Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(metaplex-mcp): surface the $THREE deploy fee in the deployer site and rebuild it

nirholas3ae4d3350f38
diff --git a/packages/metaplex-agent-mcp/README.md b/packages/metaplex-agent-mcp/README.md
index 1d4cd616f..711658308 100644
--- a/packages/metaplex-agent-mcp/README.md
+++ b/packages/metaplex-agent-mcp/README.md
@@ -13,6 +13,8 @@ Two signing lanes, both self-custodial:
- **Agents** sign with their own keypair (`SOLANA_SECRET_KEY`): `mint_onchain_agent`.
- **People** sign with Phantom, Solflare, Backpack, Ledger, or any Solana wallet: `prepare_agent_mint` builds the transaction, the wallet signs it, `send_signed_transaction` broadcasts it. No key ever touches the server.
+A mainnet deploy pays a flat **0.02 SOL** fee, in the same transaction as the mint, and that fee funds **[$THREE](https://three.ws/three) buybacks**. Hold $THREE and it halves, then disappears; devnet never pays it. Every preview shows the number and its recipient before anything is signed. See [$THREE: the deploy fee and the holder waiver](#three-the-deploy-fee-and-the-holder-waiver).
+
Nothing is mocked: real Metaplex programs, real Solana, and devnet support for free end-to-end rehearsal.
## Install
@@ -60,7 +62,9 @@ Rehearse on devnet for free, then go to mainnet:
4. get_onchain_agent { asset: "<returned asset>", network: "devnet" }
```
-The mint costs ~0.007 SOL on mainnet (Core rent + identity PDA rent + fees).
+A mainnet deploy costs ~0.027 SOL: ~0.007 in Core rent, identity PDA rent, and network fees, plus a
+flat 0.02 SOL deploy fee that funds $THREE buybacks. Holding $THREE halves that fee and then waives
+it, and devnet is free. See [$THREE](#three-the-deploy-fee-and-the-holder-waiver).
## Tools
@@ -74,6 +78,42 @@ The mint costs ~0.007 SOL on mainnet (Core rent + identity PDA rent + fees).
| `agent_wallet` | An asset's built-in wallet (mpl-core Asset Signer PDA), any address, or the configured signer, with live SOL balance. |
| `build_registration` | The EIP-8004 registration JSON + `data:` URI, fully offline. |
| `list_onchain_agents` | Latest registrations from the live three.ws `/api/deployments` feed (Solana by default, `all_chains:true` for EVM ERC-8004 too). |
+| `three_status` | Prices your next deploy: fee schedule, a wallet's live $THREE balance and tier, and the public buyback ledger. |
+
+## $THREE: the deploy fee and the holder waiver
+
+A **mainnet** deploy carries a flat **0.02 SOL** fee. Three things about it matter:
+
+- **It rides in the same transaction that creates the asset.** A deploy that fails, is rejected, or
+ expires moves no money. There is no separate payment step and nothing to reconcile.
+- **It is disclosed before anything is signed.** Every `mint_onchain_agent` preview and every
+ `prepare_agent_mint` response returns `deploy_fee_sol` and `deploy_fee_to`, with the tier that
+ produced them.
+- **It funds $THREE buybacks.** The fee is paid to the wallet the three.ws
+ [$THREE](https://three.ws/three) buyback lane spends from
+ (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump` is the mint), and the public ledger of what that
+ lane has bought is at [`/api/three-token/stats`](https://three.ws/api/three-token/stats). Deploys
+ are the only revenue this package has.
+
+**Holding $THREE makes it cheaper, then free:**
+
+| $THREE in the paying wallet | Deploy fee |
+|---|---|
+| under 50,000 | 0.02 SOL |
+| 50,000 or more | 0.01 SOL |
+| 250,000 or more | free |
+
+The balance is read live from the chain when the transaction is built. Nothing is staked, escrowed,
+locked, or spent to earn it: hold the tokens in your own wallet and keep them, and the waiver applies
+to every agent you deploy. Devnet always pays zero, so a full end-to-end rehearsal stays free.
+
+```
+three_status {} → what your next deploy costs and why
+three_status { wallet: "<any base58 address>" } → price it for someone else's wallet
+```
+
+Self-hosting a fork with different economics is `DEPLOY_FEE_SOL`, `DEPLOY_FEE_WALLET`, and
+`DEPLOY_FEE_ENABLED`.
## Customization
@@ -93,7 +133,12 @@ Every field the mint touches is a parameter: owner, collection, royalty basis po
| `SOLANA_RPC_URL` | public endpoint | HTTPS RPC. Bring your own for production traffic. |
| `METAPLEX_AGENT_NETWORK` | `mainnet` | Default cluster (`mainnet` or `devnet`); every tool takes a per-call `network` too. |
| `REQUIRE_CONFIRM` | `true` | Gate spends behind `confirm: true`. |
-| `THREE_WS_BASE` | `https://three.ws` | Host for the deployments feed. |
+| `THREE_WS_BASE` | `https://three.ws` | Host for the deployments feed and the $THREE ledger. |
+| `DEPLOY_FEE_SOL` | `0.02` | Mainnet deploy fee, in SOL. |
+| `DEPLOY_FEE_WALLET` | three.ws buyback wallet | Where the deploy fee is paid. |
+| `DEPLOY_FEE_ENABLED` | `true` | Set false to build a fork that charges nothing. |
+| `THREE_HALF_PRICE_AT` / `THREE_FREE_AT` | `50000` / `250000` | $THREE balances that halve, then waive, the fee. |
+| `THREE_MINT` | $THREE mint | Only to track an updated canonical contract. |
## Library use
@@ -120,11 +165,13 @@ The registration and metadata builders are also importable on their own (depende
## Requirements
- Node 20+
-- SOL on the target network for minting (~0.007 SOL per agent on mainnet; devnet is free via faucet)
+- SOL on the target network for minting (~0.027 SOL per agent on mainnet, or ~0.007 with the
+ holder waiver; devnet is free via faucet)
## Links
- three.ws: https://three.ws
+- $THREE: https://three.ws/three
- Live deployments feed: https://three.ws/deployments
- Metaplex Agent Registry: https://www.metaplex.com/agents
- Metaplex docs: https://www.metaplex.com/docs/agents
diff --git a/packages/metaplex-agent-mcp/docs/app.js b/packages/metaplex-agent-mcp/docs/app.js
index 28f57b5f5..bb0ec125f 100644
--- a/packages/metaplex-agent-mcp/docs/app.js
+++ b/packages/metaplex-agent-mcp/docs/app.js
@@ -1,34 +1,34 @@
-var Uq=Object.create;var Cg=Object.defineProperty;var Vq=Object.getOwnPropertyDescriptor;var Fq=Object.getOwnPropertyNames;var Kq=Object.getPrototypeOf,Wq=Object.prototype.hasOwnProperty;var Lr=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var S=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},jq=(t,e)=>{for(var r in e)Cg(t,r,{get:e[r],enumerable:!0})},kP=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Fq(e))!Wq.call(t,i)&&i!==r&&Cg(t,i,{get:()=>e[i],enumerable:!(n=Vq(e,i))||n.enumerable});return t};var Pr=(t,e,r)=>(r=t!=null?Uq(Kq(t)):{},kP(e||!t||!t.__esModule?Cg(r,"default",{value:t,enumerable:!0}):r,t)),CP=t=>kP(Cg({},"__esModule",{value:!0}),t);var LP=S(Ng=>{"use strict";a();Ng.byteLength=Gq;Ng.toByteArray=Zq;Ng.fromByteArray=Jq;var Ti=[],Fn=[],Hq=typeof Uint8Array<"u"?Uint8Array:Array,e_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ra=0,NP=e_.length;Ra<NP;++Ra)Ti[Ra]=e_[Ra],Fn[e_.charCodeAt(Ra)]=Ra;var Ra,NP;Fn[45]=62;Fn[95]=63;function MP(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Gq(t){var e=MP(t),r=e[0],n=e[1];return(r+n)*3/4-n}function $q(t,e,r){return(e+r)*3/4-r}function Zq(t){var e,r=MP(t),n=r[0],i=r[1],s=new Hq($q(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=Fn[t.charCodeAt(u)]<<18|Fn[t.charCodeAt(u+1)]<<12|Fn[t.charCodeAt(u+2)]<<6|Fn[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Fn[t.charCodeAt(u)]<<2|Fn[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Fn[t.charCodeAt(u)]<<10|Fn[t.charCodeAt(u+1)]<<4|Fn[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Yq(t){return Ti[t>>18&63]+Ti[t>>12&63]+Ti[t>>6&63]+Ti[t&63]}function Xq(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(Yq(n));return i.join("")}function Jq(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(Xq(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(Ti[e>>2]+Ti[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ti[e>>10]+Ti[e>>4&63]+Ti[e<<2&63]+"=")),i.join("")}});var DP=S(t_=>{a();t_.read=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,d=u>>1,f=-7,m=r?i-1:0,_=r?-1:1,v=t[e+m];for(m+=_,s=v&(1<<-f)-1,v>>=-f,f+=c;f>0;s=s*256+t[e+m],m+=_,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+m],m+=_,f-=8);if(s===0)s=1-d;else{if(s===u)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(v?-1:1)*o*Math.pow(2,s-n)};t_.write=function(t,e,r,n,i,s){var o,c,u,d=s*8-i-1,f=(1<<d)-1,m=f>>1,_=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,P=n?1:-1,B=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+m>=1?e+=_/u:e+=_*Math.pow(2,1-m),e*u>=2&&(o++,u/=2),o+m>=f?(c=0,o=f):o+m>=1?(c=(e*u-1)*Math.pow(2,i),o=o+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=P,c/=256,i-=8);for(o=o<<i|c,d+=i;d>0;t[r+v]=o&255,v+=P,o/=256,d-=8);t[r+v-P]|=B*128}});var Ba=S(au=>{"use strict";a();var r_=LP(),su=DP(),qP=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;au.Buffer=j;au.SlowBuffer=i4;au.INSPECT_MAX_BYTES=50;var Mg=2147483647;au.kMaxLength=Mg;j.TYPED_ARRAY_SUPPORT=Qq();!j.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function Qq(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(j.prototype,"parent",{enumerable:!0,get:function(){if(j.isBuffer(this))return this.buffer}});Object.defineProperty(j.prototype,"offset",{enumerable:!0,get:function(){if(j.isBuffer(this))return this.byteOffset}});function cs(t){if(t>Mg)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,j.prototype),e}function j(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return o_(t)}return KP(t,e,r)}j.poolSize=8192;function KP(t,e,r){if(typeof t=="string")return t4(t,e);if(ArrayBuffer.isView(t))return r4(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(zi(t,ArrayBuffer)||t&&zi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zi(t,SharedArrayBuffer)||t&&zi(t.buffer,SharedArrayBuffer)))return i_(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return j.from(n,e,r);let i=n4(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return j.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}j.from=function(t,e,r){return KP(t,e,r)};Object.setPrototypeOf(j.prototype,Uint8Array.prototype);Object.setPrototypeOf(j,Uint8Array);function WP(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function e4(t,e,r){return WP(t),t<=0?cs(t):e!==void 0?typeof r=="string"?cs(t).fill(e,r):cs(t).fill(e):cs(t)}j.alloc=function(t,e,r){return e4(t,e,r)};function o_(t){return WP(t),cs(t<0?0:a_(t)|0)}j.allocUnsafe=function(t){return o_(t)};j.allocUnsafeSlow=function(t){return o_(t)};function t4(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!j.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=jP(t,e)|0,n=cs(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function n_(t){let e=t.length<0?0:a_(t.length)|0,r=cs(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function r4(t){if(zi(t,Uint8Array)){let e=new Uint8Array(t);return i_(e.buffer,e.byteOffset,e.byteLength)}return n_(t)}function i_(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,j.prototype),n}function n4(t){if(j.isBuffer(t)){let e=a_(t.length)|0,r=cs(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||u_(t.length)?cs(0):n_(t);if(t.type==="Buffer"&&Array.isArray(t.data))return n_(t.data)}function a_(t){if(t>=Mg)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mg.toString(16)+" bytes");return t|0}function i4(t){return+t!=t&&(t=0),j.alloc(+t)}j.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==j.prototype};j.compare=function(e,r){if(zi(e,Uint8Array)&&(e=j.from(e,e.offset,e.byteLength)),zi(r,Uint8Array)&&(r=j.from(r,r.offset,r.byteLength)),!j.isBuffer(e)||!j.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};j.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}};j.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return j.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=j.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(zi(o,Uint8Array))s+o.length>i.length?(j.isBuffer(o)||(o=j.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(j.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function jP(t,e){if(j.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||zi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return s_(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return eR(t).length;default:if(i)return n?-1:s_(t).length;e=(""+e).toLowerCase(),i=!0}}j.byteLength=jP;function s4(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return g4(this,e,r);case"utf8":case"utf-8":return GP(this,e,r);case"ascii":return h4(this,e,r);case"latin1":case"binary":return p4(this,e,r);case"base64":return d4(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y4(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}j.prototype._isBuffer=!0;function Oa(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}j.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Oa(this,r,r+1);return this};j.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Oa(this,r,r+3),Oa(this,r+1,r+2);return this};j.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Oa(this,r,r+7),Oa(this,r+1,r+6),Oa(this,r+2,r+5),Oa(this,r+3,r+4);return this};j.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?GP(this,0,e):s4.apply(this,arguments)};j.prototype.toLocaleString=j.prototype.toString;j.prototype.equals=function(e){if(!j.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:j.compare(this,e)===0};j.prototype.inspect=function(){let e="",r=au.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};qP&&(j.prototype[qP]=j.prototype.inspect);j.prototype.compare=function(e,r,n,i,s){if(zi(e,Uint8Array)&&(e=j.from(e,e.offset,e.byteLength)),!j.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,c=n-r,u=Math.min(o,c),d=this.slice(i,s),f=e.slice(r,n);for(let m=0;m<u;++m)if(d[m]!==f[m]){o=d[m],c=f[m];break}return o<c?-1:c<o?1:0};function HP(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,u_(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=j.from(e,n)),j.isBuffer(e))return e.length===0?-1:UP(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):UP(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function UP(t,e,r,n,i){let s=1,o=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,c/=2,r/=2}function u(f,m){return s===1?f[m]:f.readUInt16BE(m*s)}let d;if(i){let f=-1;for(d=r;d<o;d++)if(u(t,d)===u(e,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*s}else f!==-1&&(d-=d-f),f=-1}else for(r+c>o&&(r=o-c),d=r;d>=0;d--){let f=!0;for(let m=0;m<c;m++)if(u(t,d+m)!==u(e,m)){f=!1;break}if(f)return d}return-1}j.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};j.prototype.indexOf=function(e,r,n){return HP(this,e,r,n,!0)};j.prototype.lastIndexOf=function(e,r,n){return HP(this,e,r,n,!1)};function o4(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let c=parseInt(e.substr(o*2,2),16);if(u_(c))return o;t[r+o]=c}return o}function a4(t,e,r,n){return Lg(s_(e,t.length-r),t,r,n)}function c4(t,e,r,n){return Lg(A4(e),t,r,n)}function u4(t,e,r,n){return Lg(eR(e),t,r,n)}function l4(t,e,r,n){return Lg(S4(e,t.length-r),t,r,n)}j.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return o4(this,e,r,n);case"utf8":case"utf-8":return a4(this,e,r,n);case"ascii":case"latin1":case"binary":return c4(this,e,r,n);case"base64":return u4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l4(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};j.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function d4(t,e,r){return e===0&&r===t.length?r_.fromByteArray(t):r_.fromByteArray(t.slice(e,r))}function GP(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=r){let u,d,f,m;switch(c){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(m=(s&31)<<6|u&63,m>127&&(o=m));break;case 3:u=t[i+1],d=t[i+2],(u&192)===128&&(d&192)===128&&(m=(s&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(o=m));break;case 4:u=t[i+1],d=t[i+2],f=t[i+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(s&15)<<18|(u&63)<<12|(d&63)<<6|f&63,m>65535&&m<1114112&&(o=m))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return f4(n)}var VP=4096;function f4(t){let e=t.length;if(e<=VP)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=VP));return r}function h4(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function p4(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function g4(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=v4[t[s]];return i}function y4(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}j.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,j.prototype),i};function fr(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}j.prototype.readUintLE=j.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||fr(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};j.prototype.readUintBE=j.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||fr(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};j.prototype.readUint8=j.prototype.readUInt8=function(e,r){return e=e>>>0,r||fr(e,1,this.length),this[e]};j.prototype.readUint16LE=j.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||fr(e,2,this.length),this[e]|this[e+1]<<8};j.prototype.readUint16BE=j.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||fr(e,2,this.length),this[e]<<8|this[e+1]};j.prototype.readUint32LE=j.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};j.prototype.readUint32BE=j.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};j.prototype.readBigUInt64LE=Ys(function(e){e=e>>>0,ou(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Vd(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});j.prototype.readBigUInt64BE=Ys(function(e){e=e>>>0,ou(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Vd(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});j.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||fr(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};j.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||fr(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};j.prototype.readInt8=function(e,r){return e=e>>>0,r||fr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};j.prototype.readInt16LE=function(e,r){e=e>>>0,r||fr(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};j.prototype.readInt16BE=function(e,r){e=e>>>0,r||fr(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};j.prototype.readInt32LE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};j.prototype.readInt32BE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};j.prototype.readBigInt64LE=Ys(function(e){e=e>>>0,ou(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Vd(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});j.prototype.readBigInt64BE=Ys(function(e){e=e>>>0,ou(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Vd(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});j.prototype.readFloatLE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),su.read(this,e,!0,23,4)};j.prototype.readFloatBE=function(e,r){return e=e>>>0,r||fr(e,4,this.length),su.read(this,e,!1,23,4)};j.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||fr(e,8,this.length),su.read(this,e,!0,52,8)};j.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||fr(e,8,this.length),su.read(this,e,!1,52,8)};function dn(t,e,r,n,i,s){if(!j.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}j.prototype.writeUintLE=j.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;dn(this,e,r,n,c,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};j.prototype.writeUintBE=j.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;dn(this,e,r,n,c,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};j.prototype.writeUint8=j.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,1,255,0),this[r]=e&255,r+1};j.prototype.writeUint16LE=j.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};j.prototype.writeUint16BE=j.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};j.prototype.writeUint32LE=j.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};j.prototype.writeUint32BE=j.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function $P(t,e,r,n,i){QP(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function ZP(t,e,r,n,i){QP(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}j.prototype.writeBigUInt64LE=Ys(function(e,r=0){return $P(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});j.prototype.writeBigUInt64BE=Ys(function(e,r=0){return ZP(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});j.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dn(this,e,r,n,u-1,-u)}let s=0,o=1,c=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&c===0&&this[r+s-1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};j.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dn(this,e,r,n,u-1,-u)}let s=n-1,o=1,c=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&c===0&&this[r+s+1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};j.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};j.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};j.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};j.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};j.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dn(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};j.prototype.writeBigInt64LE=Ys(function(e,r=0){return $P(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});j.prototype.writeBigInt64BE=Ys(function(e,r=0){return ZP(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function YP(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function XP(t,e,r,n,i){return e=+e,r=r>>>0,i||YP(t,e,r,4,34028234663852886e22,-34028234663852886e22),su.write(t,e,r,n,23,4),r+4}j.prototype.writeFloatLE=function(e,r,n){return XP(this,e,r,!0,n)};j.prototype.writeFloatBE=function(e,r,n){return XP(this,e,r,!1,n)};function JP(t,e,r,n,i){return e=+e,r=r>>>0,i||YP(t,e,r,8,17976931348623157e292,-17976931348623157e292),su.write(t,e,r,n,52,8),r+8}j.prototype.writeDoubleLE=function(e,r,n){return JP(this,e,r,!0,n)};j.prototype.writeDoubleBE=function(e,r,n){return JP(this,e,r,!1,n)};j.prototype.copy=function(e,r,n,i){if(!j.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};j.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!j.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=j.isBuffer(e)?e:j.from(e,i),c=o.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%c]}return this};var iu={};function c_(t,e,r){iu[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}c_("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);c_("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);c_("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=FP(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=FP(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function FP(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function m4(t,e,r){ou(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Vd(e,t.length-(r+1))}function QP(t,e,r,n,i,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",c;throw s>3?e===0||e===BigInt(0)?c=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:c=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:c=`>= ${e}${o} and <= ${r}${o}`,new iu.ERR_OUT_OF_RANGE("value",c,t)}m4(n,i,s)}function ou(t,e){if(typeof t!="number")throw new iu.ERR_INVALID_ARG_TYPE(e,"number",t)}function Vd(t,e,r){throw Math.floor(t)!==t?(ou(t,r),new iu.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new iu.ERR_BUFFER_OUT_OF_BOUNDS:new iu.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var b4=/[^+/0-9A-Za-z-_]/g;function _4(t){if(t=t.split("=")[0],t=t.trim().replace(b4,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function s_(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function A4(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function S4(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function eR(t){return r_.toByteArray(_4(t))}function Lg(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function zi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function u_(t){return t!==t}var v4=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function Ys(t){return typeof BigInt>"u"?E4:t}function E4(){throw new Error("BigInt not supported")}});var p,g,a=Lr(()=>{"use strict";p=Pr(Ba(),1),g={env:{},browser:!0,version:"",nextTick:(t,...e)=>queueMicrotask(()=>t(...e))}});var tO=S(()=>{a()});var yA=S((rO,gA)=>{a();(function(t,e){"use strict";function r(w,l){if(!w)throw new Error(l||"Assertion failed")}function n(w,l){w.super_=l;var h=function(){};h.prototype=l.prototype,w.prototype=new h,w.prototype.constructor=w}function i(w,l,h){if(i.isBN(w))return w;this.negative=0,this.words=null,this.length=0,this.red=null,w!==null&&((l==="le"||l==="be")&&(h=l,l=10),this._init(w||0,l||10,h||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=tO().Buffer}catch{}i.isBN=function(l){return l instanceof i?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===i.wordSize&&Array.isArray(l.words)},i.max=function(l,h){return l.cmp(h)>0?l:h},i.min=function(l,h){return l.cmp(h)<0?l:h},i.prototype._init=function(l,h,A){if(typeof l=="number")return this._initNumber(l,h,A);if(typeof l=="object")return this._initArray(l,h,A);h==="hex"&&(h=16),r(h===(h|0)&&h>=2&&h<=36),l=l.toString().replace(/\s+/g,"");var E=0;l[0]==="-"&&(E++,this.negative=1),E<l.length&&(h===16?this._parseHex(l,E,A):(this._parseBase(l,h,E),A==="le"&&this._initArray(this.toArray(),h,A)))},i.prototype._initNumber=function(l,h,A){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(r(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),A==="le"&&this._initArray(this.toArray(),h,A)},i.prototype._initArray=function(l,h,A){if(r(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var x,O,C=0;if(A==="be")for(E=l.length-1,x=0;E>=0;E-=3)O=l[E]|l[E-1]<<8|l[E-2]<<16,this.words[x]|=O<<C&67108863,this.words[x+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,x++);else if(A==="le")for(E=0,x=0;E<l.length;E+=3)O=l[E]|l[E+1]<<8|l[E+2]<<16,this.words[x]|=O<<C&67108863,this.words[x+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,x++);return this._strip()};function o(w,l){var h=w.charCodeAt(l);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;r(!1,"Invalid character in "+w)}function c(w,l,h){var A=o(w,h);return h-1>=l&&(A|=o(w,h-1)<<4),A}i.prototype._parseHex=function(l,h,A){this.length=Math.ceil((l.length-h)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var x=0,O=0,C;if(A==="be")for(E=l.length-1;E>=h;E-=2)C=c(l,h,E)<<x,this.words[O]|=C&67108863,x>=18?(x-=18,O+=1,this.words[O]|=C>>>26):x+=8;else{var I=l.length-h;for(E=I%2===0?h+1:h;E<l.length;E+=2)C=c(l,h,E)<<x,this.words[O]|=C&67108863,x>=18?(x-=18,O+=1,this.words[O]|=C>>>26):x+=8}this._strip()};function u(w,l,h,A){for(var E=0,x=0,O=Math.min(w.length,h),C=l;C<O;C++){var I=w.charCodeAt(C)-48;E*=A,I>=49?x=I-49+10:I>=17?x=I-17+10:x=I,r(I>=0&&x<A,"Invalid character"),E+=x}return E}i.prototype._parseBase=function(l,h,A){this.words=[0],this.length=1;for(var E=0,x=1;x<=67108863;x*=h)E++;E--,x=x/h|0;for(var O=l.length-A,C=O%E,I=Math.min(O,O-C)+A,b=0,R=A;R<I;R+=E)b=u(l,R,R+E,h),this.imuln(x),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b);if(C!==0){var ee=1;for(b=u(l,R,l.length,h),R=0;R<C;R++)ee*=h;this.imuln(ee),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b)}this._strip()},i.prototype.copy=function(l){l.words=new Array(this.length);for(var h=0;h<this.length;h++)l.words[h]=this.words[h];l.length=this.length,l.negative=this.negative,l.red=this.red};function d(w,l){w.words=l.words,w.length=l.length,w.negative=l.negative,w.red=l.red}if(i.prototype._move=function(l){d(l,this)},i.prototype.clone=function(){var l=new i(null);return this.copy(l),l},i.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var m=["","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"],_=[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],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(l,h){l=l||10,h=h|0||1;var A;if(l===16||l==="hex"){A="";for(var E=0,x=0,O=0;O<this.length;O++){var C=this.words[O],I=((C<<E|x)&16777215).toString(16);x=C>>>24-E&16777215,E+=2,E>=26&&(E-=26,O--),x!==0||O!==this.length-1?A=m[6-I.length]+I+A:A=I+A}for(x!==0&&(A=x.toString(16)+A);A.length%h!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(l===(l|0)&&l>=2&&l<=36){var b=_[l],R=v[l];A="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var te=ee.modrn(R).toString(l);ee=ee.idivn(R),ee.isZero()?A=te+A:A=m[b-te.length]+te+A}for(this.isZero()&&(A="0"+A);A.length%h!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(l,h){return this.toArrayLike(s,l,h)}),i.prototype.toArray=function(l,h){return this.toArrayLike(Array,l,h)};var P=function(l,h){return l.allocUnsafe?l.allocUnsafe(h):new l(h)};i.prototype.toArrayLike=function(l,h,A){this._strip();var E=this.byteLength(),x=A||Math.max(1,E);r(E<=x,"byte array longer than desired length"),r(x>0,"Requested array length <= 0");var O=P(l,x),C=h==="le"?"LE":"BE";return this["_toArrayLike"+C](O,E),O},i.prototype._toArrayLikeLE=function(l,h){for(var A=0,E=0,x=0,O=0;x<this.length;x++){var C=this.words[x]<<O|E;l[A++]=C&255,A<l.length&&(l[A++]=C>>8&255),A<l.length&&(l[A++]=C>>16&255),O===6?(A<l.length&&(l[A++]=C>>24&255),E=0,O=0):(E=C>>>24,O+=2)}if(A<l.length)for(l[A++]=E;A<l.length;)l[A++]=0},i.prototype._toArrayLikeBE=function(l,h){for(var A=l.length-1,E=0,x=0,O=0;x<this.length;x++){var C=this.words[x]<<O|E;l[A--]=C&255,A>=0&&(l[A--]=C>>8&255),A>=0&&(l[A--]=C>>16&255),O===6?(A>=0&&(l[A--]=C>>24&255),E=0,O=0):(E=C>>>24,O+=2)}if(A>=0)for(l[A--]=E;A>=0;)l[A--]=0},Math.clz32?i.prototype._countBits=function(l){return 32-Math.clz32(l)}:i.prototype._countBits=function(l){var h=l,A=0;return h>=4096&&(A+=13,h>>>=13),h>=64&&(A+=7,h>>>=7),h>=8&&(A+=4,h>>>=4),h>=2&&(A+=2,h>>>=2),A+h},i.prototype._zeroBits=function(l){if(l===0)return 26;var h=l,A=0;return(h&8191)===0&&(A+=13,h>>>=13),(h&127)===0&&(A+=7,h>>>=7),(h&15)===0&&(A+=4,h>>>=4),(h&3)===0&&(A+=2,h>>>=2),(h&1)===0&&A++,A},i.prototype.bitLength=function(){var l=this.words[this.length-1],h=this._countBits(l);return(this.length-1)*26+h};function B(w){for(var l=new Array(w.bitLength()),h=0;h<l.length;h++){var A=h/26|0,E=h%26;l[h]=w.words[A]>>>E&1}return l}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,h=0;h<this.length;h++){var A=this._zeroBits(this.words[h]);if(l+=A,A!==26)break}return l},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},i.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var h=0;h<l.length;h++)this.words[h]=this.words[h]|l.words[h];return this._strip()},i.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},i.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},i.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},i.prototype.iuand=function(l){var h;this.length>l.length?h=l:h=this;for(var A=0;A<h.length;A++)this.words[A]=this.words[A]&l.words[A];return this.length=h.length,this._strip()},i.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},i.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},i.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},i.prototype.iuxor=function(l){var h,A;this.length>l.length?(h=this,A=l):(h=l,A=this);for(var E=0;E<A.length;E++)this.words[E]=h.words[E]^A.words[E];if(this!==h)for(;E<h.length;E++)this.words[E]=h.words[E];return this.length=h.length,this._strip()},i.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},i.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},i.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},i.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var h=Math.ceil(l/26)|0,A=l%26;this._expand(h),A>0&&h--;for(var E=0;E<h;E++)this.words[E]=~this.words[E]&67108863;return A>0&&(this.words[E]=~this.words[E]&67108863>>26-A),this._strip()},i.prototype.notn=function(l){return this.clone().inotn(l)},i.prototype.setn=function(l,h){r(typeof l=="number"&&l>=0);var A=l/26|0,E=l%26;return this._expand(A+1),h?this.words[A]=this.words[A]|1<<E:this.words[A]=this.words[A]&~(1<<E),this._strip()},i.prototype.iadd=function(l){var h;if(this.negative!==0&&l.negative===0)return this.negative=0,h=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,h=this.isub(l),l.negative=1,h._normSign();var A,E;this.length>l.length?(A=this,E=l):(A=l,E=this);for(var x=0,O=0;O<E.length;O++)h=(A.words[O]|0)+(E.words[O]|0)+x,this.words[O]=h&67108863,x=h>>>26;for(;x!==0&&O<A.length;O++)h=(A.words[O]|0)+x,this.words[O]=h&67108863,x=h>>>26;if(this.length=A.length,x!==0)this.words[this.length]=x,this.length++;else if(A!==this)for(;O<A.length;O++)this.words[O]=A.words[O];return this},i.prototype.add=function(l){var h;return l.negative!==0&&this.negative===0?(l.negative=0,h=this.sub(l),l.negative^=1,h):l.negative===0&&this.negative!==0?(this.negative=0,h=l.sub(this),this.negative=1,h):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},i.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var h=this.iadd(l);return l.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var A=this.cmp(l);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,x;A>0?(E=this,x=l):(E=l,x=this);for(var O=0,C=0;C<x.length;C++)h=(E.words[C]|0)-(x.words[C]|0)+O,O=h>>26,this.words[C]=h&67108863;for(;O!==0&&C<E.length;C++)h=(E.words[C]|0)+O,O=h>>26,this.words[C]=h&67108863;if(O===0&&C<E.length&&E!==this)for(;C<E.length;C++)this.words[C]=E.words[C];return this.length=Math.max(this.length,C),E!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(l){return this.clone().isub(l)};function k(w,l,h){h.negative=l.negative^w.negative;var A=w.length+l.length|0;h.length=A,A=A-1|0;var E=w.words[0]|0,x=l.words[0]|0,O=E*x,C=O&67108863,I=O/67108864|0;h.words[0]=C;for(var b=1;b<A;b++){for(var R=I>>>26,ee=I&67108863,te=Math.min(b,l.length-1),oe=Math.max(0,b-w.length+1);oe<=te;oe++){var de=b-oe|0;E=w.words[de]|0,x=l.words[oe]|0,O=E*x+ee,R+=O/67108864|0,ee=O&67108863}h.words[b]=ee|0,I=R|0}return I!==0?h.words[b]=I|0:h.length--,h._strip()}var T=function(l,h,A){var E=l.words,x=h.words,O=A.words,C=0,I,b,R,ee=E[0]|0,te=ee&8191,oe=ee>>>13,de=E[1]|0,xe=de&8191,Se=de>>>13,Qe=E[2]|0,Ue=Qe&8191,Ze=Qe>>>13,Ud=E[3]|0,xt=Ud&8191,It=Ud>>>13,mP=E[4]|0,Pt=mP&8191,Rt=mP>>>13,bP=E[5]|0,Ot=bP&8191,Bt=bP>>>13,_P=E[6]|0,Tt=_P&8191,zt=_P>>>13,AP=E[7]|0,kt=AP&8191,Ct=AP>>>13,SP=E[8]|0,Nt=SP&8191,Mt=SP>>>13,vP=E[9]|0,Lt=vP&8191,Dt=vP>>>13,EP=x[0]|0,qt=EP&8191,Ut=EP>>>13,wP=x[1]|0,Vt=wP&8191,Ft=wP>>>13,xP=x[2]|0,Kt=xP&8191,Wt=xP>>>13,IP=x[3]|0,jt=IP&8191,Ht=IP>>>13,PP=x[4]|0,Gt=PP&8191,$t=PP>>>13,RP=x[5]|0,Zt=RP&8191,Yt=RP>>>13,OP=x[6]|0,Xt=OP&8191,Jt=OP>>>13,BP=x[7]|0,Qt=BP&8191,er=BP>>>13,TP=x[8]|0,tr=TP&8191,rr=TP>>>13,zP=x[9]|0,nr=zP&8191,ir=zP>>>13;A.negative=l.negative^h.negative,A.length=19,I=Math.imul(te,qt),b=Math.imul(te,Ut),b=b+Math.imul(oe,qt)|0,R=Math.imul(oe,Ut);var Nb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Nb>>>26)|0,Nb&=67108863,I=Math.imul(xe,qt),b=Math.imul(xe,Ut),b=b+Math.imul(Se,qt)|0,R=Math.imul(Se,Ut),I=I+Math.imul(te,Vt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(oe,Vt)|0,R=R+Math.imul(oe,Ft)|0;var Mb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Mb>>>26)|0,Mb&=67108863,I=Math.imul(Ue,qt),b=Math.imul(Ue,Ut),b=b+Math.imul(Ze,qt)|0,R=Math.imul(Ze,Ut),I=I+Math.imul(xe,Vt)|0,b=b+Math.imul(xe,Ft)|0,b=b+Math.imul(Se,Vt)|0,R=R+Math.imul(Se,Ft)|0,I=I+Math.imul(te,Kt)|0,b=b+Math.imul(te,Wt)|0,b=b+Math.imul(oe,Kt)|0,R=R+Math.imul(oe,Wt)|0;var Lb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Lb>>>26)|0,Lb&=67108863,I=Math.imul(xt,qt),b=Math.imul(xt,Ut),b=b+Math.imul(It,qt)|0,R=Math.imul(It,Ut),I=I+Math.imul(Ue,Vt)|0,b=b+Math.imul(Ue,Ft)|0,b=b+Math.imul(Ze,Vt)|0,R=R+Math.imul(Ze,Ft)|0,I=I+Math.imul(xe,Kt)|0,b=b+Math.imul(xe,Wt)|0,b=b+Math.imul(Se,Kt)|0,R=R+Math.imul(Se,Wt)|0,I=I+Math.imul(te,jt)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(oe,jt)|0,R=R+Math.imul(oe,Ht)|0;var Db=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Db>>>26)|0,Db&=67108863,I=Math.imul(Pt,qt),b=Math.imul(Pt,Ut),b=b+Math.imul(Rt,qt)|0,R=Math.imul(Rt,Ut),I=I+Math.imul(xt,Vt)|0,b=b+Math.imul(xt,Ft)|0,b=b+Math.imul(It,Vt)|0,R=R+Math.imul(It,Ft)|0,I=I+Math.imul(Ue,Kt)|0,b=b+Math.imul(Ue,Wt)|0,b=b+Math.imul(Ze,Kt)|0,R=R+Math.imul(Ze,Wt)|0,I=I+Math.imul(xe,jt)|0,b=b+Math.imul(xe,Ht)|0,b=b+Math.imul(Se,jt)|0,R=R+Math.imul(Se,Ht)|0,I=I+Math.imul(te,Gt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(oe,Gt)|0,R=R+Math.imul(oe,$t)|0;var qb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(qb>>>26)|0,qb&=67108863,I=Math.imul(Ot,qt),b=Math.imul(Ot,Ut),b=b+Math.imul(Bt,qt)|0,R=Math.imul(Bt,Ut),I=I+Math.imul(Pt,Vt)|0,b=b+Math.imul(Pt,Ft)|0,b=b+Math.imul(Rt,Vt)|0,R=R+Math.imul(Rt,Ft)|0,I=I+Math.imul(xt,Kt)|0,b=b+Math.imul(xt,Wt)|0,b=b+Math.imul(It,Kt)|0,R=R+Math.imul(It,Wt)|0,I=I+Math.imul(Ue,jt)|0,b=b+Math.imul(Ue,Ht)|0,b=b+Math.imul(Ze,jt)|0,R=R+Math.imul(Ze,Ht)|0,I=I+Math.imul(xe,Gt)|0,b=b+Math.imul(xe,$t)|0,b=b+Math.imul(Se,Gt)|0,R=R+Math.imul(Se,$t)|0,I=I+Math.imul(te,Zt)|0,b=b+Math.imul(te,Yt)|0,b=b+Math.imul(oe,Zt)|0,R=R+Math.imul(oe,Yt)|0;var Ub=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Ub>>>26)|0,Ub&=67108863,I=Math.imul(Tt,qt),b=Math.imul(Tt,Ut),b=b+Math.imul(zt,qt)|0,R=Math.imul(zt,Ut),I=I+Math.imul(Ot,Vt)|0,b=b+Math.imul(Ot,Ft)|0,b=b+Math.imul(Bt,Vt)|0,R=R+Math.imul(Bt,Ft)|0,I=I+Math.imul(Pt,Kt)|0,b=b+Math.imul(Pt,Wt)|0,b=b+Math.imul(Rt,Kt)|0,R=R+Math.imul(Rt,Wt)|0,I=I+Math.imul(xt,jt)|0,b=b+Math.imul(xt,Ht)|0,b=b+Math.imul(It,jt)|0,R=R+Math.imul(It,Ht)|0,I=I+Math.imul(Ue,Gt)|0,b=b+Math.imul(Ue,$t)|0,b=b+Math.imul(Ze,Gt)|0,R=R+Math.imul(Ze,$t)|0,I=I+Math.imul(xe,Zt)|0,b=b+Math.imul(xe,Yt)|0,b=b+Math.imul(Se,Zt)|0,R=R+Math.imul(Se,Yt)|0,I=I+Math.imul(te,Xt)|0,b=b+Math.imul(te,Jt)|0,b=b+Math.imul(oe,Xt)|0,R=R+Math.imul(oe,Jt)|0;var Vb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Vb>>>26)|0,Vb&=67108863,I=Math.imul(kt,qt),b=Math.imul(kt,Ut),b=b+Math.imul(Ct,qt)|0,R=Math.imul(Ct,Ut),I=I+Math.imul(Tt,Vt)|0,b=b+Math.imul(Tt,Ft)|0,b=b+Math.imul(zt,Vt)|0,R=R+Math.imul(zt,Ft)|0,I=I+Math.imul(Ot,Kt)|0,b=b+Math.imul(Ot,Wt)|0,b=b+Math.imul(Bt,Kt)|0,R=R+Math.imul(Bt,Wt)|0,I=I+Math.imul(Pt,jt)|0,b=b+Math.imul(Pt,Ht)|0,b=b+Math.imul(Rt,jt)|0,R=R+Math.imul(Rt,Ht)|0,I=I+Math.imul(xt,Gt)|0,b=b+Math.imul(xt,$t)|0,b=b+Math.imul(It,Gt)|0,R=R+Math.imul(It,$t)|0,I=I+Math.imul(Ue,Zt)|0,b=b+Math.imul(Ue,Yt)|0,b=b+Math.imul(Ze,Zt)|0,R=R+Math.imul(Ze,Yt)|0,I=I+Math.imul(xe,Xt)|0,b=b+Math.imul(xe,Jt)|0,b=b+Math.imul(Se,Xt)|0,R=R+Math.imul(Se,Jt)|0,I=I+Math.imul(te,Qt)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(oe,Qt)|0,R=R+Math.imul(oe,er)|0;var Fb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Fb>>>26)|0,Fb&=67108863,I=Math.imul(Nt,qt),b=Math.imul(Nt,Ut),b=b+Math.imul(Mt,qt)|0,R=Math.imul(Mt,Ut),I=I+Math.imul(kt,Vt)|0,b=b+Math.imul(kt,Ft)|0,b=b+Math.imul(Ct,Vt)|0,R=R+Math.imul(Ct,Ft)|0,I=I+Math.imul(Tt,Kt)|0,b=b+Math.imul(Tt,Wt)|0,b=b+Math.imul(zt,Kt)|0,R=R+Math.imul(zt,Wt)|0,I=I+Math.imul(Ot,jt)|0,b=b+Math.imul(Ot,Ht)|0,b=b+Math.imul(Bt,jt)|0,R=R+Math.imul(Bt,Ht)|0,I=I+Math.imul(Pt,Gt)|0,b=b+Math.imul(Pt,$t)|0,b=b+Math.imul(Rt,Gt)|0,R=R+Math.imul(Rt,$t)|0,I=I+Math.imul(xt,Zt)|0,b=b+Math.imul(xt,Yt)|0,b=b+Math.imul(It,Zt)|0,R=R+Math.imul(It,Yt)|0,I=I+Math.imul(Ue,Xt)|0,b=b+Math.imul(Ue,Jt)|0,b=b+Math.imul(Ze,Xt)|0,R=R+Math.imul(Ze,Jt)|0,I=I+Math.imul(xe,Qt)|0,b=b+Math.imul(xe,er)|0,b=b+Math.imul(Se,Qt)|0,R=R+Math.imul(Se,er)|0,I=I+Math.imul(te,tr)|0,b=b+Math.imul(te,rr)|0,b=b+Math.imul(oe,tr)|0,R=R+Math.imul(oe,rr)|0;var Kb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Kb>>>26)|0,Kb&=67108863,I=Math.imul(Lt,qt),b=Math.imul(Lt,Ut),b=b+Math.imul(Dt,qt)|0,R=Math.imul(Dt,Ut),I=I+Math.imul(Nt,Vt)|0,b=b+Math.imul(Nt,Ft)|0,b=b+Math.imul(Mt,Vt)|0,R=R+Math.imul(Mt,Ft)|0,I=I+Math.imul(kt,Kt)|0,b=b+Math.imul(kt,Wt)|0,b=b+Math.imul(Ct,Kt)|0,R=R+Math.imul(Ct,Wt)|0,I=I+Math.imul(Tt,jt)|0,b=b+Math.imul(Tt,Ht)|0,b=b+Math.imul(zt,jt)|0,R=R+Math.imul(zt,Ht)|0,I=I+Math.imul(Ot,Gt)|0,b=b+Math.imul(Ot,$t)|0,b=b+Math.imul(Bt,Gt)|0,R=R+Math.imul(Bt,$t)|0,I=I+Math.imul(Pt,Zt)|0,b=b+Math.imul(Pt,Yt)|0,b=b+Math.imul(Rt,Zt)|0,R=R+Math.imul(Rt,Yt)|0,I=I+Math.imul(xt,Xt)|0,b=b+Math.imul(xt,Jt)|0,b=b+Math.imul(It,Xt)|0,R=R+Math.imul(It,Jt)|0,I=I+Math.imul(Ue,Qt)|0,b=b+Math.imul(Ue,er)|0,b=b+Math.imul(Ze,Qt)|0,R=R+Math.imul(Ze,er)|0,I=I+Math.imul(xe,tr)|0,b=b+Math.imul(xe,rr)|0,b=b+Math.imul(Se,tr)|0,R=R+Math.imul(Se,rr)|0,I=I+Math.imul(te,nr)|0,b=b+Math.imul(te,ir)|0,b=b+Math.imul(oe,nr)|0,R=R+Math.imul(oe,ir)|0;var Wb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Wb>>>26)|0,Wb&=67108863,I=Math.imul(Lt,Vt),b=Math.imul(Lt,Ft),b=b+Math.imul(Dt,Vt)|0,R=Math.imul(Dt,Ft),I=I+Math.imul(Nt,Kt)|0,b=b+Math.imul(Nt,Wt)|0,b=b+Math.imul(Mt,Kt)|0,R=R+Math.imul(Mt,Wt)|0,I=I+Math.imul(kt,jt)|0,b=b+Math.imul(kt,Ht)|0,b=b+Math.imul(Ct,jt)|0,R=R+Math.imul(Ct,Ht)|0,I=I+Math.imul(Tt,Gt)|0,b=b+Math.imul(Tt,$t)|0,b=b+Math.imul(zt,Gt)|0,R=R+Math.imul(zt,$t)|0,I=I+Math.imul(Ot,Zt)|0,b=b+Math.imul(Ot,Yt)|0,b=b+Math.imul(Bt,Zt)|0,R=R+Math.imul(Bt,Yt)|0,I=I+Math.imul(Pt,Xt)|0,b=b+Math.imul(Pt,Jt)|0,b=b+Math.imul(Rt,Xt)|0,R=R+Math.imul(Rt,Jt)|0,I=I+Math.imul(xt,Qt)|0,b=b+Math.imul(xt,er)|0,b=b+Math.imul(It,Qt)|0,R=R+Math.imul(It,er)|0,I=I+Math.imul(Ue,tr)|0,b=b+Math.imul(Ue,rr)|0,b=b+Math.imul(Ze,tr)|0,R=R+Math.imul(Ze,rr)|0,I=I+Math.imul(xe,nr)|0,b=b+Math.imul(xe,ir)|0,b=b+Math.imul(Se,nr)|0,R=R+Math.imul(Se,ir)|0;var jb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(jb>>>26)|0,jb&=67108863,I=Math.imul(Lt,Kt),b=Math.imul(Lt,Wt),b=b+Math.imul(Dt,Kt)|0,R=Math.imul(Dt,Wt),I=I+Math.imul(Nt,jt)|0,b=b+Math.imul(Nt,Ht)|0,b=b+Math.imul(Mt,jt)|0,R=R+Math.imul(Mt,Ht)|0,I=I+Math.imul(kt,Gt)|0,b=b+Math.imul(kt,$t)|0,b=b+Math.imul(Ct,Gt)|0,R=R+Math.imul(Ct,$t)|0,I=I+Math.imul(Tt,Zt)|0,b=b+Math.imul(Tt,Yt)|0,b=b+Math.imul(zt,Zt)|0,R=R+Math.imul(zt,Yt)|0,I=I+Math.imul(Ot,Xt)|0,b=b+Math.imul(Ot,Jt)|0,b=b+Math.imul(Bt,Xt)|0,R=R+Math.imul(Bt,Jt)|0,I=I+Math.imul(Pt,Qt)|0,b=b+Math.imul(Pt,er)|0,b=b+Math.imul(Rt,Qt)|0,R=R+Math.imul(Rt,er)|0,I=I+Math.imul(xt,tr)|0,b=b+Math.imul(xt,rr)|0,b=b+Math.imul(It,tr)|0,R=R+Math.imul(It,rr)|0,I=I+Math.imul(Ue,nr)|0,b=b+Math.imul(Ue,ir)|0,b=b+Math.imul(Ze,nr)|0,R=R+Math.imul(Ze,ir)|0;var Hb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Hb>>>26)|0,Hb&=67108863,I=Math.imul(Lt,jt),b=Math.imul(Lt,Ht),b=b+Math.imul(Dt,jt)|0,R=Math.imul(Dt,Ht),I=I+Math.imul(Nt,Gt)|0,b=b+Math.imul(Nt,$t)|0,b=b+Math.imul(Mt,Gt)|0,R=R+Math.imul(Mt,$t)|0,I=I+Math.imul(kt,Zt)|0,b=b+Math.imul(kt,Yt)|0,b=b+Math.imul(Ct,Zt)|0,R=R+Math.imul(Ct,Yt)|0,I=I+Math.imul(Tt,Xt)|0,b=b+Math.imul(Tt,Jt)|0,b=b+Math.imul(zt,Xt)|0,R=R+Math.imul(zt,Jt)|0,I=I+Math.imul(Ot,Qt)|0,b=b+Math.imul(Ot,er)|0,b=b+Math.imul(Bt,Qt)|0,R=R+Math.imul(Bt,er)|0,I=I+Math.imul(Pt,tr)|0,b=b+Math.imul(Pt,rr)|0,b=b+Math.imul(Rt,tr)|0,R=R+Math.imul(Rt,rr)|0,I=I+Math.imul(xt,nr)|0,b=b+Math.imul(xt,ir)|0,b=b+Math.imul(It,nr)|0,R=R+Math.imul(It,ir)|0;var Gb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Gb>>>26)|0,Gb&=67108863,I=Math.imul(Lt,Gt),b=Math.imul(Lt,$t),b=b+Math.imul(Dt,Gt)|0,R=Math.imul(Dt,$t),I=I+Math.imul(Nt,Zt)|0,b=b+Math.imul(Nt,Yt)|0,b=b+Math.imul(Mt,Zt)|0,R=R+Math.imul(Mt,Yt)|0,I=I+Math.imul(kt,Xt)|0,b=b+Math.imul(kt,Jt)|0,b=b+Math.imul(Ct,Xt)|0,R=R+Math.imul(Ct,Jt)|0,I=I+Math.imul(Tt,Qt)|0,b=b+Math.imul(Tt,er)|0,b=b+Math.imul(zt,Qt)|0,R=R+Math.imul(zt,er)|0,I=I+Math.imul(Ot,tr)|0,b=b+Math.imul(Ot,rr)|0,b=b+Math.imul(Bt,tr)|0,R=R+Math.imul(Bt,rr)|0,I=I+Math.imul(Pt,nr)|0,b=b+Math.imul(Pt,ir)|0,b=b+Math.imul(Rt,nr)|0,R=R+Math.imul(Rt,ir)|0;var $b=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+($b>>>26)|0,$b&=67108863,I=Math.imul(Lt,Zt),b=Math.imul(Lt,Yt),b=b+Math.imul(Dt,Zt)|0,R=Math.imul(Dt,Yt),I=I+Math.imul(Nt,Xt)|0,b=b+Math.imul(Nt,Jt)|0,b=b+Math.imul(Mt,Xt)|0,R=R+Math.imul(Mt,Jt)|0,I=I+Math.imul(kt,Qt)|0,b=b+Math.imul(kt,er)|0,b=b+Math.imul(Ct,Qt)|0,R=R+Math.imul(Ct,er)|0,I=I+Math.imul(Tt,tr)|0,b=b+Math.imul(Tt,rr)|0,b=b+Math.imul(zt,tr)|0,R=R+Math.imul(zt,rr)|0,I=I+Math.imul(Ot,nr)|0,b=b+Math.imul(Ot,ir)|0,b=b+Math.imul(Bt,nr)|0,R=R+Math.imul(Bt,ir)|0;var Zb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Zb>>>26)|0,Zb&=67108863,I=Math.imul(Lt,Xt),b=Math.imul(Lt,Jt),b=b+Math.imul(Dt,Xt)|0,R=Math.imul(Dt,Jt),I=I+Math.imul(Nt,Qt)|0,b=b+Math.imul(Nt,er)|0,b=b+Math.imul(Mt,Qt)|0,R=R+Math.imul(Mt,er)|0,I=I+Math.imul(kt,tr)|0,b=b+Math.imul(kt,rr)|0,b=b+Math.imul(Ct,tr)|0,R=R+Math.imul(Ct,rr)|0,I=I+Math.imul(Tt,nr)|0,b=b+Math.imul(Tt,ir)|0,b=b+Math.imul(zt,nr)|0,R=R+Math.imul(zt,ir)|0;var Yb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Yb>>>26)|0,Yb&=67108863,I=Math.imul(Lt,Qt),b=Math.imul(Lt,er),b=b+Math.imul(Dt,Qt)|0,R=Math.imul(Dt,er),I=I+Math.imul(Nt,tr)|0,b=b+Math.imul(Nt,rr)|0,b=b+Math.imul(Mt,tr)|0,R=R+Math.imul(Mt,rr)|0,I=I+Math.imul(kt,nr)|0,b=b+Math.imul(kt,ir)|0,b=b+Math.imul(Ct,nr)|0,R=R+Math.imul(Ct,ir)|0;var Xb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Xb>>>26)|0,Xb&=67108863,I=Math.imul(Lt,tr),b=Math.imul(Lt,rr),b=b+Math.imul(Dt,tr)|0,R=Math.imul(Dt,rr),I=I+Math.imul(Nt,nr)|0,b=b+Math.imul(Nt,ir)|0,b=b+Math.imul(Mt,nr)|0,R=R+Math.imul(Mt,ir)|0;var Jb=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Jb>>>26)|0,Jb&=67108863,I=Math.imul(Lt,nr),b=Math.imul(Lt,ir),b=b+Math.imul(Dt,nr)|0,R=Math.imul(Dt,ir);var Qb=(C+I|0)+((b&8191)<<13)|0;return C=(R+(b>>>13)|0)+(Qb>>>26)|0,Qb&=67108863,O[0]=Nb,O[1]=Mb,O[2]=Lb,O[3]=Db,O[4]=qb,O[5]=Ub,O[6]=Vb,O[7]=Fb,O[8]=Kb,O[9]=Wb,O[10]=jb,O[11]=Hb,O[12]=Gb,O[13]=$b,O[14]=Zb,O[15]=Yb,O[16]=Xb,O[17]=Jb,O[18]=Qb,C!==0&&(O[19]=C,A.length++),A};Math.imul||(T=k);function L(w,l,h){h.negative=l.negative^w.negative,h.length=w.length+l.length;for(var A=0,E=0,x=0;x<h.length-1;x++){var O=E;E=0;for(var C=A&67108863,I=Math.min(x,l.length-1),b=Math.max(0,x-w.length+1);b<=I;b++){var R=x-b,ee=w.words[R]|0,te=l.words[b]|0,oe=ee*te,de=oe&67108863;O=O+(oe/67108864|0)|0,de=de+C|0,C=de&67108863,O=O+(de>>>26)|0,E+=O>>>26,O&=67108863}h.words[x]=C,A=O,O=E}return A!==0?h.words[x]=A:h.length--,h._strip()}function M(w,l,h){return L(w,l,h)}i.prototype.mulTo=function(l,h){var A,E=this.length+l.length;return this.length===10&&l.length===10?A=T(this,l,h):E<63?A=k(this,l,h):E<1024?A=L(this,l,h):A=M(this,l,h),A};function F(w,l){this.x=w,this.y=l}F.prototype.makeRBT=function(l){for(var h=new Array(l),A=i.prototype._countBits(l)-1,E=0;E<l;E++)h[E]=this.revBin(E,A,l);return h},F.prototype.revBin=function(l,h,A){if(l===0||l===A-1)return l;for(var E=0,x=0;x<h;x++)E|=(l&1)<<h-x-1,l>>=1;return E},F.prototype.permute=function(l,h,A,E,x,O){for(var C=0;C<O;C++)E[C]=h[l[C]],x[C]=A[l[C]]},F.prototype.transform=function(l,h,A,E,x,O){this.permute(O,l,h,A,E,x);for(var C=1;C<x;C<<=1)for(var I=C<<1,b=Math.cos(2*Math.PI/I),R=Math.sin(2*Math.PI/I),ee=0;ee<x;ee+=I)for(var te=b,oe=R,de=0;de<C;de++){var xe=A[ee+de],Se=E[ee+de],Qe=A[ee+de+C],Ue=E[ee+de+C],Ze=te*Qe-oe*Ue;Ue=te*Ue+oe*Qe,Qe=Ze,A[ee+de]=xe+Qe,E[ee+de]=Se+Ue,A[ee+de+C]=xe-Qe,E[ee+de+C]=Se-Ue,de!==I&&(Ze=b*te-R*oe,oe=b*oe+R*te,te=Ze)}},F.prototype.guessLen13b=function(l,h){var A=Math.max(h,l)|1,E=A&1,x=0;for(A=A/2|0;A;A=A>>>1)x++;return 1<<x+1+E},F.prototype.conjugate=function(l,h,A){if(!(A<=1))for(var E=0;E<A/2;E++){var x=l[E];l[E]=l[A-E-1],l[A-E-1]=x,x=h[E],h[E]=-h[A-E-1],h[A-E-1]=-x}},F.prototype.normalize13b=function(l,h){for(var A=0,E=0;E<h/2;E++){var x=Math.round(l[2*E+1]/h)*8192+Math.round(l[2*E]/h)+A;l[E]=x&67108863,x<67108864?A=0:A=x/67108864|0}return l},F.prototype.convert13b=function(l,h,A,E){for(var x=0,O=0;O<h;O++)x=x+(l[O]|0),A[2*O]=x&8191,x=x>>>13,A[2*O+1]=x&8191,x=x>>>13;for(O=2*h;O<E;++O)A[O]=0;r(x===0),r((x&-8192)===0)},F.prototype.stub=function(l){for(var h=new Array(l),A=0;A<l;A++)h[A]=0;return h},F.prototype.mulp=function(l,h,A){var E=2*this.guessLen13b(l.length,h.length),x=this.makeRBT(E),O=this.stub(E),C=new Array(E),I=new Array(E),b=new Array(E),R=new Array(E),ee=new Array(E),te=new Array(E),oe=A.words;oe.length=E,this.convert13b(l.words,l.length,C,E),this.convert13b(h.words,h.length,R,E),this.transform(C,O,I,b,E,x),this.transform(R,O,ee,te,E,x);for(var de=0;de<E;de++){var xe=I[de]*ee[de]-b[de]*te[de];b[de]=I[de]*te[de]+b[de]*ee[de],I[de]=xe}return this.conjugate(I,b,E),this.transform(I,b,oe,O,E,x),this.conjugate(oe,O,E),this.normalize13b(oe,E),A.negative=l.negative^h.negative,A.length=l.length+h.length,A._strip()},i.prototype.mul=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),this.mulTo(l,h)},i.prototype.mulf=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),M(this,l,h)},i.prototype.imul=function(l){return this.clone().mulTo(l,this)},i.prototype.imuln=function(l){var h=l<0;h&&(l=-l),r(typeof l=="number"),r(l<67108864);for(var A=0,E=0;E<this.length;E++){var x=(this.words[E]|0)*l,O=(x&67108863)+(A&67108863);A>>=26,A+=x/67108864|0,A+=O>>>26,this.words[E]=O&67108863}return A!==0&&(this.words[E]=A,this.length++),this.length=l===0?1:this.length,h?this.ineg():this},i.prototype.muln=function(l){return this.clone().imuln(l)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(l){var h=B(l);if(h.length===0)return new i(1);for(var A=this,E=0;E<h.length&&h[E]===0;E++,A=A.sqr());if(++E<h.length)for(var x=A.sqr();E<h.length;E++,x=x.sqr())h[E]!==0&&(A=A.mul(x));return A},i.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var h=l%26,A=(l-h)/26,E=67108863>>>26-h<<26-h,x;if(h!==0){var O=0;for(x=0;x<this.length;x++){var C=this.words[x]&E,I=(this.words[x]|0)-C<<h;this.words[x]=I|O,O=C>>>26-h}O&&(this.words[x]=O,this.length++)}if(A!==0){for(x=this.length-1;x>=0;x--)this.words[x+A]=this.words[x];for(x=0;x<A;x++)this.words[x]=0;this.length+=A}return this._strip()},i.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},i.prototype.iushrn=function(l,h,A){r(typeof l=="number"&&l>=0);var E;h?E=(h-h%26)/26:E=0;var x=l%26,O=Math.min((l-x)/26,this.length),C=67108863^67108863>>>x<<x,I=A;if(E-=O,E=Math.max(0,E),I){for(var b=0;b<O;b++)I.words[b]=this.words[b];I.length=O}if(O!==0)if(this.length>O)for(this.length-=O,b=0;b<this.length;b++)this.words[b]=this.words[b+O];else this.words[0]=0,this.length=1;var R=0;for(b=this.length-1;b>=0&&(R!==0||b>=E);b--){var ee=this.words[b]|0;this.words[b]=R<<26-x|ee>>>x,R=ee&C}return I&&R!==0&&(I.words[I.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(l,h,A){return r(this.negative===0),this.iushrn(l,h,A)},i.prototype.shln=function(l){return this.clone().ishln(l)},i.prototype.ushln=function(l){return this.clone().iushln(l)},i.prototype.shrn=function(l){return this.clone().ishrn(l)},i.prototype.ushrn=function(l){return this.clone().iushrn(l)},i.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var h=l%26,A=(l-h)/26,E=1<<h;if(this.length<=A)return!1;var x=this.words[A];return!!(x&E)},i.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var h=l%26,A=(l-h)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(h!==0&&A++,this.length=Math.min(A,this.length),h!==0){var E=67108863^67108863>>>h<<h;this.words[this.length-1]&=E}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(l){return this.clone().imaskn(l)},i.prototype.iaddn=function(l){return r(typeof l=="number"),r(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},i.prototype._iaddn=function(l){this.words[0]+=l;for(var h=0;h<this.length&&this.words[h]>=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},i.prototype.isubn=function(l){if(r(typeof l=="number"),r(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h<this.length&&this.words[h]<0;h++)this.words[h]+=67108864,this.words[h+1]-=1;return this._strip()},i.prototype.addn=function(l){return this.clone().iaddn(l)},i.prototype.subn=function(l){return this.clone().isubn(l)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(l,h,A){var E=l.length+A,x;this._expand(E);var O,C=0;for(x=0;x<l.length;x++){O=(this.words[x+A]|0)+C;var I=(l.words[x]|0)*h;O-=I&67108863,C=(O>>26)-(I/67108864|0),this.words[x+A]=O&67108863}for(;x<this.length-A;x++)O=(this.words[x+A]|0)+C,C=O>>26,this.words[x+A]=O&67108863;if(C===0)return this._strip();for(r(C===-1),C=0,x=0;x<this.length;x++)O=-(this.words[x]|0)+C,C=O>>26,this.words[x]=O&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(l,h){var A=this.length-l.length,E=this.clone(),x=l,O=x.words[x.length-1]|0,C=this._countBits(O);A=26-C,A!==0&&(x=x.ushln(A),E.iushln(A),O=x.words[x.length-1]|0);var I=E.length-x.length,b;if(h!=="mod"){b=new i(null),b.length=I+1,b.words=new Array(b.length);for(var R=0;R<b.length;R++)b.words[R]=0}var ee=E.clone()._ishlnsubmul(x,1,I);ee.negative===0&&(E=ee,b&&(b.words[I]=1));for(var te=I-1;te>=0;te--){var oe=(E.words[x.length+te]|0)*67108864+(E.words[x.length+te-1]|0);for(oe=Math.min(oe/O|0,67108863),E._ishlnsubmul(x,oe,te);E.negative!==0;)oe--,E.negative=0,E._ishlnsubmul(x,1,te),E.isZero()||(E.negative^=1);b&&(b.words[te]=oe)}return b&&b._strip(),E._strip(),h!=="div"&&A!==0&&E.iushrn(A),{div:b||null,mod:E}},i.prototype.divmod=function(l,h,A){if(r(!l.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var E,x,O;return this.negative!==0&&l.negative===0?(O=this.neg().divmod(l,h),h!=="mod"&&(E=O.div.neg()),h!=="div"&&(x=O.mod.neg(),A&&x.negative!==0&&x.iadd(l)),{div:E,mod:x}):this.negative===0&&l.negative!==0?(O=this.divmod(l.neg(),h),h!=="mod"&&(E=O.div.neg()),{div:E,mod:O.mod}):(this.negative&l.negative)!==0?(O=this.neg().divmod(l.neg(),h),h!=="div"&&(x=O.mod.neg(),A&&x.negative!==0&&x.isub(l)),{div:O.div,mod:x}):l.length>this.length||this.cmp(l)<0?{div:new i(0),mod:this}:l.length===1?h==="div"?{div:this.divn(l.words[0]),mod:null}:h==="mod"?{div:null,mod:new i(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new i(this.modrn(l.words[0]))}:this._wordDiv(l,h)},i.prototype.div=function(l){return this.divmod(l,"div",!1).div},i.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},i.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},i.prototype.divRound=function(l){var h=this.divmod(l);if(h.mod.isZero())return h.div;var A=h.div.negative!==0?h.mod.isub(l):h.mod,E=l.ushrn(1),x=l.andln(1),O=A.cmp(E);return O<0||x===1&&O===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},i.prototype.modrn=function(l){var h=l<0;h&&(l=-l),r(l<=67108863);for(var A=(1<<26)%l,E=0,x=this.length-1;x>=0;x--)E=(A*E+(this.words[x]|0))%l;return h?-E:E},i.prototype.modn=function(l){return this.modrn(l)},i.prototype.idivn=function(l){var h=l<0;h&&(l=-l),r(l<=67108863);for(var A=0,E=this.length-1;E>=0;E--){var x=(this.words[E]|0)+A*67108864;this.words[E]=x/l|0,A=x%l}return this._strip(),h?this.ineg():this},i.prototype.divn=function(l){return this.clone().idivn(l)},i.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var h=this,A=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var E=new i(1),x=new i(0),O=new i(0),C=new i(1),I=0;h.isEven()&&A.isEven();)h.iushrn(1),A.iushrn(1),++I;for(var b=A.clone(),R=h.clone();!h.isZero();){for(var ee=0,te=1;(h.words[0]&te)===0&&ee<26;++ee,te<<=1);if(ee>0)for(h.iushrn(ee);ee-- >0;)(E.isOdd()||x.isOdd())&&(E.iadd(b),x.isub(R)),E.iushrn(1),x.iushrn(1);for(var oe=0,de=1;(A.words[0]&de)===0&&oe<26;++oe,de<<=1);if(oe>0)for(A.iushrn(oe);oe-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(b),C.isub(R)),O.iushrn(1),C.iushrn(1);h.cmp(A)>=0?(h.isub(A),E.isub(O),x.isub(C)):(A.isub(h),O.isub(E),C.isub(x))}return{a:O,b:C,gcd:A.iushln(I)}},i.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var h=this,A=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var E=new i(1),x=new i(0),O=A.clone();h.cmpn(1)>0&&A.cmpn(1)>0;){for(var C=0,I=1;(h.words[0]&I)===0&&C<26;++C,I<<=1);if(C>0)for(h.iushrn(C);C-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);for(var b=0,R=1;(A.words[0]&R)===0&&b<26;++b,R<<=1);if(b>0)for(A.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(O),x.iushrn(1);h.cmp(A)>=0?(h.isub(A),E.isub(x)):(A.isub(h),x.isub(E))}var ee;return h.cmpn(1)===0?ee=E:ee=x,ee.cmpn(0)<0&&ee.iadd(l),ee},i.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var h=this.clone(),A=l.clone();h.negative=0,A.negative=0;for(var E=0;h.isEven()&&A.isEven();E++)h.iushrn(1),A.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;A.isEven();)A.iushrn(1);var x=h.cmp(A);if(x<0){var O=h;h=A,A=O}else if(x===0||A.cmpn(1)===0)break;h.isub(A)}while(!0);return A.iushln(E)},i.prototype.invm=function(l){return this.egcd(l).a.umod(l)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(l){return this.words[0]&l},i.prototype.bincn=function(l){r(typeof l=="number");var h=l%26,A=(l-h)/26,E=1<<h;if(this.length<=A)return this._expand(A+1),this.words[A]|=E,this;for(var x=E,O=A;x!==0&&O<this.length;O++){var C=this.words[O]|0;C+=x,x=C>>>26,C&=67108863,this.words[O]=C}return x!==0&&(this.words[O]=x,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(l){var h=l<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var A;if(this.length>1)A=1;else{h&&(l=-l),r(l<=67108863,"Number is too big");var E=this.words[0]|0;A=E===l?0:E<l?-1:1}return this.negative!==0?-A|0:A},i.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var h=this.ucmp(l);return this.negative!==0?-h|0:h},i.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var h=0,A=this.length-1;A>=0;A--){var E=this.words[A]|0,x=l.words[A]|0;if(E!==x){E<x?h=-1:E>x&&(h=1);break}}return h},i.prototype.gtn=function(l){return this.cmpn(l)===1},i.prototype.gt=function(l){return this.cmp(l)===1},i.prototype.gten=function(l){return this.cmpn(l)>=0},i.prototype.gte=function(l){return this.cmp(l)>=0},i.prototype.ltn=function(l){return this.cmpn(l)===-1},i.prototype.lt=function(l){return this.cmp(l)===-1},i.prototype.lten=function(l){return this.cmpn(l)<=0},i.prototype.lte=function(l){return this.cmp(l)<=0},i.prototype.eqn=function(l){return this.cmpn(l)===0},i.prototype.eq=function(l){return this.cmp(l)===0},i.red=function(l){return new Y(l)},i.prototype.toRed=function(l){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(l){return this.red=l,this},i.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},i.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},i.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},i.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},i.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},i.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},i.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},i.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},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(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var Q={k256:null,p224:null,p192:null,p25519:null};function W(w,l){this.name=w,this.p=new i(l,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var l=new i(null);return l.words=new Array(Math.ceil(this.n/13)),l},W.prototype.ireduce=function(l){var h=l,A;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),A=h.bitLength();while(A>this.n);var E=A<this.n?-1:h.ucmp(this.p);return E===0?(h.words[0]=0,h.length=1):E>0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},W.prototype.split=function(l,h){l.iushrn(this.n,0,h)},W.prototype.imulK=function(l){return l.imul(this.k)};function Z(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(Z,W),Z.prototype.split=function(l,h){for(var A=4194303,E=Math.min(l.length,9),x=0;x<E;x++)h.words[x]=l.words[x];if(h.length=E,l.length<=9){l.words[0]=0,l.length=1;return}var O=l.words[9];for(h.words[h.length++]=O&A,x=10;x<l.length;x++){var C=l.words[x]|0;l.words[x-10]=(C&A)<<4|O>>>22,O=C}O>>>=22,l.words[x-10]=O,O===0&&l.length>10?l.length-=10:l.length-=9},Z.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var h=0,A=0;A<l.length;A++){var E=l.words[A]|0;h+=E*977,l.words[A]=h&67108863,h=E*64+(h/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function H(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(H,W);function N(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(N,W);function K(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(K,W),K.prototype.imulK=function(l){for(var h=0,A=0;A<l.length;A++){var E=(l.words[A]|0)*19+h,x=E&67108863;E>>>=26,l.words[A]=x,h=E}return h!==0&&(l.words[l.length++]=h),l},i._prime=function(l){if(Q[l])return Q[l];var h;if(l==="k256")h=new Z;else if(l==="p224")h=new H;else if(l==="p192")h=new N;else if(l==="p25519")h=new K;else throw new Error("Unknown prime "+l);return Q[l]=h,h};function Y(w){if(typeof w=="string"){var l=i._prime(w);this.m=l.p,this.prime=l}else r(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}Y.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},Y.prototype._verify2=function(l,h){r((l.negative|h.negative)===0,"red works only with positives"),r(l.red&&l.red===h.red,"red works only with red numbers")},Y.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(d(l,l.umod(this.m)._forceRed(this)),l)},Y.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},Y.prototype.add=function(l,h){this._verify2(l,h);var A=l.add(h);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},Y.prototype.iadd=function(l,h){this._verify2(l,h);var A=l.iadd(h);return A.cmp(this.m)>=0&&A.isub(this.m),A},Y.prototype.sub=function(l,h){this._verify2(l,h);var A=l.sub(h);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},Y.prototype.isub=function(l,h){this._verify2(l,h);var A=l.isub(h);return A.cmpn(0)<0&&A.iadd(this.m),A},Y.prototype.shl=function(l,h){return this._verify1(l),this.imod(l.ushln(h))},Y.prototype.imul=function(l,h){return this._verify2(l,h),this.imod(l.imul(h))},Y.prototype.mul=function(l,h){return this._verify2(l,h),this.imod(l.mul(h))},Y.prototype.isqr=function(l){return this.imul(l,l.clone())},Y.prototype.sqr=function(l){return this.mul(l,l)},Y.prototype.sqrt=function(l){if(l.isZero())return l.clone();var h=this.m.andln(3);if(r(h%2===1),h===3){var A=this.m.add(new i(1)).iushrn(2);return this.pow(l,A)}for(var E=this.m.subn(1),x=0;!E.isZero()&&E.andln(1)===0;)x++,E.iushrn(1);r(!E.isZero());var O=new i(1).toRed(this),C=O.redNeg(),I=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new i(2*b*b).toRed(this);this.pow(b,I).cmp(C)!==0;)b.redIAdd(C);for(var R=this.pow(b,E),ee=this.pow(l,E.addn(1).iushrn(1)),te=this.pow(l,E),oe=x;te.cmp(O)!==0;){for(var de=te,xe=0;de.cmp(O)!==0;xe++)de=de.redSqr();r(xe<oe);var Se=this.pow(R,new i(1).iushln(oe-xe-1));ee=ee.redMul(Se),R=Se.redSqr(),te=te.redMul(R),oe=xe}return ee},Y.prototype.invm=function(l){var h=l._invmp(this.m);return h.negative!==0?(h.negative=0,this.imod(h).redNeg()):this.imod(h)},Y.prototype.pow=function(l,h){if(h.isZero())return new i(1).toRed(this);if(h.cmpn(1)===0)return l.clone();var A=4,E=new Array(1<<A);E[0]=new i(1).toRed(this),E[1]=l;for(var x=2;x<E.length;x++)E[x]=this.mul(E[x-1],l);var O=E[0],C=0,I=0,b=h.bitLength()%26;for(b===0&&(b=26),x=h.length-1;x>=0;x--){for(var R=h.words[x],ee=b-1;ee>=0;ee--){var te=R>>ee&1;if(O!==E[0]&&(O=this.sqr(O)),te===0&&C===0){I=0;continue}C<<=1,C|=te,I++,!(I!==A&&(x!==0||ee!==0))&&(O=this.mul(O,E[C]),I=0,C=0)}b=26}return O},Y.prototype.convertTo=function(l){var h=l.umod(this.m);return h===l?h.clone():h},Y.prototype.convertFrom=function(l){var h=l.clone();return h.red=null,h},i.mont=function(l){return new J(l)};function J(w){Y.call(this,w),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)}n(J,Y),J.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},J.prototype.convertFrom=function(l){var h=this.imod(l.mul(this.rinv));return h.red=null,h},J.prototype.imul=function(l,h){if(l.isZero()||h.isZero())return l.words[0]=0,l.length=1,l;var A=l.imul(h),E=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=A.isub(E).iushrn(this.shift),O=x;return x.cmp(this.m)>=0?O=x.isub(this.m):x.cmpn(0)<0&&(O=x.iadd(this.m)),O._forceRed(this)},J.prototype.mul=function(l,h){if(l.isZero()||h.isZero())return new i(0)._forceRed(this);var A=l.mul(h),E=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=A.isub(E).iushrn(this.shift),O=x;return x.cmp(this.m)>=0?O=x.isub(this.m):x.cmpn(0)<0&&(O=x.iadd(this.m)),O._forceRed(this)},J.prototype.invm=function(l){var h=this.imod(l._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(typeof gA>"u"||gA,rO)});var bA=S((mA,iO)=>{a();var u0=Ba(),Mi=u0.Buffer;function nO(t,e){for(var r in t)e[r]=t[r]}Mi.from&&Mi.alloc&&Mi.allocUnsafe&&Mi.allocUnsafeSlow?iO.exports=u0:(nO(u0,mA),mA.Buffer=Ua);function Ua(t,e,r){return Mi(t,e,r)}Ua.prototype=Object.create(Mi.prototype);nO(Mi,Ua);Ua.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Mi(t,e,r)};Ua.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Mi(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ua.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Mi(t)};Ua.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return u0.SlowBuffer(t)}});var oO=S((Nbe,sO)=>{"use strict";a();var l0=bA().Buffer;function bU(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var o=t.length,c=t.charAt(0),u=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function f(v){if((Array.isArray(v)||v instanceof Uint8Array)&&(v=l0.from(v)),!l0.isBuffer(v))throw new TypeError("Expected Buffer");if(v.length===0)return"";for(var P=0,B=0,k=0,T=v.length;k!==T&&v[k]===0;)k++,P++;for(var L=(T-k)*d+1>>>0,M=new Uint8Array(L);k!==T;){for(var F=v[k],Q=0,W=L-1;(F!==0||Q<B)&&W!==-1;W--,Q++)F+=256*M[W]>>>0,M[W]=F%o>>>0,F=F/o>>>0;if(F!==0)throw new Error("Non-zero carry");B=Q,k++}for(var Z=L-B;Z!==L&&M[Z]===0;)Z++;for(var H=c.repeat(P);Z<L;++Z)H+=t.charAt(M[Z]);return H}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return l0.alloc(0);for(var P=0,B=0,k=0;v[P]===c;)B++,P++;for(var T=(v.length-P)*u+1>>>0,L=new Uint8Array(T);P<v.length;){var M=v.charCodeAt(P);if(M>255)return;var F=e[M];if(F===255)return;for(var Q=0,W=T-1;(F!==0||Q<k)&&W!==-1;W--,Q++)F+=o*L[W]>>>0,L[W]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");k=Q,P++}for(var Z=T-k;Z!==T&&L[Z]===0;)Z++;var H=l0.allocUnsafe(B+(T-Z));H.fill(0,0,B);for(var N=B;Z!==T;)H[N++]=L[Z++];return H}function _(v){var P=m(v);if(P)return P;throw new Error("Non-base"+o+" character")}return{encode:f,decodeUnsafe:m,decode:_}}sO.exports=bU});var cO=S((Lbe,aO)=>{a();var _U=oO(),AU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";aO.exports=_U(AU)});var lO=S((Wbe,uO)=>{"use strict";a();var d0=bA().Buffer;function SU(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var o=t.length,c=t.charAt(0),u=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function f(v){if((Array.isArray(v)||v instanceof Uint8Array)&&(v=d0.from(v)),!d0.isBuffer(v))throw new TypeError("Expected Buffer");if(v.length===0)return"";for(var P=0,B=0,k=0,T=v.length;k!==T&&v[k]===0;)k++,P++;for(var L=(T-k)*d+1>>>0,M=new Uint8Array(L);k!==T;){for(var F=v[k],Q=0,W=L-1;(F!==0||Q<B)&&W!==-1;W--,Q++)F+=256*M[W]>>>0,M[W]=F%o>>>0,F=F/o>>>0;if(F!==0)throw new Error("Non-zero carry");B=Q,k++}for(var Z=L-B;Z!==L&&M[Z]===0;)Z++;for(var H=c.repeat(P);Z<L;++Z)H+=t.charAt(M[Z]);return H}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return d0.alloc(0);for(var P=0,B=0,k=0;v[P]===c;)B++,P++;for(var T=(v.length-P)*u+1>>>0,L=new Uint8Array(T);P<v.length;){var M=v.charCodeAt(P);if(M>255)return;var F=e[M];if(F===255)return;for(var Q=0,W=T-1;(F!==0||Q<k)&&W!==-1;W--,Q++)F+=o*L[W]>>>0,L[W]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");k=Q,P++}for(var Z=T-k;Z!==T&&L[Z]===0;)Z++;var H=d0.allocUnsafe(B+(T-Z));H.fill(0,0,B);for(var N=B;Z!==T;)H[N++]=L[Z++];return H}function _(v){var P=m(v);if(P)return P;throw new Error("Non-base"+o+" character")}return{encode:f,decodeUnsafe:m,decode:_}}uO.exports=SU});var fO=S((Hbe,dO)=>{a();var vU=lO(),EU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";dO.exports=vU(EU)});var hO=S(vA=>{"use strict";a();function ws(t,e,r){return e<=t&&t<=r}function y0(t){if(t===void 0)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function wU(t){for(var e=String(t),r=e.length,n=0,i=[];n<r;){var s=e.charCodeAt(n);if(s<55296||s>57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var c=s&1023,u=o&1023;i.push(65536+(c<<10)+u),n+=1}else i.push(65533)}n+=1}return i}function xU(t){for(var e="",r=0;r<t.length;++r){var n=t[r];n<=65535?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return e}var f0=-1;function SA(t){this.tokens=[].slice.call(t)}SA.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():f0},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var xu=-1;function AA(t,e){if(t)throw TypeError("Decoder error");return e||65533}var h0="utf-8";function p0(t,e){if(!(this instanceof p0))return new p0(t,e);if(t=t!==void 0?String(t).toLowerCase():h0,t!==h0)throw new Error("Encoding not supported. Only utf-8 is supported");e=y0(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}p0.prototype={decode:function(e,r){var n;typeof e=="object"&&e instanceof ArrayBuffer?n=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):n=new Uint8Array(0),r=y0(r),this._streaming||(this._decoder=new IU({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new SA(n),s=[],o;!i.endOfStream()&&(o=this._decoder.handler(i,i.read()),o!==xu);)o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o));if(!this._streaming){do{if(o=this._decoder.handler(i,i.read()),o===xu)break;o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o))}while(!i.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),xU(s)}};function g0(t,e){if(!(this instanceof g0))return new g0(t,e);if(t=t!==void 0?String(t).toLowerCase():h0,t!==h0)throw new Error("Encoding not supported. Only utf-8 is supported");e=y0(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}g0.prototype={encode:function(e,r){e=e?String(e):"",r=y0(r),this._streaming||(this._encoder=new PU(this._options)),this._streaming=!!r.stream;for(var n=[],i=new SA(wU(e)),s;!i.endOfStream()&&(s=this._encoder.handler(i,i.read()),s!==xu);)Array.isArray(s)?n.push.apply(n,s):n.push(s);if(!this._streaming){for(;s=this._encoder.handler(i,i.read()),s!==xu;)Array.isArray(s)?n.push.apply(n,s):n.push(s);this._encoder=null}return new Uint8Array(n)}};function IU(t){var e=t.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(c,u){if(u===f0&&i!==0)return i=0,AA(e);if(u===f0)return xu;if(i===0){if(ws(u,0,127))return u;if(ws(u,194,223))i=1,r=u-192;else if(ws(u,224,239))u===224&&(s=160),u===237&&(o=159),i=2,r=u-224;else if(ws(u,240,244))u===240&&(s=144),u===244&&(o=143),i=3,r=u-240;else return AA(e);return r=r<<6*i,null}if(!ws(u,s,o))return r=i=n=0,s=128,o=191,c.prepend(u),AA(e);if(s=128,o=191,n+=1,r+=u-128<<6*(i-n),n!==i)return null;var d=r;return r=i=n=0,d}}function PU(t){var e=t.fatal;this.handler=function(r,n){if(n===f0)return xu;if(ws(n,0,127))return n;var i,s;ws(n,128,2047)?(i=1,s=192):ws(n,2048,65535)?(i=2,s=224):ws(n,65536,1114111)&&(i=3,s=240);for(var o=[(n>>6*i)+s];i>0;){var c=n>>6*(i-1);o.push(128|c&63),i-=1}return o}}vA.TextEncoder=g0;vA.TextDecoder=p0});var bO=S(Ge=>{"use strict";a();var RU=Ge&&Ge.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),OU=Ge&&Ge.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Li=Ge&&Ge.__decorate||function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},BU=Ge&&Ge.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&RU(e,t,r);return OU(e,t),e},pO=Ge&&Ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.deserializeUnchecked=Ge.deserialize=Ge.serialize=Ge.BinaryReader=Ge.BinaryWriter=Ge.BorshError=Ge.baseDecode=Ge.baseEncode=void 0;var so=pO(yA()),gO=pO(fO()),TU=BU(hO()),zU=typeof TextDecoder!="function"?TU.TextDecoder:TextDecoder,kU=new zU("utf-8",{fatal:!0});function CU(t){return typeof t=="string"&&(t=p.Buffer.from(t,"utf8")),gO.default.encode(p.Buffer.from(t))}Ge.baseEncode=CU;function NU(t){return p.Buffer.from(gO.default.decode(t))}Ge.baseDecode=NU;var EA=1024,Br=class 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(".")}};Ge.BorshError=Br;var m0=class{constructor(){this.buf=p.Buffer.alloc(EA),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=p.Buffer.concat([this.buf,p.Buffer.alloc(EA)]))}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(p.Buffer.from(new so.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new so.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new so.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new so.default(e).toArray("le",64)))}writeBuffer(e){this.buf=p.Buffer.concat([p.Buffer.from(this.buf.subarray(0,this.length)),e,p.Buffer.alloc(EA)]),this.length+=e.length}writeString(e){this.maybeResize();let r=p.Buffer.from(e,"utf8");this.writeU32(r.length),this.writeBuffer(r)}writeFixedArray(e){this.writeBuffer(p.Buffer.from(e))}writeArray(e,r){this.maybeResize(),this.writeU32(e.length);for(let n of e)this.maybeResize(),r(n)}toArray(){return this.buf.subarray(0,this.length)}};Ge.BinaryWriter=m0;function Di(t,e,r){let n=r.value;r.value=function(...i){try{return n.apply(this,i)}catch(s){if(s instanceof RangeError){let o=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(o)>=0)throw new Br("Reached the end of buffer when deserializing")}throw s}}}var tn=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new so.default(e,"le")}readU128(){let e=this.readBuffer(16);return new so.default(e,"le")}readU256(){let e=this.readBuffer(32);return new so.default(e,"le")}readU512(){let e=this.readBuffer(64);return new so.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new Br(`Expected buffer length ${e} isn't within bounds`);let r=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,r}readString(){let e=this.readU32(),r=this.readBuffer(e);try{return kU.decode(r)}catch(n){throw new Br(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let r=this.readU32(),n=Array();for(let i=0;i<r;++i)n.push(e());return n}};Li([Di],tn.prototype,"readU8",null);Li([Di],tn.prototype,"readU16",null);Li([Di],tn.prototype,"readU32",null);Li([Di],tn.prototype,"readU64",null);Li([Di],tn.prototype,"readU128",null);Li([Di],tn.prototype,"readU256",null);Li([Di],tn.prototype,"readU512",null);Li([Di],tn.prototype,"readString",null);Li([Di],tn.prototype,"readFixedArray",null);Li([Di],tn.prototype,"readArray",null);Ge.BinaryReader=tn;function yO(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Va(t,e,r,n,i){try{if(typeof n=="string")i[`write${yO(n)}`](r);else if(n instanceof Array)if(typeof n[0]=="number"){if(r.length!==n[0])throw new Br(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(n.length===2&&typeof n[1]=="number"){if(r.length!==n[1])throw new Br(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let s=0;s<n[1];s++)Va(t,null,r[s],n[0],i)}else i.writeArray(r,s=>{Va(t,e,s,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":{r==null?i.writeU8(0):(i.writeU8(1),Va(t,e,r,n.type,i));break}case"map":{i.writeU32(r.size),r.forEach((s,o)=>{Va(t,e,o,n.key,i),Va(t,e,s,n.value,i)});break}default:throw new Br(`FieldType ${n} unrecognized`)}else mO(t,r,i)}catch(s){throw s instanceof Br&&s.addToFieldPath(e),s}}function mO(t,e,r){if(typeof e.borshSerialize=="function"){e.borshSerialize(r);return}let n=t.get(e.constructor);if(!n)throw new Br(`Class ${e.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,s])=>{Va(t,i,e[i],s,r)});else if(n.kind==="enum"){let i=e[n.field];for(let s=0;s<n.values.length;++s){let[o,c]=n.values[s];if(o===i){r.writeU8(s),Va(t,o,e[o],c,r);break}}}else throw new Br(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function MU(t,e,r=m0){let n=new r;return mO(t,e,n),n.toArray()}Ge.serialize=MU;function Fa(t,e,r,n){try{if(typeof r=="string")return n[`read${yO(r)}`]();if(r instanceof Array){if(typeof r[0]=="number")return n.readFixedArray(r[0]);if(typeof r[1]=="number"){let i=[];for(let s=0;s<r[1];s++)i.push(Fa(t,null,r[0],n));return i}else return n.readArray(()=>Fa(t,e,r[0],n))}if(r.kind==="option")return n.readU8()?Fa(t,e,r.type,n):void 0;if(r.kind==="map"){let i=new Map,s=n.readU32();for(let o=0;o<s;o++){let c=Fa(t,e,r.key,n),u=Fa(t,e,r.value,n);i.set(c,u)}return i}return wA(t,r,n)}catch(i){throw i instanceof Br&&i.addToFieldPath(e),i}}function wA(t,e,r){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(r);let n=t.get(e);if(!n)throw new Br(`Class ${e.name} is missing in schema`);if(n.kind==="struct"){let i={};for(let[s,o]of t.get(e).fields)i[s]=Fa(t,s,o,r);return new e(i)}if(n.kind==="enum"){let i=r.readU8();if(i>=n.values.length)throw new Br(`Enum index: ${i} is out of range`);let[s,o]=n.values[i],c=Fa(t,s,o,r);return new e({[s]:c})}throw new Br(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function LU(t,e,r,n=tn){let i=new n(r),s=wA(t,e,i);if(i.offset<r.length)throw new Br(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return s}Ge.deserialize=LU;function DU(t,e,r,n=tn){let i=new n(r);return wA(t,e,i)}Ge.deserializeUnchecked=DU});var RA=S(U=>{"use strict";a();Object.defineProperty(U,"__esModule",{value:!0});U.s16=U.s8=U.nu64be=U.u48be=U.u40be=U.u32be=U.u24be=U.u16be=U.nu64=U.u48=U.u40=U.u32=U.u24=U.u16=U.u8=U.offset=U.greedy=U.Constant=U.UTF8=U.CString=U.Blob=U.Boolean=U.BitField=U.BitStructure=U.VariantLayout=U.Union=U.UnionLayoutDiscriminator=U.UnionDiscriminator=U.Structure=U.Sequence=U.DoubleBE=U.Double=U.FloatBE=U.Float=U.NearInt64BE=U.NearInt64=U.NearUInt64BE=U.NearUInt64=U.IntBE=U.Int=U.UIntBE=U.UInt=U.OffsetLayout=U.GreedyCount=U.ExternalLayout=U.bindConstructorLayout=U.nameWithProperty=U.Layout=U.uint8ArrayToBuffer=U.checkUint8Array=void 0;U.constant=U.utf8=U.cstr=U.blob=U.unionLayoutDiscriminator=U.union=U.seq=U.bits=U.struct=U.f64be=U.f64=U.f32be=U.f32=U.ns64be=U.s48be=U.s40be=U.s32be=U.s24be=U.s16be=U.ns64=U.s48=U.s40=U.s32=U.s24=void 0;var IA=Ba();function Ru(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}U.checkUint8Array=Ru;function Le(t){return Ru(t),IA.Buffer.from(t.buffer,t.byteOffset,t.length)}U.uint8ArrayToBuffer=Le;var Ve=class{constructor(e,r){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=r}makeDestinationObject(){return{}}getSpan(e,r){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=e,r}fromArray(e){}};U.Layout=Ve;function PA(t,e){return e.property?t+"["+e.property+"]":t}U.nameWithProperty=PA;function qU(t,e){if(typeof t!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Ve))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=(()=>new t),Object.defineProperty(t.prototype,"encode",{value(r,n){return e.encode(this,r,n)},writable:!0}),Object.defineProperty(t,"decode",{value(r,n){return e.decode(r,n)},writable:!0})}U.bindConstructorLayout=qU;var Dr=class extends Ve{isCount(){throw new Error("ExternalLayout is abstract")}};U.ExternalLayout=Dr;var b0=class extends Dr{constructor(e=1,r){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=e}isCount(){return!0}decode(e,r=0){Ru(e);let n=e.length-r;return Math.floor(n/this.elementSpan)}encode(e,r,n){return 0}};U.GreedyCount=b0;var sf=class extends Dr{constructor(e,r=0,n){if(!(e instanceof Ve))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=r}isCount(){return this.layout instanceof pn||this.layout instanceof Rn}decode(e,r=0){return this.layout.decode(e,r+this.offset)}encode(e,r,n=0){return this.layout.encode(e,r,n+this.offset)}};U.OffsetLayout=sf;var pn=class extends Ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Le(e).readUIntLE(r,this.span)}encode(e,r,n=0){return Le(r).writeUIntLE(e,n,this.span),this.span}};U.UInt=pn;var Rn=class extends Ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Le(e).readUIntBE(r,this.span)}encode(e,r,n=0){return Le(r).writeUIntBE(e,n,this.span),this.span}};U.UIntBE=Rn;var xs=class extends Ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Le(e).readIntLE(r,this.span)}encode(e,r,n=0){return Le(r).writeIntLE(e,n,this.span),this.span}};U.Int=xs;var oo=class extends Ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Le(e).readIntBE(r,this.span)}encode(e,r,n=0){return Le(r).writeIntBE(e,n,this.span),this.span}};U.IntBE=oo;var xA=Math.pow(2,32);function N0(t){let e=Math.floor(t/xA),r=t-e*xA;return{hi32:e,lo32:r}}function M0(t,e){return t*xA+e}var _0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){let n=Le(e),i=n.readUInt32LE(r),s=n.readUInt32LE(r+4);return M0(s,i)}encode(e,r,n=0){let i=N0(e),s=Le(r);return s.writeUInt32LE(i.lo32,n),s.writeUInt32LE(i.hi32,n+4),8}};U.NearUInt64=_0;var A0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){let n=Le(e),i=n.readUInt32BE(r),s=n.readUInt32BE(r+4);return M0(i,s)}encode(e,r,n=0){let i=N0(e),s=Le(r);return s.writeUInt32BE(i.hi32,n),s.writeUInt32BE(i.lo32,n+4),8}};U.NearUInt64BE=A0;var S0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){let n=Le(e),i=n.readUInt32LE(r),s=n.readInt32LE(r+4);return M0(s,i)}encode(e,r,n=0){let i=N0(e),s=Le(r);return s.writeUInt32LE(i.lo32,n),s.writeInt32LE(i.hi32,n+4),8}};U.NearInt64=S0;var v0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){let n=Le(e),i=n.readInt32BE(r),s=n.readUInt32BE(r+4);return M0(i,s)}encode(e,r,n=0){let i=N0(e),s=Le(r);return s.writeInt32BE(i.hi32,n),s.writeUInt32BE(i.lo32,n+4),8}};U.NearInt64BE=v0;var E0=class extends Ve{constructor(e){super(4,e)}decode(e,r=0){return Le(e).readFloatLE(r)}encode(e,r,n=0){return Le(r).writeFloatLE(e,n),4}};U.Float=E0;var w0=class extends Ve{constructor(e){super(4,e)}decode(e,r=0){return Le(e).readFloatBE(r)}encode(e,r,n=0){return Le(r).writeFloatBE(e,n),4}};U.FloatBE=w0;var x0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){return Le(e).readDoubleLE(r)}encode(e,r,n=0){return Le(r).writeDoubleLE(e,n),8}};U.Double=x0;var I0=class extends Ve{constructor(e){super(8,e)}decode(e,r=0){return Le(e).readDoubleBE(r)}encode(e,r,n=0){return Le(r).writeDoubleBE(e,n),8}};U.DoubleBE=I0;var P0=class extends Ve{constructor(e,r,n){if(!(e instanceof Ve))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof Dr&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(r instanceof Dr)&&0<e.span&&(i=r*e.span),super(i,n),this.elementLayout=e,this.count=r}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0,i=this.count;if(i instanceof Dr&&(i=i.decode(e,r)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let s=0;for(;s<i;)n+=this.elementLayout.getSpan(e,r+n),++s}return n}decode(e,r=0){let n=[],i=0,s=this.count;for(s instanceof Dr&&(s=s.decode(e,r));i<s;)n.push(this.elementLayout.decode(e,r)),r+=this.elementLayout.getSpan(e,r),i+=1;return n}encode(e,r,n=0){let i=this.elementLayout,s=e.reduce((o,c)=>o+i.encode(c,r,n+o),0);return this.count instanceof Dr&&this.count.encode(e.length,r,n),s}};U.Sequence=P0;var R0=class extends Ve{constructor(e,r,n){if(!(Array.isArray(e)&&e.reduce((s,o)=>s&&o instanceof Ve,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(let s of e)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((s,o)=>s+o.getSpan(),0)}catch{}super(i,r),this.fields=e,this.decodePrefixes=!!n}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,s)=>{let o=s.getSpan(e,r);return r+=o,i+o},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,r=0){Ru(e);let n=this.makeDestinationObject();for(let i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,r)),r+=i.getSpan(e,r),this.decodePrefixes&&e.length===r)break;return n}encode(e,r,n=0){let i=n,s=0,o=0;for(let c of this.fields){let u=c.span;if(o=0<u?u:0,c.property!==void 0){let d=e[c.property];d!==void 0&&(o=c.encode(d,r,n),0>u&&(u=c.getSpan(r,n)))}s=n,n+=u}return s+o-i}fromArray(e){let r=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0<e.length&&(r[n.property]=e.shift());return r}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let r of this.fields)if(r.property===e)return r}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let r=0;for(let n of this.fields){if(n.property===e)return r;0>n.span?r=-1:0<=r&&(r+=n.span)}}};U.Structure=R0;var of=class{constructor(e){this.property=e}decode(e,r){throw new Error("UnionDiscriminator is abstract")}encode(e,r,n){throw new Error("UnionDiscriminator is abstract")}};U.UnionDiscriminator=of;var Pu=class extends of{constructor(e,r){if(!(e instanceof Dr&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||e.property||"variant"),this.layout=e}decode(e,r){return this.layout.decode(e,r)}encode(e,r,n){return this.layout.encode(e,r,n)}};U.UnionLayoutDiscriminator=Pu;var af=class extends Ve{constructor(e,r,n){let i;if(e instanceof pn||e instanceof Rn)i=new Pu(new sf(e));else if(e instanceof Dr&&e.isCount())i=new Pu(e);else if(e instanceof of)i=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof Ve))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let s=-1;r&&(s=r.span,0<=s&&(e instanceof pn||e instanceof Rn)&&(s+=i.layout.span)),super(s,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof pn||e instanceof Rn,this.defaultLayout=r,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return o(c)},this.configGetSourceVariant=function(c){o=c.bind(this)}}getSpan(e,r=0){if(0<=this.span)return this.span;let n=this.getVariant(e,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,r)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let r=this.registry[e[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(e,r.property)))return r}else for(let r in this.registry){let n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,r=0){let n,i=this.discriminator,s=i.decode(e,r),o=this.registry[s];if(o===void 0){let c=this.defaultLayout,u=0;this.usesPrefixDiscriminator&&(u=i.layout.span),n=this.makeDestinationObject(),n[i.property]=s,n[c.property]=c.decode(e,r+u)}else n=o.decode(e,r);return n}encode(e,r,n=0){let i=this.getSourceVariant(e);if(i===void 0){let s=this.discriminator,o=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=s.layout.span),s.encode(e[s.property],r,n),c+o.encode(e[o.property],r,n+c)}return i.encode(e,r,n)}addVariant(e,r,n){let i=new O0(this,e,r,n);return this.registry[e]=i,i}getVariant(e,r=0){let n;return e instanceof Uint8Array?n=this.discriminator.decode(e,r):n=e,this.registry[n]}};U.Union=af;var O0=class extends Ve{constructor(e,r,n,i){if(!(e instanceof af))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof Ve))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let s=e.span;0>e.span&&(s=n?n.span:0,0<=s&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span)),super(s,i),this.union=e,this.variant=r,this.layout=n||null}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,r+n)),n+i}decode(e,r=0){let n=this.makeDestinationObject();if(this!==this.union.getVariant(e,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let s=i;if(this.layout&&(this.layout.encode(e[this.property],r,n+i),s+=this.layout.getSpan(r,n+i),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};U.VariantLayout=O0;function Iu(t){return 0>t&&(t+=4294967296),t}var cf=class extends Ve{constructor(e,r,n){if(!(e instanceof pn||e instanceof Rn))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!r,this.fields=[];let i=0;this._packedSetValue=function(s){return i=Iu(s),this},this._packedGetValue=function(){return i}}decode(e,r=0){let n=this.makeDestinationObject(),i=this.word.decode(e,r);this._packedSetValue(i);for(let s of this.fields)s.property!==void 0&&(n[s.property]=s.decode(e));return n}encode(e,r,n=0){let i=this.word.decode(r,n);this._packedSetValue(i);for(let s of this.fields)if(s.property!==void 0){let o=e[s.property];o!==void 0&&s.encode(o)}return this.word.encode(this._packedGetValue(),r,n)}addField(e,r){let n=new uf(this,e,r);return this.fields.push(n),n}addBoolean(e){let r=new B0(this,e);return this.fields.push(r),r}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let r of this.fields)if(r.property===e)return r}};U.BitStructure=cf;var uf=class{constructor(e,r,n){if(!(e instanceof cf))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(r)||0>=r)throw new TypeError("bits must be positive integer");let i=8*e.span,s=e.fields.reduce((o,c)=>o+c.bits,0);if(r+s>i)throw new Error("bits too long for span remainder ("+(i-s)+" of "+i+" remain)");this.container=e,this.bits=r,this.valueMask=(1<<r)-1,r===32&&(this.valueMask=4294967295),this.start=s,this.container.msb&&(this.start=i-s-r),this.wordMask=Iu(this.valueMask<<this.start),this.property=n}decode(e,r){let n=this.container._packedGetValue();return Iu(n&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Iu(e&this.valueMask))throw new TypeError(PA("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let r=this.container._packedGetValue(),n=Iu(e<<this.start);this.container._packedSetValue(Iu(r&~this.wordMask)|n)}};U.BitField=uf;var B0=class extends uf{constructor(e,r){super(e,1,r)}decode(e,r){return!!super.decode(e,r)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};U.Boolean=B0;var T0=class extends Ve{constructor(e,r){if(!(e instanceof Dr&&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 Dr||(n=e),super(n,r),this.length=e}getSpan(e,r){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),n}decode(e,r=0){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),Le(e).slice(r,r+n)}encode(e,r,n){let i=this.length;if(this.length instanceof Dr&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(PA("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");let s=Le(e);return Le(r).write(s.toString("hex"),n,i,"hex"),this.length instanceof Dr&&this.length.encode(i,r,n),i}};U.Blob=T0;var z0=class extends Ve{constructor(e){super(-1,e)}getSpan(e,r=0){Ru(e);let n=r;for(;n<e.length&&e[n]!==0;)n+=1;return 1+n-r}decode(e,r=0){let n=this.getSpan(e,r);return Le(e).slice(r,r+n-1).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=IA.Buffer.from(e,"utf8"),s=i.length;if(n+s>r.length)throw new RangeError("encoding overruns Buffer");let o=Le(r);return i.copy(o,n),o[n+s]=0,s+1}};U.CString=z0;var k0=class extends Ve{constructor(e,r){if(typeof e=="string"&&r===void 0&&(r=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=e}getSpan(e,r=0){return Ru(e),e.length-r}decode(e,r=0){let n=this.getSpan(e,r);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return Le(e).slice(r,r+n).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=IA.Buffer.from(e,"utf8"),s=i.length;if(0<=this.maxSpan&&this.maxSpan<s)throw new RangeError("text length exceeds maxSpan");if(n+s>r.length)throw new RangeError("encoding overruns Buffer");return i.copy(Le(r),n),s}};U.UTF8=k0;var C0=class extends Ve{constructor(e,r){super(0,r),this.value=e}decode(e,r){return this.value}encode(e,r,n){return 0}};U.Constant=C0;U.greedy=((t,e)=>new b0(t,e));U.offset=((t,e,r)=>new sf(t,e,r));U.u8=(t=>new pn(1,t));U.u16=(t=>new pn(2,t));U.u24=(t=>new pn(3,t));U.u32=(t=>new pn(4,t));U.u40=(t=>new pn(5,t));U.u48=(t=>new pn(6,t));U.nu64=(t=>new _0(t));U.u16be=(t=>new Rn(2,t));U.u24be=(t=>new Rn(3,t));U.u32be=(t=>new Rn(4,t));U.u40be=(t=>new Rn(5,t));U.u48be=(t=>new Rn(6,t));U.nu64be=(t=>new A0(t));U.s8=(t=>new xs(1,t));U.s16=(t=>new xs(2,t));U.s24=(t=>new xs(3,t));U.s32=(t=>new xs(4,t));U.s40=(t=>new xs(5,t));U.s48=(t=>new xs(6,t));U.ns64=(t=>new S0(t));U.s16be=(t=>new oo(2,t));U.s24be=(t=>new oo(3,t));U.s32be=(t=>new oo(4,t));U.s40be=(t=>new oo(5,t));U.s48be=(t=>new oo(6,t));U.ns64be=(t=>new v0(t));U.f32=(t=>new E0(t));U.f32be=(t=>new w0(t));U.f64=(t=>new x0(t));U.f64be=(t=>new I0(t));U.struct=((t,e,r)=>new R0(t,e,r));U.bits=((t,e,r)=>new cf(t,e,r));U.seq=((t,e,r)=>new P0(t,e,r));U.union=((t,e,r)=>new af(t,e,r));U.unionLayoutDiscriminator=((t,e)=>new Pu(t,e));U.blob=((t,e)=>new T0(t,e));U.cstr=(t=>new z0(t));U.utf8=((t,e)=>new k0(t,e));U.constant=((t,e)=>new C0(t,e))});function ff(){if(!U0&&(U0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!U0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return U0(Q5)}var U0,Q5,qA=Lr(()=>{a();Q5=new Uint8Array(16)});var LO,DO=Lr(()=>{a();LO=/^(?:[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});function eW(t){return typeof t=="string"&&LO.test(t)}var co,hf=Lr(()=>{a();DO();co=eW});function tW(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Tr[t[e+0]]+Tr[t[e+1]]+Tr[t[e+2]]+Tr[t[e+3]]+"-"+Tr[t[e+4]]+Tr[t[e+5]]+"-"+Tr[t[e+6]]+Tr[t[e+7]]+"-"+Tr[t[e+8]]+Tr[t[e+9]]+"-"+Tr[t[e+10]]+Tr[t[e+11]]+Tr[t[e+12]]+Tr[t[e+13]]+Tr[t[e+14]]+Tr[t[e+15]]).toLowerCase();if(!co(r))throw TypeError("Stringified UUID is invalid");return r}var Tr,V0,uo,pf=Lr(()=>{a();hf();Tr=[];for(V0=0;V0<256;++V0)Tr.push((V0+256).toString(16).substr(1));uo=tW});function rW(t,e,r){var n=e&&r||0,i=e||new Array(16);t=t||{};var s=t.node||qO,o=t.clockseq!==void 0?t.clockseq:UA;if(s==null||o==null){var c=t.random||(t.rng||ff)();s==null&&(s=qO=[c[0]|1,c[1],c[2],c[3],c[4],c[5]]),o==null&&(o=UA=(c[6]<<8|c[7])&16383)}var u=t.msecs!==void 0?t.msecs:Date.now(),d=t.nsecs!==void 0?t.nsecs:FA+1,f=u-VA+(d-FA)/1e4;if(f<0&&t.clockseq===void 0&&(o=o+1&16383),(f<0||u>VA)&&t.nsecs===void 0&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");VA=u,FA=d,UA=o,u+=122192928e5;var m=((u&268435455)*1e4+d)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=m&255;var _=u/4294967296*1e4&268435455;i[n++]=_>>>8&255,i[n++]=_&255,i[n++]=_>>>24&15|16,i[n++]=_>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var v=0;v<6;++v)i[n+v]=s[v];return e||uo(i)}var qO,UA,VA,FA,UO,VO=Lr(()=>{a();qA();pf();VA=0,FA=0;UO=rW});function nW(t){if(!co(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var F0,KA=Lr(()=>{a();hf();F0=nW});function iW(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function K0(t,e,r){function n(i,s,o,c){if(typeof i=="string"&&(i=iW(i)),typeof s=="string"&&(s=F0(s)),s.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+i.length);if(u.set(s),u.set(i,s.length),u=r(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,o){c=c||0;for(var d=0;d<16;++d)o[c+d]=u[d];return o}return uo(u)}try{n.name=t}catch{}return n.DNS=sW,n.URL=oW,n}var sW,oW,WA=Lr(()=>{a();pf();KA();sW="6ba7b810-9dad-11d1-80b4-00c04fd430c8",oW="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function aW(t){if(typeof t=="string"){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)}return cW(uW(lW(t),t.length*8))}function cW(t){for(var e=[],r=t.length*32,n="0123456789abcdef",i=0;i<r;i+=8){var s=t[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(s&15),16);e.push(o)}return e}function FO(t){return(t+64>>>9<<4)+14+1}function uW(t,e){t[e>>5]|=128<<e%32,t[FO(e)-1]=e;for(var r=1732584193,n=-271733879,i=-1732584194,s=271733878,o=0;o<t.length;o+=16){var c=r,u=n,d=i,f=s;r=Ur(r,n,i,s,t[o],7,-680876936),s=Ur(s,r,n,i,t[o+1],12,-389564586),i=Ur(i,s,r,n,t[o+2],17,606105819),n=Ur(n,i,s,r,t[o+3],22,-1044525330),r=Ur(r,n,i,s,t[o+4],7,-176418897),s=Ur(s,r,n,i,t[o+5],12,1200080426),i=Ur(i,s,r,n,t[o+6],17,-1473231341),n=Ur(n,i,s,r,t[o+7],22,-45705983),r=Ur(r,n,i,s,t[o+8],7,1770035416),s=Ur(s,r,n,i,t[o+9],12,-1958414417),i=Ur(i,s,r,n,t[o+10],17,-42063),n=Ur(n,i,s,r,t[o+11],22,-1990404162),r=Ur(r,n,i,s,t[o+12],7,1804603682),s=Ur(s,r,n,i,t[o+13],12,-40341101),i=Ur(i,s,r,n,t[o+14],17,-1502002290),n=Ur(n,i,s,r,t[o+15],22,1236535329),r=Vr(r,n,i,s,t[o+1],5,-165796510),s=Vr(s,r,n,i,t[o+6],9,-1069501632),i=Vr(i,s,r,n,t[o+11],14,643717713),n=Vr(n,i,s,r,t[o],20,-373897302),r=Vr(r,n,i,s,t[o+5],5,-701558691),s=Vr(s,r,n,i,t[o+10],9,38016083),i=Vr(i,s,r,n,t[o+15],14,-660478335),n=Vr(n,i,s,r,t[o+4],20,-405537848),r=Vr(r,n,i,s,t[o+9],5,568446438),s=Vr(s,r,n,i,t[o+14],9,-1019803690),i=Vr(i,s,r,n,t[o+3],14,-187363961),n=Vr(n,i,s,r,t[o+8],20,1163531501),r=Vr(r,n,i,s,t[o+13],5,-1444681467),s=Vr(s,r,n,i,t[o+2],9,-51403784),i=Vr(i,s,r,n,t[o+7],14,1735328473),n=Vr(n,i,s,r,t[o+12],20,-1926607734),r=Fr(r,n,i,s,t[o+5],4,-378558),s=Fr(s,r,n,i,t[o+8],11,-2022574463),i=Fr(i,s,r,n,t[o+11],16,1839030562),n=Fr(n,i,s,r,t[o+14],23,-35309556),r=Fr(r,n,i,s,t[o+1],4,-1530992060),s=Fr(s,r,n,i,t[o+4],11,1272893353),i=Fr(i,s,r,n,t[o+7],16,-155497632),n=Fr(n,i,s,r,t[o+10],23,-1094730640),r=Fr(r,n,i,s,t[o+13],4,681279174),s=Fr(s,r,n,i,t[o],11,-358537222),i=Fr(i,s,r,n,t[o+3],16,-722521979),n=Fr(n,i,s,r,t[o+6],23,76029189),r=Fr(r,n,i,s,t[o+9],4,-640364487),s=Fr(s,r,n,i,t[o+12],11,-421815835),i=Fr(i,s,r,n,t[o+15],16,530742520),n=Fr(n,i,s,r,t[o+2],23,-995338651),r=Kr(r,n,i,s,t[o],6,-198630844),s=Kr(s,r,n,i,t[o+7],10,1126891415),i=Kr(i,s,r,n,t[o+14],15,-1416354905),n=Kr(n,i,s,r,t[o+5],21,-57434055),r=Kr(r,n,i,s,t[o+12],6,1700485571),s=Kr(s,r,n,i,t[o+3],10,-1894986606),i=Kr(i,s,r,n,t[o+10],15,-1051523),n=Kr(n,i,s,r,t[o+1],21,-2054922799),r=Kr(r,n,i,s,t[o+8],6,1873313359),s=Kr(s,r,n,i,t[o+15],10,-30611744),i=Kr(i,s,r,n,t[o+6],15,-1560198380),n=Kr(n,i,s,r,t[o+13],21,1309151649),r=Kr(r,n,i,s,t[o+4],6,-145523070),s=Kr(s,r,n,i,t[o+11],10,-1120210379),i=Kr(i,s,r,n,t[o+2],15,718787259),n=Kr(n,i,s,r,t[o+9],21,-343485551),r=lo(r,c),n=lo(n,u),i=lo(i,d),s=lo(s,f)}return[r,n,i,s]}function lW(t){if(t.length===0)return[];for(var e=t.length*8,r=new Uint32Array(FO(e)),n=0;n<e;n+=8)r[n>>5]|=(t[n/8]&255)<<n%32;return r}function lo(t,e){var r=(t&65535)+(e&65535),n=(t>>16)+(e>>16)+(r>>16);return n<<16|r&65535}function dW(t,e){return t<<e|t>>>32-e}function W0(t,e,r,n,i,s){return lo(dW(lo(lo(e,t),lo(n,s)),i),r)}function Ur(t,e,r,n,i,s,o){return W0(e&r|~e&n,t,e,i,s,o)}function Vr(t,e,r,n,i,s,o){return W0(e&n|r&~n,t,e,i,s,o)}function Fr(t,e,r,n,i,s,o){return W0(e^r^n,t,e,i,s,o)}function Kr(t,e,r,n,i,s,o){return W0(r^(e|~n),t,e,i,s,o)}var KO,WO=Lr(()=>{a();KO=aW});var fW,jO,HO=Lr(()=>{a();WA();WO();fW=K0("v3",48,KO),jO=fW});function hW(t,e,r){t=t||{};var n=t.random||(t.rng||ff)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return uo(n)}var GO,$O=Lr(()=>{a();qA();pf();GO=hW});function pW(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function jA(t,e){return t<<e|t>>>32-e}function gW(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var s=t.length/4+2,o=Math.ceil(s/16),c=new Array(o),u=0;u<o;++u){for(var d=new Uint32Array(16),f=0;f<16;++f)d[f]=t[u*64+f*4]<<24|t[u*64+f*4+1]<<16|t[u*64+f*4+2]<<8|t[u*64+f*4+3];c[u]=d}c[o-1][14]=(t.length-1)*8/Math.pow(2,32),c[o-1][14]=Math.floor(c[o-1][14]),c[o-1][15]=(t.length-1)*8&4294967295;for(var m=0;m<o;++m){for(var _=new Uint32Array(80),v=0;v<16;++v)_[v]=c[m][v];for(var P=16;P<80;++P)_[P]=jA(_[P-3]^_[P-8]^_[P-14]^_[P-16],1);for(var B=r[0],k=r[1],T=r[2],L=r[3],M=r[4],F=0;F<80;++F){var Q=Math.floor(F/20),W=jA(B,5)+pW(Q,k,T,L)+M+e[Q]+_[F]>>>0;M=L,L=T,T=jA(k,30)>>>0,k=B,B=W}r[0]=r[0]+B>>>0,r[1]=r[1]+k>>>0,r[2]=r[2]+T>>>0,r[3]=r[3]+L>>>0,r[4]=r[4]+M>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var ZO,YO=Lr(()=>{a();ZO=gW});var yW,XO,JO=Lr(()=>{a();WA();YO();yW=K0("v5",80,ZO),XO=yW});var QO,eB=Lr(()=>{a();QO="00000000-0000-0000-0000-000000000000"});function mW(t){if(!co(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}var tB,rB=Lr(()=>{a();hf();tB=mW});var HA={};jq(HA,{NIL:()=>QO,parse:()=>F0,stringify:()=>uo,v1:()=>UO,v3:()=>jO,v4:()=>GO,v5:()=>XO,validate:()=>co,version:()=>tB});var GA=Lr(()=>{a();VO();HO();$O();JO();eB();rB();hf();pf();KA()});var iB=S((dAe,nB)=>{"use strict";a();var bW=(GA(),CP(HA)).v4,_W=function(t,e,r,n){if(typeof t!="string")throw new TypeError(t+" must be a string");n=n||{};let i=typeof n.version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");let s={method:t};if(i===2&&(s.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");s.params=e}if(typeof r>"u"){let o=typeof n.generator=="function"?n.generator:function(){return bW()};s.id=o(s,n)}else i===2&&r===null?n.notificationIdNull&&(s.id=null):s.id=r;return s};nB.exports=_W});var oB=S((hAe,sB)=>{"use strict";a();var AW=(GA(),CP(HA)).v4,SW=iB(),gf=function(t,e){if(!(this instanceof gf))return new gf(t,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return AW()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=t};sB.exports=gf;gf.prototype.request=function(t,e,r,n){let i=this,s=null,o=Array.isArray(t)&&typeof e=="function";if(this.options.version===1&&o)throw new TypeError("JSON-RPC 1.0 does not support batching");if(o||!o&&t&&typeof t=="object"&&typeof e=="function")n=e,s=t;else{typeof r=="function"&&(n=r,r=void 0);let d=typeof n=="function";try{s=SW(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(f){if(d){n(f);return}throw f}if(!d)return s}let u;try{u=JSON.stringify(s,this.options.replacer)}catch(d){n(d);return}return this.callServer(u,function(d,f){i._parseResponse(d,f,n)}),s};gf.prototype._parseResponse=function(t,e,r){if(t){r(t);return}if(!e){r();return}let n;try{n=JSON.parse(e,this.options.reviver)}catch(i){r(i);return}if(r.length===3)if(Array.isArray(n)){let i=function(o){return typeof o.error<"u"},s=function(o){return!i(o)};r(null,n.filter(i),n.filter(s));return}else{r(null,n.error,n.result);return}r(null,n)}});var cB=S((gAe,$A)=>{"use strict";a();var vW=Object.prototype.hasOwnProperty,rn="~";function yf(){}Object.create&&(yf.prototype=Object.create(null),new yf().__proto__||(rn=!1));function EW(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function aB(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new EW(r,n||t,i),o=rn?rn+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],s]:t._events[o].push(s):(t._events[o]=s,t._eventsCount++),t}function j0(t,e){--t._eventsCount===0?t._events=new yf:delete t._events[e]}function Wr(){this._events=new yf,this._eventsCount=0}Wr.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)vW.call(r,n)&&e.push(rn?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Wr.prototype.listeners=function(e){var r=rn?rn+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};Wr.prototype.listenerCount=function(e){var r=rn?rn+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Wr.prototype.emit=function(e,r,n,i,s,o){var c=rn?rn+e:e;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,f,m;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,i),!0;case 5:return u.fn.call(u.context,r,n,i,s),!0;case 6:return u.fn.call(u.context,r,n,i,s,o),!0}for(m=1,f=new Array(d-1);m<d;m++)f[m-1]=arguments[m];u.fn.apply(u.context,f)}else{var _=u.length,v;for(m=0;m<_;m++)switch(u[m].once&&this.removeListener(e,u[m].fn,void 0,!0),d){case 1:u[m].fn.call(u[m].context);break;case 2:u[m].fn.call(u[m].context,r);break;case 3:u[m].fn.call(u[m].context,r,n);break;case 4:u[m].fn.call(u[m].context,r,n,i);break;default:if(!f)for(v=1,f=new Array(d-1);v<d;v++)f[v-1]=arguments[v];u[m].fn.apply(u[m].context,f)}}return!0};Wr.prototype.on=function(e,r,n){return aB(this,e,r,n,!1)};Wr.prototype.once=function(e,r,n){return aB(this,e,r,n,!0)};Wr.prototype.removeListener=function(e,r,n,i){var s=rn?rn+e:e;if(!this._events[s])return this;if(!r)return j0(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&j0(this,s);else{for(var c=0,u=[],d=o.length;c<d;c++)(o[c].fn!==r||i&&!o[c].once||n&&o[c].context!==n)&&u.push(o[c]);u.length?this._events[s]=u.length===1?u[0]:u:j0(this,s)}return this};Wr.prototype.removeAllListeners=function(e){var r;return e?(r=rn?rn+e:e,this._events[r]&&j0(this,r)):(this._events=new yf,this._eventsCount=0),this};Wr.prototype.off=Wr.prototype.removeListener;Wr.prototype.addListener=Wr.prototype.on;Wr.prefixed=rn;Wr.EventEmitter=Wr;typeof $A<"u"&&($A.exports=Wr)});var yy=S(Ja=>{"use strict";a();Object.defineProperty(Ja,"__esModule",{value:!0});var g7=t=>({__option:"Some",value:t}),y7=()=>({__option:"None"}),m7=t=>t&&typeof t=="object"&&"__option"in t&&(t.__option==="Some"&&"value"in t||t.__option==="None"),b7=t=>t.__option==="Some",_7=t=>t.__option==="None";Ja.isNone=_7;Ja.isOption=m7;Ja.isSome=b7;Ja.none=y7;Ja.some=g7});var HT=S(ec=>{"use strict";a();Object.defineProperty(ec,"__esModule",{value:!0});var Qa=yy();function A7(t,e){return Qa.isSome(t)?t.value:e?e():null}var S7=t=>t!==null?Qa.some(t):Qa.none(),v7=t=>t!=null?Qa.some(t):Qa.none(),E7=t=>Qa.isSome(t)?t.value:null,w7=(t,e)=>Qa.isSome(t)?t.value:e();ec.unwrapOption=A7;ec.unwrapSome=E7;ec.unwrapSomeOrElse=w7;ec.wrapNullable=S7;ec.wrapNullish=v7});var $T=S(cv=>{"use strict";a();Object.defineProperty(cv,"__esModule",{value:!0});var GT=yy();function av(t,e){if(!t||ArrayBuffer.isView(t))return t;let r=n=>e?av(n,e):av(n);return GT.isOption(t)?GT.isSome(t)?r(t.value):e?e():null:Array.isArray(t)?t.map(r):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([n,i])=>[n,r(i)])):t}cv.unwrapOptionRecursively=av});var uv=S(kn=>{"use strict";a();Object.defineProperty(kn,"__esModule",{value:!0});var zf=yy(),kf=HT(),x7=$T();kn.isNone=zf.isNone;kn.isOption=zf.isOption;kn.isSome=zf.isSome;kn.none=zf.none;kn.some=zf.some;kn.unwrapOption=kf.unwrapOption;kn.unwrapSome=kf.unwrapSome;kn.unwrapSomeOrElse=kf.unwrapSomeOrElse;kn.wrapNullable=kf.wrapNullable;kn.wrapNullish=kf.wrapNullish;kn.unwrapOptionRecursively=x7.unwrapOptionRecursively});var Cf=S(dv=>{"use strict";a();Object.defineProperty(dv,"__esModule",{value:!0});var lv=class extends Error{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i),this.cause=n}};dv.InvalidBaseStringError=lv});var my=S(fv=>{"use strict";a();Object.defineProperty(fv,"__esModule",{value:!0});var I7=Cf(),P7=t=>{let e=t.length,r=BigInt(e);return{description:`base${e}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${t}]*$`)))throw new I7.InvalidBaseStringError(n,e);if(n==="")return new Uint8Array;let i=[...n],s=i.findIndex(m=>m!==t[0]);s=s===-1?i.length:s;let o=Array(s).fill(0);if(s===i.length)return Uint8Array.from(o);let c=i.slice(s),u=0n,d=1n;for(let m=c.length-1;m>=0;m-=1)u+=d*BigInt(t.indexOf(c[m])),d*=r;let f=[];for(;u>0n;)f.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(o.concat(f))},deserialize(n,i=0){if(n.length===0)return["",0];let s=n.slice(i),o=s.findIndex(f=>f!==0);o=o===-1?s.length:o;let c=t[0].repeat(o);if(o===s.length)return[c,n.length];let u=s.slice(o).reduce((f,m)=>f*256n+BigInt(m),0n),d=[];for(;u>0n;)d.unshift(t[Number(u%r)]),u/=r;return[c+d.join(""),n.length]}}};fv.baseX=P7});var ZT=S(hv=>{"use strict";a();Object.defineProperty(hv,"__esModule",{value:!0});var R7=my(),O7=R7.baseX("0123456789");hv.base10=O7});var YT=S(pv=>{"use strict";a();Object.defineProperty(pv,"__esModule",{value:!0});var B7=Cf(),T7={description:"base16",fixedSize:null,maxSize:null,serialize(t){let e=t.toLowerCase();if(!e.match(/^[0123456789abcdef]*$/))throw new B7.InvalidBaseStringError(t,16);let r=e.match(/.{1,2}/g);return Uint8Array.from(r?r.map(n=>parseInt(n,16)):[])},deserialize(t,e=0){return[t.slice(e).reduce((n,i)=>n+i.toString(16).padStart(2,"0"),""),t.length]}};pv.base16=T7});var XT=S(gv=>{"use strict";a();Object.defineProperty(gv,"__esModule",{value:!0});var z7=my(),k7=z7.baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");gv.base58=k7});var by=S(Nf=>{"use strict";a();Object.defineProperty(Nf,"__esModule",{value:!0});var C7=t=>{let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r},JT=(t,e)=>{if(t.length>=e)return t;let r=new Uint8Array(e).fill(0);return r.set(t),r},N7=(t,e)=>JT(t.slice(0,e),e);Nf.fixBytes=N7;Nf.mergeBytes=C7;Nf.padBytes=JT});var _y=S(Mf=>{"use strict";a();Object.defineProperty(Mf,"__esModule",{value:!0});var yv=class extends Error{name="DeserializingEmptyBufferError";constructor(e){super(`Serializer [${e}] cannot deserialize empty buffers.`)}},mv=class extends Error{name="NotEnoughBytesError";constructor(e,r,n){super(`Serializer [${e}] expected ${r} bytes, got ${n}.`)}},bv=class extends Error{name="ExpectedFixedSizeSerializerError";constructor(e){e??="Expected a fixed-size serializer, got a variable-size one.",super(e)}};Mf.DeserializingEmptyBufferError=yv;Mf.ExpectedFixedSizeSerializerError=bv;Mf.NotEnoughBytesError=mv});var ez=S(_v=>{"use strict";a();Object.defineProperty(_v,"__esModule",{value:!0});var QT=by(),M7=_y();function L7(t,e,r){return{description:r??`fixed(${e}, ${t.description})`,fixedSize:e,maxSize:e,serialize:n=>QT.fixBytes(t.serialize(n),e),deserialize:(n,i=0)=>{if(n=n.slice(i,i+e),n.length<e)throw new M7.NotEnoughBytesError("fixSerializer",e,n.length);t.fixedSize!==null&&(n=QT.fixBytes(n,t.fixedSize));let[s]=t.deserialize(n,0);return[s,i+e]}}}_v.fixSerializer=L7});var tz=S(Av=>{"use strict";a();Object.defineProperty(Av,"__esModule",{value:!0});function D7(t,e,r){return{description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize,serialize:n=>t.serialize(e(n)),deserialize:(n,i=0)=>{let[s,o]=t.deserialize(n,i);return r?[r(s,n,i),o]:[s,o]}}}Av.mapSerializer=D7});var rz=S(Sv=>{"use strict";a();Object.defineProperty(Sv,"__esModule",{value:!0});var q7=by(),U7=_y();function V7(t){if(t.fixedSize===null)throw new U7.ExpectedFixedSizeSerializerError("Cannot reverse a serializer of variable size.");return{...t,serialize:e=>t.serialize(e).reverse(),deserialize:(e,r=0)=>{let n=t.fixedSize,i=q7.mergeBytes([e.slice(0,r),e.slice(r,r+n).reverse(),e.slice(r+n)]);return t.deserialize(i,r)}}}Sv.reverseSerializer=V7});var _r=S(wi=>{"use strict";a();Object.defineProperty(wi,"__esModule",{value:!0});var vv=by(),Ev=_y(),F7=ez(),K7=tz(),W7=rz();wi.fixBytes=vv.fixBytes;wi.mergeBytes=vv.mergeBytes;wi.padBytes=vv.padBytes;wi.DeserializingEmptyBufferError=Ev.DeserializingEmptyBufferError;wi.ExpectedFixedSizeSerializerError=Ev.ExpectedFixedSizeSerializerError;wi.NotEnoughBytesError=Ev.NotEnoughBytesError;wi.fixSerializer=F7.fixSerializer;wi.mapSerializer=K7.mapSerializer;wi.reverseSerializer=W7.reverseSerializer});var xv=S(wv=>{"use strict";a();Object.defineProperty(wv,"__esModule",{value:!0});var j7=Cf(),H7=(t,e)=>{let r=t.length,n=(i,s,o,c)=>{let u=[],d=0,f=0,m=(1<<o)-1;for(let _ of i)for(d=d<<s|_,f+=s;f>=o;)f-=o,u.push(d>>f&m);return c&&f>0&&u.push(d<<o-f&m),u};return{description:`base${r}`,fixedSize:null,maxSize:null,serialize(i){if(!i.match(new RegExp(`^[${t}]*$`)))throw new j7.InvalidBaseStringError(i,r);if(i==="")return new Uint8Array;let s=[...i].map(c=>t.indexOf(c)),o=n(s,e,8,!1);return Uint8Array.from(o)},deserialize(i,s=0){if(i.length===0)return["",0];let o=[...i.slice(s)];return[n(o,8,e,!0).map(u=>t[u]).join(""),i.length]}}};wv.baseXReslice=H7});var nz=S(Iv=>{"use strict";a();Object.defineProperty(Iv,"__esModule",{value:!0});var G7=_r(),$7=xv(),Z7=G7.mapSerializer($7.baseXReslice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",6),t=>t.replace(/=/g,""),t=>t.padEnd(Math.ceil(t.length/4)*4,"="));Iv.base64=Z7});var Pv=S(Ay=>{"use strict";a();Object.defineProperty(Ay,"__esModule",{value:!0});var Y7=t=>t.replace(/\u0000/g,""),X7=(t,e)=>t.padEnd(e,"\0");Ay.padNullCharacters=X7;Ay.removeNullCharacters=Y7});var iz=S(Rv=>{"use strict";a();Object.defineProperty(Rv,"__esModule",{value:!0});var J7=Pv(),Q7={description:"utf8",fixedSize:null,maxSize:null,serialize(t){return new TextEncoder().encode(t)},deserialize(t,e=0){let r=new TextDecoder().decode(t.slice(e));return[J7.removeNullCharacters(r),t.length]}};Rv.utf8=Q7});var Sy=S(Hn=>{"use strict";a();Object.defineProperty(Hn,"__esModule",{value:!0});var eG=ZT(),tG=YT(),rG=XT(),nG=nz(),iG=my(),sG=xv(),oG=Cf(),sz=Pv(),aG=iz();Hn.base10=eG.base10;Hn.base16=tG.base16;Hn.base58=rG.base58;Hn.base64=nG.base64;Hn.baseX=iG.baseX;Hn.baseXReslice=sG.baseXReslice;Hn.InvalidBaseStringError=oG.InvalidBaseStringError;Hn.padNullCharacters=sz.padNullCharacters;Hn.removeNullCharacters=sz.removeNullCharacters;Hn.utf8=aG.utf8});var Tv=S(Bv=>{"use strict";a();Object.defineProperty(Bv,"__esModule",{value:!0});var Ov=class extends Error{name="InvalidPublicKeyError";constructor(e,r){r=r?`. ${r}`:"",super(`The provided public key is invalid: ${e}${r}`),this.invalidPublicKey=e}};Bv.InvalidPublicKeyError=Ov});var uz=S(Gn=>{"use strict";a();Object.defineProperty(Gn,"__esModule",{value:!0});var oz=Sy(),vy=Tv(),zv=32;function Ey(t,e=!0){let r=typeof t=="string"?t:typeof t=="object"&&"publicKey"in t?t.publicKey:typeof t=="object"&&"toBase58"in t?t.toBase58():Array.isArray(t)?t[0]:oz.base58.deserialize(t)[0];return e&&kv(r),r}var cG=()=>"11111111111111111111111111111111",az=t=>{try{return kv(t),!0}catch{return!1}},uG=t=>Array.isArray(t)&&t.length===2&&typeof t[1]=="number"&&az(t[0]);function kv(t){if(typeof t!="string")throw new vy.InvalidPublicKeyError(t,"Public keys must be strings.");cz(t)}var lG=t=>[...new Set(t)],cz=t=>{if(t.length<32||t.length>44)throw new vy.InvalidPublicKeyError(t,"Public keys must be between 32 and 44 characters.");let e;try{e=oz.base58.serialize(t)}catch{throw new vy.InvalidPublicKeyError(t,"Public keys must be base58 encoded.")}if(e.length!==zv)throw new vy.InvalidPublicKeyError(t,`Public keys must be ${zv} bytes.`);return e},dG=t=>Ey(t),fG=(t,e)=>Ey(t)===Ey(e);Gn.PUBLIC_KEY_LENGTH=zv;Gn.assertPublicKey=kv;Gn.base58PublicKey=dG;Gn.defaultPublicKey=cG;Gn.isPda=uG;Gn.isPublicKey=az;Gn.publicKey=Ey;Gn.publicKeyBytes=cz;Gn.samePublicKey=fG;Gn.uniquePublicKeys=lG});var wy=S(Cn=>{"use strict";a();Object.defineProperty(Cn,"__esModule",{value:!0});var Ui=uz(),hG=Tv();Cn.PUBLIC_KEY_LENGTH=Ui.PUBLIC_KEY_LENGTH;Cn.assertPublicKey=Ui.assertPublicKey;Cn.base58PublicKey=Ui.base58PublicKey;Cn.defaultPublicKey=Ui.defaultPublicKey;Cn.isPda=Ui.isPda;Cn.isPublicKey=Ui.isPublicKey;Cn.publicKey=Ui.publicKey;Cn.publicKeyBytes=Ui.publicKeyBytes;Cn.samePublicKey=Ui.samePublicKey;Cn.uniquePublicKeys=Ui.uniquePublicKeys;Cn.InvalidPublicKeyError=hG.InvalidPublicKeyError});var Cv=S(Lf=>{"use strict";a();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.Endian=void 0;(function(t){t.Little="le",t.Big="be"})(Lf.Endian||(Lf.Endian={}))});var Lv=S(Mv=>{"use strict";a();Object.defineProperty(Mv,"__esModule",{value:!0});var Nv=class extends RangeError{name="NumberOutOfRangeError";constructor(e,r,n,i){super(`Serializer [${e}] expected number to be between ${r} and ${n}, got ${i}.`)}};Mv.NumberOutOfRangeError=Nv});var gn=S(tc=>{"use strict";a();Object.defineProperty(tc,"__esModule",{value:!0});var lz=_r(),pG=Cv(),gG=Lv();function yG(t){let e,r=t.name;return t.size>1&&(e=!("endian"in t.options)||t.options.endian===pG.Endian.Little,r+=e?"(le)":"(be)"),{description:t.options.description??r,fixedSize:t.size,maxSize:t.size,serialize(n){t.range&&hz(t.name,t.range[0],t.range[1],n);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),n,e),new Uint8Array(i)},deserialize(n,i=0){let s=n.slice(i,i+t.size);pz("i8",s,t.size);let o=fz(s);return[t.get(o,e),i+t.size]}}}var dz=t=>t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset),fz=t=>new DataView(dz(t)),hz=(t,e,r,n)=>{if(n<e||n>r)throw new gG.NumberOutOfRangeError(t,e,r,n)},pz=(t,e,r)=>{if(e.length===0)throw new lz.DeserializingEmptyBufferError(t);if(e.length<r)throw new lz.NotEnoughBytesError(t,r,e.length)};tc.assertEnoughBytes=pz;tc.assertRange=hz;tc.numberFactory=yG;tc.toArrayBuffer=dz;tc.toDataView=fz});var gz=S(Dv=>{"use strict";a();Object.defineProperty(Dv,"__esModule",{value:!0});var mG=gn(),bG=(t={})=>mG.numberFactory({name:"f32",size:4,set:(e,r,n)=>e.setFloat32(0,Number(r),n),get:(e,r)=>e.getFloat32(0,r),options:t});Dv.f32=bG});var yz=S(qv=>{"use strict";a();Object.defineProperty(qv,"__esModule",{value:!0});var _G=gn(),AG=(t={})=>_G.numberFactory({name:"f64",size:8,set:(e,r,n)=>e.setFloat64(0,Number(r),n),get:(e,r)=>e.getFloat64(0,r),options:t});qv.f64=AG});var mz=S(Uv=>{"use strict";a();Object.defineProperty(Uv,"__esModule",{value:!0});var SG=gn(),vG=(t={})=>SG.numberFactory({name:"i8",size:1,range:[-+"0x7f"-1,+"0x7f"],set:(e,r)=>e.setInt8(0,Number(r)),get:e=>e.getInt8(0),options:t});Uv.i8=vG});var bz=S(Vv=>{"use strict";a();Object.defineProperty(Vv,"__esModule",{value:!0});var EG=gn(),wG=(t={})=>EG.numberFactory({name:"i16",size:2,range:[-+"0x7fff"-1,+"0x7fff"],set:(e,r,n)=>e.setInt16(0,Number(r),n),get:(e,r)=>e.getInt16(0,r),options:t});Vv.i16=wG});var _z=S(Fv=>{"use strict";a();Object.defineProperty(Fv,"__esModule",{value:!0});var xG=gn(),IG=(t={})=>xG.numberFactory({name:"i32",size:4,range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(e,r,n)=>e.setInt32(0,Number(r),n),get:(e,r)=>e.getInt32(0,r),options:t});Fv.i32=IG});var Az=S(Kv=>{"use strict";a();Object.defineProperty(Kv,"__esModule",{value:!0});var PG=gn(),RG=(t={})=>PG.numberFactory({name:"i64",size:8,range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(e,r,n)=>e.setBigInt64(0,BigInt(r),n),get:(e,r)=>e.getBigInt64(0,r),options:t});Kv.i64=RG});var Sz=S(Wv=>{"use strict";a();Object.defineProperty(Wv,"__esModule",{value:!0});var OG=gn(),BG=(t={})=>OG.numberFactory({name:"i128",size:16,range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigInt64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigInt64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});Wv.i128=BG});var vz=S(jv=>{"use strict";a();Object.defineProperty(jv,"__esModule",{value:!0});var TG=gn(),zG=(t={})=>TG.numberFactory({name:"u8",size:1,range:[0,+"0xff"],set:(e,r)=>e.setUint8(0,Number(r)),get:e=>e.getUint8(0),options:t});jv.u8=zG});var Ez=S(Hv=>{"use strict";a();Object.defineProperty(Hv,"__esModule",{value:!0});var kG=gn(),CG=(t={})=>kG.numberFactory({name:"u16",size:2,range:[0,+"0xffff"],set:(e,r,n)=>e.setUint16(0,Number(r),n),get:(e,r)=>e.getUint16(0,r),options:t});Hv.u16=CG});var wz=S(Gv=>{"use strict";a();Object.defineProperty(Gv,"__esModule",{value:!0});var NG=gn(),MG=(t={})=>NG.numberFactory({name:"u32",size:4,range:[0,+"0xffffffff"],set:(e,r,n)=>e.setUint32(0,Number(r),n),get:(e,r)=>e.getUint32(0,r),options:t});Gv.u32=MG});var xz=S($v=>{"use strict";a();Object.defineProperty($v,"__esModule",{value:!0});var LG=gn(),DG=(t={})=>LG.numberFactory({name:"u64",size:8,range:[0,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),get:(e,r)=>e.getBigUint64(0,r),options:t});$v.u64=DG});var Iz=S(Zv=>{"use strict";a();Object.defineProperty(Zv,"__esModule",{value:!0});var qG=gn(),UG=(t={})=>qG.numberFactory({name:"u128",size:16,range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigUint64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigUint64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});Zv.u128=UG});var Pz=S(Yv=>{"use strict";a();Object.defineProperty(Yv,"__esModule",{value:!0});var VG=gn(),FG=(t={})=>({description:t.description??"shortU16",fixedSize:null,maxSize:3,serialize:e=>{VG.assertRange("shortU16",0,65535,e);let r=[0];for(let n=0;;n+=1){let i=e>>n*7;if(i===0)break;let s=127&i;r[n]=s,n>0&&(r[n-1]|=128)}return new Uint8Array(r)},deserialize:(e,r=0)=>{let n=0,i=0;for(;++i;){let s=i-1,o=e[r+s],c=127&o;if(n|=c<<s*7,(o&128)===0)break}return[n,r+i]}});Yv.shortU16=FG});var xi=S(zr=>{"use strict";a();Object.defineProperty(zr,"__esModule",{value:!0});var KG=Cv(),WG=Lv(),jG=gz(),HG=yz(),GG=mz(),$G=bz(),ZG=_z(),YG=Az(),XG=Sz(),JG=vz(),QG=Ez(),e$=wz(),t$=xz(),r$=Iz(),n$=Pz();Object.defineProperty(zr,"Endian",{enumerable:!0,get:function(){return KG.Endian}});zr.NumberOutOfRangeError=WG.NumberOutOfRangeError;zr.f32=jG.f32;zr.f64=HG.f64;zr.i8=GG.i8;zr.i16=$G.i16;zr.i32=ZG.i32;zr.i64=YG.i64;zr.i128=XG.i128;zr.u8=JG.u8;zr.u16=QG.u16;zr.u32=e$.u32;zr.u64=t$.u64;zr.u128=r$.u128;zr.shortU16=n$.shortU16});var Cs=S(Ao=>{"use strict";a();Object.defineProperty(Ao,"__esModule",{value:!0});var Xv=class extends Error{name="InvalidNumberOfItemsError";constructor(e,r,n){super(`Expected [${e}] to have ${r} items, got ${n}.`)}},Jv=class extends Error{name="InvalidArrayLikeRemainderSizeError";constructor(e,r){super(`The remainder of the buffer (${e} bytes) cannot be split into chunks of ${r} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${e} modulo ${r} should be equal to zero.`)}},Qv=class extends Error{name="UnrecognizedArrayLikeSerializerSizeError";constructor(e){super(`Unrecognized array-like serializer size: ${JSON.stringify(e)}`)}},eE=class extends Error{name="InvalidDataEnumVariantError";constructor(e,r){super(`Invalid data enum variant. Expected one of [${r.join(", ")}], got "${e}".`)}},tE=class extends Error{name="InvalidScalarEnumVariantError";constructor(e,r,n,i){super(`Invalid scalar enum variant. Expected one of [${r.join(", ")}] or a number between ${n} and ${i}, got "${e}".`)}},rE=class extends RangeError{name="EnumDiscriminatorOutOfRangeError";constructor(e,r,n){super(`Enum discriminator out of range. Expected a number between ${r} and ${n}, got ${e}.`)}};Ao.EnumDiscriminatorOutOfRangeError=rE;Ao.InvalidArrayLikeRemainderSizeError=Jv;Ao.InvalidDataEnumVariantError=eE;Ao.InvalidNumberOfItemsError=Xv;Ao.InvalidScalarEnumVariantError=tE;Ao.UnrecognizedArrayLikeSerializerSizeError=Qv});var So=S(nE=>{"use strict";a();Object.defineProperty(nE,"__esModule",{value:!0});function i$(t){return t.reduce((e,r)=>e===null||r===null?null:e+r,0)}nE.sumSerializerSizes=i$});var vo=S(Fu=>{"use strict";a();Object.defineProperty(Fu,"__esModule",{value:!0});var s$=Cs(),o$=So();function a$(t,e,r){if(typeof t=="number")return[t,r];if(typeof t=="object")return t.deserialize(e,r);throw new s$.UnrecognizedArrayLikeSerializerSizeError(t)}function c$(t){return typeof t=="object"?t.description:`${t}`}function u$(t,e){if(typeof t!="number")return null;if(t===0)return 0;let r=o$.sumSerializerSizes(e);return r===null?null:r*t}function l$(t,e){return typeof t=="object"?t.serialize(e):new Uint8Array}Fu.getResolvedSize=a$;Fu.getSizeDescription=c$;Fu.getSizeFromChildren=u$;Fu.getSizePrefix=l$});var Rz=S(iE=>{"use strict";a();Object.defineProperty(iE,"__esModule",{value:!0});var d$=_r(),f$=xi(),h$=Cs(),Df=vo();function p$(t,e={}){let r=e.size??f$.u32();return{description:e.description??`array(${t.description}; ${Df.getSizeDescription(r)})`,fixedSize:Df.getSizeFromChildren(r,[t.fixedSize]),maxSize:Df.getSizeFromChildren(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.length!==r)throw new h$.InvalidNumberOfItemsError("array",r,n.length);return d$.mergeBytes([Df.getSizePrefix(r,n.length),...n.map(i=>t.serialize(i))])},deserialize:(n,i=0)=>{let s=[];if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.push(u),i=d}return[s,i]}let[o,c]=Df.getResolvedSize(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.push(d),i=f}return[s,i]}}}iE.array=p$});var Oz=S(sE=>{"use strict";a();Object.defineProperty(sE,"__esModule",{value:!0});var g$=_r(),y$=(t,e={})=>{let r=typeof e=="boolean"?{backward:e}:e,n=r.backward??!1,i=n?"; backward":"";return{description:r.description??`bitArray(${t}${i})`,fixedSize:t,maxSize:t,serialize(s){let o=[];for(let c=0;c<t;c+=1){let u=0;for(let d=0;d<8;d+=1){let f=Number(s[c*8+d]??0);u|=f<<(n?d:7-d)}n?o.unshift(u):o.push(u)}return new Uint8Array(o)},deserialize(s,o=0){let c=[],u=s.slice(o,o+t);if(u=n?u.reverse():u,u.length!==t)throw new g$.NotEnoughBytesError("bitArray",t,u.length);return u.forEach(d=>{for(let f=0;f<8;f+=1)n?(c.push(!!(d&1)),d>>=1):(c.push(!!(d&128)),d<<=1)}),[c,o+t]}}};sE.bitArray=y$});var Tz=S(oE=>{"use strict";a();Object.defineProperty(oE,"__esModule",{value:!0});var Bz=_r(),m$=xi();function b$(t={}){let e=t.size??m$.u8();if(e.fixedSize===null)throw new Bz.ExpectedFixedSizeSerializerError("Serializer [bool] requires a fixed size.");return{description:t.description??`bool(${e.description})`,fixedSize:e.fixedSize,maxSize:e.fixedSize,serialize:r=>e.serialize(r?1:0),deserialize:(r,n=0)=>{if(r.slice(n).length===0)throw new Bz.DeserializingEmptyBufferError("bool");let[i,s]=e.deserialize(r,n);return[i===1,s]}}}oE.bool=b$});var zz=S(aE=>{"use strict";a();Object.defineProperty(aE,"__esModule",{value:!0});var xy=_r(),_$=vo();function A$(t={}){let e=t.size??"variable",r=t.description??`bytes(${_$.getSizeDescription(e)})`,n={description:r,fixedSize:null,maxSize:null,serialize:i=>new Uint8Array(i),deserialize:(i,s=0)=>{let o=i.slice(s);return[o,s+o.length]}};return e==="variable"?n:typeof e=="number"?xy.fixSerializer(n,e,r):{description:r,fixedSize:null,maxSize:null,serialize:i=>{let s=n.serialize(i),o=e.serialize(s.length);return xy.mergeBytes([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new xy.DeserializingEmptyBufferError("bytes");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new xy.NotEnoughBytesError("bytes",u,d.length);let[f,m]=n.deserialize(d);return s+=m,[f,s]}}}aE.bytes=A$});var uE=S(cE=>{"use strict";a();Object.defineProperty(cE,"__esModule",{value:!0});function S$(t){return t.reduce((e,r)=>e===null||r===null?null:Math.max(e,r),0)}cE.maxSerializerSizes=S$});var Mz=S(lE=>{"use strict";a();Object.defineProperty(lE,"__esModule",{value:!0});var kz=_r(),v$=xi(),Cz=Cs(),E$=uE(),Nz=So();function w$(t,e={}){let r=e.size??v$.u8(),n=t.map(([c,u])=>`${String(c)}${u?`: ${u.description}`:""}`).join(", "),s=t.every((c,u,d)=>c[1].fixedSize===d[0][1].fixedSize)?t[0][1].fixedSize:null,o=E$.maxSerializerSizes(t.map(([,c])=>c.maxSize));return{description:e.description??`dataEnum(${n}; ${r.description})`,fixedSize:t.length===0?r.fixedSize:Nz.sumSerializerSizes([r.fixedSize,s]),maxSize:t.length===0?r.maxSize:Nz.sumSerializerSizes([r.maxSize,o]),serialize:c=>{let u=t.findIndex(([_])=>c.__kind===_);if(u<0)throw new Cz.InvalidDataEnumVariantError(c.__kind,t.map(([_])=>_));let d=r.serialize(u),m=t[u][1].serialize(c);return kz.mergeBytes([d,m])},deserialize:(c,u=0)=>{if(c.slice(u).length===0)throw new kz.DeserializingEmptyBufferError("dataEnum");let[d,f]=r.deserialize(c,u);u=f;let m=t[Number(d)]??null;if(!m)throw new Cz.EnumDiscriminatorOutOfRangeError(d,0,t.length-1);let[_,v]=m[1].deserialize(c,u);return u=v,[{__kind:m[0],..._??{}},u]}}}lE.dataEnum=w$});var Dz=S(dE=>{"use strict";a();Object.defineProperty(dE,"__esModule",{value:!0});var Lz=_r(),x$=xi(),I$=Cs(),qf=vo();function P$(t,e,r={}){let n=r.size??x$.u32();return{description:r.description??`map(${t.description}, ${e.description}; ${qf.getSizeDescription(n)})`,fixedSize:qf.getSizeFromChildren(n,[t.fixedSize,e.fixedSize]),maxSize:qf.getSizeFromChildren(n,[t.maxSize,e.maxSize]),serialize:i=>{if(typeof n=="number"&&i.size!==n)throw new I$.InvalidNumberOfItemsError("map",n,i.size);let s=Array.from(i,([o,c])=>Lz.mergeBytes([t.serialize(o),e.serialize(c)]));return Lz.mergeBytes([qf.getSizePrefix(n,i.size),...s])},deserialize:(i,s=0)=>{let o=new Map;if(typeof n=="object"&&i.slice(s).length===0)return[o,s];if(n==="remainder"){for(;s<i.length;){let[d,f]=t.deserialize(i,s);s=f;let[m,_]=e.deserialize(i,s);s=_,o.set(d,m)}return[o,s]}let[c,u]=qf.getResolvedSize(n,i,s);s=u;for(let d=0;d<c;d+=1){let[f,m]=t.deserialize(i,s);s=m;let[_,v]=e.deserialize(i,s);s=v,o.set(f,_)}return[o,s]}}}dE.map=P$});var qz=S(hE=>{"use strict";a();Object.defineProperty(hE,"__esModule",{value:!0});var fE=_r(),R$=xi(),O$=So(),B$=vo();function T$(t,e={}){let r=e.prefix??R$.u8(),n=e.fixed??!1,i=`; ${B$.getSizeDescription(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new fE.ExpectedFixedSizeSerializerError("Fixed nullables can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`nullable(${t.description+i})`,fixedSize:s,maxSize:O$.sumSerializerSizes([r.maxSize,t.maxSize]),serialize:o=>{let c=r.serialize(+(o!==null));if(n){let d=t.fixedSize,f=o!==null?t.serialize(o).slice(0,d):new Uint8Array(d).fill(0);return fE.mergeBytes([c,f])}let u=o!==null?t.serialize(o):new Uint8Array;return fE.mergeBytes([c,u])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[null,c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[null,n?u:c];let[m,_]=t.deserialize(o,c);return c=_,[m,n?u:c]}}}hE.nullable=T$});var Uz=S(gE=>{"use strict";a();Object.defineProperty(gE,"__esModule",{value:!0});var Eo=uv(),pE=_r(),z$=xi(),k$=So(),C$=vo();function N$(t,e={}){let r=e.prefix??z$.u8(),n=e.fixed??!1,i=`; ${C$.getSizeDescription(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new pE.ExpectedFixedSizeSerializerError("Fixed options can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`option(${t.description+i})`,fixedSize:s,maxSize:k$.sumSerializerSizes([r.maxSize,t.maxSize]),serialize:o=>{let c=Eo.isOption(o)?o:Eo.wrapNullable(o),u=r.serialize(Number(Eo.isSome(c)));if(n){let f=t.fixedSize,m=Eo.isSome(c)?t.serialize(c.value).slice(0,f):new Uint8Array(f).fill(0);return pE.mergeBytes([u,m])}let d=Eo.isSome(c)?t.serialize(c.value):new Uint8Array;return pE.mergeBytes([u,d])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[Eo.none(),c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[Eo.none(),n?u:c];let[m,_]=t.deserialize(o,c);return c=_,[Eo.some(m),n?u:c]}}}gE.option=N$});var Fz=S(yE=>{"use strict";a();Object.defineProperty(yE,"__esModule",{value:!0});var Uf=wy(),Vz=_r();function M$(t={}){return{description:t.description??"publicKey",fixedSize:32,maxSize:32,serialize:e=>Uf.publicKeyBytes(Uf.publicKey(e)),deserialize:(e,r=0)=>{let n=e.slice(r,r+32);if(n.length===0)throw new Vz.DeserializingEmptyBufferError("publicKey");if(n.length<Uf.PUBLIC_KEY_LENGTH)throw new Vz.NotEnoughBytesError("publicKey",Uf.PUBLIC_KEY_LENGTH,n.length);return[Uf.publicKey(n),r+32]}}}yE.publicKey=M$});var Wz=S(mE=>{"use strict";a();Object.defineProperty(mE,"__esModule",{value:!0});var L$=_r(),D$=xi(),Kz=Cs();function q$(t,e={}){let r=e.size??D$.u8(),n=Object.keys(t),i=Object.values(t),s=i.some(m=>typeof m=="number"),o=i.filter(m=>typeof m=="string").join(", "),c=0,u=s?i.length/2-1:i.length-1,d=s?[...n]:[...new Set([...n,...i])];function f(m){let _=typeof m=="number"&&(m<c||m>u),v=typeof m=="string"&&!d.includes(m);if(_||v)throw new Kz.InvalidScalarEnumVariantError(m,d,c,u)}return{description:e.description??`enum(${o}; ${r.description})`,fixedSize:r.fixedSize,maxSize:r.maxSize,serialize:m=>{if(f(m),typeof m=="number")return r.serialize(m);let _=i.indexOf(m);return _>=0?r.serialize(_):r.serialize(n.indexOf(m))},deserialize:(m,_=0)=>{if(m.slice(_).length===0)throw new L$.DeserializingEmptyBufferError("enum");let[v,P]=r.deserialize(m,_),B=Number(v);if(_=P,B<c||B>u)throw new Kz.EnumDiscriminatorOutOfRangeError(B,c,u);return[s?B:i[B],_]}}}mE.scalarEnum=q$});var jz=S(bE=>{"use strict";a();Object.defineProperty(bE,"__esModule",{value:!0});var U$=_r(),V$=xi(),F$=Cs(),Vf=vo();function K$(t,e={}){let r=e.size??V$.u32();return{description:e.description??`set(${t.description}; ${Vf.getSizeDescription(r)})`,fixedSize:Vf.getSizeFromChildren(r,[t.fixedSize]),maxSize:Vf.getSizeFromChildren(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.size!==r)throw new F$.InvalidNumberOfItemsError("set",r,n.size);let i=Array.from(n,s=>t.serialize(s));return U$.mergeBytes([Vf.getSizePrefix(r,n.size),...i])},deserialize:(n,i=0)=>{let s=new Set;if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.add(u),i=d}return[s,i]}let[o,c]=Vf.getResolvedSize(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.add(d),i=f}return[s,i]}}}bE.set=K$});var Hz=S(_E=>{"use strict";a();Object.defineProperty(_E,"__esModule",{value:!0});var Iy=_r(),W$=Sy(),j$=xi(),H$=vo();function G$(t={}){let e=t.size??j$.u32(),r=t.encoding??W$.utf8,n=t.description??`string(${r.description}; ${H$.getSizeDescription(e)})`;return e==="variable"?{...r,description:n}:typeof e=="number"?Iy.fixSerializer(r,e,n):{description:n,fixedSize:null,maxSize:null,serialize:i=>{let s=r.serialize(i),o=e.serialize(s.length);return Iy.mergeBytes([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Iy.DeserializingEmptyBufferError("string");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new Iy.NotEnoughBytesError("string",u,d.length);let[f,m]=r.deserialize(d);return s+=m,[f,s]}}}_E.string=G$});var $z=S(AE=>{"use strict";a();Object.defineProperty(AE,"__esModule",{value:!0});var $$=_r(),Gz=So();function Z$(t,e={}){let r=t.map(([n,i])=>`${String(n)}: ${i.description}`).join(", ");return{description:e.description??`struct(${r})`,fixedSize:Gz.sumSerializerSizes(t.map(([,n])=>n.fixedSize)),maxSize:Gz.sumSerializerSizes(t.map(([,n])=>n.maxSize)),serialize:n=>{let i=t.map(([s,o])=>o.serialize(n[s]));return $$.mergeBytes(i)},deserialize:(n,i=0)=>{let s={};return t.forEach(([o,c])=>{let[u,d]=c.deserialize(n,i);i=d,s[o]=u}),[s,i]}}}AE.struct=Z$});var Yz=S(SE=>{"use strict";a();Object.defineProperty(SE,"__esModule",{value:!0});var Y$=_r(),Zz=So(),X$=Cs();function J$(t,e={}){let r=t.map(n=>n.description).join(", ");return{description:e.description??`tuple(${r})`,fixedSize:Zz.sumSerializerSizes(t.map(n=>n.fixedSize)),maxSize:Zz.sumSerializerSizes(t.map(n=>n.maxSize)),serialize:n=>{if(n.length!==t.length)throw new X$.InvalidNumberOfItemsError("tuple",t.length,n.length);return Y$.mergeBytes(t.map((i,s)=>i.serialize(n[s])))},deserialize:(n,i=0)=>{let s=[];return t.forEach(o=>{let[c,u]=o.deserialize(n,i);s.push(c),i=u}),[s,i]}}}SE.tuple=J$});var Xz=S(vE=>{"use strict";a();Object.defineProperty(vE,"__esModule",{value:!0});function Q$(t={}){return{description:t.description??"unit",fixedSize:0,maxSize:0,serialize:()=>new Uint8Array,deserialize:(e,r=0)=>[void 0,r]}}vE.unit=Q$});var rc=S(Fe=>{"use strict";a();Object.defineProperty(Fe,"__esModule",{value:!0});var Jz=_r(),Qz=Sy(),ek=xi(),e9=Rz(),t9=Oz(),r9=Tz(),n9=zz(),i9=Mz(),Ku=Cs(),s9=Dz(),o9=qz(),a9=Uz(),c9=Fz(),u9=Wz(),l9=jz(),d9=Hz(),f9=$z(),h9=Yz(),p9=Xz(),g9=uE(),y9=So();Fe.array=e9.array;Fe.bitArray=t9.bitArray;Fe.bool=r9.bool;Fe.bytes=n9.bytes;Fe.dataEnum=i9.dataEnum;Fe.EnumDiscriminatorOutOfRangeError=Ku.EnumDiscriminatorOutOfRangeError;Fe.InvalidArrayLikeRemainderSizeError=Ku.InvalidArrayLikeRemainderSizeError;Fe.InvalidDataEnumVariantError=Ku.InvalidDataEnumVariantError;Fe.InvalidNumberOfItemsError=Ku.InvalidNumberOfItemsError;Fe.InvalidScalarEnumVariantError=Ku.InvalidScalarEnumVariantError;Fe.UnrecognizedArrayLikeSerializerSizeError=Ku.UnrecognizedArrayLikeSerializerSizeError;Fe.map=s9.map;Fe.nullable=o9.nullable;Fe.option=a9.option;Fe.publicKey=c9.publicKey;Fe.scalarEnum=u9.scalarEnum;Fe.set=l9.set;Fe.string=d9.string;Fe.struct=f9.struct;Fe.tuple=h9.tuple;Fe.unit=p9.unit;Fe.maxSerializerSizes=g9.maxSerializerSizes;Fe.sumSerializerSizes=y9.sumSerializerSizes;Object.keys(Jz).forEach(function(t){t!=="default"&&!Fe.hasOwnProperty(t)&&Object.defineProperty(Fe,t,{enumerable:!0,get:function(){return Jz[t]}})});Object.keys(Qz).forEach(function(t){t!=="default"&&!Fe.hasOwnProperty(t)&&Object.defineProperty(Fe,t,{enumerable:!0,get:function(){return Qz[t]}})});Object.keys(ek).forEach(function(t){t!=="default"&&!Fe.hasOwnProperty(t)&&Object.defineProperty(Fe,t,{enumerable:!0,get:function(){return ek[t]}})})});var tk=S(Ar=>{"use strict";a();Object.defineProperty(Ar,"__esModule",{value:!0});var Hr=rc(),m9=Hr.mapSerializer,b9=Hr.fixSerializer,_9=Hr.reverseSerializer,A9=Hr.mergeBytes,S9=Hr.padBytes,v9=Hr.fixBytes,E9=Hr.utf8,w9=Hr.baseX,x9=Hr.base10,I9=Hr.base58,P9=Hr.base64,R9=Hr.base16,O9=Hr.bitArray,B9=Hr.removeNullCharacters,T9=Hr.padNullCharacters,z9=Hr.Endian;Ar.Endian=z9;Ar.base10=x9;Ar.base16=R9;Ar.base58=I9;Ar.base64=P9;Ar.baseX=w9;Ar.bitArray=O9;Ar.fixBytes=v9;Ar.fixSerializer=b9;Ar.mapSerializer=m9;Ar.mergeBytes=A9;Ar.padBytes=S9;Ar.padNullCharacters=T9;Ar.removeNullCharacters=B9;Ar.reverseSerializer=_9;Ar.utf8=E9});var Py=S(wE=>{"use strict";a();Object.defineProperty(wE,"__esModule",{value:!0});var EE=class extends Error{name="UmiError";constructor(e,r,n,i){super(e),this.source=r,this.sourceDetails=n,this.cause=i,this.message=`${this.message}
+var qW=Object.create;var Ry=Object.defineProperty;var UW=Object.getOwnPropertyDescriptor;var VW=Object.getOwnPropertyNames;var KW=Object.getPrototypeOf,FW=Object.prototype.hasOwnProperty;var en=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var _=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},WW=(t,e)=>{for(var r in e)Ry(t,r,{get:e[r],enumerable:!0})},MB=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of VW(e))!FW.call(t,i)&&i!==r&&Ry(t,i,{get:()=>e[i],enumerable:!(n=UW(e,i))||n.enumerable});return t};var xr=(t,e,r)=>(r=t!=null?qW(KW(t)):{},MB(e||!t||!t.__esModule?Ry(r,"default",{value:t,enumerable:!0}):r,t)),NB=t=>MB(Ry({},"__esModule",{value:!0}),t);var qB=_(Oy=>{"use strict";a();Oy.byteLength=HW;Oy.toByteArray=$W;Oy.fromByteArray=YW;var us=[],ai=[],jW=typeof Uint8Array<"u"?Uint8Array:Array,Iv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(wc=0,LB=Iv.length;wc<LB;++wc)us[wc]=Iv[wc],ai[Iv.charCodeAt(wc)]=wc;var wc,LB;ai[45]=62;ai[95]=63;function DB(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function HW(t){var e=DB(t),r=e[0],n=e[1];return(r+n)*3/4-n}function GW(t,e,r){return(e+r)*3/4-r}function $W(t){var e,r=DB(t),n=r[0],i=r[1],s=new jW(GW(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=ai[t.charCodeAt(u)]<<18|ai[t.charCodeAt(u+1)]<<12|ai[t.charCodeAt(u+2)]<<6|ai[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ai[t.charCodeAt(u)]<<2|ai[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=ai[t.charCodeAt(u)]<<10|ai[t.charCodeAt(u+1)]<<4|ai[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ZW(t){return us[t>>18&63]+us[t>>12&63]+us[t>>6&63]+us[t&63]}function XW(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(ZW(n));return i.join("")}function YW(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(XW(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(us[e>>2]+us[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(us[e>>10]+us[e>>4&63]+us[e<<2&63]+"=")),i.join("")}});var UB=_(Pv=>{a();Pv.read=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,d=u>>1,f=-7,m=r?i-1:0,A=r?-1:1,v=t[e+m];for(m+=A,s=v&(1<<-f)-1,v>>=-f,f+=c;f>0;s=s*256+t[e+m],m+=A,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+m],m+=A,f-=8);if(s===0)s=1-d;else{if(s===u)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(v?-1:1)*o*Math.pow(2,s-n)};Pv.write=function(t,e,r,n,i,s){var o,c,u,d=s*8-i-1,f=(1<<d)-1,m=f>>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,P=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+m>=1?e+=A/u:e+=A*Math.pow(2,1-m),e*u>=2&&(o++,u/=2),o+m>=f?(c=0,o=f):o+m>=1?(c=(e*u-1)*Math.pow(2,i),o=o+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=P,c/=256,i-=8);for(o=o<<i|c,d+=i;d>0;t[r+v]=o&255,v+=P,o/=256,d-=8);t[r+v-P]|=T*128}});var Ic=_(ul=>{"use strict";a();var Rv=qB(),al=UB(),VB=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ul.Buffer=H;ul.SlowBuffer=nj;ul.INSPECT_MAX_BYTES=50;var Ty=2147483647;ul.kMaxLength=Ty;H.TYPED_ARRAY_SUPPORT=JW();!H.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function JW(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(H.prototype,"parent",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.buffer}});Object.defineProperty(H.prototype,"offset",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.byteOffset}});function js(t){if(t>Ty)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,H.prototype),e}function H(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return zv(t)}return jB(t,e,r)}H.poolSize=8192;function jB(t,e,r){if(typeof t=="string")return ej(t,e);if(ArrayBuffer.isView(t))return tj(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ls(t,ArrayBuffer)||t&&ls(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ls(t,SharedArrayBuffer)||t&&ls(t.buffer,SharedArrayBuffer)))return Tv(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return H.from(n,e,r);let i=rj(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return H.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}H.from=function(t,e,r){return jB(t,e,r)};Object.setPrototypeOf(H.prototype,Uint8Array.prototype);Object.setPrototypeOf(H,Uint8Array);function HB(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function QW(t,e,r){return HB(t),t<=0?js(t):e!==void 0?typeof r=="string"?js(t).fill(e,r):js(t).fill(e):js(t)}H.alloc=function(t,e,r){return QW(t,e,r)};function zv(t){return HB(t),js(t<0?0:kv(t)|0)}H.allocUnsafe=function(t){return zv(t)};H.allocUnsafeSlow=function(t){return zv(t)};function ej(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!H.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=GB(t,e)|0,n=js(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ov(t){let e=t.length<0?0:kv(t.length)|0,r=js(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function tj(t){if(ls(t,Uint8Array)){let e=new Uint8Array(t);return Tv(e.buffer,e.byteOffset,e.byteLength)}return Ov(t)}function Tv(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,H.prototype),n}function rj(t){if(H.isBuffer(t)){let e=kv(t.length)|0,r=js(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Mv(t.length)?js(0):Ov(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ov(t.data)}function kv(t){if(t>=Ty)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ty.toString(16)+" bytes");return t|0}function nj(t){return+t!=t&&(t=0),H.alloc(+t)}H.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==H.prototype};H.compare=function(e,r){if(ls(e,Uint8Array)&&(e=H.from(e,e.offset,e.byteLength)),ls(r,Uint8Array)&&(r=H.from(r,r.offset,r.byteLength)),!H.isBuffer(e)||!H.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};H.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}};H.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return H.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=H.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(ls(o,Uint8Array))s+o.length>i.length?(H.isBuffer(o)||(o=H.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(H.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function GB(t,e){if(H.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ls(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Bv(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return rz(t).length;default:if(i)return n?-1:Bv(t).length;e=(""+e).toLowerCase(),i=!0}}H.byteLength=GB;function ij(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return hj(this,e,r);case"utf8":case"utf-8":return ZB(this,e,r);case"ascii":return fj(this,e,r);case"latin1":case"binary":return pj(this,e,r);case"base64":return lj(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gj(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}H.prototype._isBuffer=!0;function xc(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}H.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)xc(this,r,r+1);return this};H.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)xc(this,r,r+3),xc(this,r+1,r+2);return this};H.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)xc(this,r,r+7),xc(this,r+1,r+6),xc(this,r+2,r+5),xc(this,r+3,r+4);return this};H.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ZB(this,0,e):ij.apply(this,arguments)};H.prototype.toLocaleString=H.prototype.toString;H.prototype.equals=function(e){if(!H.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:H.compare(this,e)===0};H.prototype.inspect=function(){let e="",r=ul.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};VB&&(H.prototype[VB]=H.prototype.inspect);H.prototype.compare=function(e,r,n,i,s){if(ls(e,Uint8Array)&&(e=H.from(e,e.offset,e.byteLength)),!H.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,c=n-r,u=Math.min(o,c),d=this.slice(i,s),f=e.slice(r,n);for(let m=0;m<u;++m)if(d[m]!==f[m]){o=d[m],c=f[m];break}return o<c?-1:c<o?1:0};function $B(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Mv(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=H.from(e,n)),H.isBuffer(e))return e.length===0?-1:KB(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):KB(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function KB(t,e,r,n,i){let s=1,o=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,c/=2,r/=2}function u(f,m){return s===1?f[m]:f.readUInt16BE(m*s)}let d;if(i){let f=-1;for(d=r;d<o;d++)if(u(t,d)===u(e,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*s}else f!==-1&&(d-=d-f),f=-1}else for(r+c>o&&(r=o-c),d=r;d>=0;d--){let f=!0;for(let m=0;m<c;m++)if(u(t,d+m)!==u(e,m)){f=!1;break}if(f)return d}return-1}H.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};H.prototype.indexOf=function(e,r,n){return $B(this,e,r,n,!0)};H.prototype.lastIndexOf=function(e,r,n){return $B(this,e,r,n,!1)};function sj(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let c=parseInt(e.substr(o*2,2),16);if(Mv(c))return o;t[r+o]=c}return o}function oj(t,e,r,n){return By(Bv(e,t.length-r),t,r,n)}function aj(t,e,r,n){return By(Aj(e),t,r,n)}function cj(t,e,r,n){return By(rz(e),t,r,n)}function uj(t,e,r,n){return By(_j(e,t.length-r),t,r,n)}H.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return sj(this,e,r,n);case"utf8":case"utf-8":return oj(this,e,r,n);case"ascii":case"latin1":case"binary":return aj(this,e,r,n);case"base64":return cj(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uj(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};H.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lj(t,e,r){return e===0&&r===t.length?Rv.fromByteArray(t):Rv.fromByteArray(t.slice(e,r))}function ZB(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=r){let u,d,f,m;switch(c){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(m=(s&31)<<6|u&63,m>127&&(o=m));break;case 3:u=t[i+1],d=t[i+2],(u&192)===128&&(d&192)===128&&(m=(s&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(o=m));break;case 4:u=t[i+1],d=t[i+2],f=t[i+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(s&15)<<18|(u&63)<<12|(d&63)<<6|f&63,m>65535&&m<1114112&&(o=m))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return dj(n)}var FB=4096;function dj(t){let e=t.length;if(e<=FB)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=FB));return r}function fj(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function pj(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function hj(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=Sj[t[s]];return i}function gj(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}H.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,H.prototype),i};function Ir(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}H.prototype.readUintLE=H.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ir(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};H.prototype.readUintBE=H.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ir(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};H.prototype.readUint8=H.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ir(e,1,this.length),this[e]};H.prototype.readUint16LE=H.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ir(e,2,this.length),this[e]|this[e+1]<<8};H.prototype.readUint16BE=H.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ir(e,2,this.length),this[e]<<8|this[e+1]};H.prototype.readUint32LE=H.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};H.prototype.readUint32BE=H.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};H.prototype.readBigUInt64LE=Lo(function(e){e=e>>>0,cl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Wp(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});H.prototype.readBigUInt64BE=Lo(function(e){e=e>>>0,cl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Wp(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});H.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ir(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};H.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ir(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};H.prototype.readInt8=function(e,r){return e=e>>>0,r||Ir(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};H.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ir(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};H.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ir(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};H.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};H.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};H.prototype.readBigInt64LE=Lo(function(e){e=e>>>0,cl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Wp(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});H.prototype.readBigInt64BE=Lo(function(e){e=e>>>0,cl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Wp(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});H.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),al.read(this,e,!0,23,4)};H.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ir(e,4,this.length),al.read(this,e,!1,23,4)};H.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ir(e,8,this.length),al.read(this,e,!0,52,8)};H.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ir(e,8,this.length),al.read(this,e,!1,52,8)};function On(t,e,r,n,i,s){if(!H.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}H.prototype.writeUintLE=H.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;On(this,e,r,n,c,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};H.prototype.writeUintBE=H.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;On(this,e,r,n,c,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};H.prototype.writeUint8=H.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,1,255,0),this[r]=e&255,r+1};H.prototype.writeUint16LE=H.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};H.prototype.writeUint16BE=H.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};H.prototype.writeUint32LE=H.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};H.prototype.writeUint32BE=H.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function XB(t,e,r,n,i){tz(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function YB(t,e,r,n,i){tz(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}H.prototype.writeBigUInt64LE=Lo(function(e,r=0){return XB(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});H.prototype.writeBigUInt64BE=Lo(function(e,r=0){return YB(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});H.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);On(this,e,r,n,u-1,-u)}let s=0,o=1,c=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&c===0&&this[r+s-1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};H.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);On(this,e,r,n,u-1,-u)}let s=n-1,o=1,c=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&c===0&&this[r+s+1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};H.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};H.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};H.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};H.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};H.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||On(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};H.prototype.writeBigInt64LE=Lo(function(e,r=0){return XB(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});H.prototype.writeBigInt64BE=Lo(function(e,r=0){return YB(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function JB(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function QB(t,e,r,n,i){return e=+e,r=r>>>0,i||JB(t,e,r,4,34028234663852886e22,-34028234663852886e22),al.write(t,e,r,n,23,4),r+4}H.prototype.writeFloatLE=function(e,r,n){return QB(this,e,r,!0,n)};H.prototype.writeFloatBE=function(e,r,n){return QB(this,e,r,!1,n)};function ez(t,e,r,n,i){return e=+e,r=r>>>0,i||JB(t,e,r,8,17976931348623157e292,-17976931348623157e292),al.write(t,e,r,n,52,8),r+8}H.prototype.writeDoubleLE=function(e,r,n){return ez(this,e,r,!0,n)};H.prototype.writeDoubleBE=function(e,r,n){return ez(this,e,r,!1,n)};H.prototype.copy=function(e,r,n,i){if(!H.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};H.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!H.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=H.isBuffer(e)?e:H.from(e,i),c=o.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%c]}return this};var ol={};function Cv(t,e,r){ol[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Cv("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Cv("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Cv("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=WB(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=WB(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function WB(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function mj(t,e,r){cl(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Wp(e,t.length-(r+1))}function tz(t,e,r,n,i,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",c;throw s>3?e===0||e===BigInt(0)?c=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:c=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:c=`>= ${e}${o} and <= ${r}${o}`,new ol.ERR_OUT_OF_RANGE("value",c,t)}mj(n,i,s)}function cl(t,e){if(typeof t!="number")throw new ol.ERR_INVALID_ARG_TYPE(e,"number",t)}function Wp(t,e,r){throw Math.floor(t)!==t?(cl(t,r),new ol.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ol.ERR_BUFFER_OUT_OF_BOUNDS:new ol.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var yj=/[^+/0-9A-Za-z-_]/g;function bj(t){if(t=t.split("=")[0],t=t.trim().replace(yj,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Bv(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Aj(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function _j(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function rz(t){return Rv.toByteArray(bj(t))}function By(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ls(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Mv(t){return t!==t}var Sj=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function Lo(t){return typeof BigInt>"u"?vj:t}function vj(){throw new Error("BigInt not supported")}});var p,h,a=en(()=>{"use strict";p=xr(Ic(),1),h={env:{},browser:!0,version:"",nextTick:(t,...e)=>queueMicrotask(()=>t(...e))}});var sk=_(()=>{a()});var FE=_((ok,KE)=>{a();(function(t,e){"use strict";function r(w,l){if(!w)throw new Error(l||"Assertion failed")}function n(w,l){w.super_=l;var y=function(){};y.prototype=l.prototype,w.prototype=new y,w.prototype.constructor=w}function i(w,l,y){if(i.isBN(w))return w;this.negative=0,this.words=null,this.length=0,this.red=null,w!==null&&((l==="le"||l==="be")&&(y=l,l=10),this._init(w||0,l||10,y||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=sk().Buffer}catch{}i.isBN=function(l){return l instanceof i?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===i.wordSize&&Array.isArray(l.words)},i.max=function(l,y){return l.cmp(y)>0?l:y},i.min=function(l,y){return l.cmp(y)<0?l:y},i.prototype._init=function(l,y,S){if(typeof l=="number")return this._initNumber(l,y,S);if(typeof l=="object")return this._initArray(l,y,S);y==="hex"&&(y=16),r(y===(y|0)&&y>=2&&y<=36),l=l.toString().replace(/\s+/g,"");var E=0;l[0]==="-"&&(E++,this.negative=1),E<l.length&&(y===16?this._parseHex(l,E,S):(this._parseBase(l,y,E),S==="le"&&this._initArray(this.toArray(),y,S)))},i.prototype._initNumber=function(l,y,S){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(r(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),S==="le"&&this._initArray(this.toArray(),y,S)},i.prototype._initArray=function(l,y,S){if(r(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var x,O,C=0;if(S==="be")for(E=l.length-1,x=0;E>=0;E-=3)O=l[E]|l[E-1]<<8|l[E-2]<<16,this.words[x]|=O<<C&67108863,this.words[x+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,x++);else if(S==="le")for(E=0,x=0;E<l.length;E+=3)O=l[E]|l[E+1]<<8|l[E+2]<<16,this.words[x]|=O<<C&67108863,this.words[x+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,x++);return this._strip()};function o(w,l){var y=w.charCodeAt(l);if(y>=48&&y<=57)return y-48;if(y>=65&&y<=70)return y-55;if(y>=97&&y<=102)return y-87;r(!1,"Invalid character in "+w)}function c(w,l,y){var S=o(w,y);return y-1>=l&&(S|=o(w,y-1)<<4),S}i.prototype._parseHex=function(l,y,S){this.length=Math.ceil((l.length-y)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var x=0,O=0,C;if(S==="be")for(E=l.length-1;E>=y;E-=2)C=c(l,y,E)<<x,this.words[O]|=C&67108863,x>=18?(x-=18,O+=1,this.words[O]|=C>>>26):x+=8;else{var I=l.length-y;for(E=I%2===0?y+1:y;E<l.length;E+=2)C=c(l,y,E)<<x,this.words[O]|=C&67108863,x>=18?(x-=18,O+=1,this.words[O]|=C>>>26):x+=8}this._strip()};function u(w,l,y,S){for(var E=0,x=0,O=Math.min(w.length,y),C=l;C<O;C++){var I=w.charCodeAt(C)-48;E*=S,I>=49?x=I-49+10:I>=17?x=I-17+10:x=I,r(I>=0&&x<S,"Invalid character"),E+=x}return E}i.prototype._parseBase=function(l,y,S){this.words=[0],this.length=1;for(var E=0,x=1;x<=67108863;x*=y)E++;E--,x=x/y|0;for(var O=l.length-S,C=O%E,I=Math.min(O,O-C)+S,b=0,R=S;R<I;R+=E)b=u(l,R,R+E,y),this.imuln(x),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b);if(C!==0){var re=1;for(b=u(l,R,l.length,y),R=0;R<C;R++)re*=y;this.imuln(re),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b)}this._strip()},i.prototype.copy=function(l){l.words=new Array(this.length);for(var y=0;y<this.length;y++)l.words[y]=this.words[y];l.length=this.length,l.negative=this.negative,l.red=this.red};function d(w,l){w.words=l.words,w.length=l.length,w.negative=l.negative,w.red=l.red}if(i.prototype._move=function(l){d(l,this)},i.prototype.clone=function(){var l=new i(null);return this.copy(l),l},i.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var m=["","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"],A=[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],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(l,y){l=l||10,y=y|0||1;var S;if(l===16||l==="hex"){S="";for(var E=0,x=0,O=0;O<this.length;O++){var C=this.words[O],I=((C<<E|x)&16777215).toString(16);x=C>>>24-E&16777215,E+=2,E>=26&&(E-=26,O--),x!==0||O!==this.length-1?S=m[6-I.length]+I+S:S=I+S}for(x!==0&&(S=x.toString(16)+S);S.length%y!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(l===(l|0)&&l>=2&&l<=36){var b=A[l],R=v[l];S="";var re=this.clone();for(re.negative=0;!re.isZero();){var te=re.modrn(R).toString(l);re=re.idivn(R),re.isZero()?S=te+S:S=m[b-te.length]+te+S}for(this.isZero()&&(S="0"+S);S.length%y!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(l,y){return this.toArrayLike(s,l,y)}),i.prototype.toArray=function(l,y){return this.toArrayLike(Array,l,y)};var P=function(l,y){return l.allocUnsafe?l.allocUnsafe(y):new l(y)};i.prototype.toArrayLike=function(l,y,S){this._strip();var E=this.byteLength(),x=S||Math.max(1,E);r(E<=x,"byte array longer than desired length"),r(x>0,"Requested array length <= 0");var O=P(l,x),C=y==="le"?"LE":"BE";return this["_toArrayLike"+C](O,E),O},i.prototype._toArrayLikeLE=function(l,y){for(var S=0,E=0,x=0,O=0;x<this.length;x++){var C=this.words[x]<<O|E;l[S++]=C&255,S<l.length&&(l[S++]=C>>8&255),S<l.length&&(l[S++]=C>>16&255),O===6?(S<l.length&&(l[S++]=C>>24&255),E=0,O=0):(E=C>>>24,O+=2)}if(S<l.length)for(l[S++]=E;S<l.length;)l[S++]=0},i.prototype._toArrayLikeBE=function(l,y){for(var S=l.length-1,E=0,x=0,O=0;x<this.length;x++){var C=this.words[x]<<O|E;l[S--]=C&255,S>=0&&(l[S--]=C>>8&255),S>=0&&(l[S--]=C>>16&255),O===6?(S>=0&&(l[S--]=C>>24&255),E=0,O=0):(E=C>>>24,O+=2)}if(S>=0)for(l[S--]=E;S>=0;)l[S--]=0},Math.clz32?i.prototype._countBits=function(l){return 32-Math.clz32(l)}:i.prototype._countBits=function(l){var y=l,S=0;return y>=4096&&(S+=13,y>>>=13),y>=64&&(S+=7,y>>>=7),y>=8&&(S+=4,y>>>=4),y>=2&&(S+=2,y>>>=2),S+y},i.prototype._zeroBits=function(l){if(l===0)return 26;var y=l,S=0;return(y&8191)===0&&(S+=13,y>>>=13),(y&127)===0&&(S+=7,y>>>=7),(y&15)===0&&(S+=4,y>>>=4),(y&3)===0&&(S+=2,y>>>=2),(y&1)===0&&S++,S},i.prototype.bitLength=function(){var l=this.words[this.length-1],y=this._countBits(l);return(this.length-1)*26+y};function T(w){for(var l=new Array(w.bitLength()),y=0;y<l.length;y++){var S=y/26|0,E=y%26;l[y]=w.words[S]>>>E&1}return l}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,y=0;y<this.length;y++){var S=this._zeroBits(this.words[y]);if(l+=S,S!==26)break}return l},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},i.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var y=0;y<l.length;y++)this.words[y]=this.words[y]|l.words[y];return this._strip()},i.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},i.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},i.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},i.prototype.iuand=function(l){var y;this.length>l.length?y=l:y=this;for(var S=0;S<y.length;S++)this.words[S]=this.words[S]&l.words[S];return this.length=y.length,this._strip()},i.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},i.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},i.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},i.prototype.iuxor=function(l){var y,S;this.length>l.length?(y=this,S=l):(y=l,S=this);for(var E=0;E<S.length;E++)this.words[E]=y.words[E]^S.words[E];if(this!==y)for(;E<y.length;E++)this.words[E]=y.words[E];return this.length=y.length,this._strip()},i.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},i.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},i.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},i.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var y=Math.ceil(l/26)|0,S=l%26;this._expand(y),S>0&&y--;for(var E=0;E<y;E++)this.words[E]=~this.words[E]&67108863;return S>0&&(this.words[E]=~this.words[E]&67108863>>26-S),this._strip()},i.prototype.notn=function(l){return this.clone().inotn(l)},i.prototype.setn=function(l,y){r(typeof l=="number"&&l>=0);var S=l/26|0,E=l%26;return this._expand(S+1),y?this.words[S]=this.words[S]|1<<E:this.words[S]=this.words[S]&~(1<<E),this._strip()},i.prototype.iadd=function(l){var y;if(this.negative!==0&&l.negative===0)return this.negative=0,y=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,y=this.isub(l),l.negative=1,y._normSign();var S,E;this.length>l.length?(S=this,E=l):(S=l,E=this);for(var x=0,O=0;O<E.length;O++)y=(S.words[O]|0)+(E.words[O]|0)+x,this.words[O]=y&67108863,x=y>>>26;for(;x!==0&&O<S.length;O++)y=(S.words[O]|0)+x,this.words[O]=y&67108863,x=y>>>26;if(this.length=S.length,x!==0)this.words[this.length]=x,this.length++;else if(S!==this)for(;O<S.length;O++)this.words[O]=S.words[O];return this},i.prototype.add=function(l){var y;return l.negative!==0&&this.negative===0?(l.negative=0,y=this.sub(l),l.negative^=1,y):l.negative===0&&this.negative!==0?(this.negative=0,y=l.sub(this),this.negative=1,y):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},i.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var y=this.iadd(l);return l.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var S=this.cmp(l);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,x;S>0?(E=this,x=l):(E=l,x=this);for(var O=0,C=0;C<x.length;C++)y=(E.words[C]|0)-(x.words[C]|0)+O,O=y>>26,this.words[C]=y&67108863;for(;O!==0&&C<E.length;C++)y=(E.words[C]|0)+O,O=y>>26,this.words[C]=y&67108863;if(O===0&&C<E.length&&E!==this)for(;C<E.length;C++)this.words[C]=E.words[C];return this.length=Math.max(this.length,C),E!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(l){return this.clone().isub(l)};function k(w,l,y){y.negative=l.negative^w.negative;var S=w.length+l.length|0;y.length=S,S=S-1|0;var E=w.words[0]|0,x=l.words[0]|0,O=E*x,C=O&67108863,I=O/67108864|0;y.words[0]=C;for(var b=1;b<S;b++){for(var R=I>>>26,re=I&67108863,te=Math.min(b,l.length-1),se=Math.max(0,b-w.length+1);se<=te;se++){var fe=b-se|0;E=w.words[fe]|0,x=l.words[se]|0,O=E*x+re,R+=O/67108864|0,re=O&67108863}y.words[b]=re|0,I=R|0}return I!==0?y.words[b]=I|0:y.length--,y._strip()}var B=function(l,y,S){var E=l.words,x=y.words,O=S.words,C=0,I,b,R,re=E[0]|0,te=re&8191,se=re>>>13,fe=E[1]|0,Pe=fe&8191,Se=fe>>>13,it=E[2]|0,We=it&8191,Qe=it>>>13,Fp=E[3]|0,Mt=Fp&8191,Nt=Fp>>>13,AB=E[4]|0,Lt=AB&8191,Dt=AB>>>13,_B=E[5]|0,qt=_B&8191,Ut=_B>>>13,SB=E[6]|0,Vt=SB&8191,Kt=SB>>>13,vB=E[7]|0,Ft=vB&8191,Wt=vB>>>13,EB=E[8]|0,jt=EB&8191,Ht=EB>>>13,wB=E[9]|0,Gt=wB&8191,$t=wB>>>13,xB=x[0]|0,Zt=xB&8191,Xt=xB>>>13,IB=x[1]|0,Yt=IB&8191,Jt=IB>>>13,PB=x[2]|0,Qt=PB&8191,er=PB>>>13,RB=x[3]|0,tr=RB&8191,rr=RB>>>13,OB=x[4]|0,nr=OB&8191,ir=OB>>>13,TB=x[5]|0,sr=TB&8191,or=TB>>>13,BB=x[6]|0,ar=BB&8191,cr=BB>>>13,zB=x[7]|0,ur=zB&8191,lr=zB>>>13,kB=x[8]|0,dr=kB&8191,fr=kB>>>13,CB=x[9]|0,pr=CB&8191,hr=CB>>>13;S.negative=l.negative^y.negative,S.length=19,I=Math.imul(te,Zt),b=Math.imul(te,Xt),b=b+Math.imul(se,Zt)|0,R=Math.imul(se,Xt);var av=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(av>>>26)|0,av&=67108863,I=Math.imul(Pe,Zt),b=Math.imul(Pe,Xt),b=b+Math.imul(Se,Zt)|0,R=Math.imul(Se,Xt),I=I+Math.imul(te,Yt)|0,b=b+Math.imul(te,Jt)|0,b=b+Math.imul(se,Yt)|0,R=R+Math.imul(se,Jt)|0;var cv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(cv>>>26)|0,cv&=67108863,I=Math.imul(We,Zt),b=Math.imul(We,Xt),b=b+Math.imul(Qe,Zt)|0,R=Math.imul(Qe,Xt),I=I+Math.imul(Pe,Yt)|0,b=b+Math.imul(Pe,Jt)|0,b=b+Math.imul(Se,Yt)|0,R=R+Math.imul(Se,Jt)|0,I=I+Math.imul(te,Qt)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(se,Qt)|0,R=R+Math.imul(se,er)|0;var uv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(uv>>>26)|0,uv&=67108863,I=Math.imul(Mt,Zt),b=Math.imul(Mt,Xt),b=b+Math.imul(Nt,Zt)|0,R=Math.imul(Nt,Xt),I=I+Math.imul(We,Yt)|0,b=b+Math.imul(We,Jt)|0,b=b+Math.imul(Qe,Yt)|0,R=R+Math.imul(Qe,Jt)|0,I=I+Math.imul(Pe,Qt)|0,b=b+Math.imul(Pe,er)|0,b=b+Math.imul(Se,Qt)|0,R=R+Math.imul(Se,er)|0,I=I+Math.imul(te,tr)|0,b=b+Math.imul(te,rr)|0,b=b+Math.imul(se,tr)|0,R=R+Math.imul(se,rr)|0;var lv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(lv>>>26)|0,lv&=67108863,I=Math.imul(Lt,Zt),b=Math.imul(Lt,Xt),b=b+Math.imul(Dt,Zt)|0,R=Math.imul(Dt,Xt),I=I+Math.imul(Mt,Yt)|0,b=b+Math.imul(Mt,Jt)|0,b=b+Math.imul(Nt,Yt)|0,R=R+Math.imul(Nt,Jt)|0,I=I+Math.imul(We,Qt)|0,b=b+Math.imul(We,er)|0,b=b+Math.imul(Qe,Qt)|0,R=R+Math.imul(Qe,er)|0,I=I+Math.imul(Pe,tr)|0,b=b+Math.imul(Pe,rr)|0,b=b+Math.imul(Se,tr)|0,R=R+Math.imul(Se,rr)|0,I=I+Math.imul(te,nr)|0,b=b+Math.imul(te,ir)|0,b=b+Math.imul(se,nr)|0,R=R+Math.imul(se,ir)|0;var dv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(dv>>>26)|0,dv&=67108863,I=Math.imul(qt,Zt),b=Math.imul(qt,Xt),b=b+Math.imul(Ut,Zt)|0,R=Math.imul(Ut,Xt),I=I+Math.imul(Lt,Yt)|0,b=b+Math.imul(Lt,Jt)|0,b=b+Math.imul(Dt,Yt)|0,R=R+Math.imul(Dt,Jt)|0,I=I+Math.imul(Mt,Qt)|0,b=b+Math.imul(Mt,er)|0,b=b+Math.imul(Nt,Qt)|0,R=R+Math.imul(Nt,er)|0,I=I+Math.imul(We,tr)|0,b=b+Math.imul(We,rr)|0,b=b+Math.imul(Qe,tr)|0,R=R+Math.imul(Qe,rr)|0,I=I+Math.imul(Pe,nr)|0,b=b+Math.imul(Pe,ir)|0,b=b+Math.imul(Se,nr)|0,R=R+Math.imul(Se,ir)|0,I=I+Math.imul(te,sr)|0,b=b+Math.imul(te,or)|0,b=b+Math.imul(se,sr)|0,R=R+Math.imul(se,or)|0;var fv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(fv>>>26)|0,fv&=67108863,I=Math.imul(Vt,Zt),b=Math.imul(Vt,Xt),b=b+Math.imul(Kt,Zt)|0,R=Math.imul(Kt,Xt),I=I+Math.imul(qt,Yt)|0,b=b+Math.imul(qt,Jt)|0,b=b+Math.imul(Ut,Yt)|0,R=R+Math.imul(Ut,Jt)|0,I=I+Math.imul(Lt,Qt)|0,b=b+Math.imul(Lt,er)|0,b=b+Math.imul(Dt,Qt)|0,R=R+Math.imul(Dt,er)|0,I=I+Math.imul(Mt,tr)|0,b=b+Math.imul(Mt,rr)|0,b=b+Math.imul(Nt,tr)|0,R=R+Math.imul(Nt,rr)|0,I=I+Math.imul(We,nr)|0,b=b+Math.imul(We,ir)|0,b=b+Math.imul(Qe,nr)|0,R=R+Math.imul(Qe,ir)|0,I=I+Math.imul(Pe,sr)|0,b=b+Math.imul(Pe,or)|0,b=b+Math.imul(Se,sr)|0,R=R+Math.imul(Se,or)|0,I=I+Math.imul(te,ar)|0,b=b+Math.imul(te,cr)|0,b=b+Math.imul(se,ar)|0,R=R+Math.imul(se,cr)|0;var pv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(pv>>>26)|0,pv&=67108863,I=Math.imul(Ft,Zt),b=Math.imul(Ft,Xt),b=b+Math.imul(Wt,Zt)|0,R=Math.imul(Wt,Xt),I=I+Math.imul(Vt,Yt)|0,b=b+Math.imul(Vt,Jt)|0,b=b+Math.imul(Kt,Yt)|0,R=R+Math.imul(Kt,Jt)|0,I=I+Math.imul(qt,Qt)|0,b=b+Math.imul(qt,er)|0,b=b+Math.imul(Ut,Qt)|0,R=R+Math.imul(Ut,er)|0,I=I+Math.imul(Lt,tr)|0,b=b+Math.imul(Lt,rr)|0,b=b+Math.imul(Dt,tr)|0,R=R+Math.imul(Dt,rr)|0,I=I+Math.imul(Mt,nr)|0,b=b+Math.imul(Mt,ir)|0,b=b+Math.imul(Nt,nr)|0,R=R+Math.imul(Nt,ir)|0,I=I+Math.imul(We,sr)|0,b=b+Math.imul(We,or)|0,b=b+Math.imul(Qe,sr)|0,R=R+Math.imul(Qe,or)|0,I=I+Math.imul(Pe,ar)|0,b=b+Math.imul(Pe,cr)|0,b=b+Math.imul(Se,ar)|0,R=R+Math.imul(Se,cr)|0,I=I+Math.imul(te,ur)|0,b=b+Math.imul(te,lr)|0,b=b+Math.imul(se,ur)|0,R=R+Math.imul(se,lr)|0;var hv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(hv>>>26)|0,hv&=67108863,I=Math.imul(jt,Zt),b=Math.imul(jt,Xt),b=b+Math.imul(Ht,Zt)|0,R=Math.imul(Ht,Xt),I=I+Math.imul(Ft,Yt)|0,b=b+Math.imul(Ft,Jt)|0,b=b+Math.imul(Wt,Yt)|0,R=R+Math.imul(Wt,Jt)|0,I=I+Math.imul(Vt,Qt)|0,b=b+Math.imul(Vt,er)|0,b=b+Math.imul(Kt,Qt)|0,R=R+Math.imul(Kt,er)|0,I=I+Math.imul(qt,tr)|0,b=b+Math.imul(qt,rr)|0,b=b+Math.imul(Ut,tr)|0,R=R+Math.imul(Ut,rr)|0,I=I+Math.imul(Lt,nr)|0,b=b+Math.imul(Lt,ir)|0,b=b+Math.imul(Dt,nr)|0,R=R+Math.imul(Dt,ir)|0,I=I+Math.imul(Mt,sr)|0,b=b+Math.imul(Mt,or)|0,b=b+Math.imul(Nt,sr)|0,R=R+Math.imul(Nt,or)|0,I=I+Math.imul(We,ar)|0,b=b+Math.imul(We,cr)|0,b=b+Math.imul(Qe,ar)|0,R=R+Math.imul(Qe,cr)|0,I=I+Math.imul(Pe,ur)|0,b=b+Math.imul(Pe,lr)|0,b=b+Math.imul(Se,ur)|0,R=R+Math.imul(Se,lr)|0,I=I+Math.imul(te,dr)|0,b=b+Math.imul(te,fr)|0,b=b+Math.imul(se,dr)|0,R=R+Math.imul(se,fr)|0;var gv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(gv>>>26)|0,gv&=67108863,I=Math.imul(Gt,Zt),b=Math.imul(Gt,Xt),b=b+Math.imul($t,Zt)|0,R=Math.imul($t,Xt),I=I+Math.imul(jt,Yt)|0,b=b+Math.imul(jt,Jt)|0,b=b+Math.imul(Ht,Yt)|0,R=R+Math.imul(Ht,Jt)|0,I=I+Math.imul(Ft,Qt)|0,b=b+Math.imul(Ft,er)|0,b=b+Math.imul(Wt,Qt)|0,R=R+Math.imul(Wt,er)|0,I=I+Math.imul(Vt,tr)|0,b=b+Math.imul(Vt,rr)|0,b=b+Math.imul(Kt,tr)|0,R=R+Math.imul(Kt,rr)|0,I=I+Math.imul(qt,nr)|0,b=b+Math.imul(qt,ir)|0,b=b+Math.imul(Ut,nr)|0,R=R+Math.imul(Ut,ir)|0,I=I+Math.imul(Lt,sr)|0,b=b+Math.imul(Lt,or)|0,b=b+Math.imul(Dt,sr)|0,R=R+Math.imul(Dt,or)|0,I=I+Math.imul(Mt,ar)|0,b=b+Math.imul(Mt,cr)|0,b=b+Math.imul(Nt,ar)|0,R=R+Math.imul(Nt,cr)|0,I=I+Math.imul(We,ur)|0,b=b+Math.imul(We,lr)|0,b=b+Math.imul(Qe,ur)|0,R=R+Math.imul(Qe,lr)|0,I=I+Math.imul(Pe,dr)|0,b=b+Math.imul(Pe,fr)|0,b=b+Math.imul(Se,dr)|0,R=R+Math.imul(Se,fr)|0,I=I+Math.imul(te,pr)|0,b=b+Math.imul(te,hr)|0,b=b+Math.imul(se,pr)|0,R=R+Math.imul(se,hr)|0;var mv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(mv>>>26)|0,mv&=67108863,I=Math.imul(Gt,Yt),b=Math.imul(Gt,Jt),b=b+Math.imul($t,Yt)|0,R=Math.imul($t,Jt),I=I+Math.imul(jt,Qt)|0,b=b+Math.imul(jt,er)|0,b=b+Math.imul(Ht,Qt)|0,R=R+Math.imul(Ht,er)|0,I=I+Math.imul(Ft,tr)|0,b=b+Math.imul(Ft,rr)|0,b=b+Math.imul(Wt,tr)|0,R=R+Math.imul(Wt,rr)|0,I=I+Math.imul(Vt,nr)|0,b=b+Math.imul(Vt,ir)|0,b=b+Math.imul(Kt,nr)|0,R=R+Math.imul(Kt,ir)|0,I=I+Math.imul(qt,sr)|0,b=b+Math.imul(qt,or)|0,b=b+Math.imul(Ut,sr)|0,R=R+Math.imul(Ut,or)|0,I=I+Math.imul(Lt,ar)|0,b=b+Math.imul(Lt,cr)|0,b=b+Math.imul(Dt,ar)|0,R=R+Math.imul(Dt,cr)|0,I=I+Math.imul(Mt,ur)|0,b=b+Math.imul(Mt,lr)|0,b=b+Math.imul(Nt,ur)|0,R=R+Math.imul(Nt,lr)|0,I=I+Math.imul(We,dr)|0,b=b+Math.imul(We,fr)|0,b=b+Math.imul(Qe,dr)|0,R=R+Math.imul(Qe,fr)|0,I=I+Math.imul(Pe,pr)|0,b=b+Math.imul(Pe,hr)|0,b=b+Math.imul(Se,pr)|0,R=R+Math.imul(Se,hr)|0;var yv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(yv>>>26)|0,yv&=67108863,I=Math.imul(Gt,Qt),b=Math.imul(Gt,er),b=b+Math.imul($t,Qt)|0,R=Math.imul($t,er),I=I+Math.imul(jt,tr)|0,b=b+Math.imul(jt,rr)|0,b=b+Math.imul(Ht,tr)|0,R=R+Math.imul(Ht,rr)|0,I=I+Math.imul(Ft,nr)|0,b=b+Math.imul(Ft,ir)|0,b=b+Math.imul(Wt,nr)|0,R=R+Math.imul(Wt,ir)|0,I=I+Math.imul(Vt,sr)|0,b=b+Math.imul(Vt,or)|0,b=b+Math.imul(Kt,sr)|0,R=R+Math.imul(Kt,or)|0,I=I+Math.imul(qt,ar)|0,b=b+Math.imul(qt,cr)|0,b=b+Math.imul(Ut,ar)|0,R=R+Math.imul(Ut,cr)|0,I=I+Math.imul(Lt,ur)|0,b=b+Math.imul(Lt,lr)|0,b=b+Math.imul(Dt,ur)|0,R=R+Math.imul(Dt,lr)|0,I=I+Math.imul(Mt,dr)|0,b=b+Math.imul(Mt,fr)|0,b=b+Math.imul(Nt,dr)|0,R=R+Math.imul(Nt,fr)|0,I=I+Math.imul(We,pr)|0,b=b+Math.imul(We,hr)|0,b=b+Math.imul(Qe,pr)|0,R=R+Math.imul(Qe,hr)|0;var bv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(bv>>>26)|0,bv&=67108863,I=Math.imul(Gt,tr),b=Math.imul(Gt,rr),b=b+Math.imul($t,tr)|0,R=Math.imul($t,rr),I=I+Math.imul(jt,nr)|0,b=b+Math.imul(jt,ir)|0,b=b+Math.imul(Ht,nr)|0,R=R+Math.imul(Ht,ir)|0,I=I+Math.imul(Ft,sr)|0,b=b+Math.imul(Ft,or)|0,b=b+Math.imul(Wt,sr)|0,R=R+Math.imul(Wt,or)|0,I=I+Math.imul(Vt,ar)|0,b=b+Math.imul(Vt,cr)|0,b=b+Math.imul(Kt,ar)|0,R=R+Math.imul(Kt,cr)|0,I=I+Math.imul(qt,ur)|0,b=b+Math.imul(qt,lr)|0,b=b+Math.imul(Ut,ur)|0,R=R+Math.imul(Ut,lr)|0,I=I+Math.imul(Lt,dr)|0,b=b+Math.imul(Lt,fr)|0,b=b+Math.imul(Dt,dr)|0,R=R+Math.imul(Dt,fr)|0,I=I+Math.imul(Mt,pr)|0,b=b+Math.imul(Mt,hr)|0,b=b+Math.imul(Nt,pr)|0,R=R+Math.imul(Nt,hr)|0;var Av=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Av>>>26)|0,Av&=67108863,I=Math.imul(Gt,nr),b=Math.imul(Gt,ir),b=b+Math.imul($t,nr)|0,R=Math.imul($t,ir),I=I+Math.imul(jt,sr)|0,b=b+Math.imul(jt,or)|0,b=b+Math.imul(Ht,sr)|0,R=R+Math.imul(Ht,or)|0,I=I+Math.imul(Ft,ar)|0,b=b+Math.imul(Ft,cr)|0,b=b+Math.imul(Wt,ar)|0,R=R+Math.imul(Wt,cr)|0,I=I+Math.imul(Vt,ur)|0,b=b+Math.imul(Vt,lr)|0,b=b+Math.imul(Kt,ur)|0,R=R+Math.imul(Kt,lr)|0,I=I+Math.imul(qt,dr)|0,b=b+Math.imul(qt,fr)|0,b=b+Math.imul(Ut,dr)|0,R=R+Math.imul(Ut,fr)|0,I=I+Math.imul(Lt,pr)|0,b=b+Math.imul(Lt,hr)|0,b=b+Math.imul(Dt,pr)|0,R=R+Math.imul(Dt,hr)|0;var _v=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(_v>>>26)|0,_v&=67108863,I=Math.imul(Gt,sr),b=Math.imul(Gt,or),b=b+Math.imul($t,sr)|0,R=Math.imul($t,or),I=I+Math.imul(jt,ar)|0,b=b+Math.imul(jt,cr)|0,b=b+Math.imul(Ht,ar)|0,R=R+Math.imul(Ht,cr)|0,I=I+Math.imul(Ft,ur)|0,b=b+Math.imul(Ft,lr)|0,b=b+Math.imul(Wt,ur)|0,R=R+Math.imul(Wt,lr)|0,I=I+Math.imul(Vt,dr)|0,b=b+Math.imul(Vt,fr)|0,b=b+Math.imul(Kt,dr)|0,R=R+Math.imul(Kt,fr)|0,I=I+Math.imul(qt,pr)|0,b=b+Math.imul(qt,hr)|0,b=b+Math.imul(Ut,pr)|0,R=R+Math.imul(Ut,hr)|0;var Sv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Sv>>>26)|0,Sv&=67108863,I=Math.imul(Gt,ar),b=Math.imul(Gt,cr),b=b+Math.imul($t,ar)|0,R=Math.imul($t,cr),I=I+Math.imul(jt,ur)|0,b=b+Math.imul(jt,lr)|0,b=b+Math.imul(Ht,ur)|0,R=R+Math.imul(Ht,lr)|0,I=I+Math.imul(Ft,dr)|0,b=b+Math.imul(Ft,fr)|0,b=b+Math.imul(Wt,dr)|0,R=R+Math.imul(Wt,fr)|0,I=I+Math.imul(Vt,pr)|0,b=b+Math.imul(Vt,hr)|0,b=b+Math.imul(Kt,pr)|0,R=R+Math.imul(Kt,hr)|0;var vv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(vv>>>26)|0,vv&=67108863,I=Math.imul(Gt,ur),b=Math.imul(Gt,lr),b=b+Math.imul($t,ur)|0,R=Math.imul($t,lr),I=I+Math.imul(jt,dr)|0,b=b+Math.imul(jt,fr)|0,b=b+Math.imul(Ht,dr)|0,R=R+Math.imul(Ht,fr)|0,I=I+Math.imul(Ft,pr)|0,b=b+Math.imul(Ft,hr)|0,b=b+Math.imul(Wt,pr)|0,R=R+Math.imul(Wt,hr)|0;var Ev=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(Ev>>>26)|0,Ev&=67108863,I=Math.imul(Gt,dr),b=Math.imul(Gt,fr),b=b+Math.imul($t,dr)|0,R=Math.imul($t,fr),I=I+Math.imul(jt,pr)|0,b=b+Math.imul(jt,hr)|0,b=b+Math.imul(Ht,pr)|0,R=R+Math.imul(Ht,hr)|0;var wv=(C+I|0)+((b&8191)<<13)|0;C=(R+(b>>>13)|0)+(wv>>>26)|0,wv&=67108863,I=Math.imul(Gt,pr),b=Math.imul(Gt,hr),b=b+Math.imul($t,pr)|0,R=Math.imul($t,hr);var xv=(C+I|0)+((b&8191)<<13)|0;return C=(R+(b>>>13)|0)+(xv>>>26)|0,xv&=67108863,O[0]=av,O[1]=cv,O[2]=uv,O[3]=lv,O[4]=dv,O[5]=fv,O[6]=pv,O[7]=hv,O[8]=gv,O[9]=mv,O[10]=yv,O[11]=bv,O[12]=Av,O[13]=_v,O[14]=Sv,O[15]=vv,O[16]=Ev,O[17]=wv,O[18]=xv,C!==0&&(O[19]=C,S.length++),S};Math.imul||(B=k);function D(w,l,y){y.negative=l.negative^w.negative,y.length=w.length+l.length;for(var S=0,E=0,x=0;x<y.length-1;x++){var O=E;E=0;for(var C=S&67108863,I=Math.min(x,l.length-1),b=Math.max(0,x-w.length+1);b<=I;b++){var R=x-b,re=w.words[R]|0,te=l.words[b]|0,se=re*te,fe=se&67108863;O=O+(se/67108864|0)|0,fe=fe+C|0,C=fe&67108863,O=O+(fe>>>26)|0,E+=O>>>26,O&=67108863}y.words[x]=C,S=O,O=E}return S!==0?y.words[x]=S:y.length--,y._strip()}function L(w,l,y){return D(w,l,y)}i.prototype.mulTo=function(l,y){var S,E=this.length+l.length;return this.length===10&&l.length===10?S=B(this,l,y):E<63?S=k(this,l,y):E<1024?S=D(this,l,y):S=L(this,l,y),S};function F(w,l){this.x=w,this.y=l}F.prototype.makeRBT=function(l){for(var y=new Array(l),S=i.prototype._countBits(l)-1,E=0;E<l;E++)y[E]=this.revBin(E,S,l);return y},F.prototype.revBin=function(l,y,S){if(l===0||l===S-1)return l;for(var E=0,x=0;x<y;x++)E|=(l&1)<<y-x-1,l>>=1;return E},F.prototype.permute=function(l,y,S,E,x,O){for(var C=0;C<O;C++)E[C]=y[l[C]],x[C]=S[l[C]]},F.prototype.transform=function(l,y,S,E,x,O){this.permute(O,l,y,S,E,x);for(var C=1;C<x;C<<=1)for(var I=C<<1,b=Math.cos(2*Math.PI/I),R=Math.sin(2*Math.PI/I),re=0;re<x;re+=I)for(var te=b,se=R,fe=0;fe<C;fe++){var Pe=S[re+fe],Se=E[re+fe],it=S[re+fe+C],We=E[re+fe+C],Qe=te*it-se*We;We=te*We+se*it,it=Qe,S[re+fe]=Pe+it,E[re+fe]=Se+We,S[re+fe+C]=Pe-it,E[re+fe+C]=Se-We,fe!==I&&(Qe=b*te-R*se,se=b*se+R*te,te=Qe)}},F.prototype.guessLen13b=function(l,y){var S=Math.max(y,l)|1,E=S&1,x=0;for(S=S/2|0;S;S=S>>>1)x++;return 1<<x+1+E},F.prototype.conjugate=function(l,y,S){if(!(S<=1))for(var E=0;E<S/2;E++){var x=l[E];l[E]=l[S-E-1],l[S-E-1]=x,x=y[E],y[E]=-y[S-E-1],y[S-E-1]=-x}},F.prototype.normalize13b=function(l,y){for(var S=0,E=0;E<y/2;E++){var x=Math.round(l[2*E+1]/y)*8192+Math.round(l[2*E]/y)+S;l[E]=x&67108863,x<67108864?S=0:S=x/67108864|0}return l},F.prototype.convert13b=function(l,y,S,E){for(var x=0,O=0;O<y;O++)x=x+(l[O]|0),S[2*O]=x&8191,x=x>>>13,S[2*O+1]=x&8191,x=x>>>13;for(O=2*y;O<E;++O)S[O]=0;r(x===0),r((x&-8192)===0)},F.prototype.stub=function(l){for(var y=new Array(l),S=0;S<l;S++)y[S]=0;return y},F.prototype.mulp=function(l,y,S){var E=2*this.guessLen13b(l.length,y.length),x=this.makeRBT(E),O=this.stub(E),C=new Array(E),I=new Array(E),b=new Array(E),R=new Array(E),re=new Array(E),te=new Array(E),se=S.words;se.length=E,this.convert13b(l.words,l.length,C,E),this.convert13b(y.words,y.length,R,E),this.transform(C,O,I,b,E,x),this.transform(R,O,re,te,E,x);for(var fe=0;fe<E;fe++){var Pe=I[fe]*re[fe]-b[fe]*te[fe];b[fe]=I[fe]*te[fe]+b[fe]*re[fe],I[fe]=Pe}return this.conjugate(I,b,E),this.transform(I,b,se,O,E,x),this.conjugate(se,O,E),this.normalize13b(se,E),S.negative=l.negative^y.negative,S.length=l.length+y.length,S._strip()},i.prototype.mul=function(l){var y=new i(null);return y.words=new Array(this.length+l.length),this.mulTo(l,y)},i.prototype.mulf=function(l){var y=new i(null);return y.words=new Array(this.length+l.length),L(this,l,y)},i.prototype.imul=function(l){return this.clone().mulTo(l,this)},i.prototype.imuln=function(l){var y=l<0;y&&(l=-l),r(typeof l=="number"),r(l<67108864);for(var S=0,E=0;E<this.length;E++){var x=(this.words[E]|0)*l,O=(x&67108863)+(S&67108863);S>>=26,S+=x/67108864|0,S+=O>>>26,this.words[E]=O&67108863}return S!==0&&(this.words[E]=S,this.length++),this.length=l===0?1:this.length,y?this.ineg():this},i.prototype.muln=function(l){return this.clone().imuln(l)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(l){var y=T(l);if(y.length===0)return new i(1);for(var S=this,E=0;E<y.length&&y[E]===0;E++,S=S.sqr());if(++E<y.length)for(var x=S.sqr();E<y.length;E++,x=x.sqr())y[E]!==0&&(S=S.mul(x));return S},i.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var y=l%26,S=(l-y)/26,E=67108863>>>26-y<<26-y,x;if(y!==0){var O=0;for(x=0;x<this.length;x++){var C=this.words[x]&E,I=(this.words[x]|0)-C<<y;this.words[x]=I|O,O=C>>>26-y}O&&(this.words[x]=O,this.length++)}if(S!==0){for(x=this.length-1;x>=0;x--)this.words[x+S]=this.words[x];for(x=0;x<S;x++)this.words[x]=0;this.length+=S}return this._strip()},i.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},i.prototype.iushrn=function(l,y,S){r(typeof l=="number"&&l>=0);var E;y?E=(y-y%26)/26:E=0;var x=l%26,O=Math.min((l-x)/26,this.length),C=67108863^67108863>>>x<<x,I=S;if(E-=O,E=Math.max(0,E),I){for(var b=0;b<O;b++)I.words[b]=this.words[b];I.length=O}if(O!==0)if(this.length>O)for(this.length-=O,b=0;b<this.length;b++)this.words[b]=this.words[b+O];else this.words[0]=0,this.length=1;var R=0;for(b=this.length-1;b>=0&&(R!==0||b>=E);b--){var re=this.words[b]|0;this.words[b]=R<<26-x|re>>>x,R=re&C}return I&&R!==0&&(I.words[I.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(l,y,S){return r(this.negative===0),this.iushrn(l,y,S)},i.prototype.shln=function(l){return this.clone().ishln(l)},i.prototype.ushln=function(l){return this.clone().iushln(l)},i.prototype.shrn=function(l){return this.clone().ishrn(l)},i.prototype.ushrn=function(l){return this.clone().iushrn(l)},i.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var y=l%26,S=(l-y)/26,E=1<<y;if(this.length<=S)return!1;var x=this.words[S];return!!(x&E)},i.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var y=l%26,S=(l-y)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(y!==0&&S++,this.length=Math.min(S,this.length),y!==0){var E=67108863^67108863>>>y<<y;this.words[this.length-1]&=E}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(l){return this.clone().imaskn(l)},i.prototype.iaddn=function(l){return r(typeof l=="number"),r(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},i.prototype._iaddn=function(l){this.words[0]+=l;for(var y=0;y<this.length&&this.words[y]>=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},i.prototype.isubn=function(l){if(r(typeof l=="number"),r(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y<this.length&&this.words[y]<0;y++)this.words[y]+=67108864,this.words[y+1]-=1;return this._strip()},i.prototype.addn=function(l){return this.clone().iaddn(l)},i.prototype.subn=function(l){return this.clone().isubn(l)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(l,y,S){var E=l.length+S,x;this._expand(E);var O,C=0;for(x=0;x<l.length;x++){O=(this.words[x+S]|0)+C;var I=(l.words[x]|0)*y;O-=I&67108863,C=(O>>26)-(I/67108864|0),this.words[x+S]=O&67108863}for(;x<this.length-S;x++)O=(this.words[x+S]|0)+C,C=O>>26,this.words[x+S]=O&67108863;if(C===0)return this._strip();for(r(C===-1),C=0,x=0;x<this.length;x++)O=-(this.words[x]|0)+C,C=O>>26,this.words[x]=O&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(l,y){var S=this.length-l.length,E=this.clone(),x=l,O=x.words[x.length-1]|0,C=this._countBits(O);S=26-C,S!==0&&(x=x.ushln(S),E.iushln(S),O=x.words[x.length-1]|0);var I=E.length-x.length,b;if(y!=="mod"){b=new i(null),b.length=I+1,b.words=new Array(b.length);for(var R=0;R<b.length;R++)b.words[R]=0}var re=E.clone()._ishlnsubmul(x,1,I);re.negative===0&&(E=re,b&&(b.words[I]=1));for(var te=I-1;te>=0;te--){var se=(E.words[x.length+te]|0)*67108864+(E.words[x.length+te-1]|0);for(se=Math.min(se/O|0,67108863),E._ishlnsubmul(x,se,te);E.negative!==0;)se--,E.negative=0,E._ishlnsubmul(x,1,te),E.isZero()||(E.negative^=1);b&&(b.words[te]=se)}return b&&b._strip(),E._strip(),y!=="div"&&S!==0&&E.iushrn(S),{div:b||null,mod:E}},i.prototype.divmod=function(l,y,S){if(r(!l.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var E,x,O;return this.negative!==0&&l.negative===0?(O=this.neg().divmod(l,y),y!=="mod"&&(E=O.div.neg()),y!=="div"&&(x=O.mod.neg(),S&&x.negative!==0&&x.iadd(l)),{div:E,mod:x}):this.negative===0&&l.negative!==0?(O=this.divmod(l.neg(),y),y!=="mod"&&(E=O.div.neg()),{div:E,mod:O.mod}):(this.negative&l.negative)!==0?(O=this.neg().divmod(l.neg(),y),y!=="div"&&(x=O.mod.neg(),S&&x.negative!==0&&x.isub(l)),{div:O.div,mod:x}):l.length>this.length||this.cmp(l)<0?{div:new i(0),mod:this}:l.length===1?y==="div"?{div:this.divn(l.words[0]),mod:null}:y==="mod"?{div:null,mod:new i(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new i(this.modrn(l.words[0]))}:this._wordDiv(l,y)},i.prototype.div=function(l){return this.divmod(l,"div",!1).div},i.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},i.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},i.prototype.divRound=function(l){var y=this.divmod(l);if(y.mod.isZero())return y.div;var S=y.div.negative!==0?y.mod.isub(l):y.mod,E=l.ushrn(1),x=l.andln(1),O=S.cmp(E);return O<0||x===1&&O===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},i.prototype.modrn=function(l){var y=l<0;y&&(l=-l),r(l<=67108863);for(var S=(1<<26)%l,E=0,x=this.length-1;x>=0;x--)E=(S*E+(this.words[x]|0))%l;return y?-E:E},i.prototype.modn=function(l){return this.modrn(l)},i.prototype.idivn=function(l){var y=l<0;y&&(l=-l),r(l<=67108863);for(var S=0,E=this.length-1;E>=0;E--){var x=(this.words[E]|0)+S*67108864;this.words[E]=x/l|0,S=x%l}return this._strip(),y?this.ineg():this},i.prototype.divn=function(l){return this.clone().idivn(l)},i.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var y=this,S=l.clone();y.negative!==0?y=y.umod(l):y=y.clone();for(var E=new i(1),x=new i(0),O=new i(0),C=new i(1),I=0;y.isEven()&&S.isEven();)y.iushrn(1),S.iushrn(1),++I;for(var b=S.clone(),R=y.clone();!y.isZero();){for(var re=0,te=1;(y.words[0]&te)===0&&re<26;++re,te<<=1);if(re>0)for(y.iushrn(re);re-- >0;)(E.isOdd()||x.isOdd())&&(E.iadd(b),x.isub(R)),E.iushrn(1),x.iushrn(1);for(var se=0,fe=1;(S.words[0]&fe)===0&&se<26;++se,fe<<=1);if(se>0)for(S.iushrn(se);se-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(b),C.isub(R)),O.iushrn(1),C.iushrn(1);y.cmp(S)>=0?(y.isub(S),E.isub(O),x.isub(C)):(S.isub(y),O.isub(E),C.isub(x))}return{a:O,b:C,gcd:S.iushln(I)}},i.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var y=this,S=l.clone();y.negative!==0?y=y.umod(l):y=y.clone();for(var E=new i(1),x=new i(0),O=S.clone();y.cmpn(1)>0&&S.cmpn(1)>0;){for(var C=0,I=1;(y.words[0]&I)===0&&C<26;++C,I<<=1);if(C>0)for(y.iushrn(C);C-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);for(var b=0,R=1;(S.words[0]&R)===0&&b<26;++b,R<<=1);if(b>0)for(S.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(O),x.iushrn(1);y.cmp(S)>=0?(y.isub(S),E.isub(x)):(S.isub(y),x.isub(E))}var re;return y.cmpn(1)===0?re=E:re=x,re.cmpn(0)<0&&re.iadd(l),re},i.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var y=this.clone(),S=l.clone();y.negative=0,S.negative=0;for(var E=0;y.isEven()&&S.isEven();E++)y.iushrn(1),S.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;S.isEven();)S.iushrn(1);var x=y.cmp(S);if(x<0){var O=y;y=S,S=O}else if(x===0||S.cmpn(1)===0)break;y.isub(S)}while(!0);return S.iushln(E)},i.prototype.invm=function(l){return this.egcd(l).a.umod(l)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(l){return this.words[0]&l},i.prototype.bincn=function(l){r(typeof l=="number");var y=l%26,S=(l-y)/26,E=1<<y;if(this.length<=S)return this._expand(S+1),this.words[S]|=E,this;for(var x=E,O=S;x!==0&&O<this.length;O++){var C=this.words[O]|0;C+=x,x=C>>>26,C&=67108863,this.words[O]=C}return x!==0&&(this.words[O]=x,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(l){var y=l<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this._strip();var S;if(this.length>1)S=1;else{y&&(l=-l),r(l<=67108863,"Number is too big");var E=this.words[0]|0;S=E===l?0:E<l?-1:1}return this.negative!==0?-S|0:S},i.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var y=this.ucmp(l);return this.negative!==0?-y|0:y},i.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var y=0,S=this.length-1;S>=0;S--){var E=this.words[S]|0,x=l.words[S]|0;if(E!==x){E<x?y=-1:E>x&&(y=1);break}}return y},i.prototype.gtn=function(l){return this.cmpn(l)===1},i.prototype.gt=function(l){return this.cmp(l)===1},i.prototype.gten=function(l){return this.cmpn(l)>=0},i.prototype.gte=function(l){return this.cmp(l)>=0},i.prototype.ltn=function(l){return this.cmpn(l)===-1},i.prototype.lt=function(l){return this.cmp(l)===-1},i.prototype.lten=function(l){return this.cmpn(l)<=0},i.prototype.lte=function(l){return this.cmp(l)<=0},i.prototype.eqn=function(l){return this.cmpn(l)===0},i.prototype.eq=function(l){return this.cmp(l)===0},i.red=function(l){return new Y(l)},i.prototype.toRed=function(l){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(l){return this.red=l,this},i.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},i.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},i.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},i.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},i.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},i.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},i.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},i.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},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(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var ee={k256:null,p224:null,p192:null,p25519:null};function j(w,l){this.name=w,this.p=new i(l,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var l=new i(null);return l.words=new Array(Math.ceil(this.n/13)),l},j.prototype.ireduce=function(l){var y=l,S;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),S=y.bitLength();while(S>this.n);var E=S<this.n?-1:y.ucmp(this.p);return E===0?(y.words[0]=0,y.length=1):E>0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},j.prototype.split=function(l,y){l.iushrn(this.n,0,y)},j.prototype.imulK=function(l){return l.imul(this.k)};function X(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(X,j),X.prototype.split=function(l,y){for(var S=4194303,E=Math.min(l.length,9),x=0;x<E;x++)y.words[x]=l.words[x];if(y.length=E,l.length<=9){l.words[0]=0,l.length=1;return}var O=l.words[9];for(y.words[y.length++]=O&S,x=10;x<l.length;x++){var C=l.words[x]|0;l.words[x-10]=(C&S)<<4|O>>>22,O=C}O>>>=22,l.words[x-10]=O,O===0&&l.length>10?l.length-=10:l.length-=9},X.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var y=0,S=0;S<l.length;S++){var E=l.words[S]|0;y+=E*977,l.words[S]=y&67108863,y=E*64+(y/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function G(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(G,j);function M(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(M,j);function W(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(W,j),W.prototype.imulK=function(l){for(var y=0,S=0;S<l.length;S++){var E=(l.words[S]|0)*19+y,x=E&67108863;E>>>=26,l.words[S]=x,y=E}return y!==0&&(l.words[l.length++]=y),l},i._prime=function(l){if(ee[l])return ee[l];var y;if(l==="k256")y=new X;else if(l==="p224")y=new G;else if(l==="p192")y=new M;else if(l==="p25519")y=new W;else throw new Error("Unknown prime "+l);return ee[l]=y,y};function Y(w){if(typeof w=="string"){var l=i._prime(w);this.m=l.p,this.prime=l}else r(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}Y.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},Y.prototype._verify2=function(l,y){r((l.negative|y.negative)===0,"red works only with positives"),r(l.red&&l.red===y.red,"red works only with red numbers")},Y.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(d(l,l.umod(this.m)._forceRed(this)),l)},Y.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},Y.prototype.add=function(l,y){this._verify2(l,y);var S=l.add(y);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},Y.prototype.iadd=function(l,y){this._verify2(l,y);var S=l.iadd(y);return S.cmp(this.m)>=0&&S.isub(this.m),S},Y.prototype.sub=function(l,y){this._verify2(l,y);var S=l.sub(y);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},Y.prototype.isub=function(l,y){this._verify2(l,y);var S=l.isub(y);return S.cmpn(0)<0&&S.iadd(this.m),S},Y.prototype.shl=function(l,y){return this._verify1(l),this.imod(l.ushln(y))},Y.prototype.imul=function(l,y){return this._verify2(l,y),this.imod(l.imul(y))},Y.prototype.mul=function(l,y){return this._verify2(l,y),this.imod(l.mul(y))},Y.prototype.isqr=function(l){return this.imul(l,l.clone())},Y.prototype.sqr=function(l){return this.mul(l,l)},Y.prototype.sqrt=function(l){if(l.isZero())return l.clone();var y=this.m.andln(3);if(r(y%2===1),y===3){var S=this.m.add(new i(1)).iushrn(2);return this.pow(l,S)}for(var E=this.m.subn(1),x=0;!E.isZero()&&E.andln(1)===0;)x++,E.iushrn(1);r(!E.isZero());var O=new i(1).toRed(this),C=O.redNeg(),I=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new i(2*b*b).toRed(this);this.pow(b,I).cmp(C)!==0;)b.redIAdd(C);for(var R=this.pow(b,E),re=this.pow(l,E.addn(1).iushrn(1)),te=this.pow(l,E),se=x;te.cmp(O)!==0;){for(var fe=te,Pe=0;fe.cmp(O)!==0;Pe++)fe=fe.redSqr();r(Pe<se);var Se=this.pow(R,new i(1).iushln(se-Pe-1));re=re.redMul(Se),R=Se.redSqr(),te=te.redMul(R),se=Pe}return re},Y.prototype.invm=function(l){var y=l._invmp(this.m);return y.negative!==0?(y.negative=0,this.imod(y).redNeg()):this.imod(y)},Y.prototype.pow=function(l,y){if(y.isZero())return new i(1).toRed(this);if(y.cmpn(1)===0)return l.clone();var S=4,E=new Array(1<<S);E[0]=new i(1).toRed(this),E[1]=l;for(var x=2;x<E.length;x++)E[x]=this.mul(E[x-1],l);var O=E[0],C=0,I=0,b=y.bitLength()%26;for(b===0&&(b=26),x=y.length-1;x>=0;x--){for(var R=y.words[x],re=b-1;re>=0;re--){var te=R>>re&1;if(O!==E[0]&&(O=this.sqr(O)),te===0&&C===0){I=0;continue}C<<=1,C|=te,I++,!(I!==S&&(x!==0||re!==0))&&(O=this.mul(O,E[C]),I=0,C=0)}b=26}return O},Y.prototype.convertTo=function(l){var y=l.umod(this.m);return y===l?y.clone():y},Y.prototype.convertFrom=function(l){var y=l.clone();return y.red=null,y},i.mont=function(l){return new Q(l)};function Q(w){Y.call(this,w),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)}n(Q,Y),Q.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},Q.prototype.convertFrom=function(l){var y=this.imod(l.mul(this.rinv));return y.red=null,y},Q.prototype.imul=function(l,y){if(l.isZero()||y.isZero())return l.words[0]=0,l.length=1,l;var S=l.imul(y),E=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=S.isub(E).iushrn(this.shift),O=x;return x.cmp(this.m)>=0?O=x.isub(this.m):x.cmpn(0)<0&&(O=x.iadd(this.m)),O._forceRed(this)},Q.prototype.mul=function(l,y){if(l.isZero()||y.isZero())return new i(0)._forceRed(this);var S=l.mul(y),E=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=S.isub(E).iushrn(this.shift),O=x;return x.cmp(this.m)>=0?O=x.isub(this.m):x.cmpn(0)<0&&(O=x.iadd(this.m)),O._forceRed(this)},Q.prototype.invm=function(l){var y=this.imod(l._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(typeof KE>"u"||KE,ok)});var jE=_((WE,ck)=>{a();var r1=Ic(),hs=r1.Buffer;function ak(t,e){for(var r in t)e[r]=t[r]}hs.from&&hs.alloc&&hs.allocUnsafe&&hs.allocUnsafeSlow?ck.exports=r1:(ak(r1,WE),WE.Buffer=Nc);function Nc(t,e,r){return hs(t,e,r)}Nc.prototype=Object.create(hs.prototype);ak(hs,Nc);Nc.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return hs(t,e,r)};Nc.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=hs(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Nc.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return hs(t)};Nc.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return r1.SlowBuffer(t)}});var lk=_((eTe,uk)=>{"use strict";a();var n1=jE().Buffer;function yH(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var o=t.length,c=t.charAt(0),u=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function f(v){if((Array.isArray(v)||v instanceof Uint8Array)&&(v=n1.from(v)),!n1.isBuffer(v))throw new TypeError("Expected Buffer");if(v.length===0)return"";for(var P=0,T=0,k=0,B=v.length;k!==B&&v[k]===0;)k++,P++;for(var D=(B-k)*d+1>>>0,L=new Uint8Array(D);k!==B;){for(var F=v[k],ee=0,j=D-1;(F!==0||ee<T)&&j!==-1;j--,ee++)F+=256*L[j]>>>0,L[j]=F%o>>>0,F=F/o>>>0;if(F!==0)throw new Error("Non-zero carry");T=ee,k++}for(var X=D-T;X!==D&&L[X]===0;)X++;for(var G=c.repeat(P);X<D;++X)G+=t.charAt(L[X]);return G}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return n1.alloc(0);for(var P=0,T=0,k=0;v[P]===c;)T++,P++;for(var B=(v.length-P)*u+1>>>0,D=new Uint8Array(B);P<v.length;){var L=v.charCodeAt(P);if(L>255)return;var F=e[L];if(F===255)return;for(var ee=0,j=B-1;(F!==0||ee<k)&&j!==-1;j--,ee++)F+=o*D[j]>>>0,D[j]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");k=ee,P++}for(var X=B-k;X!==B&&D[X]===0;)X++;var G=n1.allocUnsafe(T+(B-X));G.fill(0,0,T);for(var M=T;X!==B;)G[M++]=D[X++];return G}function A(v){var P=m(v);if(P)return P;throw new Error("Non-base"+o+" character")}return{encode:f,decodeUnsafe:m,decode:A}}uk.exports=yH});var fk=_((rTe,dk)=>{a();var bH=lk(),AH="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";dk.exports=bH(AH)});var hk=_((uTe,pk)=>{"use strict";a();var i1=jE().Buffer;function _H(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var o=t.length,c=t.charAt(0),u=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function f(v){if((Array.isArray(v)||v instanceof Uint8Array)&&(v=i1.from(v)),!i1.isBuffer(v))throw new TypeError("Expected Buffer");if(v.length===0)return"";for(var P=0,T=0,k=0,B=v.length;k!==B&&v[k]===0;)k++,P++;for(var D=(B-k)*d+1>>>0,L=new Uint8Array(D);k!==B;){for(var F=v[k],ee=0,j=D-1;(F!==0||ee<T)&&j!==-1;j--,ee++)F+=256*L[j]>>>0,L[j]=F%o>>>0,F=F/o>>>0;if(F!==0)throw new Error("Non-zero carry");T=ee,k++}for(var X=D-T;X!==D&&L[X]===0;)X++;for(var G=c.repeat(P);X<D;++X)G+=t.charAt(L[X]);return G}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return i1.alloc(0);for(var P=0,T=0,k=0;v[P]===c;)T++,P++;for(var B=(v.length-P)*u+1>>>0,D=new Uint8Array(B);P<v.length;){var L=v.charCodeAt(P);if(L>255)return;var F=e[L];if(F===255)return;for(var ee=0,j=B-1;(F!==0||ee<k)&&j!==-1;j--,ee++)F+=o*D[j]>>>0,D[j]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");k=ee,P++}for(var X=B-k;X!==B&&D[X]===0;)X++;var G=i1.allocUnsafe(T+(B-X));G.fill(0,0,T);for(var M=T;X!==B;)G[M++]=D[X++];return G}function A(v){var P=m(v);if(P)return P;throw new Error("Non-base"+o+" character")}return{encode:f,decodeUnsafe:m,decode:A}}pk.exports=_H});var mk=_((dTe,gk)=>{a();var SH=hk(),vH="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";gk.exports=SH(vH)});var yk=_(ZE=>{"use strict";a();function ao(t,e,r){return e<=t&&t<=r}function u1(t){if(t===void 0)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function EH(t){for(var e=String(t),r=e.length,n=0,i=[];n<r;){var s=e.charCodeAt(n);if(s<55296||s>57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var c=s&1023,u=o&1023;i.push(65536+(c<<10)+u),n+=1}else i.push(65533)}n+=1}return i}function wH(t){for(var e="",r=0;r<t.length;++r){var n=t[r];n<=65535?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return e}var s1=-1;function $E(t){this.tokens=[].slice.call(t)}$E.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():s1},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var Pl=-1;function GE(t,e){if(t)throw TypeError("Decoder error");return e||65533}var o1="utf-8";function a1(t,e){if(!(this instanceof a1))return new a1(t,e);if(t=t!==void 0?String(t).toLowerCase():o1,t!==o1)throw new Error("Encoding not supported. Only utf-8 is supported");e=u1(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}a1.prototype={decode:function(e,r){var n;typeof e=="object"&&e instanceof ArrayBuffer?n=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):n=new Uint8Array(0),r=u1(r),this._streaming||(this._decoder=new xH({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new $E(n),s=[],o;!i.endOfStream()&&(o=this._decoder.handler(i,i.read()),o!==Pl);)o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o));if(!this._streaming){do{if(o=this._decoder.handler(i,i.read()),o===Pl)break;o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o))}while(!i.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),wH(s)}};function c1(t,e){if(!(this instanceof c1))return new c1(t,e);if(t=t!==void 0?String(t).toLowerCase():o1,t!==o1)throw new Error("Encoding not supported. Only utf-8 is supported");e=u1(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}c1.prototype={encode:function(e,r){e=e?String(e):"",r=u1(r),this._streaming||(this._encoder=new IH(this._options)),this._streaming=!!r.stream;for(var n=[],i=new $E(EH(e)),s;!i.endOfStream()&&(s=this._encoder.handler(i,i.read()),s!==Pl);)Array.isArray(s)?n.push.apply(n,s):n.push(s);if(!this._streaming){for(;s=this._encoder.handler(i,i.read()),s!==Pl;)Array.isArray(s)?n.push.apply(n,s):n.push(s);this._encoder=null}return new Uint8Array(n)}};function xH(t){var e=t.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(c,u){if(u===s1&&i!==0)return i=0,GE(e);if(u===s1)return Pl;if(i===0){if(ao(u,0,127))return u;if(ao(u,194,223))i=1,r=u-192;else if(ao(u,224,239))u===224&&(s=160),u===237&&(o=159),i=2,r=u-224;else if(ao(u,240,244))u===240&&(s=144),u===244&&(o=143),i=3,r=u-240;else return GE(e);return r=r<<6*i,null}if(!ao(u,s,o))return r=i=n=0,s=128,o=191,c.prepend(u),GE(e);if(s=128,o=191,n+=1,r+=u-128<<6*(i-n),n!==i)return null;var d=r;return r=i=n=0,d}}function IH(t){var e=t.fatal;this.handler=function(r,n){if(n===s1)return Pl;if(ao(n,0,127))return n;var i,s;ao(n,128,2047)?(i=1,s=192):ao(n,2048,65535)?(i=2,s=224):ao(n,65536,1114111)&&(i=3,s=240);for(var o=[(n>>6*i)+s];i>0;){var c=n>>6*(i-1);o.push(128|c&63),i-=1}return o}}ZE.TextEncoder=c1;ZE.TextDecoder=a1});var vk=_(Ye=>{"use strict";a();var PH=Ye&&Ye.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),RH=Ye&&Ye.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),gs=Ye&&Ye.__decorate||function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},OH=Ye&&Ye.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&PH(e,t,r);return RH(e,t),e},bk=Ye&&Ye.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.deserializeUnchecked=Ye.deserialize=Ye.serialize=Ye.BinaryReader=Ye.BinaryWriter=Ye.BorshError=Ye.baseDecode=Ye.baseEncode=void 0;var Ho=bk(FE()),Ak=bk(mk()),TH=OH(yk()),BH=typeof TextDecoder!="function"?TH.TextDecoder:TextDecoder,zH=new BH("utf-8",{fatal:!0});function kH(t){return typeof t=="string"&&(t=p.Buffer.from(t,"utf8")),Ak.default.encode(p.Buffer.from(t))}Ye.baseEncode=kH;function CH(t){return p.Buffer.from(Ak.default.decode(t))}Ye.baseDecode=CH;var XE=1024,Hr=class 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(".")}};Ye.BorshError=Hr;var l1=class{constructor(){this.buf=p.Buffer.alloc(XE),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=p.Buffer.concat([this.buf,p.Buffer.alloc(XE)]))}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(p.Buffer.from(new Ho.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new Ho.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new Ho.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(p.Buffer.from(new Ho.default(e).toArray("le",64)))}writeBuffer(e){this.buf=p.Buffer.concat([p.Buffer.from(this.buf.subarray(0,this.length)),e,p.Buffer.alloc(XE)]),this.length+=e.length}writeString(e){this.maybeResize();let r=p.Buffer.from(e,"utf8");this.writeU32(r.length),this.writeBuffer(r)}writeFixedArray(e){this.writeBuffer(p.Buffer.from(e))}writeArray(e,r){this.maybeResize(),this.writeU32(e.length);for(let n of e)this.maybeResize(),r(n)}toArray(){return this.buf.subarray(0,this.length)}};Ye.BinaryWriter=l1;function ms(t,e,r){let n=r.value;r.value=function(...i){try{return n.apply(this,i)}catch(s){if(s instanceof RangeError){let o=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(o)>=0)throw new Hr("Reached the end of buffer when deserializing")}throw s}}}var An=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new Ho.default(e,"le")}readU128(){let e=this.readBuffer(16);return new Ho.default(e,"le")}readU256(){let e=this.readBuffer(32);return new Ho.default(e,"le")}readU512(){let e=this.readBuffer(64);return new Ho.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new Hr(`Expected buffer length ${e} isn't within bounds`);let r=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,r}readString(){let e=this.readU32(),r=this.readBuffer(e);try{return zH.decode(r)}catch(n){throw new Hr(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let r=this.readU32(),n=Array();for(let i=0;i<r;++i)n.push(e());return n}};gs([ms],An.prototype,"readU8",null);gs([ms],An.prototype,"readU16",null);gs([ms],An.prototype,"readU32",null);gs([ms],An.prototype,"readU64",null);gs([ms],An.prototype,"readU128",null);gs([ms],An.prototype,"readU256",null);gs([ms],An.prototype,"readU512",null);gs([ms],An.prototype,"readString",null);gs([ms],An.prototype,"readFixedArray",null);gs([ms],An.prototype,"readArray",null);Ye.BinaryReader=An;function _k(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Lc(t,e,r,n,i){try{if(typeof n=="string")i[`write${_k(n)}`](r);else if(n instanceof Array)if(typeof n[0]=="number"){if(r.length!==n[0])throw new Hr(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(n.length===2&&typeof n[1]=="number"){if(r.length!==n[1])throw new Hr(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let s=0;s<n[1];s++)Lc(t,null,r[s],n[0],i)}else i.writeArray(r,s=>{Lc(t,e,s,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":{r==null?i.writeU8(0):(i.writeU8(1),Lc(t,e,r,n.type,i));break}case"map":{i.writeU32(r.size),r.forEach((s,o)=>{Lc(t,e,o,n.key,i),Lc(t,e,s,n.value,i)});break}default:throw new Hr(`FieldType ${n} unrecognized`)}else Sk(t,r,i)}catch(s){throw s instanceof Hr&&s.addToFieldPath(e),s}}function Sk(t,e,r){if(typeof e.borshSerialize=="function"){e.borshSerialize(r);return}let n=t.get(e.constructor);if(!n)throw new Hr(`Class ${e.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,s])=>{Lc(t,i,e[i],s,r)});else if(n.kind==="enum"){let i=e[n.field];for(let s=0;s<n.values.length;++s){let[o,c]=n.values[s];if(o===i){r.writeU8(s),Lc(t,o,e[o],c,r);break}}}else throw new Hr(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function MH(t,e,r=l1){let n=new r;return Sk(t,e,n),n.toArray()}Ye.serialize=MH;function Dc(t,e,r,n){try{if(typeof r=="string")return n[`read${_k(r)}`]();if(r instanceof Array){if(typeof r[0]=="number")return n.readFixedArray(r[0]);if(typeof r[1]=="number"){let i=[];for(let s=0;s<r[1];s++)i.push(Dc(t,null,r[0],n));return i}else return n.readArray(()=>Dc(t,e,r[0],n))}if(r.kind==="option")return n.readU8()?Dc(t,e,r.type,n):void 0;if(r.kind==="map"){let i=new Map,s=n.readU32();for(let o=0;o<s;o++){let c=Dc(t,e,r.key,n),u=Dc(t,e,r.value,n);i.set(c,u)}return i}return YE(t,r,n)}catch(i){throw i instanceof Hr&&i.addToFieldPath(e),i}}function YE(t,e,r){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(r);let n=t.get(e);if(!n)throw new Hr(`Class ${e.name} is missing in schema`);if(n.kind==="struct"){let i={};for(let[s,o]of t.get(e).fields)i[s]=Dc(t,s,o,r);return new e(i)}if(n.kind==="enum"){let i=r.readU8();if(i>=n.values.length)throw new Hr(`Enum index: ${i} is out of range`);let[s,o]=n.values[i],c=Dc(t,s,o,r);return new e({[s]:c})}throw new Hr(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function NH(t,e,r,n=An){let i=new n(r),s=YE(t,e,i);if(i.offset<r.length)throw new Hr(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return s}Ye.deserialize=NH;function LH(t,e,r,n=An){let i=new n(r);return YE(t,e,i)}Ye.deserializeUnchecked=LH});var tw=_(V=>{"use strict";a();Object.defineProperty(V,"__esModule",{value:!0});V.s16=V.s8=V.nu64be=V.u48be=V.u40be=V.u32be=V.u24be=V.u16be=V.nu64=V.u48=V.u40=V.u32=V.u24=V.u16=V.u8=V.offset=V.greedy=V.Constant=V.UTF8=V.CString=V.Blob=V.Boolean=V.BitField=V.BitStructure=V.VariantLayout=V.Union=V.UnionLayoutDiscriminator=V.UnionDiscriminator=V.Structure=V.Sequence=V.DoubleBE=V.Double=V.FloatBE=V.Float=V.NearInt64BE=V.NearInt64=V.NearUInt64BE=V.NearUInt64=V.IntBE=V.Int=V.UIntBE=V.UInt=V.OffsetLayout=V.GreedyCount=V.ExternalLayout=V.bindConstructorLayout=V.nameWithProperty=V.Layout=V.uint8ArrayToBuffer=V.checkUint8Array=void 0;V.constant=V.utf8=V.cstr=V.blob=V.unionLayoutDiscriminator=V.union=V.seq=V.bits=V.struct=V.f64be=V.f64=V.f32be=V.f32=V.ns64be=V.s48be=V.s40be=V.s32be=V.s24be=V.s16be=V.ns64=V.s48=V.s40=V.s32=V.s24=void 0;var QE=Ic();function Tl(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}V.checkUint8Array=Tl;function Ve(t){return Tl(t),QE.Buffer.from(t.buffer,t.byteOffset,t.length)}V.uint8ArrayToBuffer=Ve;var je=class{constructor(e,r){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=r}makeDestinationObject(){return{}}getSpan(e,r){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=e,r}fromArray(e){}};V.Layout=je;function ew(t,e){return e.property?t+"["+e.property+"]":t}V.nameWithProperty=ew;function DH(t,e){if(typeof t!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof je))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=(()=>new t),Object.defineProperty(t.prototype,"encode",{value(r,n){return e.encode(this,r,n)},writable:!0}),Object.defineProperty(t,"decode",{value(r,n){return e.decode(r,n)},writable:!0})}V.bindConstructorLayout=DH;var tn=class extends je{isCount(){throw new Error("ExternalLayout is abstract")}};V.ExternalLayout=tn;var d1=class extends tn{constructor(e=1,r){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=e}isCount(){return!0}decode(e,r=0){Tl(e);let n=e.length-r;return Math.floor(n/this.elementSpan)}encode(e,r,n){return 0}};V.GreedyCount=d1;var ch=class extends tn{constructor(e,r=0,n){if(!(e instanceof je))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=r}isCount(){return this.layout instanceof zn||this.layout instanceof Gn}decode(e,r=0){return this.layout.decode(e,r+this.offset)}encode(e,r,n=0){return this.layout.encode(e,r,n+this.offset)}};V.OffsetLayout=ch;var zn=class extends je{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Ve(e).readUIntLE(r,this.span)}encode(e,r,n=0){return Ve(r).writeUIntLE(e,n,this.span),this.span}};V.UInt=zn;var Gn=class extends je{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Ve(e).readUIntBE(r,this.span)}encode(e,r,n=0){return Ve(r).writeUIntBE(e,n,this.span),this.span}};V.UIntBE=Gn;var co=class extends je{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Ve(e).readIntLE(r,this.span)}encode(e,r,n=0){return Ve(r).writeIntLE(e,n,this.span),this.span}};V.Int=co;var Go=class extends je{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return Ve(e).readIntBE(r,this.span)}encode(e,r,n=0){return Ve(r).writeIntBE(e,n,this.span),this.span}};V.IntBE=Go;var JE=Math.pow(2,32);function R1(t){let e=Math.floor(t/JE),r=t-e*JE;return{hi32:e,lo32:r}}function O1(t,e){return t*JE+e}var f1=class extends je{constructor(e){super(8,e)}decode(e,r=0){let n=Ve(e),i=n.readUInt32LE(r),s=n.readUInt32LE(r+4);return O1(s,i)}encode(e,r,n=0){let i=R1(e),s=Ve(r);return s.writeUInt32LE(i.lo32,n),s.writeUInt32LE(i.hi32,n+4),8}};V.NearUInt64=f1;var p1=class extends je{constructor(e){super(8,e)}decode(e,r=0){let n=Ve(e),i=n.readUInt32BE(r),s=n.readUInt32BE(r+4);return O1(i,s)}encode(e,r,n=0){let i=R1(e),s=Ve(r);return s.writeUInt32BE(i.hi32,n),s.writeUInt32BE(i.lo32,n+4),8}};V.NearUInt64BE=p1;var h1=class extends je{constructor(e){super(8,e)}decode(e,r=0){let n=Ve(e),i=n.readUInt32LE(r),s=n.readInt32LE(r+4);return O1(s,i)}encode(e,r,n=0){let i=R1(e),s=Ve(r);return s.writeUInt32LE(i.lo32,n),s.writeInt32LE(i.hi32,n+4),8}};V.NearInt64=h1;var g1=class extends je{constructor(e){super(8,e)}decode(e,r=0){let n=Ve(e),i=n.readInt32BE(r),s=n.readUInt32BE(r+4);return O1(i,s)}encode(e,r,n=0){let i=R1(e),s=Ve(r);return s.writeInt32BE(i.hi32,n),s.writeUInt32BE(i.lo32,n+4),8}};V.NearInt64BE=g1;var m1=class extends je{constructor(e){super(4,e)}decode(e,r=0){return Ve(e).readFloatLE(r)}encode(e,r,n=0){return Ve(r).writeFloatLE(e,n),4}};V.Float=m1;var y1=class extends je{constructor(e){super(4,e)}decode(e,r=0){return Ve(e).readFloatBE(r)}encode(e,r,n=0){return Ve(r).writeFloatBE(e,n),4}};V.FloatBE=y1;var b1=class extends je{constructor(e){super(8,e)}decode(e,r=0){return Ve(e).readDoubleLE(r)}encode(e,r,n=0){return Ve(r).writeDoubleLE(e,n),8}};V.Double=b1;var A1=class extends je{constructor(e){super(8,e)}decode(e,r=0){return Ve(e).readDoubleBE(r)}encode(e,r,n=0){return Ve(r).writeDoubleBE(e,n),8}};V.DoubleBE=A1;var _1=class extends je{constructor(e,r,n){if(!(e instanceof je))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof tn&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(r instanceof tn)&&0<e.span&&(i=r*e.span),super(i,n),this.elementLayout=e,this.count=r}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0,i=this.count;if(i instanceof tn&&(i=i.decode(e,r)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let s=0;for(;s<i;)n+=this.elementLayout.getSpan(e,r+n),++s}return n}decode(e,r=0){let n=[],i=0,s=this.count;for(s instanceof tn&&(s=s.decode(e,r));i<s;)n.push(this.elementLayout.decode(e,r)),r+=this.elementLayout.getSpan(e,r),i+=1;return n}encode(e,r,n=0){let i=this.elementLayout,s=e.reduce((o,c)=>o+i.encode(c,r,n+o),0);return this.count instanceof tn&&this.count.encode(e.length,r,n),s}};V.Sequence=_1;var S1=class extends je{constructor(e,r,n){if(!(Array.isArray(e)&&e.reduce((s,o)=>s&&o instanceof je,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(let s of e)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((s,o)=>s+o.getSpan(),0)}catch{}super(i,r),this.fields=e,this.decodePrefixes=!!n}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,s)=>{let o=s.getSpan(e,r);return r+=o,i+o},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,r=0){Tl(e);let n=this.makeDestinationObject();for(let i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,r)),r+=i.getSpan(e,r),this.decodePrefixes&&e.length===r)break;return n}encode(e,r,n=0){let i=n,s=0,o=0;for(let c of this.fields){let u=c.span;if(o=0<u?u:0,c.property!==void 0){let d=e[c.property];d!==void 0&&(o=c.encode(d,r,n),0>u&&(u=c.getSpan(r,n)))}s=n,n+=u}return s+o-i}fromArray(e){let r=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0<e.length&&(r[n.property]=e.shift());return r}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let r of this.fields)if(r.property===e)return r}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let r=0;for(let n of this.fields){if(n.property===e)return r;0>n.span?r=-1:0<=r&&(r+=n.span)}}};V.Structure=S1;var uh=class{constructor(e){this.property=e}decode(e,r){throw new Error("UnionDiscriminator is abstract")}encode(e,r,n){throw new Error("UnionDiscriminator is abstract")}};V.UnionDiscriminator=uh;var Ol=class extends uh{constructor(e,r){if(!(e instanceof tn&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||e.property||"variant"),this.layout=e}decode(e,r){return this.layout.decode(e,r)}encode(e,r,n){return this.layout.encode(e,r,n)}};V.UnionLayoutDiscriminator=Ol;var lh=class extends je{constructor(e,r,n){let i;if(e instanceof zn||e instanceof Gn)i=new Ol(new ch(e));else if(e instanceof tn&&e.isCount())i=new Ol(e);else if(e instanceof uh)i=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof je))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let s=-1;r&&(s=r.span,0<=s&&(e instanceof zn||e instanceof Gn)&&(s+=i.layout.span)),super(s,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof zn||e instanceof Gn,this.defaultLayout=r,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return o(c)},this.configGetSourceVariant=function(c){o=c.bind(this)}}getSpan(e,r=0){if(0<=this.span)return this.span;let n=this.getVariant(e,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,r)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let r=this.registry[e[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(e,r.property)))return r}else for(let r in this.registry){let n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,r=0){let n,i=this.discriminator,s=i.decode(e,r),o=this.registry[s];if(o===void 0){let c=this.defaultLayout,u=0;this.usesPrefixDiscriminator&&(u=i.layout.span),n=this.makeDestinationObject(),n[i.property]=s,n[c.property]=c.decode(e,r+u)}else n=o.decode(e,r);return n}encode(e,r,n=0){let i=this.getSourceVariant(e);if(i===void 0){let s=this.discriminator,o=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=s.layout.span),s.encode(e[s.property],r,n),c+o.encode(e[o.property],r,n+c)}return i.encode(e,r,n)}addVariant(e,r,n){let i=new v1(this,e,r,n);return this.registry[e]=i,i}getVariant(e,r=0){let n;return e instanceof Uint8Array?n=this.discriminator.decode(e,r):n=e,this.registry[n]}};V.Union=lh;var v1=class extends je{constructor(e,r,n,i){if(!(e instanceof lh))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof je))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let s=e.span;0>e.span&&(s=n?n.span:0,0<=s&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span)),super(s,i),this.union=e,this.variant=r,this.layout=n||null}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,r+n)),n+i}decode(e,r=0){let n=this.makeDestinationObject();if(this!==this.union.getVariant(e,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let s=i;if(this.layout&&(this.layout.encode(e[this.property],r,n+i),s+=this.layout.getSpan(r,n+i),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};V.VariantLayout=v1;function Rl(t){return 0>t&&(t+=4294967296),t}var dh=class extends je{constructor(e,r,n){if(!(e instanceof zn||e instanceof Gn))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!r,this.fields=[];let i=0;this._packedSetValue=function(s){return i=Rl(s),this},this._packedGetValue=function(){return i}}decode(e,r=0){let n=this.makeDestinationObject(),i=this.word.decode(e,r);this._packedSetValue(i);for(let s of this.fields)s.property!==void 0&&(n[s.property]=s.decode(e));return n}encode(e,r,n=0){let i=this.word.decode(r,n);this._packedSetValue(i);for(let s of this.fields)if(s.property!==void 0){let o=e[s.property];o!==void 0&&s.encode(o)}return this.word.encode(this._packedGetValue(),r,n)}addField(e,r){let n=new fh(this,e,r);return this.fields.push(n),n}addBoolean(e){let r=new E1(this,e);return this.fields.push(r),r}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let r of this.fields)if(r.property===e)return r}};V.BitStructure=dh;var fh=class{constructor(e,r,n){if(!(e instanceof dh))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(r)||0>=r)throw new TypeError("bits must be positive integer");let i=8*e.span,s=e.fields.reduce((o,c)=>o+c.bits,0);if(r+s>i)throw new Error("bits too long for span remainder ("+(i-s)+" of "+i+" remain)");this.container=e,this.bits=r,this.valueMask=(1<<r)-1,r===32&&(this.valueMask=4294967295),this.start=s,this.container.msb&&(this.start=i-s-r),this.wordMask=Rl(this.valueMask<<this.start),this.property=n}decode(e,r){let n=this.container._packedGetValue();return Rl(n&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Rl(e&this.valueMask))throw new TypeError(ew("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let r=this.container._packedGetValue(),n=Rl(e<<this.start);this.container._packedSetValue(Rl(r&~this.wordMask)|n)}};V.BitField=fh;var E1=class extends fh{constructor(e,r){super(e,1,r)}decode(e,r){return!!super.decode(e,r)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};V.Boolean=E1;var w1=class extends je{constructor(e,r){if(!(e instanceof tn&&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 tn||(n=e),super(n,r),this.length=e}getSpan(e,r){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),n}decode(e,r=0){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),Ve(e).slice(r,r+n)}encode(e,r,n){let i=this.length;if(this.length instanceof tn&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(ew("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");let s=Ve(e);return Ve(r).write(s.toString("hex"),n,i,"hex"),this.length instanceof tn&&this.length.encode(i,r,n),i}};V.Blob=w1;var x1=class extends je{constructor(e){super(-1,e)}getSpan(e,r=0){Tl(e);let n=r;for(;n<e.length&&e[n]!==0;)n+=1;return 1+n-r}decode(e,r=0){let n=this.getSpan(e,r);return Ve(e).slice(r,r+n-1).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=QE.Buffer.from(e,"utf8"),s=i.length;if(n+s>r.length)throw new RangeError("encoding overruns Buffer");let o=Ve(r);return i.copy(o,n),o[n+s]=0,s+1}};V.CString=x1;var I1=class extends je{constructor(e,r){if(typeof e=="string"&&r===void 0&&(r=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=e}getSpan(e,r=0){return Tl(e),e.length-r}decode(e,r=0){let n=this.getSpan(e,r);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return Ve(e).slice(r,r+n).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));let i=QE.Buffer.from(e,"utf8"),s=i.length;if(0<=this.maxSpan&&this.maxSpan<s)throw new RangeError("text length exceeds maxSpan");if(n+s>r.length)throw new RangeError("encoding overruns Buffer");return i.copy(Ve(r),n),s}};V.UTF8=I1;var P1=class extends je{constructor(e,r){super(0,r),this.value=e}decode(e,r){return this.value}encode(e,r,n){return 0}};V.Constant=P1;V.greedy=((t,e)=>new d1(t,e));V.offset=((t,e,r)=>new ch(t,e,r));V.u8=(t=>new zn(1,t));V.u16=(t=>new zn(2,t));V.u24=(t=>new zn(3,t));V.u32=(t=>new zn(4,t));V.u40=(t=>new zn(5,t));V.u48=(t=>new zn(6,t));V.nu64=(t=>new f1(t));V.u16be=(t=>new Gn(2,t));V.u24be=(t=>new Gn(3,t));V.u32be=(t=>new Gn(4,t));V.u40be=(t=>new Gn(5,t));V.u48be=(t=>new Gn(6,t));V.nu64be=(t=>new p1(t));V.s8=(t=>new co(1,t));V.s16=(t=>new co(2,t));V.s24=(t=>new co(3,t));V.s32=(t=>new co(4,t));V.s40=(t=>new co(5,t));V.s48=(t=>new co(6,t));V.ns64=(t=>new h1(t));V.s16be=(t=>new Go(2,t));V.s24be=(t=>new Go(3,t));V.s32be=(t=>new Go(4,t));V.s40be=(t=>new Go(5,t));V.s48be=(t=>new Go(6,t));V.ns64be=(t=>new g1(t));V.f32=(t=>new m1(t));V.f32be=(t=>new y1(t));V.f64=(t=>new b1(t));V.f64be=(t=>new A1(t));V.struct=((t,e,r)=>new S1(t,e,r));V.bits=((t,e,r)=>new dh(t,e,r));V.seq=((t,e,r)=>new _1(t,e,r));V.union=((t,e,r)=>new lh(t,e,r));V.unionLayoutDiscriminator=((t,e)=>new Ol(t,e));V.blob=((t,e)=>new w1(t,e));V.cstr=(t=>new x1(t));V.utf8=((t,e)=>new I1(t,e));V.constant=((t,e)=>new P1(t,e))});function gh(){if(!k1&&(k1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!k1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return k1(J9)}var k1,J9,fw=en(()=>{a();J9=new Uint8Array(16)});var Vk,Kk=en(()=>{a();Vk=/^(?:[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});function Q9(t){return typeof t=="string"&&Vk.test(t)}var Zo,mh=en(()=>{a();Kk();Zo=Q9});function eZ(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Gr[t[e+0]]+Gr[t[e+1]]+Gr[t[e+2]]+Gr[t[e+3]]+"-"+Gr[t[e+4]]+Gr[t[e+5]]+"-"+Gr[t[e+6]]+Gr[t[e+7]]+"-"+Gr[t[e+8]]+Gr[t[e+9]]+"-"+Gr[t[e+10]]+Gr[t[e+11]]+Gr[t[e+12]]+Gr[t[e+13]]+Gr[t[e+14]]+Gr[t[e+15]]).toLowerCase();if(!Zo(r))throw TypeError("Stringified UUID is invalid");return r}var Gr,C1,Xo,yh=en(()=>{a();mh();Gr=[];for(C1=0;C1<256;++C1)Gr.push((C1+256).toString(16).substr(1));Xo=eZ});function tZ(t,e,r){var n=e&&r||0,i=e||new Array(16);t=t||{};var s=t.node||Fk,o=t.clockseq!==void 0?t.clockseq:pw;if(s==null||o==null){var c=t.random||(t.rng||gh)();s==null&&(s=Fk=[c[0]|1,c[1],c[2],c[3],c[4],c[5]]),o==null&&(o=pw=(c[6]<<8|c[7])&16383)}var u=t.msecs!==void 0?t.msecs:Date.now(),d=t.nsecs!==void 0?t.nsecs:gw+1,f=u-hw+(d-gw)/1e4;if(f<0&&t.clockseq===void 0&&(o=o+1&16383),(f<0||u>hw)&&t.nsecs===void 0&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");hw=u,gw=d,pw=o,u+=122192928e5;var m=((u&268435455)*1e4+d)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=m&255;var A=u/4294967296*1e4&268435455;i[n++]=A>>>8&255,i[n++]=A&255,i[n++]=A>>>24&15|16,i[n++]=A>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var v=0;v<6;++v)i[n+v]=s[v];return e||Xo(i)}var Fk,pw,hw,gw,Wk,jk=en(()=>{a();fw();yh();hw=0,gw=0;Wk=tZ});function rZ(t){if(!Zo(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var M1,mw=en(()=>{a();mh();M1=rZ});function nZ(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function N1(t,e,r){function n(i,s,o,c){if(typeof i=="string"&&(i=nZ(i)),typeof s=="string"&&(s=M1(s)),s.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+i.length);if(u.set(s),u.set(i,s.length),u=r(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,o){c=c||0;for(var d=0;d<16;++d)o[c+d]=u[d];return o}return Xo(u)}try{n.name=t}catch{}return n.DNS=iZ,n.URL=sZ,n}var iZ,sZ,yw=en(()=>{a();yh();mw();iZ="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sZ="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function oZ(t){if(typeof t=="string"){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)}return aZ(cZ(uZ(t),t.length*8))}function aZ(t){for(var e=[],r=t.length*32,n="0123456789abcdef",i=0;i<r;i+=8){var s=t[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(s&15),16);e.push(o)}return e}function Hk(t){return(t+64>>>9<<4)+14+1}function cZ(t,e){t[e>>5]|=128<<e%32,t[Hk(e)-1]=e;for(var r=1732584193,n=-271733879,i=-1732584194,s=271733878,o=0;o<t.length;o+=16){var c=r,u=n,d=i,f=s;r=nn(r,n,i,s,t[o],7,-680876936),s=nn(s,r,n,i,t[o+1],12,-389564586),i=nn(i,s,r,n,t[o+2],17,606105819),n=nn(n,i,s,r,t[o+3],22,-1044525330),r=nn(r,n,i,s,t[o+4],7,-176418897),s=nn(s,r,n,i,t[o+5],12,1200080426),i=nn(i,s,r,n,t[o+6],17,-1473231341),n=nn(n,i,s,r,t[o+7],22,-45705983),r=nn(r,n,i,s,t[o+8],7,1770035416),s=nn(s,r,n,i,t[o+9],12,-1958414417),i=nn(i,s,r,n,t[o+10],17,-42063),n=nn(n,i,s,r,t[o+11],22,-1990404162),r=nn(r,n,i,s,t[o+12],7,1804603682),s=nn(s,r,n,i,t[o+13],12,-40341101),i=nn(i,s,r,n,t[o+14],17,-1502002290),n=nn(n,i,s,r,t[o+15],22,1236535329),r=sn(r,n,i,s,t[o+1],5,-165796510),s=sn(s,r,n,i,t[o+6],9,-1069501632),i=sn(i,s,r,n,t[o+11],14,643717713),n=sn(n,i,s,r,t[o],20,-373897302),r=sn(r,n,i,s,t[o+5],5,-701558691),s=sn(s,r,n,i,t[o+10],9,38016083),i=sn(i,s,r,n,t[o+15],14,-660478335),n=sn(n,i,s,r,t[o+4],20,-405537848),r=sn(r,n,i,s,t[o+9],5,568446438),s=sn(s,r,n,i,t[o+14],9,-1019803690),i=sn(i,s,r,n,t[o+3],14,-187363961),n=sn(n,i,s,r,t[o+8],20,1163531501),r=sn(r,n,i,s,t[o+13],5,-1444681467),s=sn(s,r,n,i,t[o+2],9,-51403784),i=sn(i,s,r,n,t[o+7],14,1735328473),n=sn(n,i,s,r,t[o+12],20,-1926607734),r=on(r,n,i,s,t[o+5],4,-378558),s=on(s,r,n,i,t[o+8],11,-2022574463),i=on(i,s,r,n,t[o+11],16,1839030562),n=on(n,i,s,r,t[o+14],23,-35309556),r=on(r,n,i,s,t[o+1],4,-1530992060),s=on(s,r,n,i,t[o+4],11,1272893353),i=on(i,s,r,n,t[o+7],16,-155497632),n=on(n,i,s,r,t[o+10],23,-1094730640),r=on(r,n,i,s,t[o+13],4,681279174),s=on(s,r,n,i,t[o],11,-358537222),i=on(i,s,r,n,t[o+3],16,-722521979),n=on(n,i,s,r,t[o+6],23,76029189),r=on(r,n,i,s,t[o+9],4,-640364487),s=on(s,r,n,i,t[o+12],11,-421815835),i=on(i,s,r,n,t[o+15],16,530742520),n=on(n,i,s,r,t[o+2],23,-995338651),r=an(r,n,i,s,t[o],6,-198630844),s=an(s,r,n,i,t[o+7],10,1126891415),i=an(i,s,r,n,t[o+14],15,-1416354905),n=an(n,i,s,r,t[o+5],21,-57434055),r=an(r,n,i,s,t[o+12],6,1700485571),s=an(s,r,n,i,t[o+3],10,-1894986606),i=an(i,s,r,n,t[o+10],15,-1051523),n=an(n,i,s,r,t[o+1],21,-2054922799),r=an(r,n,i,s,t[o+8],6,1873313359),s=an(s,r,n,i,t[o+15],10,-30611744),i=an(i,s,r,n,t[o+6],15,-1560198380),n=an(n,i,s,r,t[o+13],21,1309151649),r=an(r,n,i,s,t[o+4],6,-145523070),s=an(s,r,n,i,t[o+11],10,-1120210379),i=an(i,s,r,n,t[o+2],15,718787259),n=an(n,i,s,r,t[o+9],21,-343485551),r=Yo(r,c),n=Yo(n,u),i=Yo(i,d),s=Yo(s,f)}return[r,n,i,s]}function uZ(t){if(t.length===0)return[];for(var e=t.length*8,r=new Uint32Array(Hk(e)),n=0;n<e;n+=8)r[n>>5]|=(t[n/8]&255)<<n%32;return r}function Yo(t,e){var r=(t&65535)+(e&65535),n=(t>>16)+(e>>16)+(r>>16);return n<<16|r&65535}function lZ(t,e){return t<<e|t>>>32-e}function L1(t,e,r,n,i,s){return Yo(lZ(Yo(Yo(e,t),Yo(n,s)),i),r)}function nn(t,e,r,n,i,s,o){return L1(e&r|~e&n,t,e,i,s,o)}function sn(t,e,r,n,i,s,o){return L1(e&n|r&~n,t,e,i,s,o)}function on(t,e,r,n,i,s,o){return L1(e^r^n,t,e,i,s,o)}function an(t,e,r,n,i,s,o){return L1(r^(e|~n),t,e,i,s,o)}var Gk,$k=en(()=>{a();Gk=oZ});var dZ,Zk,Xk=en(()=>{a();yw();$k();dZ=N1("v3",48,Gk),Zk=dZ});function fZ(t,e,r){t=t||{};var n=t.random||(t.rng||gh)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Xo(n)}var Yk,Jk=en(()=>{a();fw();yh();Yk=fZ});function pZ(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function bw(t,e){return t<<e|t>>>32-e}function hZ(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var s=t.length/4+2,o=Math.ceil(s/16),c=new Array(o),u=0;u<o;++u){for(var d=new Uint32Array(16),f=0;f<16;++f)d[f]=t[u*64+f*4]<<24|t[u*64+f*4+1]<<16|t[u*64+f*4+2]<<8|t[u*64+f*4+3];c[u]=d}c[o-1][14]=(t.length-1)*8/Math.pow(2,32),c[o-1][14]=Math.floor(c[o-1][14]),c[o-1][15]=(t.length-1)*8&4294967295;for(var m=0;m<o;++m){for(var A=new Uint32Array(80),v=0;v<16;++v)A[v]=c[m][v];for(var P=16;P<80;++P)A[P]=bw(A[P-3]^A[P-8]^A[P-14]^A[P-16],1);for(var T=r[0],k=r[1],B=r[2],D=r[3],L=r[4],F=0;F<80;++F){var ee=Math.floor(F/20),j=bw(T,5)+pZ(ee,k,B,D)+L+e[ee]+A[F]>>>0;L=D,D=B,B=bw(k,30)>>>0,k=T,T=j}r[0]=r[0]+T>>>0,r[1]=r[1]+k>>>0,r[2]=r[2]+B>>>0,r[3]=r[3]+D>>>0,r[4]=r[4]+L>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Qk,eC=en(()=>{a();Qk=hZ});var gZ,tC,rC=en(()=>{a();yw();eC();gZ=N1("v5",80,Qk),tC=gZ});var nC,iC=en(()=>{a();nC="00000000-0000-0000-0000-000000000000"});function mZ(t){if(!Zo(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}var sC,oC=en(()=>{a();mh();sC=mZ});var Aw={};WW(Aw,{NIL:()=>nC,parse:()=>M1,stringify:()=>Xo,v1:()=>Wk,v3:()=>Zk,v4:()=>Yk,v5:()=>tC,validate:()=>Zo,version:()=>sC});var _w=en(()=>{a();jk();Xk();Jk();rC();iC();oC();mh();yh();mw()});var cC=_((TBe,aC)=>{"use strict";a();var yZ=(_w(),NB(Aw)).v4,bZ=function(t,e,r,n){if(typeof t!="string")throw new TypeError(t+" must be a string");n=n||{};let i=typeof n.version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");let s={method:t};if(i===2&&(s.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");s.params=e}if(typeof r>"u"){let o=typeof n.generator=="function"?n.generator:function(){return yZ()};s.id=o(s,n)}else i===2&&r===null?n.notificationIdNull&&(s.id=null):s.id=r;return s};aC.exports=bZ});var lC=_((zBe,uC)=>{"use strict";a();var AZ=(_w(),NB(Aw)).v4,_Z=cC(),bh=function(t,e){if(!(this instanceof bh))return new bh(t,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return AZ()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=t};uC.exports=bh;bh.prototype.request=function(t,e,r,n){let i=this,s=null,o=Array.isArray(t)&&typeof e=="function";if(this.options.version===1&&o)throw new TypeError("JSON-RPC 1.0 does not support batching");if(o||!o&&t&&typeof t=="object"&&typeof e=="function")n=e,s=t;else{typeof r=="function"&&(n=r,r=void 0);let d=typeof n=="function";try{s=_Z(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(f){if(d){n(f);return}throw f}if(!d)return s}let u;try{u=JSON.stringify(s,this.options.replacer)}catch(d){n(d);return}return this.callServer(u,function(d,f){i._parseResponse(d,f,n)}),s};bh.prototype._parseResponse=function(t,e,r){if(t){r(t);return}if(!e){r();return}let n;try{n=JSON.parse(e,this.options.reviver)}catch(i){r(i);return}if(r.length===3)if(Array.isArray(n)){let i=function(o){return typeof o.error<"u"},s=function(o){return!i(o)};r(null,n.filter(i),n.filter(s));return}else{r(null,n.error,n.result);return}r(null,n)}});var fC=_((CBe,Sw)=>{"use strict";a();var SZ=Object.prototype.hasOwnProperty,_n="~";function Ah(){}Object.create&&(Ah.prototype=Object.create(null),new Ah().__proto__||(_n=!1));function vZ(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function dC(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new vZ(r,n||t,i),o=_n?_n+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],s]:t._events[o].push(s):(t._events[o]=s,t._eventsCount++),t}function D1(t,e){--t._eventsCount===0?t._events=new Ah:delete t._events[e]}function cn(){this._events=new Ah,this._eventsCount=0}cn.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)SZ.call(r,n)&&e.push(_n?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};cn.prototype.listeners=function(e){var r=_n?_n+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};cn.prototype.listenerCount=function(e){var r=_n?_n+e:e,n=this._events[r];return n?n.fn?1:n.length:0};cn.prototype.emit=function(e,r,n,i,s,o){var c=_n?_n+e:e;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,f,m;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,i),!0;case 5:return u.fn.call(u.context,r,n,i,s),!0;case 6:return u.fn.call(u.context,r,n,i,s,o),!0}for(m=1,f=new Array(d-1);m<d;m++)f[m-1]=arguments[m];u.fn.apply(u.context,f)}else{var A=u.length,v;for(m=0;m<A;m++)switch(u[m].once&&this.removeListener(e,u[m].fn,void 0,!0),d){case 1:u[m].fn.call(u[m].context);break;case 2:u[m].fn.call(u[m].context,r);break;case 3:u[m].fn.call(u[m].context,r,n);break;case 4:u[m].fn.call(u[m].context,r,n,i);break;default:if(!f)for(v=1,f=new Array(d-1);v<d;v++)f[v-1]=arguments[v];u[m].fn.apply(u[m].context,f)}}return!0};cn.prototype.on=function(e,r,n){return dC(this,e,r,n,!1)};cn.prototype.once=function(e,r,n){return dC(this,e,r,n,!0)};cn.prototype.removeListener=function(e,r,n,i){var s=_n?_n+e:e;if(!this._events[s])return this;if(!r)return D1(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&D1(this,s);else{for(var c=0,u=[],d=o.length;c<d;c++)(o[c].fn!==r||i&&!o[c].once||n&&o[c].context!==n)&&u.push(o[c]);u.length?this._events[s]=u.length===1?u[0]:u:D1(this,s)}return this};cn.prototype.removeAllListeners=function(e){var r;return e?(r=_n?_n+e:e,this._events[r]&&D1(this,r)):(this._events=new Ah,this._eventsCount=0),this};cn.prototype.off=cn.prototype.removeListener;cn.prototype.addListener=cn.prototype.on;cn.prefixed=_n;cn.EventEmitter=cn;typeof Sw<"u"&&(Sw.exports=cn)});var ub=_($c=>{"use strict";a();Object.defineProperty($c,"__esModule",{value:!0});var hJ=t=>({__option:"Some",value:t}),gJ=()=>({__option:"None"}),mJ=t=>t&&typeof t=="object"&&"__option"in t&&(t.__option==="Some"&&"value"in t||t.__option==="None"),yJ=t=>t.__option==="Some",bJ=t=>t.__option==="None";$c.isNone=bJ;$c.isOption=mJ;$c.isSome=yJ;$c.none=gJ;$c.some=hJ});var XM=_(Xc=>{"use strict";a();Object.defineProperty(Xc,"__esModule",{value:!0});var Zc=ub();function AJ(t,e){return Zc.isSome(t)?t.value:e?e():null}var _J=t=>t!==null?Zc.some(t):Zc.none(),SJ=t=>t!=null?Zc.some(t):Zc.none(),vJ=t=>Zc.isSome(t)?t.value:null,EJ=(t,e)=>Zc.isSome(t)?t.value:e();Xc.unwrapOption=AJ;Xc.unwrapSome=vJ;Xc.unwrapSomeOrElse=EJ;Xc.wrapNullable=_J;Xc.wrapNullish=SJ});var JM=_(Mx=>{"use strict";a();Object.defineProperty(Mx,"__esModule",{value:!0});var YM=ub();function Cx(t,e){if(!t||ArrayBuffer.isView(t))return t;let r=n=>e?Cx(n,e):Cx(n);return YM.isOption(t)?YM.isSome(t)?r(t.value):e?e():null:Array.isArray(t)?t.map(r):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([n,i])=>[n,r(i)])):t}Mx.unwrapOptionRecursively=Cx});var Nx=_(Jn=>{"use strict";a();Object.defineProperty(Jn,"__esModule",{value:!0});var Mh=ub(),Nh=XM(),wJ=JM();Jn.isNone=Mh.isNone;Jn.isOption=Mh.isOption;Jn.isSome=Mh.isSome;Jn.none=Mh.none;Jn.some=Mh.some;Jn.unwrapOption=Nh.unwrapOption;Jn.unwrapSome=Nh.unwrapSome;Jn.unwrapSomeOrElse=Nh.unwrapSomeOrElse;Jn.wrapNullable=Nh.wrapNullable;Jn.wrapNullish=Nh.wrapNullish;Jn.unwrapOptionRecursively=wJ.unwrapOptionRecursively});var Lh=_(Dx=>{"use strict";a();Object.defineProperty(Dx,"__esModule",{value:!0});var Lx=class extends Error{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i),this.cause=n}};Dx.InvalidBaseStringError=Lx});var lb=_(qx=>{"use strict";a();Object.defineProperty(qx,"__esModule",{value:!0});var xJ=Lh(),IJ=t=>{let e=t.length,r=BigInt(e);return{description:`base${e}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${t}]*$`)))throw new xJ.InvalidBaseStringError(n,e);if(n==="")return new Uint8Array;let i=[...n],s=i.findIndex(m=>m!==t[0]);s=s===-1?i.length:s;let o=Array(s).fill(0);if(s===i.length)return Uint8Array.from(o);let c=i.slice(s),u=0n,d=1n;for(let m=c.length-1;m>=0;m-=1)u+=d*BigInt(t.indexOf(c[m])),d*=r;let f=[];for(;u>0n;)f.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(o.concat(f))},deserialize(n,i=0){if(n.length===0)return["",0];let s=n.slice(i),o=s.findIndex(f=>f!==0);o=o===-1?s.length:o;let c=t[0].repeat(o);if(o===s.length)return[c,n.length];let u=s.slice(o).reduce((f,m)=>f*256n+BigInt(m),0n),d=[];for(;u>0n;)d.unshift(t[Number(u%r)]),u/=r;return[c+d.join(""),n.length]}}};qx.baseX=IJ});var QM=_(Ux=>{"use strict";a();Object.defineProperty(Ux,"__esModule",{value:!0});var PJ=lb(),RJ=PJ.baseX("0123456789");Ux.base10=RJ});var eN=_(Vx=>{"use strict";a();Object.defineProperty(Vx,"__esModule",{value:!0});var OJ=Lh(),TJ={description:"base16",fixedSize:null,maxSize:null,serialize(t){let e=t.toLowerCase();if(!e.match(/^[0123456789abcdef]*$/))throw new OJ.InvalidBaseStringError(t,16);let r=e.match(/.{1,2}/g);return Uint8Array.from(r?r.map(n=>parseInt(n,16)):[])},deserialize(t,e=0){return[t.slice(e).reduce((n,i)=>n+i.toString(16).padStart(2,"0"),""),t.length]}};Vx.base16=TJ});var tN=_(Kx=>{"use strict";a();Object.defineProperty(Kx,"__esModule",{value:!0});var BJ=lb(),zJ=BJ.baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Kx.base58=zJ});var db=_(Dh=>{"use strict";a();Object.defineProperty(Dh,"__esModule",{value:!0});var kJ=t=>{let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r},rN=(t,e)=>{if(t.length>=e)return t;let r=new Uint8Array(e).fill(0);return r.set(t),r},CJ=(t,e)=>rN(t.slice(0,e),e);Dh.fixBytes=CJ;Dh.mergeBytes=kJ;Dh.padBytes=rN});var fb=_(qh=>{"use strict";a();Object.defineProperty(qh,"__esModule",{value:!0});var Fx=class extends Error{name="DeserializingEmptyBufferError";constructor(e){super(`Serializer [${e}] cannot deserialize empty buffers.`)}},Wx=class extends Error{name="NotEnoughBytesError";constructor(e,r,n){super(`Serializer [${e}] expected ${r} bytes, got ${n}.`)}},jx=class extends Error{name="ExpectedFixedSizeSerializerError";constructor(e){e??="Expected a fixed-size serializer, got a variable-size one.",super(e)}};qh.DeserializingEmptyBufferError=Fx;qh.ExpectedFixedSizeSerializerError=jx;qh.NotEnoughBytesError=Wx});var iN=_(Hx=>{"use strict";a();Object.defineProperty(Hx,"__esModule",{value:!0});var nN=db(),MJ=fb();function NJ(t,e,r){return{description:r??`fixed(${e}, ${t.description})`,fixedSize:e,maxSize:e,serialize:n=>nN.fixBytes(t.serialize(n),e),deserialize:(n,i=0)=>{if(n=n.slice(i,i+e),n.length<e)throw new MJ.NotEnoughBytesError("fixSerializer",e,n.length);t.fixedSize!==null&&(n=nN.fixBytes(n,t.fixedSize));let[s]=t.deserialize(n,0);return[s,i+e]}}}Hx.fixSerializer=NJ});var sN=_(Gx=>{"use strict";a();Object.defineProperty(Gx,"__esModule",{value:!0});function LJ(t,e,r){return{description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize,serialize:n=>t.serialize(e(n)),deserialize:(n,i=0)=>{let[s,o]=t.deserialize(n,i);return r?[r(s,n,i),o]:[s,o]}}}Gx.mapSerializer=LJ});var oN=_($x=>{"use strict";a();Object.defineProperty($x,"__esModule",{value:!0});var DJ=db(),qJ=fb();function UJ(t){if(t.fixedSize===null)throw new qJ.ExpectedFixedSizeSerializerError("Cannot reverse a serializer of variable size.");return{...t,serialize:e=>t.serialize(e).reverse(),deserialize:(e,r=0)=>{let n=t.fixedSize,i=DJ.mergeBytes([e.slice(0,r),e.slice(r,r+n).reverse(),e.slice(r+n)]);return t.deserialize(i,r)}}}$x.reverseSerializer=UJ});var zr=_(Qi=>{"use strict";a();Object.defineProperty(Qi,"__esModule",{value:!0});var Zx=db(),Xx=fb(),VJ=iN(),KJ=sN(),FJ=oN();Qi.fixBytes=Zx.fixBytes;Qi.mergeBytes=Zx.mergeBytes;Qi.padBytes=Zx.padBytes;Qi.DeserializingEmptyBufferError=Xx.DeserializingEmptyBufferError;Qi.ExpectedFixedSizeSerializerError=Xx.ExpectedFixedSizeSerializerError;Qi.NotEnoughBytesError=Xx.NotEnoughBytesError;Qi.fixSerializer=VJ.fixSerializer;Qi.mapSerializer=KJ.mapSerializer;Qi.reverseSerializer=FJ.reverseSerializer});var Jx=_(Yx=>{"use strict";a();Object.defineProperty(Yx,"__esModule",{value:!0});var WJ=Lh(),jJ=(t,e)=>{let r=t.length,n=(i,s,o,c)=>{let u=[],d=0,f=0,m=(1<<o)-1;for(let A of i)for(d=d<<s|A,f+=s;f>=o;)f-=o,u.push(d>>f&m);return c&&f>0&&u.push(d<<o-f&m),u};return{description:`base${r}`,fixedSize:null,maxSize:null,serialize(i){if(!i.match(new RegExp(`^[${t}]*$`)))throw new WJ.InvalidBaseStringError(i,r);if(i==="")return new Uint8Array;let s=[...i].map(c=>t.indexOf(c)),o=n(s,e,8,!1);return Uint8Array.from(o)},deserialize(i,s=0){if(i.length===0)return["",0];let o=[...i.slice(s)];return[n(o,8,e,!0).map(u=>t[u]).join(""),i.length]}}};Yx.baseXReslice=jJ});var aN=_(Qx=>{"use strict";a();Object.defineProperty(Qx,"__esModule",{value:!0});var HJ=zr(),GJ=Jx(),$J=HJ.mapSerializer(GJ.baseXReslice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",6),t=>t.replace(/=/g,""),t=>t.padEnd(Math.ceil(t.length/4)*4,"="));Qx.base64=$J});var eI=_(pb=>{"use strict";a();Object.defineProperty(pb,"__esModule",{value:!0});var ZJ=t=>t.replace(/\u0000/g,""),XJ=(t,e)=>t.padEnd(e,"\0");pb.padNullCharacters=XJ;pb.removeNullCharacters=ZJ});var cN=_(tI=>{"use strict";a();Object.defineProperty(tI,"__esModule",{value:!0});var YJ=eI(),JJ={description:"utf8",fixedSize:null,maxSize:null,serialize(t){return new TextEncoder().encode(t)},deserialize(t,e=0){let r=new TextDecoder().decode(t.slice(e));return[YJ.removeNullCharacters(r),t.length]}};tI.utf8=JJ});var hb=_(di=>{"use strict";a();Object.defineProperty(di,"__esModule",{value:!0});var QJ=QM(),eQ=eN(),tQ=tN(),rQ=aN(),nQ=lb(),iQ=Jx(),sQ=Lh(),uN=eI(),oQ=cN();di.base10=QJ.base10;di.base16=eQ.base16;di.base58=tQ.base58;di.base64=rQ.base64;di.baseX=nQ.baseX;di.baseXReslice=iQ.baseXReslice;di.InvalidBaseStringError=sQ.InvalidBaseStringError;di.padNullCharacters=uN.padNullCharacters;di.removeNullCharacters=uN.removeNullCharacters;di.utf8=oQ.utf8});var iI=_(nI=>{"use strict";a();Object.defineProperty(nI,"__esModule",{value:!0});var rI=class extends Error{name="InvalidPublicKeyError";constructor(e,r){r=r?`. ${r}`:"",super(`The provided public key is invalid: ${e}${r}`),this.invalidPublicKey=e}};nI.InvalidPublicKeyError=rI});var pN=_(fi=>{"use strict";a();Object.defineProperty(fi,"__esModule",{value:!0});var lN=hb(),gb=iI(),sI=32;function mb(t,e=!0){let r=typeof t=="string"?t:typeof t=="object"&&"publicKey"in t?t.publicKey:typeof t=="object"&&"toBase58"in t?t.toBase58():Array.isArray(t)?t[0]:lN.base58.deserialize(t)[0];return e&&oI(r),r}var aQ=()=>"11111111111111111111111111111111",dN=t=>{try{return oI(t),!0}catch{return!1}},cQ=t=>Array.isArray(t)&&t.length===2&&typeof t[1]=="number"&&dN(t[0]);function oI(t){if(typeof t!="string")throw new gb.InvalidPublicKeyError(t,"Public keys must be strings.");fN(t)}var uQ=t=>[...new Set(t)],fN=t=>{if(t.length<32||t.length>44)throw new gb.InvalidPublicKeyError(t,"Public keys must be between 32 and 44 characters.");let e;try{e=lN.base58.serialize(t)}catch{throw new gb.InvalidPublicKeyError(t,"Public keys must be base58 encoded.")}if(e.length!==sI)throw new gb.InvalidPublicKeyError(t,`Public keys must be ${sI} bytes.`);return e},lQ=t=>mb(t),dQ=(t,e)=>mb(t)===mb(e);fi.PUBLIC_KEY_LENGTH=sI;fi.assertPublicKey=oI;fi.base58PublicKey=lQ;fi.defaultPublicKey=aQ;fi.isPda=cQ;fi.isPublicKey=dN;fi.publicKey=mb;fi.publicKeyBytes=fN;fi.samePublicKey=dQ;fi.uniquePublicKeys=uQ});var yb=_(Qn=>{"use strict";a();Object.defineProperty(Qn,"__esModule",{value:!0});var bs=pN(),fQ=iI();Qn.PUBLIC_KEY_LENGTH=bs.PUBLIC_KEY_LENGTH;Qn.assertPublicKey=bs.assertPublicKey;Qn.base58PublicKey=bs.base58PublicKey;Qn.defaultPublicKey=bs.defaultPublicKey;Qn.isPda=bs.isPda;Qn.isPublicKey=bs.isPublicKey;Qn.publicKey=bs.publicKey;Qn.publicKeyBytes=bs.publicKeyBytes;Qn.samePublicKey=bs.samePublicKey;Qn.uniquePublicKeys=bs.uniquePublicKeys;Qn.InvalidPublicKeyError=fQ.InvalidPublicKeyError});var aI=_(Uh=>{"use strict";a();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.Endian=void 0;(function(t){t.Little="le",t.Big="be"})(Uh.Endian||(Uh.Endian={}))});var lI=_(uI=>{"use strict";a();Object.defineProperty(uI,"__esModule",{value:!0});var cI=class extends RangeError{name="NumberOutOfRangeError";constructor(e,r,n,i){super(`Serializer [${e}] expected number to be between ${r} and ${n}, got ${i}.`)}};uI.NumberOutOfRangeError=cI});var kn=_(Yc=>{"use strict";a();Object.defineProperty(Yc,"__esModule",{value:!0});var hN=zr(),pQ=aI(),hQ=lI();function gQ(t){let e,r=t.name;return t.size>1&&(e=!("endian"in t.options)||t.options.endian===pQ.Endian.Little,r+=e?"(le)":"(be)"),{description:t.options.description??r,fixedSize:t.size,maxSize:t.size,serialize(n){t.range&&yN(t.name,t.range[0],t.range[1],n);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),n,e),new Uint8Array(i)},deserialize(n,i=0){let s=n.slice(i,i+t.size);bN("i8",s,t.size);let o=mN(s);return[t.get(o,e),i+t.size]}}}var gN=t=>t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset),mN=t=>new DataView(gN(t)),yN=(t,e,r,n)=>{if(n<e||n>r)throw new hQ.NumberOutOfRangeError(t,e,r,n)},bN=(t,e,r)=>{if(e.length===0)throw new hN.DeserializingEmptyBufferError(t);if(e.length<r)throw new hN.NotEnoughBytesError(t,r,e.length)};Yc.assertEnoughBytes=bN;Yc.assertRange=yN;Yc.numberFactory=gQ;Yc.toArrayBuffer=gN;Yc.toDataView=mN});var AN=_(dI=>{"use strict";a();Object.defineProperty(dI,"__esModule",{value:!0});var mQ=kn(),yQ=(t={})=>mQ.numberFactory({name:"f32",size:4,set:(e,r,n)=>e.setFloat32(0,Number(r),n),get:(e,r)=>e.getFloat32(0,r),options:t});dI.f32=yQ});var _N=_(fI=>{"use strict";a();Object.defineProperty(fI,"__esModule",{value:!0});var bQ=kn(),AQ=(t={})=>bQ.numberFactory({name:"f64",size:8,set:(e,r,n)=>e.setFloat64(0,Number(r),n),get:(e,r)=>e.getFloat64(0,r),options:t});fI.f64=AQ});var SN=_(pI=>{"use strict";a();Object.defineProperty(pI,"__esModule",{value:!0});var _Q=kn(),SQ=(t={})=>_Q.numberFactory({name:"i8",size:1,range:[-+"0x7f"-1,+"0x7f"],set:(e,r)=>e.setInt8(0,Number(r)),get:e=>e.getInt8(0),options:t});pI.i8=SQ});var vN=_(hI=>{"use strict";a();Object.defineProperty(hI,"__esModule",{value:!0});var vQ=kn(),EQ=(t={})=>vQ.numberFactory({name:"i16",size:2,range:[-+"0x7fff"-1,+"0x7fff"],set:(e,r,n)=>e.setInt16(0,Number(r),n),get:(e,r)=>e.getInt16(0,r),options:t});hI.i16=EQ});var EN=_(gI=>{"use strict";a();Object.defineProperty(gI,"__esModule",{value:!0});var wQ=kn(),xQ=(t={})=>wQ.numberFactory({name:"i32",size:4,range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(e,r,n)=>e.setInt32(0,Number(r),n),get:(e,r)=>e.getInt32(0,r),options:t});gI.i32=xQ});var wN=_(mI=>{"use strict";a();Object.defineProperty(mI,"__esModule",{value:!0});var IQ=kn(),PQ=(t={})=>IQ.numberFactory({name:"i64",size:8,range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(e,r,n)=>e.setBigInt64(0,BigInt(r),n),get:(e,r)=>e.getBigInt64(0,r),options:t});mI.i64=PQ});var xN=_(yI=>{"use strict";a();Object.defineProperty(yI,"__esModule",{value:!0});var RQ=kn(),OQ=(t={})=>RQ.numberFactory({name:"i128",size:16,range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigInt64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigInt64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});yI.i128=OQ});var IN=_(bI=>{"use strict";a();Object.defineProperty(bI,"__esModule",{value:!0});var TQ=kn(),BQ=(t={})=>TQ.numberFactory({name:"u8",size:1,range:[0,+"0xff"],set:(e,r)=>e.setUint8(0,Number(r)),get:e=>e.getUint8(0),options:t});bI.u8=BQ});var PN=_(AI=>{"use strict";a();Object.defineProperty(AI,"__esModule",{value:!0});var zQ=kn(),kQ=(t={})=>zQ.numberFactory({name:"u16",size:2,range:[0,+"0xffff"],set:(e,r,n)=>e.setUint16(0,Number(r),n),get:(e,r)=>e.getUint16(0,r),options:t});AI.u16=kQ});var RN=_(_I=>{"use strict";a();Object.defineProperty(_I,"__esModule",{value:!0});var CQ=kn(),MQ=(t={})=>CQ.numberFactory({name:"u32",size:4,range:[0,+"0xffffffff"],set:(e,r,n)=>e.setUint32(0,Number(r),n),get:(e,r)=>e.getUint32(0,r),options:t});_I.u32=MQ});var ON=_(SI=>{"use strict";a();Object.defineProperty(SI,"__esModule",{value:!0});var NQ=kn(),LQ=(t={})=>NQ.numberFactory({name:"u64",size:8,range:[0,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),get:(e,r)=>e.getBigUint64(0,r),options:t});SI.u64=LQ});var TN=_(vI=>{"use strict";a();Object.defineProperty(vI,"__esModule",{value:!0});var DQ=kn(),qQ=(t={})=>DQ.numberFactory({name:"u128",size:16,range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigUint64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigUint64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});vI.u128=qQ});var BN=_(EI=>{"use strict";a();Object.defineProperty(EI,"__esModule",{value:!0});var UQ=kn(),VQ=(t={})=>({description:t.description??"shortU16",fixedSize:null,maxSize:3,serialize:e=>{UQ.assertRange("shortU16",0,65535,e);let r=[0];for(let n=0;;n+=1){let i=e>>n*7;if(i===0)break;let s=127&i;r[n]=s,n>0&&(r[n-1]|=128)}return new Uint8Array(r)},deserialize:(e,r=0)=>{let n=0,i=0;for(;++i;){let s=i-1,o=e[r+s],c=127&o;if(n|=c<<s*7,(o&128)===0)break}return[n,r+i]}});EI.shortU16=VQ});var es=_($r=>{"use strict";a();Object.defineProperty($r,"__esModule",{value:!0});var KQ=aI(),FQ=lI(),WQ=AN(),jQ=_N(),HQ=SN(),GQ=vN(),$Q=EN(),ZQ=wN(),XQ=xN(),YQ=IN(),JQ=PN(),QQ=RN(),eee=ON(),tee=TN(),ree=BN();Object.defineProperty($r,"Endian",{enumerable:!0,get:function(){return KQ.Endian}});$r.NumberOutOfRangeError=FQ.NumberOutOfRangeError;$r.f32=WQ.f32;$r.f64=jQ.f64;$r.i8=HQ.i8;$r.i16=GQ.i16;$r.i32=$Q.i32;$r.i64=ZQ.i64;$r.i128=XQ.i128;$r.u8=YQ.u8;$r.u16=JQ.u16;$r.u32=QQ.u32;$r.u64=eee.u64;$r.u128=tee.u128;$r.shortU16=ree.shortU16});var bo=_(oa=>{"use strict";a();Object.defineProperty(oa,"__esModule",{value:!0});var wI=class extends Error{name="InvalidNumberOfItemsError";constructor(e,r,n){super(`Expected [${e}] to have ${r} items, got ${n}.`)}},xI=class extends Error{name="InvalidArrayLikeRemainderSizeError";constructor(e,r){super(`The remainder of the buffer (${e} bytes) cannot be split into chunks of ${r} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${e} modulo ${r} should be equal to zero.`)}},II=class extends Error{name="UnrecognizedArrayLikeSerializerSizeError";constructor(e){super(`Unrecognized array-like serializer size: ${JSON.stringify(e)}`)}},PI=class extends Error{name="InvalidDataEnumVariantError";constructor(e,r){super(`Invalid data enum variant. Expected one of [${r.join(", ")}], got "${e}".`)}},RI=class extends Error{name="InvalidScalarEnumVariantError";constructor(e,r,n,i){super(`Invalid scalar enum variant. Expected one of [${r.join(", ")}] or a number between ${n} and ${i}, got "${e}".`)}},OI=class extends RangeError{name="EnumDiscriminatorOutOfRangeError";constructor(e,r,n){super(`Enum discriminator out of range. Expected a number between ${r} and ${n}, got ${e}.`)}};oa.EnumDiscriminatorOutOfRangeError=OI;oa.InvalidArrayLikeRemainderSizeError=xI;oa.InvalidDataEnumVariantError=PI;oa.InvalidNumberOfItemsError=wI;oa.InvalidScalarEnumVariantError=RI;oa.UnrecognizedArrayLikeSerializerSizeError=II});var aa=_(TI=>{"use strict";a();Object.defineProperty(TI,"__esModule",{value:!0});function nee(t){return t.reduce((e,r)=>e===null||r===null?null:e+r,0)}TI.sumSerializerSizes=nee});var ca=_(Wl=>{"use strict";a();Object.defineProperty(Wl,"__esModule",{value:!0});var iee=bo(),see=aa();function oee(t,e,r){if(typeof t=="number")return[t,r];if(typeof t=="object")return t.deserialize(e,r);throw new iee.UnrecognizedArrayLikeSerializerSizeError(t)}function aee(t){return typeof t=="object"?t.description:`${t}`}function cee(t,e){if(typeof t!="number")return null;if(t===0)return 0;let r=see.sumSerializerSizes(e);return r===null?null:r*t}function uee(t,e){return typeof t=="object"?t.serialize(e):new Uint8Array}Wl.getResolvedSize=oee;Wl.getSizeDescription=aee;Wl.getSizeFromChildren=cee;Wl.getSizePrefix=uee});var zN=_(BI=>{"use strict";a();Object.defineProperty(BI,"__esModule",{value:!0});var lee=zr(),dee=es(),fee=bo(),Vh=ca();function pee(t,e={}){let r=e.size??dee.u32();return{description:e.description??`array(${t.description}; ${Vh.getSizeDescription(r)})`,fixedSize:Vh.getSizeFromChildren(r,[t.fixedSize]),maxSize:Vh.getSizeFromChildren(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.length!==r)throw new fee.InvalidNumberOfItemsError("array",r,n.length);return lee.mergeBytes([Vh.getSizePrefix(r,n.length),...n.map(i=>t.serialize(i))])},deserialize:(n,i=0)=>{let s=[];if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.push(u),i=d}return[s,i]}let[o,c]=Vh.getResolvedSize(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.push(d),i=f}return[s,i]}}}BI.array=pee});var kN=_(zI=>{"use strict";a();Object.defineProperty(zI,"__esModule",{value:!0});var hee=zr(),gee=(t,e={})=>{let r=typeof e=="boolean"?{backward:e}:e,n=r.backward??!1,i=n?"; backward":"";return{description:r.description??`bitArray(${t}${i})`,fixedSize:t,maxSize:t,serialize(s){let o=[];for(let c=0;c<t;c+=1){let u=0;for(let d=0;d<8;d+=1){let f=Number(s[c*8+d]??0);u|=f<<(n?d:7-d)}n?o.unshift(u):o.push(u)}return new Uint8Array(o)},deserialize(s,o=0){let c=[],u=s.slice(o,o+t);if(u=n?u.reverse():u,u.length!==t)throw new hee.NotEnoughBytesError("bitArray",t,u.length);return u.forEach(d=>{for(let f=0;f<8;f+=1)n?(c.push(!!(d&1)),d>>=1):(c.push(!!(d&128)),d<<=1)}),[c,o+t]}}};zI.bitArray=gee});var MN=_(kI=>{"use strict";a();Object.defineProperty(kI,"__esModule",{value:!0});var CN=zr(),mee=es();function yee(t={}){let e=t.size??mee.u8();if(e.fixedSize===null)throw new CN.ExpectedFixedSizeSerializerError("Serializer [bool] requires a fixed size.");return{description:t.description??`bool(${e.description})`,fixedSize:e.fixedSize,maxSize:e.fixedSize,serialize:r=>e.serialize(r?1:0),deserialize:(r,n=0)=>{if(r.slice(n).length===0)throw new CN.DeserializingEmptyBufferError("bool");let[i,s]=e.deserialize(r,n);return[i===1,s]}}}kI.bool=yee});var NN=_(CI=>{"use strict";a();Object.defineProperty(CI,"__esModule",{value:!0});var bb=zr(),bee=ca();function Aee(t={}){let e=t.size??"variable",r=t.description??`bytes(${bee.getSizeDescription(e)})`,n={description:r,fixedSize:null,maxSize:null,serialize:i=>new Uint8Array(i),deserialize:(i,s=0)=>{let o=i.slice(s);return[o,s+o.length]}};return e==="variable"?n:typeof e=="number"?bb.fixSerializer(n,e,r):{description:r,fixedSize:null,maxSize:null,serialize:i=>{let s=n.serialize(i),o=e.serialize(s.length);return bb.mergeBytes([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new bb.DeserializingEmptyBufferError("bytes");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new bb.NotEnoughBytesError("bytes",u,d.length);let[f,m]=n.deserialize(d);return s+=m,[f,s]}}}CI.bytes=Aee});var NI=_(MI=>{"use strict";a();Object.defineProperty(MI,"__esModule",{value:!0});function _ee(t){return t.reduce((e,r)=>e===null||r===null?null:Math.max(e,r),0)}MI.maxSerializerSizes=_ee});var UN=_(LI=>{"use strict";a();Object.defineProperty(LI,"__esModule",{value:!0});var LN=zr(),See=es(),DN=bo(),vee=NI(),qN=aa();function Eee(t,e={}){let r=e.size??See.u8(),n=t.map(([c,u])=>`${String(c)}${u?`: ${u.description}`:""}`).join(", "),s=t.every((c,u,d)=>c[1].fixedSize===d[0][1].fixedSize)?t[0][1].fixedSize:null,o=vee.maxSerializerSizes(t.map(([,c])=>c.maxSize));return{description:e.description??`dataEnum(${n}; ${r.description})`,fixedSize:t.length===0?r.fixedSize:qN.sumSerializerSizes([r.fixedSize,s]),maxSize:t.length===0?r.maxSize:qN.sumSerializerSizes([r.maxSize,o]),serialize:c=>{let u=t.findIndex(([A])=>c.__kind===A);if(u<0)throw new DN.InvalidDataEnumVariantError(c.__kind,t.map(([A])=>A));let d=r.serialize(u),m=t[u][1].serialize(c);return LN.mergeBytes([d,m])},deserialize:(c,u=0)=>{if(c.slice(u).length===0)throw new LN.DeserializingEmptyBufferError("dataEnum");let[d,f]=r.deserialize(c,u);u=f;let m=t[Number(d)]??null;if(!m)throw new DN.EnumDiscriminatorOutOfRangeError(d,0,t.length-1);let[A,v]=m[1].deserialize(c,u);return u=v,[{__kind:m[0],...A??{}},u]}}}LI.dataEnum=Eee});var KN=_(DI=>{"use strict";a();Object.defineProperty(DI,"__esModule",{value:!0});var VN=zr(),wee=es(),xee=bo(),Kh=ca();function Iee(t,e,r={}){let n=r.size??wee.u32();return{description:r.description??`map(${t.description}, ${e.description}; ${Kh.getSizeDescription(n)})`,fixedSize:Kh.getSizeFromChildren(n,[t.fixedSize,e.fixedSize]),maxSize:Kh.getSizeFromChildren(n,[t.maxSize,e.maxSize]),serialize:i=>{if(typeof n=="number"&&i.size!==n)throw new xee.InvalidNumberOfItemsError("map",n,i.size);let s=Array.from(i,([o,c])=>VN.mergeBytes([t.serialize(o),e.serialize(c)]));return VN.mergeBytes([Kh.getSizePrefix(n,i.size),...s])},deserialize:(i,s=0)=>{let o=new Map;if(typeof n=="object"&&i.slice(s).length===0)return[o,s];if(n==="remainder"){for(;s<i.length;){let[d,f]=t.deserialize(i,s);s=f;let[m,A]=e.deserialize(i,s);s=A,o.set(d,m)}return[o,s]}let[c,u]=Kh.getResolvedSize(n,i,s);s=u;for(let d=0;d<c;d+=1){let[f,m]=t.deserialize(i,s);s=m;let[A,v]=e.deserialize(i,s);s=v,o.set(f,A)}return[o,s]}}}DI.map=Iee});var FN=_(UI=>{"use strict";a();Object.defineProperty(UI,"__esModule",{value:!0});var qI=zr(),Pee=es(),Ree=aa(),Oee=ca();function Tee(t,e={}){let r=e.prefix??Pee.u8(),n=e.fixed??!1,i=`; ${Oee.getSizeDescription(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new qI.ExpectedFixedSizeSerializerError("Fixed nullables can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`nullable(${t.description+i})`,fixedSize:s,maxSize:Ree.sumSerializerSizes([r.maxSize,t.maxSize]),serialize:o=>{let c=r.serialize(+(o!==null));if(n){let d=t.fixedSize,f=o!==null?t.serialize(o).slice(0,d):new Uint8Array(d).fill(0);return qI.mergeBytes([c,f])}let u=o!==null?t.serialize(o):new Uint8Array;return qI.mergeBytes([c,u])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[null,c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[null,n?u:c];let[m,A]=t.deserialize(o,c);return c=A,[m,n?u:c]}}}UI.nullable=Tee});var WN=_(KI=>{"use strict";a();Object.defineProperty(KI,"__esModule",{value:!0});var ua=Nx(),VI=zr(),Bee=es(),zee=aa(),kee=ca();function Cee(t,e={}){let r=e.prefix??Bee.u8(),n=e.fixed??!1,i=`; ${kee.getSizeDescription(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new VI.ExpectedFixedSizeSerializerError("Fixed options can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`option(${t.description+i})`,fixedSize:s,maxSize:zee.sumSerializerSizes([r.maxSize,t.maxSize]),serialize:o=>{let c=ua.isOption(o)?o:ua.wrapNullable(o),u=r.serialize(Number(ua.isSome(c)));if(n){let f=t.fixedSize,m=ua.isSome(c)?t.serialize(c.value).slice(0,f):new Uint8Array(f).fill(0);return VI.mergeBytes([u,m])}let d=ua.isSome(c)?t.serialize(c.value):new Uint8Array;return VI.mergeBytes([u,d])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[ua.none(),c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[ua.none(),n?u:c];let[m,A]=t.deserialize(o,c);return c=A,[ua.some(m),n?u:c]}}}KI.option=Cee});var HN=_(FI=>{"use strict";a();Object.defineProperty(FI,"__esModule",{value:!0});var Fh=yb(),jN=zr();function Mee(t={}){return{description:t.description??"publicKey",fixedSize:32,maxSize:32,serialize:e=>Fh.publicKeyBytes(Fh.publicKey(e)),deserialize:(e,r=0)=>{let n=e.slice(r,r+32);if(n.length===0)throw new jN.DeserializingEmptyBufferError("publicKey");if(n.length<Fh.PUBLIC_KEY_LENGTH)throw new jN.NotEnoughBytesError("publicKey",Fh.PUBLIC_KEY_LENGTH,n.length);return[Fh.publicKey(n),r+32]}}}FI.publicKey=Mee});var $N=_(WI=>{"use strict";a();Object.defineProperty(WI,"__esModule",{value:!0});var Nee=zr(),Lee=es(),GN=bo();function Dee(t,e={}){let r=e.size??Lee.u8(),n=Object.keys(t),i=Object.values(t),s=i.some(m=>typeof m=="number"),o=i.filter(m=>typeof m=="string").join(", "),c=0,u=s?i.length/2-1:i.length-1,d=s?[...n]:[...new Set([...n,...i])];function f(m){let A=typeof m=="number"&&(m<c||m>u),v=typeof m=="string"&&!d.includes(m);if(A||v)throw new GN.InvalidScalarEnumVariantError(m,d,c,u)}return{description:e.description??`enum(${o}; ${r.description})`,fixedSize:r.fixedSize,maxSize:r.maxSize,serialize:m=>{if(f(m),typeof m=="number")return r.serialize(m);let A=i.indexOf(m);return A>=0?r.serialize(A):r.serialize(n.indexOf(m))},deserialize:(m,A=0)=>{if(m.slice(A).length===0)throw new Nee.DeserializingEmptyBufferError("enum");let[v,P]=r.deserialize(m,A),T=Number(v);if(A=P,T<c||T>u)throw new GN.EnumDiscriminatorOutOfRangeError(T,c,u);return[s?T:i[T],A]}}}WI.scalarEnum=Dee});var ZN=_(jI=>{"use strict";a();Object.defineProperty(jI,"__esModule",{value:!0});var qee=zr(),Uee=es(),Vee=bo(),Wh=ca();function Kee(t,e={}){let r=e.size??Uee.u32();return{description:e.description??`set(${t.description}; ${Wh.getSizeDescription(r)})`,fixedSize:Wh.getSizeFromChildren(r,[t.fixedSize]),maxSize:Wh.getSizeFromChildren(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.size!==r)throw new Vee.InvalidNumberOfItemsError("set",r,n.size);let i=Array.from(n,s=>t.serialize(s));return qee.mergeBytes([Wh.getSizePrefix(r,n.size),...i])},deserialize:(n,i=0)=>{let s=new Set;if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.add(u),i=d}return[s,i]}let[o,c]=Wh.getResolvedSize(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.add(d),i=f}return[s,i]}}}jI.set=Kee});var XN=_(HI=>{"use strict";a();Object.defineProperty(HI,"__esModule",{value:!0});var Ab=zr(),Fee=hb(),Wee=es(),jee=ca();function Hee(t={}){let e=t.size??Wee.u32(),r=t.encoding??Fee.utf8,n=t.description??`string(${r.description}; ${jee.getSizeDescription(e)})`;return e==="variable"?{...r,description:n}:typeof e=="number"?Ab.fixSerializer(r,e,n):{description:n,fixedSize:null,maxSize:null,serialize:i=>{let s=r.serialize(i),o=e.serialize(s.length);return Ab.mergeBytes([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Ab.DeserializingEmptyBufferError("string");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new Ab.NotEnoughBytesError("string",u,d.length);let[f,m]=r.deserialize(d);return s+=m,[f,s]}}}HI.string=Hee});var JN=_(GI=>{"use strict";a();Object.defineProperty(GI,"__esModule",{value:!0});var Gee=zr(),YN=aa();function $ee(t,e={}){let r=t.map(([n,i])=>`${String(n)}: ${i.description}`).join(", ");return{description:e.description??`struct(${r})`,fixedSize:YN.sumSerializerSizes(t.map(([,n])=>n.fixedSize)),maxSize:YN.sumSerializerSizes(t.map(([,n])=>n.maxSize)),serialize:n=>{let i=t.map(([s,o])=>o.serialize(n[s]));return Gee.mergeBytes(i)},deserialize:(n,i=0)=>{let s={};return t.forEach(([o,c])=>{let[u,d]=c.deserialize(n,i);i=d,s[o]=u}),[s,i]}}}GI.struct=$ee});var e2=_($I=>{"use strict";a();Object.defineProperty($I,"__esModule",{value:!0});var Zee=zr(),QN=aa(),Xee=bo();function Yee(t,e={}){let r=t.map(n=>n.description).join(", ");return{description:e.description??`tuple(${r})`,fixedSize:QN.sumSerializerSizes(t.map(n=>n.fixedSize)),maxSize:QN.sumSerializerSizes(t.map(n=>n.maxSize)),serialize:n=>{if(n.length!==t.length)throw new Xee.InvalidNumberOfItemsError("tuple",t.length,n.length);return Zee.mergeBytes(t.map((i,s)=>i.serialize(n[s])))},deserialize:(n,i=0)=>{let s=[];return t.forEach(o=>{let[c,u]=o.deserialize(n,i);s.push(c),i=u}),[s,i]}}}$I.tuple=Yee});var t2=_(ZI=>{"use strict";a();Object.defineProperty(ZI,"__esModule",{value:!0});function Jee(t={}){return{description:t.description??"unit",fixedSize:0,maxSize:0,serialize:()=>new Uint8Array,deserialize:(e,r=0)=>[void 0,r]}}ZI.unit=Jee});var Jc=_(He=>{"use strict";a();Object.defineProperty(He,"__esModule",{value:!0});var r2=zr(),n2=hb(),i2=es(),Qee=zN(),ete=kN(),tte=MN(),rte=NN(),nte=UN(),jl=bo(),ite=KN(),ste=FN(),ote=WN(),ate=HN(),cte=$N(),ute=ZN(),lte=XN(),dte=JN(),fte=e2(),pte=t2(),hte=NI(),gte=aa();He.array=Qee.array;He.bitArray=ete.bitArray;He.bool=tte.bool;He.bytes=rte.bytes;He.dataEnum=nte.dataEnum;He.EnumDiscriminatorOutOfRangeError=jl.EnumDiscriminatorOutOfRangeError;He.InvalidArrayLikeRemainderSizeError=jl.InvalidArrayLikeRemainderSizeError;He.InvalidDataEnumVariantError=jl.InvalidDataEnumVariantError;He.InvalidNumberOfItemsError=jl.InvalidNumberOfItemsError;He.InvalidScalarEnumVariantError=jl.InvalidScalarEnumVariantError;He.UnrecognizedArrayLikeSerializerSizeError=jl.UnrecognizedArrayLikeSerializerSizeError;He.map=ite.map;He.nullable=ste.nullable;He.option=ote.option;He.publicKey=ate.publicKey;He.scalarEnum=cte.scalarEnum;He.set=ute.set;He.string=lte.string;He.struct=dte.struct;He.tuple=fte.tuple;He.unit=pte.unit;He.maxSerializerSizes=hte.maxSerializerSizes;He.sumSerializerSizes=gte.sumSerializerSizes;Object.keys(r2).forEach(function(t){t!=="default"&&!He.hasOwnProperty(t)&&Object.defineProperty(He,t,{enumerable:!0,get:function(){return r2[t]}})});Object.keys(n2).forEach(function(t){t!=="default"&&!He.hasOwnProperty(t)&&Object.defineProperty(He,t,{enumerable:!0,get:function(){return n2[t]}})});Object.keys(i2).forEach(function(t){t!=="default"&&!He.hasOwnProperty(t)&&Object.defineProperty(He,t,{enumerable:!0,get:function(){return i2[t]}})})});var s2=_(kr=>{"use strict";a();Object.defineProperty(kr,"__esModule",{value:!0});var ln=Jc(),mte=ln.mapSerializer,yte=ln.fixSerializer,bte=ln.reverseSerializer,Ate=ln.mergeBytes,_te=ln.padBytes,Ste=ln.fixBytes,vte=ln.utf8,Ete=ln.baseX,wte=ln.base10,xte=ln.base58,Ite=ln.base64,Pte=ln.base16,Rte=ln.bitArray,Ote=ln.removeNullCharacters,Tte=ln.padNullCharacters,Bte=ln.Endian;kr.Endian=Bte;kr.base10=wte;kr.base16=Pte;kr.base58=xte;kr.base64=Ite;kr.baseX=Ete;kr.bitArray=Rte;kr.fixBytes=Ste;kr.fixSerializer=yte;kr.mapSerializer=mte;kr.mergeBytes=Ate;kr.padBytes=_te;kr.padNullCharacters=Tte;kr.removeNullCharacters=Ote;kr.reverseSerializer=bte;kr.utf8=vte});var _b=_(YI=>{"use strict";a();Object.defineProperty(YI,"__esModule",{value:!0});var XI=class extends Error{name="UmiError";constructor(e,r,n,i){super(e),this.source=r,this.sourceDetails=n,this.cause=i,this.message=`${this.message}
Source: ${this.getFullSource()}${this.cause?`
Caused By: ${this.cause}`:""}
-`}getCapitalizedSource(){return this.source==="sdk"||this.source==="rpc"?this.source.toUpperCase():this.source[0].toUpperCase()+this.source.slice(1)}getFullSource(){let e=this.getCapitalizedSource(),r=this.sourceDetails?` > ${this.sourceDetails}`:"";return e+r}toString(){return`[${this.name}] ${this.message}`}};wE.UmiError=EE});var Vi=S(IE=>{"use strict";a();Object.defineProperty(IE,"__esModule",{value:!0});var k9=Py(),xE=class extends k9.UmiError{name="SdkError";constructor(e,r){super(e,"sdk",void 0,r)}};IE.SdkError=xE});var OE=S(RE=>{"use strict";a();Object.defineProperty(RE,"__esModule",{value:!0});var C9=Vi(),PE=class extends C9.SdkError{name="UnexpectedAccountError";constructor(e,r,n){let i=`The account at the provided address [${e}] is not of the expected type [${r}].`;super(i,n)}};RE.UnexpectedAccountError=PE});var zE=S(TE=>{"use strict";a();Object.defineProperty(TE,"__esModule",{value:!0});var N9=Vi(),BE=class extends N9.SdkError{name="AccountNotFoundError";constructor(e,r,n){let i=`${r?`The account of type [${r}] was not found`:"No account was found"} at the provided address [${e}].${n?` ${n}`:""}`;super(i)}};TE.AccountNotFoundError=BE});var rk=S(Ff=>{"use strict";a();Object.defineProperty(Ff,"__esModule",{value:!0});var M9=OE(),L9=zE(),D9=128;function q9(t,e){let{data:r,publicKey:n,...i}=t;try{let[s]=e.deserialize(r);return{publicKey:n,header:i,...s}}catch(s){throw new M9.UnexpectedAccountError(n,e.description,s)}}function U9(t,e,r){if(!t.exists)throw new L9.AccountNotFoundError(t.publicKey,e,r)}Ff.ACCOUNT_HEADER_SIZE=D9;Ff.assertAccountExists=U9;Ff.deserializeAccount=q9});var Ry=S(kE=>{"use strict";a();Object.defineProperty(kE,"__esModule",{value:!0});var V9=t=>(t=typeof t=="object"?t.toString():t,BigInt(t));kE.createBigInt=V9});var ME=S(NE=>{"use strict";a();Object.defineProperty(NE,"__esModule",{value:!0});var F9=Vi(),CE=class extends F9.SdkError{name="UnexpectedAmountError";constructor(e,r,n){let i=`Expected amount of type [${r} with ${n} decimals] but got [${e.identifier} with ${e.decimals} decimals]. Ensure the provided Amount is of the expected type.`;super(i),this.amount=e,this.expectedIdentifier=r,this.expectedDecimals=n}};NE.UnexpectedAmountError=CE});var qE=S(DE=>{"use strict";a();Object.defineProperty(DE,"__esModule",{value:!0});var K9=Vi(),LE=class extends K9.SdkError{name="AmountMismatchError";constructor(e,r,n){let s=`The SDK tried to execute an operation${n?` [${n}]`:""} on two amounts of different types: [${e.identifier} with ${e.decimals} decimals] and [${r.identifier} with ${r.decimals} decimals]. Provide both amounts in the same type to perform this operation.`;super(s),this.left=e,this.right=r,this.operation=n}};DE.AmountMismatchError=LE});var uk=S(Ce=>{"use strict";a();Object.defineProperty(Ce,"__esModule",{value:!0});var W9=rc(),j9=Ry(),H9=ME(),G9=qE(),ju=(t,e,r)=>({basisPoints:j9.createBigInt(t),identifier:e,decimals:r}),Hu=(t,e,r)=>{let n=ju(BigInt(10)**BigInt(r??0),e,r);return ok(n,t)},$9=(t,e=2)=>Hu(t,"%",e),Z9=(t,e,r)=>Hu(t,e??"splToken",r??0),Y9=t=>ju(t,"SOL",9),X9=t=>Hu(t,"SOL",9),J9=t=>Hu(t,"USD",2),Q9=t=>ju(t,"uSOL",15),eZ=t=>Hu(t,"uSOL",15),Oy=(t,e,r)=>t.identifier===e&&t.decimals===r,tZ=t=>Oy(t,"SOL",9),nk=(t,e)=>Oy(t,e.identifier,e.decimals);function ik(t,e,r){if(!Oy(t,e,r))throw new H9.UnexpectedAmountError(t,e,r)}function rZ(t){ik(t,"SOL",9)}function Wu(t,e,r){if(!nk(t,e))throw new G9.AmountMismatchError(t,e,r)}var nZ=(t,e)=>(Wu(t,e,"add"),{...t,basisPoints:t.basisPoints+e.basisPoints}),sk=(t,e)=>(Wu(t,e,"subtract"),{...t,basisPoints:t.basisPoints-e.basisPoints}),ok=(t,e)=>{if(typeof e=="bigint")return{...t,basisPoints:t.basisPoints*e};let[r,n]=e.toString().split("."),i=BigInt(r+(n??"")),s=BigInt(10)**BigInt(n?.length??0);return{...t,basisPoints:t.basisPoints*i/s}},iZ=(t,e)=>{if(typeof e=="bigint")return{...t,basisPoints:t.basisPoints/e};let[r,n]=e.toString().split("."),i=BigInt(r+(n??"")),s=BigInt(10)**BigInt(n?.length??0);return{...t,basisPoints:t.basisPoints*s/i}},ak=t=>{let e=t.basisPoints;return{...t,basisPoints:e<0?-e:e}},Kf=(t,e)=>(Wu(t,e,"compare"),t.basisPoints>e.basisPoints?1:t.basisPoints<e.basisPoints?-1:0),sZ=(t,e,r)=>{r=r??ju(0,t.identifier,t.decimals),Wu(t,e,"isEqualToAmount"),Wu(t,r,"isEqualToAmount");let n=ak(sk(t,e));return ck(n,r)},oZ=(t,e)=>Kf(t,e)<0,ck=(t,e)=>Kf(t,e)<=0,aZ=(t,e)=>Kf(t,e)>0,cZ=(t,e)=>Kf(t,e)>=0,uZ=t=>t.basisPoints===BigInt(0),lZ=t=>t.basisPoints>=BigInt(0),dZ=t=>t.basisPoints<BigInt(0),UE=(t,e)=>{let r=t.basisPoints.toString();if(t.decimals===0)return r;let n=r.startsWith("-")?"-":"";r=r.replace("-",""),r=r.padStart(t.decimals+1,"0");let i=r.slice(0,-t.decimals),s=r.slice(-t.decimals);return e!==void 0&&(s=s.slice(0,e)),`${n+i}.${s}`},fZ=t=>parseFloat(UE(t)),hZ=(t,e)=>{let r=UE(t,e);switch(t.identifier){case"%":return`${r}%`;case"splToken":return/^1(\.0+)?$/.test(r)?`${r} Token`:`${r} Tokens`;default:if(t.identifier.startsWith("splToken.")){let[,n]=t.identifier.split(".");return`${n} ${r}`}return`${t.identifier} ${r}`}},pZ=(t,e,r)=>W9.mapSerializer(t,n=>n.basisPoints>Number.MAX_SAFE_INTEGER?n.basisPoints:Number(n.basisPoints),n=>ju(n,e,r));Ce.absoluteAmount=ak;Ce.addAmounts=nZ;Ce.amountToNumber=fZ;Ce.amountToString=UE;Ce.assertAmount=ik;Ce.assertSameAmounts=Wu;Ce.assertSolAmount=rZ;Ce.compareAmounts=Kf;Ce.createAmount=ju;Ce.createAmountFromDecimals=Hu;Ce.displayAmount=hZ;Ce.divideAmount=iZ;Ce.isAmount=Oy;Ce.isEqualToAmount=sZ;Ce.isGreaterThanAmount=aZ;Ce.isGreaterThanOrEqualToAmount=cZ;Ce.isLessThanAmount=oZ;Ce.isLessThanOrEqualToAmount=ck;Ce.isNegativeAmount=dZ;Ce.isPositiveAmount=lZ;Ce.isSolAmount=tZ;Ce.isZeroAmount=uZ;Ce.lamports=Y9;Ce.mapAmountSerializer=pZ;Ce.microLamports=Q9;Ce.microSol=eZ;Ce.multiplyAmount=ok;Ce.percentAmount=$9;Ce.sameAmounts=nk;Ce.sol=X9;Ce.subtractAmounts=sk;Ce.tokenAmount=Z9;Ce.usd=J9});var lk=S(VE=>{"use strict";a();Object.defineProperty(VE,"__esModule",{value:!0});var gZ=["api.mainnet-beta.solana.com","ssc-dao.genesysgo.net"],yZ=["api.devnet.solana.com","psytrbhymqlkfrhudd.dev.genesysgo.net"],mZ=["api.testnet.solana.com"],bZ=["localhost","127.0.0.1"],_Z=t=>{let e=new URL(t).hostname;return gZ.includes(e)?"mainnet-beta":yZ.includes(e)?"devnet":mZ.includes(e)?"testnet":bZ.includes(e)?"localnet":t.includes("mainnet")?"mainnet-beta":t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("local")?"localnet":"custom"};VE.resolveClusterFromEndpoint=_Z});var Fi=S(KE=>{"use strict";a();Object.defineProperty(KE,"__esModule",{value:!0});var AZ=Vi(),FE=class extends AZ.SdkError{name="InterfaceImplementationMissingError";constructor(e,r){let n=e.replace(/Interface$/,""),i=`Tried using ${e} but no implementation of that interface was found. Make sure an implementation is registered, e.g. via "context.${r} = new My${n}();".`;super(i)}};KE.InterfaceImplementationMissingError=FE});var jE=S(WE=>{"use strict";a();Object.defineProperty(WE,"__esModule",{value:!0});var SZ=Fi();function vZ(){let t=()=>{throw new SZ.InterfaceImplementationMissingError("DownloaderInterface","downloader")};return{download:t,downloadJson:t}}WE.createNullDownloader=vZ});var GE=S(HE=>{"use strict";a();Object.defineProperty(HE,"__esModule",{value:!0});var EZ=Fi();function wZ(){let t=()=>{throw new EZ.InterfaceImplementationMissingError("EddsaInterface","eddsa")};return{generateKeypair:t,createKeypairFromSecretKey:t,createKeypairFromSeed:t,isOnCurve:t,findPda:t,sign:t,verify:t}}HE.createNullEddsa=wZ});var ZE=S($E=>{"use strict";a();Object.defineProperty($E,"__esModule",{value:!0});var xZ=Fi();function IZ(){return{send:()=>{throw new xZ.InterfaceImplementationMissingError("HttpInterface","http")}}}$E.createNullHttp=IZ});var XE=S(YE=>{"use strict";a();Object.defineProperty(YE,"__esModule",{value:!0});var PZ=Fi();function RZ(){let t=()=>{throw new PZ.InterfaceImplementationMissingError("ProgramRepositoryInterface","programs")};return{has:t,get:t,getPublicKey:t,all:t,add:t,bind:t,unbind:t,clone:t,resolveError:t}}YE.createNullProgramRepository=RZ});var QE=S(JE=>{"use strict";a();Object.defineProperty(JE,"__esModule",{value:!0});var OZ=Fi();function BZ(){let t=()=>{throw new OZ.InterfaceImplementationMissingError("RpcInterface","rpc")};return{getEndpoint:t,getCluster:t,getAccount:t,getAccounts:t,getProgramAccounts:t,getBlockTime:t,getBalance:t,getRent:t,getSlot:t,getGenesisHash:t,getLatestBlockhash:t,getTransaction:t,getSignatureStatuses:t,accountExists:t,airdrop:t,call:t,sendTransaction:t,simulateTransaction:t,confirmTransaction:t}}JE.createNullRpc=BZ});var tw=S(ew=>{"use strict";a();Object.defineProperty(ew,"__esModule",{value:!0});var TZ=Fi();function zZ(){let t=()=>{throw new TZ.InterfaceImplementationMissingError("SerializerInterface","serializer")};return{tuple:t,array:t,map:t,set:t,option:t,nullable:t,struct:t,enum:t,dataEnum:t,string:t,bool:t,unit:t,u8:t,u16:t,u32:t,u64:t,u128:t,i8:t,i16:t,i32:t,i64:t,i128:t,f32:t,f64:t,bytes:t,publicKey:t}}ew.createNullSerializer=zZ});var By=S(Wf=>{"use strict";a();Object.defineProperty(Wf,"__esModule",{value:!0});var kZ=(t,e)=>t.reduce((r,n,i)=>{let s=Math.floor(i/e);return r[s]||(r[s]=[]),r[s].push(n),r},[]),CZ=(t,e,r)=>t.map((n,i)=>r(n,e?.[i]??null,i)),NZ=(t,e)=>t.reduce((r,n)=>(r.some(i=>e(n,i))||r.push(n),r),[]);Wf.chunk=kZ;Wf.uniqueBy=NZ;Wf.zipMap=CZ});var jf=S(wo=>{"use strict";a();Object.defineProperty(wo,"__esModule",{value:!0});var MZ=By(),LZ=async(t,e)=>e.reduce(async(r,n)=>{let i=await r;return n.signTransaction(i)},Promise.resolve(t)),DZ=async t=>{let e=t.map(n=>n.transaction);return t.reduce((n,{signers:i},s)=>(i.forEach(o=>{let c=n.find(u=>u.signer.publicKey===o.publicKey);c?c.indices.push(s):n.push({signer:o,indices:[s]})}),n),[]).reduce(async(n,{signer:i,indices:s})=>{let o=await n;if(s.length===1){let d=o[s[0]];return o[s[0]]=await i.signTransaction(d),o}let c=s.map(d=>o[d]),u=await i.signAllTransactions(c);return s.forEach((d,f)=>{o[d]=u[f]}),o},Promise.resolve(e))},qZ=t=>typeof t=="object"&&"publicKey"in t&&"signMessage"in t,UZ=t=>MZ.uniqueBy(t,(e,r)=>e.publicKey===r.publicKey),VZ=t=>({publicKey:t,async signMessage(e){return e},async signTransaction(e){return e},async signAllTransactions(e){return e}});function FZ(){let t=new Error("Trying to use a NullSigner. Did you forget to set a Signer on your Umi instance? See the `signerIdentity` method for more information."),e=()=>{throw t};return{get publicKey(){throw t},signMessage:e,signTransaction:e,signAllTransactions:e}}wo.createNoopSigner=VZ;wo.createNullSigner=FZ;wo.isSigner=qZ;wo.signAllTransactions=DZ;wo.signTransaction=LZ;wo.uniqueSigners=UZ});var nw=S(rw=>{"use strict";a();Object.defineProperty(rw,"__esModule",{value:!0});var KZ=Fi();function WZ(){let t=()=>{throw new KZ.InterfaceImplementationMissingError("TransactionFactoryInterface","transactions")};return{create:t,serialize:t,deserialize:t,serializeMessage:t,deserializeMessage:t}}rw.createNullTransactionFactory=WZ});var sw=S(iw=>{"use strict";a();Object.defineProperty(iw,"__esModule",{value:!0});var jZ=Fi();function HZ(){let t=()=>{throw new jZ.InterfaceImplementationMissingError("UploaderInterface","uploader")};return{upload:t,uploadJson:t,getUploadPrice:t}}iw.createNullUploader=HZ});var aw=S(ow=>{"use strict";a();Object.defineProperty(ow,"__esModule",{value:!0});var GZ=jE(),$Z=GE(),ZZ=ZE(),YZ=XE(),XZ=QE(),JZ=tw(),dk=jf(),QZ=nw(),eY=sw(),tY=()=>({downloader:GZ.createNullDownloader(),eddsa:$Z.createNullEddsa(),http:ZZ.createNullHttp(),identity:dk.createNullSigner(),payer:dk.createNullSigner(),programs:YZ.createNullProgramRepository(),rpc:XZ.createNullRpc(),serializer:JZ.createNullSerializer(),transactions:QZ.createNullTransactionFactory(),uploader:eY.createNullUploader()});ow.createNullContext=tY});var hk=S(Gu=>{"use strict";a();Object.defineProperty(Gu,"__esModule",{value:!0});var rY=rc(),fk=Ry(),Ty=t=>{if(typeof t=="string"||iY(t)){let e=new Date(t),r=Math.floor(e.getTime()/1e3);return fk.createBigInt(r)}return fk.createBigInt(t)},nY=()=>Ty(new Date(Date.now())),iY=t=>Object.prototype.toString.call(t)==="[object Date]",sY=(t,e="en-US",r={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZone:"UTC"})=>new Date(Number(t*1000n)).toLocaleDateString(e,r),oY=t=>rY.mapSerializer(t,e=>{let r=Ty(e);return r>Number.MAX_SAFE_INTEGER?r:Number(r)},e=>Ty(e));Gu.dateTime=Ty;Gu.formatDateTime=sY;Gu.mapDateTimeSerializer=oY;Gu.now=nY});var uw=S(cw=>{"use strict";a();Object.defineProperty(cw,"__esModule",{value:!0});var aY=(t=20,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")=>{let r="",n=e.length;for(let i=0;i<t;i+=1)r+=e.charAt(Math.floor(Math.random()*n));return r};cw.generateRandomString=aY});var pk=S(Ns=>{"use strict";a();Object.defineProperty(Ns,"__esModule",{value:!0});var cY=rc(),uY=uw(),lw=(t,e,r={})=>({buffer:typeof t=="string"?cY.utf8.serialize(t):t,fileName:e,displayName:r.displayName??e,uniqueName:r.uniqueName??uY.generateRandomString(),contentType:r.contentType??null,extension:r.extension??yY(e),tags:r.tags??[]}),lY=async(t,e={})=>lw(new Uint8Array(await t.arrayBuffer()),t.name,e),dY=(t,e="inline.json",r={})=>lw(JSON.stringify(t),e,{contentType:"application/json",...r}),fY=t=>new File([t.buffer],t.fileName),hY=t=>JSON.parse(new TextDecoder().decode(t.buffer)),pY=(...t)=>t.reduce((e,r)=>e+r.buffer.byteLength,0),gY=t=>t!=null&&typeof t=="object"&&"buffer"in t&&"fileName"in t&&"displayName"in t&&"uniqueName"in t&&"contentType"in t&&"extension"in t&&"tags"in t,yY=t=>{let e=t.lastIndexOf(".");return e<0?null:t.slice(e+1)};Ns.createBrowserFileFromGenericFile=fY;Ns.createGenericFile=lw;Ns.createGenericFileFromBrowserFile=lY;Ns.createGenericFileFromJson=dY;Ns.getBytesFromGenericFiles=pY;Ns.isGenericFile=gY;Ns.parseJsonFromGenericFile=hY});var gk=S(ky=>{"use strict";a();Object.defineProperty(ky,"__esModule",{value:!0});var mY=wy(),dw=rc(),Hf=Vi(),zy=class t{constructor(e,r,n={}){this.context=e,this.programId=r,this.options=n}reset(){return new t(this.context,this.programId,{fields:this.options.fields,deserializeCallback:this.options.deserializeCallback})}registerFields(e){return new t(this.context,this.programId,{...this.options,fields:e})}registerFieldsFromStruct(e){let r=0,n=e.reduce((i,[s,o])=>(i[s]=[r,o],r=r===null||o.fixedSize===null?null:r+o.fixedSize,i),{});return this.registerFields(n)}registerNestedFieldsFromStruct(e,r,n){let i=r,s=n.reduce((c,[u,d])=>{let f=`${e}.${u}`;return c[f]=[i,d],i=i===null||d.fixedSize===null?null:i+d.fixedSize,c},{}),o={...this.options.fields,...s};return new t(this.context,this.programId,{...this.options,fields:o})}deserializeUsing(e){return new t(this.context,this.programId,{...this.options,deserializeCallback:e})}slice(e,r){return new t(this.context,this.programId,{...this.options,dataSlice:{offset:e,length:r}})}sliceField(e,r){let[n,i]=this.getField(e,r);if(!i.fixedSize)throw new Hf.SdkError(`Cannot slice field [${e}] because its size is variable.`);return this.slice(n,i.fixedSize)}withoutData(){return this.slice(0,0)}addFilter(...e){return new t(this.context,this.programId,{...this.options,filters:[...this.options.filters??[],...e]})}where(e,r){let n;return typeof r=="string"?n=dw.base58.serialize(r):typeof r=="number"||typeof r=="bigint"||typeof r=="boolean"?n=dw.base10.serialize(BigInt(r).toString()):n=new Uint8Array(r),this.addFilter({memcmp:{offset:e,bytes:n}})}whereField(e,r,n){let[i,s]=this.getField(e,n);return this.where(i,s.serialize(r))}whereSize(e){return this.addFilter({dataSize:e})}sortUsing(e){return new t(this.context,this.programId,{...this.options,sortCallback:e})}async get(e={}){let r=await this.context.rpc.getProgramAccounts(this.programId,{...e,dataSlice:e.dataSlice??this.options.dataSlice,filters:[...e.filters??[],...this.options.filters??[]]});return this.options.sortCallback&&r.sort(this.options.sortCallback),r}async getAndMap(e,r={}){return(await this.get(r)).map(e)}async getDeserialized(e={}){let r=await this.get(e);return this.options.deserializeCallback?r.map(this.options.deserializeCallback):r}async getPublicKeys(e={}){return this.getAndMap(r=>r.publicKey,e)}async getDataAsPublicKeys(e={}){return this.getAndMap(r=>{try{return mY.publicKey(r.data)}catch{let i=`Following a getProgramAccount call, you are trying to use an account's data (or a slice of it) as a public key. However, we encountered an account [${r.publicKey}] whose data [base64=${dw.base64.deserialize(r.data)}] is not a valid public key.`;throw new Hf.SdkError(i)}},e)}getField(e,r){if(!this.options.fields)throw new Hf.SdkError("Fields are not defined in this GpaBuilder.");let n=this.options.fields[e];if(!n)throw new Hf.SdkError(`Field [${e}] is not defined in this GpaBuilder.`);let[i,s]=n;if(r!==void 0)return[r,s];if(i===null)throw new Hf.SdkError(`Field [${e}] does not have a fixed offset. This is likely because it is not in the fixed part of the account's data. In other words, it is located after a field of variable length which means we cannot find a fixed offset for the filter. You may go around this by providing an offset explicitly.`);return[i,s]}},bY=(t,e)=>new zy(t,e);ky.GpaBuilder=zy;ky.gpaBuilder=bY});var yk=S(Ny=>{"use strict";a();Object.defineProperty(Ny,"__esModule",{value:!0});var _Y=()=>new Cy({method:"get",data:void 0,headers:{},url:""}),Cy=class t{constructor(e){this.request=e}asJson(){return this.contentType("application/json")}asMultipart(){return this.contentType("multipart/form-data")}asForm(){return this.contentType("application/x-www-form-urlencoded")}accept(e){return this.withHeader("accept",e)}contentType(e){return this.withHeader("content-type",e)}userAgent(e){return this.withHeader("user-agent",e)}withToken(e,r="Bearer"){return this.withHeader("authorization",`${r} ${e}`)}withHeader(e,r){return this.withHeaders({[e]:r})}withHeaders(e){return new t({...this.request,headers:{...this.request.headers,...e}})}dontFollowRedirects(){return this.followRedirects(0)}followRedirects(e){return new t({...this.request,maxRedirects:e})}withoutTimeout(){return this.withTimeout(0)}withTimeout(e){return new t({...this.request,timeout:e})}withAbortSignal(e){return new t({...this.request,signal:e})}withEndpoint(e,r){return new t({...this.request,method:e,url:r})}withParams(e){let r=new URL(this.request.url),n=new URLSearchParams(e),i=new URLSearchParams(r.searchParams);return[...n.entries()].forEach(([s,o])=>{i.append(s,o)}),r.search=i.toString(),new t({...this.request,url:r.toString()})}withData(e){return new t({...this.request,data:e})}get(e){return this.withEndpoint("get",e)}post(e){return this.withEndpoint("post",e)}put(e){return this.withEndpoint("put",e)}patch(e){return this.withEndpoint("patch",e)}delete(e){return this.withEndpoint("delete",e)}get method(){return this.request.method}get url(){return this.request.url}get data(){return this.request.data}get headers(){return this.request.headers}get maxRedirects(){return this.request.maxRedirects}get timeout(){return this.request.timeout}get signal(){return this.request.signal}};Ny.HttpRequestBuilder=Cy;Ny.request=_Y});var Ly=S(My=>{"use strict";a();Object.defineProperty(My,"__esModule",{value:!0});var AY=1232,SY=(t,e,r)=>{let n=t.message.header.numRequiredSignatures,s=t.message.accounts.slice(0,n).findIndex(c=>c===r);if(s<0)throw new Error("The provided signer is not required to sign this transaction.");let o=[...t.signatures];return o[s]=e,{...t,signatures:o}};My.TRANSACTION_SIZE_LIMIT=AY;My.addTransactionSignature=SY});var fw=S(Gf=>{"use strict";a();Object.defineProperty(Gf,"__esModule",{value:!0});var vY=Ly(),EY=t=>mk(t,t.eddsa.generateKeypair()),mk=(t,e)=>({publicKey:e.publicKey,secretKey:e.secretKey,async signMessage(r){return t.eddsa.sign(r,e)},async signTransaction(r){let n=r.serializedMessage,i=t.eddsa.sign(n,e);return vY.addTransactionSignature(r,i,e.publicKey)},async signAllTransactions(r){return Promise.all(r.map(n=>this.signTransaction(n)))}}),wY=t=>t.secretKey!==void 0;Gf.createSignerFromKeypair=mk;Gf.generateSigner=EY;Gf.isKeypairSigner=wY});var bk=S(hw=>{"use strict";a();Object.defineProperty(hw,"__esModule",{value:!0});var xY=t=>t instanceof Error&&"logs"in t;hw.isErrorWithLogs=xY});var _k=S(xo=>{"use strict";a();Object.defineProperty(xo,"__esModule",{value:!0});var Dy=fw(),pw=(t,e=!0)=>({install(r){r.identity=t,e&&(r.payer=t)}}),gw=t=>({install(e){e.payer=t}}),IY=(t=!0)=>({install(e){let r=Dy.generateSigner(e);e.use(pw(r,t))}}),PY=()=>({install(t){let e=Dy.generateSigner(t);t.use(gw(e))}}),RY=(t,e=!0)=>({install(r){let n=Dy.createSignerFromKeypair(r,t);r.use(pw(n,e))}}),OY=t=>({install(e){let r=Dy.createSignerFromKeypair(e,t);e.use(gw(r))}});xo.generatedSignerIdentity=IY;xo.generatedSignerPayer=PY;xo.keypairIdentity=RY;xo.keypairPayer=OY;xo.signerIdentity=pw;xo.signerPayer=gw});var yw=S(Uy=>{"use strict";a();Object.defineProperty(Uy,"__esModule",{value:!0});var Ak=jf(),BY=Ly(),TY=Vi(),qy=class t{constructor(e=[],r={}){this.items=e,this.options=r}empty(){return new t([],this.options)}setItems(e){return new t(this.parseItems(e),this.options)}prepend(e){return new t([...this.parseItems(e),...this.items],this.options)}append(e){return new t([...this.items,...this.parseItems(e)],this.options)}add(e){return this.append(e)}mapInstructions(e){return new t(this.items.map(e),this.options)}addRemainingAccounts(e,r){r=r??this.items.length-1;let n=Array.isArray(e)?e:[e],i=n.map(o=>"pubkey"in o?o:{pubkey:o.signer.publicKey,isSigner:!0,isWritable:o.isWritable}),s=n.flatMap(o=>"pubkey"in o?[]:[o.signer]);return this.mapInstructions((o,c)=>{if(c!==r)return o;let u=[...o.instruction.keys,...i];return{...o,instruction:{...o.instruction,keys:u},signers:[...o.signers,...s]}})}splitByIndex(e){return[new t(this.items.slice(0,e),this.options),new t(this.items.slice(e),this.options)]}unsafeSplitByTransactionSize(e){return this.items.reduce((r,n)=>{let i=r.pop(),s=i.add(n);return s.fitsInOneTransaction(e)?r.push(s):(r.push(i),r.push(i.empty().add(n))),r},[this.empty()])}setFeePayer(e){return new t(this.items,{...this.options,feePayer:e})}getFeePayer(e){return this.options.feePayer??e.payer}setVersion(e){return new t(this.items,{...this.options,version:e})}useLegacyVersion(){return this.setVersion("legacy")}useV0(){return this.setVersion(0)}setAddressLookupTables(e){return new t(this.items,{...this.options,addressLookupTables:e})}getBlockhash(){return typeof this.options.blockhash=="object"?this.options.blockhash.blockhash:this.options.blockhash}setBlockhash(e){return new t(this.items,{...this.options,blockhash:e})}async setLatestBlockhash(e,r={}){return this.setBlockhash(await e.rpc.getLatestBlockhash(r))}getInstructions(){return this.items.map(e=>e.instruction)}getSigners(e){return Ak.uniqueSigners([this.getFeePayer(e),...this.items.flatMap(r=>r.signers)])}getBytesCreatedOnChain(){return this.items.reduce((e,r)=>e+r.bytesCreatedOnChain,0)}async getRentCreatedOnChain(e){return e.rpc.getRent(this.getBytesCreatedOnChain(),{includesHeaderBytes:!0})}getTransactionSize(e){return e.transactions.serialize(this.setBlockhash("11111111111111111111111111111111").build(e)).length}minimumTransactionsRequired(e){return Math.ceil(this.getTransactionSize(e)/BY.TRANSACTION_SIZE_LIMIT)}fitsInOneTransaction(e){return this.minimumTransactionsRequired(e)===1}build(e){let r=this.getBlockhash();if(!r)throw new TY.SdkError("Setting a blockhash is required to build a transaction. Please use the `setBlockhash` or `setLatestBlockhash` methods.");let n={version:this.options.version??0,payer:this.getFeePayer(e).publicKey,instructions:this.getInstructions(),blockhash:r};return n.version===0&&this.options.addressLookupTables&&(n.addressLookupTables=this.options.addressLookupTables),e.transactions.create(n)}async buildWithLatestBlockhash(e,r={}){let n=this;return this.options.blockhash||(n=await this.setLatestBlockhash(e,r)),n.build(e)}async buildAndSign(e){return Ak.signTransaction(await this.buildWithLatestBlockhash(e),this.getSigners(e))}async send(e,r={}){let n=await this.buildAndSign(e);return e.rpc.sendTransaction(n,r)}async confirm(e,r,n={}){let i=this;this.options.blockhash||(i=await this.setLatestBlockhash(e));let s;if(n.strategy)s=n.strategy;else{let o=typeof i.options.blockhash=="object"?i.options.blockhash:await e.rpc.getLatestBlockhash();s=n.strategy??{type:"blockhash",...o}}return e.rpc.confirmTransaction(r,{...n,strategy:s})}async sendAndConfirm(e,r={}){let n=this;this.options.blockhash||(n=await this.setLatestBlockhash(e));let i=await n.send(e,r.send),s=await n.confirm(e,i,r.confirm);return{signature:i,result:s}}parseItems(e){return(Array.isArray(e)?e:[e]).flatMap(r=>"items"in r?r.items:[r])}},zY=(t=[])=>new qy(t);Uy.TransactionBuilder=qy;Uy.transactionBuilder=zY});var Sk=S(Fy=>{"use strict";a();Object.defineProperty(Fy,"__esModule",{value:!0});var kY=jf(),CY=yw(),NY=By(),Vy=class t{constructor(e=[],r={}){this.builders=e,this.options=r}prepend(e){let r=Array.isArray(e)?e:[e];return new t([...r,...this.builders],this.options)}append(e){let r=Array.isArray(e)?e:[e];return new t([...this.builders,...r],this.options)}add(e){return this.append(e)}sequential(){return new t(this.builders,{...this.options,parallel:!1})}parallel(){return new t(this.builders,{...this.options,parallel:!0})}isParallel(){return this.options.parallel??!1}merge(){return this.builders.length===0?new CY.TransactionBuilder:this.builders.reduce((e,r)=>e.add(r),this.builders[0].empty())}build(e){return this.builders.map(r=>r.build(e))}async setLatestBlockhash(e){if(!this.builders.some(i=>!i.options.blockhash))return this;let n=await e.rpc.getLatestBlockhash();return this.map(i=>i.options.blockhash?i:i.setBlockhash(n))}async buildWithLatestBlockhash(e){return(await this.setLatestBlockhash(e)).build(e)}async buildAndSign(e){let r=await this.buildWithLatestBlockhash(e),n=this.builders.map(i=>i.getSigners(e));return kY.signAllTransactions(NY.zipMap(r,n,(i,s)=>({transaction:i,signers:s??[]})))}async send(e,r={}){return this.runAll(await this.buildAndSign(e),async n=>e.rpc.sendTransaction(n,r))}async sendAndConfirm(e,r={}){let n=this.builders.find(s=>typeof s.options.blockhash=="object")?.options.blockhash,i;if(r.confirm?.strategy)i=r.confirm.strategy;else{let s=n??await e.rpc.getLatestBlockhash();i=r.confirm?.strategy??{type:"blockhash",...s}}return this.runAll(await this.buildAndSign(e),async s=>{let o=await e.rpc.sendTransaction(s,r.send),c=await e.rpc.confirmTransaction(o,{...r.confirm,strategy:i});return{signature:o,result:c}})}map(e){return new t(this.builders.map(e))}filter(e){return new t(this.builders.filter(e))}async runAll(e,r){return this.isParallel()?Promise.all(e.map(r)):e.reduce(async(n,...i)=>[...await n,await r(...i)],Promise.resolve([]))}};function MY(t=[]){return new Vy(t)}Fy.TransactionBuilderGroup=Vy;Fy.transactionBuilderGroup=MY});var Ek=S(Ky=>{"use strict";a();Object.defineProperty(Ky,"__esModule",{value:!0});var LY=aw(),DY=()=>vk(),vk=()=>({...LY.createNullContext(),use(t){return t.install(this),this}});Ky.createBaseUmi=vk;Ky.createUmi=DY});var wk=S(bw=>{"use strict";a();Object.defineProperty(bw,"__esModule",{value:!0});var qY=Vi(),mw=class extends qY.SdkError{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i,n)}};bw.InvalidBaseStringError=mw});var xk=S(Aw=>{"use strict";a();Object.defineProperty(Aw,"__esModule",{value:!0});var UY=Py(),_w=class extends UY.UmiError{name="ProgramError";constructor(e,r,n){super(e,"program",`${r.name} [${r.publicKey}]`,n),this.program=r,this.logs=n?.logs,this.logs&&(this.message+=`
+`}getCapitalizedSource(){return this.source==="sdk"||this.source==="rpc"?this.source.toUpperCase():this.source[0].toUpperCase()+this.source.slice(1)}getFullSource(){let e=this.getCapitalizedSource(),r=this.sourceDetails?` > ${this.sourceDetails}`:"";return e+r}toString(){return`[${this.name}] ${this.message}`}};YI.UmiError=XI});var As=_(QI=>{"use strict";a();Object.defineProperty(QI,"__esModule",{value:!0});var zte=_b(),JI=class extends zte.UmiError{name="SdkError";constructor(e,r){super(e,"sdk",void 0,r)}};QI.SdkError=JI});var rP=_(tP=>{"use strict";a();Object.defineProperty(tP,"__esModule",{value:!0});var kte=As(),eP=class extends kte.SdkError{name="UnexpectedAccountError";constructor(e,r,n){let i=`The account at the provided address [${e}] is not of the expected type [${r}].`;super(i,n)}};tP.UnexpectedAccountError=eP});var sP=_(iP=>{"use strict";a();Object.defineProperty(iP,"__esModule",{value:!0});var Cte=As(),nP=class extends Cte.SdkError{name="AccountNotFoundError";constructor(e,r,n){let i=`${r?`The account of type [${r}] was not found`:"No account was found"} at the provided address [${e}].${n?` ${n}`:""}`;super(i)}};iP.AccountNotFoundError=nP});var o2=_(jh=>{"use strict";a();Object.defineProperty(jh,"__esModule",{value:!0});var Mte=rP(),Nte=sP(),Lte=128;function Dte(t,e){let{data:r,publicKey:n,...i}=t;try{let[s]=e.deserialize(r);return{publicKey:n,header:i,...s}}catch(s){throw new Mte.UnexpectedAccountError(n,e.description,s)}}function qte(t,e,r){if(!t.exists)throw new Nte.AccountNotFoundError(t.publicKey,e,r)}jh.ACCOUNT_HEADER_SIZE=Lte;jh.assertAccountExists=qte;jh.deserializeAccount=Dte});var Sb=_(oP=>{"use strict";a();Object.defineProperty(oP,"__esModule",{value:!0});var Ute=t=>(t=typeof t=="object"?t.toString():t,BigInt(t));oP.createBigInt=Ute});var uP=_(cP=>{"use strict";a();Object.defineProperty(cP,"__esModule",{value:!0});var Vte=As(),aP=class extends Vte.SdkError{name="UnexpectedAmountError";constructor(e,r,n){let i=`Expected amount of type [${r} with ${n} decimals] but got [${e.identifier} with ${e.decimals} decimals]. Ensure the provided Amount is of the expected type.`;super(i),this.amount=e,this.expectedIdentifier=r,this.expectedDecimals=n}};cP.UnexpectedAmountError=aP});var fP=_(dP=>{"use strict";a();Object.defineProperty(dP,"__esModule",{value:!0});var Kte=As(),lP=class extends Kte.SdkError{name="AmountMismatchError";constructor(e,r,n){let s=`The SDK tried to execute an operation${n?` [${n}]`:""} on two amounts of different types: [${e.identifier} with ${e.decimals} decimals] and [${r.identifier} with ${r.decimals} decimals]. Provide both amounts in the same type to perform this operation.`;super(s),this.left=e,this.right=r,this.operation=n}};dP.AmountMismatchError=lP});var p2=_(De=>{"use strict";a();Object.defineProperty(De,"__esModule",{value:!0});var Fte=Jc(),Wte=Sb(),jte=uP(),Hte=fP(),Gl=(t,e,r)=>({basisPoints:Wte.createBigInt(t),identifier:e,decimals:r}),$l=(t,e,r)=>{let n=Gl(BigInt(10)**BigInt(r??0),e,r);return l2(n,t)},Gte=(t,e=2)=>$l(t,"%",e),$te=(t,e,r)=>$l(t,e??"splToken",r??0),Zte=t=>Gl(t,"SOL",9),Xte=t=>$l(t,"SOL",9),Yte=t=>$l(t,"USD",2),Jte=t=>Gl(t,"uSOL",15),Qte=t=>$l(t,"uSOL",15),vb=(t,e,r)=>t.identifier===e&&t.decimals===r,ere=t=>vb(t,"SOL",9),a2=(t,e)=>vb(t,e.identifier,e.decimals);function c2(t,e,r){if(!vb(t,e,r))throw new jte.UnexpectedAmountError(t,e,r)}function tre(t){c2(t,"SOL",9)}function Hl(t,e,r){if(!a2(t,e))throw new Hte.AmountMismatchError(t,e,r)}var rre=(t,e)=>(Hl(t,e,"add"),{...t,basisPoints:t.basisPoints+e.basisPoints}),u2=(t,e)=>(Hl(t,e,"subtract"),{...t,basisPoints:t.basisPoints-e.basisPoints}),l2=(t,e)=>{if(typeof e=="bigint")return{...t,basisPoints:t.basisPoints*e};let[r,n]=e.toString().split("."),i=BigInt(r+(n??"")),s=BigInt(10)**BigInt(n?.length??0);return{...t,basisPoints:t.basisPoints*i/s}},nre=(t,e)=>{if(typeof e=="bigint")return{...t,basisPoints:t.basisPoints/e};let[r,n]=e.toString().split("."),i=BigInt(r+(n??"")),s=BigInt(10)**BigInt(n?.length??0);return{...t,basisPoints:t.basisPoints*s/i}},d2=t=>{let e=t.basisPoints;return{...t,basisPoints:e<0?-e:e}},Hh=(t,e)=>(Hl(t,e,"compare"),t.basisPoints>e.basisPoints?1:t.basisPoints<e.basisPoints?-1:0),ire=(t,e,r)=>{r=r??Gl(0,t.identifier,t.decimals),Hl(t,e,"isEqualToAmount"),Hl(t,r,"isEqualToAmount");let n=d2(u2(t,e));return f2(n,r)},sre=(t,e)=>Hh(t,e)<0,f2=(t,e)=>Hh(t,e)<=0,ore=(t,e)=>Hh(t,e)>0,are=(t,e)=>Hh(t,e)>=0,cre=t=>t.basisPoints===BigInt(0),ure=t=>t.basisPoints>=BigInt(0),lre=t=>t.basisPoints<BigInt(0),pP=(t,e)=>{let r=t.basisPoints.toString();if(t.decimals===0)return r;let n=r.startsWith("-")?"-":"";r=r.replace("-",""),r=r.padStart(t.decimals+1,"0");let i=r.slice(0,-t.decimals),s=r.slice(-t.decimals);return e!==void 0&&(s=s.slice(0,e)),`${n+i}.${s}`},dre=t=>parseFloat(pP(t)),fre=(t,e)=>{let r=pP(t,e);switch(t.identifier){case"%":return`${r}%`;case"splToken":return/^1(\.0+)?$/.test(r)?`${r} Token`:`${r} Tokens`;default:if(t.identifier.startsWith("splToken.")){let[,n]=t.identifier.split(".");return`${n} ${r}`}return`${t.identifier} ${r}`}},pre=(t,e,r)=>Fte.mapSerializer(t,n=>n.basisPoints>Number.MAX_SAFE_INTEGER?n.basisPoints:Number(n.basisPoints),n=>Gl(n,e,r));De.absoluteAmount=d2;De.addAmounts=rre;De.amountToNumber=dre;De.amountToString=pP;De.assertAmount=c2;De.assertSameAmounts=Hl;De.assertSolAmount=tre;De.compareAmounts=Hh;De.createAmount=Gl;De.createAmountFromDecimals=$l;De.displayAmount=fre;De.divideAmount=nre;De.isAmount=vb;De.isEqualToAmount=ire;De.isGreaterThanAmount=ore;De.isGreaterThanOrEqualToAmount=are;De.isLessThanAmount=sre;De.isLessThanOrEqualToAmount=f2;De.isNegativeAmount=lre;De.isPositiveAmount=ure;De.isSolAmount=ere;De.isZeroAmount=cre;De.lamports=Zte;De.mapAmountSerializer=pre;De.microLamports=Jte;De.microSol=Qte;De.multiplyAmount=l2;De.percentAmount=Gte;De.sameAmounts=a2;De.sol=Xte;De.subtractAmounts=u2;De.tokenAmount=$te;De.usd=Yte});var h2=_(hP=>{"use strict";a();Object.defineProperty(hP,"__esModule",{value:!0});var hre=["api.mainnet-beta.solana.com","ssc-dao.genesysgo.net"],gre=["api.devnet.solana.com","psytrbhymqlkfrhudd.dev.genesysgo.net"],mre=["api.testnet.solana.com"],yre=["localhost","127.0.0.1"],bre=t=>{let e=new URL(t).hostname;return hre.includes(e)?"mainnet-beta":gre.includes(e)?"devnet":mre.includes(e)?"testnet":yre.includes(e)?"localnet":t.includes("mainnet")?"mainnet-beta":t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("local")?"localnet":"custom"};hP.resolveClusterFromEndpoint=bre});var _s=_(mP=>{"use strict";a();Object.defineProperty(mP,"__esModule",{value:!0});var Are=As(),gP=class extends Are.SdkError{name="InterfaceImplementationMissingError";constructor(e,r){let n=e.replace(/Interface$/,""),i=`Tried using ${e} but no implementation of that interface was found. Make sure an implementation is registered, e.g. via "context.${r} = new My${n}();".`;super(i)}};mP.InterfaceImplementationMissingError=gP});var bP=_(yP=>{"use strict";a();Object.defineProperty(yP,"__esModule",{value:!0});var _re=_s();function Sre(){let t=()=>{throw new _re.InterfaceImplementationMissingError("DownloaderInterface","downloader")};return{download:t,downloadJson:t}}yP.createNullDownloader=Sre});var _P=_(AP=>{"use strict";a();Object.defineProperty(AP,"__esModule",{value:!0});var vre=_s();function Ere(){let t=()=>{throw new vre.InterfaceImplementationMissingError("EddsaInterface","eddsa")};return{generateKeypair:t,createKeypairFromSecretKey:t,createKeypairFromSeed:t,isOnCurve:t,findPda:t,sign:t,verify:t}}AP.createNullEddsa=Ere});var vP=_(SP=>{"use strict";a();Object.defineProperty(SP,"__esModule",{value:!0});var wre=_s();function xre(){return{send:()=>{throw new wre.InterfaceImplementationMissingError("HttpInterface","http")}}}SP.createNullHttp=xre});var wP=_(EP=>{"use strict";a();Object.defineProperty(EP,"__esModule",{value:!0});var Ire=_s();function Pre(){let t=()=>{throw new Ire.InterfaceImplementationMissingError("ProgramRepositoryInterface","programs")};return{has:t,get:t,getPublicKey:t,all:t,add:t,bind:t,unbind:t,clone:t,resolveError:t}}EP.createNullProgramRepository=Pre});var IP=_(xP=>{"use strict";a();Object.defineProperty(xP,"__esModule",{value:!0});var Rre=_s();function Ore(){let t=()=>{throw new Rre.InterfaceImplementationMissingError("RpcInterface","rpc")};return{getEndpoint:t,getCluster:t,getAccount:t,getAccounts:t,getProgramAccounts:t,getBlockTime:t,getBalance:t,getRent:t,getSlot:t,getGenesisHash:t,getLatestBlockhash:t,getTransaction:t,getSignatureStatuses:t,accountExists:t,airdrop:t,call:t,sendTransaction:t,simulateTransaction:t,confirmTransaction:t}}xP.createNullRpc=Ore});var RP=_(PP=>{"use strict";a();Object.defineProperty(PP,"__esModule",{value:!0});var Tre=_s();function Bre(){let t=()=>{throw new Tre.InterfaceImplementationMissingError("SerializerInterface","serializer")};return{tuple:t,array:t,map:t,set:t,option:t,nullable:t,struct:t,enum:t,dataEnum:t,string:t,bool:t,unit:t,u8:t,u16:t,u32:t,u64:t,u128:t,i8:t,i16:t,i32:t,i64:t,i128:t,f32:t,f64:t,bytes:t,publicKey:t}}PP.createNullSerializer=Bre});var Eb=_(Gh=>{"use strict";a();Object.defineProperty(Gh,"__esModule",{value:!0});var zre=(t,e)=>t.reduce((r,n,i)=>{let s=Math.floor(i/e);return r[s]||(r[s]=[]),r[s].push(n),r},[]),kre=(t,e,r)=>t.map((n,i)=>r(n,e?.[i]??null,i)),Cre=(t,e)=>t.reduce((r,n)=>(r.some(i=>e(n,i))||r.push(n),r),[]);Gh.chunk=zre;Gh.uniqueBy=Cre;Gh.zipMap=kre});var $h=_(la=>{"use strict";a();Object.defineProperty(la,"__esModule",{value:!0});var Mre=Eb(),Nre=async(t,e)=>e.reduce(async(r,n)=>{let i=await r;return n.signTransaction(i)},Promise.resolve(t)),Lre=async t=>{let e=t.map(n=>n.transaction);return t.reduce((n,{signers:i},s)=>(i.forEach(o=>{let c=n.find(u=>u.signer.publicKey===o.publicKey);c?c.indices.push(s):n.push({signer:o,indices:[s]})}),n),[]).reduce(async(n,{signer:i,indices:s})=>{let o=await n;if(s.length===1){let d=o[s[0]];return o[s[0]]=await i.signTransaction(d),o}let c=s.map(d=>o[d]),u=await i.signAllTransactions(c);return s.forEach((d,f)=>{o[d]=u[f]}),o},Promise.resolve(e))},Dre=t=>typeof t=="object"&&"publicKey"in t&&"signMessage"in t,qre=t=>Mre.uniqueBy(t,(e,r)=>e.publicKey===r.publicKey),Ure=t=>({publicKey:t,async signMessage(e){return e},async signTransaction(e){return e},async signAllTransactions(e){return e}});function Vre(){let t=new Error("Trying to use a NullSigner. Did you forget to set a Signer on your Umi instance? See the `signerIdentity` method for more information."),e=()=>{throw t};return{get publicKey(){throw t},signMessage:e,signTransaction:e,signAllTransactions:e}}la.createNoopSigner=Ure;la.createNullSigner=Vre;la.isSigner=Dre;la.signAllTransactions=Lre;la.signTransaction=Nre;la.uniqueSigners=qre});var TP=_(OP=>{"use strict";a();Object.defineProperty(OP,"__esModule",{value:!0});var Kre=_s();function Fre(){let t=()=>{throw new Kre.InterfaceImplementationMissingError("TransactionFactoryInterface","transactions")};return{create:t,serialize:t,deserialize:t,serializeMessage:t,deserializeMessage:t}}OP.createNullTransactionFactory=Fre});var zP=_(BP=>{"use strict";a();Object.defineProperty(BP,"__esModule",{value:!0});var Wre=_s();function jre(){let t=()=>{throw new Wre.InterfaceImplementationMissingError("UploaderInterface","uploader")};return{upload:t,uploadJson:t,getUploadPrice:t}}BP.createNullUploader=jre});var CP=_(kP=>{"use strict";a();Object.defineProperty(kP,"__esModule",{value:!0});var Hre=bP(),Gre=_P(),$re=vP(),Zre=wP(),Xre=IP(),Yre=RP(),g2=$h(),Jre=TP(),Qre=zP(),ene=()=>({downloader:Hre.createNullDownloader(),eddsa:Gre.createNullEddsa(),http:$re.createNullHttp(),identity:g2.createNullSigner(),payer:g2.createNullSigner(),programs:Zre.createNullProgramRepository(),rpc:Xre.createNullRpc(),serializer:Yre.createNullSerializer(),transactions:Jre.createNullTransactionFactory(),uploader:Qre.createNullUploader()});kP.createNullContext=ene});var y2=_(Zl=>{"use strict";a();Object.defineProperty(Zl,"__esModule",{value:!0});var tne=Jc(),m2=Sb(),wb=t=>{if(typeof t=="string"||nne(t)){let e=new Date(t),r=Math.floor(e.getTime()/1e3);return m2.createBigInt(r)}return m2.createBigInt(t)},rne=()=>wb(new Date(Date.now())),nne=t=>Object.prototype.toString.call(t)==="[object Date]",ine=(t,e="en-US",r={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZone:"UTC"})=>new Date(Number(t*1000n)).toLocaleDateString(e,r),sne=t=>tne.mapSerializer(t,e=>{let r=wb(e);return r>Number.MAX_SAFE_INTEGER?r:Number(r)},e=>wb(e));Zl.dateTime=wb;Zl.formatDateTime=ine;Zl.mapDateTimeSerializer=sne;Zl.now=rne});var NP=_(MP=>{"use strict";a();Object.defineProperty(MP,"__esModule",{value:!0});var one=(t=20,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")=>{let r="",n=e.length;for(let i=0;i<t;i+=1)r+=e.charAt(Math.floor(Math.random()*n));return r};MP.generateRandomString=one});var b2=_(Ao=>{"use strict";a();Object.defineProperty(Ao,"__esModule",{value:!0});var ane=Jc(),cne=NP(),LP=(t,e,r={})=>({buffer:typeof t=="string"?ane.utf8.serialize(t):t,fileName:e,displayName:r.displayName??e,uniqueName:r.uniqueName??cne.generateRandomString(),contentType:r.contentType??null,extension:r.extension??gne(e),tags:r.tags??[]}),une=async(t,e={})=>LP(new Uint8Array(await t.arrayBuffer()),t.name,e),lne=(t,e="inline.json",r={})=>LP(JSON.stringify(t),e,{contentType:"application/json",...r}),dne=t=>new File([t.buffer],t.fileName),fne=t=>JSON.parse(new TextDecoder().decode(t.buffer)),pne=(...t)=>t.reduce((e,r)=>e+r.buffer.byteLength,0),hne=t=>t!=null&&typeof t=="object"&&"buffer"in t&&"fileName"in t&&"displayName"in t&&"uniqueName"in t&&"contentType"in t&&"extension"in t&&"tags"in t,gne=t=>{let e=t.lastIndexOf(".");return e<0?null:t.slice(e+1)};Ao.createBrowserFileFromGenericFile=dne;Ao.createGenericFile=LP;Ao.createGenericFileFromBrowserFile=une;Ao.createGenericFileFromJson=lne;Ao.getBytesFromGenericFiles=pne;Ao.isGenericFile=hne;Ao.parseJsonFromGenericFile=fne});var A2=_(Ib=>{"use strict";a();Object.defineProperty(Ib,"__esModule",{value:!0});var mne=yb(),DP=Jc(),Zh=As(),xb=class t{constructor(e,r,n={}){this.context=e,this.programId=r,this.options=n}reset(){return new t(this.context,this.programId,{fields:this.options.fields,deserializeCallback:this.options.deserializeCallback})}registerFields(e){return new t(this.context,this.programId,{...this.options,fields:e})}registerFieldsFromStruct(e){let r=0,n=e.reduce((i,[s,o])=>(i[s]=[r,o],r=r===null||o.fixedSize===null?null:r+o.fixedSize,i),{});return this.registerFields(n)}registerNestedFieldsFromStruct(e,r,n){let i=r,s=n.reduce((c,[u,d])=>{let f=`${e}.${u}`;return c[f]=[i,d],i=i===null||d.fixedSize===null?null:i+d.fixedSize,c},{}),o={...this.options.fields,...s};return new t(this.context,this.programId,{...this.options,fields:o})}deserializeUsing(e){return new t(this.context,this.programId,{...this.options,deserializeCallback:e})}slice(e,r){return new t(this.context,this.programId,{...this.options,dataSlice:{offset:e,length:r}})}sliceField(e,r){let[n,i]=this.getField(e,r);if(!i.fixedSize)throw new Zh.SdkError(`Cannot slice field [${e}] because its size is variable.`);return this.slice(n,i.fixedSize)}withoutData(){return this.slice(0,0)}addFilter(...e){return new t(this.context,this.programId,{...this.options,filters:[...this.options.filters??[],...e]})}where(e,r){let n;return typeof r=="string"?n=DP.base58.serialize(r):typeof r=="number"||typeof r=="bigint"||typeof r=="boolean"?n=DP.base10.serialize(BigInt(r).toString()):n=new Uint8Array(r),this.addFilter({memcmp:{offset:e,bytes:n}})}whereField(e,r,n){let[i,s]=this.getField(e,n);return this.where(i,s.serialize(r))}whereSize(e){return this.addFilter({dataSize:e})}sortUsing(e){return new t(this.context,this.programId,{...this.options,sortCallback:e})}async get(e={}){let r=await this.context.rpc.getProgramAccounts(this.programId,{...e,dataSlice:e.dataSlice??this.options.dataSlice,filters:[...e.filters??[],...this.options.filters??[]]});return this.options.sortCallback&&r.sort(this.options.sortCallback),r}async getAndMap(e,r={}){return(await this.get(r)).map(e)}async getDeserialized(e={}){let r=await this.get(e);return this.options.deserializeCallback?r.map(this.options.deserializeCallback):r}async getPublicKeys(e={}){return this.getAndMap(r=>r.publicKey,e)}async getDataAsPublicKeys(e={}){return this.getAndMap(r=>{try{return mne.publicKey(r.data)}catch{let i=`Following a getProgramAccount call, you are trying to use an account's data (or a slice of it) as a public key. However, we encountered an account [${r.publicKey}] whose data [base64=${DP.base64.deserialize(r.data)}] is not a valid public key.`;throw new Zh.SdkError(i)}},e)}getField(e,r){if(!this.options.fields)throw new Zh.SdkError("Fields are not defined in this GpaBuilder.");let n=this.options.fields[e];if(!n)throw new Zh.SdkError(`Field [${e}] is not defined in this GpaBuilder.`);let[i,s]=n;if(r!==void 0)return[r,s];if(i===null)throw new Zh.SdkError(`Field [${e}] does not have a fixed offset. This is likely because it is not in the fixed part of the account's data. In other words, it is located after a field of variable length which means we cannot find a fixed offset for the filter. You may go around this by providing an offset explicitly.`);return[i,s]}},yne=(t,e)=>new xb(t,e);Ib.GpaBuilder=xb;Ib.gpaBuilder=yne});var _2=_(Rb=>{"use strict";a();Object.defineProperty(Rb,"__esModule",{value:!0});var bne=()=>new Pb({method:"get",data:void 0,headers:{},url:""}),Pb=class t{constructor(e){this.request=e}asJson(){return this.contentType("application/json")}asMultipart(){return this.contentType("multipart/form-data")}asForm(){return this.contentType("application/x-www-form-urlencoded")}accept(e){return this.withHeader("accept",e)}contentType(e){return this.withHeader("content-type",e)}userAgent(e){return this.withHeader("user-agent",e)}withToken(e,r="Bearer"){return this.withHeader("authorization",`${r} ${e}`)}withHeader(e,r){return this.withHeaders({[e]:r})}withHeaders(e){return new t({...this.request,headers:{...this.request.headers,...e}})}dontFollowRedirects(){return this.followRedirects(0)}followRedirects(e){return new t({...this.request,maxRedirects:e})}withoutTimeout(){return this.withTimeout(0)}withTimeout(e){return new t({...this.request,timeout:e})}withAbortSignal(e){return new t({...this.request,signal:e})}withEndpoint(e,r){return new t({...this.request,method:e,url:r})}withParams(e){let r=new URL(this.request.url),n=new URLSearchParams(e),i=new URLSearchParams(r.searchParams);return[...n.entries()].forEach(([s,o])=>{i.append(s,o)}),r.search=i.toString(),new t({...this.request,url:r.toString()})}withData(e){return new t({...this.request,data:e})}get(e){return this.withEndpoint("get",e)}post(e){return this.withEndpoint("post",e)}put(e){return this.withEndpoint("put",e)}patch(e){return this.withEndpoint("patch",e)}delete(e){return this.withEndpoint("delete",e)}get method(){return this.request.method}get url(){return this.request.url}get data(){return this.request.data}get headers(){return this.request.headers}get maxRedirects(){return this.request.maxRedirects}get timeout(){return this.request.timeout}get signal(){return this.request.signal}};Rb.HttpRequestBuilder=Pb;Rb.request=bne});var Tb=_(Ob=>{"use strict";a();Object.defineProperty(Ob,"__esModule",{value:!0});var Ane=1232,_ne=(t,e,r)=>{let n=t.message.header.numRequiredSignatures,s=t.message.accounts.slice(0,n).findIndex(c=>c===r);if(s<0)throw new Error("The provided signer is not required to sign this transaction.");let o=[...t.signatures];return o[s]=e,{...t,signatures:o}};Ob.TRANSACTION_SIZE_LIMIT=Ane;Ob.addTransactionSignature=_ne});var qP=_(Xh=>{"use strict";a();Object.defineProperty(Xh,"__esModule",{value:!0});var Sne=Tb(),vne=t=>S2(t,t.eddsa.generateKeypair()),S2=(t,e)=>({publicKey:e.publicKey,secretKey:e.secretKey,async signMessage(r){return t.eddsa.sign(r,e)},async signTransaction(r){let n=r.serializedMessage,i=t.eddsa.sign(n,e);return Sne.addTransactionSignature(r,i,e.publicKey)},async signAllTransactions(r){return Promise.all(r.map(n=>this.signTransaction(n)))}}),Ene=t=>t.secretKey!==void 0;Xh.createSignerFromKeypair=S2;Xh.generateSigner=vne;Xh.isKeypairSigner=Ene});var v2=_(UP=>{"use strict";a();Object.defineProperty(UP,"__esModule",{value:!0});var wne=t=>t instanceof Error&&"logs"in t;UP.isErrorWithLogs=wne});var E2=_(da=>{"use strict";a();Object.defineProperty(da,"__esModule",{value:!0});var Bb=qP(),VP=(t,e=!0)=>({install(r){r.identity=t,e&&(r.payer=t)}}),KP=t=>({install(e){e.payer=t}}),xne=(t=!0)=>({install(e){let r=Bb.generateSigner(e);e.use(VP(r,t))}}),Ine=()=>({install(t){let e=Bb.generateSigner(t);t.use(KP(e))}}),Pne=(t,e=!0)=>({install(r){let n=Bb.createSignerFromKeypair(r,t);r.use(VP(n,e))}}),Rne=t=>({install(e){let r=Bb.createSignerFromKeypair(e,t);e.use(KP(r))}});da.generatedSignerIdentity=xne;da.generatedSignerPayer=Ine;da.keypairIdentity=Pne;da.keypairPayer=Rne;da.signerIdentity=VP;da.signerPayer=KP});var FP=_(kb=>{"use strict";a();Object.defineProperty(kb,"__esModule",{value:!0});var w2=$h(),One=Tb(),Tne=As(),zb=class t{constructor(e=[],r={}){this.items=e,this.options=r}empty(){return new t([],this.options)}setItems(e){return new t(this.parseItems(e),this.options)}prepend(e){return new t([...this.parseItems(e),...this.items],this.options)}append(e){return new t([...this.items,...this.parseItems(e)],this.options)}add(e){return this.append(e)}mapInstructions(e){return new t(this.items.map(e),this.options)}addRemainingAccounts(e,r){r=r??this.items.length-1;let n=Array.isArray(e)?e:[e],i=n.map(o=>"pubkey"in o?o:{pubkey:o.signer.publicKey,isSigner:!0,isWritable:o.isWritable}),s=n.flatMap(o=>"pubkey"in o?[]:[o.signer]);return this.mapInstructions((o,c)=>{if(c!==r)return o;let u=[...o.instruction.keys,...i];return{...o,instruction:{...o.instruction,keys:u},signers:[...o.signers,...s]}})}splitByIndex(e){return[new t(this.items.slice(0,e),this.options),new t(this.items.slice(e),this.options)]}unsafeSplitByTransactionSize(e){return this.items.reduce((r,n)=>{let i=r.pop(),s=i.add(n);return s.fitsInOneTransaction(e)?r.push(s):(r.push(i),r.push(i.empty().add(n))),r},[this.empty()])}setFeePayer(e){return new t(this.items,{...this.options,feePayer:e})}getFeePayer(e){return this.options.feePayer??e.payer}setVersion(e){return new t(this.items,{...this.options,version:e})}useLegacyVersion(){return this.setVersion("legacy")}useV0(){return this.setVersion(0)}setAddressLookupTables(e){return new t(this.items,{...this.options,addressLookupTables:e})}getBlockhash(){return typeof this.options.blockhash=="object"?this.options.blockhash.blockhash:this.options.blockhash}setBlockhash(e){return new t(this.items,{...this.options,blockhash:e})}async setLatestBlockhash(e,r={}){return this.setBlockhash(await e.rpc.getLatestBlockhash(r))}getInstructions(){return this.items.map(e=>e.instruction)}getSigners(e){return w2.uniqueSigners([this.getFeePayer(e),...this.items.flatMap(r=>r.signers)])}getBytesCreatedOnChain(){return this.items.reduce((e,r)=>e+r.bytesCreatedOnChain,0)}async getRentCreatedOnChain(e){return e.rpc.getRent(this.getBytesCreatedOnChain(),{includesHeaderBytes:!0})}getTransactionSize(e){return e.transactions.serialize(this.setBlockhash("11111111111111111111111111111111").build(e)).length}minimumTransactionsRequired(e){return Math.ceil(this.getTransactionSize(e)/One.TRANSACTION_SIZE_LIMIT)}fitsInOneTransaction(e){return this.minimumTransactionsRequired(e)===1}build(e){let r=this.getBlockhash();if(!r)throw new Tne.SdkError("Setting a blockhash is required to build a transaction. Please use the `setBlockhash` or `setLatestBlockhash` methods.");let n={version:this.options.version??0,payer:this.getFeePayer(e).publicKey,instructions:this.getInstructions(),blockhash:r};return n.version===0&&this.options.addressLookupTables&&(n.addressLookupTables=this.options.addressLookupTables),e.transactions.create(n)}async buildWithLatestBlockhash(e,r={}){let n=this;return this.options.blockhash||(n=await this.setLatestBlockhash(e,r)),n.build(e)}async buildAndSign(e){return w2.signTransaction(await this.buildWithLatestBlockhash(e),this.getSigners(e))}async send(e,r={}){let n=await this.buildAndSign(e);return e.rpc.sendTransaction(n,r)}async confirm(e,r,n={}){let i=this;this.options.blockhash||(i=await this.setLatestBlockhash(e));let s;if(n.strategy)s=n.strategy;else{let o=typeof i.options.blockhash=="object"?i.options.blockhash:await e.rpc.getLatestBlockhash();s=n.strategy??{type:"blockhash",...o}}return e.rpc.confirmTransaction(r,{...n,strategy:s})}async sendAndConfirm(e,r={}){let n=this;this.options.blockhash||(n=await this.setLatestBlockhash(e));let i=await n.send(e,r.send),s=await n.confirm(e,i,r.confirm);return{signature:i,result:s}}parseItems(e){return(Array.isArray(e)?e:[e]).flatMap(r=>"items"in r?r.items:[r])}},Bne=(t=[])=>new zb(t);kb.TransactionBuilder=zb;kb.transactionBuilder=Bne});var x2=_(Mb=>{"use strict";a();Object.defineProperty(Mb,"__esModule",{value:!0});var zne=$h(),kne=FP(),Cne=Eb(),Cb=class t{constructor(e=[],r={}){this.builders=e,this.options=r}prepend(e){let r=Array.isArray(e)?e:[e];return new t([...r,...this.builders],this.options)}append(e){let r=Array.isArray(e)?e:[e];return new t([...this.builders,...r],this.options)}add(e){return this.append(e)}sequential(){return new t(this.builders,{...this.options,parallel:!1})}parallel(){return new t(this.builders,{...this.options,parallel:!0})}isParallel(){return this.options.parallel??!1}merge(){return this.builders.length===0?new kne.TransactionBuilder:this.builders.reduce((e,r)=>e.add(r),this.builders[0].empty())}build(e){return this.builders.map(r=>r.build(e))}async setLatestBlockhash(e){if(!this.builders.some(i=>!i.options.blockhash))return this;let n=await e.rpc.getLatestBlockhash();return this.map(i=>i.options.blockhash?i:i.setBlockhash(n))}async buildWithLatestBlockhash(e){return(await this.setLatestBlockhash(e)).build(e)}async buildAndSign(e){let r=await this.buildWithLatestBlockhash(e),n=this.builders.map(i=>i.getSigners(e));return zne.signAllTransactions(Cne.zipMap(r,n,(i,s)=>({transaction:i,signers:s??[]})))}async send(e,r={}){return this.runAll(await this.buildAndSign(e),async n=>e.rpc.sendTransaction(n,r))}async sendAndConfirm(e,r={}){let n=this.builders.find(s=>typeof s.options.blockhash=="object")?.options.blockhash,i;if(r.confirm?.strategy)i=r.confirm.strategy;else{let s=n??await e.rpc.getLatestBlockhash();i=r.confirm?.strategy??{type:"blockhash",...s}}return this.runAll(await this.buildAndSign(e),async s=>{let o=await e.rpc.sendTransaction(s,r.send),c=await e.rpc.confirmTransaction(o,{...r.confirm,strategy:i});return{signature:o,result:c}})}map(e){return new t(this.builders.map(e))}filter(e){return new t(this.builders.filter(e))}async runAll(e,r){return this.isParallel()?Promise.all(e.map(r)):e.reduce(async(n,...i)=>[...await n,await r(...i)],Promise.resolve([]))}};function Mne(t=[]){return new Cb(t)}Mb.TransactionBuilderGroup=Cb;Mb.transactionBuilderGroup=Mne});var P2=_(Nb=>{"use strict";a();Object.defineProperty(Nb,"__esModule",{value:!0});var Nne=CP(),Lne=()=>I2(),I2=()=>({...Nne.createNullContext(),use(t){return t.install(this),this}});Nb.createBaseUmi=I2;Nb.createUmi=Lne});var R2=_(jP=>{"use strict";a();Object.defineProperty(jP,"__esModule",{value:!0});var Dne=As(),WP=class extends Dne.SdkError{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i,n)}};jP.InvalidBaseStringError=WP});var O2=_(GP=>{"use strict";a();Object.defineProperty(GP,"__esModule",{value:!0});var qne=_b(),HP=class extends qne.UmiError{name="ProgramError";constructor(e,r,n){super(e,"program",`${r.name} [${r.publicKey}]`,n),this.program=r,this.logs=n?.logs,this.logs&&(this.message+=`
Program Logs:
${this.logs.map(i=>`| ${i}`).join(`
`)}
-`)}};Aw.ProgramError=_w});var re=S(G=>{"use strict";a();Object.defineProperty(G,"__esModule",{value:!0});var Ik=uv(),Pk=wy(),Gr=tk(),Sw=rk(),Me=uk(),VY=Ry(),FY=lk(),KY=aw(),Wy=hk(),WY=jE(),jY=GE(),nc=pk(),Rk=gk(),HY=ZE(),Ok=yk(),vw=fw(),GY=bk(),$Y=XE(),ZY=QE(),YY=tw(),$u=jf(),Zu=_k(),Bk=Ly(),Tk=yw(),zk=Sk(),XY=nw(),kk=Ek(),JY=sw(),QY=zE(),eX=qE(),tX=Fi(),rX=wk(),nX=xk(),iX=Vi(),sX=Py(),oX=OE(),aX=ME(),Ew=By(),cX=uw();G.Endian=Gr.Endian;G.base10=Gr.base10;G.base16=Gr.base16;G.base58=Gr.base58;G.base64=Gr.base64;G.baseX=Gr.baseX;G.bitArray=Gr.bitArray;G.fixBytes=Gr.fixBytes;G.fixSerializer=Gr.fixSerializer;G.mapSerializer=Gr.mapSerializer;G.mergeBytes=Gr.mergeBytes;G.padBytes=Gr.padBytes;G.padNullCharacters=Gr.padNullCharacters;G.removeNullCharacters=Gr.removeNullCharacters;G.reverseSerializer=Gr.reverseSerializer;G.utf8=Gr.utf8;G.ACCOUNT_HEADER_SIZE=Sw.ACCOUNT_HEADER_SIZE;G.assertAccountExists=Sw.assertAccountExists;G.deserializeAccount=Sw.deserializeAccount;G.absoluteAmount=Me.absoluteAmount;G.addAmounts=Me.addAmounts;G.amountToNumber=Me.amountToNumber;G.amountToString=Me.amountToString;G.assertAmount=Me.assertAmount;G.assertSameAmounts=Me.assertSameAmounts;G.assertSolAmount=Me.assertSolAmount;G.compareAmounts=Me.compareAmounts;G.createAmount=Me.createAmount;G.createAmountFromDecimals=Me.createAmountFromDecimals;G.displayAmount=Me.displayAmount;G.divideAmount=Me.divideAmount;G.isAmount=Me.isAmount;G.isEqualToAmount=Me.isEqualToAmount;G.isGreaterThanAmount=Me.isGreaterThanAmount;G.isGreaterThanOrEqualToAmount=Me.isGreaterThanOrEqualToAmount;G.isLessThanAmount=Me.isLessThanAmount;G.isLessThanOrEqualToAmount=Me.isLessThanOrEqualToAmount;G.isNegativeAmount=Me.isNegativeAmount;G.isPositiveAmount=Me.isPositiveAmount;G.isSolAmount=Me.isSolAmount;G.isZeroAmount=Me.isZeroAmount;G.lamports=Me.lamports;G.mapAmountSerializer=Me.mapAmountSerializer;G.microLamports=Me.microLamports;G.microSol=Me.microSol;G.multiplyAmount=Me.multiplyAmount;G.percentAmount=Me.percentAmount;G.sameAmounts=Me.sameAmounts;G.sol=Me.sol;G.subtractAmounts=Me.subtractAmounts;G.tokenAmount=Me.tokenAmount;G.usd=Me.usd;G.createBigInt=VY.createBigInt;G.resolveClusterFromEndpoint=FY.resolveClusterFromEndpoint;G.createNullContext=KY.createNullContext;G.dateTime=Wy.dateTime;G.formatDateTime=Wy.formatDateTime;G.mapDateTimeSerializer=Wy.mapDateTimeSerializer;G.now=Wy.now;G.createNullDownloader=WY.createNullDownloader;G.createNullEddsa=jY.createNullEddsa;G.createBrowserFileFromGenericFile=nc.createBrowserFileFromGenericFile;G.createGenericFile=nc.createGenericFile;G.createGenericFileFromBrowserFile=nc.createGenericFileFromBrowserFile;G.createGenericFileFromJson=nc.createGenericFileFromJson;G.getBytesFromGenericFiles=nc.getBytesFromGenericFiles;G.isGenericFile=nc.isGenericFile;G.parseJsonFromGenericFile=nc.parseJsonFromGenericFile;G.GpaBuilder=Rk.GpaBuilder;G.gpaBuilder=Rk.gpaBuilder;G.createNullHttp=HY.createNullHttp;G.HttpRequestBuilder=Ok.HttpRequestBuilder;G.request=Ok.request;G.createSignerFromKeypair=vw.createSignerFromKeypair;G.generateSigner=vw.generateSigner;G.isKeypairSigner=vw.isKeypairSigner;G.isErrorWithLogs=GY.isErrorWithLogs;G.createNullProgramRepository=$Y.createNullProgramRepository;G.createNullRpc=ZY.createNullRpc;G.createNullSerializer=YY.createNullSerializer;G.createNoopSigner=$u.createNoopSigner;G.createNullSigner=$u.createNullSigner;G.isSigner=$u.isSigner;G.signAllTransactions=$u.signAllTransactions;G.signTransaction=$u.signTransaction;G.uniqueSigners=$u.uniqueSigners;G.generatedSignerIdentity=Zu.generatedSignerIdentity;G.generatedSignerPayer=Zu.generatedSignerPayer;G.keypairIdentity=Zu.keypairIdentity;G.keypairPayer=Zu.keypairPayer;G.signerIdentity=Zu.signerIdentity;G.signerPayer=Zu.signerPayer;G.TRANSACTION_SIZE_LIMIT=Bk.TRANSACTION_SIZE_LIMIT;G.addTransactionSignature=Bk.addTransactionSignature;G.TransactionBuilder=Tk.TransactionBuilder;G.transactionBuilder=Tk.transactionBuilder;G.TransactionBuilderGroup=zk.TransactionBuilderGroup;G.transactionBuilderGroup=zk.transactionBuilderGroup;G.createNullTransactionFactory=XY.createNullTransactionFactory;G.createBaseUmi=kk.createBaseUmi;G.createUmi=kk.createUmi;G.createNullUploader=JY.createNullUploader;G.AccountNotFoundError=QY.AccountNotFoundError;G.AmountMismatchError=eX.AmountMismatchError;G.InterfaceImplementationMissingError=tX.InterfaceImplementationMissingError;G.InvalidBaseStringError=rX.InvalidBaseStringError;G.ProgramError=nX.ProgramError;G.SdkError=iX.SdkError;G.UmiError=sX.UmiError;G.UnexpectedAccountError=oX.UnexpectedAccountError;G.UnexpectedAmountError=aX.UnexpectedAmountError;G.chunk=Ew.chunk;G.uniqueBy=Ew.uniqueBy;G.zipMap=Ew.zipMap;G.generateRandomString=cX.generateRandomString;Object.keys(Ik).forEach(function(t){t!=="default"&&!G.hasOwnProperty(t)&&Object.defineProperty(G,t,{enumerable:!0,get:function(){return Ik[t]}})});Object.keys(Pk).forEach(function(t){t!=="default"&&!G.hasOwnProperty(t)&&Object.defineProperty(G,t,{enumerable:!0,get:function(){return Pk[t]}})})});var q=S(jy=>{"use strict";a();Object.defineProperty(jy,"__esModule",{value:!0});var Ck=rc();Object.keys(Ck).forEach(function(t){t!=="default"&&!jy.hasOwnProperty(t)&&Object.defineProperty(jy,t,{enumerable:!0,get:function(){return Ck[t]}})})});var Dk=S(st=>{"use strict";a();Object.defineProperty(st,"__esModule",{value:!0});st.safeFetchAssetSignerFromSeeds=st.fetchAssetSignerFromSeeds=st.findAssetSignerPda=st.getAssetSignerSize=st.getAssetSignerGpaBuilder=st.safeFetchAllAssetSigner=st.fetchAllAssetSigner=st.safeFetchAssetSigner=st.fetchAssetSigner=st.deserializeAssetSigner=st.getAssetSignerAccountDataSerializer=void 0;var Io=re(),$f=q();function Nk(){return(0,$f.struct)([["data",(0,$f.bytes)()]],{description:"AssetSignerAccountData"})}st.getAssetSignerAccountDataSerializer=Nk;function Yu(t){return(0,Io.deserializeAccount)(t,Nk())}st.deserializeAssetSigner=Yu;async function Mk(t,e,r){let n=await t.rpc.getAccount((0,Io.publicKey)(e,!1),r);return(0,Io.assertAccountExists)(n,"AssetSigner"),Yu(n)}st.fetchAssetSigner=Mk;async function Lk(t,e,r){let n=await t.rpc.getAccount((0,Io.publicKey)(e,!1),r);return n.exists?Yu(n):null}st.safeFetchAssetSigner=Lk;async function uX(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Io.publicKey)(i,!1)),r)).map(i=>((0,Io.assertAccountExists)(i,"AssetSigner"),Yu(i)))}st.fetchAllAssetSigner=uX;async function lX(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Io.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Yu(i))}st.safeFetchAllAssetSigner=lX;function dX(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Io.gpaBuilder)(t,e).registerFields({data:[0,(0,$f.bytes)()]}).deserializeUsing(r=>Yu(r))}st.getAssetSignerGpaBuilder=dX;function fX(){return 0}st.getAssetSignerSize=fX;function ww(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return t.eddsa.findPda(r,[(0,$f.string)({size:"variable"}).serialize("mpl-core-execute"),(0,$f.publicKey)().serialize(e.asset)])}st.findAssetSignerPda=ww;async function hX(t,e,r){return Mk(t,ww(t,e),r)}st.fetchAssetSignerFromSeeds=hX;async function pX(t,e,r){return Lk(t,ww(t,e),r)}st.safeFetchAssetSignerFromSeeds=pX});var qk=S(Hy=>{"use strict";a();Object.defineProperty(Hy,"__esModule",{value:!0});Hy.getAddBlockerSerializer=void 0;var gX=q();function yX(){return(0,gX.struct)([],{description:"AddBlocker"})}Hy.getAddBlockerSerializer=yX});var Uk=S(Gy=>{"use strict";a();Object.defineProperty(Gy,"__esModule",{value:!0});Gy.getAttributeSerializer=void 0;var xw=q();function mX(){return(0,xw.struct)([["key",(0,xw.string)()],["value",(0,xw.string)()]],{description:"Attribute"})}Gy.getAttributeSerializer=mX});var Fk=S($y=>{"use strict";a();Object.defineProperty($y,"__esModule",{value:!0});$y.getAttributesSerializer=void 0;var Vk=q(),bX=ae();function _X(){return(0,Vk.struct)([["attributeList",(0,Vk.array)((0,bX.getAttributeSerializer)())]],{description:"Attributes"})}$y.getAttributesSerializer=_X});var Wk=S(Zy=>{"use strict";a();Object.defineProperty(Zy,"__esModule",{value:!0});Zy.getAutographSerializer=void 0;var Kk=q(),AX=ae();function SX(){return(0,Kk.struct)([["signatures",(0,Kk.array)((0,AX.getAutographSignatureSerializer)())]],{description:"Autograph"})}Zy.getAutographSerializer=SX});var jk=S(Yy=>{"use strict";a();Object.defineProperty(Yy,"__esModule",{value:!0});Yy.getAutographSignatureSerializer=void 0;var Iw=q();function vX(){return(0,Iw.struct)([["address",(0,Iw.publicKey)()],["message",(0,Iw.string)()]],{description:"AutographSignature"})}Yy.getAutographSignatureSerializer=vX});var Gk=S(Xy=>{"use strict";a();Object.defineProperty(Xy,"__esModule",{value:!0});Xy.getBaseAgentIdentitySerializer=void 0;var Hk=q();function EX(){return(0,Hk.struct)([["uri",(0,Hk.string)()]],{description:"BaseAgentIdentity"})}Xy.getBaseAgentIdentitySerializer=EX});var $k=S(Jy=>{"use strict";a();Object.defineProperty(Jy,"__esModule",{value:!0});Jy.getBaseAgentIdentityInitInfoSerializer=void 0;var Zf=q(),Pw=ae();function wX(){return(0,Zf.struct)([["uri",(0,Zf.string)()],["initPluginAuthority",(0,Zf.option)((0,Pw.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,Zf.array)((0,Zf.tuple)([(0,Pw.getHookableLifecycleEventSerializer)(),(0,Pw.getExternalCheckResultSerializer)()]))]],{description:"BaseAgentIdentityInitInfo"})}Jy.getBaseAgentIdentityInitInfoSerializer=wX});var Yk=S(Qy=>{"use strict";a();Object.defineProperty(Qy,"__esModule",{value:!0});Qy.getBaseAgentIdentityUpdateInfoSerializer=void 0;var Xu=q(),Zk=ae();function xX(){return(0,Xu.struct)([["uri",(0,Xu.option)((0,Xu.string)())],["lifecycleChecks",(0,Xu.option)((0,Xu.array)((0,Xu.tuple)([(0,Zk.getHookableLifecycleEventSerializer)(),(0,Zk.getExternalCheckResultSerializer)()])))]],{description:"BaseAgentIdentityUpdateInfo"})}Qy.getBaseAgentIdentityUpdateInfoSerializer=xX});var Jk=S(em=>{"use strict";a();Object.defineProperty(em,"__esModule",{value:!0});em.getBaseAppDataSerializer=void 0;var IX=q(),Xk=ae();function PX(){return(0,IX.struct)([["dataAuthority",(0,Xk.getBasePluginAuthoritySerializer)()],["schema",(0,Xk.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseAppData"})}em.getBaseAppDataSerializer=PX});var Qk=S(tm=>{"use strict";a();Object.defineProperty(tm,"__esModule",{value:!0});tm.getBaseAppDataInitInfoSerializer=void 0;var Rw=q(),Ow=ae();function RX(){return(0,Rw.struct)([["dataAuthority",(0,Ow.getBasePluginAuthoritySerializer)()],["initPluginAuthority",(0,Rw.option)((0,Ow.getBasePluginAuthoritySerializer)())],["schema",(0,Rw.option)((0,Ow.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseAppDataInitInfo"})}tm.getBaseAppDataInitInfoSerializer=RX});var tC=S(rm=>{"use strict";a();Object.defineProperty(rm,"__esModule",{value:!0});rm.getBaseAppDataUpdateInfoSerializer=void 0;var eC=q(),OX=ae();function BX(){return(0,eC.struct)([["schema",(0,eC.option)((0,OX.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseAppDataUpdateInfo"})}rm.getBaseAppDataUpdateInfoSerializer=BX});var nC=S(nm=>{"use strict";a();Object.defineProperty(nm,"__esModule",{value:!0});nm.getBaseDataSectionSerializer=void 0;var TX=q(),rC=ae();function zX(){return(0,TX.struct)([["parentKey",(0,rC.getBaseLinkedDataKeySerializer)()],["schema",(0,rC.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseDataSection"})}nm.getBaseDataSectionSerializer=zX});var sC=S(im=>{"use strict";a();Object.defineProperty(im,"__esModule",{value:!0});im.getBaseDataSectionInitInfoSerializer=void 0;var kX=q(),iC=ae();function CX(){return(0,kX.struct)([["parentKey",(0,iC.getBaseLinkedDataKeySerializer)()],["schema",(0,iC.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseDataSectionInitInfo"})}im.getBaseDataSectionInitInfoSerializer=CX});var oC=S(sm=>{"use strict";a();Object.defineProperty(sm,"__esModule",{value:!0});sm.getBaseDataSectionUpdateInfoSerializer=void 0;var NX=q();function MX(){return(0,NX.struct)([],{description:"BaseDataSectionUpdateInfo"})}sm.getBaseDataSectionUpdateInfoSerializer=MX});var aC=S(Po=>{"use strict";a();Object.defineProperty(Po,"__esModule",{value:!0});Po.isBaseExternalPluginAdapterInitInfo=Po.baseExternalPluginAdapterInitInfo=Po.getBaseExternalPluginAdapterInitInfoSerializer=void 0;var an=q(),ic=ae();function LX(){return(0,an.dataEnum)([["LifecycleHook",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseLifecycleHookInitInfoSerializer)()])]])],["Oracle",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseOracleInitInfoSerializer)()])]])],["AppData",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseAppDataInitInfoSerializer)()])]])],["LinkedLifecycleHook",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseLinkedLifecycleHookInitInfoSerializer)()])]])],["LinkedAppData",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseLinkedAppDataInitInfoSerializer)()])]])],["DataSection",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseDataSectionInitInfoSerializer)()])]])],["AgentIdentity",(0,an.struct)([["fields",(0,an.tuple)([(0,ic.getBaseAgentIdentityInitInfoSerializer)()])]])]],{description:"BaseExternalPluginAdapterInitInfo"})}Po.getBaseExternalPluginAdapterInitInfoSerializer=LX;function DX(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Po.baseExternalPluginAdapterInitInfo=DX;function qX(t,e){return e.__kind===t}Po.isBaseExternalPluginAdapterInitInfo=qX});var cC=S(Ro=>{"use strict";a();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.isBaseExternalPluginAdapterKey=Ro.baseExternalPluginAdapterKey=Ro.getBaseExternalPluginAdapterKeySerializer=void 0;var kr=q(),Bw=ae();function UX(){return(0,kr.dataEnum)([["LifecycleHook",(0,kr.struct)([["fields",(0,kr.tuple)([(0,kr.publicKey)()])]])],["Oracle",(0,kr.struct)([["fields",(0,kr.tuple)([(0,kr.publicKey)()])]])],["AppData",(0,kr.struct)([["fields",(0,kr.tuple)([(0,Bw.getBasePluginAuthoritySerializer)()])]])],["LinkedLifecycleHook",(0,kr.struct)([["fields",(0,kr.tuple)([(0,kr.publicKey)()])]])],["LinkedAppData",(0,kr.struct)([["fields",(0,kr.tuple)([(0,Bw.getBasePluginAuthoritySerializer)()])]])],["DataSection",(0,kr.struct)([["fields",(0,kr.tuple)([(0,Bw.getBaseLinkedDataKeySerializer)()])]])],["AgentIdentity",(0,kr.unit)()]],{description:"BaseExternalPluginAdapterKey"})}Ro.getBaseExternalPluginAdapterKeySerializer=UX;function VX(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Ro.baseExternalPluginAdapterKey=VX;function FX(t,e){return e.__kind===t}Ro.isBaseExternalPluginAdapterKey=FX});var uC=S(Oo=>{"use strict";a();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isBaseExternalPluginAdapterUpdateInfo=Oo.baseExternalPluginAdapterUpdateInfo=Oo.getBaseExternalPluginAdapterUpdateInfoSerializer=void 0;var Nn=q(),Ju=ae();function KX(){return(0,Nn.dataEnum)([["LifecycleHook",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseLifecycleHookUpdateInfoSerializer)()])]])],["Oracle",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseOracleUpdateInfoSerializer)()])]])],["AppData",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseAppDataUpdateInfoSerializer)()])]])],["LinkedLifecycleHook",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseLinkedLifecycleHookUpdateInfoSerializer)()])]])],["LinkedAppData",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseLinkedAppDataUpdateInfoSerializer)()])]])],["AgentIdentity",(0,Nn.struct)([["fields",(0,Nn.tuple)([(0,Ju.getBaseAgentIdentityUpdateInfoSerializer)()])]])]],{description:"BaseExternalPluginAdapterUpdateInfo"})}Oo.getBaseExternalPluginAdapterUpdateInfoSerializer=KX;function WX(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Oo.baseExternalPluginAdapterUpdateInfo=WX;function jX(t,e){return e.__kind===t}Oo.isBaseExternalPluginAdapterUpdateInfo=jX});var lC=S(Bo=>{"use strict";a();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.isBaseExtraAccount=Bo.baseExtraAccount=Bo.getBaseExtraAccountSerializer=void 0;var Je=q(),HX=ae();function GX(){return(0,Je.dataEnum)([["PreconfiguredProgram",(0,Je.struct)([["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["PreconfiguredCollection",(0,Je.struct)([["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["PreconfiguredOwner",(0,Je.struct)([["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["PreconfiguredRecipient",(0,Je.struct)([["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["PreconfiguredAsset",(0,Je.struct)([["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["CustomPda",(0,Je.struct)([["seeds",(0,Je.array)((0,HX.getBaseSeedSerializer)())],["customProgramId",(0,Je.option)((0,Je.publicKey)())],["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])],["Address",(0,Je.struct)([["address",(0,Je.publicKey)()],["isSigner",(0,Je.bool)()],["isWritable",(0,Je.bool)()]])]],{description:"BaseExtraAccount"})}Bo.getBaseExtraAccountSerializer=GX;function $X(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Bo.baseExtraAccount=$X;function ZX(t,e){return e.__kind===t}Bo.isBaseExtraAccount=ZX});var dC=S(om=>{"use strict";a();Object.defineProperty(om,"__esModule",{value:!0});om.getBaseLifecycleHookSerializer=void 0;var Yf=q(),Tw=ae();function YX(){return(0,Yf.struct)([["hookedProgram",(0,Yf.publicKey)()],["extraAccounts",(0,Yf.option)((0,Yf.array)((0,Tw.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,Yf.option)((0,Tw.getBasePluginAuthoritySerializer)())],["schema",(0,Tw.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLifecycleHook"})}om.getBaseLifecycleHookSerializer=YX});var fC=S(am=>{"use strict";a();Object.defineProperty(am,"__esModule",{value:!0});am.getBaseLifecycleHookInitInfoSerializer=void 0;var Ms=q(),Qu=ae();function XX(){return(0,Ms.struct)([["hookedProgram",(0,Ms.publicKey)()],["initPluginAuthority",(0,Ms.option)((0,Qu.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,Ms.array)((0,Ms.tuple)([(0,Qu.getHookableLifecycleEventSerializer)(),(0,Qu.getExternalCheckResultSerializer)()]))],["extraAccounts",(0,Ms.option)((0,Ms.array)((0,Qu.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,Ms.option)((0,Qu.getBasePluginAuthoritySerializer)())],["schema",(0,Ms.option)((0,Qu.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLifecycleHookInitInfo"})}am.getBaseLifecycleHookInitInfoSerializer=XX});var hC=S(um=>{"use strict";a();Object.defineProperty(um,"__esModule",{value:!0});um.getBaseLifecycleHookUpdateInfoSerializer=void 0;var sc=q(),cm=ae();function JX(){return(0,sc.struct)([["lifecycleChecks",(0,sc.option)((0,sc.array)((0,sc.tuple)([(0,cm.getHookableLifecycleEventSerializer)(),(0,cm.getExternalCheckResultSerializer)()])))],["extraAccounts",(0,sc.option)((0,sc.array)((0,cm.getBaseExtraAccountSerializer)()))],["schema",(0,sc.option)((0,cm.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLifecycleHookUpdateInfo"})}um.getBaseLifecycleHookUpdateInfoSerializer=JX});var gC=S(lm=>{"use strict";a();Object.defineProperty(lm,"__esModule",{value:!0});lm.getBaseLinkedAppDataSerializer=void 0;var QX=q(),pC=ae();function eJ(){return(0,QX.struct)([["dataAuthority",(0,pC.getBasePluginAuthoritySerializer)()],["schema",(0,pC.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLinkedAppData"})}lm.getBaseLinkedAppDataSerializer=eJ});var yC=S(dm=>{"use strict";a();Object.defineProperty(dm,"__esModule",{value:!0});dm.getBaseLinkedAppDataInitInfoSerializer=void 0;var zw=q(),kw=ae();function tJ(){return(0,zw.struct)([["dataAuthority",(0,kw.getBasePluginAuthoritySerializer)()],["initPluginAuthority",(0,zw.option)((0,kw.getBasePluginAuthoritySerializer)())],["schema",(0,zw.option)((0,kw.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedAppDataInitInfo"})}dm.getBaseLinkedAppDataInitInfoSerializer=tJ});var bC=S(fm=>{"use strict";a();Object.defineProperty(fm,"__esModule",{value:!0});fm.getBaseLinkedAppDataUpdateInfoSerializer=void 0;var mC=q(),rJ=ae();function nJ(){return(0,mC.struct)([["schema",(0,mC.option)((0,rJ.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedAppDataUpdateInfo"})}fm.getBaseLinkedAppDataUpdateInfoSerializer=nJ});var _C=S(To=>{"use strict";a();Object.defineProperty(To,"__esModule",{value:!0});To.isBaseLinkedDataKey=To.baseLinkedDataKey=To.getBaseLinkedDataKeySerializer=void 0;var el=q(),iJ=ae();function sJ(){return(0,el.dataEnum)([["LinkedLifecycleHook",(0,el.struct)([["fields",(0,el.tuple)([(0,el.publicKey)()])]])],["LinkedAppData",(0,el.struct)([["fields",(0,el.tuple)([(0,iJ.getBasePluginAuthoritySerializer)()])]])]],{description:"BaseLinkedDataKey"})}To.getBaseLinkedDataKeySerializer=sJ;function oJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}To.baseLinkedDataKey=oJ;function aJ(t,e){return e.__kind===t}To.isBaseLinkedDataKey=aJ});var AC=S(hm=>{"use strict";a();Object.defineProperty(hm,"__esModule",{value:!0});hm.getBaseLinkedLifecycleHookSerializer=void 0;var Xf=q(),Cw=ae();function cJ(){return(0,Xf.struct)([["hookedProgram",(0,Xf.publicKey)()],["extraAccounts",(0,Xf.option)((0,Xf.array)((0,Cw.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,Xf.option)((0,Cw.getBasePluginAuthoritySerializer)())],["schema",(0,Cw.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLinkedLifecycleHook"})}hm.getBaseLinkedLifecycleHookSerializer=cJ});var SC=S(pm=>{"use strict";a();Object.defineProperty(pm,"__esModule",{value:!0});pm.getBaseLinkedLifecycleHookInitInfoSerializer=void 0;var Ls=q(),tl=ae();function uJ(){return(0,Ls.struct)([["hookedProgram",(0,Ls.publicKey)()],["initPluginAuthority",(0,Ls.option)((0,tl.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,Ls.array)((0,Ls.tuple)([(0,tl.getHookableLifecycleEventSerializer)(),(0,tl.getExternalCheckResultSerializer)()]))],["extraAccounts",(0,Ls.option)((0,Ls.array)((0,tl.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,Ls.option)((0,tl.getBasePluginAuthoritySerializer)())],["schema",(0,Ls.option)((0,tl.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedLifecycleHookInitInfo"})}pm.getBaseLinkedLifecycleHookInitInfoSerializer=uJ});var vC=S(ym=>{"use strict";a();Object.defineProperty(ym,"__esModule",{value:!0});ym.getBaseLinkedLifecycleHookUpdateInfoSerializer=void 0;var oc=q(),gm=ae();function lJ(){return(0,oc.struct)([["lifecycleChecks",(0,oc.option)((0,oc.array)((0,oc.tuple)([(0,gm.getHookableLifecycleEventSerializer)(),(0,gm.getExternalCheckResultSerializer)()])))],["extraAccounts",(0,oc.option)((0,oc.array)((0,gm.getBaseExtraAccountSerializer)()))],["schema",(0,oc.option)((0,gm.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedLifecycleHookUpdateInfo"})}ym.getBaseLinkedLifecycleHookUpdateInfoSerializer=lJ});var EC=S(mm=>{"use strict";a();Object.defineProperty(mm,"__esModule",{value:!0});mm.getBaseMasterEditionSerializer=void 0;var ac=q();function dJ(){return(0,ac.struct)([["maxSupply",(0,ac.option)((0,ac.u32)())],["name",(0,ac.option)((0,ac.string)())],["uri",(0,ac.option)((0,ac.string)())]],{description:"BaseMasterEdition"})}mm.getBaseMasterEditionSerializer=dJ});var xC=S(bm=>{"use strict";a();Object.defineProperty(bm,"__esModule",{value:!0});bm.getBaseOracleSerializer=void 0;var Nw=q(),wC=ae();function fJ(){return(0,Nw.struct)([["baseAddress",(0,Nw.publicKey)()],["baseAddressConfig",(0,Nw.option)((0,wC.getBaseExtraAccountSerializer)())],["resultsOffset",(0,wC.getBaseValidationResultsOffsetSerializer)()]],{description:"BaseOracle"})}bm.getBaseOracleSerializer=fJ});var IC=S(_m=>{"use strict";a();Object.defineProperty(_m,"__esModule",{value:!0});_m.getBaseOracleInitInfoSerializer=void 0;var cc=q(),Jf=ae();function hJ(){return(0,cc.struct)([["baseAddress",(0,cc.publicKey)()],["initPluginAuthority",(0,cc.option)((0,Jf.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,cc.array)((0,cc.tuple)([(0,Jf.getHookableLifecycleEventSerializer)(),(0,Jf.getExternalCheckResultSerializer)()]))],["baseAddressConfig",(0,cc.option)((0,Jf.getBaseExtraAccountSerializer)())],["resultsOffset",(0,cc.option)((0,Jf.getBaseValidationResultsOffsetSerializer)())]],{description:"BaseOracleInitInfo"})}_m.getBaseOracleInitInfoSerializer=hJ});var PC=S(Sm=>{"use strict";a();Object.defineProperty(Sm,"__esModule",{value:!0});Sm.getBaseOracleUpdateInfoSerializer=void 0;var rl=q(),Am=ae();function pJ(){return(0,rl.struct)([["lifecycleChecks",(0,rl.option)((0,rl.array)((0,rl.tuple)([(0,Am.getHookableLifecycleEventSerializer)(),(0,Am.getExternalCheckResultSerializer)()])))],["baseAddressConfig",(0,rl.option)((0,Am.getBaseExtraAccountSerializer)())],["resultsOffset",(0,rl.option)((0,Am.getBaseValidationResultsOffsetSerializer)())]],{description:"BaseOracleUpdateInfo"})}Sm.getBaseOracleUpdateInfoSerializer=pJ});var RC=S(zo=>{"use strict";a();Object.defineProperty(zo,"__esModule",{value:!0});zo.isBasePluginAuthority=zo.basePluginAuthority=zo.getBasePluginAuthoritySerializer=void 0;var nl=q();function gJ(){return(0,nl.dataEnum)([["None",(0,nl.unit)()],["Owner",(0,nl.unit)()],["UpdateAuthority",(0,nl.unit)()],["Address",(0,nl.struct)([["address",(0,nl.publicKey)()]])]],{description:"BasePluginAuthority"})}zo.getBasePluginAuthoritySerializer=gJ;function yJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}zo.basePluginAuthority=yJ;function mJ(t,e){return e.__kind===t}zo.isBasePluginAuthority=mJ});var BC=S(vm=>{"use strict";a();Object.defineProperty(vm,"__esModule",{value:!0});vm.getBaseRoyaltiesSerializer=void 0;var Mw=q(),OC=ae();function bJ(){return(0,Mw.struct)([["basisPoints",(0,Mw.u16)()],["creators",(0,Mw.array)((0,OC.getCreatorSerializer)())],["ruleSet",(0,OC.getBaseRuleSetSerializer)()]],{description:"BaseRoyalties"})}vm.getBaseRoyaltiesSerializer=bJ});var TC=S(ko=>{"use strict";a();Object.defineProperty(ko,"__esModule",{value:!0});ko.isBaseRuleSet=ko.baseRuleSet=ko.getBaseRuleSetSerializer=void 0;var Ki=q();function _J(){return(0,Ki.dataEnum)([["None",(0,Ki.unit)()],["ProgramAllowList",(0,Ki.struct)([["fields",(0,Ki.tuple)([(0,Ki.array)((0,Ki.publicKey)())])]])],["ProgramDenyList",(0,Ki.struct)([["fields",(0,Ki.tuple)([(0,Ki.array)((0,Ki.publicKey)())])]])]],{description:"BaseRuleSet"})}ko.getBaseRuleSetSerializer=_J;function AJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ko.baseRuleSet=AJ;function SJ(t,e){return e.__kind===t}ko.isBaseRuleSet=SJ});var zC=S(Co=>{"use strict";a();Object.defineProperty(Co,"__esModule",{value:!0});Co.isBaseSeed=Co.baseSeed=Co.getBaseSeedSerializer=void 0;var $n=q();function vJ(){return(0,$n.dataEnum)([["Collection",(0,$n.unit)()],["Owner",(0,$n.unit)()],["Recipient",(0,$n.unit)()],["Asset",(0,$n.unit)()],["Address",(0,$n.struct)([["fields",(0,$n.tuple)([(0,$n.publicKey)()])]])],["Bytes",(0,$n.struct)([["fields",(0,$n.tuple)([(0,$n.bytes)({size:(0,$n.u32)()})])]])]],{description:"BaseSeed"})}Co.getBaseSeedSerializer=vJ;function EJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Co.baseSeed=EJ;function wJ(t,e){return e.__kind===t}Co.isBaseSeed=wJ});var kC=S(Mo=>{"use strict";a();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.isBaseUpdateAuthority=Mo.baseUpdateAuthority=Mo.getBaseUpdateAuthoritySerializer=void 0;var No=q();function xJ(){return(0,No.dataEnum)([["None",(0,No.unit)()],["Address",(0,No.struct)([["fields",(0,No.tuple)([(0,No.publicKey)()])]])],["Collection",(0,No.struct)([["fields",(0,No.tuple)([(0,No.publicKey)()])]])]],{description:"BaseUpdateAuthority"})}Mo.getBaseUpdateAuthoritySerializer=xJ;function IJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Mo.baseUpdateAuthority=IJ;function PJ(t,e){return e.__kind===t}Mo.isBaseUpdateAuthority=PJ});var CC=S(Lo=>{"use strict";a();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.isBaseValidationResultsOffset=Lo.baseValidationResultsOffset=Lo.getBaseValidationResultsOffsetSerializer=void 0;var il=q();function RJ(){return(0,il.dataEnum)([["NoOffset",(0,il.unit)()],["Anchor",(0,il.unit)()],["Custom",(0,il.struct)([["fields",(0,il.tuple)([(0,il.u64)()])]])]],{description:"BaseValidationResultsOffset"})}Lo.getBaseValidationResultsOffsetSerializer=RJ;function OJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Lo.baseValidationResultsOffset=OJ;function BJ(t,e){return e.__kind===t}Lo.isBaseValidationResultsOffset=BJ});var NC=S(Em=>{"use strict";a();Object.defineProperty(Em,"__esModule",{value:!0});Em.getBubblegumV2Serializer=void 0;var TJ=q();function zJ(){return(0,TJ.struct)([],{description:"BubblegumV2"})}Em.getBubblegumV2Serializer=zJ});var MC=S(wm=>{"use strict";a();Object.defineProperty(wm,"__esModule",{value:!0});wm.getBurnDelegateSerializer=void 0;var kJ=q();function CJ(){return(0,kJ.struct)([],{description:"BurnDelegate"})}wm.getBurnDelegateSerializer=CJ});var DC=S(xm=>{"use strict";a();Object.defineProperty(xm,"__esModule",{value:!0});xm.getCompressionProofSerializer=void 0;var sl=q(),LC=ae();function NJ(){return(0,sl.struct)([["owner",(0,sl.publicKey)()],["updateAuthority",(0,LC.getBaseUpdateAuthoritySerializer)()],["name",(0,sl.string)()],["uri",(0,sl.string)()],["seq",(0,sl.u64)()],["plugins",(0,sl.array)((0,LC.getHashablePluginSchemaSerializer)())]],{description:"CompressionProof"})}xm.getCompressionProofSerializer=NJ});var qC=S(Im=>{"use strict";a();Object.defineProperty(Im,"__esModule",{value:!0});Im.getCreatorSerializer=void 0;var Lw=q();function MJ(){return(0,Lw.struct)([["address",(0,Lw.publicKey)()],["percentage",(0,Lw.u8)()]],{description:"Creator"})}Im.getCreatorSerializer=MJ});var VC=S(uc=>{"use strict";a();Object.defineProperty(uc,"__esModule",{value:!0});uc.getDataStateSerializer=uc.DataState=void 0;var LJ=q(),UC;(function(t){t[t.AccountState=0]="AccountState",t[t.LedgerState=1]="LedgerState"})(UC=uc.DataState||(uc.DataState={}));function DJ(){return(0,LJ.scalarEnum)(UC,{description:"DataState"})}uc.getDataStateSerializer=DJ});var KC=S(Pm=>{"use strict";a();Object.defineProperty(Pm,"__esModule",{value:!0});Pm.getEditionSerializer=void 0;var FC=q();function qJ(){return(0,FC.struct)([["number",(0,FC.u32)()]],{description:"Edition"})}Pm.getEditionSerializer=qJ});var jC=S(Rm=>{"use strict";a();Object.defineProperty(Rm,"__esModule",{value:!0});Rm.getExternalCheckResultSerializer=void 0;var WC=q();function UJ(){return(0,WC.struct)([["flags",(0,WC.u32)()]],{description:"ExternalCheckResult"})}Rm.getExternalCheckResultSerializer=UJ});var HC=S(Do=>{"use strict";a();Object.defineProperty(Do,"__esModule",{value:!0});Do.isExternalPluginAdapter=Do.externalPluginAdapter=Do.getExternalPluginAdapterSerializer=void 0;var cn=q(),lc=ae();function VJ(){return(0,cn.dataEnum)([["LifecycleHook",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseLifecycleHookSerializer)()])]])],["Oracle",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseOracleSerializer)()])]])],["AppData",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseAppDataSerializer)()])]])],["LinkedLifecycleHook",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseLinkedLifecycleHookSerializer)()])]])],["LinkedAppData",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseLinkedAppDataSerializer)()])]])],["DataSection",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseDataSectionSerializer)()])]])],["AgentIdentity",(0,cn.struct)([["fields",(0,cn.tuple)([(0,lc.getBaseAgentIdentitySerializer)()])]])]],{description:"ExternalPluginAdapter"})}Do.getExternalPluginAdapterSerializer=VJ;function FJ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Do.externalPluginAdapter=FJ;function KJ(t,e){return e.__kind===t}Do.isExternalPluginAdapter=KJ});var $C=S(dc=>{"use strict";a();Object.defineProperty(dc,"__esModule",{value:!0});dc.getExternalPluginAdapterSchemaSerializer=dc.ExternalPluginAdapterSchema=void 0;var WJ=q(),GC;(function(t){t[t.Binary=0]="Binary",t[t.Json=1]="Json",t[t.MsgPack=2]="MsgPack"})(GC=dc.ExternalPluginAdapterSchema||(dc.ExternalPluginAdapterSchema={}));function jJ(){return(0,WJ.scalarEnum)(GC,{description:"ExternalPluginAdapterSchema"})}dc.getExternalPluginAdapterSchemaSerializer=jJ});var YC=S(fc=>{"use strict";a();Object.defineProperty(fc,"__esModule",{value:!0});fc.getExternalPluginAdapterTypeSerializer=fc.ExternalPluginAdapterType=void 0;var HJ=q(),ZC;(function(t){t[t.LifecycleHook=0]="LifecycleHook",t[t.Oracle=1]="Oracle",t[t.AppData=2]="AppData",t[t.LinkedLifecycleHook=3]="LinkedLifecycleHook",t[t.LinkedAppData=4]="LinkedAppData",t[t.DataSection=5]="DataSection",t[t.AgentIdentity=6]="AgentIdentity"})(ZC=fc.ExternalPluginAdapterType||(fc.ExternalPluginAdapterType={}));function GJ(){return(0,HJ.scalarEnum)(ZC,{description:"ExternalPluginAdapterType"})}fc.getExternalPluginAdapterTypeSerializer=GJ});var XC=S(Bm=>{"use strict";a();Object.defineProperty(Bm,"__esModule",{value:!0});Bm.getExternalRegistryRecordSerializer=void 0;var Ds=q(),Om=ae();function $J(){return(0,Ds.struct)([["pluginType",(0,Om.getExternalPluginAdapterTypeSerializer)()],["authority",(0,Om.getBasePluginAuthoritySerializer)()],["lifecycleChecks",(0,Ds.option)((0,Ds.array)((0,Ds.tuple)([(0,Om.getHookableLifecycleEventSerializer)(),(0,Om.getExternalCheckResultSerializer)()])))],["offset",(0,Ds.u64)()],["dataOffset",(0,Ds.option)((0,Ds.u64)())],["dataLen",(0,Ds.option)((0,Ds.u64)())]],{description:"ExternalRegistryRecord"})}Bm.getExternalRegistryRecordSerializer=$J});var QC=S(hc=>{"use strict";a();Object.defineProperty(hc,"__esModule",{value:!0});hc.getExternalValidationResultSerializer=hc.ExternalValidationResult=void 0;var ZJ=q(),JC;(function(t){t[t.Approved=0]="Approved",t[t.Rejected=1]="Rejected",t[t.Pass=2]="Pass"})(JC=hc.ExternalValidationResult||(hc.ExternalValidationResult={}));function YJ(){return(0,ZJ.scalarEnum)(JC,{description:"ExternalValidationResult"})}hc.getExternalValidationResultSerializer=YJ});var t2=S(Tm=>{"use strict";a();Object.defineProperty(Tm,"__esModule",{value:!0});Tm.getFreezeDelegateSerializer=void 0;var e2=q();function XJ(){return(0,e2.struct)([["frozen",(0,e2.bool)()]],{description:"FreezeDelegate"})}Tm.getFreezeDelegateSerializer=XJ});var n2=S(zm=>{"use strict";a();Object.defineProperty(zm,"__esModule",{value:!0});zm.getFreezeExecuteSerializer=void 0;var r2=q();function JJ(){return(0,r2.struct)([["frozen",(0,r2.bool)()]],{description:"FreezeExecute"})}zm.getFreezeExecuteSerializer=JJ});var i2=S(km=>{"use strict";a();Object.defineProperty(km,"__esModule",{value:!0});km.getGroupsSerializer=void 0;var Dw=q();function QJ(){return(0,Dw.struct)([["groups",(0,Dw.array)((0,Dw.publicKey)())]],{description:"Groups"})}km.getGroupsSerializer=QJ});var a2=S(Cm=>{"use strict";a();Object.defineProperty(Cm,"__esModule",{value:!0});Cm.getHashablePluginSchemaSerializer=void 0;var s2=q(),o2=ae();function eQ(){return(0,s2.struct)([["index",(0,s2.u64)()],["authority",(0,o2.getBasePluginAuthoritySerializer)()],["plugin",(0,o2.getPluginSerializer)()]],{description:"HashablePluginSchema"})}Cm.getHashablePluginSchemaSerializer=eQ});var c2=S(Mm=>{"use strict";a();Object.defineProperty(Mm,"__esModule",{value:!0});Mm.getHashedAssetSchemaSerializer=void 0;var Nm=q();function tQ(){return(0,Nm.struct)([["assetHash",(0,Nm.bytes)({size:32})],["pluginHashes",(0,Nm.array)((0,Nm.bytes)({size:32}))]],{description:"HashedAssetSchema"})}Mm.getHashedAssetSchemaSerializer=tQ});var l2=S(pc=>{"use strict";a();Object.defineProperty(pc,"__esModule",{value:!0});pc.getHookableLifecycleEventSerializer=pc.HookableLifecycleEvent=void 0;var rQ=q(),u2;(function(t){t[t.Create=0]="Create",t[t.Transfer=1]="Transfer",t[t.Burn=2]="Burn",t[t.Update=3]="Update",t[t.Execute=4]="Execute"})(u2=pc.HookableLifecycleEvent||(pc.HookableLifecycleEvent={}));function nQ(){return(0,rQ.scalarEnum)(u2,{description:"HookableLifecycleEvent"})}pc.getHookableLifecycleEventSerializer=nQ});var d2=S(Lm=>{"use strict";a();Object.defineProperty(Lm,"__esModule",{value:!0});Lm.getImmutableMetadataSerializer=void 0;var iQ=q();function sQ(){return(0,iQ.struct)([],{description:"ImmutableMetadata"})}Lm.getImmutableMetadataSerializer=sQ});var h2=S(gc=>{"use strict";a();Object.defineProperty(gc,"__esModule",{value:!0});gc.getKeySerializer=gc.Key=void 0;var oQ=q(),f2;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AssetV1=1]="AssetV1",t[t.HashedAssetV1=2]="HashedAssetV1",t[t.PluginHeaderV1=3]="PluginHeaderV1",t[t.PluginRegistryV1=4]="PluginRegistryV1",t[t.CollectionV1=5]="CollectionV1",t[t.GroupV1=6]="GroupV1"})(f2=gc.Key||(gc.Key={}));function aQ(){return(0,oQ.scalarEnum)(f2,{description:"Key"})}gc.getKeySerializer=aQ});var p2=S(qo=>{"use strict";a();Object.defineProperty(qo,"__esModule",{value:!0});qo.isOracleValidation=qo.oracleValidation=qo.getOracleValidationSerializer=void 0;var qw=q(),Dm=ae();function cQ(){return(0,qw.dataEnum)([["Uninitialized",(0,qw.unit)()],["V1",(0,qw.struct)([["create",(0,Dm.getExternalValidationResultSerializer)()],["transfer",(0,Dm.getExternalValidationResultSerializer)()],["burn",(0,Dm.getExternalValidationResultSerializer)()],["update",(0,Dm.getExternalValidationResultSerializer)()]])]],{description:"OracleValidation"})}qo.getOracleValidationSerializer=cQ;function uQ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}qo.oracleValidation=uQ;function lQ(t,e){return e.__kind===t}qo.isOracleValidation=lQ});var g2=S(qm=>{"use strict";a();Object.defineProperty(qm,"__esModule",{value:!0});qm.getPermanentBurnDelegateSerializer=void 0;var dQ=q();function fQ(){return(0,dQ.struct)([],{description:"PermanentBurnDelegate"})}qm.getPermanentBurnDelegateSerializer=fQ});var m2=S(Um=>{"use strict";a();Object.defineProperty(Um,"__esModule",{value:!0});Um.getPermanentFreezeDelegateSerializer=void 0;var y2=q();function hQ(){return(0,y2.struct)([["frozen",(0,y2.bool)()]],{description:"PermanentFreezeDelegate"})}Um.getPermanentFreezeDelegateSerializer=hQ});var _2=S(Vm=>{"use strict";a();Object.defineProperty(Vm,"__esModule",{value:!0});Vm.getPermanentFreezeExecuteSerializer=void 0;var b2=q();function pQ(){return(0,b2.struct)([["frozen",(0,b2.bool)()]],{description:"PermanentFreezeExecute"})}Vm.getPermanentFreezeExecuteSerializer=pQ});var A2=S(Fm=>{"use strict";a();Object.defineProperty(Fm,"__esModule",{value:!0});Fm.getPermanentTransferDelegateSerializer=void 0;var gQ=q();function yQ(){return(0,gQ.struct)([],{description:"PermanentTransferDelegate"})}Fm.getPermanentTransferDelegateSerializer=yQ});var S2=S(Uo=>{"use strict";a();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.isPlugin=Uo.plugin=Uo.getPluginSerializer=void 0;var Be=q(),lr=ae();function mQ(){return(0,Be.dataEnum)([["Royalties",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getBaseRoyaltiesSerializer)()])]])],["FreezeDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getFreezeDelegateSerializer)()])]])],["BurnDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getBurnDelegateSerializer)()])]])],["TransferDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getTransferDelegateSerializer)()])]])],["UpdateDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getUpdateDelegateSerializer)()])]])],["PermanentFreezeDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getPermanentFreezeDelegateSerializer)()])]])],["Attributes",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getAttributesSerializer)()])]])],["PermanentTransferDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getPermanentTransferDelegateSerializer)()])]])],["PermanentBurnDelegate",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getPermanentBurnDelegateSerializer)()])]])],["Edition",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getEditionSerializer)()])]])],["MasterEdition",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getBaseMasterEditionSerializer)()])]])],["AddBlocker",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getAddBlockerSerializer)()])]])],["ImmutableMetadata",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getImmutableMetadataSerializer)()])]])],["VerifiedCreators",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getVerifiedCreatorsSerializer)()])]])],["Autograph",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getAutographSerializer)()])]])],["BubblegumV2",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getBubblegumV2Serializer)()])]])],["FreezeExecute",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getFreezeExecuteSerializer)()])]])],["PermanentFreezeExecute",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getPermanentFreezeExecuteSerializer)()])]])],["Groups",(0,Be.struct)([["fields",(0,Be.tuple)([(0,lr.getGroupsSerializer)()])]])]],{description:"Plugin"})}Uo.getPluginSerializer=mQ;function bQ(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Uo.plugin=bQ;function _Q(t,e){return e.__kind===t}Uo.isPlugin=_Q});var w2=S(Km=>{"use strict";a();Object.defineProperty(Km,"__esModule",{value:!0});Km.getPluginAuthorityPairSerializer=void 0;var v2=q(),E2=ae();function AQ(){return(0,v2.struct)([["plugin",(0,E2.getPluginSerializer)()],["authority",(0,v2.option)((0,E2.getBasePluginAuthoritySerializer)())]],{description:"PluginAuthorityPair"})}Km.getPluginAuthorityPairSerializer=AQ});var I2=S(yc=>{"use strict";a();Object.defineProperty(yc,"__esModule",{value:!0});yc.getPluginTypeSerializer=yc.PluginType=void 0;var SQ=q(),x2;(function(t){t[t.Royalties=0]="Royalties",t[t.FreezeDelegate=1]="FreezeDelegate",t[t.BurnDelegate=2]="BurnDelegate",t[t.TransferDelegate=3]="TransferDelegate",t[t.UpdateDelegate=4]="UpdateDelegate",t[t.PermanentFreezeDelegate=5]="PermanentFreezeDelegate",t[t.Attributes=6]="Attributes",t[t.PermanentTransferDelegate=7]="PermanentTransferDelegate",t[t.PermanentBurnDelegate=8]="PermanentBurnDelegate",t[t.Edition=9]="Edition",t[t.MasterEdition=10]="MasterEdition",t[t.AddBlocker=11]="AddBlocker",t[t.ImmutableMetadata=12]="ImmutableMetadata",t[t.VerifiedCreators=13]="VerifiedCreators",t[t.Autograph=14]="Autograph",t[t.BubblegumV2=15]="BubblegumV2",t[t.FreezeExecute=16]="FreezeExecute",t[t.PermanentFreezeExecute=17]="PermanentFreezeExecute",t[t.Groups=18]="Groups"})(x2=yc.PluginType||(yc.PluginType={}));function vQ(){return(0,SQ.scalarEnum)(x2,{description:"PluginType"})}yc.getPluginTypeSerializer=vQ});var O2=S(Wm=>{"use strict";a();Object.defineProperty(Wm,"__esModule",{value:!0});Wm.getRegistryRecordSerializer=void 0;var P2=q(),R2=ae();function EQ(){return(0,P2.struct)([["pluginType",(0,R2.getPluginTypeSerializer)()],["authority",(0,R2.getBasePluginAuthoritySerializer)()],["offset",(0,P2.u64)()]],{description:"RegistryRecord"})}Wm.getRegistryRecordSerializer=EQ});var T2=S(jm=>{"use strict";a();Object.defineProperty(jm,"__esModule",{value:!0});jm.getRelationshipEntrySerializer=void 0;var B2=q(),wQ=ae();function xQ(){return(0,B2.struct)([["kind",(0,wQ.getRelationshipKindSerializer)()],["key",(0,B2.publicKey)()]],{description:"RelationshipEntry"})}jm.getRelationshipEntrySerializer=xQ});var k2=S(mc=>{"use strict";a();Object.defineProperty(mc,"__esModule",{value:!0});mc.getRelationshipKindSerializer=mc.RelationshipKind=void 0;var IQ=q(),z2;(function(t){t[t.Collection=0]="Collection",t[t.ChildGroup=1]="ChildGroup",t[t.ParentGroup=2]="ParentGroup",t[t.Asset=3]="Asset"})(z2=mc.RelationshipKind||(mc.RelationshipKind={}));function PQ(){return(0,IQ.scalarEnum)(z2,{description:"RelationshipKind"})}mc.getRelationshipKindSerializer=PQ});var C2=S(Hm=>{"use strict";a();Object.defineProperty(Hm,"__esModule",{value:!0});Hm.getTransferDelegateSerializer=void 0;var RQ=q();function OQ(){return(0,RQ.struct)([],{description:"TransferDelegate"})}Hm.getTransferDelegateSerializer=OQ});var N2=S(Gm=>{"use strict";a();Object.defineProperty(Gm,"__esModule",{value:!0});Gm.getUpdateDelegateSerializer=void 0;var Uw=q();function BQ(){return(0,Uw.struct)([["additionalDelegates",(0,Uw.array)((0,Uw.publicKey)())]],{description:"UpdateDelegate"})}Gm.getUpdateDelegateSerializer=BQ});var L2=S(bc=>{"use strict";a();Object.defineProperty(bc,"__esModule",{value:!0});bc.getUpdateTypeSerializer=bc.UpdateType=void 0;var TQ=q(),M2;(function(t){t[t.Mint=0]="Mint",t[t.Add=1]="Add",t[t.Remove=2]="Remove"})(M2=bc.UpdateType||(bc.UpdateType={}));function zQ(){return(0,TQ.scalarEnum)(M2,{description:"UpdateType"})}bc.getUpdateTypeSerializer=zQ});var q2=S(_c=>{"use strict";a();Object.defineProperty(_c,"__esModule",{value:!0});_c.getValidationResultSerializer=_c.ValidationResult=void 0;var kQ=q(),D2;(function(t){t[t.Approved=0]="Approved",t[t.Rejected=1]="Rejected",t[t.Pass=2]="Pass",t[t.ForceApproved=3]="ForceApproved"})(D2=_c.ValidationResult||(_c.ValidationResult={}));function CQ(){return(0,kQ.scalarEnum)(D2,{description:"ValidationResult"})}_c.getValidationResultSerializer=CQ});var V2=S($m=>{"use strict";a();Object.defineProperty($m,"__esModule",{value:!0});$m.getVerifiedCreatorsSerializer=void 0;var U2=q(),NQ=ae();function MQ(){return(0,U2.struct)([["signatures",(0,U2.array)((0,NQ.getVerifiedCreatorsSignatureSerializer)())]],{description:"VerifiedCreators"})}$m.getVerifiedCreatorsSerializer=MQ});var F2=S(Zm=>{"use strict";a();Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getVerifiedCreatorsSignatureSerializer=void 0;var Vw=q();function LQ(){return(0,Vw.struct)([["address",(0,Vw.publicKey)()],["verified",(0,Vw.bool)()]],{description:"VerifiedCreatorsSignature"})}Zm.getVerifiedCreatorsSignatureSerializer=LQ});var ae=S(ie=>{"use strict";a();var DQ=ie&&ie.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),le=ie&&ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DQ(e,t,r)};Object.defineProperty(ie,"__esModule",{value:!0});le(qk(),ie);le(Uk(),ie);le(Fk(),ie);le(Wk(),ie);le(jk(),ie);le(Gk(),ie);le($k(),ie);le(Yk(),ie);le(Jk(),ie);le(Qk(),ie);le(tC(),ie);le(nC(),ie);le(sC(),ie);le(oC(),ie);le(aC(),ie);le(cC(),ie);le(uC(),ie);le(lC(),ie);le(dC(),ie);le(fC(),ie);le(hC(),ie);le(gC(),ie);le(yC(),ie);le(bC(),ie);le(_C(),ie);le(AC(),ie);le(SC(),ie);le(vC(),ie);le(EC(),ie);le(xC(),ie);le(IC(),ie);le(PC(),ie);le(RC(),ie);le(BC(),ie);le(TC(),ie);le(zC(),ie);le(kC(),ie);le(CC(),ie);le(NC(),ie);le(MC(),ie);le(DC(),ie);le(qC(),ie);le(VC(),ie);le(KC(),ie);le(jC(),ie);le(HC(),ie);le($C(),ie);le(YC(),ie);le(XC(),ie);le(QC(),ie);le(t2(),ie);le(n2(),ie);le(i2(),ie);le(a2(),ie);le(c2(),ie);le(l2(),ie);le(d2(),ie);le(h2(),ie);le(p2(),ie);le(g2(),ie);le(m2(),ie);le(_2(),ie);le(A2(),ie);le(S2(),ie);le(w2(),ie);le(I2(),ie);le(O2(),ie);le(T2(),ie);le(k2(),ie);le(C2(),ie);le(N2(),ie);le(L2(),ie);le(q2(),ie);le(V2(),ie);le(F2(),ie)});var W2=S(Ym=>{"use strict";a();Object.defineProperty(Ym,"__esModule",{value:!0});Ym.getAssetV1AccountDataSerializer=void 0;var ol=q(),K2=ae();function qQ(){return(0,ol.struct)([["key",(0,K2.getKeySerializer)()],["owner",(0,ol.publicKey)()],["updateAuthority",(0,K2.getBaseUpdateAuthoritySerializer)()],["name",(0,ol.string)()],["uri",(0,ol.string)()],["seq",(0,ol.option)((0,ol.u64)())]],{description:"AssetV1AccountData"})}Ym.getAssetV1AccountDataSerializer=qQ});var Fw=S(Vo=>{"use strict";a();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.royaltiesFromBase=Vo.royaltiesToBase=Vo.ruleSetToBase=void 0;function j2(t){if(t.__kind)return t;let r=t;return r.type==="ProgramAllowList"||r.type==="ProgramDenyList"?{__kind:r.type,fields:[r.addresses]}:{__kind:r.type}}Vo.ruleSetToBase=j2;function UQ(t){return{...t,ruleSet:j2(t.ruleSet)}}Vo.royaltiesToBase=UQ;function VQ(t){let e;return t.ruleSet.__kind==="ProgramAllowList"?e={...t.ruleSet,type:"ProgramAllowList",addresses:t.ruleSet.fields[0]}:t.ruleSet.__kind==="ProgramDenyList"?e={...t.ruleSet,type:"ProgramDenyList",addresses:t.ruleSet.fields[0]}:e={...t.ruleSet,type:t.ruleSet.__kind},{...t,ruleSet:e}}Vo.royaltiesFromBase=VQ});var Xm=S(qs=>{"use strict";a();Object.defineProperty(qs,"__esModule",{value:!0});qs.utf8Count=FQ;qs.utf8EncodeJs=H2;qs.utf8EncodeTE=G2;qs.utf8Encode=jQ;qs.utf8DecodeJs=$2;qs.utf8DecodeTD=Z2;qs.utf8Decode=ZQ;function FQ(t){let e=t.length,r=0,n=0;for(;n<e;){let i=t.charCodeAt(n++);if((i&4294967168)===0){r++;continue}else if((i&4294965248)===0)r+=2;else{if(i>=55296&&i<=56319&&n<e){let s=t.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?r+=3:r+=4}}return r}function H2(t,e,r){let n=t.length,i=r,s=0;for(;s<n;){let o=t.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){let c=t.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}var KQ=new TextEncoder,WQ=50;function G2(t,e,r){KQ.encodeInto(t,e.subarray(r))}function jQ(t,e,r){t.length>WQ?G2(t,e,r):H2(t,e,r)}var HQ=4096;function $2(t,e,r){let n=e,i=n+r,s=[],o="";for(;n<i;){let c=t[n++];if((c&128)===0)s.push(c);else if((c&224)===192){let u=t[n++]&63;s.push((c&31)<<6|u)}else if((c&240)===224){let u=t[n++]&63,d=t[n++]&63;s.push((c&31)<<12|u<<6|d)}else if((c&248)===240){let u=t[n++]&63,d=t[n++]&63,f=t[n++]&63,m=(c&7)<<18|u<<12|d<<6|f;m>65535&&(m-=65536,s.push(m>>>10&1023|55296),m=56320|m&1023),s.push(m)}else s.push(c);s.length>=HQ&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}var GQ=new TextDecoder,$Q=200;function Z2(t,e,r){let n=t.subarray(e,e+r);return GQ.decode(n)}function ZQ(t,e,r){return r>$Q?Z2(t,e,r):$2(t,e,r)}});var Ww=S(Jm=>{"use strict";a();Object.defineProperty(Jm,"__esModule",{value:!0});Jm.ExtData=void 0;var Kw=class{type;data;constructor(e,r){this.type=e,this.data=r}};Jm.ExtData=Kw});var e1=S(Qm=>{"use strict";a();Object.defineProperty(Qm,"__esModule",{value:!0});Qm.DecodeError=void 0;var jw=class t extends Error{constructor(e){super(e);let r=Object.create(t.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:t.name})}};Qm.DecodeError=jw});var t1=S(Fo=>{"use strict";a();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.UINT32_MAX=void 0;Fo.setUint64=YQ;Fo.setInt64=XQ;Fo.getInt64=JQ;Fo.getUint64=QQ;Fo.UINT32_MAX=4294967295;function YQ(t,e,r){let n=r/4294967296,i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function XQ(t,e,r){let n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function JQ(t,e){let r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function QQ(t,e){let r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}});var Hw=S(Zn=>{"use strict";a();Object.defineProperty(Zn,"__esModule",{value:!0});Zn.timestampExtension=Zn.EXT_TIMESTAMP=void 0;Zn.encodeTimeSpecToTimestamp=X2;Zn.encodeDateToTimeSpec=J2;Zn.encodeTimestampExtension=Q2;Zn.decodeTimestampToTimeSpec=eN;Zn.decodeTimestampExtension=tN;var eee=e1(),Y2=t1();Zn.EXT_TIMESTAMP=-1;var tee=4294967296-1,ree=17179869184-1;function X2({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=ree)if(e===0&&t<=tee){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{let r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|r&3),s.setUint32(4,n),i}else{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),(0,Y2.setInt64)(n,4,t),r}}function J2(t){let e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function Q2(t){if(t instanceof Date){let e=J2(t);return X2(e)}else return null}function eN(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,s=r>>>2;return{sec:i,nsec:s}}case 12:{let r=(0,Y2.getInt64)(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new eee.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function tN(t){let e=eN(t);return new Date(e.sec*1e3+e.nsec/1e6)}Zn.timestampExtension={type:Zn.EXT_TIMESTAMP,encode:Q2,decode:tN}});var i1=S(n1=>{"use strict";a();Object.defineProperty(n1,"__esModule",{value:!0});n1.ExtensionCodec=void 0;var r1=Ww(),nee=Hw(),Gw=class t{static defaultCodec=new t;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(nee.timestampExtension)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{let i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){let i=this.builtInEncoders[n];if(i!=null){let s=i(e,r);if(s!=null){let o=-1-n;return new r1.ExtData(o,s)}}}for(let n=0;n<this.encoders.length;n++){let i=this.encoders[n];if(i!=null){let s=i(e,r);if(s!=null){let o=n;return new r1.ExtData(o,s)}}}return e instanceof r1.ExtData?e:null}decode(e,r,n){let i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new r1.ExtData(r,e)}};n1.ExtensionCodec=Gw});var Zw=S($w=>{"use strict";a();Object.defineProperty($w,"__esModule",{value:!0});$w.ensureUint8Array=see;function iee(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function see(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):iee(t)?new Uint8Array(t):Uint8Array.from(t)}});var Xw=S(Wi=>{"use strict";a();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.Encoder=Wi.DEFAULT_INITIAL_BUFFER_SIZE=Wi.DEFAULT_MAX_DEPTH=void 0;var rN=Xm(),oee=i1(),nN=t1(),aee=Zw();Wi.DEFAULT_MAX_DEPTH=100;Wi.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Yw=class t{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??oee.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??Wi.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??Wi.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new t({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,r)}ensureBufferSizeToWrite(e){let r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){let r=new ArrayBuffer(e),n=new Uint8Array(r),i=new DataView(r);n.set(this.bytes),this.view=i,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let n=(0,rN.utf8Count)(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),(0,rN.utf8Encode)(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,r){let n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);let n=(0,aee.ensureUint8Array)(e);this.writeU8a(n)}encodeArray(e,r){let n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(let i of e)this.doEncode(i,r+1)}countWithoutUndefined(e,r){let n=0;for(let i of r)e[i]!==void 0&&n++;return n}encodeMap(e,r){let n=Object.keys(e);this.sortKeys&&n.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(let s of n){let o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,r+1))}}encodeExtension(e){if(typeof e.data=="function"){let n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(n);return}let r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),(0,nN.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,nN.setInt64)(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};Wi.Encoder=Yw});var iN=S(Jw=>{"use strict";a();Object.defineProperty(Jw,"__esModule",{value:!0});Jw.encode=uee;var cee=Xw();function uee(t,e){return new cee.Encoder(e).encodeSharedRef(t)}});var sN=S(Qw=>{"use strict";a();Object.defineProperty(Qw,"__esModule",{value:!0});Qw.prettyByte=lee;function lee(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var oN=S(s1=>{"use strict";a();Object.defineProperty(s1,"__esModule",{value:!0});s1.CachedKeyDecoder=void 0;var dee=Xm(),fee=16,hee=16,ex=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=fee,r=hee){this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){let i=this.caches[n-1];e:for(let s of i){let o=s.bytes;for(let c=0;c<n;c++)if(o[c]!==e[r+c])continue e;return s.str}return null}store(e,r){let n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){let i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;let s=(0,dee.utf8DecodeJs)(e,r,n),o=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(o,s),s}};s1.CachedKeyDecoder=ex});var a1=S(o1=>{"use strict";a();Object.defineProperty(o1,"__esModule",{value:!0});o1.Decoder=void 0;var tx=sN(),pee=i1(),Ac=t1(),gee=Xm(),aN=Zw(),yee=oN(),Us=e1(),rx="array",eh="map_key",uN="map_value",mee=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new Us.DecodeError("The type of key must be string or number but "+typeof t)},nx=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let r=this.getUninitializedStateFromPool();r.type=rx,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){let r=this.getUninitializedStateFromPool();r.type=eh,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===rx){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===eh||e.type===uN){let n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},Qf=-1,sx=new DataView(new ArrayBuffer(0)),bee=new Uint8Array(sx.buffer);try{sx.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var cN=new RangeError("Insufficient data"),_ee=new yee.CachedKeyDecoder,ix=class t{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=sx;bytes=bee;headByte=Qf;stack=new nx;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??pee.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Ac.UINT32_MAX,this.maxBinLength=e?.maxBinLength??Ac.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??Ac.UINT32_MAX,this.maxMapLength=e?.maxMapLength??Ac.UINT32_MAX,this.maxExtLength=e?.maxExtLength??Ac.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:_ee,this.mapKeyConverter=e?.mapKeyConverter??mee}clone(){return new t({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Qf,this.stack.reset()}setBuffer(e){let r=(0,aN.ensureUint8Array)(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Qf&&!this.hasRemaining(1))this.setBuffer(e);else{let r=this.bytes.subarray(this.pos),n=(0,aN.ensureUint8Array)(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,n;for await(let c of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),r=!0}catch(u){if(!(u instanceof RangeError))throw u}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${(0,tx.prettyByte)(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,i=-1;for await(let s of e){if(r&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){let i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e<160){let i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else{let i=e-160;r=this.decodeString(i,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){let i=this.lookU8();r=this.decodeString(i,1)}else if(e===218){let i=this.lookU16();r=this.decodeString(i,2)}else if(e===219){let i=this.lookU32();r=this.decodeString(i,4)}else if(e===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===196){let i=this.lookU8();r=this.decodeBinary(i,1)}else if(e===197){let i=this.lookU16();r=this.decodeBinary(i,2)}else if(e===198){let i=this.lookU32();r=this.decodeBinary(i,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){let i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){let i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){let i=this.lookU32();r=this.decodeExtension(i,4)}else throw new Us.DecodeError(`Unrecognized type byte: ${(0,tx.prettyByte)(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===rx)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===eh){if(r==="__proto__")throw new Us.DecodeError("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=uN;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=eh;continue e}}return r}}readHeadByte(){return this.headByte===Qf&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Qf}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Us.DecodeError(`Unrecognized array type byte: ${(0,tx.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Us.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Us.DecodeError(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new Us.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw cN;let n=this.pos+r,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=(0,gee.utf8Decode)(this.bytes,n,e),this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===eh:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new Us.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw cN;let n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new Us.DecodeError(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+r),i=this.decodeBinary(e,r+1);return this.extensionCodec.decode(i,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=(0,Ac.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,Ac.getInt64)(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}};o1.Decoder=ix});var dN=S(c1=>{"use strict";a();Object.defineProperty(c1,"__esModule",{value:!0});c1.decode=Aee;c1.decodeMulti=See;var lN=a1();function Aee(t,e){return new lN.Decoder(e).decode(t)}function See(t,e){return new lN.Decoder(e).decodeMulti(t)}});var pN=S(th=>{"use strict";a();Object.defineProperty(th,"__esModule",{value:!0});th.isAsyncIterable=fN;th.asyncIterableFromStream=hN;th.ensureAsyncIterable=vee;function fN(t){return t[Symbol.asyncIterator]!=null}async function*hN(t){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}function vee(t){return fN(t)?t:hN(t)}});var gN=S(rh=>{"use strict";a();Object.defineProperty(rh,"__esModule",{value:!0});rh.decodeAsync=Eee;rh.decodeArrayStream=wee;rh.decodeMultiStream=xee;var ox=a1(),ax=pN();async function Eee(t,e){let r=(0,ax.ensureAsyncIterable)(t);return new ox.Decoder(e).decodeAsync(r)}function wee(t,e){let r=(0,ax.ensureAsyncIterable)(t);return new ox.Decoder(e).decodeArrayStream(r)}function xee(t,e){let r=(0,ax.ensureAsyncIterable)(t);return new ox.Decoder(e).decodeStream(r)}});var mN=S(ze=>{"use strict";a();Object.defineProperty(ze,"__esModule",{value:!0});ze.decodeTimestampExtension=ze.encodeTimestampExtension=ze.decodeTimestampToTimeSpec=ze.encodeTimeSpecToTimestamp=ze.encodeDateToTimeSpec=ze.EXT_TIMESTAMP=ze.ExtData=ze.ExtensionCodec=ze.Encoder=ze.DecodeError=ze.Decoder=ze.decodeMultiStream=ze.decodeArrayStream=ze.decodeAsync=ze.decodeMulti=ze.decode=ze.encode=void 0;var Iee=iN();Object.defineProperty(ze,"encode",{enumerable:!0,get:function(){return Iee.encode}});var yN=dN();Object.defineProperty(ze,"decode",{enumerable:!0,get:function(){return yN.decode}});Object.defineProperty(ze,"decodeMulti",{enumerable:!0,get:function(){return yN.decodeMulti}});var cx=gN();Object.defineProperty(ze,"decodeAsync",{enumerable:!0,get:function(){return cx.decodeAsync}});Object.defineProperty(ze,"decodeArrayStream",{enumerable:!0,get:function(){return cx.decodeArrayStream}});Object.defineProperty(ze,"decodeMultiStream",{enumerable:!0,get:function(){return cx.decodeMultiStream}});var Pee=a1();Object.defineProperty(ze,"Decoder",{enumerable:!0,get:function(){return Pee.Decoder}});var Ree=e1();Object.defineProperty(ze,"DecodeError",{enumerable:!0,get:function(){return Ree.DecodeError}});var Oee=Xw();Object.defineProperty(ze,"Encoder",{enumerable:!0,get:function(){return Oee.Encoder}});var Bee=i1();Object.defineProperty(ze,"ExtensionCodec",{enumerable:!0,get:function(){return Bee.ExtensionCodec}});var Tee=Ww();Object.defineProperty(ze,"ExtData",{enumerable:!0,get:function(){return Tee.ExtData}});var al=Hw();Object.defineProperty(ze,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return al.EXT_TIMESTAMP}});Object.defineProperty(ze,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return al.encodeDateToTimeSpec}});Object.defineProperty(ze,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return al.encodeTimeSpecToTimestamp}});Object.defineProperty(ze,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return al.decodeTimestampToTimeSpec}});Object.defineProperty(ze,"encodeTimestampExtension",{enumerable:!0,get:function(){return al.encodeTimestampExtension}});Object.defineProperty(ze,"decodeTimestampExtension",{enumerable:!0,get:function(){return al.decodeTimestampExtension}})});var cl=S(Yn=>{"use strict";a();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.unwrapOption=Yn.someOrNone=Yn.lowercaseFirstLetter=Yn.capitalizeFirstLetter=Yn.toWords=void 0;var bN=re();function zee(t){let e=/([a-z0-9])([A-Z])/g;return t.replace(e,"$1 $2")}Yn.toWords=zee;function kee(t){return t.charAt(0).toUpperCase()+t.slice(1)}Yn.capitalizeFirstLetter=kee;function Cee(t){return t.charAt(0).toLowerCase()+t.slice(1)}Yn.lowercaseFirstLetter=Cee;function Nee(t){return t!==void 0?(0,bN.some)(t):(0,bN.none)()}Yn.someOrNone=Nee;function Mee(t){return t.__option==="Some"?t.value:void 0}Yn.unwrapOption=Mee});var ux=S(ll=>{"use strict";a();Object.defineProperty(ll,"__esModule",{value:!0});ll.masterEditionFromBase=ll.masterEditionToBase=void 0;var ul=cl();function Lee(t){return{maxSupply:(0,ul.someOrNone)(t.maxSupply),name:(0,ul.someOrNone)(t.name),uri:(0,ul.someOrNone)(t.uri)}}ll.masterEditionToBase=Lee;function Dee(t){return{maxSupply:(0,ul.unwrapOption)(t.maxSupply),name:(0,ul.unwrapOption)(t.name),uri:(0,ul.unwrapOption)(t.uri)}}ll.masterEditionFromBase=Dee});var Xn=S(Ko=>{"use strict";a();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.comparePluginAuthorities=Ko.pluginAuthorityFromBase=Ko.pluginAuthorityToBase=void 0;function qee(t){return t.type==="Address"?{__kind:"Address",address:t.address}:{__kind:t.type}}Ko.pluginAuthorityToBase=qee;function Uee(t){return{type:t.__kind,address:t.address}}Ko.pluginAuthorityFromBase=Uee;function Vee(t,e){return t.type!==e.type?!1:t.address===e.address}Ko.comparePluginAuthorities=Vee});var ih=S(_t=>{"use strict";a();Object.defineProperty(_t,"__esModule",{value:!0});_t.parseExternalPluginAdapterData=_t.pluginKeyToPluginType=_t.registryRecordsToPluginsList=_t.mapPlugin=_t.mapPluginFields=_t.pluginAuthorityPairV2=_t.createPluginV2=_t.pluginAuthorityPair=_t.createPlugin=_t.formPluginHeaderV1=void 0;var dl=re(),Fee=mN(),nh=we(),Kee=cl(),_N=ux(),AN=Xn(),SN=Fw();function Wee(t){return{key:nh.Key.PluginHeaderV1,pluginRegistryOffset:t}}_t.formPluginHeaderV1=Wee;function vN(t){return t.type==="UpdateDelegate"?{__kind:t.type,fields:[t.data||{additionalDelegates:[]}]}:{__kind:t.type,fields:[t.data||{}]}}_t.createPlugin=vN;function jee(t){let{type:e,authority:r,data:n}=t;return{plugin:vN({type:e,data:n}),authority:r?(0,dl.some)(r):(0,dl.none)()}}_t.pluginAuthorityPair=jee;function EN(t){let{type:e}=t;return e==="UpdateDelegate"?{__kind:e,fields:[t||{additionalDelegates:[]}]}:e==="Royalties"?{__kind:e,fields:[(0,SN.royaltiesToBase)(t)]}:e==="MasterEdition"?{__kind:e,fields:[(0,_N.masterEditionToBase)(t)]}:{__kind:e,fields:[t||{}]}}_t.createPluginV2=EN;function Hee({type:t,authority:e,...r}){return{plugin:EN({type:t,...r}),authority:e?(0,dl.some)((0,AN.pluginAuthorityToBase)(e)):(0,dl.none)()}}_t.pluginAuthorityPairV2=Hee;function wN(t){return t.reduce((e,r)=>({...e,...r}),{})}_t.mapPluginFields=wN;function xN({plugin:t,authority:e,offset:r}){let n=(0,Kee.toWords)(t.__kind).toLowerCase().split(" ").reduce((i,s)=>i+(s.charAt(0).toUpperCase()+s.slice(1)));return t.__kind==="Royalties"?{[n]:{authority:e,offset:r,...(0,SN.royaltiesFromBase)(t.fields[0])}}:t.__kind==="MasterEdition"?{[n]:{authority:e,offset:r,...(0,_N.masterEditionFromBase)(t.fields[0])}}:{[n]:{authority:e,offset:r,..."fields"in t?wN(t.fields):{}}}}_t.mapPlugin=xN;function Gee(t,e){return t.reduce((r,n)=>{let i=(0,AN.pluginAuthorityFromBase)(n.authority),s=(0,nh.getPluginSerializer)().deserialize(e,Number(n.offset))[0];return r={...r,...xN({plugin:s,authority:i,offset:n.offset})},r},{})}_t.registryRecordsToPluginsList=Gee;function $ee(t){return t.charAt(0).toUpperCase()+t.slice(1)}_t.pluginKeyToPluginType=$ee;function Zee(t,e,r){let n;if((0,dl.isSome)(e.dataOffset)&&(0,dl.isSome)(e.dataLen)){let i=r.slice(Number(e.dataOffset.value),Number(e.dataOffset.value)+Number(e.dataLen.value));if(t.schema===nh.ExternalPluginAdapterSchema.Binary)n=i;else if(t.schema===nh.ExternalPluginAdapterSchema.Json){if(i.length!==0)try{n=JSON.parse(new TextDecoder().decode(i))}catch(s){console.warn("Invalid JSON in external plugin data",s.message)}}else t.schema===nh.ExternalPluginAdapterSchema.MsgPack&&(i.length===0?n=null:n=(0,Fee.decode)(i));return n}throw new Error("Invalid DataStore, missing dataOffset or dataLen")}_t.parseExternalPluginAdapterData=Zee});var dx=S(ji=>{"use strict";a();Object.defineProperty(ji,"__esModule",{value:!0});ji.appDataManifest=ji.appDataFromBase=ji.appDataUpdateInfoArgsToBase=ji.appDataInitInfoArgsToBase=void 0;var Yee=ih(),lx=Xn();function IN(t){return{dataAuthority:(0,lx.pluginAuthorityToBase)(t.dataAuthority),initPluginAuthority:t.initPluginAuthority?(0,lx.pluginAuthorityToBase)(t.initPluginAuthority):null,schema:t.schema??null}}ji.appDataInitInfoArgsToBase=IN;function PN(t){return{schema:t.schema??null}}ji.appDataUpdateInfoArgsToBase=PN;function RN(t,e,r){return{...t,dataAuthority:(0,lx.pluginAuthorityFromBase)(t.dataAuthority),data:(0,Yee.parseExternalPluginAdapterData)(t,e,r)}}ji.appDataFromBase=RN;ji.appDataManifest={type:"AppData",fromBase:RN,initToBase:IN,updateToBase:PN}});var vc=S(dr=>{"use strict";a();Object.defineProperty(dr,"__esModule",{value:!0});dr.lifecycleChecksFromBase=dr.lifecycleChecksToBase=dr.hookableLifecycleEventToLifecycleCheckKey=dr.lifecycleCheckKeyToEnum=dr.checkResultsToAdapterCheckResult=dr.adapterCheckResultToCheckResults=dr.CheckResult=void 0;var ON=we(),Xee=cl(),Sc;(function(t){t[t.CAN_LISTEN=0]="CAN_LISTEN",t[t.CAN_APPROVE=1]="CAN_APPROVE",t[t.CAN_REJECT=2]="CAN_REJECT"})(Sc=dr.CheckResult||(dr.CheckResult={}));var Jee=t=>{let e=[];return t.flags&1&&e.push(Sc.CAN_LISTEN),t.flags&2&&e.push(Sc.CAN_APPROVE),t.flags&4&&e.push(Sc.CAN_REJECT),e};dr.adapterCheckResultToCheckResults=Jee;var Qee=t=>{let e=0;return t.forEach(r=>{switch(r){case Sc.CAN_LISTEN:e|=1;break;case Sc.CAN_APPROVE:e|=2;break;case Sc.CAN_REJECT:e|=4;break;default:}}),{flags:e}};dr.checkResultsToAdapterCheckResult=Qee;function BN(t){return ON.HookableLifecycleEvent[(0,Xee.capitalizeFirstLetter)(t)]}dr.lifecycleCheckKeyToEnum=BN;function TN(t){return ON.HookableLifecycleEvent[t].toLowerCase()}dr.hookableLifecycleEventToLifecycleCheckKey=TN;function ete(t){return Object.keys(t).map(e=>{let r=e,n=t[r];return n?[BN(r),(0,dr.checkResultsToAdapterCheckResult)(n)]:null}).filter(e=>e!==null)}dr.lifecycleChecksToBase=ete;function tte(t){let e={};return t.forEach(([r,n])=>{e[TN(r)]=(0,dr.adapterCheckResultToCheckResults)(n)}),e}dr.lifecycleChecksFromBase=tte});var fx=S(fl=>{"use strict";a();Object.defineProperty(fl,"__esModule",{value:!0});fl.seedFromBase=fl.seedToBase=void 0;function rte(t){return t.type==="Address"?{__kind:"Address",fields:[t.pubkey]}:t.type==="Bytes"?{__kind:"Bytes",fields:[t.bytes]}:{__kind:t.type}}fl.seedToBase=rte;function nte(t){return t.__kind==="Address"?{type:"Address",pubkey:t.fields[0]}:t.__kind==="Bytes"?{type:"Bytes",bytes:t.fields[0]}:{type:t.__kind}}fl.seedFromBase=nte});var hl=S(or=>{"use strict";a();Object.defineProperty(or,"__esModule",{value:!0});or.getExtraAccountRequiredInputs=or.extraAccountFromBase=or.extraAccountToBase=or.extraAccountToAccountMeta=or.findPreconfiguredPda=or.PRECONFIGURED_SEED=void 0;var Wo=q(),zN=fx(),kN=cl();or.PRECONFIGURED_SEED="mpl-core";var ite=(t,e,r)=>t.eddsa.findPda(e,[(0,Wo.string)({size:"variable"}).serialize(or.PRECONFIGURED_SEED),(0,Wo.publicKey)().serialize(r)]);or.findPreconfiguredPda=ite;function ste(t,e,r){let n={isSigner:e.isSigner||!1,isWritable:e.isWritable||!1},i=CN(e),s=[];if(i.forEach(o=>{r[o]||s.push(o)}),s.length)throw new Error(`Missing required inputs to derive account address: ${s.join(", ")}`);switch(e.type){case"PreconfiguredProgram":return{...n,pubkey:t.eddsa.findPda(r.program,[(0,Wo.string)({size:"variable"}).serialize(or.PRECONFIGURED_SEED)])[0]};case"PreconfiguredCollection":return{...n,pubkey:(0,or.findPreconfiguredPda)(t,r.program,r.collection)[0]};case"PreconfiguredOwner":return{...n,pubkey:(0,or.findPreconfiguredPda)(t,r.program,r.owner)[0]};case"PreconfiguredRecipient":return{...n,pubkey:(0,or.findPreconfiguredPda)(t,r.program,r.recipient)[0]};case"PreconfiguredAsset":return{...n,pubkey:(0,or.findPreconfiguredPda)(t,r.program,r.asset)[0]};case"CustomPda":return{pubkey:t.eddsa.findPda(e.customProgramId?e.customProgramId:r.program,e.seeds.map(o=>{switch(o.type){case"Collection":return(0,Wo.publicKey)().serialize(r.collection);case"Owner":return(0,Wo.publicKey)().serialize(r.owner);case"Recipient":return(0,Wo.publicKey)().serialize(r.recipient);case"Asset":return(0,Wo.publicKey)().serialize(r.asset);case"Address":return(0,Wo.publicKey)().serialize(o.pubkey);case"Bytes":return o.bytes;default:throw new Error("Unknown seed type")}}))[0],...n};case"Address":return{...n,pubkey:e.address};default:throw new Error("Unknown extra account type")}}or.extraAccountToAccountMeta=ste;function ote(t){let e={isSigner:t.isSigner||!1,isWritable:t.isWritable||!1};return t.type==="CustomPda"?{__kind:"CustomPda",...e,seeds:t.seeds.map(zN.seedToBase),customProgramId:(0,kN.someOrNone)(t.customProgramId)}:t.type==="Address"?{__kind:"Address",...e,address:t.address}:{__kind:t.type,...e}}or.extraAccountToBase=ote;function ate(t){return t.__kind==="CustomPda"?{type:"CustomPda",isSigner:t.isSigner,isWritable:t.isWritable,seeds:t.seeds.map(zN.seedFromBase),customProgramId:(0,kN.unwrapOption)(t.customProgramId)}:t.__kind==="Address"?{type:"Address",isSigner:t.isSigner,isWritable:t.isWritable,address:t.address}:{type:t.__kind,isSigner:t.isSigner,isWritable:t.isWritable}}or.extraAccountFromBase=ate;var cte={PreconfiguredOwner:"owner",PreconfiguredRecipient:"recipient",PreconfiguredAsset:"asset",PreconfiguredCollection:"collection",PreconfiguredProgram:"program"};function CN(t){let e=cte[t.type];return e?[e]:t.type==="CustomPda"?t.seeds.map(r=>{switch(r.type){case"Collection":return"collection";case"Owner":return"owner";case"Recipient":return"recipient";case"Asset":return"asset";default:return null}}).filter(r=>r):[]}or.getExtraAccountRequiredInputs=CN});var qN=S(Hi=>{"use strict";a();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.lifecycleHookManifest=Hi.lifecycleHookFromBase=Hi.lifecycleHookUpdateInfoArgsToBase=Hi.lifecycleHookInitInfoArgsToBase=void 0;var px=hl(),NN=vc(),hx=Xn(),ute=ih();function MN(t){return{extraAccounts:t.extraAccounts?t.extraAccounts.map(px.extraAccountToBase):null,hookedProgram:t.hookedProgram,initPluginAuthority:t.initPluginAuthority?(0,hx.pluginAuthorityToBase)(t.initPluginAuthority):null,lifecycleChecks:(0,NN.lifecycleChecksToBase)(t.lifecycleChecks),schema:t.schema??null,dataAuthority:t.dataAuthority?(0,hx.pluginAuthorityToBase)(t.dataAuthority):null}}Hi.lifecycleHookInitInfoArgsToBase=MN;function LN(t){return{lifecycleChecks:t.lifecycleChecks?(0,NN.lifecycleChecksToBase)(t.lifecycleChecks):null,extraAccounts:t.extraAccounts?t.extraAccounts.map(px.extraAccountToBase):null,schema:t.schema??null}}Hi.lifecycleHookUpdateInfoArgsToBase=LN;function DN(t,e,r){return{...t,extraAccounts:t.extraAccounts.__option==="Some"?t.extraAccounts.value.map(px.extraAccountFromBase):void 0,data:(0,ute.parseExternalPluginAdapterData)(t,e,r),dataAuthority:t.dataAuthority.__option==="Some"?(0,hx.pluginAuthorityFromBase)(t.dataAuthority.value):void 0}}Hi.lifecycleHookFromBase=DN;Hi.lifecycleHookManifest={type:"LifecycleHook",fromBase:DN,initToBase:MN,updateToBase:LN}});var gx=S(pl=>{"use strict";a();Object.defineProperty(pl,"__esModule",{value:!0});pl.validationResultsOffsetFromBase=pl.validationResultsOffsetToBase=void 0;function lte(t){return t.type==="Custom"?{__kind:"Custom",fields:[t.offset]}:{__kind:t.type}}pl.validationResultsOffsetToBase=lte;function dte(t){return t.__kind==="Custom"?{type:"Custom",offset:t.fields[0]}:{type:t.__kind}}pl.validationResultsOffsetFromBase=dte});var mx=S(yn=>{"use strict";a();Object.defineProperty(yn,"__esModule",{value:!0});yn.oracleManifest=yn.deserializeOracleValidation=yn.findOracleAccount=yn.oracleFromBase=yn.oracleUpdateInfoArgsToBase=yn.oracleInitInfoArgsToBase=void 0;var u1=hl(),fte=we(),UN=vc(),hte=Xn(),yx=gx();function VN(t){return{baseAddress:t.baseAddress,baseAddressConfig:t.baseAddressConfig?(0,u1.extraAccountToBase)(t.baseAddressConfig):null,lifecycleChecks:(0,UN.lifecycleChecksToBase)(t.lifecycleChecks),initPluginAuthority:t.initPluginAuthority?(0,hte.pluginAuthorityToBase)(t.initPluginAuthority):null,resultsOffset:t.resultsOffset?(0,yx.validationResultsOffsetToBase)(t.resultsOffset):null}}yn.oracleInitInfoArgsToBase=VN;function FN(t){return{baseAddressConfig:t.baseAddressConfig?(0,u1.extraAccountToBase)(t.baseAddressConfig):null,lifecycleChecks:t.lifecycleChecks?(0,UN.lifecycleChecksToBase)(t.lifecycleChecks):null,resultsOffset:t.resultsOffset?(0,yx.validationResultsOffsetToBase)(t.resultsOffset):null}}yn.oracleUpdateInfoArgsToBase=FN;function KN(t,e,r){return{...t,baseAddressConfig:t.baseAddressConfig.__option==="Some"?(0,u1.extraAccountFromBase)(t.baseAddressConfig.value):void 0,resultsOffset:(0,yx.validationResultsOffsetFromBase)(t.resultsOffset)}}yn.oracleFromBase=KN;function pte(t,e,r){return e.baseAddressConfig?(0,u1.extraAccountToAccountMeta)(t,e.baseAddressConfig,{...r,program:e.baseAddress}).pubkey:e.baseAddress}yn.findOracleAccount=pte;function gte(t,e){let r=0;return e.type==="Custom"?r=Number(e.offset):e.type==="Anchor"&&(r=8),(0,fte.getOracleValidationSerializer)().deserialize(t,r)[0]}yn.deserializeOracleValidation=gte;yn.oracleManifest={type:"Oracle",fromBase:KN,initToBase:VN,updateToBase:FN}});var l1=S(gl=>{"use strict";a();Object.defineProperty(gl,"__esModule",{value:!0});gl.linkedDataKeyFromBase=gl.linkedDataKeyToBase=void 0;var WN=Xn();function yte(t){switch(t.type){case"LinkedLifecycleHook":return{__kind:t.type,fields:[t.hookedProgram]};case"LinkedAppData":return{__kind:t.type,fields:[(0,WN.pluginAuthorityToBase)(t.dataAuthority)]};default:throw new Error("Unknown LinkedDataKey type")}}gl.linkedDataKeyToBase=yte;function mte(t){switch(t.__kind){case"LinkedLifecycleHook":return{type:t.__kind,hookedProgram:t.fields[0]};case"LinkedAppData":return{type:t.__kind,dataAuthority:(0,WN.pluginAuthorityFromBase)(t.fields[0])};default:throw new Error("Unknown LinkedDataKey type")}}gl.linkedDataKeyFromBase=mte});var bx=S(d1=>{"use strict";a();Object.defineProperty(d1,"__esModule",{value:!0});d1.externalPluginAdapterKeyToBase=void 0;var bte=Xn(),_te=l1();function Ate(t){switch(t.type){case"Oracle":return{__kind:t.type,fields:[t.baseAddress]};case"AppData":case"LinkedAppData":return{__kind:t.type,fields:[(0,bte.pluginAuthorityToBase)(t.dataAuthority)]};case"LifecycleHook":return{__kind:t.type,fields:[t.hookedProgram]};case"DataSection":return{__kind:t.type,fields:[(0,_te.linkedDataKeyToBase)(t.parentKey)]};case"AgentIdentity":return{__kind:t.type};default:throw new Error("Unknown ExternalPluginAdapterKey type")}}d1.externalPluginAdapterKeyToBase=Ate});var HN=S(jN=>{"use strict";a();Object.defineProperty(jN,"__esModule",{value:!0})});var GN=S(jo=>{"use strict";a();Object.defineProperty(jo,"__esModule",{value:!0});jo.updateAuthority=jo.ruleSet=jo.pluginAuthority=void 0;var _x=we();Object.defineProperty(jo,"pluginAuthority",{enumerable:!0,get:function(){return _x.basePluginAuthority}});Object.defineProperty(jo,"ruleSet",{enumerable:!0,get:function(){return _x.baseRuleSet}});Object.defineProperty(jo,"updateAuthority",{enumerable:!0,get:function(){return _x.baseUpdateAuthority}})});var Sx=S(Gi=>{"use strict";a();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.linkedAppDataManifest=Gi.linkedAppDataFromBase=Gi.linkedAppDataUpdateInfoArgsToBase=Gi.linkedAppDataInitInfoArgsToBase=void 0;var Ax=Xn();function $N(t){return{dataAuthority:(0,Ax.pluginAuthorityToBase)(t.dataAuthority),initPluginAuthority:t.initPluginAuthority?(0,Ax.pluginAuthorityToBase)(t.initPluginAuthority):null,schema:t.schema??null}}Gi.linkedAppDataInitInfoArgsToBase=$N;function ZN(t){return{schema:t.schema??null}}Gi.linkedAppDataUpdateInfoArgsToBase=ZN;function YN(t,e,r){return{...t,dataAuthority:(0,Ax.pluginAuthorityFromBase)(t.dataAuthority)}}Gi.linkedAppDataFromBase=YN;Gi.linkedAppDataManifest={type:"LinkedAppData",fromBase:YN,initToBase:$N,updateToBase:ZN}});var vx=S($i=>{"use strict";a();Object.defineProperty($i,"__esModule",{value:!0});$i.dataSectionManifest=$i.dataSectionFromBase=$i.dataSectionUpdateInfoArgsToBase=$i.dataSectionInitInfoArgsToBase=void 0;var Ste=ih(),XN=l1(),vte=Xn();function JN(t){return{parentKey:(0,XN.linkedDataKeyToBase)(t.parentKey),schema:t.schema}}$i.dataSectionInitInfoArgsToBase=JN;function QN(t){return{}}$i.dataSectionUpdateInfoArgsToBase=QN;function eM(t,e,r){return{...t,parentKey:(0,XN.linkedDataKeyFromBase)(t.parentKey),dataAuthority:t.parentKey.__kind!=="LinkedLifecycleHook"?(0,vte.pluginAuthorityFromBase)(t.parentKey.fields[0]):void 0,data:(0,Ste.parseExternalPluginAdapterData)(t,e,r)}}$i.dataSectionFromBase=eM;$i.dataSectionManifest={type:"DataSection",fromBase:eM,initToBase:JN,updateToBase:QN}});var xx=S(Zi=>{"use strict";a();Object.defineProperty(Zi,"__esModule",{value:!0});Zi.linkedLifecycleHookManifest=Zi.linkedLifecycleHookFromBase=Zi.linkedLifecycleHookUpdateInfoArgsToBase=Zi.linkedLifecycleHookInitInfoArgsToBase=void 0;var wx=hl(),tM=vc(),Ex=Xn();function rM(t){return{extraAccounts:t.extraAccounts?t.extraAccounts.map(wx.extraAccountToBase):null,hookedProgram:t.hookedProgram,initPluginAuthority:t.initPluginAuthority?(0,Ex.pluginAuthorityToBase)(t.initPluginAuthority):null,lifecycleChecks:(0,tM.lifecycleChecksToBase)(t.lifecycleChecks),schema:t.schema?t.schema:null,dataAuthority:t.dataAuthority?(0,Ex.pluginAuthorityToBase)(t.dataAuthority):null}}Zi.linkedLifecycleHookInitInfoArgsToBase=rM;function nM(t){return{lifecycleChecks:t.lifecycleChecks?(0,tM.lifecycleChecksToBase)(t.lifecycleChecks):null,extraAccounts:t.extraAccounts?t.extraAccounts.map(wx.extraAccountToBase):null,schema:t.schema??null}}Zi.linkedLifecycleHookUpdateInfoArgsToBase=nM;function iM(t,e,r){return{...t,extraAccounts:t.extraAccounts.__option==="Some"?t.extraAccounts.value.map(wx.extraAccountFromBase):void 0,dataAuthority:t.dataAuthority.__option==="Some"?(0,Ex.pluginAuthorityFromBase)(t.dataAuthority.value):void 0}}Zi.linkedLifecycleHookFromBase=iM;Zi.linkedLifecycleHookManifest={type:"LinkedLifecycleHook",fromBase:iM,initToBase:rM,updateToBase:nM}});var Ix=S(Yi=>{"use strict";a();Object.defineProperty(Yi,"__esModule",{value:!0});Yi.agentIdentityManifest=Yi.agentIdentityFromBase=Yi.agentIdentityUpdateInfoArgsToBase=Yi.agentIdentityInitInfoArgsToBase=void 0;var sM=vc(),Ete=Xn();function oM(t){return{uri:t.uri,lifecycleChecks:(0,sM.lifecycleChecksToBase)(t.lifecycleChecks),initPluginAuthority:t.initPluginAuthority?(0,Ete.pluginAuthorityToBase)(t.initPluginAuthority):null}}Yi.agentIdentityInitInfoArgsToBase=oM;function aM(t){return{uri:t.uri??null,lifecycleChecks:t.lifecycleChecks?(0,sM.lifecycleChecksToBase)(t.lifecycleChecks):null}}Yi.agentIdentityUpdateInfoArgsToBase=aM;function cM(t,e,r){return{...t}}Yi.agentIdentityFromBase=cM;Yi.agentIdentityManifest={type:"AgentIdentity",fromBase:cM,initToBase:oM,updateToBase:aM}});var Ho=S($r=>{"use strict";a();Object.defineProperty($r,"__esModule",{value:!0});$r.findExtraAccounts=$r.createExternalPluginAdapterUpdateInfo=$r.createExternalPluginAdapterInitInfo=$r.isExternalPluginAdapterType=$r.externalRegistryRecordsToExternalPluginAdapterList=$r.externalPluginAdapterManifests=void 0;var yl=re(),Rx=$e(),wte=we(),uM=dx(),xte=vc(),lM=mx(),Px=hl(),dM=Sx(),fM=vx(),hM=xx(),pM=Ix();$r.externalPluginAdapterManifests={LifecycleHook:Rx.lifecycleHookManifest,Oracle:lM.oracleManifest,AppData:uM.appDataManifest,LinkedLifecycleHook:hM.linkedLifecycleHookManifest,LinkedAppData:dM.linkedAppDataManifest,DataSection:fM.dataSectionManifest,AgentIdentity:pM.agentIdentityManifest};function Ite(t,e){let r={};return t.forEach(n=>{let i=(0,wte.getExternalPluginAdapterSerializer)().deserialize(e,Number(n.offset))[0],s={lifecycleChecks:n.lifecycleChecks.__option==="Some"?(0,xte.lifecycleChecksFromBase)(n.lifecycleChecks.value):void 0,authority:(0,Rx.pluginAuthorityFromBase)(n.authority),offset:n.offset};i.__kind==="LifecycleHook"?(r.lifecycleHooks||(r.lifecycleHooks=[]),r.lifecycleHooks.push({type:"LifecycleHook",dataOffset:(0,yl.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,yl.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,Rx.lifecycleHookFromBase)(i.fields[0],n,e)})):i.__kind==="AppData"?(r.appDatas||(r.appDatas=[]),r.appDatas.push({type:"AppData",dataOffset:(0,yl.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,yl.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,uM.appDataFromBase)(i.fields[0],n,e)})):i.__kind==="Oracle"?(r.oracles||(r.oracles=[]),r.oracles.push({type:"Oracle",...s,...(0,lM.oracleFromBase)(i.fields[0],n,e)})):i.__kind==="LinkedLifecycleHook"?(r.linkedLifecycleHooks||(r.linkedLifecycleHooks=[]),r.linkedLifecycleHooks.push({type:"LinkedLifecycleHook",...s,...(0,hM.linkedLifecycleHookFromBase)(i.fields[0],n,e)})):i.__kind==="LinkedAppData"?(r.linkedAppDatas||(r.linkedAppDatas=[]),r.linkedAppDatas.push({type:"LinkedAppData",...s,...(0,dM.linkedAppDataFromBase)(i.fields[0],n,e)})):i.__kind==="DataSection"?(r.dataSections||(r.dataSections=[]),r.dataSections.push({type:"DataSection",dataOffset:(0,yl.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,yl.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,fM.dataSectionFromBase)(i.fields[0],n,e)})):i.__kind==="AgentIdentity"&&(r.agentIdentities||(r.agentIdentities=[]),r.agentIdentities.push({type:"AgentIdentity",...s,...(0,pM.agentIdentityFromBase)(i.fields[0],n,e)}))}),r}$r.externalRegistryRecordsToExternalPluginAdapterList=Ite;var Pte=t=>t.type==="LifecycleHook"||t.type==="Oracle"||t.type==="AppData"||t.type==="LinkedLifecycleHook"||t.type==="DataSection"||t.type==="LinkedAppData"||t.type==="AgentIdentity";$r.isExternalPluginAdapterType=Pte;function Rte({type:t,...e}){let r=$r.externalPluginAdapterManifests[t];return{__kind:t,fields:[r.initToBase(e)]}}$r.createExternalPluginAdapterInitInfo=Rte;function Ote({type:t,...e}){let r=$r.externalPluginAdapterManifests[t];return{__kind:t,fields:[r.updateToBase(e)]}}$r.createExternalPluginAdapterUpdateInfo=Ote;var Bte=(t,e,r,n)=>{let i=[];return r.oracles?.forEach(s=>{s.lifecycleChecks?.[e]&&(s.baseAddressConfig?i.push((0,Px.extraAccountToAccountMeta)(t,s.baseAddressConfig,{...n,program:s.baseAddress})):i.push({pubkey:s.baseAddress,isSigner:!1,isWritable:!1}))}),r.lifecycleHooks?.forEach(s=>{s.lifecycleChecks?.[e]&&(i.push({pubkey:s.hookedProgram,isSigner:!1,isWritable:!1}),s.extraAccounts?.forEach(o=>{i.push((0,Px.extraAccountToAccountMeta)(t,o,{...n,program:s.hookedProgram}))}))}),r.linkedLifecycleHooks?.forEach(s=>{s.lifecycleChecks?.[e]&&(i.push({pubkey:s.hookedProgram,isSigner:!1,isWritable:!1}),s.extraAccounts?.forEach(o=>{i.push((0,Px.extraAccountToAccountMeta)(t,o,{...n,program:s.hookedProgram}))}))}),i};$r.findExtraAccounts=Bte});var gM=S(f1=>{"use strict";a();Object.defineProperty(f1,"__esModule",{value:!0});f1.updateAuthorityToBase=void 0;function Tte(t){return t.type==="None"?{__kind:"None"}:{__kind:t.type,fields:[t.address]}}f1.updateAuthorityToBase=Tte});var $e=S(Ye=>{"use strict";a();var zte=Ye&&Ye.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wt=Ye&&Ye.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zte(e,t,r)};Object.defineProperty(Ye,"__esModule",{value:!0});wt(Fw(),Ye);wt(ih(),Ye);wt(dx(),Ye);wt(vc(),Ye);wt(qN(),Ye);wt(mx(),Ye);wt(bx(),Ye);wt(HN(),Ye);wt(Xn(),Ye);wt(GN(),Ye);wt(Ho(),Ye);wt(gM(),Ye);wt(fx(),Ye);wt(hl(),Ye);wt(gx(),Ye);wt(xx(),Ye);wt(Sx(),Ye);wt(vx(),Ye);wt(l1(),Ye);wt(ux(),Ye);wt(Ix(),Ye)});var sh=S(Go=>{"use strict";a();Object.defineProperty(Go,"__esModule",{value:!0});Go.getPluginRegistryV1AccountDataSerializer=Go.getAdapterRegistryRecordSerializer=Go.getRegistryRecordSerializer=void 0;var Ii=q(),Xi=we();function yM(){return{description:"RegistryRecordWithUnknown",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n,i]=[Xi.PluginType.Attributes,e+1,!0];try{[r,n]=(0,Xi.getPluginTypeSerializer)().deserialize(t,e),i=!1}catch{}let[s,o]=(0,Xi.getBasePluginAuthoritySerializer)().deserialize(t,n),[c,u]=(0,Ii.u64)().deserialize(t,o);return[{pluginType:r,authority:s,offset:c,isUnknown:i},u]}}}Go.getRegistryRecordSerializer=yM;function mM(){return{description:"AdapterRegistryRecordWithUnknown",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n,i]=[Xi.ExternalPluginAdapterType.AppData,e+1,!0];try{[r,n]=(0,Xi.getExternalPluginAdapterTypeSerializer)().deserialize(t,e),i=!1}catch{}let[s,o]=(0,Xi.getBasePluginAuthoritySerializer)().deserialize(t,n),[c,u]=(0,Ii.option)((0,Ii.array)((0,Ii.tuple)([(0,Xi.getHookableLifecycleEventSerializer)(),(0,Xi.getExternalCheckResultSerializer)()]))).deserialize(t,o),[d,f]=(0,Ii.u64)().deserialize(t,u),[m,_]=(0,Ii.option)((0,Ii.u64)()).deserialize(t,f),[v,P]=(0,Ii.option)((0,Ii.u64)()).deserialize(t,_);return[{pluginType:r,authority:s,lifecycleChecks:c,offset:d,isUnknown:i,dataOffset:m,dataLen:v},P]}}}Go.getAdapterRegistryRecordSerializer=mM;function kte(){return{description:"PluginRegistryV1AccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,Xi.getKeySerializer)().deserialize(t,e);if(r!==Xi.Key.PluginRegistryV1)throw new Error(`Expected a PluginRegistryV1 account, got key: ${r}`);let[i,s]=(0,Ii.array)(yM()).deserialize(t,n),[o,c]=(0,Ii.array)(mM()).deserialize(t,s);return[{key:r,registry:i.filter(u=>!u.isUnknown),externalRegistry:o.filter(u=>!u.isUnknown)},c]}}}Go.getPluginRegistryV1AccountDataSerializer=kte});var _M=S(h1=>{"use strict";a();Object.defineProperty(h1,"__esModule",{value:!0});h1.getAssetV1AccountDataSerializer=void 0;var bM=we(),Cte=W2(),Nte=$e(),Mte=sh(),Lte=Ho(),Dte=()=>({description:"AssetAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,Cte.getAssetV1AccountDataSerializer)().deserialize(t,e);if(r.key!==bM.Key.AssetV1)throw new Error(`Expected an Asset account, got key: ${r.key}`);let i,s,o,c,u=n;t.length!==n&&([i]=(0,bM.getPluginHeaderV1AccountDataSerializer)().deserialize(t,n),[s,u]=(0,Mte.getPluginRegistryV1AccountDataSerializer)().deserialize(t,Number(i.pluginRegistryOffset)),o=(0,Nte.registryRecordsToPluginsList)(s.registry,t),c=(0,Lte.externalRegistryRecordsToExternalPluginAdapterList)(s.externalRegistry,t));let d={type:r.updateAuthority.__kind,address:r.updateAuthority.__kind==="None"?void 0:r.updateAuthority.fields[0]};return[{pluginHeader:i,...o,...c,...r,updateAuthority:d},u]}});h1.getAssetV1AccountDataSerializer=Dte});var AM=S(p1=>{"use strict";a();Object.defineProperty(p1,"__esModule",{value:!0});p1.getCollectionV1AccountDataSerializer=void 0;var ml=q(),qte=ae();function Ute(){return(0,ml.struct)([["key",(0,qte.getKeySerializer)()],["updateAuthority",(0,ml.publicKey)()],["name",(0,ml.string)()],["uri",(0,ml.string)()],["numMinted",(0,ml.u32)()],["currentSize",(0,ml.u32)()]],{description:"CollectionV1AccountData"})}p1.getCollectionV1AccountDataSerializer=Ute});var EM=S(g1=>{"use strict";a();Object.defineProperty(g1,"__esModule",{value:!0});g1.getCollectionV1AccountDataSerializer=void 0;var SM=we(),Vte=AM(),vM=$e(),Fte=sh(),Kte=()=>({description:"CollectionAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,Vte.getCollectionV1AccountDataSerializer)().deserialize(t,e);if(r.key!==SM.Key.CollectionV1)throw new Error(`Expected an Collection account, got key: ${r.key}`);let i,s,o,c,u=n;return t.length!==n&&([i]=(0,SM.getPluginHeaderV1AccountDataSerializer)().deserialize(t,n),[s,u]=(0,Fte.getPluginRegistryV1AccountDataSerializer)().deserialize(t,Number(i.pluginRegistryOffset)),o=(0,vM.registryRecordsToPluginsList)(s.registry,t),c=(0,vM.externalRegistryRecordsToExternalPluginAdapterList)(s.externalRegistry,t)),[{pluginHeader:i,...o,...c,...r},u]}});g1.getCollectionV1AccountDataSerializer=Kte});var xM=S(y1=>{"use strict";a();Object.defineProperty(y1,"__esModule",{value:!0});y1.getGroupV1AccountDataSerializer=void 0;var Mn=q(),wM=ae();function Wte(){return(0,Mn.mapSerializer)((0,Mn.struct)([["key",(0,wM.getKeySerializer)()],["updateAuthority",(0,Mn.publicKey)()],["name",(0,Mn.string)()],["uri",(0,Mn.string)()],["collections",(0,Mn.array)((0,Mn.publicKey)())],["groups",(0,Mn.array)((0,Mn.publicKey)())],["parentGroups",(0,Mn.array)((0,Mn.publicKey)())],["assets",(0,Mn.array)((0,Mn.publicKey)())]],{description:"GroupV1AccountData"}),t=>({...t,key:wM.Key.GroupV1}))}y1.getGroupV1AccountDataSerializer=Wte});var PM=S(m1=>{"use strict";a();Object.defineProperty(m1,"__esModule",{value:!0});m1.getGroupV1AccountDataSerializer=void 0;var IM=we(),jte=xM(),Hte=$e(),Gte=Ho(),$te=sh(),Zte=()=>({description:"GroupAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let r=(0,IM.getPluginHeaderV1AccountDataSerializer)(),n=r.fixedSize;if(n===null)throw new Error("Invalid plugin header serializer configuration.");let[i,s]=(0,jte.getGroupV1AccountDataSerializer)().deserialize(t,e);if(i.key!==IM.Key.GroupV1)throw new Error(`Expected a Group account, got key: ${i.key}`);let o,c,u,d,f=s;if(t.length>s&&t.length<s+n)throw new Error("Invalid Group account data: truncated plugin header.");if(t.length>=s+n){[o]=r.deserialize(t,s);let _=Number(o.pluginRegistryOffset);if(!Number.isSafeInteger(_)||_<s+n||_>=t.length)throw new Error("Invalid Group account data: plugin registry offset is out of bounds.");if([c,f]=(0,$te.getPluginRegistryV1AccountDataSerializer)().deserialize(t,_),f>t.length)throw new Error("Invalid Group account data: plugin registry exceeds buffer length.");u=(0,Hte.registryRecordsToPluginsList)(c.registry,t),d=(0,Gte.externalRegistryRecordsToExternalPluginAdapterList)(c.externalRegistry,t)}return[{pluginHeader:o,...i,...u,...d},f]}});m1.getGroupV1AccountDataSerializer=Zte});var oh=S(Ji=>{"use strict";a();var Yte=Ji&&Ji.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),b1=Ji&&Ji.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Yte(e,t,r)};Object.defineProperty(Ji,"__esModule",{value:!0});b1(_M(),Ji);b1(EM(),Ji);b1(PM(),Ji);b1(sh(),Ji)});var OM=S(mn=>{"use strict";a();Object.defineProperty(mn,"__esModule",{value:!0});mn.getAssetV1GpaBuilder=mn.safeFetchAllAssetV1=mn.fetchAllAssetV1=mn.safeFetchAssetV1=mn.fetchAssetV1=mn.deserializeAssetV1=void 0;var $o=re(),ah=q(),Xte=oh(),RM=ae();function bl(t){return(0,$o.deserializeAccount)(t,(0,Xte.getAssetV1AccountDataSerializer)())}mn.deserializeAssetV1=bl;async function Jte(t,e,r){let n=await t.rpc.getAccount((0,$o.publicKey)(e,!1),r);return(0,$o.assertAccountExists)(n,"AssetV1"),bl(n)}mn.fetchAssetV1=Jte;async function Qte(t,e,r){let n=await t.rpc.getAccount((0,$o.publicKey)(e,!1),r);return n.exists?bl(n):null}mn.safeFetchAssetV1=Qte;async function ere(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,$o.publicKey)(i,!1)),r)).map(i=>((0,$o.assertAccountExists)(i,"AssetV1"),bl(i)))}mn.fetchAllAssetV1=ere;async function tre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,$o.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>bl(i))}mn.safeFetchAllAssetV1=tre;function rre(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,$o.gpaBuilder)(t,e).registerFields({key:[0,(0,RM.getKeySerializer)()],owner:[1,(0,ah.publicKey)()],updateAuthority:[33,(0,RM.getBaseUpdateAuthoritySerializer)()],name:[null,(0,ah.string)()],uri:[null,(0,ah.string)()],seq:[null,(0,ah.option)((0,ah.u64)())]}).deserializeUsing(r=>bl(r))}mn.getAssetV1GpaBuilder=rre});var BM=S(bn=>{"use strict";a();Object.defineProperty(bn,"__esModule",{value:!0});bn.getCollectionV1GpaBuilder=bn.safeFetchAllCollectionV1=bn.fetchAllCollectionV1=bn.safeFetchCollectionV1=bn.fetchCollectionV1=bn.deserializeCollectionV1=void 0;var Zo=re(),ch=q(),nre=oh(),ire=ae();function _l(t){return(0,Zo.deserializeAccount)(t,(0,nre.getCollectionV1AccountDataSerializer)())}bn.deserializeCollectionV1=_l;async function sre(t,e,r){let n=await t.rpc.getAccount((0,Zo.publicKey)(e,!1),r);return(0,Zo.assertAccountExists)(n,"CollectionV1"),_l(n)}bn.fetchCollectionV1=sre;async function ore(t,e,r){let n=await t.rpc.getAccount((0,Zo.publicKey)(e,!1),r);return n.exists?_l(n):null}bn.safeFetchCollectionV1=ore;async function are(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Zo.publicKey)(i,!1)),r)).map(i=>((0,Zo.assertAccountExists)(i,"CollectionV1"),_l(i)))}bn.fetchAllCollectionV1=are;async function cre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Zo.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>_l(i))}bn.safeFetchAllCollectionV1=cre;function ure(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Zo.gpaBuilder)(t,e).registerFields({key:[0,(0,ire.getKeySerializer)()],updateAuthority:[1,(0,ch.publicKey)()],name:[33,(0,ch.string)()],uri:[null,(0,ch.string)()],numMinted:[null,(0,ch.u32)()],currentSize:[null,(0,ch.u32)()]}).deserializeUsing(r=>_l(r))}bn.getCollectionV1GpaBuilder=ure});var zM=S(_n=>{"use strict";a();Object.defineProperty(_n,"__esModule",{value:!0});_n.getGroupV1GpaBuilder=_n.safeFetchAllGroupV1=_n.fetchAllGroupV1=_n.safeFetchGroupV1=_n.fetchGroupV1=_n.deserializeGroupV1=void 0;var Yo=re(),Pi=q(),lre=oh(),TM=ae();function Al(t){return(0,Yo.deserializeAccount)(t,(0,lre.getGroupV1AccountDataSerializer)())}_n.deserializeGroupV1=Al;async function dre(t,e,r){let n=await t.rpc.getAccount((0,Yo.publicKey)(e,!1),r);return(0,Yo.assertAccountExists)(n,"GroupV1"),Al(n)}_n.fetchGroupV1=dre;async function fre(t,e,r){let n=await t.rpc.getAccount((0,Yo.publicKey)(e,!1),r);return n.exists?Al(n):null}_n.safeFetchGroupV1=fre;async function hre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Yo.publicKey)(i,!1)),r)).map(i=>((0,Yo.assertAccountExists)(i,"GroupV1"),Al(i)))}_n.fetchAllGroupV1=hre;async function pre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Yo.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Al(i))}_n.safeFetchAllGroupV1=pre;function gre(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Yo.gpaBuilder)(t,e).registerFields({key:[0,(0,TM.getKeySerializer)()],updateAuthority:[1,(0,Pi.publicKey)()],name:[33,(0,Pi.string)()],uri:[null,(0,Pi.string)()],collections:[null,(0,Pi.array)((0,Pi.publicKey)())],groups:[null,(0,Pi.array)((0,Pi.publicKey)())],parentGroups:[null,(0,Pi.array)((0,Pi.publicKey)())],assets:[null,(0,Pi.array)((0,Pi.publicKey)())]}).deserializeUsing(r=>Al(r)).whereField("key",TM.Key.GroupV1)}_n.getGroupV1GpaBuilder=gre});var NM=S(Sr=>{"use strict";a();Object.defineProperty(Sr,"__esModule",{value:!0});Sr.getHashedAssetV1Size=Sr.getHashedAssetV1GpaBuilder=Sr.safeFetchAllHashedAssetV1=Sr.fetchAllHashedAssetV1=Sr.safeFetchHashedAssetV1=Sr.fetchHashedAssetV1=Sr.deserializeHashedAssetV1=Sr.getHashedAssetV1AccountDataSerializer=void 0;var Xo=re(),Ox=q(),kM=ae();function CM(){return(0,Ox.struct)([["key",(0,kM.getKeySerializer)()],["hash",(0,Ox.bytes)({size:32})]],{description:"HashedAssetV1AccountData"})}Sr.getHashedAssetV1AccountDataSerializer=CM;function Sl(t){return(0,Xo.deserializeAccount)(t,CM())}Sr.deserializeHashedAssetV1=Sl;async function yre(t,e,r){let n=await t.rpc.getAccount((0,Xo.publicKey)(e,!1),r);return(0,Xo.assertAccountExists)(n,"HashedAssetV1"),Sl(n)}Sr.fetchHashedAssetV1=yre;async function mre(t,e,r){let n=await t.rpc.getAccount((0,Xo.publicKey)(e,!1),r);return n.exists?Sl(n):null}Sr.safeFetchHashedAssetV1=mre;async function bre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Xo.publicKey)(i,!1)),r)).map(i=>((0,Xo.assertAccountExists)(i,"HashedAssetV1"),Sl(i)))}Sr.fetchAllHashedAssetV1=bre;async function _re(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Xo.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Sl(i))}Sr.safeFetchAllHashedAssetV1=_re;function Are(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Xo.gpaBuilder)(t,e).registerFields({key:[0,(0,kM.getKeySerializer)()],hash:[1,(0,Ox.bytes)({size:32})]}).deserializeUsing(r=>Sl(r))}Sr.getHashedAssetV1GpaBuilder=Are;function Sre(){return 33}Sr.getHashedAssetV1Size=Sre});var DM=S(vr=>{"use strict";a();Object.defineProperty(vr,"__esModule",{value:!0});vr.getPluginHeaderV1Size=vr.getPluginHeaderV1GpaBuilder=vr.safeFetchAllPluginHeaderV1=vr.fetchAllPluginHeaderV1=vr.safeFetchPluginHeaderV1=vr.fetchPluginHeaderV1=vr.deserializePluginHeaderV1=vr.getPluginHeaderV1AccountDataSerializer=void 0;var Jo=re(),Bx=q(),MM=ae();function LM(){return(0,Bx.struct)([["key",(0,MM.getKeySerializer)()],["pluginRegistryOffset",(0,Bx.u64)()]],{description:"PluginHeaderV1AccountData"})}vr.getPluginHeaderV1AccountDataSerializer=LM;function vl(t){return(0,Jo.deserializeAccount)(t,LM())}vr.deserializePluginHeaderV1=vl;async function vre(t,e,r){let n=await t.rpc.getAccount((0,Jo.publicKey)(e,!1),r);return(0,Jo.assertAccountExists)(n,"PluginHeaderV1"),vl(n)}vr.fetchPluginHeaderV1=vre;async function Ere(t,e,r){let n=await t.rpc.getAccount((0,Jo.publicKey)(e,!1),r);return n.exists?vl(n):null}vr.safeFetchPluginHeaderV1=Ere;async function wre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Jo.publicKey)(i,!1)),r)).map(i=>((0,Jo.assertAccountExists)(i,"PluginHeaderV1"),vl(i)))}vr.fetchAllPluginHeaderV1=wre;async function xre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Jo.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>vl(i))}vr.safeFetchAllPluginHeaderV1=xre;function Ire(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Jo.gpaBuilder)(t,e).registerFields({key:[0,(0,MM.getKeySerializer)()],pluginRegistryOffset:[1,(0,Bx.u64)()]}).deserializeUsing(r=>vl(r))}vr.getPluginHeaderV1GpaBuilder=Ire;function Pre(){return 9}vr.getPluginHeaderV1Size=Pre});var UM=S(An=>{"use strict";a();Object.defineProperty(An,"__esModule",{value:!0});An.getPluginRegistryV1GpaBuilder=An.safeFetchAllPluginRegistryV1=An.fetchAllPluginRegistryV1=An.safeFetchPluginRegistryV1=An.fetchPluginRegistryV1=An.deserializePluginRegistryV1=void 0;var Qo=re(),qM=q(),Rre=oh(),Tx=ae();function El(t){return(0,Qo.deserializeAccount)(t,(0,Rre.getPluginRegistryV1AccountDataSerializer)())}An.deserializePluginRegistryV1=El;async function Ore(t,e,r){let n=await t.rpc.getAccount((0,Qo.publicKey)(e,!1),r);return(0,Qo.assertAccountExists)(n,"PluginRegistryV1"),El(n)}An.fetchPluginRegistryV1=Ore;async function Bre(t,e,r){let n=await t.rpc.getAccount((0,Qo.publicKey)(e,!1),r);return n.exists?El(n):null}An.safeFetchPluginRegistryV1=Bre;async function Tre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Qo.publicKey)(i,!1)),r)).map(i=>((0,Qo.assertAccountExists)(i,"PluginRegistryV1"),El(i)))}An.fetchAllPluginRegistryV1=Tre;async function zre(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Qo.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>El(i))}An.safeFetchAllPluginRegistryV1=zre;function kre(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Qo.gpaBuilder)(t,e).registerFields({key:[0,(0,Tx.getKeySerializer)()],registry:[1,(0,qM.array)((0,Tx.getRegistryRecordSerializer)())],externalRegistry:[null,(0,qM.array)((0,Tx.getExternalRegistryRecordSerializer)())]}).deserializeUsing(r=>El(r))}An.getPluginRegistryV1GpaBuilder=kre});var zx=S(Ln=>{"use strict";a();var Cre=Ln&&Ln.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ec=Ln&&Ln.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cre(e,t,r)};Object.defineProperty(Ln,"__esModule",{value:!0});Ec(Dk(),Ln);Ec(OM(),Ln);Ec(BM(),Ln);Ec(zM(),Ln);Ec(NM(),Ln);Ec(DM(),Ln);Ec(UM(),Ln)});var VM=S($=>{"use strict";a();Object.defineProperty($,"__esModule",{value:!0});$.InvalidExecutePdaError=$.PermanentDelegatesPreventMoveError=$.CannotAddDataSectionError=$.InvalidPluginAdapterTargetError=$.NoDataSourcesError=$.UnsupportedOperationError=$.TwoDataSourcesError=$.CollectionMustBeEmptyError=$.InvalidPluginOperationError=$.MissingSignerError=$.UninitializedOracleAccountError=$.InvalidOracleAccountDataError=$.DuplicateLifecycleChecksError=$.RequiresLifecycleCheckError=$.OracleCanRejectOnlyError=$.MissingExternalPluginAdapterAccountError=$.MissingAssetError=$.ExternalPluginAdapterAlreadyExistsError=$.ExternalPluginAdapterNotFoundError=$.InvalidLogWrapperProgramError=$.ConflictingAuthorityError=$.InvalidPluginSettingError=$.CannotRedelegateError=$.NoApprovalsError=$.MissingCollectionError=$.InvalidAssetError=$.NotAvailableError=$.MissingSystemProgramError=$.MissingNewOwnerError=$.MissingUpdateAuthorityError=$.InvalidCollectionError=$.AlreadyDecompressedError=$.AlreadyCompressedError=$.NumericalOverflowErrorError=$.PluginAlreadyExistsError=$.CannotBurnCollectionError=$.CannotMigratePrintsError=$.CannotMigrateMasterWithSupplyError=$.MissingCompressionProofError=$.AssetIsFrozenError=$.InvalidAuthorityError=$.InvalidPluginError=$.IncorrectAssetHashError=$.IncorrectAccountError=$.NumericalOverflowError=$.PluginNotFoundError=$.PluginsNotInitializedError=$.SerializationErrorError=$.DeserializationErrorError=$.InvalidSystemProgramError=void 0;$.getMplCoreErrorFromName=$.getMplCoreErrorFromCode=$.InconsistentGroupRelationshipError=$.GroupNestingDepthExceededError=$.GroupVectorFullError=$.DuplicateEntryError=$.GroupMustBeEmptyError=$.AgentIdentityMustSignError=$.BlockedByBubblegumV2Error=void 0;var ye=re(),pe=new Map,ge=new Map,uh=class extends ye.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};$.InvalidSystemProgramError=uh;pe.set(0,uh);ge.set("InvalidSystemProgram",uh);var lh=class extends ye.ProgramError{constructor(e,r){super("Error deserializing account",e,r),this.name="DeserializationError",this.code=1}};$.DeserializationErrorError=lh;pe.set(1,lh);ge.set("DeserializationError",lh);var dh=class extends ye.ProgramError{constructor(e,r){super("Error serializing account",e,r),this.name="SerializationError",this.code=2}};$.SerializationErrorError=dh;pe.set(2,dh);ge.set("SerializationError",dh);var fh=class extends ye.ProgramError{constructor(e,r){super("Plugins not initialized",e,r),this.name="PluginsNotInitialized",this.code=3}};$.PluginsNotInitializedError=fh;pe.set(3,fh);ge.set("PluginsNotInitialized",fh);var hh=class extends ye.ProgramError{constructor(e,r){super("Plugin not found",e,r),this.name="PluginNotFound",this.code=4}};$.PluginNotFoundError=hh;pe.set(4,hh);ge.set("PluginNotFound",hh);var ph=class extends ye.ProgramError{constructor(e,r){super("Numerical Overflow",e,r),this.name="NumericalOverflow",this.code=5}};$.NumericalOverflowError=ph;pe.set(5,ph);ge.set("NumericalOverflow",ph);var gh=class extends ye.ProgramError{constructor(e,r){super("Incorrect account",e,r),this.name="IncorrectAccount",this.code=6}};$.IncorrectAccountError=gh;pe.set(6,gh);ge.set("IncorrectAccount",gh);var yh=class extends ye.ProgramError{constructor(e,r){super("Incorrect asset hash",e,r),this.name="IncorrectAssetHash",this.code=7}};$.IncorrectAssetHashError=yh;pe.set(7,yh);ge.set("IncorrectAssetHash",yh);var mh=class extends ye.ProgramError{constructor(e,r){super("Invalid Plugin",e,r),this.name="InvalidPlugin",this.code=8}};$.InvalidPluginError=mh;pe.set(8,mh);ge.set("InvalidPlugin",mh);var bh=class extends ye.ProgramError{constructor(e,r){super("Invalid Authority",e,r),this.name="InvalidAuthority",this.code=9}};$.InvalidAuthorityError=bh;pe.set(9,bh);ge.set("InvalidAuthority",bh);var _h=class extends ye.ProgramError{constructor(e,r){super("Cannot transfer a frozen asset",e,r),this.name="AssetIsFrozen",this.code=10}};$.AssetIsFrozenError=_h;pe.set(10,_h);ge.set("AssetIsFrozen",_h);var Ah=class extends ye.ProgramError{constructor(e,r){super("Missing compression proof",e,r),this.name="MissingCompressionProof",this.code=11}};$.MissingCompressionProofError=Ah;pe.set(11,Ah);ge.set("MissingCompressionProof",Ah);var Sh=class extends ye.ProgramError{constructor(e,r){super("Cannot migrate a master edition used for prints",e,r),this.name="CannotMigrateMasterWithSupply",this.code=12}};$.CannotMigrateMasterWithSupplyError=Sh;pe.set(12,Sh);ge.set("CannotMigrateMasterWithSupply",Sh);var vh=class extends ye.ProgramError{constructor(e,r){super("Cannot migrate a print edition",e,r),this.name="CannotMigratePrints",this.code=13}};$.CannotMigratePrintsError=vh;pe.set(13,vh);ge.set("CannotMigratePrints",vh);var Eh=class extends ye.ProgramError{constructor(e,r){super("Cannot burn a collection NFT",e,r),this.name="CannotBurnCollection",this.code=14}};$.CannotBurnCollectionError=Eh;pe.set(14,Eh);ge.set("CannotBurnCollection",Eh);var wh=class extends ye.ProgramError{constructor(e,r){super("Plugin already exists",e,r),this.name="PluginAlreadyExists",this.code=15}};$.PluginAlreadyExistsError=wh;pe.set(15,wh);ge.set("PluginAlreadyExists",wh);var xh=class extends ye.ProgramError{constructor(e,r){super("Numerical overflow",e,r),this.name="NumericalOverflowError",this.code=16}};$.NumericalOverflowErrorError=xh;pe.set(16,xh);ge.set("NumericalOverflowError",xh);var Ih=class extends ye.ProgramError{constructor(e,r){super("Already compressed account",e,r),this.name="AlreadyCompressed",this.code=17}};$.AlreadyCompressedError=Ih;pe.set(17,Ih);ge.set("AlreadyCompressed",Ih);var Ph=class extends ye.ProgramError{constructor(e,r){super("Already decompressed account",e,r),this.name="AlreadyDecompressed",this.code=18}};$.AlreadyDecompressedError=Ph;pe.set(18,Ph);ge.set("AlreadyDecompressed",Ph);var Rh=class extends ye.ProgramError{constructor(e,r){super("Invalid Collection passed in",e,r),this.name="InvalidCollection",this.code=19}};$.InvalidCollectionError=Rh;pe.set(19,Rh);ge.set("InvalidCollection",Rh);var Oh=class extends ye.ProgramError{constructor(e,r){super("Missing update authority",e,r),this.name="MissingUpdateAuthority",this.code=20}};$.MissingUpdateAuthorityError=Oh;pe.set(20,Oh);ge.set("MissingUpdateAuthority",Oh);var Bh=class extends ye.ProgramError{constructor(e,r){super("Missing new owner",e,r),this.name="MissingNewOwner",this.code=21}};$.MissingNewOwnerError=Bh;pe.set(21,Bh);ge.set("MissingNewOwner",Bh);var Th=class extends ye.ProgramError{constructor(e,r){super("Missing system program",e,r),this.name="MissingSystemProgram",this.code=22}};$.MissingSystemProgramError=Th;pe.set(22,Th);ge.set("MissingSystemProgram",Th);var zh=class extends ye.ProgramError{constructor(e,r){super("Feature not available",e,r),this.name="NotAvailable",this.code=23}};$.NotAvailableError=zh;pe.set(23,zh);ge.set("NotAvailable",zh);var kh=class extends ye.ProgramError{constructor(e,r){super("Invalid Asset passed in",e,r),this.name="InvalidAsset",this.code=24}};$.InvalidAssetError=kh;pe.set(24,kh);ge.set("InvalidAsset",kh);var Ch=class extends ye.ProgramError{constructor(e,r){super("Missing collection",e,r),this.name="MissingCollection",this.code=25}};$.MissingCollectionError=Ch;pe.set(25,Ch);ge.set("MissingCollection",Ch);var Nh=class extends ye.ProgramError{constructor(e,r){super("Neither the asset or any plugins have approved this operation",e,r),this.name="NoApprovals",this.code=26}};$.NoApprovalsError=Nh;pe.set(26,Nh);ge.set("NoApprovals",Nh);var Mh=class extends ye.ProgramError{constructor(e,r){super("Plugin Manager cannot redelegate a delegated plugin without revoking first",e,r),this.name="CannotRedelegate",this.code=27}};$.CannotRedelegateError=Mh;pe.set(27,Mh);ge.set("CannotRedelegate",Mh);var Lh=class extends ye.ProgramError{constructor(e,r){super("Invalid setting for plugin",e,r),this.name="InvalidPluginSetting",this.code=28}};$.InvalidPluginSettingError=Lh;pe.set(28,Lh);ge.set("InvalidPluginSetting",Lh);var Dh=class extends ye.ProgramError{constructor(e,r){super("Cannot specify both an update authority and collection on an asset",e,r),this.name="ConflictingAuthority",this.code=29}};$.ConflictingAuthorityError=Dh;pe.set(29,Dh);ge.set("ConflictingAuthority",Dh);var qh=class extends ye.ProgramError{constructor(e,r){super("Invalid Log Wrapper Program",e,r),this.name="InvalidLogWrapperProgram",this.code=30}};$.InvalidLogWrapperProgramError=qh;pe.set(30,qh);ge.set("InvalidLogWrapperProgram",qh);var Uh=class extends ye.ProgramError{constructor(e,r){super("External Plugin Adapter not found",e,r),this.name="ExternalPluginAdapterNotFound",this.code=31}};$.ExternalPluginAdapterNotFoundError=Uh;pe.set(31,Uh);ge.set("ExternalPluginAdapterNotFound",Uh);var Vh=class extends ye.ProgramError{constructor(e,r){super("External Plugin Adapter already exists",e,r),this.name="ExternalPluginAdapterAlreadyExists",this.code=32}};$.ExternalPluginAdapterAlreadyExistsError=Vh;pe.set(32,Vh);ge.set("ExternalPluginAdapterAlreadyExists",Vh);var Fh=class extends ye.ProgramError{constructor(e,r){super("Missing asset needed for extra account PDA derivation",e,r),this.name="MissingAsset",this.code=33}};$.MissingAssetError=Fh;pe.set(33,Fh);ge.set("MissingAsset",Fh);var Kh=class extends ye.ProgramError{constructor(e,r){super("Missing account needed for external plugin adapter",e,r),this.name="MissingExternalPluginAdapterAccount",this.code=34}};$.MissingExternalPluginAdapterAccountError=Kh;pe.set(34,Kh);ge.set("MissingExternalPluginAdapterAccount",Kh);var Wh=class extends ye.ProgramError{constructor(e,r){super("Oracle external plugin adapter can only be configured to reject",e,r),this.name="OracleCanRejectOnly",this.code=35}};$.OracleCanRejectOnlyError=Wh;pe.set(35,Wh);ge.set("OracleCanRejectOnly",Wh);var jh=class extends ye.ProgramError{constructor(e,r){super("External plugin adapter must have at least one lifecycle check",e,r),this.name="RequiresLifecycleCheck",this.code=36}};$.RequiresLifecycleCheckError=jh;pe.set(36,jh);ge.set("RequiresLifecycleCheck",jh);var Hh=class extends ye.ProgramError{constructor(e,r){super("Duplicate lifecycle checks were provided for external plugin adapter ",e,r),this.name="DuplicateLifecycleChecks",this.code=37}};$.DuplicateLifecycleChecksError=Hh;pe.set(37,Hh);ge.set("DuplicateLifecycleChecks",Hh);var Gh=class extends ye.ProgramError{constructor(e,r){super("Could not read from oracle account",e,r),this.name="InvalidOracleAccountData",this.code=38}};$.InvalidOracleAccountDataError=Gh;pe.set(38,Gh);ge.set("InvalidOracleAccountData",Gh);var $h=class extends ye.ProgramError{constructor(e,r){super("Oracle account is uninitialized",e,r),this.name="UninitializedOracleAccount",this.code=39}};$.UninitializedOracleAccountError=$h;pe.set(39,$h);ge.set("UninitializedOracleAccount",$h);var Zh=class extends ye.ProgramError{constructor(e,r){super("Missing required signer for operation",e,r),this.name="MissingSigner",this.code=40}};$.MissingSignerError=Zh;pe.set(40,Zh);ge.set("MissingSigner",Zh);var Yh=class extends ye.ProgramError{constructor(e,r){super("Invalid plugin operation",e,r),this.name="InvalidPluginOperation",this.code=41}};$.InvalidPluginOperationError=Yh;pe.set(41,Yh);ge.set("InvalidPluginOperation",Yh);var Xh=class extends ye.ProgramError{constructor(e,r){super("Collection must be empty to be burned",e,r),this.name="CollectionMustBeEmpty",this.code=42}};$.CollectionMustBeEmptyError=Xh;pe.set(42,Xh);ge.set("CollectionMustBeEmpty",Xh);var Jh=class extends ye.ProgramError{constructor(e,r){super("Two data sources provided, only one is allowed",e,r),this.name="TwoDataSources",this.code=43}};$.TwoDataSourcesError=Jh;pe.set(43,Jh);ge.set("TwoDataSources",Jh);var Qh=class extends ye.ProgramError{constructor(e,r){super("External Plugin does not support this operation",e,r),this.name="UnsupportedOperation",this.code=44}};$.UnsupportedOperationError=Qh;pe.set(44,Qh);ge.set("UnsupportedOperation",Qh);var ep=class extends ye.ProgramError{constructor(e,r){super("No data sources provided, one is required",e,r),this.name="NoDataSources",this.code=45}};$.NoDataSourcesError=ep;pe.set(45,ep);ge.set("NoDataSources",ep);var tp=class extends ye.ProgramError{constructor(e,r){super("This plugin adapter cannot be added to an Asset",e,r),this.name="InvalidPluginAdapterTarget",this.code=46}};$.InvalidPluginAdapterTargetError=tp;pe.set(46,tp);ge.set("InvalidPluginAdapterTarget",tp);var rp=class extends ye.ProgramError{constructor(e,r){super("Cannot add a Data Section without a linked external plugin",e,r),this.name="CannotAddDataSection",this.code=47}};$.CannotAddDataSectionError=rp;pe.set(47,rp);ge.set("CannotAddDataSection",rp);var np=class extends ye.ProgramError{constructor(e,r){super("Cannot move asset to collection with permanent delegates",e,r),this.name="PermanentDelegatesPreventMove",this.code=48}};$.PermanentDelegatesPreventMoveError=np;pe.set(48,np);ge.set("PermanentDelegatesPreventMove",np);var ip=class extends ye.ProgramError{constructor(e,r){super("Invalid Signing PDA for Asset or Collection Execute",e,r),this.name="InvalidExecutePda",this.code=49}};$.InvalidExecutePdaError=ip;pe.set(49,ip);ge.set("InvalidExecutePda",ip);var sp=class extends ye.ProgramError{constructor(e,r){super("Bubblegum V2 Plugin limits other plugins",e,r),this.name="BlockedByBubblegumV2",this.code=50}};$.BlockedByBubblegumV2Error=sp;pe.set(50,sp);ge.set("BlockedByBubblegumV2",sp);var op=class extends ye.ProgramError{constructor(e,r){super("Agent Identity Program must sign",e,r),this.name="AgentIdentityMustSign",this.code=51}};$.AgentIdentityMustSignError=op;pe.set(51,op);ge.set("AgentIdentityMustSign",op);var ap=class extends ye.ProgramError{constructor(e,r){super("Group must be empty to be closed",e,r),this.name="GroupMustBeEmpty",this.code=52}};$.GroupMustBeEmptyError=ap;pe.set(52,ap);ge.set("GroupMustBeEmpty",ap);var cp=class extends ye.ProgramError{constructor(e,r){super("Duplicate entry provided when adding relationships to a group",e,r),this.name="DuplicateEntry",this.code=53}};$.DuplicateEntryError=cp;pe.set(53,cp);ge.set("DuplicateEntry",cp);var up=class extends ye.ProgramError{constructor(e,r){super("Group vector is at maximum capacity",e,r),this.name="GroupVectorFull",this.code=54}};$.GroupVectorFullError=up;pe.set(54,up);ge.set("GroupVectorFull",up);var lp=class extends ye.ProgramError{constructor(e,r){super("Group nesting depth exceeded",e,r),this.name="GroupNestingDepthExceeded",this.code=55}};$.GroupNestingDepthExceededError=lp;pe.set(55,lp);ge.set("GroupNestingDepthExceeded",lp);var dp=class extends ye.ProgramError{constructor(e,r){super("Bidirectional group relationship is inconsistent",e,r),this.name="InconsistentGroupRelationship",this.code=56}};$.InconsistentGroupRelationshipError=dp;pe.set(56,dp);ge.set("InconsistentGroupRelationship",dp);function Nre(t,e,r){let n=pe.get(t);return n?new n(e,r):null}$.getMplCoreErrorFromCode=Nre;function Mre(t,e,r){let n=ge.get(t);return n?new n(e,r):null}$.getMplCoreErrorFromName=Mre});var kx=S(wc=>{"use strict";a();var Lre=wc&&wc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Dre=wc&&wc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Lre(e,t,r)};Object.defineProperty(wc,"__esModule",{value:!0});Dre(VM(),wc)});var Ie=S(Qi=>{"use strict";a();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.getAccountMetasAndSigners=Qi.expectPda=Qi.expectPublicKey=Qi.expectSome=void 0;var fp=re();function qre(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Qi.expectSome=qre;function Ure(t){if(!t)throw new Error("Expected a PublicKey.");return(0,fp.publicKey)(t,!1)}Qi.expectPublicKey=Ure;function Vre(t){if(!t||!Array.isArray(t)||!(0,fp.isPda)(t))throw new Error("Expected a PDA.");return t}Qi.expectPda=Vre;function Fre(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,fp.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,fp.publicKey)(s.value,!1),isSigner:(0,fp.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Qi.getAccountMetasAndSigners=Fre});var KM=S(wl=>{"use strict";a();Object.defineProperty(wl,"__esModule",{value:!0});wl.addAssetsToGroupV1=wl.getAddAssetsToGroupV1InstructionDataSerializer=void 0;var Kre=re(),Cx=q(),Wre=Ie();function FM(){return(0,Cx.mapSerializer)((0,Cx.struct)([["discriminator",(0,Cx.u8)()]],{description:"AddAssetsToGroupV1InstructionData"}),t=>({...t,discriminator:35}))}wl.getAddAssetsToGroupV1InstructionDataSerializer=FM;function jre(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Wre.getAccountMetasAndSigners)(i,"programId",r),c=FM().serialize({});return(0,Kre.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}wl.addAssetsToGroupV1=jre});var jM=S(xl=>{"use strict";a();Object.defineProperty(xl,"__esModule",{value:!0});xl.addCollectionExternalPluginAdapterV1=xl.getAddCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var Hre=re(),Nx=q(),Gre=Ie(),$re=ae();function WM(){return(0,Nx.mapSerializer)((0,Nx.struct)([["discriminator",(0,Nx.u8)()],["initInfo",(0,$re.getBaseExternalPluginAdapterInitInfoSerializer)()]],{description:"AddCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:23}))}xl.getAddCollectionExternalPluginAdapterV1InstructionDataSerializer=WM;function Zre(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Gre.getAccountMetasAndSigners)(s,"programId",r),u=WM().serialize(i);return(0,Hre.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}xl.addCollectionExternalPluginAdapterV1=Zre});var ZM=S(Il=>{"use strict";a();Object.defineProperty(Il,"__esModule",{value:!0});Il.addCollectionPluginV1=Il.getAddCollectionPluginV1InstructionDataSerializer=void 0;var GM=re(),_1=q(),Yre=Ie(),HM=ae();function $M(){return(0,_1.mapSerializer)((0,_1.struct)([["discriminator",(0,_1.u8)()],["plugin",(0,HM.getPluginSerializer)()],["initAuthority",(0,_1.option)((0,HM.getBasePluginAuthoritySerializer)())]],{description:"AddCollectionPluginV1InstructionData"}),t=>({...t,discriminator:3,initAuthority:t.initAuthority??(0,GM.none)()}))}Il.getAddCollectionPluginV1InstructionDataSerializer=$M;function Xre(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Yre.getAccountMetasAndSigners)(s,"programId",r),u=$M().serialize(i);return(0,GM.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Il.addCollectionPluginV1=Xre});var XM=S(Pl=>{"use strict";a();Object.defineProperty(Pl,"__esModule",{value:!0});Pl.addCollectionsToGroupV1=Pl.getAddCollectionsToGroupV1InstructionDataSerializer=void 0;var Jre=re(),Mx=q(),Qre=Ie();function YM(){return(0,Mx.mapSerializer)((0,Mx.struct)([["discriminator",(0,Mx.u8)()]],{description:"AddCollectionsToGroupV1InstructionData"}),t=>({...t,discriminator:33}))}Pl.getAddCollectionsToGroupV1InstructionDataSerializer=YM;function ene(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Qre.getAccountMetasAndSigners)(i,"programId",r),c=YM().serialize({});return(0,Jre.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Pl.addCollectionsToGroupV1=ene});var QM=S(Rl=>{"use strict";a();Object.defineProperty(Rl,"__esModule",{value:!0});Rl.addExternalPluginAdapterV1=Rl.getAddExternalPluginAdapterV1InstructionDataSerializer=void 0;var tne=re(),Lx=q(),rne=Ie(),nne=ae();function JM(){return(0,Lx.mapSerializer)((0,Lx.struct)([["discriminator",(0,Lx.u8)()],["initInfo",(0,nne.getBaseExternalPluginAdapterInitInfoSerializer)()]],{description:"AddExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:22}))}Rl.getAddExternalPluginAdapterV1InstructionDataSerializer=JM;function ine(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,rne.getAccountMetasAndSigners)(s,"programId",r),u=JM().serialize(i);return(0,tne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Rl.addExternalPluginAdapterV1=ine});var tL=S(Ol=>{"use strict";a();Object.defineProperty(Ol,"__esModule",{value:!0});Ol.addGroupsToGroupV1=Ol.getAddGroupsToGroupV1InstructionDataSerializer=void 0;var sne=re(),hp=q(),one=Ie();function eL(){return(0,hp.mapSerializer)((0,hp.struct)([["discriminator",(0,hp.u8)()],["groups",(0,hp.array)((0,hp.publicKey)())]],{description:"AddGroupsToGroupV1InstructionData"}),t=>({...t,discriminator:37}))}Ol.getAddGroupsToGroupV1InstructionDataSerializer=eL;function ane(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={parentGroup:{index:0,isWritable:!0,value:e.parentGroup??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,one.getAccountMetasAndSigners)(s,"programId",r),u=eL().serialize(i);return(0,sne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Ol.addGroupsToGroupV1=ane});var sL=S(Bl=>{"use strict";a();Object.defineProperty(Bl,"__esModule",{value:!0});Bl.addPluginV1=Bl.getAddPluginV1InstructionDataSerializer=void 0;var nL=re(),A1=q(),cne=Ie(),rL=ae();function iL(){return(0,A1.mapSerializer)((0,A1.struct)([["discriminator",(0,A1.u8)()],["plugin",(0,rL.getPluginSerializer)()],["initAuthority",(0,A1.option)((0,rL.getBasePluginAuthoritySerializer)())]],{description:"AddPluginV1InstructionData"}),t=>({...t,discriminator:2,initAuthority:t.initAuthority??(0,nL.none)()}))}Bl.getAddPluginV1InstructionDataSerializer=iL;function une(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,cne.getAccountMetasAndSigners)(s,"programId",r),u=iL().serialize(i);return(0,nL.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Bl.addPluginV1=une});var cL=S(Tl=>{"use strict";a();Object.defineProperty(Tl,"__esModule",{value:!0});Tl.approveCollectionPluginAuthorityV1=Tl.getApproveCollectionPluginAuthorityV1InstructionDataSerializer=void 0;var lne=re(),Dx=q(),dne=Ie(),oL=ae();function aL(){return(0,Dx.mapSerializer)((0,Dx.struct)([["discriminator",(0,Dx.u8)()],["pluginType",(0,oL.getPluginTypeSerializer)()],["newAuthority",(0,oL.getBasePluginAuthoritySerializer)()]],{description:"ApproveCollectionPluginAuthorityV1InstructionData"}),t=>({...t,discriminator:9}))}Tl.getApproveCollectionPluginAuthorityV1InstructionDataSerializer=aL;function fne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,dne.getAccountMetasAndSigners)(s,"programId",r),u=aL().serialize(i);return(0,lne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Tl.approveCollectionPluginAuthorityV1=fne});var dL=S(zl=>{"use strict";a();Object.defineProperty(zl,"__esModule",{value:!0});zl.approvePluginAuthorityV1=zl.getApprovePluginAuthorityV1InstructionDataSerializer=void 0;var hne=re(),qx=q(),pne=Ie(),uL=ae();function lL(){return(0,qx.mapSerializer)((0,qx.struct)([["discriminator",(0,qx.u8)()],["pluginType",(0,uL.getPluginTypeSerializer)()],["newAuthority",(0,uL.getBasePluginAuthoritySerializer)()]],{description:"ApprovePluginAuthorityV1InstructionData"}),t=>({...t,discriminator:8}))}zl.getApprovePluginAuthorityV1InstructionDataSerializer=lL;function gne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,pne.getAccountMetasAndSigners)(s,"programId",r),u=lL().serialize(i);return(0,hne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}zl.approvePluginAuthorityV1=gne});var hL=S(kl=>{"use strict";a();Object.defineProperty(kl,"__esModule",{value:!0});kl.burnCollectionV1=kl.getBurnCollectionV1InstructionDataSerializer=void 0;var yne=re(),S1=q(),mne=Ie(),bne=ae();function fL(){return(0,S1.mapSerializer)((0,S1.struct)([["discriminator",(0,S1.u8)()],["compressionProof",(0,S1.option)((0,bne.getCompressionProofSerializer)())]],{description:"BurnCollectionV1InstructionData"}),t=>({...t,discriminator:13}))}kl.getBurnCollectionV1InstructionDataSerializer=fL;function _ne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!0,value:e.authority??null},logWrapper:{index:3,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,mne.getAccountMetasAndSigners)(s,"programId",r),u=fL().serialize(i);return(0,yne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}kl.burnCollectionV1=_ne});var yL=S(Cl=>{"use strict";a();Object.defineProperty(Cl,"__esModule",{value:!0});Cl.burnV1=Cl.getBurnV1InstructionDataSerializer=void 0;var pL=re(),v1=q(),Ane=Ie(),Sne=ae();function gL(){return(0,v1.mapSerializer)((0,v1.struct)([["discriminator",(0,v1.u8)()],["compressionProof",(0,v1.option)((0,Sne.getCompressionProofSerializer)())]],{description:"BurnV1InstructionData"}),t=>({...t,discriminator:12,compressionProof:t.compressionProof??(0,pL.none)()}))}Cl.getBurnV1InstructionDataSerializer=gL;function vne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Ane.getAccountMetasAndSigners)(s,"programId",r),u=gL().serialize(i);return(0,pL.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Cl.burnV1=vne});var bL=S(Nl=>{"use strict";a();Object.defineProperty(Nl,"__esModule",{value:!0});Nl.closeGroupV1=Nl.getCloseGroupV1InstructionDataSerializer=void 0;var Ene=re(),Ux=q(),wne=Ie();function mL(){return(0,Ux.mapSerializer)((0,Ux.struct)([["discriminator",(0,Ux.u8)()]],{description:"CloseGroupV1InstructionData"}),t=>({...t,discriminator:40}))}Nl.getCloseGroupV1InstructionDataSerializer=mL;function xne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null}};n.payer.value||(n.payer.value=t.payer);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,wne.getAccountMetasAndSigners)(i,"programId",r),c=mL().serialize({});return(0,Ene.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Nl.closeGroupV1=xne});var AL=S(Ml=>{"use strict";a();Object.defineProperty(Ml,"__esModule",{value:!0});Ml.collect=Ml.getCollectInstructionDataSerializer=void 0;var Vx=re(),Fx=q(),Ine=Ie();function _L(){return(0,Fx.mapSerializer)((0,Fx.struct)([["discriminator",(0,Fx.u8)()]],{description:"CollectInstructionData"}),t=>({...t,discriminator:19}))}Ml.getCollectInstructionDataSerializer=_L;function Pne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={recipient1:{index:0,isWritable:!0,value:e.recipient1??null},recipient2:{index:1,isWritable:!0,value:e.recipient2??null}};n.recipient1.value||(n.recipient1.value=(0,Vx.publicKey)("8AT6o8Qk5T9QnZvPThMrF9bcCQLTGkyGvVZZzHgCw11v")),n.recipient2.value||(n.recipient2.value=(0,Vx.publicKey)("MmHsqX4LxTfifxoH8BVRLUKrwDn1LPCac6YcCZTHhwt"));let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Ine.getAccountMetasAndSigners)(i,"programId",r),c=_L().serialize({});return(0,Vx.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ml.collect=Pne});var vL=S(Ll=>{"use strict";a();Object.defineProperty(Ll,"__esModule",{value:!0});Ll.compressV1=Ll.getCompressV1InstructionDataSerializer=void 0;var Rne=re(),Kx=q(),One=Ie();function SL(){return(0,Kx.mapSerializer)((0,Kx.struct)([["discriminator",(0,Kx.u8)()]],{description:"CompressV1InstructionData"}),t=>({...t,discriminator:17}))}Ll.getCompressV1InstructionDataSerializer=SL;function Bne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,One.getAccountMetasAndSigners)(i,"programId",r),c=SL().serialize({});return(0,Rne.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ll.compressV1=Bne});var xL=S(Dl=>{"use strict";a();Object.defineProperty(Dl,"__esModule",{value:!0});Dl.createCollectionV1=Dl.getCreateCollectionV1InstructionDataSerializer=void 0;var EL=re(),xc=q(),Tne=Ie(),zne=ae();function wL(){return(0,xc.mapSerializer)((0,xc.struct)([["discriminator",(0,xc.u8)()],["name",(0,xc.string)()],["uri",(0,xc.string)()],["plugins",(0,xc.option)((0,xc.array)((0,zne.getPluginAuthorityPairSerializer)()))]],{description:"CreateCollectionV1InstructionData"}),t=>({...t,discriminator:1,plugins:t.plugins??(0,EL.none)()}))}Dl.getCreateCollectionV1InstructionDataSerializer=wL;function kne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Tne.getAccountMetasAndSigners)(s,"programId",r),u=wL().serialize(i);return(0,EL.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Dl.createCollectionV1=kne});var OL=S(ql=>{"use strict";a();Object.defineProperty(ql,"__esModule",{value:!0});ql.createCollectionV2=ql.getCreateCollectionV2InstructionDataSerializer=void 0;var PL=re(),Vs=q(),Cne=Ie(),IL=ae();function RL(){return(0,Vs.mapSerializer)((0,Vs.struct)([["discriminator",(0,Vs.u8)()],["name",(0,Vs.string)()],["uri",(0,Vs.string)()],["plugins",(0,Vs.option)((0,Vs.array)((0,IL.getPluginAuthorityPairSerializer)()))],["externalPluginAdapters",(0,Vs.option)((0,Vs.array)((0,IL.getBaseExternalPluginAdapterInitInfoSerializer)()))]],{description:"CreateCollectionV2InstructionData"}),t=>({...t,discriminator:21,plugins:t.plugins??(0,PL.none)(),externalPluginAdapters:t.externalPluginAdapters??[]}))}ql.getCreateCollectionV2InstructionDataSerializer=RL;function Nne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Cne.getAccountMetasAndSigners)(s,"programId",r),u=RL().serialize(i);return(0,PL.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ql.createCollectionV2=Nne});var TL=S(Vl=>{"use strict";a();Object.defineProperty(Vl,"__esModule",{value:!0});Vl.createGroupV1=Vl.getCreateGroupV1InstructionDataSerializer=void 0;var Mne=re(),Ul=q(),Lne=Ie(),Dne=ae();function BL(){return(0,Ul.mapSerializer)((0,Ul.struct)([["discriminator",(0,Ul.u8)()],["name",(0,Ul.string)()],["uri",(0,Ul.string)()],["relationships",(0,Ul.array)((0,Dne.getRelationshipEntrySerializer)())]],{description:"CreateGroupV1InstructionData"}),t=>({...t,discriminator:39}))}Vl.getCreateGroupV1InstructionDataSerializer=BL;function qne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Lne.getAccountMetasAndSigners)(s,"programId",r),u=BL().serialize(i);return(0,Mne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Vl.createGroupV1=qne});var kL=S(Fl=>{"use strict";a();Object.defineProperty(Fl,"__esModule",{value:!0});Fl.createV1=Fl.getCreateV1InstructionDataSerializer=void 0;var Une=re(),Ic=q(),Vne=Ie(),Wx=ae();function zL(){return(0,Ic.mapSerializer)((0,Ic.struct)([["discriminator",(0,Ic.u8)()],["dataState",(0,Wx.getDataStateSerializer)()],["name",(0,Ic.string)()],["uri",(0,Ic.string)()],["plugins",(0,Ic.option)((0,Ic.array)((0,Wx.getPluginAuthorityPairSerializer)()))]],{description:"CreateV1InstructionData"}),t=>({...t,discriminator:0,dataState:t.dataState??Wx.DataState.AccountState,plugins:t.plugins??[]}))}Fl.getCreateV1InstructionDataSerializer=zL;function Fne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},payer:{index:3,isWritable:!0,value:e.payer??null},owner:{index:4,isWritable:!1,value:e.owner??null},updateAuthority:{index:5,isWritable:!1,value:e.updateAuthority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Vne.getAccountMetasAndSigners)(s,"programId",r),u=zL().serialize(i);return(0,Une.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Fl.createV1=Fne});var NL=S(Kl=>{"use strict";a();Object.defineProperty(Kl,"__esModule",{value:!0});Kl.createV2=Kl.getCreateV2InstructionDataSerializer=void 0;var Kne=re(),Fs=q(),Wne=Ie(),E1=ae();function CL(){return(0,Fs.mapSerializer)((0,Fs.struct)([["discriminator",(0,Fs.u8)()],["dataState",(0,E1.getDataStateSerializer)()],["name",(0,Fs.string)()],["uri",(0,Fs.string)()],["plugins",(0,Fs.option)((0,Fs.array)((0,E1.getPluginAuthorityPairSerializer)()))],["externalPluginAdapters",(0,Fs.option)((0,Fs.array)((0,E1.getBaseExternalPluginAdapterInitInfoSerializer)()))]],{description:"CreateV2InstructionData"}),t=>({...t,discriminator:20,dataState:t.dataState??E1.DataState.AccountState,plugins:t.plugins??[],externalPluginAdapters:t.externalPluginAdapters??[]}))}Kl.getCreateV2InstructionDataSerializer=CL;function jne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},payer:{index:3,isWritable:!0,value:e.payer??null},owner:{index:4,isWritable:!1,value:e.owner??null},updateAuthority:{index:5,isWritable:!1,value:e.updateAuthority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Wne.getAccountMetasAndSigners)(s,"programId",r),u=CL().serialize(i);return(0,Kne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Kl.createV2=jne});var LL=S(Wl=>{"use strict";a();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.decompressV1=Wl.getDecompressV1InstructionDataSerializer=void 0;var Hne=re(),jx=q(),Gne=Ie(),$ne=ae();function ML(){return(0,jx.mapSerializer)((0,jx.struct)([["discriminator",(0,jx.u8)()],["compressionProof",(0,$ne.getCompressionProofSerializer)()]],{description:"DecompressV1InstructionData"}),t=>({...t,discriminator:18}))}Wl.getDecompressV1InstructionDataSerializer=ML;function Zne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Gne.getAccountMetasAndSigners)(s,"programId",r),u=ML().serialize(i);return(0,Hne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Wl.decompressV1=Zne});var UL=S(jl=>{"use strict";a();Object.defineProperty(jl,"__esModule",{value:!0});jl.executeV1=jl.getExecuteV1InstructionDataSerializer=void 0;var Yne=re(),pp=q(),Xne=zx(),DL=Ie();function qL(){return(0,pp.mapSerializer)((0,pp.struct)([["discriminator",(0,pp.u8)()],["instructionData",(0,pp.bytes)({size:(0,pp.u32)()})]],{description:"ExecuteV1InstructionData"}),t=>({...t,discriminator:31}))}jl.getExecuteV1InstructionDataSerializer=qL;function Jne(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},assetSigner:{index:2,isWritable:!1,value:e.assetSigner??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},programId:{index:6,isWritable:!1,value:e.programId??null}},i={...e};n.assetSigner.value||(n.assetSigner.value=(0,Xne.findAssetSignerPda)(t,{asset:(0,DL.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1),n.programId.value||(n.programId.value=r,n.programId.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,DL.getAccountMetasAndSigners)(s,"programId",r),u=qL().serialize(i);return(0,Yne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}jl.executeV1=Jne});var FL=S(Hl=>{"use strict";a();Object.defineProperty(Hl,"__esModule",{value:!0});Hl.removeAssetsFromGroupV1=Hl.getRemoveAssetsFromGroupV1InstructionDataSerializer=void 0;var Qne=re(),gp=q(),eie=Ie();function VL(){return(0,gp.mapSerializer)((0,gp.struct)([["discriminator",(0,gp.u8)()],["assets",(0,gp.array)((0,gp.publicKey)())]],{description:"RemoveAssetsFromGroupV1InstructionData"}),t=>({...t,discriminator:36}))}Hl.getRemoveAssetsFromGroupV1InstructionDataSerializer=VL;function tie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,eie.getAccountMetasAndSigners)(s,"programId",r),u=VL().serialize(i);return(0,Qne.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Hl.removeAssetsFromGroupV1=tie});var WL=S(Gl=>{"use strict";a();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.removeCollectionExternalPluginAdapterV1=Gl.getRemoveCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var rie=re(),Hx=q(),nie=Ie(),iie=ae();function KL(){return(0,Hx.mapSerializer)((0,Hx.struct)([["discriminator",(0,Hx.u8)()],["key",(0,iie.getBaseExternalPluginAdapterKeySerializer)()]],{description:"RemoveCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:25}))}Gl.getRemoveCollectionExternalPluginAdapterV1InstructionDataSerializer=KL;function sie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,nie.getAccountMetasAndSigners)(s,"programId",r),u=KL().serialize(i);return(0,rie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Gl.removeCollectionExternalPluginAdapterV1=sie});var HL=S($l=>{"use strict";a();Object.defineProperty($l,"__esModule",{value:!0});$l.removeCollectionPluginV1=$l.getRemoveCollectionPluginV1InstructionDataSerializer=void 0;var oie=re(),Gx=q(),aie=Ie(),cie=ae();function jL(){return(0,Gx.mapSerializer)((0,Gx.struct)([["discriminator",(0,Gx.u8)()],["pluginType",(0,cie.getPluginTypeSerializer)()]],{description:"RemoveCollectionPluginV1InstructionData"}),t=>({...t,discriminator:5}))}$l.getRemoveCollectionPluginV1InstructionDataSerializer=jL;function uie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,aie.getAccountMetasAndSigners)(s,"programId",r),u=jL().serialize(i);return(0,oie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}$l.removeCollectionPluginV1=uie});var $L=S(Zl=>{"use strict";a();Object.defineProperty(Zl,"__esModule",{value:!0});Zl.removeCollectionsFromGroupV1=Zl.getRemoveCollectionsFromGroupV1InstructionDataSerializer=void 0;var lie=re(),yp=q(),die=Ie();function GL(){return(0,yp.mapSerializer)((0,yp.struct)([["discriminator",(0,yp.u8)()],["collections",(0,yp.array)((0,yp.publicKey)())]],{description:"RemoveCollectionsFromGroupV1InstructionData"}),t=>({...t,discriminator:34}))}Zl.getRemoveCollectionsFromGroupV1InstructionDataSerializer=GL;function fie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,die.getAccountMetasAndSigners)(s,"programId",r),u=GL().serialize(i);return(0,lie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Zl.removeCollectionsFromGroupV1=fie});var YL=S(Yl=>{"use strict";a();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.removeExternalPluginAdapterV1=Yl.getRemoveExternalPluginAdapterV1InstructionDataSerializer=void 0;var hie=re(),$x=q(),pie=Ie(),gie=ae();function ZL(){return(0,$x.mapSerializer)((0,$x.struct)([["discriminator",(0,$x.u8)()],["key",(0,gie.getBaseExternalPluginAdapterKeySerializer)()]],{description:"RemoveExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:24}))}Yl.getRemoveExternalPluginAdapterV1InstructionDataSerializer=ZL;function yie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,pie.getAccountMetasAndSigners)(s,"programId",r),u=ZL().serialize(i);return(0,hie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Yl.removeExternalPluginAdapterV1=yie});var JL=S(Xl=>{"use strict";a();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.removeGroupsFromGroupV1=Xl.getRemoveGroupsFromGroupV1InstructionDataSerializer=void 0;var mie=re(),mp=q(),bie=Ie();function XL(){return(0,mp.mapSerializer)((0,mp.struct)([["discriminator",(0,mp.u8)()],["groups",(0,mp.array)((0,mp.publicKey)())]],{description:"RemoveGroupsFromGroupV1InstructionData"}),t=>({...t,discriminator:38}))}Xl.getRemoveGroupsFromGroupV1InstructionDataSerializer=XL;function _ie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={parentGroup:{index:0,isWritable:!0,value:e.parentGroup??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,bie.getAccountMetasAndSigners)(s,"programId",r),u=XL().serialize(i);return(0,mie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Xl.removeGroupsFromGroupV1=_ie});var eD=S(Jl=>{"use strict";a();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.removePluginV1=Jl.getRemovePluginV1InstructionDataSerializer=void 0;var Aie=re(),Zx=q(),Sie=Ie(),vie=ae();function QL(){return(0,Zx.mapSerializer)((0,Zx.struct)([["discriminator",(0,Zx.u8)()],["pluginType",(0,vie.getPluginTypeSerializer)()]],{description:"RemovePluginV1InstructionData"}),t=>({...t,discriminator:4}))}Jl.getRemovePluginV1InstructionDataSerializer=QL;function Eie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Sie.getAccountMetasAndSigners)(s,"programId",r),u=QL().serialize(i);return(0,Aie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Jl.removePluginV1=Eie});var rD=S(Ql=>{"use strict";a();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.revokeCollectionPluginAuthorityV1=Ql.getRevokeCollectionPluginAuthorityV1InstructionDataSerializer=void 0;var wie=re(),Yx=q(),xie=Ie(),Iie=ae();function tD(){return(0,Yx.mapSerializer)((0,Yx.struct)([["discriminator",(0,Yx.u8)()],["pluginType",(0,Iie.getPluginTypeSerializer)()]],{description:"RevokeCollectionPluginAuthorityV1InstructionData"}),t=>({...t,discriminator:11}))}Ql.getRevokeCollectionPluginAuthorityV1InstructionDataSerializer=tD;function Pie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,xie.getAccountMetasAndSigners)(s,"programId",r),u=tD().serialize(i);return(0,wie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Ql.revokeCollectionPluginAuthorityV1=Pie});var iD=S(ed=>{"use strict";a();Object.defineProperty(ed,"__esModule",{value:!0});ed.revokePluginAuthorityV1=ed.getRevokePluginAuthorityV1InstructionDataSerializer=void 0;var Rie=re(),Xx=q(),Oie=Ie(),Bie=ae();function nD(){return(0,Xx.mapSerializer)((0,Xx.struct)([["discriminator",(0,Xx.u8)()],["pluginType",(0,Bie.getPluginTypeSerializer)()]],{description:"RevokePluginAuthorityV1InstructionData"}),t=>({...t,discriminator:10}))}ed.getRevokePluginAuthorityV1InstructionDataSerializer=nD;function Tie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Oie.getAccountMetasAndSigners)(s,"programId",r),u=nD().serialize(i);return(0,Rie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ed.revokePluginAuthorityV1=Tie});var aD=S(td=>{"use strict";a();Object.defineProperty(td,"__esModule",{value:!0});td.transferV1=td.getTransferV1InstructionDataSerializer=void 0;var sD=re(),w1=q(),zie=Ie(),kie=ae();function oD(){return(0,w1.mapSerializer)((0,w1.struct)([["discriminator",(0,w1.u8)()],["compressionProof",(0,w1.option)((0,kie.getCompressionProofSerializer)())]],{description:"TransferV1InstructionData"}),t=>({...t,discriminator:14,compressionProof:t.compressionProof??(0,sD.none)()}))}td.getTransferV1InstructionDataSerializer=oD;function Cie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},newOwner:{index:4,isWritable:!1,value:e.newOwner??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,zie.getAccountMetasAndSigners)(s,"programId",r),u=oD().serialize(i);return(0,sD.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}td.transferV1=Cie});var lD=S(rd=>{"use strict";a();Object.defineProperty(rd,"__esModule",{value:!0});rd.updateCollectionExternalPluginAdapterV1=rd.getUpdateCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var Nie=re(),Jx=q(),Mie=Ie(),cD=ae();function uD(){return(0,Jx.mapSerializer)((0,Jx.struct)([["discriminator",(0,Jx.u8)()],["key",(0,cD.getBaseExternalPluginAdapterKeySerializer)()],["updateInfo",(0,cD.getBaseExternalPluginAdapterUpdateInfoSerializer)()]],{description:"UpdateCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:27}))}rd.getUpdateCollectionExternalPluginAdapterV1InstructionDataSerializer=uD;function Lie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Mie.getAccountMetasAndSigners)(s,"programId",r),u=uD().serialize(i);return(0,Nie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}rd.updateCollectionExternalPluginAdapterV1=Lie});var fD=S(nd=>{"use strict";a();Object.defineProperty(nd,"__esModule",{value:!0});nd.updateCollectionInfoV1=nd.getUpdateCollectionInfoV1InstructionDataSerializer=void 0;var Die=re(),x1=q(),qie=Ie(),Uie=ae();function dD(){return(0,x1.mapSerializer)((0,x1.struct)([["discriminator",(0,x1.u8)()],["updateType",(0,Uie.getUpdateTypeSerializer)()],["amount",(0,x1.u32)()]],{description:"UpdateCollectionInfoV1InstructionData"}),t=>({...t,discriminator:32}))}nd.getUpdateCollectionInfoV1InstructionDataSerializer=dD;function Vie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},bubblegumSigner:{index:1,isWritable:!1,value:e.bubblegumSigner??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,qie.getAccountMetasAndSigners)(s,"programId",r),u=dD().serialize(i);return(0,Die.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}nd.updateCollectionInfoV1=Vie});var pD=S(id=>{"use strict";a();Object.defineProperty(id,"__esModule",{value:!0});id.updateCollectionPluginV1=id.getUpdateCollectionPluginV1InstructionDataSerializer=void 0;var Fie=re(),Qx=q(),Kie=Ie(),Wie=ae();function hD(){return(0,Qx.mapSerializer)((0,Qx.struct)([["discriminator",(0,Qx.u8)()],["plugin",(0,Wie.getPluginSerializer)()]],{description:"UpdateCollectionPluginV1InstructionData"}),t=>({...t,discriminator:7}))}id.getUpdateCollectionPluginV1InstructionDataSerializer=hD;function jie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Kie.getAccountMetasAndSigners)(s,"programId",r),u=hD().serialize(i);return(0,Fie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}id.updateCollectionPluginV1=jie});var yD=S(sd=>{"use strict";a();Object.defineProperty(sd,"__esModule",{value:!0});sd.updateCollectionV1=sd.getUpdateCollectionV1InstructionDataSerializer=void 0;var eI=re(),Pc=q(),Hie=Ie();function gD(){return(0,Pc.mapSerializer)((0,Pc.struct)([["discriminator",(0,Pc.u8)()],["newName",(0,Pc.option)((0,Pc.string)())],["newUri",(0,Pc.option)((0,Pc.string)())]],{description:"UpdateCollectionV1InstructionData"}),t=>({...t,discriminator:16,newName:t.newName??(0,eI.none)(),newUri:t.newUri??(0,eI.none)()}))}sd.getUpdateCollectionV1InstructionDataSerializer=gD;function Gie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},newUpdateAuthority:{index:3,isWritable:!1,value:e.newUpdateAuthority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Hie.getAccountMetasAndSigners)(s,"programId",r),u=gD().serialize(i);return(0,eI.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}sd.updateCollectionV1=Gie});var _D=S(od=>{"use strict";a();Object.defineProperty(od,"__esModule",{value:!0});od.updateExternalPluginAdapterV1=od.getUpdateExternalPluginAdapterV1InstructionDataSerializer=void 0;var $ie=re(),tI=q(),Zie=Ie(),mD=ae();function bD(){return(0,tI.mapSerializer)((0,tI.struct)([["discriminator",(0,tI.u8)()],["key",(0,mD.getBaseExternalPluginAdapterKeySerializer)()],["updateInfo",(0,mD.getBaseExternalPluginAdapterUpdateInfoSerializer)()]],{description:"UpdateExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:26}))}od.getUpdateExternalPluginAdapterV1InstructionDataSerializer=bD;function Yie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Zie.getAccountMetasAndSigners)(s,"programId",r),u=bD().serialize(i);return(0,$ie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}od.updateExternalPluginAdapterV1=Yie});var SD=S(ad=>{"use strict";a();Object.defineProperty(ad,"__esModule",{value:!0});ad.updateGroupV1=ad.getUpdateGroupV1InstructionDataSerializer=void 0;var rI=re(),Rc=q(),Xie=Ie();function AD(){return(0,Rc.mapSerializer)((0,Rc.struct)([["discriminator",(0,Rc.u8)()],["newName",(0,Rc.option)((0,Rc.string)())],["newUri",(0,Rc.option)((0,Rc.string)())]],{description:"UpdateGroupV1InstructionData"}),t=>({...t,discriminator:41,newName:t.newName??(0,rI.none)(),newUri:t.newUri??(0,rI.none)()}))}ad.getUpdateGroupV1InstructionDataSerializer=AD;function Jie(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},newUpdateAuthority:{index:3,isWritable:!1,value:e.newUpdateAuthority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Xie.getAccountMetasAndSigners)(s,"programId",r),u=AD().serialize(i);return(0,rI.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ad.updateGroupV1=Jie});var ED=S(cd=>{"use strict";a();Object.defineProperty(cd,"__esModule",{value:!0});cd.updatePluginV1=cd.getUpdatePluginV1InstructionDataSerializer=void 0;var Qie=re(),nI=q(),ese=Ie(),tse=ae();function vD(){return(0,nI.mapSerializer)((0,nI.struct)([["discriminator",(0,nI.u8)()],["plugin",(0,tse.getPluginSerializer)()]],{description:"UpdatePluginV1InstructionData"}),t=>({...t,discriminator:6}))}cd.getUpdatePluginV1InstructionDataSerializer=vD;function rse(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ese.getAccountMetasAndSigners)(s,"programId",r),u=vD().serialize(i);return(0,Qie.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}cd.updatePluginV1=rse});var xD=S(ud=>{"use strict";a();Object.defineProperty(ud,"__esModule",{value:!0});ud.updateV1=ud.getUpdateV1InstructionDataSerializer=void 0;var I1=re(),ea=q(),nse=Ie(),ise=ae();function wD(){return(0,ea.mapSerializer)((0,ea.struct)([["discriminator",(0,ea.u8)()],["newName",(0,ea.option)((0,ea.string)())],["newUri",(0,ea.option)((0,ea.string)())],["newUpdateAuthority",(0,ea.option)((0,ise.getBaseUpdateAuthoritySerializer)())]],{description:"UpdateV1InstructionData"}),t=>({...t,discriminator:15,newName:t.newName??(0,I1.none)(),newUri:t.newUri??(0,I1.none)(),newUpdateAuthority:t.newUpdateAuthority??(0,I1.none)()}))}ud.getUpdateV1InstructionDataSerializer=wD;function sse(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,nse.getAccountMetasAndSigners)(s,"programId",r),u=wD().serialize(i);return(0,I1.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ud.updateV1=sse});var PD=S(ld=>{"use strict";a();Object.defineProperty(ld,"__esModule",{value:!0});ld.updateV2=ld.getUpdateV2InstructionDataSerializer=void 0;var P1=re(),ta=q(),ose=Ie(),ase=ae();function ID(){return(0,ta.mapSerializer)((0,ta.struct)([["discriminator",(0,ta.u8)()],["newName",(0,ta.option)((0,ta.string)())],["newUri",(0,ta.option)((0,ta.string)())],["newUpdateAuthority",(0,ta.option)((0,ase.getBaseUpdateAuthoritySerializer)())]],{description:"UpdateV2InstructionData"}),t=>({...t,discriminator:30,newName:t.newName??(0,P1.none)(),newUri:t.newUri??(0,P1.none)(),newUpdateAuthority:t.newUpdateAuthority??(0,P1.none)()}))}ld.getUpdateV2InstructionDataSerializer=ID;function cse(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},newCollection:{index:4,isWritable:!0,value:e.newCollection??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ose.getAccountMetasAndSigners)(s,"programId",r),u=ID().serialize(i);return(0,P1.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ld.updateV2=cse});var OD=S(fd=>{"use strict";a();Object.defineProperty(fd,"__esModule",{value:!0});fd.writeCollectionExternalPluginAdapterDataV1=fd.getWriteCollectionExternalPluginAdapterDataV1InstructionDataSerializer=void 0;var use=re(),dd=q(),lse=Ie(),dse=ae();function RD(){return(0,dd.mapSerializer)((0,dd.struct)([["discriminator",(0,dd.u8)()],["key",(0,dse.getBaseExternalPluginAdapterKeySerializer)()],["data",(0,dd.option)((0,dd.bytes)({size:(0,dd.u32)()}))]],{description:"WriteCollectionExternalPluginAdapterDataV1InstructionData"}),t=>({...t,discriminator:29}))}fd.getWriteCollectionExternalPluginAdapterDataV1InstructionDataSerializer=RD;function fse(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},buffer:{index:3,isWritable:!1,value:e.buffer??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,lse.getAccountMetasAndSigners)(s,"programId",r),u=RD().serialize(i);return(0,use.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}fd.writeCollectionExternalPluginAdapterDataV1=fse});var TD=S(pd=>{"use strict";a();Object.defineProperty(pd,"__esModule",{value:!0});pd.writeExternalPluginAdapterDataV1=pd.getWriteExternalPluginAdapterDataV1InstructionDataSerializer=void 0;var hse=re(),hd=q(),pse=Ie(),gse=ae();function BD(){return(0,hd.mapSerializer)((0,hd.struct)([["discriminator",(0,hd.u8)()],["key",(0,gse.getBaseExternalPluginAdapterKeySerializer)()],["data",(0,hd.option)((0,hd.bytes)({size:(0,hd.u32)()}))]],{description:"WriteExternalPluginAdapterDataV1InstructionData"}),t=>({...t,discriminator:28}))}pd.getWriteExternalPluginAdapterDataV1InstructionDataSerializer=BD;function yse(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},buffer:{index:4,isWritable:!1,value:e.buffer??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,pse.getAccountMetasAndSigners)(s,"programId",r),u=BD().serialize(i);return(0,hse.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}pd.writeExternalPluginAdapterDataV1=yse});var zD=S(Ee=>{"use strict";a();var mse=Ee&&Ee.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Re=Ee&&Ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mse(e,t,r)};Object.defineProperty(Ee,"__esModule",{value:!0});Re(KM(),Ee);Re(jM(),Ee);Re(ZM(),Ee);Re(XM(),Ee);Re(QM(),Ee);Re(tL(),Ee);Re(sL(),Ee);Re(cL(),Ee);Re(dL(),Ee);Re(hL(),Ee);Re(yL(),Ee);Re(bL(),Ee);Re(AL(),Ee);Re(vL(),Ee);Re(xL(),Ee);Re(OL(),Ee);Re(TL(),Ee);Re(kL(),Ee);Re(NL(),Ee);Re(LL(),Ee);Re(UL(),Ee);Re(FL(),Ee);Re(WL(),Ee);Re(HL(),Ee);Re($L(),Ee);Re(YL(),Ee);Re(JL(),Ee);Re(eD(),Ee);Re(rD(),Ee);Re(iD(),Ee);Re(aD(),Ee);Re(lD(),Ee);Re(fD(),Ee);Re(pD(),Ee);Re(yD(),Ee);Re(_D(),Ee);Re(SD(),Ee);Re(ED(),Ee);Re(xD(),Ee);Re(PD(),Ee);Re(OD(),Ee);Re(TD(),Ee)});var CD=S(Jn=>{"use strict";a();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.getMplCoreProgramId=Jn.getMplCoreProgram=Jn.createMplCoreProgram=Jn.MPL_CORE_PROGRAM_ID=void 0;var kD=kx();Jn.MPL_CORE_PROGRAM_ID="CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d";function bse(){return{name:"mplCore",publicKey:Jn.MPL_CORE_PROGRAM_ID,getErrorFromCode(t,e){return(0,kD.getMplCoreErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,kD.getMplCoreErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Jn.createMplCoreProgram=bse;function _se(t,e){return t.programs.get("mplCore",e)}Jn.getMplCoreProgram=_se;function Ase(t,e){return t.programs.getPublicKey("mplCore",Jn.MPL_CORE_PROGRAM_ID,e)}Jn.getMplCoreProgramId=Ase});var ND=S(Oc=>{"use strict";a();var Sse=Oc&&Oc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),vse=Oc&&Oc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sse(e,t,r)};Object.defineProperty(Oc,"__esModule",{value:!0});vse(CD(),Oc)});var we=S(Qn=>{"use strict";a();var Ese=Qn&&Qn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),gd=Qn&&Qn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ese(e,t,r)};Object.defineProperty(Qn,"__esModule",{value:!0});gd(zx(),Qn);gd(kx(),Qn);gd(zD(),Qn);gd(ND(),Qn);gd(Ie(),Qn);gd(ae(),Qn)});var MD=S(R1=>{"use strict";a();Object.defineProperty(R1,"__esModule",{value:!0});R1.mplCore=void 0;var wse=we(),xse=()=>({install(t){t.programs.add((0,wse.createMplCoreProgram)(),!1)}});R1.mplCore=xse});var i8=S(Pe=>{"use strict";a();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.toBig=Pe.shrSL=Pe.shrSH=Pe.rotrSL=Pe.rotrSH=Pe.rotrBL=Pe.rotrBH=Pe.rotr32L=Pe.rotr32H=Pe.rotlSL=Pe.rotlSH=Pe.rotlBL=Pe.rotlBH=Pe.add5L=Pe.add5H=Pe.add4L=Pe.add4H=Pe.add3L=Pe.add3H=void 0;Pe.add=XD;Pe.fromBig=sI;Pe.split=LD;var O1=BigInt(2**32-1),iI=BigInt(32);function sI(t,e=!1){return e?{h:Number(t&O1),l:Number(t>>iI&O1)}:{h:Number(t>>iI&O1)|0,l:Number(t&O1)|0}}function LD(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:o,l:c}=sI(t[s],e);[n[s],i[s]]=[o,c]}return[n,i]}var DD=(t,e)=>BigInt(t>>>0)<<iI|BigInt(e>>>0);Pe.toBig=DD;var qD=(t,e,r)=>t>>>r;Pe.shrSH=qD;var UD=(t,e,r)=>t<<32-r|e>>>r;Pe.shrSL=UD;var VD=(t,e,r)=>t>>>r|e<<32-r;Pe.rotrSH=VD;var FD=(t,e,r)=>t<<32-r|e>>>r;Pe.rotrSL=FD;var KD=(t,e,r)=>t<<64-r|e>>>r-32;Pe.rotrBH=KD;var WD=(t,e,r)=>t>>>r-32|e<<64-r;Pe.rotrBL=WD;var jD=(t,e)=>e;Pe.rotr32H=jD;var HD=(t,e)=>t;Pe.rotr32L=HD;var GD=(t,e,r)=>t<<r|e>>>32-r;Pe.rotlSH=GD;var $D=(t,e,r)=>e<<r|t>>>32-r;Pe.rotlSL=$D;var ZD=(t,e,r)=>e<<r-32|t>>>64-r;Pe.rotlBH=ZD;var YD=(t,e,r)=>t<<r-32|e>>>64-r;Pe.rotlBL=YD;function XD(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var JD=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);Pe.add3L=JD;var QD=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;Pe.add3H=QD;var e8=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);Pe.add4L=e8;var t8=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;Pe.add4H=t8;var r8=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Pe.add5L=r8;var n8=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0;Pe.add5H=n8;var Ise={fromBig:sI,split:LD,toBig:DD,shrSH:qD,shrSL:UD,rotrSH:VD,rotrSL:FD,rotrBH:KD,rotrBL:WD,rotr32H:jD,rotr32L:HD,rotlSH:GD,rotlSL:$D,rotlBH:ZD,rotlBL:YD,add:XD,add3L:JD,add3H:QD,add4L:e8,add4H:t8,add5H:n8,add5L:r8};Pe.default=Ise});var s8=S(B1=>{"use strict";a();Object.defineProperty(B1,"__esModule",{value:!0});B1.crypto=void 0;B1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var h8=S(Ae=>{"use strict";a();Object.defineProperty(Ae,"__esModule",{value:!0});Ae.wrapXOFConstructorWithOpts=Ae.wrapConstructorWithOpts=Ae.wrapConstructor=Ae.Hash=Ae.nextTick=Ae.swap32IfBE=Ae.byteSwapIfBE=Ae.swap8IfBE=Ae.isLE=void 0;Ae.isBytes=a8;Ae.anumber=oI;Ae.abytes=md;Ae.ahash=Pse;Ae.aexists=Rse;Ae.aoutput=Ose;Ae.u8=Bse;Ae.u32=Tse;Ae.clean=zse;Ae.createView=kse;Ae.rotr=Cse;Ae.rotl=Nse;Ae.byteSwap=cI;Ae.byteSwap32=c8;Ae.bytesToHex=Lse;Ae.hexToBytes=Dse;Ae.asyncLoop=Use;Ae.utf8ToBytes=uI;Ae.bytesToUtf8=Vse;Ae.toBytes=T1;Ae.kdfInputToBytes=Fse;Ae.concatBytes=Kse;Ae.checkOpts=Wse;Ae.createHasher=l8;Ae.createOptHasher=d8;Ae.createXOFer=f8;Ae.randomBytes=jse;var yd=s8();function a8(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function oI(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function md(t,...e){if(!a8(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Pse(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");oI(t.outputLen),oI(t.blockLen)}function Rse(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ose(t,e){md(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Bse(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function Tse(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function zse(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function kse(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Cse(t,e){return t<<32-e|t>>>e}function Nse(t,e){return t<<e|t>>>32-e>>>0}Ae.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function cI(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}Ae.swap8IfBE=Ae.isLE?t=>t:t=>cI(t);Ae.byteSwapIfBE=Ae.swap8IfBE;function c8(t){for(let e=0;e<t.length;e++)t[e]=cI(t[e]);return t}Ae.swap32IfBE=Ae.isLE?t=>t:c8;var u8=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mse=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Lse(t){if(md(t),u8)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=Mse[t[r]];return e}var Ks={_0:48,_9:57,A:65,F:70,a:97,f:102};function o8(t){if(t>=Ks._0&&t<=Ks._9)return t-Ks._0;if(t>=Ks.A&&t<=Ks.F)return t-(Ks.A-10);if(t>=Ks.a&&t<=Ks.f)return t-(Ks.a-10)}function Dse(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(u8)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let o=o8(t.charCodeAt(s)),c=o8(t.charCodeAt(s+1));if(o===void 0||c===void 0){let u=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}var qse=async()=>{};Ae.nextTick=qse;async function Use(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let s=Date.now()-n;s>=0&&s<e||(await(0,Ae.nextTick)(),n+=s)}}function uI(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Vse(t){return new TextDecoder().decode(t)}function T1(t){return typeof t=="string"&&(t=uI(t)),md(t),t}function Fse(t){return typeof t=="string"&&(t=uI(t)),md(t),t}function Kse(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];md(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}function Wse(t,e){if(e!==void 0&&{}.toString.call(e)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(t,e)}var aI=class{};Ae.Hash=aI;function l8(t){let e=n=>t().update(T1(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function d8(t){let e=(n,i)=>t(i).update(T1(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function f8(t){let e=(n,i)=>t(i).update(T1(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}Ae.wrapConstructor=l8;Ae.wrapConstructorWithOpts=d8;Ae.wrapXOFConstructorWithOpts=f8;function jse(t=32){if(yd.crypto&&typeof yd.crypto.getRandomValues=="function")return yd.crypto.getRandomValues(new Uint8Array(t));if(yd.crypto&&typeof yd.crypto.randomBytes=="function")return Uint8Array.from(yd.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}});var v8=S(tt=>{"use strict";a();Object.defineProperty(tt,"__esModule",{value:!0});tt.shake256=tt.shake128=tt.keccak_512=tt.keccak_384=tt.keccak_256=tt.keccak_224=tt.sha3_512=tt.sha3_384=tt.sha3_256=tt.sha3_224=tt.Keccak=void 0;tt.keccakP=A8;var _p=i8(),Zr=h8(),Hse=BigInt(0),bp=BigInt(1),Gse=BigInt(2),$se=BigInt(7),Zse=BigInt(256),Yse=BigInt(113),y8=[],m8=[],b8=[];for(let t=0,e=bp,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],y8.push(2*(5*n+r)),m8.push((t+1)*(t+2)/2%64);let i=Hse;for(let s=0;s<7;s++)e=(e<<bp^(e>>$se)*Yse)%Zse,e&Gse&&(i^=bp<<(bp<<BigInt(s))-bp);b8.push(i)}var _8=(0,_p.split)(b8,!0),Xse=_8[0],Jse=_8[1],p8=(t,e,r)=>r>32?(0,_p.rotlBH)(t,e,r):(0,_p.rotlSH)(t,e,r),g8=(t,e,r)=>r>32?(0,_p.rotlBL)(t,e,r):(0,_p.rotlSL)(t,e,r);function A8(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],m=p8(d,f,1)^r[c],_=g8(d,f,1)^r[c+1];for(let v=0;v<50;v+=10)t[o+v]^=m,t[o+v+1]^=_}let i=t[2],s=t[3];for(let o=0;o<24;o++){let c=m8[o],u=p8(i,s,c),d=g8(i,s,c),f=y8[o];i=t[f],s=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=Xse[n],t[1]^=Jse[n]}(0,Zr.clean)(r)}var Ap=class t extends Zr.Hash{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,(0,Zr.anumber)(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,Zr.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,Zr.swap32IfBE)(this.state32),A8(this.state32,this.rounds),(0,Zr.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,Zr.aexists)(this),e=(0,Zr.toBytes)(e),(0,Zr.abytes)(e);let{blockLen:r,state:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(r-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){(0,Zr.aexists)(this,!1),(0,Zr.abytes)(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}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,Zr.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,Zr.aoutput)(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,(0,Zr.clean)(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new t(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};tt.Keccak=Ap;var ra=(t,e,r)=>(0,Zr.createHasher)(()=>new Ap(e,t,r));tt.sha3_224=ra(6,144,224/8);tt.sha3_256=ra(6,136,256/8);tt.sha3_384=ra(6,104,384/8);tt.sha3_512=ra(6,72,512/8);tt.keccak_224=ra(1,144,224/8);tt.keccak_256=ra(1,136,256/8);tt.keccak_384=ra(1,104,384/8);tt.keccak_512=ra(1,72,512/8);var S8=(t,e,r)=>(0,Zr.createXOFer)((n={})=>new Ap(e,t,n.dkLen===void 0?r:n.dkLen,!0));tt.shake128=S8(31,168,128/8);tt.shake256=S8(31,136,256/8)});var E8=S(z1=>{"use strict";a();Object.defineProperty(z1,"__esModule",{value:!0});z1.hash=void 0;var Qse=q(),eoe=v8();function toe(t){return(0,eoe.keccak_256)(Array.isArray(t)?(0,Qse.mergeBytes)(t):t)}z1.hash=toe});var C1=S(es=>{"use strict";a();Object.defineProperty(es,"__esModule",{value:!0});es.addressPluginAuthority=es.updatePluginAuthority=es.ownerPluginAuthority=es.nonePluginAuthority=void 0;var k1=$e();function roe(){return(0,k1.pluginAuthority)("None")}es.nonePluginAuthority=roe;function noe(){return(0,k1.pluginAuthority)("Owner")}es.ownerPluginAuthority=noe;function ioe(){return(0,k1.pluginAuthority)("UpdateAuthority")}es.updatePluginAuthority=ioe;function soe(t){return(0,k1.pluginAuthority)("Address",{address:t})}es.addressPluginAuthority=soe});var bd=S(Er=>{"use strict";a();Object.defineProperty(Er,"__esModule",{value:!0});Er.isAssetOwner=Er.isFrozen=Er.deriveAssetPlugins=Er.deriveExternalPluginAdapters=Er.getExternalPluginAdapterKeyAsString=Er.collectionAddress=void 0;var ooe=re(),aoe=$e();function coe(t){if(t.updateAuthority.type==="Collection")return t.updateAuthority.address}Er.collectionAddress=coe;var uoe=["oracles","appDatas","lifecycleHooks","dataSections","linkedAppDatas","agentIdentities"],loe=t=>{switch(t.type){case"Oracle":return`${t.type}-${t.baseAddress}`;case"AppData":return`${t.type}-${t.dataAuthority.type}${t.dataAuthority.address?`-${t.dataAuthority.address}`:""}`;case"LifecycleHook":return`${t.type}-${t.hookedProgram}`;case"LinkedAppData":return`${t.type}-${t.dataAuthority.type}${t.dataAuthority.address?`-${t.dataAuthority.address}`:""}`;case"DataSection":return`${t.type}-${(0,Er.getExternalPluginAdapterKeyAsString)(t.parentKey)}`;case"AgentIdentity":return t.type;default:throw new Error("Unknown ExternalPluginAdapter type")}};Er.getExternalPluginAdapterKeyAsString=loe;var doe=(t,e)=>{if(!e)return t;let r={};return uoe.forEach(n=>{let i=new Set;(t[n]||e[n])&&(r[n]=[]),t[n]?.forEach(s=>{i.add((0,Er.getExternalPluginAdapterKeyAsString)(s)),r[n]?.push(s)}),e[n]?.forEach(s=>{i.has((0,Er.getExternalPluginAdapterKeyAsString)(s))||r[n]?.push(s)})}),r};Er.deriveExternalPluginAdapters=doe;function w8(t,e){if(!e)return t;let r=(0,Er.deriveExternalPluginAdapters)(t,e);r.dataSections?.forEach(c=>{let u,d;if(c.parentKey.type==="LinkedAppData")d=c.parentKey.dataAuthority,u=r.linkedAppDatas?.find(f=>(0,aoe.comparePluginAuthorities)(d,f.dataAuthority)),u&&(u.data=c.data);else throw new Error("LinkedLifecycleHook currently unsupported")});let{numMinted:n,currentSize:i,masterEdition:s,...o}=e;return{...o,...t,...r}}Er.deriveAssetPlugins=w8;function foe(t,e){let r=w8(t,e);return r.freezeDelegate?.frozen||r.permanentFreezeDelegate?.frozen||!1}Er.isFrozen=foe;function hoe(t,e){return(0,ooe.publicKey)(t)===e.owner}Er.isAssetOwner=hoe});var N1=S(ei=>{"use strict";a();Object.defineProperty(ei,"__esModule",{value:!0});ei.hasCollectionUpdateAuthority=ei.hasAssetUpdateAuthority=ei.hasPluginUpdateAuthority=ei.hasPluginOwnerAuthority=ei.hasPluginAddressAuthority=void 0;var lI=re(),x8=bd();function poe(t,e){return e.type==="Address"&&e.address===(0,lI.publicKey)(t)}ei.hasPluginAddressAuthority=poe;function goe(t,e,r){return e.type==="Owner"&&(0,x8.isAssetOwner)(t,r)}ei.hasPluginOwnerAuthority=goe;function yoe(t,e,r,n){return e.type==="UpdateAuthority"&&I8(t,r,n)}ei.hasPluginUpdateAuthority=yoe;function I8(t,e,r){let n=(0,lI.publicKey)(t),i=(0,x8.deriveAssetPlugins)(e,r);if(i.updateAuthority.type==="Collection"&&i.updateAuthority.address!==r?.publicKey)throw Error("Collection mismatch");return i.updateAuthority.type==="Address"&&i.updateAuthority.address===n||i.updateDelegate?.authority.type==="Address"&&i.updateDelegate?.authority.address===n||i.updateDelegate?.authority.type==="Owner"&&i.owner===n||i.updateAuthority.type==="Collection"&&r?.updateAuthority===n}ei.hasAssetUpdateAuthority=I8;function moe(t,e){let r=(0,lI.publicKey)(t);return e.updateAuthority===r||e.updateDelegate?.authority.type==="Address"&&e.updateDelegate?.authority.address===r}ei.hasCollectionUpdateAuthority=moe});var fI=S(na=>{"use strict";a();Object.defineProperty(na,"__esModule",{value:!0});na.checkPluginAuthorities=na.pluginTypeFromAssetPluginKey=na.assetPluginKeyFromType=void 0;var boe=re(),R8=cl(),O8=we(),dI=bd(),P8=N1();function B8(t){return(0,R8.lowercaseFirstLetter)(O8.PluginType[t])}na.assetPluginKeyFromType=B8;function _oe(t){return O8.PluginType[(0,R8.capitalizeFirstLetter)(t)]}na.pluginTypeFromAssetPluginKey=_oe;function Aoe({authority:t,pluginTypes:e,asset:r,collection:n}){let i=(0,dI.collectionAddress)(r);if(i&&i!==n?.publicKey)throw new Error("Collection mismatch");let s=(0,dI.deriveAssetPlugins)(r,n),o=(0,boe.publicKey)(t),c=(0,P8.hasAssetUpdateAuthority)(o,r,n),u=(0,dI.isAssetOwner)(o,r);return e.map(d=>{let f=s[B8(d)];return!!(f&&((0,P8.hasPluginAddressAuthority)(o,f.authority)||f.authority.type==="UpdateAuthority"&&c||f.authority.type==="Owner"&&u))})}na.checkPluginAuthorities=Aoe});var z8=S(Cr=>{"use strict";a();Object.defineProperty(Cr,"__esModule",{value:!0});Cr.validateUpdate=Cr.canUpdate=Cr.validateBurn=Cr.canBurn=Cr.validateTransfer=Cr.canTransfer=Cr.LifecycleValidationError=void 0;var Ri=we(),ia=bd(),sa=fI(),T8=N1(),ts=$e(),Ws;(function(t){t.OracleValidationFailed="Oracle validation failed.",t.NoAuthority="No authority to perform this action.",t.AssetFrozen="Asset is frozen."})(Ws=Cr.LifecycleValidationError||(Cr.LifecycleValidationError={}));function Soe(t,e,r){let n=(0,ia.deriveAssetPlugins)(e,r);return(0,sa.checkPluginAuthorities)({authority:t,pluginTypes:[Ri.PluginType.PermanentTransferDelegate],asset:n,collection:r}).some(o=>o)?!0:(0,ia.isFrozen)(e,r)?!1:n.owner===t?!0:(0,sa.checkPluginAuthorities)({authority:t,pluginTypes:[Ri.PluginType.TransferDelegate],asset:n,collection:r}).some(o=>o)}Cr.canTransfer=Soe;async function voe(t,{authority:e,asset:r,collection:n,recipient:i}){let s=(0,ia.deriveAssetPlugins)(r,n);if((0,sa.checkPluginAuthorities)({authority:e,pluginTypes:[Ri.PluginType.PermanentTransferDelegate],asset:s,collection:n}).some(u=>u))return null;if((0,ia.isFrozen)(r,n))return Ws.AssetFrozen;if(s.oracles?.length){let u=s.oracles.filter(d=>d.lifecycleChecks?.transfer?.includes(ts.CheckResult.CAN_REJECT)).filter(d=>!!(!d.baseAddressConfig||i||!(0,ts.getExtraAccountRequiredInputs)(d.baseAddressConfig).includes("recipient")));if(u.length){let d=u.map(_=>({pubkey:(0,ts.findOracleAccount)(t,_,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner,recipient:i}),offset:_.resultsOffset}));if(!(await t.rpc.getAccounts(d.map(_=>_.pubkey))).map((_,v)=>_.exists?(0,ts.deserializeOracleValidation)(_.data,d[v].offset):null).every(_=>_?.__kind==="Uninitialized"?!1:_?.transfer===Ri.ExternalValidationResult.Pass))return Ws.OracleValidationFailed}}return s.owner===e||(0,sa.checkPluginAuthorities)({authority:e,pluginTypes:[Ri.PluginType.TransferDelegate],asset:s,collection:n}).some(u=>u)?null:Ws.NoAuthority}Cr.validateTransfer=voe;function Eoe(t,e,r){let n=(0,ia.deriveAssetPlugins)(e,r);return(0,sa.checkPluginAuthorities)({authority:t,pluginTypes:[Ri.PluginType.PermanentBurnDelegate],asset:n,collection:r}).some(o=>o)?!0:(0,ia.isFrozen)(e,r)?!1:n.owner===t?!0:(0,sa.checkPluginAuthorities)({authority:t,pluginTypes:[Ri.PluginType.BurnDelegate],asset:e,collection:r}).some(o=>o)}Cr.canBurn=Eoe;async function woe(t,{authority:e,asset:r,collection:n}){let i=(0,ia.deriveAssetPlugins)(r,n);if((0,sa.checkPluginAuthorities)({authority:e,pluginTypes:[Ri.PluginType.PermanentBurnDelegate],asset:i,collection:n}).some(c=>c))return null;if((0,ia.isFrozen)(r,n))return Ws.AssetFrozen;if(i.oracles?.length){let c=i.oracles.filter(u=>u.lifecycleChecks?.burn?.includes(ts.CheckResult.CAN_REJECT));if(c.length){let u=c.map(m=>({pubkey:(0,ts.findOracleAccount)(t,m,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner}),offset:m.resultsOffset}));if(!(await t.rpc.getAccounts(u.map(m=>m.pubkey))).map((m,_)=>m.exists?(0,ts.deserializeOracleValidation)(m.data,u[_].offset):null).every(m=>m?.__kind==="Uninitialized"?!1:m?.burn===Ri.ExternalValidationResult.Pass))return Ws.OracleValidationFailed}}return i.owner===e||(0,sa.checkPluginAuthorities)({authority:e,pluginTypes:[Ri.PluginType.BurnDelegate],asset:r,collection:n}).some(c=>c)?null:Ws.NoAuthority}Cr.validateBurn=woe;function xoe(t,e,r){return(0,T8.hasAssetUpdateAuthority)(t,e,r)}Cr.canUpdate=xoe;async function Ioe(t,{authority:e,asset:r,collection:n}){if(r.oracles?.length){let i=r.oracles.filter(s=>s.lifecycleChecks?.update?.includes(ts.CheckResult.CAN_REJECT));if(i.length){let s=i.map(u=>({pubkey:(0,ts.findOracleAccount)(t,u,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner}),offset:u.resultsOffset}));if(!(await t.rpc.getAccounts(s.map(u=>u.pubkey))).map((u,d)=>u.exists?(0,ts.deserializeOracleValidation)(u.data,s[d].offset):null).every(u=>u?.__kind==="Uninitialized"?!1:u?.update===Ri.ExternalValidationResult.Pass))return Ws.OracleValidationFailed}}return(0,T8.hasAssetUpdateAuthority)(e,r,n)?null:Ws.NoAuthority}Cr.validateUpdate=Ioe});var k8=S(wr=>{"use strict";a();Object.defineProperty(wr,"__esModule",{value:!0});wr.fetchCollection=wr.fetchAllAssets=wr.fetchAsset=wr.fetchCollectionsByUpdateAuthority=wr.fetchAssetsByCollection=wr.fetchAssetsByOwner=wr.deriveAssetPluginsWithFetch=void 0;var _d=re(),ti=we(),Poe=$e(),oa=bd(),Roe=async(t,e)=>{let r=Array.from(new Set(e.map(s=>(0,oa.collectionAddress)(s)))).filter(s=>!!s),i=(await(0,ti.fetchAllCollectionV1)(t,r)).reduce((s,o)=>(s[o.publicKey]=o,s),{});return e.map(s=>{let o=(0,oa.collectionAddress)(s);return o?(0,oa.deriveAssetPlugins)(s,i[o]):s})};wr.deriveAssetPluginsWithFetch=Roe;var Ooe=async(t,e,r={})=>{let n=await(0,ti.getAssetV1GpaBuilder)(t).whereField("key",ti.Key.AssetV1).whereField("owner",(0,_d.publicKey)(e)).getDeserialized();return r.skipDerivePlugins?n:(0,wr.deriveAssetPluginsWithFetch)(t,n)};wr.fetchAssetsByOwner=Ooe;var Boe=async(t,e,r={})=>{let n=await(0,ti.getAssetV1GpaBuilder)(t).whereField("key",ti.Key.AssetV1).whereField("updateAuthority",(0,Poe.updateAuthority)("Collection",[(0,_d.publicKey)(e)])).getDeserialized();return r.skipDerivePlugins?n:(0,wr.deriveAssetPluginsWithFetch)(t,n)};wr.fetchAssetsByCollection=Boe;var Toe=async(t,e)=>(0,ti.getCollectionV1GpaBuilder)(t).whereField("key",ti.Key.CollectionV1).whereField("updateAuthority",(0,_d.publicKey)(e)).getDeserialized();wr.fetchCollectionsByUpdateAuthority=Toe;var zoe=async(t,e,r={})=>{let n=await(0,ti.fetchAssetV1)(t,(0,_d.publicKey)(e));if(r.skipDerivePlugins)return n;let i=(0,oa.collectionAddress)(n);return i?(0,oa.deriveAssetPlugins)(n,await(0,ti.fetchCollectionV1)(t,i)):n};wr.fetchAsset=zoe;var koe=async(t,e,r={})=>{let n=r.chunkSize??1e3,i=[];for(let d=0;d<e.length;d+=n)i.push(e.slice(d,d+n));let s=(await Promise.all(i.map(d=>(0,ti.fetchAllAssetV1)(t,d.map(f=>(0,_d.publicKey)(f)))))).flat();if(r.skipDerivePlugins)return s;let o=Array.from(new Set(s.map(d=>(0,oa.collectionAddress)(d)))).filter(d=>!!d),u=(await(0,ti.fetchAllCollectionV1)(t,o)).reduce((d,f)=>(d[f.publicKey]=f,d),{});return s.map(d=>{let f=(0,oa.collectionAddress)(d);return f?(0,oa.deriveAssetPlugins)(d,u[f]):d})};wr.fetchAllAssets=koe;var Coe=async(t,e,r)=>(0,ti.fetchCollectionV1)(t,(0,_d.publicKey)(e),r);wr.fetchCollection=Coe});var Bc=S(Oi=>{"use strict";a();var Noe=Oi&&Oi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Sp=Oi&&Oi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Noe(e,t,r)};Object.defineProperty(Oi,"__esModule",{value:!0});Sp(bd(),Oi);Sp(z8(),Oi);Sp(fI(),Oi);Sp(N1(),Oi);Sp(k8(),Oi)});var N8=S(M1=>{"use strict";a();Object.defineProperty(M1,"__esModule",{value:!0});M1.addPlugin=void 0;var C8=we(),hI=$e(),Moe=(t,{plugin:e,...r})=>{if((0,hI.isExternalPluginAdapterType)(e))return(0,C8.addExternalPluginAdapterV1)(t,{...r,initInfo:(0,hI.createExternalPluginAdapterInitInfo)(e)});let n=(0,hI.pluginAuthorityPairV2)(e);return(0,C8.addPluginV1)(t,{...r,plugin:n.plugin,initAuthority:n.authority})};M1.addPlugin=Moe});var pI=S(L1=>{"use strict";a();Object.defineProperty(L1,"__esModule",{value:!0});L1.approvePluginAuthority=void 0;var M8=we(),Loe=$e(),Doe=(t,{plugin:e,newAuthority:r,...n})=>{let i=e.type;if(i==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,M8.approvePluginAuthorityV1)(t,{...n,pluginType:M8.PluginType[i],newAuthority:(0,Loe.pluginAuthorityToBase)(r)})};L1.approvePluginAuthority=Doe});var L8=S(D1=>{"use strict";a();Object.defineProperty(D1,"__esModule",{value:!0});D1.burn=void 0;var qoe=we(),Uoe=$e(),Voe=Bc(),Foe=(t,{asset:e,collection:r,...n})=>{let i=(0,Voe.deriveExternalPluginAdapters)(e,r),s=(0,Uoe.findExtraAccounts)(t,"burn",i,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner});return(0,qoe.burnV1)(t,{...n,asset:e.publicKey,collection:r?.publicKey}).addRemainingAccounts(s)};D1.burn=Foe});var U8=S(q1=>{"use strict";a();Object.defineProperty(q1,"__esModule",{value:!0});q1.addCollectionPlugin=void 0;var D8=we(),Koe=$e(),q8=Ho(),Woe=(t,{plugin:e,...r})=>{if((0,q8.isExternalPluginAdapterType)(e))return(0,D8.addCollectionExternalPluginAdapterV1)(t,{...r,initInfo:(0,q8.createExternalPluginAdapterInitInfo)(e)});let n=(0,Koe.pluginAuthorityPairV2)(e);return(0,D8.addCollectionPluginV1)(t,{...r,plugin:n.plugin,initAuthority:n.authority})};q1.addCollectionPlugin=Woe});var F8=S(U1=>{"use strict";a();Object.defineProperty(U1,"__esModule",{value:!0});U1.approveCollectionPluginAuthority=void 0;var V8=we(),joe=$e(),Hoe=(t,{plugin:e,newAuthority:r,...n})=>{let i=e.type;if(i==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,V8.approveCollectionPluginAuthorityV1)(t,{...n,pluginType:V8.PluginType[i],newAuthority:(0,joe.pluginAuthorityToBase)(r)})};U1.approveCollectionPluginAuthority=Hoe});var K8=S(V1=>{"use strict";a();Object.defineProperty(V1,"__esModule",{value:!0});V1.burnCollection=void 0;var Goe=we();Object.defineProperty(V1,"burnCollection",{enumerable:!0,get:function(){return Goe.burnCollectionV1}})});var j8=S(F1=>{"use strict";a();Object.defineProperty(F1,"__esModule",{value:!0});F1.createCollection=void 0;var $oe=we(),W8=$e(),Zoe=Ho(),Yoe=(t,{plugins:e,...r})=>{let n=[],i=[];return e?.forEach(s=>{(0,Zoe.isExternalPluginAdapterType)(s)?i.push(s):n.push(s)}),(0,$oe.createCollectionV2)(t,{...r,plugins:n.map(W8.pluginAuthorityPairV2),externalPluginAdapters:i.map(W8.createExternalPluginAdapterInitInfo)})};F1.createCollection=Yoe});var H8=S(K1=>{"use strict";a();Object.defineProperty(K1,"__esModule",{value:!0});K1.removeCollectionPlugin=void 0;var gI=we(),Xoe=$e(),Joe=Ho(),Qoe=(t,{plugin:e,...r})=>{if((0,Joe.isExternalPluginAdapterType)(e))return(0,gI.removeCollectionExternalPluginAdapterV1)(t,{...r,key:(0,Xoe.externalPluginAdapterKeyToBase)(e)});let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,gI.removeCollectionPluginV1)(t,{...r,pluginType:gI.PluginType[n]})};K1.removeCollectionPlugin=Qoe});var $8=S(W1=>{"use strict";a();Object.defineProperty(W1,"__esModule",{value:!0});W1.revokeCollectionPluginAuthority=void 0;var G8=we(),eae=(t,{plugin:e,...r})=>{let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,G8.revokeCollectionPluginAuthorityV1)(t,{...r,pluginType:G8.PluginType[n]})};W1.revokeCollectionPluginAuthority=eae});var Z8=S(j1=>{"use strict";a();Object.defineProperty(j1,"__esModule",{value:!0});j1.updateCollection=void 0;var tae=we(),rae=(t,{name:e,uri:r,...n})=>(0,tae.updateCollectionV1)(t,{...n,newName:e,newUri:r});j1.updateCollection=rae});var X8=S(G1=>{"use strict";a();Object.defineProperty(G1,"__esModule",{value:!0});G1.updateCollectionPlugin=void 0;var Y8=we(),H1=$e(),nae=(t,{plugin:e,...r})=>{if((0,H1.isExternalPluginAdapterType)(e)){let n=e;return(0,Y8.updateCollectionExternalPluginAdapterV1)(t,{...r,updateInfo:(0,H1.createExternalPluginAdapterUpdateInfo)(n),key:(0,H1.externalPluginAdapterKeyToBase)(n.key)})}return(0,Y8.updateCollectionPluginV1)(t,{...r,plugin:(0,H1.createPluginV2)(e)})};G1.updateCollectionPlugin=nae});var J8=S($1=>{"use strict";a();Object.defineProperty($1,"__esModule",{value:!0});$1.writeCollectionData=void 0;var iae=we(),sae=$e(),oae=(t,e)=>{let{key:r,...n}=e;return(0,iae.writeCollectionExternalPluginAdapterDataV1)(t,{...n,key:(0,sae.externalPluginAdapterKeyToBase)(r)})};$1.writeCollectionData=oae});var Q8=S(un=>{"use strict";a();var aae=un&&un.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),js=un&&un.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aae(e,t,r)};Object.defineProperty(un,"__esModule",{value:!0});js(U8(),un);js(F8(),un);js(K8(),un);js(j8(),un);js(H8(),un);js($8(),un);js(Z8(),un);js(X8(),un);js(J8(),un)});var t6=S(Z1=>{"use strict";a();Object.defineProperty(Z1,"__esModule",{value:!0});Z1.create=void 0;var cae=re(),e6=we(),yI=$e(),uae=Bc(),lae=Ho(),dae=(t,{asset:e,plugins:r,collection:n,...i})=>{let s=i.owner||i.updateAuthority||i.payer,o={oracles:[],lifecycleHooks:[]},c=[],u=[];r?.forEach(m=>{if((0,lae.isExternalPluginAdapterType)(m))switch(c.push(m),m.type){case"Oracle":o.oracles?.push({...m,resultsOffset:m.resultsOffset||{type:"NoOffset"},baseAddress:m.baseAddress,authority:m.initPluginAuthority||{type:"UpdateAuthority"},type:"Oracle"});break;case"AppData":break;case"LifecycleHook":o.lifecycleHooks?.push({...m,hookedProgram:m.hookedProgram,authority:m.initPluginAuthority||{type:"UpdateAuthority"},type:"LifecycleHook",schema:m.schema||e6.ExternalPluginAdapterSchema.Binary});break;default:}else u.push(m)});let d=(0,uae.deriveExternalPluginAdapters)(o,n),f=(0,yI.findExtraAccounts)(t,"create",d,{asset:e.publicKey,collection:n?n.publicKey:void 0,owner:s?(0,cae.publicKey)(s):t.identity.publicKey});return(0,e6.createV2)(t,{...i,plugins:u.map(yI.pluginAuthorityPairV2),externalPluginAdapters:c.map(yI.createExternalPluginAdapterInitInfo),asset:e,collection:n?n.publicKey:void 0}).addRemainingAccounts(f)};Z1.create=dae});var n6=S(Y1=>{"use strict";a();Object.defineProperty(Y1,"__esModule",{value:!0});Y1.execute=void 0;var mI=re(),r6=we(),fae=(t,e)=>hae(t,e);Y1.execute=fae;var hae=(t,e)=>{let r=new mI.TransactionBuilder,n=[...e.signers||[]],i=new mI.TransactionBuilder;if("getInstructions"in e.instructions)i=e.instructions;else if(Array.isArray(e.instructions))e.instructions.forEach(s=>{let o=[];s.keys.filter(c=>c.isSigner).forEach(c=>{let u=n.find(d=>d.publicKey===c.pubkey);u&&o.push(u)}),i=i.add({instruction:s,signers:o,bytesCreatedOnChain:0})});else throw new Error("No builder or instructions provided");for(let s of i.items){let[o]=(0,r6.findAssetSignerPda)(t,{asset:e.asset.publicKey}),c=(0,r6.executeV1)(t,{...e,asset:e.asset.publicKey,collection:e.collection?.publicKey,assetSigner:o,programId:s.instruction.programId,instructionData:s.instruction.data});e.executionDelegateRecord&&(c=c.addRemainingAccounts([{pubkey:(0,mI.publicKey)(e.executionDelegateRecord),isSigner:!1,isWritable:!1}])),r=r.add(c.addRemainingAccounts(s.instruction.keys.map(f=>f.pubkey===o?{pubkey:f.pubkey,isSigner:!1,isWritable:f.isWritable}:f)));let u=r.items,d=[...n,...s.signers].filter(f=>f.publicKey!==o);u[u.length-1].signers.push(...d),r=r.setItems(u)}return r}});var o6=S(Ad=>{"use strict";a();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.thawAsset=Ad.freezeAsset=void 0;var bI=re(),aa=we(),i6=Bc(),s6=$e(),pae=C1();function gae(t,{asset:e,authority:r,collection:n,delegate:i}){if((0,i6.isFrozen)(e,n))throw new Error("Cannot freeze: asset is already frozen");if(e.freezeDelegate&&e.freezeDelegate.authority.type==="None")throw new Error("Cannot freeze: owner has made the freeze immutable until transfer");let s=(0,bI.transactionBuilder)();return e.freezeDelegate&&(e.freezeDelegate.authority.type!=="Owner"&&(s=s.add((0,aa.revokePluginAuthorityV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:aa.PluginType.FreezeDelegate,authority:r}))),s=s.add((0,aa.removePluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:aa.PluginType.FreezeDelegate,authority:r}))),s=s.add((0,aa.addPluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,plugin:(0,s6.createPlugin)({type:"FreezeDelegate",data:{frozen:!0}}),initAuthority:(0,pae.addressPluginAuthority)((0,bI.publicKey)(i)),authority:r})),s}Ad.freezeAsset=gae;function yae(t,{asset:e,delegate:r,collection:n}){if(!(0,i6.isFrozen)(e,n))throw new Error("Cannot thaw: asset is not frozen");return(0,bI.transactionBuilder)().add((0,aa.updatePluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,plugin:(0,s6.createPlugin)({type:"FreezeDelegate",data:{frozen:!1}}),authority:r})).add((0,aa.revokePluginAuthorityV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:aa.PluginType.FreezeDelegate,authority:r}))}Ad.thawAsset=yae});var a6=S(X1=>{"use strict";a();Object.defineProperty(X1,"__esModule",{value:!0});X1.addAssetsToGroup=void 0;var mae=we(),bae=(t,e)=>(0,mae.addAssetsToGroupV1)(t,e);X1.addAssetsToGroup=bae});var c6=S(J1=>{"use strict";a();Object.defineProperty(J1,"__esModule",{value:!0});J1.addCollectionsToGroup=void 0;var _ae=we(),Aae=(t,e)=>(0,_ae.addCollectionsToGroupV1)(t,e);J1.addCollectionsToGroup=Aae});var u6=S(Q1=>{"use strict";a();Object.defineProperty(Q1,"__esModule",{value:!0});Q1.addGroupsToGroup=void 0;var Sae=we(),vae=(t,e)=>(0,Sae.addGroupsToGroupV1)(t,e);Q1.addGroupsToGroup=vae});var l6=S(eb=>{"use strict";a();Object.defineProperty(eb,"__esModule",{value:!0});eb.closeGroup=void 0;var Eae=we(),wae=(t,e)=>(0,Eae.closeGroupV1)(t,e);eb.closeGroup=wae});var d6=S(tb=>{"use strict";a();Object.defineProperty(tb,"__esModule",{value:!0});tb.createGroup=void 0;var xae=we(),Iae=(t,e)=>(0,xae.createGroupV1)(t,e);tb.createGroup=Iae});var f6=S(rb=>{"use strict";a();Object.defineProperty(rb,"__esModule",{value:!0});rb.removeAssetsFromGroup=void 0;var Pae=we(),Rae=(t,e)=>(0,Pae.removeAssetsFromGroupV1)(t,e);rb.removeAssetsFromGroup=Rae});var h6=S(nb=>{"use strict";a();Object.defineProperty(nb,"__esModule",{value:!0});nb.removeCollectionsFromGroup=void 0;var Oae=we(),Bae=(t,e)=>(0,Oae.removeCollectionsFromGroupV1)(t,e);nb.removeCollectionsFromGroup=Bae});var p6=S(ib=>{"use strict";a();Object.defineProperty(ib,"__esModule",{value:!0});ib.removeGroupsFromGroup=void 0;var Tae=we(),zae=(t,e)=>(0,Tae.removeGroupsFromGroupV1)(t,e);ib.removeGroupsFromGroup=zae});var g6=S(sb=>{"use strict";a();Object.defineProperty(sb,"__esModule",{value:!0});sb.updateGroup=void 0;var kae=we(),Cae=(t,e)=>(0,kae.updateGroupV1)(t,e);sb.updateGroup=Cae});var y6=S(ln=>{"use strict";a();var Nae=ln&&ln.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Hs=ln&&ln.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Nae(e,t,r)};Object.defineProperty(ln,"__esModule",{value:!0});Hs(a6(),ln);Hs(c6(),ln);Hs(u6(),ln);Hs(l6(),ln);Hs(d6(),ln);Hs(f6(),ln);Hs(h6(),ln);Hs(p6(),ln);Hs(g6(),ln)});var _I=S(Sd=>{"use strict";a();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.ERR_CANNOT_REVOKE=Sd.ERR_CANNOT_DELEGATE=void 0;Sd.ERR_CANNOT_DELEGATE="Cannot delegate. The target delegate is already either a plugin authority or the asset owner";Sd.ERR_CANNOT_REVOKE="Cannot revoke. Either no plugins defined or the plugin authority is already the asset owner"});var m6=S(ob=>{"use strict";a();Object.defineProperty(ob,"__esModule",{value:!0});ob.legacyDelegate=void 0;var Mae=re(),Lae=_I(),Dae=we(),AI=$e(),qae=C1(),Uae=pI();function Vae(t,e,r){let n=(({freezeDelegate:f,transferDelegate:m,burnDelegate:_})=>({...f?{freezeDelegate:f}:{},...m?{transferDelegate:m}:{},..._?{burnDelegate:_}:{}}))(e);if(!Object.values(n).every(f=>{let m=e.owner,_=f.authority,v=_.address;return _.type==="Owner"?r!==m:v!==r&&v!==m}))throw new Error(Lae.ERR_CANNOT_DELEGATE);let s=(0,Mae.transactionBuilder)(),o=Object.keys(n),c={freezeDelegate:"FreezeDelegate",transferDelegate:"TransferDelegate",burnDelegate:"BurnDelegate"};return o.forEach(f=>{let m=c[f];s=s.add((0,Uae.approvePluginAuthority)(t,{asset:e.publicKey,plugin:{type:m},newAuthority:{type:"Address",address:r}}))}),["freezeDelegate","transferDelegate","burnDelegate"].filter(f=>!o.includes(f)).forEach(f=>{let m=f==="freezeDelegate"?(0,AI.createPlugin)({type:"FreezeDelegate",data:{frozen:!1}}):f==="transferDelegate"?(0,AI.createPlugin)({type:"TransferDelegate"}):(0,AI.createPlugin)({type:"BurnDelegate"});s=s.add((0,Dae.addPluginV1)(t,{asset:e.publicKey,plugin:m,initAuthority:(0,qae.addressPluginAuthority)(r)}))}),s}ob.legacyDelegate=Vae});var _6=S(ab=>{"use strict";a();Object.defineProperty(ab,"__esModule",{value:!0});ab.legacyRevoke=void 0;var Fae=re(),b6=we(),Kae=_I(),Wae=$e();function jae(t,e){let r=(({freezeDelegate:o,transferDelegate:c,burnDelegate:u})=>({...o?{freezeDelegate:o}:{},...c?{transferDelegate:c}:{},...u?{burnDelegate:u}:{}}))(e),n=Object.values(r);if(!(n.length>0&&n.every(o=>{let c=e.owner,u=o.authority;return u.type!=="Owner"&&u.address!==c})))throw new Error(Kae.ERR_CANNOT_REVOKE);let s=(0,Fae.transactionBuilder)();return Object.keys(r).forEach(o=>{let c=(0,Wae.pluginKeyToPluginType)(o);s=s.add((0,b6.revokePluginAuthorityV1)(t,{asset:e.publicKey,pluginType:b6.PluginType[c]}))}),s}ab.legacyRevoke=jae});var A6=S(cb=>{"use strict";a();Object.defineProperty(cb,"__esModule",{value:!0});cb.removePlugin=void 0;var SI=we(),Hae=$e(),Gae=bx(),$ae=(t,{plugin:e,...r})=>{if((0,Hae.isExternalPluginAdapterType)(e))return(0,SI.removeExternalPluginAdapterV1)(t,{...r,key:(0,Gae.externalPluginAdapterKeyToBase)(e)});let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,SI.removePluginV1)(t,{...r,pluginType:SI.PluginType[n]})};cb.removePlugin=$ae});var v6=S(ub=>{"use strict";a();Object.defineProperty(ub,"__esModule",{value:!0});ub.revokePluginAuthority=void 0;var S6=we(),Zae=(t,{plugin:e,...r})=>{let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,S6.revokePluginAuthorityV1)(t,{...r,pluginType:S6.PluginType[n]})};ub.revokePluginAuthority=Zae});var E6=S(lb=>{"use strict";a();Object.defineProperty(lb,"__esModule",{value:!0});lb.transfer=void 0;var Yae=re(),Xae=we(),Jae=$e(),Qae=Bc(),ece=(t,{asset:e,collection:r,...n})=>{let i=(0,Qae.deriveExternalPluginAdapters)(e,r),s=(0,Jae.findExtraAccounts)(t,"transfer",i,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner,recipient:(0,Yae.publicKey)(n.newOwner)});return(0,Xae.transferV1)(t,{...n,asset:e.publicKey,collection:r?.publicKey}).addRemainingAccounts(s)};lb.transfer=ece});var w6=S(db=>{"use strict";a();Object.defineProperty(db,"__esModule",{value:!0});db.update=void 0;var tce=we(),rce=$e(),nce=Bc(),ice=(t,{asset:e,collection:r,name:n,uri:i,...s})=>{let o=(0,nce.deriveExternalPluginAdapters)(e,r),c=(0,rce.findExtraAccounts)(t,"update",o,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner});return(0,tce.updateV2)(t,{...s,asset:e.publicKey,collection:r?.publicKey,newName:n,newUri:i}).addRemainingAccounts(c)};db.update=ice});var I6=S(hb=>{"use strict";a();Object.defineProperty(hb,"__esModule",{value:!0});hb.updatePlugin=void 0;var x6=we(),fb=$e(),sce=(t,{plugin:e,...r})=>{if((0,fb.isExternalPluginAdapterType)(e)){let n=e;return(0,x6.updateExternalPluginAdapterV1)(t,{...r,updateInfo:(0,fb.createExternalPluginAdapterUpdateInfo)(n),key:(0,fb.externalPluginAdapterKeyToBase)(n.key)})}return(0,x6.updatePluginV1)(t,{...r,plugin:(0,fb.createPluginV2)(e)})};hb.updatePlugin=sce});var P6=S(pb=>{"use strict";a();Object.defineProperty(pb,"__esModule",{value:!0});pb.writeData=void 0;var oce=we(),ace=$e(),cce=(t,e)=>{let{key:r,...n}=e;return(0,oce.writeExternalPluginAdapterDataV1)(t,{...n,key:(0,ace.externalPluginAdapterKeyToBase)(r)})};pb.writeData=cce});var R6=S(At=>{"use strict";a();var uce=At&&At.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Yr=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uce(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});Yr(N8(),At);Yr(pI(),At);Yr(L8(),At);Yr(Q8(),At);Yr(t6(),At);Yr(n6(),At);Yr(o6(),At);Yr(y6(),At);Yr(m6(),At);Yr(_6(),At);Yr(A6(),At);Yr(v6(),At);Yr(E6(),At);Yr(w6(),At);Yr(I6(),At);Yr(P6(),At)});var gb=S(Dn=>{"use strict";a();var lce=Dn&&Dn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Tc=Dn&&Dn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lce(e,t,r)};Object.defineProperty(Dn,"__esModule",{value:!0});Tc(we(),Dn);Tc(MD(),Dn);Tc(E8(),Dn);Tc(C1(),Dn);Tc($e(),Dn);Tc(Bc(),Dn);Tc(R6(),Dn)});var vI=S(yb=>{"use strict";a();Object.defineProperty(yb,"__esModule",{value:!0});yb.signAndSendAgentTransaction=void 0;async function dce(t,e,r){let n=r?.commitment??"confirmed",i=r?.preflightCommitment??"confirmed",s=r?.skipPreflight??!1,o=await t.identity.signTransaction(e.transaction),c=await t.rpc.sendTransaction(o,{skipPreflight:s,commitment:n,preflightCommitment:i});return await t.rpc.confirmTransaction(c,{strategy:{type:"blockhash",...e.blockhash},commitment:n}),c}yb.signAndSendAgentTransaction=dce});var EI=S(Sn=>{"use strict";a();Object.defineProperty(Sn,"__esModule",{value:!0});Sn.isAgentValidationError=Sn.agentValidationError=Sn.isAgentApiNetworkError=Sn.agentApiNetworkError=Sn.isAgentApiError=Sn.agentApiError=void 0;function fce(t,e,r){let n=new Error(t);return n.name="AgentApiError",n.statusCode=e,n.responseBody=r,n}Sn.agentApiError=fce;function hce(t){return t instanceof Error&&t.name==="AgentApiError"}Sn.isAgentApiError=hce;function pce(t,e){let r=new Error(t);return r.name="AgentApiNetworkError",r.cause=e,r}Sn.agentApiNetworkError=pce;function gce(t){return t instanceof Error&&t.name==="AgentApiNetworkError"}Sn.isAgentApiNetworkError=gce;function yce(t,e){let r=new Error(t);return r.name="AgentValidationError",r.field=e,r}Sn.agentValidationError=yce;function mce(t){return t instanceof Error&&t.name==="AgentValidationError"}Sn.isAgentValidationError=mce});var B6=S(vd=>{"use strict";a();Object.defineProperty(vd,"__esModule",{value:!0});vd.mintAndSubmitAgent=vd.mintAgent=void 0;var bce=q(),_ce=vI(),wI=EI(),Ace="https://api.metaplex.com";function Sce(t){return t.baseUrl??Ace}function vce(t){return typeof t=="string"?t:t.toString()}function Ece(t){return{wallet:vce(t.wallet),network:t.network??"solana-mainnet",name:t.name,uri:t.uri,agentMetadata:t.agentMetadata}}async function O6(t,e,r){let n=e??{},i=Ece(r),s=n.fetch??globalThis.fetch,o=Sce(n),c;try{c=await s(`${o}/v1/agents/mint`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}catch(_){throw(0,wI.agentApiNetworkError)(`Network error calling mintAgent: ${_.message}`,_)}let u=await c.text().catch(()=>"<unable to read body>"),d;try{d=JSON.parse(u)}catch(_){throw(0,wI.agentApiError)(`Failed to parse mintAgent response as JSON: ${_.message} \u2014 raw body: ${u}`,c.status,{rawText:u})}if(!c.ok||!d.success)throw(0,wI.agentApiError)(d.error??`API returned status ${c.status}`,c.status,d);let f=bce.base64.serialize(d.tx);return{transaction:t.transactions.deserialize(f),blockhash:d.blockhash,assetAddress:typeof d.assetAddress=="string"?d.assetAddress:d.assetAddress.toString()}}vd.mintAgent=O6;async function wce(t,e,r,n){let i=await O6(t,e,r),s;return n?.txSender?s=await n.txSender(i.transaction):s=await(0,_ce.signAndSendAgentTransaction)(t,i,{commitment:n?.commitment??"confirmed",preflightCommitment:n?.preflightCommitment??"confirmed",skipPreflight:n?.skipPreflight??!1}),{signature:s,assetAddress:i.assetAddress}}vd.mintAndSubmitAgent=wce});var z6=S(ar=>{"use strict";a();Object.defineProperty(ar,"__esModule",{value:!0});ar.isAgentValidationError=ar.isAgentApiNetworkError=ar.isAgentApiError=ar.agentValidationError=ar.agentApiNetworkError=ar.agentApiError=ar.signAndSendAgentTransaction=ar.mintAndSubmitAgent=ar.mintAgent=void 0;var T6=B6();Object.defineProperty(ar,"mintAgent",{enumerable:!0,get:function(){return T6.mintAgent}});Object.defineProperty(ar,"mintAndSubmitAgent",{enumerable:!0,get:function(){return T6.mintAndSubmitAgent}});var xce=vI();Object.defineProperty(ar,"signAndSendAgentTransaction",{enumerable:!0,get:function(){return xce.signAndSendAgentTransaction}});var Ed=EI();Object.defineProperty(ar,"agentApiError",{enumerable:!0,get:function(){return Ed.agentApiError}});Object.defineProperty(ar,"agentApiNetworkError",{enumerable:!0,get:function(){return Ed.agentApiNetworkError}});Object.defineProperty(ar,"agentValidationError",{enumerable:!0,get:function(){return Ed.agentValidationError}});Object.defineProperty(ar,"isAgentApiError",{enumerable:!0,get:function(){return Ed.isAgentApiError}});Object.defineProperty(ar,"isAgentApiNetworkError",{enumerable:!0,get:function(){return Ed.isAgentApiNetworkError}});Object.defineProperty(ar,"isAgentValidationError",{enumerable:!0,get:function(){return Ed.isAgentValidationError}})});var C6=S(zc=>{"use strict";a();Object.defineProperty(zc,"__esModule",{value:!0});zc.getKeySerializer=zc.Key=void 0;var Ice=q(),k6;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentIdentityV1=1]="AgentIdentityV1",t[t.AgentIdentityV2=2]="AgentIdentityV2"})(k6=zc.Key||(zc.Key={}));function Pce(){return(0,Ice.scalarEnum)(k6,{description:"Key"})}zc.getKeySerializer=Pce});var mb=S(kc=>{"use strict";a();var Rce=kc&&kc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Oce=kc&&kc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rce(e,t,r)};Object.defineProperty(kc,"__esModule",{value:!0});Oce(C6(),kc)});var q6=S(ot=>{"use strict";a();Object.defineProperty(ot,"__esModule",{value:!0});ot.safeFetchAgentIdentityV1FromSeeds=ot.fetchAgentIdentityV1FromSeeds=ot.findAgentIdentityV1Pda=ot.getAgentIdentityV1Size=ot.getAgentIdentityV1GpaBuilder=ot.safeFetchAllAgentIdentityV1=ot.fetchAllAgentIdentityV1=ot.safeFetchAgentIdentityV1=ot.fetchAgentIdentityV1=ot.deserializeAgentIdentityV1=ot.getAgentIdentityV1AccountDataSerializer=void 0;var ca=re(),ri=q(),N6=mb();function M6(){return(0,ri.mapSerializer)((0,ri.struct)([["key",(0,N6.getKeySerializer)()],["bump",(0,ri.u8)()],["padding",(0,ri.array)((0,ri.u8)(),{size:6})],["asset",(0,ri.publicKey)()]],{description:"AgentIdentityV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}ot.getAgentIdentityV1AccountDataSerializer=M6;function wd(t){return(0,ca.deserializeAccount)(t,M6())}ot.deserializeAgentIdentityV1=wd;async function L6(t,e,r){let n=await t.rpc.getAccount((0,ca.publicKey)(e,!1),r);return(0,ca.assertAccountExists)(n,"AgentIdentityV1"),wd(n)}ot.fetchAgentIdentityV1=L6;async function D6(t,e,r){let n=await t.rpc.getAccount((0,ca.publicKey)(e,!1),r);return n.exists?wd(n):null}ot.safeFetchAgentIdentityV1=D6;async function Bce(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ca.publicKey)(i,!1)),r)).map(i=>((0,ca.assertAccountExists)(i,"AgentIdentityV1"),wd(i)))}ot.fetchAllAgentIdentityV1=Bce;async function Tce(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ca.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>wd(i))}ot.safeFetchAllAgentIdentityV1=Tce;function zce(t){let e=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return(0,ca.gpaBuilder)(t,e).registerFields({key:[0,(0,N6.getKeySerializer)()],bump:[1,(0,ri.u8)()],padding:[2,(0,ri.array)((0,ri.u8)(),{size:6})],asset:[8,(0,ri.publicKey)()]}).deserializeUsing(r=>wd(r))}ot.getAgentIdentityV1GpaBuilder=zce;function kce(){return 40}ot.getAgentIdentityV1Size=kce;function xI(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return t.eddsa.findPda(r,[(0,ri.string)({size:"variable"}).serialize("agent_identity"),(0,ri.publicKey)().serialize(e.asset)])}ot.findAgentIdentityV1Pda=xI;async function Cce(t,e,r){return L6(t,xI(t,e),r)}ot.fetchAgentIdentityV1FromSeeds=Cce;async function Nce(t,e,r){return D6(t,xI(t,e),r)}ot.safeFetchAgentIdentityV1FromSeeds=Nce});var W6=S(at=>{"use strict";a();Object.defineProperty(at,"__esModule",{value:!0});at.safeFetchAgentIdentityV2FromSeeds=at.fetchAgentIdentityV2FromSeeds=at.findAgentIdentityV2Pda=at.getAgentIdentityV2Size=at.getAgentIdentityV2GpaBuilder=at.safeFetchAllAgentIdentityV2=at.fetchAllAgentIdentityV2=at.safeFetchAgentIdentityV2=at.fetchAgentIdentityV2=at.deserializeAgentIdentityV2=at.getAgentIdentityV2AccountDataSerializer=void 0;var vn=re(),Xr=q(),U6=mb();function V6(){return(0,Xr.mapSerializer)((0,Xr.struct)([["key",(0,U6.getKeySerializer)()],["bump",(0,Xr.u8)()],["padding",(0,Xr.array)((0,Xr.u8)(),{size:6})],["asset",(0,Xr.publicKey)()],["agentToken",(()=>{let t=(0,Xr.publicKey)(),e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);if(t.fixedSize==null)throw new Error("Fixed-size options require an inner serializer with a fixed size.");if(t.fixedSize!==e.length)throw new Error("Fixed-size option sentinel length must match the inner serializer fixed size.");let{fixedSize:r}=t,n=i=>i==null?null:(0,vn.isOption)(i)?i.__option==="None"?null:i.value:i;return{description:"Option<PublicKey>",fixedSize:r,maxSize:r,serialize:i=>{let s=n(i);return s==null?e.slice():t.serialize(s)},deserialize:(i,s=0)=>{if(i.slice(s,s+r).every((f,m)=>f===e[m]))return[(0,vn.none)(),s+r];let[u,d]=t.deserialize(i,s);return[(0,vn.some)(u),d]}}})()],["reserved",(0,Xr.bytes)({size:32})]],{description:"AgentIdentityV2AccountData"}),t=>({...t,padding:[0,0,0,0,0,0],reserved:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}))}at.getAgentIdentityV2AccountDataSerializer=V6;function xd(t){return(0,vn.deserializeAccount)(t,V6())}at.deserializeAgentIdentityV2=xd;async function F6(t,e,r){let n=await t.rpc.getAccount((0,vn.publicKey)(e,!1),r);return(0,vn.assertAccountExists)(n,"AgentIdentityV2"),xd(n)}at.fetchAgentIdentityV2=F6;async function K6(t,e,r){let n=await t.rpc.getAccount((0,vn.publicKey)(e,!1),r);return n.exists?xd(n):null}at.safeFetchAgentIdentityV2=K6;async function Mce(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,vn.publicKey)(i,!1)),r)).map(i=>((0,vn.assertAccountExists)(i,"AgentIdentityV2"),xd(i)))}at.fetchAllAgentIdentityV2=Mce;async function Lce(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,vn.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>xd(i))}at.safeFetchAllAgentIdentityV2=Lce;function Dce(t){let e=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return(0,vn.gpaBuilder)(t,e).registerFields({key:[0,(0,U6.getKeySerializer)()],bump:[1,(0,Xr.u8)()],padding:[2,(0,Xr.array)((0,Xr.u8)(),{size:6})],asset:[8,(0,Xr.publicKey)()],agentToken:[40,(()=>{let r=(0,Xr.publicKey)(),n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);if(r.fixedSize==null)throw new Error("Fixed-size options require an inner serializer with a fixed size.");if(r.fixedSize!==n.length)throw new Error("Fixed-size option sentinel length must match the inner serializer fixed size.");let{fixedSize:i}=r,s=o=>o==null?null:(0,vn.isOption)(o)?o.__option==="None"?null:o.value:o;return{description:"Option<PublicKey>",fixedSize:i,maxSize:i,serialize:o=>{let c=s(o);return c==null?n.slice():r.serialize(c)},deserialize:(o,c=0)=>{if(o.slice(c,c+i).every((_,v)=>_===n[v]))return[(0,vn.none)(),c+i];let[f,m]=r.deserialize(o,c);return[(0,vn.some)(f),m]}}})()],reserved:[72,(0,Xr.bytes)({size:32})]}).deserializeUsing(r=>xd(r))}at.getAgentIdentityV2GpaBuilder=Dce;function qce(){return 104}at.getAgentIdentityV2Size=qce;function II(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return t.eddsa.findPda(r,[(0,Xr.string)({size:"variable"}).serialize("agent_identity"),(0,Xr.publicKey)().serialize(e.asset)])}at.findAgentIdentityV2Pda=II;async function Uce(t,e,r){return F6(t,II(t,e),r)}at.fetchAgentIdentityV2FromSeeds=Uce;async function Vce(t,e,r){return K6(t,II(t,e),r)}at.safeFetchAgentIdentityV2FromSeeds=Vce});var vp=S(ua=>{"use strict";a();var Fce=ua&&ua.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),j6=ua&&ua.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fce(e,t,r)};Object.defineProperty(ua,"__esModule",{value:!0});j6(q6(),ua);j6(W6(),ua)});var H6=S(We=>{"use strict";a();Object.defineProperty(We,"__esModule",{value:!0});We.getMplAgentIdentityErrorFromName=We.getMplAgentIdentityErrorFromCode=We.GenesisNotMintFundedError=We.InvalidGenesisAccountError=We.AgentIdentityAlreadyRegisteredError=We.InvalidAgentIdentityError=We.AgentTokenAlreadySetError=We.OnlyAssetSignerCanSetAgentTokenError=We.InvalidAgentTokenError=We.InvalidCoreAssetError=We.InvalidMplCoreProgramError=We.InvalidAccountDataError=We.InvalidInstructionDataError=We.InvalidSystemProgramError=void 0;var ni=re(),qn=new Map,Un=new Map,Ep=class extends ni.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};We.InvalidSystemProgramError=Ep;qn.set(0,Ep);Un.set("InvalidSystemProgram",Ep);var wp=class extends ni.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};We.InvalidInstructionDataError=wp;qn.set(1,wp);Un.set("InvalidInstructionData",wp);var xp=class extends ni.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};We.InvalidAccountDataError=xp;qn.set(2,xp);Un.set("InvalidAccountData",xp);var Ip=class extends ni.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};We.InvalidMplCoreProgramError=Ip;qn.set(3,Ip);Un.set("InvalidMplCoreProgram",Ip);var Pp=class extends ni.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};We.InvalidCoreAssetError=Pp;qn.set(4,Pp);Un.set("InvalidCoreAsset",Pp);var Rp=class extends ni.ProgramError{constructor(e,r){super("Invalid Agent Token",e,r),this.name="InvalidAgentToken",this.code=5}};We.InvalidAgentTokenError=Rp;qn.set(5,Rp);Un.set("InvalidAgentToken",Rp);var Op=class extends ni.ProgramError{constructor(e,r){super("Only the Asset Signer can set the agent token",e,r),this.name="OnlyAssetSignerCanSetAgentToken",this.code=6}};We.OnlyAssetSignerCanSetAgentTokenError=Op;qn.set(6,Op);Un.set("OnlyAssetSignerCanSetAgentToken",Op);var Bp=class extends ni.ProgramError{constructor(e,r){super("Agent Token already set",e,r),this.name="AgentTokenAlreadySet",this.code=7}};We.AgentTokenAlreadySetError=Bp;qn.set(7,Bp);Un.set("AgentTokenAlreadySet",Bp);var Tp=class extends ni.ProgramError{constructor(e,r){super("Invalid Agent Identity",e,r),this.name="InvalidAgentIdentity",this.code=8}};We.InvalidAgentIdentityError=Tp;qn.set(8,Tp);Un.set("InvalidAgentIdentity",Tp);var zp=class extends ni.ProgramError{constructor(e,r){super("Agent Identity already registered",e,r),this.name="AgentIdentityAlreadyRegistered",this.code=9}};We.AgentIdentityAlreadyRegisteredError=zp;qn.set(9,zp);Un.set("AgentIdentityAlreadyRegistered",zp);var kp=class extends ni.ProgramError{constructor(e,r){super("Invalid Genesis Account",e,r),this.name="InvalidGenesisAccount",this.code=10}};We.InvalidGenesisAccountError=kp;qn.set(10,kp);Un.set("InvalidGenesisAccount",kp);var Cp=class extends ni.ProgramError{constructor(e,r){super("Genesis account is not mint-funded",e,r),this.name="GenesisNotMintFunded",this.code=11}};We.GenesisNotMintFundedError=Cp;qn.set(11,Cp);Un.set("GenesisNotMintFunded",Cp);function Kce(t,e,r){let n=qn.get(t);return n?new n(e,r):null}We.getMplAgentIdentityErrorFromCode=Kce;function Wce(t,e,r){let n=Un.get(t);return n?new n(e,r):null}We.getMplAgentIdentityErrorFromName=Wce});var PI=S(Cc=>{"use strict";a();var jce=Cc&&Cc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Hce=Cc&&Cc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jce(e,t,r)};Object.defineProperty(Cc,"__esModule",{value:!0});Hce(H6(),Cc)});var bb=S(rs=>{"use strict";a();Object.defineProperty(rs,"__esModule",{value:!0});rs.getAccountMetasAndSigners=rs.expectPda=rs.expectPublicKey=rs.expectSome=void 0;var Np=re();function Gce(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}rs.expectSome=Gce;function $ce(t){if(!t)throw new Error("Expected a PublicKey.");return(0,Np.publicKey)(t,!1)}rs.expectPublicKey=$ce;function Zce(t){if(!t||!Array.isArray(t)||!(0,Np.isPda)(t))throw new Error("Expected a PDA.");return t}rs.expectPda=Zce;function Yce(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,Np.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,Np.publicKey)(s.value,!1),isSigner:(0,Np.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}rs.getAccountMetasAndSigners=Yce});var Z6=S(la=>{"use strict";a();Object.defineProperty(la,"__esModule",{value:!0});la.registerIdentityV1=la.registerIdentityV1InstructionDiscriminator=la.getRegisterIdentityV1InstructionDataSerializer=void 0;var Xce=re(),Id=q(),Jce=vp(),G6=bb();function $6(){return(0,Id.mapSerializer)((0,Id.struct)([["discriminator",(0,Id.u8)()],["padding",(0,Id.array)((0,Id.u8)(),{size:7})],["agentRegistrationUri",(0,Id.string)()]],{description:"RegisterIdentityV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}la.getRegisterIdentityV1InstructionDataSerializer=$6;la.registerIdentityV1InstructionDiscriminator=0;function Qce(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p"),n={agentIdentity:{index:0,isWritable:!0,value:e.agentIdentity??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}},i={...e};n.agentIdentity.value||(n.agentIdentity.value=(0,Jce.findAgentIdentityV2Pda)(t,{asset:(0,G6.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,G6.getAccountMetasAndSigners)(s,"programId",r),u=$6().serialize(i);return(0,Xce.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}la.registerIdentityV1=Qce});var J6=S(da=>{"use strict";a();Object.defineProperty(da,"__esModule",{value:!0});da.setAgentTokenV1=da.setAgentTokenV1InstructionDiscriminator=da.getSetAgentTokenV1InstructionDataSerializer=void 0;var eue=re(),Mp=q(),tue=vp(),Y6=bb();function X6(){return(0,Mp.mapSerializer)((0,Mp.struct)([["discriminator",(0,Mp.u8)()],["padding",(0,Mp.array)((0,Mp.u8)(),{size:7})]],{description:"SetAgentTokenV1InstructionData"}),t=>({...t,discriminator:1,padding:[0,0,0,0,0,0,0]}))}da.getSetAgentTokenV1InstructionDataSerializer=X6;da.setAgentTokenV1InstructionDiscriminator=1;function rue(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p"),n={agentIdentity:{index:0,isWritable:!0,value:e.agentIdentity??null},asset:{index:1,isWritable:!1,value:e.asset??null},genesisAccount:{index:2,isWritable:!1,value:e.genesisAccount??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null}};n.agentIdentity.value||(n.agentIdentity.value=(0,tue.findAgentIdentityV2Pda)(t,{asset:(0,Y6.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Y6.getAccountMetasAndSigners)(i,"programId",r),c=X6().serialize({});return(0,eue.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}da.setAgentTokenV1=rue});var RI=S(fa=>{"use strict";a();var nue=fa&&fa.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Q6=fa&&fa.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nue(e,t,r)};Object.defineProperty(fa,"__esModule",{value:!0});Q6(Z6(),fa);Q6(J6(),fa)});var t3=S(ii=>{"use strict";a();Object.defineProperty(ii,"__esModule",{value:!0});ii.getMplAgentIdentityProgramId=ii.getMplAgentIdentityProgram=ii.createMplAgentIdentityProgram=ii.MPL_AGENT_IDENTITY_PROGRAM_ID=void 0;var e3=PI();ii.MPL_AGENT_IDENTITY_PROGRAM_ID="1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p";function iue(){return{name:"mplAgentIdentity",publicKey:ii.MPL_AGENT_IDENTITY_PROGRAM_ID,getErrorFromCode(t,e){return(0,e3.getMplAgentIdentityErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,e3.getMplAgentIdentityErrorFromName)(t,this,e)},isOnCluster(){return!0}}}ii.createMplAgentIdentityProgram=iue;function sue(t,e){return t.programs.get("mplAgentIdentity",e)}ii.getMplAgentIdentityProgram=sue;function oue(t,e){return t.programs.getPublicKey("mplAgentIdentity",ii.MPL_AGENT_IDENTITY_PROGRAM_ID,e)}ii.getMplAgentIdentityProgramId=oue});var OI=S(Nc=>{"use strict";a();var aue=Nc&&Nc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),cue=Nc&&Nc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aue(e,t,r)};Object.defineProperty(Nc,"__esModule",{value:!0});cue(t3(),Nc)});var BI=S(si=>{"use strict";a();var uue=si&&si.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Pd=si&&si.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uue(e,t,r)};Object.defineProperty(si,"__esModule",{value:!0});Pd(vp(),si);Pd(PI(),si);Pd(RI(),si);Pd(OI(),si);Pd(bb(),si);Pd(mb(),si)});var n3=S(Mc=>{"use strict";a();Object.defineProperty(Mc,"__esModule",{value:!0});Mc.getKeySerializer=Mc.Key=void 0;var lue=q(),r3;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentReputationV1=1]="AgentReputationV1"})(r3=Mc.Key||(Mc.Key={}));function due(){return(0,lue.scalarEnum)(r3,{description:"Key"})}Mc.getKeySerializer=due});var TI=S(Lc=>{"use strict";a();var fue=Lc&&Lc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),hue=Lc&&Lc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fue(e,t,r)};Object.defineProperty(Lc,"__esModule",{value:!0});hue(n3(),Lc)});var c3=S(ct=>{"use strict";a();Object.defineProperty(ct,"__esModule",{value:!0});ct.safeFetchAgentReputationV1FromSeeds=ct.fetchAgentReputationV1FromSeeds=ct.findAgentReputationV1Pda=ct.getAgentReputationV1Size=ct.getAgentReputationV1GpaBuilder=ct.safeFetchAllAgentReputationV1=ct.fetchAllAgentReputationV1=ct.safeFetchAgentReputationV1=ct.fetchAgentReputationV1=ct.deserializeAgentReputationV1=ct.getAgentReputationV1AccountDataSerializer=void 0;var ha=re(),oi=q(),i3=TI();function s3(){return(0,oi.mapSerializer)((0,oi.struct)([["key",(0,i3.getKeySerializer)()],["bump",(0,oi.u8)()],["padding",(0,oi.array)((0,oi.u8)(),{size:6})],["asset",(0,oi.publicKey)()]],{description:"AgentReputationV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}ct.getAgentReputationV1AccountDataSerializer=s3;function Rd(t){return(0,ha.deserializeAccount)(t,s3())}ct.deserializeAgentReputationV1=Rd;async function o3(t,e,r){let n=await t.rpc.getAccount((0,ha.publicKey)(e,!1),r);return(0,ha.assertAccountExists)(n,"AgentReputationV1"),Rd(n)}ct.fetchAgentReputationV1=o3;async function a3(t,e,r){let n=await t.rpc.getAccount((0,ha.publicKey)(e,!1),r);return n.exists?Rd(n):null}ct.safeFetchAgentReputationV1=a3;async function pue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ha.publicKey)(i,!1)),r)).map(i=>((0,ha.assertAccountExists)(i,"AgentReputationV1"),Rd(i)))}ct.fetchAllAgentReputationV1=pue;async function gue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ha.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Rd(i))}ct.safeFetchAllAgentReputationV1=gue;function yue(t){let e=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR");return(0,ha.gpaBuilder)(t,e).registerFields({key:[0,(0,i3.getKeySerializer)()],bump:[1,(0,oi.u8)()],padding:[2,(0,oi.array)((0,oi.u8)(),{size:6})],asset:[8,(0,oi.publicKey)()]}).deserializeUsing(r=>Rd(r))}ct.getAgentReputationV1GpaBuilder=yue;function mue(){return 40}ct.getAgentReputationV1Size=mue;function zI(t,e){let r=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR");return t.eddsa.findPda(r,[(0,oi.string)({size:"variable"}).serialize("agent_reputation"),(0,oi.publicKey)().serialize(e.asset)])}ct.findAgentReputationV1Pda=zI;async function bue(t,e,r){return o3(t,zI(t,e),r)}ct.fetchAgentReputationV1FromSeeds=bue;async function _ue(t,e,r){return a3(t,zI(t,e),r)}ct.safeFetchAgentReputationV1FromSeeds=_ue});var _b=S(Dc=>{"use strict";a();var Aue=Dc&&Dc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Sue=Dc&&Dc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Aue(e,t,r)};Object.defineProperty(Dc,"__esModule",{value:!0});Sue(c3(),Dc)});var u3=S(xr=>{"use strict";a();Object.defineProperty(xr,"__esModule",{value:!0});xr.getMplAgentReputationErrorFromName=xr.getMplAgentReputationErrorFromCode=xr.AgentReputationAlreadyRegisteredError=xr.InvalidCoreAssetError=xr.InvalidMplCoreProgramError=xr.InvalidAccountDataError=xr.InvalidInstructionDataError=xr.InvalidSystemProgramError=void 0;var Od=re(),qc=new Map,Uc=new Map,Lp=class extends Od.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};xr.InvalidSystemProgramError=Lp;qc.set(0,Lp);Uc.set("InvalidSystemProgram",Lp);var Dp=class extends Od.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};xr.InvalidInstructionDataError=Dp;qc.set(1,Dp);Uc.set("InvalidInstructionData",Dp);var qp=class extends Od.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};xr.InvalidAccountDataError=qp;qc.set(2,qp);Uc.set("InvalidAccountData",qp);var Up=class extends Od.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};xr.InvalidMplCoreProgramError=Up;qc.set(3,Up);Uc.set("InvalidMplCoreProgram",Up);var Vp=class extends Od.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};xr.InvalidCoreAssetError=Vp;qc.set(4,Vp);Uc.set("InvalidCoreAsset",Vp);var Fp=class extends Od.ProgramError{constructor(e,r){super("Agent Reputation already registered",e,r),this.name="AgentReputationAlreadyRegistered",this.code=5}};xr.AgentReputationAlreadyRegisteredError=Fp;qc.set(5,Fp);Uc.set("AgentReputationAlreadyRegistered",Fp);function vue(t,e,r){let n=qc.get(t);return n?new n(e,r):null}xr.getMplAgentReputationErrorFromCode=vue;function Eue(t,e,r){let n=Uc.get(t);return n?new n(e,r):null}xr.getMplAgentReputationErrorFromName=Eue});var kI=S(Vc=>{"use strict";a();var wue=Vc&&Vc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),xue=Vc&&Vc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wue(e,t,r)};Object.defineProperty(Vc,"__esModule",{value:!0});xue(u3(),Vc)});var CI=S(ns=>{"use strict";a();Object.defineProperty(ns,"__esModule",{value:!0});ns.getAccountMetasAndSigners=ns.expectPda=ns.expectPublicKey=ns.expectSome=void 0;var Kp=re();function Iue(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}ns.expectSome=Iue;function Pue(t){if(!t)throw new Error("Expected a PublicKey.");return(0,Kp.publicKey)(t,!1)}ns.expectPublicKey=Pue;function Rue(t){if(!t||!Array.isArray(t)||!(0,Kp.isPda)(t))throw new Error("Expected a PDA.");return t}ns.expectPda=Rue;function Oue(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,Kp.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,Kp.publicKey)(s.value,!1),isSigner:(0,Kp.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}ns.getAccountMetasAndSigners=Oue});var f3=S(pa=>{"use strict";a();Object.defineProperty(pa,"__esModule",{value:!0});pa.registerReputationV1=pa.registerReputationV1InstructionDiscriminator=pa.getRegisterReputationV1InstructionDataSerializer=void 0;var Bue=re(),Wp=q(),Tue=_b(),l3=CI();function d3(){return(0,Wp.mapSerializer)((0,Wp.struct)([["discriminator",(0,Wp.u8)()],["padding",(0,Wp.array)((0,Wp.u8)(),{size:7})]],{description:"RegisterReputationV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}pa.getRegisterReputationV1InstructionDataSerializer=d3;pa.registerReputationV1InstructionDiscriminator=0;function zue(t,e){let r=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR"),n={agentReputation:{index:0,isWritable:!0,value:e.agentReputation??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.agentReputation.value||(n.agentReputation.value=(0,Tue.findAgentReputationV1Pda)(t,{asset:(0,l3.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,l3.getAccountMetasAndSigners)(i,"programId",r),c=d3().serialize({});return(0,Bue.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}pa.registerReputationV1=zue});var NI=S(Fc=>{"use strict";a();var kue=Fc&&Fc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Cue=Fc&&Fc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kue(e,t,r)};Object.defineProperty(Fc,"__esModule",{value:!0});Cue(f3(),Fc)});var p3=S(ai=>{"use strict";a();Object.defineProperty(ai,"__esModule",{value:!0});ai.getMplAgentReputationProgramId=ai.getMplAgentReputationProgram=ai.createMplAgentReputationProgram=ai.MPL_AGENT_REPUTATION_PROGRAM_ID=void 0;var h3=kI();ai.MPL_AGENT_REPUTATION_PROGRAM_ID="REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR";function Nue(){return{name:"mplAgentReputation",publicKey:ai.MPL_AGENT_REPUTATION_PROGRAM_ID,getErrorFromCode(t,e){return(0,h3.getMplAgentReputationErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,h3.getMplAgentReputationErrorFromName)(t,this,e)},isOnCluster(){return!0}}}ai.createMplAgentReputationProgram=Nue;function Mue(t,e){return t.programs.get("mplAgentReputation",e)}ai.getMplAgentReputationProgram=Mue;function Lue(t,e){return t.programs.getPublicKey("mplAgentReputation",ai.MPL_AGENT_REPUTATION_PROGRAM_ID,e)}ai.getMplAgentReputationProgramId=Lue});var MI=S(Kc=>{"use strict";a();var Due=Kc&&Kc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),que=Kc&&Kc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Due(e,t,r)};Object.defineProperty(Kc,"__esModule",{value:!0});que(p3(),Kc)});var LI=S(ci=>{"use strict";a();var Uue=ci&&ci.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Bd=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Uue(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});Bd(_b(),ci);Bd(kI(),ci);Bd(NI(),ci);Bd(MI(),ci);Bd(CI(),ci);Bd(TI(),ci)});var y3=S(Wc=>{"use strict";a();Object.defineProperty(Wc,"__esModule",{value:!0});Wc.getKeySerializer=Wc.Key=void 0;var Vue=q(),g3;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentValidationV1=1]="AgentValidationV1"})(g3=Wc.Key||(Wc.Key={}));function Fue(){return(0,Vue.scalarEnum)(g3,{description:"Key"})}Wc.getKeySerializer=Fue});var DI=S(jc=>{"use strict";a();var Kue=jc&&jc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Wue=jc&&jc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kue(e,t,r)};Object.defineProperty(jc,"__esModule",{value:!0});Wue(y3(),jc)});var S3=S(ut=>{"use strict";a();Object.defineProperty(ut,"__esModule",{value:!0});ut.safeFetchAgentValidationV1FromSeeds=ut.fetchAgentValidationV1FromSeeds=ut.findAgentValidationV1Pda=ut.getAgentValidationV1Size=ut.getAgentValidationV1GpaBuilder=ut.safeFetchAllAgentValidationV1=ut.fetchAllAgentValidationV1=ut.safeFetchAgentValidationV1=ut.fetchAgentValidationV1=ut.deserializeAgentValidationV1=ut.getAgentValidationV1AccountDataSerializer=void 0;var ga=re(),ui=q(),m3=DI();function b3(){return(0,ui.mapSerializer)((0,ui.struct)([["key",(0,m3.getKeySerializer)()],["bump",(0,ui.u8)()],["padding",(0,ui.array)((0,ui.u8)(),{size:6})],["asset",(0,ui.publicKey)()]],{description:"AgentValidationV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}ut.getAgentValidationV1AccountDataSerializer=b3;function Td(t){return(0,ga.deserializeAccount)(t,b3())}ut.deserializeAgentValidationV1=Td;async function _3(t,e,r){let n=await t.rpc.getAccount((0,ga.publicKey)(e,!1),r);return(0,ga.assertAccountExists)(n,"AgentValidationV1"),Td(n)}ut.fetchAgentValidationV1=_3;async function A3(t,e,r){let n=await t.rpc.getAccount((0,ga.publicKey)(e,!1),r);return n.exists?Td(n):null}ut.safeFetchAgentValidationV1=A3;async function jue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ga.publicKey)(i,!1)),r)).map(i=>((0,ga.assertAccountExists)(i,"AgentValidationV1"),Td(i)))}ut.fetchAllAgentValidationV1=jue;async function Hue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ga.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Td(i))}ut.safeFetchAllAgentValidationV1=Hue;function Gue(t){let e=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi");return(0,ga.gpaBuilder)(t,e).registerFields({key:[0,(0,m3.getKeySerializer)()],bump:[1,(0,ui.u8)()],padding:[2,(0,ui.array)((0,ui.u8)(),{size:6})],asset:[8,(0,ui.publicKey)()]}).deserializeUsing(r=>Td(r))}ut.getAgentValidationV1GpaBuilder=Gue;function $ue(){return 40}ut.getAgentValidationV1Size=$ue;function qI(t,e){let r=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi");return t.eddsa.findPda(r,[(0,ui.string)({size:"variable"}).serialize("agent_validation"),(0,ui.publicKey)().serialize(e.asset)])}ut.findAgentValidationV1Pda=qI;async function Zue(t,e,r){return _3(t,qI(t,e),r)}ut.fetchAgentValidationV1FromSeeds=Zue;async function Yue(t,e,r){return A3(t,qI(t,e),r)}ut.safeFetchAgentValidationV1FromSeeds=Yue});var Ab=S(Hc=>{"use strict";a();var Xue=Hc&&Hc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Jue=Hc&&Hc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xue(e,t,r)};Object.defineProperty(Hc,"__esModule",{value:!0});Jue(S3(),Hc)});var v3=S(Ir=>{"use strict";a();Object.defineProperty(Ir,"__esModule",{value:!0});Ir.getMplAgentValidationErrorFromName=Ir.getMplAgentValidationErrorFromCode=Ir.AgentValidationAlreadyRegisteredError=Ir.InvalidCoreAssetError=Ir.InvalidMplCoreProgramError=Ir.InvalidAccountDataError=Ir.InvalidInstructionDataError=Ir.InvalidSystemProgramError=void 0;var zd=re(),Gc=new Map,$c=new Map,jp=class extends zd.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Ir.InvalidSystemProgramError=jp;Gc.set(0,jp);$c.set("InvalidSystemProgram",jp);var Hp=class extends zd.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};Ir.InvalidInstructionDataError=Hp;Gc.set(1,Hp);$c.set("InvalidInstructionData",Hp);var Gp=class extends zd.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};Ir.InvalidAccountDataError=Gp;Gc.set(2,Gp);$c.set("InvalidAccountData",Gp);var $p=class extends zd.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};Ir.InvalidMplCoreProgramError=$p;Gc.set(3,$p);$c.set("InvalidMplCoreProgram",$p);var Zp=class extends zd.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};Ir.InvalidCoreAssetError=Zp;Gc.set(4,Zp);$c.set("InvalidCoreAsset",Zp);var Yp=class extends zd.ProgramError{constructor(e,r){super("Agent Validation already registered",e,r),this.name="AgentValidationAlreadyRegistered",this.code=5}};Ir.AgentValidationAlreadyRegisteredError=Yp;Gc.set(5,Yp);$c.set("AgentValidationAlreadyRegistered",Yp);function Que(t,e,r){let n=Gc.get(t);return n?new n(e,r):null}Ir.getMplAgentValidationErrorFromCode=Que;function ele(t,e,r){let n=$c.get(t);return n?new n(e,r):null}Ir.getMplAgentValidationErrorFromName=ele});var UI=S(Zc=>{"use strict";a();var tle=Zc&&Zc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),rle=Zc&&Zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tle(e,t,r)};Object.defineProperty(Zc,"__esModule",{value:!0});rle(v3(),Zc)});var VI=S(is=>{"use strict";a();Object.defineProperty(is,"__esModule",{value:!0});is.getAccountMetasAndSigners=is.expectPda=is.expectPublicKey=is.expectSome=void 0;var Xp=re();function nle(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}is.expectSome=nle;function ile(t){if(!t)throw new Error("Expected a PublicKey.");return(0,Xp.publicKey)(t,!1)}is.expectPublicKey=ile;function sle(t){if(!t||!Array.isArray(t)||!(0,Xp.isPda)(t))throw new Error("Expected a PDA.");return t}is.expectPda=sle;function ole(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,Xp.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,Xp.publicKey)(s.value,!1),isSigner:(0,Xp.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}is.getAccountMetasAndSigners=ole});var x3=S(ya=>{"use strict";a();Object.defineProperty(ya,"__esModule",{value:!0});ya.registerValidationV1=ya.registerValidationV1InstructionDiscriminator=ya.getRegisterValidationV1InstructionDataSerializer=void 0;var ale=re(),Jp=q(),cle=Ab(),E3=VI();function w3(){return(0,Jp.mapSerializer)((0,Jp.struct)([["discriminator",(0,Jp.u8)()],["padding",(0,Jp.array)((0,Jp.u8)(),{size:7})]],{description:"RegisterValidationV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}ya.getRegisterValidationV1InstructionDataSerializer=w3;ya.registerValidationV1InstructionDiscriminator=0;function ule(t,e){let r=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi"),n={agentValidation:{index:0,isWritable:!0,value:e.agentValidation??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.agentValidation.value||(n.agentValidation.value=(0,cle.findAgentValidationV1Pda)(t,{asset:(0,E3.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,E3.getAccountMetasAndSigners)(i,"programId",r),c=w3().serialize({});return(0,ale.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}ya.registerValidationV1=ule});var FI=S(Yc=>{"use strict";a();var lle=Yc&&Yc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),dle=Yc&&Yc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lle(e,t,r)};Object.defineProperty(Yc,"__esModule",{value:!0});dle(x3(),Yc)});var P3=S(li=>{"use strict";a();Object.defineProperty(li,"__esModule",{value:!0});li.getMplAgentValidationProgramId=li.getMplAgentValidationProgram=li.createMplAgentValidationProgram=li.MPL_AGENT_VALIDATION_PROGRAM_ID=void 0;var I3=UI();li.MPL_AGENT_VALIDATION_PROGRAM_ID="VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi";function fle(){return{name:"mplAgentValidation",publicKey:li.MPL_AGENT_VALIDATION_PROGRAM_ID,getErrorFromCode(t,e){return(0,I3.getMplAgentValidationErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,I3.getMplAgentValidationErrorFromName)(t,this,e)},isOnCluster(){return!0}}}li.createMplAgentValidationProgram=fle;function hle(t,e){return t.programs.get("mplAgentValidation",e)}li.getMplAgentValidationProgram=hle;function ple(t,e){return t.programs.getPublicKey("mplAgentValidation",li.MPL_AGENT_VALIDATION_PROGRAM_ID,e)}li.getMplAgentValidationProgramId=ple});var KI=S(Xc=>{"use strict";a();var gle=Xc&&Xc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),yle=Xc&&Xc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gle(e,t,r)};Object.defineProperty(Xc,"__esModule",{value:!0});yle(P3(),Xc)});var WI=S(di=>{"use strict";a();var mle=di&&di.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kd=di&&di.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mle(e,t,r)};Object.defineProperty(di,"__esModule",{value:!0});kd(Ab(),di);kd(UI(),di);kd(FI(),di);kd(KI(),di);kd(VI(),di);kd(DI(),di)});var O3=S(Jc=>{"use strict";a();Object.defineProperty(Jc,"__esModule",{value:!0});Jc.getKeySerializer=Jc.Key=void 0;var ble=q(),R3;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.ExecutiveProfileV1=1]="ExecutiveProfileV1",t[t.ExecutionDelegateRecordV1=2]="ExecutionDelegateRecordV1"})(R3=Jc.Key||(Jc.Key={}));function _le(){return(0,ble.scalarEnum)(R3,{description:"Key"})}Jc.getKeySerializer=_le});var Sb=S(Qc=>{"use strict";a();var Ale=Qc&&Qc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Sle=Qc&&Qc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ale(e,t,r)};Object.defineProperty(Qc,"__esModule",{value:!0});Sle(O3(),Qc)});var C3=S(lt=>{"use strict";a();Object.defineProperty(lt,"__esModule",{value:!0});lt.safeFetchExecutionDelegateRecordV1FromSeeds=lt.fetchExecutionDelegateRecordV1FromSeeds=lt.findExecutionDelegateRecordV1Pda=lt.getExecutionDelegateRecordV1Size=lt.getExecutionDelegateRecordV1GpaBuilder=lt.safeFetchAllExecutionDelegateRecordV1=lt.fetchAllExecutionDelegateRecordV1=lt.safeFetchExecutionDelegateRecordV1=lt.fetchExecutionDelegateRecordV1=lt.deserializeExecutionDelegateRecordV1=lt.getExecutionDelegateRecordV1AccountDataSerializer=void 0;var ma=re(),Nr=q(),B3=Sb();function T3(){return(0,Nr.mapSerializer)((0,Nr.struct)([["key",(0,B3.getKeySerializer)()],["bump",(0,Nr.u8)()],["padding",(0,Nr.array)((0,Nr.u8)(),{size:6})],["executiveProfile",(0,Nr.publicKey)()],["authority",(0,Nr.publicKey)()],["agentAsset",(0,Nr.publicKey)()]],{description:"ExecutionDelegateRecordV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}lt.getExecutionDelegateRecordV1AccountDataSerializer=T3;function Cd(t){return(0,ma.deserializeAccount)(t,T3())}lt.deserializeExecutionDelegateRecordV1=Cd;async function z3(t,e,r){let n=await t.rpc.getAccount((0,ma.publicKey)(e,!1),r);return(0,ma.assertAccountExists)(n,"ExecutionDelegateRecordV1"),Cd(n)}lt.fetchExecutionDelegateRecordV1=z3;async function k3(t,e,r){let n=await t.rpc.getAccount((0,ma.publicKey)(e,!1),r);return n.exists?Cd(n):null}lt.safeFetchExecutionDelegateRecordV1=k3;async function vle(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ma.publicKey)(i,!1)),r)).map(i=>((0,ma.assertAccountExists)(i,"ExecutionDelegateRecordV1"),Cd(i)))}lt.fetchAllExecutionDelegateRecordV1=vle;async function Ele(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ma.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Cd(i))}lt.safeFetchAllExecutionDelegateRecordV1=Ele;function wle(t){let e=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return(0,ma.gpaBuilder)(t,e).registerFields({key:[0,(0,B3.getKeySerializer)()],bump:[1,(0,Nr.u8)()],padding:[2,(0,Nr.array)((0,Nr.u8)(),{size:6})],executiveProfile:[8,(0,Nr.publicKey)()],authority:[40,(0,Nr.publicKey)()],agentAsset:[72,(0,Nr.publicKey)()]}).deserializeUsing(r=>Cd(r))}lt.getExecutionDelegateRecordV1GpaBuilder=wle;function xle(){return 104}lt.getExecutionDelegateRecordV1Size=xle;function jI(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return t.eddsa.findPda(r,[(0,Nr.string)({size:"variable"}).serialize("execution_delegate_record"),(0,Nr.publicKey)().serialize(e.executiveProfile),(0,Nr.publicKey)().serialize(e.agentAsset)])}lt.findExecutionDelegateRecordV1Pda=jI;async function Ile(t,e,r){return z3(t,jI(t,e),r)}lt.fetchExecutionDelegateRecordV1FromSeeds=Ile;async function Ple(t,e,r){return k3(t,jI(t,e),r)}lt.safeFetchExecutionDelegateRecordV1FromSeeds=Ple});var q3=S(dt=>{"use strict";a();Object.defineProperty(dt,"__esModule",{value:!0});dt.safeFetchExecutiveProfileV1FromSeeds=dt.fetchExecutiveProfileV1FromSeeds=dt.findExecutiveProfileV1Pda=dt.getExecutiveProfileV1Size=dt.getExecutiveProfileV1GpaBuilder=dt.safeFetchAllExecutiveProfileV1=dt.fetchAllExecutiveProfileV1=dt.safeFetchExecutiveProfileV1=dt.fetchExecutiveProfileV1=dt.deserializeExecutiveProfileV1=dt.getExecutiveProfileV1AccountDataSerializer=void 0;var ba=re(),ss=q(),N3=Sb();function M3(){return(0,ss.mapSerializer)((0,ss.struct)([["key",(0,N3.getKeySerializer)()],["padding",(0,ss.array)((0,ss.u8)(),{size:7})],["authority",(0,ss.publicKey)()]],{description:"ExecutiveProfileV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0,0]}))}dt.getExecutiveProfileV1AccountDataSerializer=M3;function Nd(t){return(0,ba.deserializeAccount)(t,M3())}dt.deserializeExecutiveProfileV1=Nd;async function L3(t,e,r){let n=await t.rpc.getAccount((0,ba.publicKey)(e,!1),r);return(0,ba.assertAccountExists)(n,"ExecutiveProfileV1"),Nd(n)}dt.fetchExecutiveProfileV1=L3;async function D3(t,e,r){let n=await t.rpc.getAccount((0,ba.publicKey)(e,!1),r);return n.exists?Nd(n):null}dt.safeFetchExecutiveProfileV1=D3;async function Rle(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ba.publicKey)(i,!1)),r)).map(i=>((0,ba.assertAccountExists)(i,"ExecutiveProfileV1"),Nd(i)))}dt.fetchAllExecutiveProfileV1=Rle;async function Ole(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ba.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Nd(i))}dt.safeFetchAllExecutiveProfileV1=Ole;function Ble(t){let e=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return(0,ba.gpaBuilder)(t,e).registerFields({key:[0,(0,N3.getKeySerializer)()],padding:[1,(0,ss.array)((0,ss.u8)(),{size:7})],authority:[8,(0,ss.publicKey)()]}).deserializeUsing(r=>Nd(r))}dt.getExecutiveProfileV1GpaBuilder=Ble;function Tle(){return 40}dt.getExecutiveProfileV1Size=Tle;function HI(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return t.eddsa.findPda(r,[(0,ss.string)({size:"variable"}).serialize("executive_profile"),(0,ss.publicKey)().serialize(e.authority)])}dt.findExecutiveProfileV1Pda=HI;async function zle(t,e,r){return L3(t,HI(t,e),r)}dt.fetchExecutiveProfileV1FromSeeds=zle;async function kle(t,e,r){return D3(t,HI(t,e),r)}dt.safeFetchExecutiveProfileV1FromSeeds=kle});var U3=S(_a=>{"use strict";a();Object.defineProperty(_a,"__esModule",{value:!0});_a.findReceiptsTreePda=_a.findReceiptsAuthorityPda=_a.findReceiptsCollectionPda=void 0;var vb=q(),Cle="TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S";function GI(t,e){let r=t.programs.getPublicKey("mplAgentTools",Cle);return t.eddsa.findPda(r,e)}function Nle(t){return GI(t,[(0,vb.string)({size:"variable"}).serialize("receipts_collection")])}_a.findReceiptsCollectionPda=Nle;function Mle(t){return GI(t,[(0,vb.string)({size:"variable"}).serialize("receipts_authority")])}_a.findReceiptsAuthorityPda=Mle;function Lle(t,e){return GI(t,[(0,vb.string)({size:"variable"}).serialize("receipts_tree"),(0,vb.u64)().serialize(e.treeIndex)])}_a.findReceiptsTreePda=Lle});var $s=S(Gs=>{"use strict";a();var Dle=Gs&&Gs.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),$I=Gs&&Gs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Dle(e,t,r)};Object.defineProperty(Gs,"__esModule",{value:!0});$I(C3(),Gs);$I(q3(),Gs);$I(U3(),Gs)});var V3=S(_e=>{"use strict";a();Object.defineProperty(_e,"__esModule",{value:!0});_e.getMplAgentToolsErrorFromName=_e.getMplAgentToolsErrorFromCode=_e.InvalidCompressionProgramError=_e.InvalidReceiptsTreeDerivationError=_e.ReceiptsCollectionAlreadyInitializedError=_e.InvalidReceiptsAuthorityError=_e.InvalidReceiptsCollectionError=_e.ReceiptUriInvalidError=_e.ExecutiveAuthorityMismatchError=_e.InvalidBubblegumProgramError=_e.ExecutiveProfileMustBeInitializedError=_e.UnauthorizedRevokeError=_e.ExecutionDelegateRecordMustBeInitializedError=_e.InvalidExecutiveProfileDerivationError=_e.AssetOwnerMustBeTheOneToDelegateExecutionError=_e.AgentIdentityNotRegisteredError=_e.InvalidAgentIdentityError=_e.ExecutionDelegateRecordMustBeUninitializedError=_e.InvalidExecutionDelegateRecordDerivationError=_e.ExecutiveProfileMustBeUninitializedError=_e.InvalidCoreAssetError=_e.InvalidMplCoreProgramError=_e.InvalidAccountDataError=_e.InvalidInstructionDataError=_e.InvalidSystemProgramError=void 0;var yt=re(),ft=new Map,ht=new Map,Qp=class extends yt.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};_e.InvalidSystemProgramError=Qp;ft.set(0,Qp);ht.set("InvalidSystemProgram",Qp);var eg=class extends yt.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};_e.InvalidInstructionDataError=eg;ft.set(1,eg);ht.set("InvalidInstructionData",eg);var tg=class extends yt.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};_e.InvalidAccountDataError=tg;ft.set(2,tg);ht.set("InvalidAccountData",tg);var rg=class extends yt.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};_e.InvalidMplCoreProgramError=rg;ft.set(3,rg);ht.set("InvalidMplCoreProgram",rg);var ng=class extends yt.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};_e.InvalidCoreAssetError=ng;ft.set(4,ng);ht.set("InvalidCoreAsset",ng);var ig=class extends yt.ProgramError{constructor(e,r){super("Executive Profile must be uninitialized",e,r),this.name="ExecutiveProfileMustBeUninitialized",this.code=5}};_e.ExecutiveProfileMustBeUninitializedError=ig;ft.set(5,ig);ht.set("ExecutiveProfileMustBeUninitialized",ig);var sg=class extends yt.ProgramError{constructor(e,r){super("Invalid Execution Delegate Record Derivation",e,r),this.name="InvalidExecutionDelegateRecordDerivation",this.code=6}};_e.InvalidExecutionDelegateRecordDerivationError=sg;ft.set(6,sg);ht.set("InvalidExecutionDelegateRecordDerivation",sg);var og=class extends yt.ProgramError{constructor(e,r){super("Execution Delegate Record must be uninitialized",e,r),this.name="ExecutionDelegateRecordMustBeUninitialized",this.code=7}};_e.ExecutionDelegateRecordMustBeUninitializedError=og;ft.set(7,og);ht.set("ExecutionDelegateRecordMustBeUninitialized",og);var ag=class extends yt.ProgramError{constructor(e,r){super("Invalid Agent Identity",e,r),this.name="InvalidAgentIdentity",this.code=8}};_e.InvalidAgentIdentityError=ag;ft.set(8,ag);ht.set("InvalidAgentIdentity",ag);var cg=class extends yt.ProgramError{constructor(e,r){super("Agent Identity not registered",e,r),this.name="AgentIdentityNotRegistered",this.code=9}};_e.AgentIdentityNotRegisteredError=cg;ft.set(9,cg);ht.set("AgentIdentityNotRegistered",cg);var ug=class extends yt.ProgramError{constructor(e,r){super("Asset owner must be the one to delegate execution",e,r),this.name="AssetOwnerMustBeTheOneToDelegateExecution",this.code=10}};_e.AssetOwnerMustBeTheOneToDelegateExecutionError=ug;ft.set(10,ug);ht.set("AssetOwnerMustBeTheOneToDelegateExecution",ug);var lg=class extends yt.ProgramError{constructor(e,r){super("Invalid Executive Profile Derivation",e,r),this.name="InvalidExecutiveProfileDerivation",this.code=11}};_e.InvalidExecutiveProfileDerivationError=lg;ft.set(11,lg);ht.set("InvalidExecutiveProfileDerivation",lg);var dg=class extends yt.ProgramError{constructor(e,r){super("Execution Delegate Record must be initialized",e,r),this.name="ExecutionDelegateRecordMustBeInitialized",this.code=12}};_e.ExecutionDelegateRecordMustBeInitializedError=dg;ft.set(12,dg);ht.set("ExecutionDelegateRecordMustBeInitialized",dg);var fg=class extends yt.ProgramError{constructor(e,r){super("Authority must be asset owner or executive to revoke",e,r),this.name="UnauthorizedRevoke",this.code=13}};_e.UnauthorizedRevokeError=fg;ft.set(13,fg);ht.set("UnauthorizedRevoke",fg);var hg=class extends yt.ProgramError{constructor(e,r){super("Executive Profile must be initialized",e,r),this.name="ExecutiveProfileMustBeInitialized",this.code=14}};_e.ExecutiveProfileMustBeInitializedError=hg;ft.set(14,hg);ht.set("ExecutiveProfileMustBeInitialized",hg);var pg=class extends yt.ProgramError{constructor(e,r){super("Invalid Bubblegum Program",e,r),this.name="InvalidBubblegumProgram",this.code=15}};_e.InvalidBubblegumProgramError=pg;ft.set(15,pg);ht.set("InvalidBubblegumProgram",pg);var gg=class extends yt.ProgramError{constructor(e,r){super("Executive authority does not match the delegate record's authority",e,r),this.name="ExecutiveAuthorityMismatch",this.code=16}};_e.ExecutiveAuthorityMismatchError=gg;ft.set(16,gg);ht.set("ExecutiveAuthorityMismatch",gg);var yg=class extends yt.ProgramError{constructor(e,r){super("Receipt URI must be non-empty and within size limits",e,r),this.name="ReceiptUriInvalid",this.code=17}};_e.ReceiptUriInvalidError=yg;ft.set(17,yg);ht.set("ReceiptUriInvalid",yg);var mg=class extends yt.ProgramError{constructor(e,r){super("Supplied collection is not the canonical receipts collection PDA",e,r),this.name="InvalidReceiptsCollection",this.code=18}};_e.InvalidReceiptsCollectionError=mg;ft.set(18,mg);ht.set("InvalidReceiptsCollection",mg);var bg=class extends yt.ProgramError{constructor(e,r){super("Supplied authority is not the canonical receipts authority PDA",e,r),this.name="InvalidReceiptsAuthority",this.code=19}};_e.InvalidReceiptsAuthorityError=bg;ft.set(19,bg);ht.set("InvalidReceiptsAuthority",bg);var _g=class extends yt.ProgramError{constructor(e,r){super("Receipts collection already exists",e,r),this.name="ReceiptsCollectionAlreadyInitialized",this.code=20}};_e.ReceiptsCollectionAlreadyInitializedError=_g;ft.set(20,_g);ht.set("ReceiptsCollectionAlreadyInitialized",_g);var Ag=class extends yt.ProgramError{constructor(e,r){super("Invalid receipts tree PDA derivation",e,r),this.name="InvalidReceiptsTreeDerivation",this.code=21}};_e.InvalidReceiptsTreeDerivationError=Ag;ft.set(21,Ag);ht.set("InvalidReceiptsTreeDerivation",Ag);var Sg=class extends yt.ProgramError{constructor(e,r){super("Invalid MPL Account Compression Program",e,r),this.name="InvalidCompressionProgram",this.code=22}};_e.InvalidCompressionProgramError=Sg;ft.set(22,Sg);ht.set("InvalidCompressionProgram",Sg);function qle(t,e,r){let n=ft.get(t);return n?new n(e,r):null}_e.getMplAgentToolsErrorFromCode=qle;function Ule(t,e,r){let n=ht.get(t);return n?new n(e,r):null}_e.getMplAgentToolsErrorFromName=Ule});var ZI=S(eu=>{"use strict";a();var Vle=eu&&eu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Fle=eu&&eu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vle(e,t,r)};Object.defineProperty(eu,"__esModule",{value:!0});Fle(V3(),eu)});var Zs=S(os=>{"use strict";a();Object.defineProperty(os,"__esModule",{value:!0});os.getAccountMetasAndSigners=os.expectPda=os.expectPublicKey=os.expectSome=void 0;var vg=re();function Kle(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}os.expectSome=Kle;function Wle(t){if(!t)throw new Error("Expected a PublicKey.");return(0,vg.publicKey)(t,!1)}os.expectPublicKey=Wle;function jle(t){if(!t||!Array.isArray(t)||!(0,vg.isPda)(t))throw new Error("Expected a PDA.");return t}os.expectPda=jle;function Hle(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,vg.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,vg.publicKey)(s.value,!1),isSigner:(0,vg.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}os.getAccountMetasAndSigners=Hle});var W3=S(Aa=>{"use strict";a();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.closeWorkReceiptV1=Aa.closeWorkReceiptV1InstructionDiscriminator=Aa.getCloseWorkReceiptV1InstructionDataSerializer=void 0;var Gle=re(),Mr=q(),F3=$s(),$le=Zs();function K3(){return(0,Mr.mapSerializer)((0,Mr.struct)([["discriminator",(0,Mr.u8)()],["pad",(0,Mr.array)((0,Mr.u8)(),{size:7})],["treeIndex",(0,Mr.u64)()],["root",(0,Mr.bytes)({size:32})],["dataHash",(0,Mr.bytes)({size:32})],["creatorHash",(0,Mr.bytes)({size:32})],["assetDataHash",(0,Mr.bytes)({size:32})],["flags",(0,Mr.u8)()],["pad2",(0,Mr.array)((0,Mr.u8)(),{size:7})],["nonce",(0,Mr.u64)()],["index",(0,Mr.u32)()],["pad3",(0,Mr.array)((0,Mr.u8)(),{size:4})]],{description:"CloseWorkReceiptV1InstructionData"}),t=>({...t,discriminator:6,pad:[0,0,0,0,0,0,0],pad2:[0,0,0,0,0,0,0],pad3:[0,0,0,0]}))}Aa.getCloseWorkReceiptV1InstructionDataSerializer=K3;Aa.closeWorkReceiptV1InstructionDiscriminator=6;function Zle(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},leafOwner:{index:1,isWritable:!1,value:e.leafOwner??null},authority:{index:2,isWritable:!1,value:e.authority??null},treeConfig:{index:3,isWritable:!0,value:e.treeConfig??null},merkleTree:{index:4,isWritable:!0,value:e.merkleTree??null},coreCollection:{index:5,isWritable:!0,value:e.coreCollection??null},mplCoreCpiSigner:{index:6,isWritable:!1,value:e.mplCoreCpiSigner??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:8,isWritable:!1,value:e.compressionProgram??null},mplCoreProgram:{index:9,isWritable:!1,value:e.mplCoreProgram??null},bubblegumProgram:{index:10,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:11,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,F3.findReceiptsAuthorityPda)(t)),n.coreCollection.value||(n.coreCollection.value=(0,F3.findReceiptsCollectionPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,$le.getAccountMetasAndSigners)(s,"programId",r),u=K3().serialize(i);return(0,Gle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Aa.closeWorkReceiptV1=Zle});var G3=S(Sa=>{"use strict";a();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.createReceiptsCollectionV1=Sa.createReceiptsCollectionV1InstructionDiscriminator=Sa.getCreateReceiptsCollectionV1InstructionDataSerializer=void 0;var Yle=re(),Eg=q(),j3=$s(),Xle=Zs();function H3(){return(0,Eg.mapSerializer)((0,Eg.struct)([["discriminator",(0,Eg.u8)()],["padding",(0,Eg.array)((0,Eg.u8)(),{size:7})]],{description:"CreateReceiptsCollectionV1InstructionData"}),t=>({...t,discriminator:4,padding:[0,0,0,0,0,0,0]}))}Sa.getCreateReceiptsCollectionV1InstructionDataSerializer=H3;Sa.createReceiptsCollectionV1InstructionDiscriminator=4;function Jle(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:3,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.collection.value||(n.collection.value=(0,j3.findReceiptsCollectionPda)(t)),n.authority.value||(n.authority.value=(0,j3.findReceiptsAuthorityPda)(t)),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Xle.getAccountMetasAndSigners)(i,"programId",r),c=H3().serialize({});return(0,Yle.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Sa.createReceiptsCollectionV1=Jle});var Z3=S(va=>{"use strict";a();Object.defineProperty(va,"__esModule",{value:!0});va.delegateExecutionV1=va.delegateExecutionV1InstructionDiscriminator=va.getDelegateExecutionV1InstructionDataSerializer=void 0;var Qle=re(),wg=q(),ede=$s(),YI=Zs();function $3(){return(0,wg.mapSerializer)((0,wg.struct)([["discriminator",(0,wg.u8)()],["padding",(0,wg.array)((0,wg.u8)(),{size:7})]],{description:"DelegateExecutionV1InstructionData"}),t=>({...t,discriminator:1,padding:[0,0,0,0,0,0,0]}))}va.getDelegateExecutionV1InstructionDataSerializer=$3;va.delegateExecutionV1InstructionDiscriminator=1;function tde(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executiveProfile:{index:0,isWritable:!1,value:e.executiveProfile??null},agentAsset:{index:1,isWritable:!1,value:e.agentAsset??null},agentIdentity:{index:2,isWritable:!1,value:e.agentIdentity??null},executionDelegateRecord:{index:3,isWritable:!0,value:e.executionDelegateRecord??null},payer:{index:4,isWritable:!0,value:e.payer??null},authority:{index:5,isWritable:!1,value:e.authority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.executionDelegateRecord.value||(n.executionDelegateRecord.value=(0,ede.findExecutionDelegateRecordV1Pda)(t,{executiveProfile:(0,YI.expectPublicKey)(n.executiveProfile.value),agentAsset:(0,YI.expectPublicKey)(n.agentAsset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,YI.getAccountMetasAndSigners)(i,"programId",r),c=$3().serialize({});return(0,Qle.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}va.delegateExecutionV1=tde});var J3=S(Ea=>{"use strict";a();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.mintWorkReceiptV1=Ea.mintWorkReceiptV1InstructionDiscriminator=Ea.getMintWorkReceiptV1InstructionDataSerializer=void 0;var rde=re(),tu=q(),Y3=$s(),nde=Zs();function X3(){return(0,tu.mapSerializer)((0,tu.struct)([["discriminator",(0,tu.u8)()],["pad",(0,tu.array)((0,tu.u8)(),{size:7})],["treeIndex",(0,tu.u64)()],["receiptUri",(0,tu.string)()]],{description:"MintWorkReceiptV1InstructionData"}),t=>({...t,discriminator:3,pad:[0,0,0,0,0,0,0]}))}Ea.getMintWorkReceiptV1InstructionDataSerializer=X3;Ea.mintWorkReceiptV1InstructionDiscriminator=3;function ide(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},executiveAuthority:{index:1,isWritable:!1,value:e.executiveAuthority??null},executionDelegateRecord:{index:2,isWritable:!1,value:e.executionDelegateRecord??null},agentAsset:{index:3,isWritable:!1,value:e.agentAsset??null},client:{index:4,isWritable:!1,value:e.client??null},authority:{index:5,isWritable:!1,value:e.authority??null},treeConfig:{index:6,isWritable:!0,value:e.treeConfig??null},merkleTree:{index:7,isWritable:!0,value:e.merkleTree??null},coreCollection:{index:8,isWritable:!0,value:e.coreCollection??null},mplCoreCpiSigner:{index:9,isWritable:!1,value:e.mplCoreCpiSigner??null},logWrapper:{index:10,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:11,isWritable:!1,value:e.compressionProgram??null},mplCoreProgram:{index:12,isWritable:!1,value:e.mplCoreProgram??null},bubblegumProgram:{index:13,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:14,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,Y3.findReceiptsAuthorityPda)(t)),n.coreCollection.value||(n.coreCollection.value=(0,Y3.findReceiptsCollectionPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,nde.getAccountMetasAndSigners)(s,"programId",r),u=X3().serialize(i);return(0,rde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Ea.mintWorkReceiptV1=ide});var tq=S(wa=>{"use strict";a();Object.defineProperty(wa,"__esModule",{value:!0});wa.registerExecutiveV1=wa.registerExecutiveV1InstructionDiscriminator=wa.getRegisterExecutiveV1InstructionDataSerializer=void 0;var sde=re(),xg=q(),Q3=$s(),XI=Zs();function eq(){return(0,xg.mapSerializer)((0,xg.struct)([["discriminator",(0,xg.u8)()],["padding",(0,xg.array)((0,xg.u8)(),{size:7})]],{description:"RegisterExecutiveV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}wa.getRegisterExecutiveV1InstructionDataSerializer=eq;wa.registerExecutiveV1InstructionDiscriminator=0;function ode(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executiveProfile:{index:0,isWritable:!0,value:e.executiveProfile??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.executiveProfile.value||(n.authority.value?n.executiveProfile.value=(0,Q3.findExecutiveProfileV1Pda)(t,{authority:(0,XI.expectPublicKey)(n.authority.value)}):n.executiveProfile.value=(0,Q3.findExecutiveProfileV1Pda)(t,{authority:(0,XI.expectPublicKey)(n.payer.value)})),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,XI.getAccountMetasAndSigners)(i,"programId",r),c=eq().serialize({});return(0,sde.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}wa.registerExecutiveV1=ode});var nq=S(xa=>{"use strict";a();Object.defineProperty(xa,"__esModule",{value:!0});xa.registerReceiptsTreeV1=xa.registerReceiptsTreeV1InstructionDiscriminator=xa.getRegisterReceiptsTreeV1InstructionDataSerializer=void 0;var ade=re(),Bi=q(),cde=$s(),ude=Zs();function rq(){return(0,Bi.mapSerializer)((0,Bi.struct)([["discriminator",(0,Bi.u8)()],["pad",(0,Bi.array)((0,Bi.u8)(),{size:7})],["treeIndex",(0,Bi.u64)()],["maxDepth",(0,Bi.u32)()],["maxBufferSize",(0,Bi.u32)()],["canopyDepth",(0,Bi.u32)()],["pad2",(0,Bi.array)((0,Bi.u8)(),{size:4})]],{description:"RegisterReceiptsTreeV1InstructionData"}),t=>({...t,discriminator:5,pad:[0,0,0,0,0,0,0],pad2:[0,0,0,0]}))}xa.getRegisterReceiptsTreeV1InstructionDataSerializer=rq;xa.registerReceiptsTreeV1InstructionDiscriminator=5;function lde(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},authority:{index:1,isWritable:!1,value:e.authority??null},merkleTree:{index:2,isWritable:!0,value:e.merkleTree??null},treeConfig:{index:3,isWritable:!0,value:e.treeConfig??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:5,isWritable:!1,value:e.compressionProgram??null},bubblegumProgram:{index:6,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:7,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,cde.findReceiptsAuthorityPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ude.getAccountMetasAndSigners)(s,"programId",r),u=rq().serialize(i);return(0,ade.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}xa.registerReceiptsTreeV1=lde});var sq=S(Ia=>{"use strict";a();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.revokeExecutionV1=Ia.revokeExecutionV1InstructionDiscriminator=Ia.getRevokeExecutionV1InstructionDataSerializer=void 0;var dde=re(),Ig=q(),fde=Zs();function iq(){return(0,Ig.mapSerializer)((0,Ig.struct)([["discriminator",(0,Ig.u8)()],["padding",(0,Ig.array)((0,Ig.u8)(),{size:7})]],{description:"RevokeExecutionV1InstructionData"}),t=>({...t,discriminator:2,padding:[0,0,0,0,0,0,0]}))}Ia.getRevokeExecutionV1InstructionDataSerializer=iq;Ia.revokeExecutionV1InstructionDiscriminator=2;function hde(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executionDelegateRecord:{index:0,isWritable:!0,value:e.executionDelegateRecord??null},agentAsset:{index:1,isWritable:!1,value:e.agentAsset??null},destination:{index:2,isWritable:!0,value:e.destination??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,fde.getAccountMetasAndSigners)(i,"programId",r),c=iq().serialize({});return(0,dde.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ia.revokeExecutionV1=hde});var JI=S(Vn=>{"use strict";a();var pde=Vn&&Vn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ru=Vn&&Vn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pde(e,t,r)};Object.defineProperty(Vn,"__esModule",{value:!0});ru(W3(),Vn);ru(G3(),Vn);ru(Z3(),Vn);ru(J3(),Vn);ru(tq(),Vn);ru(nq(),Vn);ru(sq(),Vn)});var aq=S(fi=>{"use strict";a();Object.defineProperty(fi,"__esModule",{value:!0});fi.getMplAgentToolsProgramId=fi.getMplAgentToolsProgram=fi.createMplAgentToolsProgram=fi.MPL_AGENT_TOOLS_PROGRAM_ID=void 0;var oq=ZI();fi.MPL_AGENT_TOOLS_PROGRAM_ID="TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S";function gde(){return{name:"mplAgentTools",publicKey:fi.MPL_AGENT_TOOLS_PROGRAM_ID,getErrorFromCode(t,e){return(0,oq.getMplAgentToolsErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,oq.getMplAgentToolsErrorFromName)(t,this,e)},isOnCluster(){return!0}}}fi.createMplAgentToolsProgram=gde;function yde(t,e){return t.programs.get("mplAgentTools",e)}fi.getMplAgentToolsProgram=yde;function mde(t,e){return t.programs.getPublicKey("mplAgentTools",fi.MPL_AGENT_TOOLS_PROGRAM_ID,e)}fi.getMplAgentToolsProgramId=mde});var QI=S(nu=>{"use strict";a();var bde=nu&&nu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),_de=nu&&nu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bde(e,t,r)};Object.defineProperty(nu,"__esModule",{value:!0});_de(aq(),nu)});var eP=S(hi=>{"use strict";a();var Ade=hi&&hi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Md=hi&&hi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ade(e,t,r)};Object.defineProperty(hi,"__esModule",{value:!0});Md($s(),hi);Md(ZI(),hi);Md(JI(),hi);Md(QI(),hi);Md(Zs(),hi);Md(Sb(),hi)});var cq=S(as=>{"use strict";a();Object.defineProperty(as,"__esModule",{value:!0});as.mplAgentTools=as.mplAgentValidation=as.mplAgentReputation=as.mplAgentIdentity=void 0;var Sde=BI(),vde=LI(),Ede=WI(),wde=eP(),xde=()=>({install(t){t.programs.add((0,Sde.createMplAgentIdentityProgram)(),!1)}});as.mplAgentIdentity=xde;var Ide=()=>({install(t){t.programs.add((0,vde.createMplAgentReputationProgram)(),!1)}});as.mplAgentReputation=Ide;var Pde=()=>({install(t){t.programs.add((0,Ede.createMplAgentValidationProgram)(),!1)}});as.mplAgentValidation=Pde;var Rde=()=>({install(t){t.programs.add((0,wde.createMplAgentToolsProgram)(),!1)}});as.mplAgentTools=Rde});var wb=S(qe=>{"use strict";a();var uq=qe&&qe.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ode=qe&&qe.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),En=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uq(e,t,r)},Eb=qe&&qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uq(e,t,r);return Ode(e,t),e};Object.defineProperty(qe,"__esModule",{value:!0});qe.tools=qe.validation=qe.reputation=qe.identity=void 0;En(z6(),qe);En(cq(),qe);qe.identity=Eb(BI());qe.reputation=Eb(LI());qe.validation=Eb(WI());qe.tools=Eb(eP());En(vp(),qe);En(RI(),qe);En(OI(),qe);En(_b(),qe);En(NI(),qe);En(MI(),qe);En(Ab(),qe);En(FI(),qe);En(KI(),qe);En($s(),qe);En(JI(),qe);En(QI(),qe)});a();a();a();a();a();var Fd=t=>({__option:"Some",value:t}),cu=()=>({__option:"None"}),l_=t=>t&&typeof t=="object"&&"__option"in t&&(t.__option==="Some"&&"value"in t||t.__option==="None"),uu=t=>t.__option==="Some";a();var d_=t=>t!==null?Fd(t):cu();a();a();a();a();a();var Dg=class extends Error{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i),this.cause=n}};var f_=t=>{let e=t.length,r=BigInt(e);return{description:`base${e}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${t}]*$`)))throw new Dg(n,e);if(n==="")return new Uint8Array;let i=[...n],s=i.findIndex(m=>m!==t[0]);s=s===-1?i.length:s;let o=Array(s).fill(0);if(s===i.length)return Uint8Array.from(o);let c=i.slice(s),u=0n,d=1n;for(let m=c.length-1;m>=0;m-=1)u+=d*BigInt(t.indexOf(c[m])),d*=r;let f=[];for(;u>0n;)f.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(o.concat(f))},deserialize(n,i=0){if(n.length===0)return["",0];let s=n.slice(i),o=s.findIndex(f=>f!==0);o=o===-1?s.length:o;let c=t[0].repeat(o);if(o===s.length)return[c,n.length];let u=s.slice(o).reduce((f,m)=>f*256n+BigInt(m),0n),d=[];for(;u>0n;)d.unshift(t[Number(u%r)]),u/=r;return[c+d.join(""),n.length]}}};a();var cr=f_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");a();a();var et=t=>{let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r},h_=(t,e)=>{if(t.length>=e)return t;let r=new Uint8Array(e).fill(0);return r.set(t),r},Kd=(t,e)=>h_(t.slice(0,e),e);a();var Rr=class extends Error{name="DeserializingEmptyBufferError";constructor(e){super(`Serializer [${e}] cannot deserialize empty buffers.`)}},xn=class extends Error{name="NotEnoughBytesError";constructor(e,r,n){super(`Serializer [${e}] expected ${r} bytes, got ${n}.`)}},us=class extends Error{name="ExpectedFixedSizeSerializerError";constructor(e){e??="Expected a fixed-size serializer, got a variable-size one.",super(e)}};a();function lu(t,e,r){return{description:r??`fixed(${e}, ${t.description})`,fixedSize:e,maxSize:e,serialize:n=>Kd(t.serialize(n),e),deserialize:(n,i=0)=>{if(n=n.slice(i,i+e),n.length<e)throw new xn("fixSerializer",e,n.length);t.fixedSize!==null&&(n=Kd(n,t.fixedSize));let[s]=t.deserialize(n,0);return[s,i+e]}}}a();function qg(t,e,r){return{description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize,serialize:n=>t.serialize(e(n)),deserialize:(n,i=0)=>{let[s,o]=t.deserialize(n,i);return r?[r(s,n,i),o]:[s,o]}}}a();var p_=t=>t.replace(/\u0000/g,"");a();var du={description:"utf8",fixedSize:null,maxSize:null,serialize(t){return new TextEncoder().encode(t)},deserialize(t,e=0){let r=new TextDecoder().decode(t.slice(e));return[p_(r),t.length]}};a();var Ta=class extends Error{name="InvalidPublicKeyError";constructor(e,r){r=r?`. ${r}`:"",super(`The provided public key is invalid: ${e}${r}`),this.invalidPublicKey=e}};var fu=32;function hr(t,e=!0){let r=typeof t=="string"?t:typeof t=="object"&&"publicKey"in t?t.publicKey:typeof t=="object"&&"toBase58"in t?t.toBase58():Array.isArray(t)?t[0]:cr.deserialize(t)[0];return e&&g_(r),r}var za=t=>{try{return g_(t),!0}catch{return!1}};function g_(t){if(typeof t!="string")throw new Ta(t,"Public keys must be strings.");hu(t)}var hu=t=>{if(t.length<32||t.length>44)throw new Ta(t,"Public keys must be between 32 and 44 characters.");let e;try{e=cr.serialize(t)}catch{throw new Ta(t,"Public keys must be base58 encoded.")}if(e.length!==fu)throw new Ta(t,`Public keys must be ${fu} bytes.`);return e};a();a();a();a();var Wd;(function(t){t.Little="le",t.Big="be"})(Wd||(Wd={}));a();var Ug=class extends RangeError{name="NumberOutOfRangeError";constructor(e,r,n,i){super(`Serializer [${e}] expected number to be between ${r} and ${n}, got ${i}.`)}};a();a();function rt(t){let e,r=t.name;return t.size>1&&(e=!("endian"in t.options)||t.options.endian===Wd.Little,r+=e?"(le)":"(be)"),{description:t.options.description??r,fixedSize:t.size,maxSize:t.size,serialize(n){t.range&&y_(t.name,t.range[0],t.range[1],n);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),n,e),new Uint8Array(i)},deserialize(n,i=0){let s=n.slice(i,i+t.size);I4("i8",s,t.size);let o=x4(s);return[t.get(o,e),i+t.size]}}}var w4=t=>t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset),x4=t=>new DataView(w4(t)),y_=(t,e,r,n)=>{if(n<e||n>r)throw new Ug(t,e,r,n)},I4=(t,e,r)=>{if(e.length===0)throw new Rr(t);if(e.length<r)throw new xn(t,r,e.length)};var m_=(t={})=>rt({name:"f32",size:4,set:(e,r,n)=>e.setFloat32(0,Number(r),n),get:(e,r)=>e.getFloat32(0,r),options:t});a();var b_=(t={})=>rt({name:"f64",size:8,set:(e,r,n)=>e.setFloat64(0,Number(r),n),get:(e,r)=>e.getFloat64(0,r),options:t});a();var __=(t={})=>rt({name:"i8",size:1,range:[-+"0x7f"-1,+"0x7f"],set:(e,r)=>e.setInt8(0,Number(r)),get:e=>e.getInt8(0),options:t});a();var A_=(t={})=>rt({name:"i16",size:2,range:[-+"0x7fff"-1,+"0x7fff"],set:(e,r,n)=>e.setInt16(0,Number(r),n),get:(e,r)=>e.getInt16(0,r),options:t});a();var S_=(t={})=>rt({name:"i32",size:4,range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(e,r,n)=>e.setInt32(0,Number(r),n),get:(e,r)=>e.getInt32(0,r),options:t});a();var v_=(t={})=>rt({name:"i64",size:8,range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(e,r,n)=>e.setBigInt64(0,BigInt(r),n),get:(e,r)=>e.getBigInt64(0,r),options:t});a();var E_=(t={})=>rt({name:"i128",size:16,range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigInt64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigInt64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});a();var St=(t={})=>rt({name:"u8",size:1,range:[0,+"0xff"],set:(e,r)=>e.setUint8(0,Number(r)),get:e=>e.getUint8(0),options:t});a();var w_=(t={})=>rt({name:"u16",size:2,range:[0,+"0xffff"],set:(e,r,n)=>e.setUint16(0,Number(r),n),get:(e,r)=>e.getUint16(0,r),options:t});a();var gi=(t={})=>rt({name:"u32",size:4,range:[0,+"0xffffffff"],set:(e,r,n)=>e.setUint32(0,Number(r),n),get:(e,r)=>e.getUint32(0,r),options:t});a();var x_=(t={})=>rt({name:"u64",size:8,range:[0,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),get:(e,r)=>e.getBigUint64(0,r),options:t});a();var I_=(t={})=>rt({name:"u128",size:16,range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigUint64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigUint64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});a();var ki=(t={})=>({description:t.description??"shortU16",fixedSize:null,maxSize:3,serialize:e=>{y_("shortU16",0,65535,e);let r=[0];for(let n=0;;n+=1){let i=e>>n*7;if(i===0)break;let s=127&i;r[n]=s,n>0&&(r[n-1]|=128)}return new Uint8Array(r)},deserialize:(e,r=0)=>{let n=0,i=0;for(;++i;){let s=i-1,o=e[r+s],c=127&o;if(n|=c<<s*7,(o&128)===0)break}return[n,r+i]}});a();a();var Ci=class extends Error{name="InvalidNumberOfItemsError";constructor(e,r,n){super(`Expected [${e}] to have ${r} items, got ${n}.`)}};var Vg=class extends Error{name="UnrecognizedArrayLikeSerializerSizeError";constructor(e){super(`Unrecognized array-like serializer size: ${JSON.stringify(e)}`)}},Fg=class extends Error{name="InvalidDataEnumVariantError";constructor(e,r){super(`Invalid data enum variant. Expected one of [${r.join(", ")}], got "${e}".`)}},Kg=class extends Error{name="InvalidScalarEnumVariantError";constructor(e,r,n,i){super(`Invalid scalar enum variant. Expected one of [${r.join(", ")}] or a number between ${n} and ${i}, got "${e}".`)}},pu=class extends RangeError{name="EnumDiscriminatorOutOfRangeError";constructor(e,r,n){super(`Enum discriminator out of range. Expected a number between ${r} and ${n}, got ${e}.`)}};a();a();function Jr(t){return t.reduce((e,r)=>e===null||r===null?null:e+r,0)}function gu(t,e,r){if(typeof t=="number")return[t,r];if(typeof t=="object")return t.deserialize(e,r);throw new Vg(t)}function fn(t){return typeof t=="object"?t.description:`${t}`}function ls(t,e){if(typeof t!="number")return null;if(t===0)return 0;let r=Jr(e);return r===null?null:r*t}function yu(t,e){return typeof t=="object"?t.serialize(e):new Uint8Array}function yi(t,e={}){let r=e.size??gi();return{description:e.description??`array(${t.description}; ${fn(r)})`,fixedSize:ls(r,[t.fixedSize]),maxSize:ls(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.length!==r)throw new Ci("array",r,n.length);return et([yu(r,n.length),...n.map(i=>t.serialize(i))])},deserialize:(n,i=0)=>{let s=[];if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.push(u),i=d}return[s,i]}let[o,c]=gu(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.push(d),i=f}return[s,i]}}}a();function P_(t={}){let e=t.size??St();if(e.fixedSize===null)throw new us("Serializer [bool] requires a fixed size.");return{description:t.description??`bool(${e.description})`,fixedSize:e.fixedSize,maxSize:e.fixedSize,serialize:r=>e.serialize(r?1:0),deserialize:(r,n=0)=>{if(r.slice(n).length===0)throw new Rr("bool");let[i,s]=e.deserialize(r,n);return[i===1,s]}}}a();function ka(t={}){let e=t.size??"variable",r=t.description??`bytes(${fn(e)})`,n={description:r,fixedSize:null,maxSize:null,serialize:i=>new Uint8Array(i),deserialize:(i,s=0)=>{let o=i.slice(s);return[o,s+o.length]}};return e==="variable"?n:typeof e=="number"?lu(n,e,r):{description:r,fixedSize:null,maxSize:null,serialize:i=>{let s=n.serialize(i),o=e.serialize(s.length);return et([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Rr("bytes");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new xn("bytes",u,d.length);let[f,m]=n.deserialize(d);return s+=m,[f,s]}}}a();a();function tR(t){return t.reduce((e,r)=>e===null||r===null?null:Math.max(e,r),0)}function R_(t,e={}){let r=e.size??St(),n=t.map(([c,u])=>`${String(c)}${u?`: ${u.description}`:""}`).join(", "),s=t.every((c,u,d)=>c[1].fixedSize===d[0][1].fixedSize)?t[0][1].fixedSize:null,o=tR(t.map(([,c])=>c.maxSize));return{description:e.description??`dataEnum(${n}; ${r.description})`,fixedSize:t.length===0?r.fixedSize:Jr([r.fixedSize,s]),maxSize:t.length===0?r.maxSize:Jr([r.maxSize,o]),serialize:c=>{let u=t.findIndex(([_])=>c.__kind===_);if(u<0)throw new Fg(c.__kind,t.map(([_])=>_));let d=r.serialize(u),m=t[u][1].serialize(c);return et([d,m])},deserialize:(c,u=0)=>{if(c.slice(u).length===0)throw new Rr("dataEnum");let[d,f]=r.deserialize(c,u);u=f;let m=t[Number(d)]??null;if(!m)throw new pu(d,0,t.length-1);let[_,v]=m[1].deserialize(c,u);return u=v,[{__kind:m[0],..._??{}},u]}}}a();function O_(t,e,r={}){let n=r.size??gi();return{description:r.description??`map(${t.description}, ${e.description}; ${fn(n)})`,fixedSize:ls(n,[t.fixedSize,e.fixedSize]),maxSize:ls(n,[t.maxSize,e.maxSize]),serialize:i=>{if(typeof n=="number"&&i.size!==n)throw new Ci("map",n,i.size);let s=Array.from(i,([o,c])=>et([t.serialize(o),e.serialize(c)]));return et([yu(n,i.size),...s])},deserialize:(i,s=0)=>{let o=new Map;if(typeof n=="object"&&i.slice(s).length===0)return[o,s];if(n==="remainder"){for(;s<i.length;){let[d,f]=t.deserialize(i,s);s=f;let[m,_]=e.deserialize(i,s);s=_,o.set(d,m)}return[o,s]}let[c,u]=gu(n,i,s);s=u;for(let d=0;d<c;d+=1){let[f,m]=t.deserialize(i,s);s=m;let[_,v]=e.deserialize(i,s);s=v,o.set(f,_)}return[o,s]}}}a();function B_(t,e={}){let r=e.prefix??St(),n=e.fixed??!1,i=`; ${fn(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new us("Fixed nullables can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`nullable(${t.description+i})`,fixedSize:s,maxSize:Jr([r.maxSize,t.maxSize]),serialize:o=>{let c=r.serialize(+(o!==null));if(n){let d=t.fixedSize,f=o!==null?t.serialize(o).slice(0,d):new Uint8Array(d).fill(0);return et([c,f])}let u=o!==null?t.serialize(o):new Uint8Array;return et([c,u])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[null,c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[null,n?u:c];let[m,_]=t.deserialize(o,c);return c=_,[m,n?u:c]}}}a();function T_(t,e={}){let r=e.prefix??St(),n=e.fixed??!1,i=`; ${fn(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new us("Fixed options can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`option(${t.description+i})`,fixedSize:s,maxSize:Jr([r.maxSize,t.maxSize]),serialize:o=>{let c=l_(o)?o:d_(o),u=r.serialize(Number(uu(c)));if(n){let f=t.fixedSize,m=uu(c)?t.serialize(c.value).slice(0,f):new Uint8Array(f).fill(0);return et([u,m])}let d=uu(c)?t.serialize(c.value):new Uint8Array;return et([u,d])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[cu(),c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[cu(),n?u:c];let[m,_]=t.deserialize(o,c);return c=_,[Fd(m),n?u:c]}}}a();function mu(t={}){return{description:t.description??"publicKey",fixedSize:32,maxSize:32,serialize:e=>hu(hr(e)),deserialize:(e,r=0)=>{let n=e.slice(r,r+32);if(n.length===0)throw new Rr("publicKey");if(n.length<fu)throw new xn("publicKey",fu,n.length);return[hr(n),r+32]}}}a();function z_(t,e={}){let r=e.size??St(),n=Object.keys(t),i=Object.values(t),s=i.some(m=>typeof m=="number"),o=i.filter(m=>typeof m=="string").join(", "),c=0,u=s?i.length/2-1:i.length-1,d=s?[...n]:[...new Set([...n,...i])];function f(m){let _=typeof m=="number"&&(m<c||m>u),v=typeof m=="string"&&!d.includes(m);if(_||v)throw new Kg(m,d,c,u)}return{description:e.description??`enum(${o}; ${r.description})`,fixedSize:r.fixedSize,maxSize:r.maxSize,serialize:m=>{if(f(m),typeof m=="number")return r.serialize(m);let _=i.indexOf(m);return _>=0?r.serialize(_):r.serialize(n.indexOf(m))},deserialize:(m,_=0)=>{if(m.slice(_).length===0)throw new Rr("enum");let[v,P]=r.deserialize(m,_),B=Number(v);if(_=P,B<c||B>u)throw new pu(B,c,u);return[s?B:i[B],_]}}}a();function k_(t,e={}){let r=e.size??gi();return{description:e.description??`set(${t.description}; ${fn(r)})`,fixedSize:ls(r,[t.fixedSize]),maxSize:ls(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.size!==r)throw new Ci("set",r,n.size);let i=Array.from(n,s=>t.serialize(s));return et([yu(r,n.size),...i])},deserialize:(n,i=0)=>{let s=new Set;if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.add(u),i=d}return[s,i]}let[o,c]=gu(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.add(d),i=f}return[s,i]}}}a();function jd(t={}){let e=t.size??gi(),r=t.encoding??du,n=t.description??`string(${r.description}; ${fn(e)})`;return e==="variable"?{...r,description:n}:typeof e=="number"?lu(r,e,n):{description:n,fixedSize:null,maxSize:null,serialize:i=>{let s=r.serialize(i),o=e.serialize(s.length);return et([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Rr("string");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new xn("string",u,d.length);let[f,m]=r.deserialize(d);return s+=m,[f,s]}}}a();function ds(t,e={}){let r=t.map(([n,i])=>`${String(n)}: ${i.description}`).join(", ");return{description:e.description??`struct(${r})`,fixedSize:Jr(t.map(([,n])=>n.fixedSize)),maxSize:Jr(t.map(([,n])=>n.maxSize)),serialize:n=>{let i=t.map(([s,o])=>o.serialize(n[s]));return et(i)},deserialize:(n,i=0)=>{let s={};return t.forEach(([o,c])=>{let[u,d]=c.deserialize(n,i);i=d,s[o]=u}),[s,i]}}}a();function C_(t,e={}){let r=t.map(n=>n.description).join(", ");return{description:e.description??`tuple(${r})`,fixedSize:Jr(t.map(n=>n.fixedSize)),maxSize:Jr(t.map(n=>n.maxSize)),serialize:n=>{if(n.length!==t.length)throw new Ci("tuple",t.length,n.length);return et(t.map((i,s)=>i.serialize(n[s])))},deserialize:(n,i=0)=>{let s=[];return t.forEach(o=>{let[c,u]=o.deserialize(n,i);s.push(c),i=u}),[s,i]}}}a();function N_(t={}){return{description:t.description??"unit",fixedSize:0,maxSize:0,serialize:()=>new Uint8Array,deserialize:(e,r=0)=>[void 0,r]}}var M_=cr;a();a();a();var bu=class extends Error{name="UmiError";constructor(e,r,n,i){super(e),this.source=r,this.sourceDetails=n,this.cause=i,this.message=`${this.message}
+`)}};GP.ProgramError=HP});var U=_($=>{"use strict";a();Object.defineProperty($,"__esModule",{value:!0});var T2=Nx(),B2=yb(),dn=s2(),$P=o2(),Ue=p2(),Une=Sb(),Vne=h2(),Kne=CP(),Lb=y2(),Fne=bP(),Wne=_P(),Qc=b2(),z2=A2(),jne=vP(),k2=_2(),ZP=qP(),Hne=v2(),Gne=wP(),$ne=IP(),Zne=RP(),Xl=$h(),Yl=E2(),C2=Tb(),M2=FP(),N2=x2(),Xne=TP(),L2=P2(),Yne=zP(),Jne=sP(),Qne=fP(),eie=_s(),tie=R2(),rie=O2(),nie=As(),iie=_b(),sie=rP(),oie=uP(),XP=Eb(),aie=NP();$.Endian=dn.Endian;$.base10=dn.base10;$.base16=dn.base16;$.base58=dn.base58;$.base64=dn.base64;$.baseX=dn.baseX;$.bitArray=dn.bitArray;$.fixBytes=dn.fixBytes;$.fixSerializer=dn.fixSerializer;$.mapSerializer=dn.mapSerializer;$.mergeBytes=dn.mergeBytes;$.padBytes=dn.padBytes;$.padNullCharacters=dn.padNullCharacters;$.removeNullCharacters=dn.removeNullCharacters;$.reverseSerializer=dn.reverseSerializer;$.utf8=dn.utf8;$.ACCOUNT_HEADER_SIZE=$P.ACCOUNT_HEADER_SIZE;$.assertAccountExists=$P.assertAccountExists;$.deserializeAccount=$P.deserializeAccount;$.absoluteAmount=Ue.absoluteAmount;$.addAmounts=Ue.addAmounts;$.amountToNumber=Ue.amountToNumber;$.amountToString=Ue.amountToString;$.assertAmount=Ue.assertAmount;$.assertSameAmounts=Ue.assertSameAmounts;$.assertSolAmount=Ue.assertSolAmount;$.compareAmounts=Ue.compareAmounts;$.createAmount=Ue.createAmount;$.createAmountFromDecimals=Ue.createAmountFromDecimals;$.displayAmount=Ue.displayAmount;$.divideAmount=Ue.divideAmount;$.isAmount=Ue.isAmount;$.isEqualToAmount=Ue.isEqualToAmount;$.isGreaterThanAmount=Ue.isGreaterThanAmount;$.isGreaterThanOrEqualToAmount=Ue.isGreaterThanOrEqualToAmount;$.isLessThanAmount=Ue.isLessThanAmount;$.isLessThanOrEqualToAmount=Ue.isLessThanOrEqualToAmount;$.isNegativeAmount=Ue.isNegativeAmount;$.isPositiveAmount=Ue.isPositiveAmount;$.isSolAmount=Ue.isSolAmount;$.isZeroAmount=Ue.isZeroAmount;$.lamports=Ue.lamports;$.mapAmountSerializer=Ue.mapAmountSerializer;$.microLamports=Ue.microLamports;$.microSol=Ue.microSol;$.multiplyAmount=Ue.multiplyAmount;$.percentAmount=Ue.percentAmount;$.sameAmounts=Ue.sameAmounts;$.sol=Ue.sol;$.subtractAmounts=Ue.subtractAmounts;$.tokenAmount=Ue.tokenAmount;$.usd=Ue.usd;$.createBigInt=Une.createBigInt;$.resolveClusterFromEndpoint=Vne.resolveClusterFromEndpoint;$.createNullContext=Kne.createNullContext;$.dateTime=Lb.dateTime;$.formatDateTime=Lb.formatDateTime;$.mapDateTimeSerializer=Lb.mapDateTimeSerializer;$.now=Lb.now;$.createNullDownloader=Fne.createNullDownloader;$.createNullEddsa=Wne.createNullEddsa;$.createBrowserFileFromGenericFile=Qc.createBrowserFileFromGenericFile;$.createGenericFile=Qc.createGenericFile;$.createGenericFileFromBrowserFile=Qc.createGenericFileFromBrowserFile;$.createGenericFileFromJson=Qc.createGenericFileFromJson;$.getBytesFromGenericFiles=Qc.getBytesFromGenericFiles;$.isGenericFile=Qc.isGenericFile;$.parseJsonFromGenericFile=Qc.parseJsonFromGenericFile;$.GpaBuilder=z2.GpaBuilder;$.gpaBuilder=z2.gpaBuilder;$.createNullHttp=jne.createNullHttp;$.HttpRequestBuilder=k2.HttpRequestBuilder;$.request=k2.request;$.createSignerFromKeypair=ZP.createSignerFromKeypair;$.generateSigner=ZP.generateSigner;$.isKeypairSigner=ZP.isKeypairSigner;$.isErrorWithLogs=Hne.isErrorWithLogs;$.createNullProgramRepository=Gne.createNullProgramRepository;$.createNullRpc=$ne.createNullRpc;$.createNullSerializer=Zne.createNullSerializer;$.createNoopSigner=Xl.createNoopSigner;$.createNullSigner=Xl.createNullSigner;$.isSigner=Xl.isSigner;$.signAllTransactions=Xl.signAllTransactions;$.signTransaction=Xl.signTransaction;$.uniqueSigners=Xl.uniqueSigners;$.generatedSignerIdentity=Yl.generatedSignerIdentity;$.generatedSignerPayer=Yl.generatedSignerPayer;$.keypairIdentity=Yl.keypairIdentity;$.keypairPayer=Yl.keypairPayer;$.signerIdentity=Yl.signerIdentity;$.signerPayer=Yl.signerPayer;$.TRANSACTION_SIZE_LIMIT=C2.TRANSACTION_SIZE_LIMIT;$.addTransactionSignature=C2.addTransactionSignature;$.TransactionBuilder=M2.TransactionBuilder;$.transactionBuilder=M2.transactionBuilder;$.TransactionBuilderGroup=N2.TransactionBuilderGroup;$.transactionBuilderGroup=N2.transactionBuilderGroup;$.createNullTransactionFactory=Xne.createNullTransactionFactory;$.createBaseUmi=L2.createBaseUmi;$.createUmi=L2.createUmi;$.createNullUploader=Yne.createNullUploader;$.AccountNotFoundError=Jne.AccountNotFoundError;$.AmountMismatchError=Qne.AmountMismatchError;$.InterfaceImplementationMissingError=eie.InterfaceImplementationMissingError;$.InvalidBaseStringError=tie.InvalidBaseStringError;$.ProgramError=rie.ProgramError;$.SdkError=nie.SdkError;$.UmiError=iie.UmiError;$.UnexpectedAccountError=sie.UnexpectedAccountError;$.UnexpectedAmountError=oie.UnexpectedAmountError;$.chunk=XP.chunk;$.uniqueBy=XP.uniqueBy;$.zipMap=XP.zipMap;$.generateRandomString=aie.generateRandomString;Object.keys(T2).forEach(function(t){t!=="default"&&!$.hasOwnProperty(t)&&Object.defineProperty($,t,{enumerable:!0,get:function(){return T2[t]}})});Object.keys(B2).forEach(function(t){t!=="default"&&!$.hasOwnProperty(t)&&Object.defineProperty($,t,{enumerable:!0,get:function(){return B2[t]}})})});var N=_(Db=>{"use strict";a();Object.defineProperty(Db,"__esModule",{value:!0});var D2=Jc();Object.keys(D2).forEach(function(t){t!=="default"&&!Db.hasOwnProperty(t)&&Object.defineProperty(Db,t,{enumerable:!0,get:function(){return D2[t]}})})});var K2=_(lt=>{"use strict";a();Object.defineProperty(lt,"__esModule",{value:!0});lt.safeFetchAssetSignerFromSeeds=lt.fetchAssetSignerFromSeeds=lt.findAssetSignerPda=lt.getAssetSignerSize=lt.getAssetSignerGpaBuilder=lt.safeFetchAllAssetSigner=lt.fetchAllAssetSigner=lt.safeFetchAssetSigner=lt.fetchAssetSigner=lt.deserializeAssetSigner=lt.getAssetSignerAccountDataSerializer=void 0;var fa=U(),Yh=N();function q2(){return(0,Yh.struct)([["data",(0,Yh.bytes)()]],{description:"AssetSignerAccountData"})}lt.getAssetSignerAccountDataSerializer=q2;function Jl(t){return(0,fa.deserializeAccount)(t,q2())}lt.deserializeAssetSigner=Jl;async function U2(t,e,r){let n=await t.rpc.getAccount((0,fa.publicKey)(e,!1),r);return(0,fa.assertAccountExists)(n,"AssetSigner"),Jl(n)}lt.fetchAssetSigner=U2;async function V2(t,e,r){let n=await t.rpc.getAccount((0,fa.publicKey)(e,!1),r);return n.exists?Jl(n):null}lt.safeFetchAssetSigner=V2;async function cie(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,fa.publicKey)(i,!1)),r)).map(i=>((0,fa.assertAccountExists)(i,"AssetSigner"),Jl(i)))}lt.fetchAllAssetSigner=cie;async function uie(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,fa.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Jl(i))}lt.safeFetchAllAssetSigner=uie;function lie(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,fa.gpaBuilder)(t,e).registerFields({data:[0,(0,Yh.bytes)()]}).deserializeUsing(r=>Jl(r))}lt.getAssetSignerGpaBuilder=lie;function die(){return 0}lt.getAssetSignerSize=die;function YP(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return t.eddsa.findPda(r,[(0,Yh.string)({size:"variable"}).serialize("mpl-core-execute"),(0,Yh.publicKey)().serialize(e.asset)])}lt.findAssetSignerPda=YP;async function fie(t,e,r){return U2(t,YP(t,e),r)}lt.fetchAssetSignerFromSeeds=fie;async function pie(t,e,r){return V2(t,YP(t,e),r)}lt.safeFetchAssetSignerFromSeeds=pie});var F2=_(qb=>{"use strict";a();Object.defineProperty(qb,"__esModule",{value:!0});qb.getAddBlockerSerializer=void 0;var hie=N();function gie(){return(0,hie.struct)([],{description:"AddBlocker"})}qb.getAddBlockerSerializer=gie});var W2=_(Ub=>{"use strict";a();Object.defineProperty(Ub,"__esModule",{value:!0});Ub.getAttributeSerializer=void 0;var JP=N();function mie(){return(0,JP.struct)([["key",(0,JP.string)()],["value",(0,JP.string)()]],{description:"Attribute"})}Ub.getAttributeSerializer=mie});var H2=_(Vb=>{"use strict";a();Object.defineProperty(Vb,"__esModule",{value:!0});Vb.getAttributesSerializer=void 0;var j2=N(),yie=ce();function bie(){return(0,j2.struct)([["attributeList",(0,j2.array)((0,yie.getAttributeSerializer)())]],{description:"Attributes"})}Vb.getAttributesSerializer=bie});var $2=_(Kb=>{"use strict";a();Object.defineProperty(Kb,"__esModule",{value:!0});Kb.getAutographSerializer=void 0;var G2=N(),Aie=ce();function _ie(){return(0,G2.struct)([["signatures",(0,G2.array)((0,Aie.getAutographSignatureSerializer)())]],{description:"Autograph"})}Kb.getAutographSerializer=_ie});var Z2=_(Fb=>{"use strict";a();Object.defineProperty(Fb,"__esModule",{value:!0});Fb.getAutographSignatureSerializer=void 0;var QP=N();function Sie(){return(0,QP.struct)([["address",(0,QP.publicKey)()],["message",(0,QP.string)()]],{description:"AutographSignature"})}Fb.getAutographSignatureSerializer=Sie});var Y2=_(Wb=>{"use strict";a();Object.defineProperty(Wb,"__esModule",{value:!0});Wb.getBaseAgentIdentitySerializer=void 0;var X2=N();function vie(){return(0,X2.struct)([["uri",(0,X2.string)()]],{description:"BaseAgentIdentity"})}Wb.getBaseAgentIdentitySerializer=vie});var J2=_(jb=>{"use strict";a();Object.defineProperty(jb,"__esModule",{value:!0});jb.getBaseAgentIdentityInitInfoSerializer=void 0;var Jh=N(),eR=ce();function Eie(){return(0,Jh.struct)([["uri",(0,Jh.string)()],["initPluginAuthority",(0,Jh.option)((0,eR.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,Jh.array)((0,Jh.tuple)([(0,eR.getHookableLifecycleEventSerializer)(),(0,eR.getExternalCheckResultSerializer)()]))]],{description:"BaseAgentIdentityInitInfo"})}jb.getBaseAgentIdentityInitInfoSerializer=Eie});var eL=_(Hb=>{"use strict";a();Object.defineProperty(Hb,"__esModule",{value:!0});Hb.getBaseAgentIdentityUpdateInfoSerializer=void 0;var Ql=N(),Q2=ce();function wie(){return(0,Ql.struct)([["uri",(0,Ql.option)((0,Ql.string)())],["lifecycleChecks",(0,Ql.option)((0,Ql.array)((0,Ql.tuple)([(0,Q2.getHookableLifecycleEventSerializer)(),(0,Q2.getExternalCheckResultSerializer)()])))]],{description:"BaseAgentIdentityUpdateInfo"})}Hb.getBaseAgentIdentityUpdateInfoSerializer=wie});var rL=_(Gb=>{"use strict";a();Object.defineProperty(Gb,"__esModule",{value:!0});Gb.getBaseAppDataSerializer=void 0;var xie=N(),tL=ce();function Iie(){return(0,xie.struct)([["dataAuthority",(0,tL.getBasePluginAuthoritySerializer)()],["schema",(0,tL.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseAppData"})}Gb.getBaseAppDataSerializer=Iie});var nL=_($b=>{"use strict";a();Object.defineProperty($b,"__esModule",{value:!0});$b.getBaseAppDataInitInfoSerializer=void 0;var tR=N(),rR=ce();function Pie(){return(0,tR.struct)([["dataAuthority",(0,rR.getBasePluginAuthoritySerializer)()],["initPluginAuthority",(0,tR.option)((0,rR.getBasePluginAuthoritySerializer)())],["schema",(0,tR.option)((0,rR.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseAppDataInitInfo"})}$b.getBaseAppDataInitInfoSerializer=Pie});var sL=_(Zb=>{"use strict";a();Object.defineProperty(Zb,"__esModule",{value:!0});Zb.getBaseAppDataUpdateInfoSerializer=void 0;var iL=N(),Rie=ce();function Oie(){return(0,iL.struct)([["schema",(0,iL.option)((0,Rie.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseAppDataUpdateInfo"})}Zb.getBaseAppDataUpdateInfoSerializer=Oie});var aL=_(Xb=>{"use strict";a();Object.defineProperty(Xb,"__esModule",{value:!0});Xb.getBaseDataSectionSerializer=void 0;var Tie=N(),oL=ce();function Bie(){return(0,Tie.struct)([["parentKey",(0,oL.getBaseLinkedDataKeySerializer)()],["schema",(0,oL.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseDataSection"})}Xb.getBaseDataSectionSerializer=Bie});var uL=_(Yb=>{"use strict";a();Object.defineProperty(Yb,"__esModule",{value:!0});Yb.getBaseDataSectionInitInfoSerializer=void 0;var zie=N(),cL=ce();function kie(){return(0,zie.struct)([["parentKey",(0,cL.getBaseLinkedDataKeySerializer)()],["schema",(0,cL.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseDataSectionInitInfo"})}Yb.getBaseDataSectionInitInfoSerializer=kie});var lL=_(Jb=>{"use strict";a();Object.defineProperty(Jb,"__esModule",{value:!0});Jb.getBaseDataSectionUpdateInfoSerializer=void 0;var Cie=N();function Mie(){return(0,Cie.struct)([],{description:"BaseDataSectionUpdateInfo"})}Jb.getBaseDataSectionUpdateInfoSerializer=Mie});var dL=_(pa=>{"use strict";a();Object.defineProperty(pa,"__esModule",{value:!0});pa.isBaseExternalPluginAdapterInitInfo=pa.baseExternalPluginAdapterInitInfo=pa.getBaseExternalPluginAdapterInitInfoSerializer=void 0;var wn=N(),eu=ce();function Nie(){return(0,wn.dataEnum)([["LifecycleHook",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseLifecycleHookInitInfoSerializer)()])]])],["Oracle",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseOracleInitInfoSerializer)()])]])],["AppData",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseAppDataInitInfoSerializer)()])]])],["LinkedLifecycleHook",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseLinkedLifecycleHookInitInfoSerializer)()])]])],["LinkedAppData",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseLinkedAppDataInitInfoSerializer)()])]])],["DataSection",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseDataSectionInitInfoSerializer)()])]])],["AgentIdentity",(0,wn.struct)([["fields",(0,wn.tuple)([(0,eu.getBaseAgentIdentityInitInfoSerializer)()])]])]],{description:"BaseExternalPluginAdapterInitInfo"})}pa.getBaseExternalPluginAdapterInitInfoSerializer=Nie;function Lie(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}pa.baseExternalPluginAdapterInitInfo=Lie;function Die(t,e){return e.__kind===t}pa.isBaseExternalPluginAdapterInitInfo=Die});var fL=_(ha=>{"use strict";a();Object.defineProperty(ha,"__esModule",{value:!0});ha.isBaseExternalPluginAdapterKey=ha.baseExternalPluginAdapterKey=ha.getBaseExternalPluginAdapterKeySerializer=void 0;var Zr=N(),nR=ce();function qie(){return(0,Zr.dataEnum)([["LifecycleHook",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,Zr.publicKey)()])]])],["Oracle",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,Zr.publicKey)()])]])],["AppData",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,nR.getBasePluginAuthoritySerializer)()])]])],["LinkedLifecycleHook",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,Zr.publicKey)()])]])],["LinkedAppData",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,nR.getBasePluginAuthoritySerializer)()])]])],["DataSection",(0,Zr.struct)([["fields",(0,Zr.tuple)([(0,nR.getBaseLinkedDataKeySerializer)()])]])],["AgentIdentity",(0,Zr.unit)()]],{description:"BaseExternalPluginAdapterKey"})}ha.getBaseExternalPluginAdapterKeySerializer=qie;function Uie(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ha.baseExternalPluginAdapterKey=Uie;function Vie(t,e){return e.__kind===t}ha.isBaseExternalPluginAdapterKey=Vie});var pL=_(ga=>{"use strict";a();Object.defineProperty(ga,"__esModule",{value:!0});ga.isBaseExternalPluginAdapterUpdateInfo=ga.baseExternalPluginAdapterUpdateInfo=ga.getBaseExternalPluginAdapterUpdateInfoSerializer=void 0;var ei=N(),ed=ce();function Kie(){return(0,ei.dataEnum)([["LifecycleHook",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseLifecycleHookUpdateInfoSerializer)()])]])],["Oracle",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseOracleUpdateInfoSerializer)()])]])],["AppData",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseAppDataUpdateInfoSerializer)()])]])],["LinkedLifecycleHook",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseLinkedLifecycleHookUpdateInfoSerializer)()])]])],["LinkedAppData",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseLinkedAppDataUpdateInfoSerializer)()])]])],["AgentIdentity",(0,ei.struct)([["fields",(0,ei.tuple)([(0,ed.getBaseAgentIdentityUpdateInfoSerializer)()])]])]],{description:"BaseExternalPluginAdapterUpdateInfo"})}ga.getBaseExternalPluginAdapterUpdateInfoSerializer=Kie;function Fie(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ga.baseExternalPluginAdapterUpdateInfo=Fie;function Wie(t,e){return e.__kind===t}ga.isBaseExternalPluginAdapterUpdateInfo=Wie});var hL=_(ma=>{"use strict";a();Object.defineProperty(ma,"__esModule",{value:!0});ma.isBaseExtraAccount=ma.baseExtraAccount=ma.getBaseExtraAccountSerializer=void 0;var nt=N(),jie=ce();function Hie(){return(0,nt.dataEnum)([["PreconfiguredProgram",(0,nt.struct)([["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["PreconfiguredCollection",(0,nt.struct)([["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["PreconfiguredOwner",(0,nt.struct)([["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["PreconfiguredRecipient",(0,nt.struct)([["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["PreconfiguredAsset",(0,nt.struct)([["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["CustomPda",(0,nt.struct)([["seeds",(0,nt.array)((0,jie.getBaseSeedSerializer)())],["customProgramId",(0,nt.option)((0,nt.publicKey)())],["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])],["Address",(0,nt.struct)([["address",(0,nt.publicKey)()],["isSigner",(0,nt.bool)()],["isWritable",(0,nt.bool)()]])]],{description:"BaseExtraAccount"})}ma.getBaseExtraAccountSerializer=Hie;function Gie(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ma.baseExtraAccount=Gie;function $ie(t,e){return e.__kind===t}ma.isBaseExtraAccount=$ie});var gL=_(Qb=>{"use strict";a();Object.defineProperty(Qb,"__esModule",{value:!0});Qb.getBaseLifecycleHookSerializer=void 0;var Qh=N(),iR=ce();function Zie(){return(0,Qh.struct)([["hookedProgram",(0,Qh.publicKey)()],["extraAccounts",(0,Qh.option)((0,Qh.array)((0,iR.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,Qh.option)((0,iR.getBasePluginAuthoritySerializer)())],["schema",(0,iR.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLifecycleHook"})}Qb.getBaseLifecycleHookSerializer=Zie});var mL=_(eA=>{"use strict";a();Object.defineProperty(eA,"__esModule",{value:!0});eA.getBaseLifecycleHookInitInfoSerializer=void 0;var _o=N(),td=ce();function Xie(){return(0,_o.struct)([["hookedProgram",(0,_o.publicKey)()],["initPluginAuthority",(0,_o.option)((0,td.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,_o.array)((0,_o.tuple)([(0,td.getHookableLifecycleEventSerializer)(),(0,td.getExternalCheckResultSerializer)()]))],["extraAccounts",(0,_o.option)((0,_o.array)((0,td.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,_o.option)((0,td.getBasePluginAuthoritySerializer)())],["schema",(0,_o.option)((0,td.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLifecycleHookInitInfo"})}eA.getBaseLifecycleHookInitInfoSerializer=Xie});var yL=_(rA=>{"use strict";a();Object.defineProperty(rA,"__esModule",{value:!0});rA.getBaseLifecycleHookUpdateInfoSerializer=void 0;var tu=N(),tA=ce();function Yie(){return(0,tu.struct)([["lifecycleChecks",(0,tu.option)((0,tu.array)((0,tu.tuple)([(0,tA.getHookableLifecycleEventSerializer)(),(0,tA.getExternalCheckResultSerializer)()])))],["extraAccounts",(0,tu.option)((0,tu.array)((0,tA.getBaseExtraAccountSerializer)()))],["schema",(0,tu.option)((0,tA.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLifecycleHookUpdateInfo"})}rA.getBaseLifecycleHookUpdateInfoSerializer=Yie});var AL=_(nA=>{"use strict";a();Object.defineProperty(nA,"__esModule",{value:!0});nA.getBaseLinkedAppDataSerializer=void 0;var Jie=N(),bL=ce();function Qie(){return(0,Jie.struct)([["dataAuthority",(0,bL.getBasePluginAuthoritySerializer)()],["schema",(0,bL.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLinkedAppData"})}nA.getBaseLinkedAppDataSerializer=Qie});var _L=_(iA=>{"use strict";a();Object.defineProperty(iA,"__esModule",{value:!0});iA.getBaseLinkedAppDataInitInfoSerializer=void 0;var sR=N(),oR=ce();function ese(){return(0,sR.struct)([["dataAuthority",(0,oR.getBasePluginAuthoritySerializer)()],["initPluginAuthority",(0,sR.option)((0,oR.getBasePluginAuthoritySerializer)())],["schema",(0,sR.option)((0,oR.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedAppDataInitInfo"})}iA.getBaseLinkedAppDataInitInfoSerializer=ese});var vL=_(sA=>{"use strict";a();Object.defineProperty(sA,"__esModule",{value:!0});sA.getBaseLinkedAppDataUpdateInfoSerializer=void 0;var SL=N(),tse=ce();function rse(){return(0,SL.struct)([["schema",(0,SL.option)((0,tse.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedAppDataUpdateInfo"})}sA.getBaseLinkedAppDataUpdateInfoSerializer=rse});var EL=_(ya=>{"use strict";a();Object.defineProperty(ya,"__esModule",{value:!0});ya.isBaseLinkedDataKey=ya.baseLinkedDataKey=ya.getBaseLinkedDataKeySerializer=void 0;var rd=N(),nse=ce();function ise(){return(0,rd.dataEnum)([["LinkedLifecycleHook",(0,rd.struct)([["fields",(0,rd.tuple)([(0,rd.publicKey)()])]])],["LinkedAppData",(0,rd.struct)([["fields",(0,rd.tuple)([(0,nse.getBasePluginAuthoritySerializer)()])]])]],{description:"BaseLinkedDataKey"})}ya.getBaseLinkedDataKeySerializer=ise;function sse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ya.baseLinkedDataKey=sse;function ose(t,e){return e.__kind===t}ya.isBaseLinkedDataKey=ose});var wL=_(oA=>{"use strict";a();Object.defineProperty(oA,"__esModule",{value:!0});oA.getBaseLinkedLifecycleHookSerializer=void 0;var eg=N(),aR=ce();function ase(){return(0,eg.struct)([["hookedProgram",(0,eg.publicKey)()],["extraAccounts",(0,eg.option)((0,eg.array)((0,aR.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,eg.option)((0,aR.getBasePluginAuthoritySerializer)())],["schema",(0,aR.getExternalPluginAdapterSchemaSerializer)()]],{description:"BaseLinkedLifecycleHook"})}oA.getBaseLinkedLifecycleHookSerializer=ase});var xL=_(aA=>{"use strict";a();Object.defineProperty(aA,"__esModule",{value:!0});aA.getBaseLinkedLifecycleHookInitInfoSerializer=void 0;var So=N(),nd=ce();function cse(){return(0,So.struct)([["hookedProgram",(0,So.publicKey)()],["initPluginAuthority",(0,So.option)((0,nd.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,So.array)((0,So.tuple)([(0,nd.getHookableLifecycleEventSerializer)(),(0,nd.getExternalCheckResultSerializer)()]))],["extraAccounts",(0,So.option)((0,So.array)((0,nd.getBaseExtraAccountSerializer)()))],["dataAuthority",(0,So.option)((0,nd.getBasePluginAuthoritySerializer)())],["schema",(0,So.option)((0,nd.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedLifecycleHookInitInfo"})}aA.getBaseLinkedLifecycleHookInitInfoSerializer=cse});var IL=_(uA=>{"use strict";a();Object.defineProperty(uA,"__esModule",{value:!0});uA.getBaseLinkedLifecycleHookUpdateInfoSerializer=void 0;var ru=N(),cA=ce();function use(){return(0,ru.struct)([["lifecycleChecks",(0,ru.option)((0,ru.array)((0,ru.tuple)([(0,cA.getHookableLifecycleEventSerializer)(),(0,cA.getExternalCheckResultSerializer)()])))],["extraAccounts",(0,ru.option)((0,ru.array)((0,cA.getBaseExtraAccountSerializer)()))],["schema",(0,ru.option)((0,cA.getExternalPluginAdapterSchemaSerializer)())]],{description:"BaseLinkedLifecycleHookUpdateInfo"})}uA.getBaseLinkedLifecycleHookUpdateInfoSerializer=use});var PL=_(lA=>{"use strict";a();Object.defineProperty(lA,"__esModule",{value:!0});lA.getBaseMasterEditionSerializer=void 0;var nu=N();function lse(){return(0,nu.struct)([["maxSupply",(0,nu.option)((0,nu.u32)())],["name",(0,nu.option)((0,nu.string)())],["uri",(0,nu.option)((0,nu.string)())]],{description:"BaseMasterEdition"})}lA.getBaseMasterEditionSerializer=lse});var OL=_(dA=>{"use strict";a();Object.defineProperty(dA,"__esModule",{value:!0});dA.getBaseOracleSerializer=void 0;var cR=N(),RL=ce();function dse(){return(0,cR.struct)([["baseAddress",(0,cR.publicKey)()],["baseAddressConfig",(0,cR.option)((0,RL.getBaseExtraAccountSerializer)())],["resultsOffset",(0,RL.getBaseValidationResultsOffsetSerializer)()]],{description:"BaseOracle"})}dA.getBaseOracleSerializer=dse});var TL=_(fA=>{"use strict";a();Object.defineProperty(fA,"__esModule",{value:!0});fA.getBaseOracleInitInfoSerializer=void 0;var iu=N(),tg=ce();function fse(){return(0,iu.struct)([["baseAddress",(0,iu.publicKey)()],["initPluginAuthority",(0,iu.option)((0,tg.getBasePluginAuthoritySerializer)())],["lifecycleChecks",(0,iu.array)((0,iu.tuple)([(0,tg.getHookableLifecycleEventSerializer)(),(0,tg.getExternalCheckResultSerializer)()]))],["baseAddressConfig",(0,iu.option)((0,tg.getBaseExtraAccountSerializer)())],["resultsOffset",(0,iu.option)((0,tg.getBaseValidationResultsOffsetSerializer)())]],{description:"BaseOracleInitInfo"})}fA.getBaseOracleInitInfoSerializer=fse});var BL=_(hA=>{"use strict";a();Object.defineProperty(hA,"__esModule",{value:!0});hA.getBaseOracleUpdateInfoSerializer=void 0;var id=N(),pA=ce();function pse(){return(0,id.struct)([["lifecycleChecks",(0,id.option)((0,id.array)((0,id.tuple)([(0,pA.getHookableLifecycleEventSerializer)(),(0,pA.getExternalCheckResultSerializer)()])))],["baseAddressConfig",(0,id.option)((0,pA.getBaseExtraAccountSerializer)())],["resultsOffset",(0,id.option)((0,pA.getBaseValidationResultsOffsetSerializer)())]],{description:"BaseOracleUpdateInfo"})}hA.getBaseOracleUpdateInfoSerializer=pse});var zL=_(ba=>{"use strict";a();Object.defineProperty(ba,"__esModule",{value:!0});ba.isBasePluginAuthority=ba.basePluginAuthority=ba.getBasePluginAuthoritySerializer=void 0;var sd=N();function hse(){return(0,sd.dataEnum)([["None",(0,sd.unit)()],["Owner",(0,sd.unit)()],["UpdateAuthority",(0,sd.unit)()],["Address",(0,sd.struct)([["address",(0,sd.publicKey)()]])]],{description:"BasePluginAuthority"})}ba.getBasePluginAuthoritySerializer=hse;function gse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}ba.basePluginAuthority=gse;function mse(t,e){return e.__kind===t}ba.isBasePluginAuthority=mse});var CL=_(gA=>{"use strict";a();Object.defineProperty(gA,"__esModule",{value:!0});gA.getBaseRoyaltiesSerializer=void 0;var uR=N(),kL=ce();function yse(){return(0,uR.struct)([["basisPoints",(0,uR.u16)()],["creators",(0,uR.array)((0,kL.getCreatorSerializer)())],["ruleSet",(0,kL.getBaseRuleSetSerializer)()]],{description:"BaseRoyalties"})}gA.getBaseRoyaltiesSerializer=yse});var ML=_(Aa=>{"use strict";a();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.isBaseRuleSet=Aa.baseRuleSet=Aa.getBaseRuleSetSerializer=void 0;var Ss=N();function bse(){return(0,Ss.dataEnum)([["None",(0,Ss.unit)()],["ProgramAllowList",(0,Ss.struct)([["fields",(0,Ss.tuple)([(0,Ss.array)((0,Ss.publicKey)())])]])],["ProgramDenyList",(0,Ss.struct)([["fields",(0,Ss.tuple)([(0,Ss.array)((0,Ss.publicKey)())])]])]],{description:"BaseRuleSet"})}Aa.getBaseRuleSetSerializer=bse;function Ase(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Aa.baseRuleSet=Ase;function _se(t,e){return e.__kind===t}Aa.isBaseRuleSet=_se});var NL=_(_a=>{"use strict";a();Object.defineProperty(_a,"__esModule",{value:!0});_a.isBaseSeed=_a.baseSeed=_a.getBaseSeedSerializer=void 0;var pi=N();function Sse(){return(0,pi.dataEnum)([["Collection",(0,pi.unit)()],["Owner",(0,pi.unit)()],["Recipient",(0,pi.unit)()],["Asset",(0,pi.unit)()],["Address",(0,pi.struct)([["fields",(0,pi.tuple)([(0,pi.publicKey)()])]])],["Bytes",(0,pi.struct)([["fields",(0,pi.tuple)([(0,pi.bytes)({size:(0,pi.u32)()})])]])]],{description:"BaseSeed"})}_a.getBaseSeedSerializer=Sse;function vse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}_a.baseSeed=vse;function Ese(t,e){return e.__kind===t}_a.isBaseSeed=Ese});var LL=_(va=>{"use strict";a();Object.defineProperty(va,"__esModule",{value:!0});va.isBaseUpdateAuthority=va.baseUpdateAuthority=va.getBaseUpdateAuthoritySerializer=void 0;var Sa=N();function wse(){return(0,Sa.dataEnum)([["None",(0,Sa.unit)()],["Address",(0,Sa.struct)([["fields",(0,Sa.tuple)([(0,Sa.publicKey)()])]])],["Collection",(0,Sa.struct)([["fields",(0,Sa.tuple)([(0,Sa.publicKey)()])]])]],{description:"BaseUpdateAuthority"})}va.getBaseUpdateAuthoritySerializer=wse;function xse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}va.baseUpdateAuthority=xse;function Ise(t,e){return e.__kind===t}va.isBaseUpdateAuthority=Ise});var DL=_(Ea=>{"use strict";a();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.isBaseValidationResultsOffset=Ea.baseValidationResultsOffset=Ea.getBaseValidationResultsOffsetSerializer=void 0;var od=N();function Pse(){return(0,od.dataEnum)([["NoOffset",(0,od.unit)()],["Anchor",(0,od.unit)()],["Custom",(0,od.struct)([["fields",(0,od.tuple)([(0,od.u64)()])]])]],{description:"BaseValidationResultsOffset"})}Ea.getBaseValidationResultsOffsetSerializer=Pse;function Rse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Ea.baseValidationResultsOffset=Rse;function Ose(t,e){return e.__kind===t}Ea.isBaseValidationResultsOffset=Ose});var qL=_(mA=>{"use strict";a();Object.defineProperty(mA,"__esModule",{value:!0});mA.getBubblegumV2Serializer=void 0;var Tse=N();function Bse(){return(0,Tse.struct)([],{description:"BubblegumV2"})}mA.getBubblegumV2Serializer=Bse});var UL=_(yA=>{"use strict";a();Object.defineProperty(yA,"__esModule",{value:!0});yA.getBurnDelegateSerializer=void 0;var zse=N();function kse(){return(0,zse.struct)([],{description:"BurnDelegate"})}yA.getBurnDelegateSerializer=kse});var KL=_(bA=>{"use strict";a();Object.defineProperty(bA,"__esModule",{value:!0});bA.getCompressionProofSerializer=void 0;var ad=N(),VL=ce();function Cse(){return(0,ad.struct)([["owner",(0,ad.publicKey)()],["updateAuthority",(0,VL.getBaseUpdateAuthoritySerializer)()],["name",(0,ad.string)()],["uri",(0,ad.string)()],["seq",(0,ad.u64)()],["plugins",(0,ad.array)((0,VL.getHashablePluginSchemaSerializer)())]],{description:"CompressionProof"})}bA.getCompressionProofSerializer=Cse});var FL=_(AA=>{"use strict";a();Object.defineProperty(AA,"__esModule",{value:!0});AA.getCreatorSerializer=void 0;var lR=N();function Mse(){return(0,lR.struct)([["address",(0,lR.publicKey)()],["percentage",(0,lR.u8)()]],{description:"Creator"})}AA.getCreatorSerializer=Mse});var jL=_(su=>{"use strict";a();Object.defineProperty(su,"__esModule",{value:!0});su.getDataStateSerializer=su.DataState=void 0;var Nse=N(),WL;(function(t){t[t.AccountState=0]="AccountState",t[t.LedgerState=1]="LedgerState"})(WL=su.DataState||(su.DataState={}));function Lse(){return(0,Nse.scalarEnum)(WL,{description:"DataState"})}su.getDataStateSerializer=Lse});var GL=_(_A=>{"use strict";a();Object.defineProperty(_A,"__esModule",{value:!0});_A.getEditionSerializer=void 0;var HL=N();function Dse(){return(0,HL.struct)([["number",(0,HL.u32)()]],{description:"Edition"})}_A.getEditionSerializer=Dse});var ZL=_(SA=>{"use strict";a();Object.defineProperty(SA,"__esModule",{value:!0});SA.getExternalCheckResultSerializer=void 0;var $L=N();function qse(){return(0,$L.struct)([["flags",(0,$L.u32)()]],{description:"ExternalCheckResult"})}SA.getExternalCheckResultSerializer=qse});var XL=_(wa=>{"use strict";a();Object.defineProperty(wa,"__esModule",{value:!0});wa.isExternalPluginAdapter=wa.externalPluginAdapter=wa.getExternalPluginAdapterSerializer=void 0;var xn=N(),ou=ce();function Use(){return(0,xn.dataEnum)([["LifecycleHook",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseLifecycleHookSerializer)()])]])],["Oracle",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseOracleSerializer)()])]])],["AppData",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseAppDataSerializer)()])]])],["LinkedLifecycleHook",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseLinkedLifecycleHookSerializer)()])]])],["LinkedAppData",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseLinkedAppDataSerializer)()])]])],["DataSection",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseDataSectionSerializer)()])]])],["AgentIdentity",(0,xn.struct)([["fields",(0,xn.tuple)([(0,ou.getBaseAgentIdentitySerializer)()])]])]],{description:"ExternalPluginAdapter"})}wa.getExternalPluginAdapterSerializer=Use;function Vse(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}wa.externalPluginAdapter=Vse;function Kse(t,e){return e.__kind===t}wa.isExternalPluginAdapter=Kse});var JL=_(au=>{"use strict";a();Object.defineProperty(au,"__esModule",{value:!0});au.getExternalPluginAdapterSchemaSerializer=au.ExternalPluginAdapterSchema=void 0;var Fse=N(),YL;(function(t){t[t.Binary=0]="Binary",t[t.Json=1]="Json",t[t.MsgPack=2]="MsgPack"})(YL=au.ExternalPluginAdapterSchema||(au.ExternalPluginAdapterSchema={}));function Wse(){return(0,Fse.scalarEnum)(YL,{description:"ExternalPluginAdapterSchema"})}au.getExternalPluginAdapterSchemaSerializer=Wse});var eD=_(cu=>{"use strict";a();Object.defineProperty(cu,"__esModule",{value:!0});cu.getExternalPluginAdapterTypeSerializer=cu.ExternalPluginAdapterType=void 0;var jse=N(),QL;(function(t){t[t.LifecycleHook=0]="LifecycleHook",t[t.Oracle=1]="Oracle",t[t.AppData=2]="AppData",t[t.LinkedLifecycleHook=3]="LinkedLifecycleHook",t[t.LinkedAppData=4]="LinkedAppData",t[t.DataSection=5]="DataSection",t[t.AgentIdentity=6]="AgentIdentity"})(QL=cu.ExternalPluginAdapterType||(cu.ExternalPluginAdapterType={}));function Hse(){return(0,jse.scalarEnum)(QL,{description:"ExternalPluginAdapterType"})}cu.getExternalPluginAdapterTypeSerializer=Hse});var tD=_(EA=>{"use strict";a();Object.defineProperty(EA,"__esModule",{value:!0});EA.getExternalRegistryRecordSerializer=void 0;var vo=N(),vA=ce();function Gse(){return(0,vo.struct)([["pluginType",(0,vA.getExternalPluginAdapterTypeSerializer)()],["authority",(0,vA.getBasePluginAuthoritySerializer)()],["lifecycleChecks",(0,vo.option)((0,vo.array)((0,vo.tuple)([(0,vA.getHookableLifecycleEventSerializer)(),(0,vA.getExternalCheckResultSerializer)()])))],["offset",(0,vo.u64)()],["dataOffset",(0,vo.option)((0,vo.u64)())],["dataLen",(0,vo.option)((0,vo.u64)())]],{description:"ExternalRegistryRecord"})}EA.getExternalRegistryRecordSerializer=Gse});var nD=_(uu=>{"use strict";a();Object.defineProperty(uu,"__esModule",{value:!0});uu.getExternalValidationResultSerializer=uu.ExternalValidationResult=void 0;var $se=N(),rD;(function(t){t[t.Approved=0]="Approved",t[t.Rejected=1]="Rejected",t[t.Pass=2]="Pass"})(rD=uu.ExternalValidationResult||(uu.ExternalValidationResult={}));function Zse(){return(0,$se.scalarEnum)(rD,{description:"ExternalValidationResult"})}uu.getExternalValidationResultSerializer=Zse});var sD=_(wA=>{"use strict";a();Object.defineProperty(wA,"__esModule",{value:!0});wA.getFreezeDelegateSerializer=void 0;var iD=N();function Xse(){return(0,iD.struct)([["frozen",(0,iD.bool)()]],{description:"FreezeDelegate"})}wA.getFreezeDelegateSerializer=Xse});var aD=_(xA=>{"use strict";a();Object.defineProperty(xA,"__esModule",{value:!0});xA.getFreezeExecuteSerializer=void 0;var oD=N();function Yse(){return(0,oD.struct)([["frozen",(0,oD.bool)()]],{description:"FreezeExecute"})}xA.getFreezeExecuteSerializer=Yse});var cD=_(IA=>{"use strict";a();Object.defineProperty(IA,"__esModule",{value:!0});IA.getGroupsSerializer=void 0;var dR=N();function Jse(){return(0,dR.struct)([["groups",(0,dR.array)((0,dR.publicKey)())]],{description:"Groups"})}IA.getGroupsSerializer=Jse});var dD=_(PA=>{"use strict";a();Object.defineProperty(PA,"__esModule",{value:!0});PA.getHashablePluginSchemaSerializer=void 0;var uD=N(),lD=ce();function Qse(){return(0,uD.struct)([["index",(0,uD.u64)()],["authority",(0,lD.getBasePluginAuthoritySerializer)()],["plugin",(0,lD.getPluginSerializer)()]],{description:"HashablePluginSchema"})}PA.getHashablePluginSchemaSerializer=Qse});var fD=_(OA=>{"use strict";a();Object.defineProperty(OA,"__esModule",{value:!0});OA.getHashedAssetSchemaSerializer=void 0;var RA=N();function eoe(){return(0,RA.struct)([["assetHash",(0,RA.bytes)({size:32})],["pluginHashes",(0,RA.array)((0,RA.bytes)({size:32}))]],{description:"HashedAssetSchema"})}OA.getHashedAssetSchemaSerializer=eoe});var hD=_(lu=>{"use strict";a();Object.defineProperty(lu,"__esModule",{value:!0});lu.getHookableLifecycleEventSerializer=lu.HookableLifecycleEvent=void 0;var toe=N(),pD;(function(t){t[t.Create=0]="Create",t[t.Transfer=1]="Transfer",t[t.Burn=2]="Burn",t[t.Update=3]="Update",t[t.Execute=4]="Execute"})(pD=lu.HookableLifecycleEvent||(lu.HookableLifecycleEvent={}));function roe(){return(0,toe.scalarEnum)(pD,{description:"HookableLifecycleEvent"})}lu.getHookableLifecycleEventSerializer=roe});var gD=_(TA=>{"use strict";a();Object.defineProperty(TA,"__esModule",{value:!0});TA.getImmutableMetadataSerializer=void 0;var noe=N();function ioe(){return(0,noe.struct)([],{description:"ImmutableMetadata"})}TA.getImmutableMetadataSerializer=ioe});var yD=_(du=>{"use strict";a();Object.defineProperty(du,"__esModule",{value:!0});du.getKeySerializer=du.Key=void 0;var soe=N(),mD;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AssetV1=1]="AssetV1",t[t.HashedAssetV1=2]="HashedAssetV1",t[t.PluginHeaderV1=3]="PluginHeaderV1",t[t.PluginRegistryV1=4]="PluginRegistryV1",t[t.CollectionV1=5]="CollectionV1",t[t.GroupV1=6]="GroupV1"})(mD=du.Key||(du.Key={}));function ooe(){return(0,soe.scalarEnum)(mD,{description:"Key"})}du.getKeySerializer=ooe});var bD=_(xa=>{"use strict";a();Object.defineProperty(xa,"__esModule",{value:!0});xa.isOracleValidation=xa.oracleValidation=xa.getOracleValidationSerializer=void 0;var fR=N(),BA=ce();function aoe(){return(0,fR.dataEnum)([["Uninitialized",(0,fR.unit)()],["V1",(0,fR.struct)([["create",(0,BA.getExternalValidationResultSerializer)()],["transfer",(0,BA.getExternalValidationResultSerializer)()],["burn",(0,BA.getExternalValidationResultSerializer)()],["update",(0,BA.getExternalValidationResultSerializer)()]])]],{description:"OracleValidation"})}xa.getOracleValidationSerializer=aoe;function coe(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}xa.oracleValidation=coe;function uoe(t,e){return e.__kind===t}xa.isOracleValidation=uoe});var AD=_(zA=>{"use strict";a();Object.defineProperty(zA,"__esModule",{value:!0});zA.getPermanentBurnDelegateSerializer=void 0;var loe=N();function doe(){return(0,loe.struct)([],{description:"PermanentBurnDelegate"})}zA.getPermanentBurnDelegateSerializer=doe});var SD=_(kA=>{"use strict";a();Object.defineProperty(kA,"__esModule",{value:!0});kA.getPermanentFreezeDelegateSerializer=void 0;var _D=N();function foe(){return(0,_D.struct)([["frozen",(0,_D.bool)()]],{description:"PermanentFreezeDelegate"})}kA.getPermanentFreezeDelegateSerializer=foe});var ED=_(CA=>{"use strict";a();Object.defineProperty(CA,"__esModule",{value:!0});CA.getPermanentFreezeExecuteSerializer=void 0;var vD=N();function poe(){return(0,vD.struct)([["frozen",(0,vD.bool)()]],{description:"PermanentFreezeExecute"})}CA.getPermanentFreezeExecuteSerializer=poe});var wD=_(MA=>{"use strict";a();Object.defineProperty(MA,"__esModule",{value:!0});MA.getPermanentTransferDelegateSerializer=void 0;var hoe=N();function goe(){return(0,hoe.struct)([],{description:"PermanentTransferDelegate"})}MA.getPermanentTransferDelegateSerializer=goe});var xD=_(Ia=>{"use strict";a();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.isPlugin=Ia.plugin=Ia.getPluginSerializer=void 0;var Ce=N(),vr=ce();function moe(){return(0,Ce.dataEnum)([["Royalties",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getBaseRoyaltiesSerializer)()])]])],["FreezeDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getFreezeDelegateSerializer)()])]])],["BurnDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getBurnDelegateSerializer)()])]])],["TransferDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getTransferDelegateSerializer)()])]])],["UpdateDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getUpdateDelegateSerializer)()])]])],["PermanentFreezeDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getPermanentFreezeDelegateSerializer)()])]])],["Attributes",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getAttributesSerializer)()])]])],["PermanentTransferDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getPermanentTransferDelegateSerializer)()])]])],["PermanentBurnDelegate",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getPermanentBurnDelegateSerializer)()])]])],["Edition",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getEditionSerializer)()])]])],["MasterEdition",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getBaseMasterEditionSerializer)()])]])],["AddBlocker",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getAddBlockerSerializer)()])]])],["ImmutableMetadata",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getImmutableMetadataSerializer)()])]])],["VerifiedCreators",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getVerifiedCreatorsSerializer)()])]])],["Autograph",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getAutographSerializer)()])]])],["BubblegumV2",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getBubblegumV2Serializer)()])]])],["FreezeExecute",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getFreezeExecuteSerializer)()])]])],["PermanentFreezeExecute",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getPermanentFreezeExecuteSerializer)()])]])],["Groups",(0,Ce.struct)([["fields",(0,Ce.tuple)([(0,vr.getGroupsSerializer)()])]])]],{description:"Plugin"})}Ia.getPluginSerializer=moe;function yoe(t,e){return Array.isArray(e)?{__kind:t,fields:e}:{__kind:t,...e??{}}}Ia.plugin=yoe;function boe(t,e){return e.__kind===t}Ia.isPlugin=boe});var RD=_(NA=>{"use strict";a();Object.defineProperty(NA,"__esModule",{value:!0});NA.getPluginAuthorityPairSerializer=void 0;var ID=N(),PD=ce();function Aoe(){return(0,ID.struct)([["plugin",(0,PD.getPluginSerializer)()],["authority",(0,ID.option)((0,PD.getBasePluginAuthoritySerializer)())]],{description:"PluginAuthorityPair"})}NA.getPluginAuthorityPairSerializer=Aoe});var TD=_(fu=>{"use strict";a();Object.defineProperty(fu,"__esModule",{value:!0});fu.getPluginTypeSerializer=fu.PluginType=void 0;var _oe=N(),OD;(function(t){t[t.Royalties=0]="Royalties",t[t.FreezeDelegate=1]="FreezeDelegate",t[t.BurnDelegate=2]="BurnDelegate",t[t.TransferDelegate=3]="TransferDelegate",t[t.UpdateDelegate=4]="UpdateDelegate",t[t.PermanentFreezeDelegate=5]="PermanentFreezeDelegate",t[t.Attributes=6]="Attributes",t[t.PermanentTransferDelegate=7]="PermanentTransferDelegate",t[t.PermanentBurnDelegate=8]="PermanentBurnDelegate",t[t.Edition=9]="Edition",t[t.MasterEdition=10]="MasterEdition",t[t.AddBlocker=11]="AddBlocker",t[t.ImmutableMetadata=12]="ImmutableMetadata",t[t.VerifiedCreators=13]="VerifiedCreators",t[t.Autograph=14]="Autograph",t[t.BubblegumV2=15]="BubblegumV2",t[t.FreezeExecute=16]="FreezeExecute",t[t.PermanentFreezeExecute=17]="PermanentFreezeExecute",t[t.Groups=18]="Groups"})(OD=fu.PluginType||(fu.PluginType={}));function Soe(){return(0,_oe.scalarEnum)(OD,{description:"PluginType"})}fu.getPluginTypeSerializer=Soe});var kD=_(LA=>{"use strict";a();Object.defineProperty(LA,"__esModule",{value:!0});LA.getRegistryRecordSerializer=void 0;var BD=N(),zD=ce();function voe(){return(0,BD.struct)([["pluginType",(0,zD.getPluginTypeSerializer)()],["authority",(0,zD.getBasePluginAuthoritySerializer)()],["offset",(0,BD.u64)()]],{description:"RegistryRecord"})}LA.getRegistryRecordSerializer=voe});var MD=_(DA=>{"use strict";a();Object.defineProperty(DA,"__esModule",{value:!0});DA.getRelationshipEntrySerializer=void 0;var CD=N(),Eoe=ce();function woe(){return(0,CD.struct)([["kind",(0,Eoe.getRelationshipKindSerializer)()],["key",(0,CD.publicKey)()]],{description:"RelationshipEntry"})}DA.getRelationshipEntrySerializer=woe});var LD=_(pu=>{"use strict";a();Object.defineProperty(pu,"__esModule",{value:!0});pu.getRelationshipKindSerializer=pu.RelationshipKind=void 0;var xoe=N(),ND;(function(t){t[t.Collection=0]="Collection",t[t.ChildGroup=1]="ChildGroup",t[t.ParentGroup=2]="ParentGroup",t[t.Asset=3]="Asset"})(ND=pu.RelationshipKind||(pu.RelationshipKind={}));function Ioe(){return(0,xoe.scalarEnum)(ND,{description:"RelationshipKind"})}pu.getRelationshipKindSerializer=Ioe});var DD=_(qA=>{"use strict";a();Object.defineProperty(qA,"__esModule",{value:!0});qA.getTransferDelegateSerializer=void 0;var Poe=N();function Roe(){return(0,Poe.struct)([],{description:"TransferDelegate"})}qA.getTransferDelegateSerializer=Roe});var qD=_(UA=>{"use strict";a();Object.defineProperty(UA,"__esModule",{value:!0});UA.getUpdateDelegateSerializer=void 0;var pR=N();function Ooe(){return(0,pR.struct)([["additionalDelegates",(0,pR.array)((0,pR.publicKey)())]],{description:"UpdateDelegate"})}UA.getUpdateDelegateSerializer=Ooe});var VD=_(hu=>{"use strict";a();Object.defineProperty(hu,"__esModule",{value:!0});hu.getUpdateTypeSerializer=hu.UpdateType=void 0;var Toe=N(),UD;(function(t){t[t.Mint=0]="Mint",t[t.Add=1]="Add",t[t.Remove=2]="Remove"})(UD=hu.UpdateType||(hu.UpdateType={}));function Boe(){return(0,Toe.scalarEnum)(UD,{description:"UpdateType"})}hu.getUpdateTypeSerializer=Boe});var FD=_(gu=>{"use strict";a();Object.defineProperty(gu,"__esModule",{value:!0});gu.getValidationResultSerializer=gu.ValidationResult=void 0;var zoe=N(),KD;(function(t){t[t.Approved=0]="Approved",t[t.Rejected=1]="Rejected",t[t.Pass=2]="Pass",t[t.ForceApproved=3]="ForceApproved"})(KD=gu.ValidationResult||(gu.ValidationResult={}));function koe(){return(0,zoe.scalarEnum)(KD,{description:"ValidationResult"})}gu.getValidationResultSerializer=koe});var jD=_(VA=>{"use strict";a();Object.defineProperty(VA,"__esModule",{value:!0});VA.getVerifiedCreatorsSerializer=void 0;var WD=N(),Coe=ce();function Moe(){return(0,WD.struct)([["signatures",(0,WD.array)((0,Coe.getVerifiedCreatorsSignatureSerializer)())]],{description:"VerifiedCreators"})}VA.getVerifiedCreatorsSerializer=Moe});var HD=_(KA=>{"use strict";a();Object.defineProperty(KA,"__esModule",{value:!0});KA.getVerifiedCreatorsSignatureSerializer=void 0;var hR=N();function Noe(){return(0,hR.struct)([["address",(0,hR.publicKey)()],["verified",(0,hR.bool)()]],{description:"VerifiedCreatorsSignature"})}KA.getVerifiedCreatorsSignatureSerializer=Noe});var ce=_(oe=>{"use strict";a();var Loe=oe&&oe.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),de=oe&&oe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Loe(e,t,r)};Object.defineProperty(oe,"__esModule",{value:!0});de(F2(),oe);de(W2(),oe);de(H2(),oe);de($2(),oe);de(Z2(),oe);de(Y2(),oe);de(J2(),oe);de(eL(),oe);de(rL(),oe);de(nL(),oe);de(sL(),oe);de(aL(),oe);de(uL(),oe);de(lL(),oe);de(dL(),oe);de(fL(),oe);de(pL(),oe);de(hL(),oe);de(gL(),oe);de(mL(),oe);de(yL(),oe);de(AL(),oe);de(_L(),oe);de(vL(),oe);de(EL(),oe);de(wL(),oe);de(xL(),oe);de(IL(),oe);de(PL(),oe);de(OL(),oe);de(TL(),oe);de(BL(),oe);de(zL(),oe);de(CL(),oe);de(ML(),oe);de(NL(),oe);de(LL(),oe);de(DL(),oe);de(qL(),oe);de(UL(),oe);de(KL(),oe);de(FL(),oe);de(jL(),oe);de(GL(),oe);de(ZL(),oe);de(XL(),oe);de(JL(),oe);de(eD(),oe);de(tD(),oe);de(nD(),oe);de(sD(),oe);de(aD(),oe);de(cD(),oe);de(dD(),oe);de(fD(),oe);de(hD(),oe);de(gD(),oe);de(yD(),oe);de(bD(),oe);de(AD(),oe);de(SD(),oe);de(ED(),oe);de(wD(),oe);de(xD(),oe);de(RD(),oe);de(TD(),oe);de(kD(),oe);de(MD(),oe);de(LD(),oe);de(DD(),oe);de(qD(),oe);de(VD(),oe);de(FD(),oe);de(jD(),oe);de(HD(),oe)});var $D=_(FA=>{"use strict";a();Object.defineProperty(FA,"__esModule",{value:!0});FA.getAssetV1AccountDataSerializer=void 0;var cd=N(),GD=ce();function Doe(){return(0,cd.struct)([["key",(0,GD.getKeySerializer)()],["owner",(0,cd.publicKey)()],["updateAuthority",(0,GD.getBaseUpdateAuthoritySerializer)()],["name",(0,cd.string)()],["uri",(0,cd.string)()],["seq",(0,cd.option)((0,cd.u64)())]],{description:"AssetV1AccountData"})}FA.getAssetV1AccountDataSerializer=Doe});var gR=_(Pa=>{"use strict";a();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.royaltiesFromBase=Pa.royaltiesToBase=Pa.ruleSetToBase=void 0;function ZD(t){if(t.__kind)return t;let r=t;return r.type==="ProgramAllowList"||r.type==="ProgramDenyList"?{__kind:r.type,fields:[r.addresses]}:{__kind:r.type}}Pa.ruleSetToBase=ZD;function qoe(t){return{...t,ruleSet:ZD(t.ruleSet)}}Pa.royaltiesToBase=qoe;function Uoe(t){let e;return t.ruleSet.__kind==="ProgramAllowList"?e={...t.ruleSet,type:"ProgramAllowList",addresses:t.ruleSet.fields[0]}:t.ruleSet.__kind==="ProgramDenyList"?e={...t.ruleSet,type:"ProgramDenyList",addresses:t.ruleSet.fields[0]}:e={...t.ruleSet,type:t.ruleSet.__kind},{...t,ruleSet:e}}Pa.royaltiesFromBase=Uoe});var WA=_(Eo=>{"use strict";a();Object.defineProperty(Eo,"__esModule",{value:!0});Eo.utf8Count=Voe;Eo.utf8EncodeJs=XD;Eo.utf8EncodeTE=YD;Eo.utf8Encode=Woe;Eo.utf8DecodeJs=JD;Eo.utf8DecodeTD=QD;Eo.utf8Decode=$oe;function Voe(t){let e=t.length,r=0,n=0;for(;n<e;){let i=t.charCodeAt(n++);if((i&4294967168)===0){r++;continue}else if((i&4294965248)===0)r+=2;else{if(i>=55296&&i<=56319&&n<e){let s=t.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?r+=3:r+=4}}return r}function XD(t,e,r){let n=t.length,i=r,s=0;for(;s<n;){let o=t.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){let c=t.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}var Koe=new TextEncoder,Foe=50;function YD(t,e,r){Koe.encodeInto(t,e.subarray(r))}function Woe(t,e,r){t.length>Foe?YD(t,e,r):XD(t,e,r)}var joe=4096;function JD(t,e,r){let n=e,i=n+r,s=[],o="";for(;n<i;){let c=t[n++];if((c&128)===0)s.push(c);else if((c&224)===192){let u=t[n++]&63;s.push((c&31)<<6|u)}else if((c&240)===224){let u=t[n++]&63,d=t[n++]&63;s.push((c&31)<<12|u<<6|d)}else if((c&248)===240){let u=t[n++]&63,d=t[n++]&63,f=t[n++]&63,m=(c&7)<<18|u<<12|d<<6|f;m>65535&&(m-=65536,s.push(m>>>10&1023|55296),m=56320|m&1023),s.push(m)}else s.push(c);s.length>=joe&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}var Hoe=new TextDecoder,Goe=200;function QD(t,e,r){let n=t.subarray(e,e+r);return Hoe.decode(n)}function $oe(t,e,r){return r>Goe?QD(t,e,r):JD(t,e,r)}});var yR=_(jA=>{"use strict";a();Object.defineProperty(jA,"__esModule",{value:!0});jA.ExtData=void 0;var mR=class{type;data;constructor(e,r){this.type=e,this.data=r}};jA.ExtData=mR});var GA=_(HA=>{"use strict";a();Object.defineProperty(HA,"__esModule",{value:!0});HA.DecodeError=void 0;var bR=class t extends Error{constructor(e){super(e);let r=Object.create(t.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:t.name})}};HA.DecodeError=bR});var $A=_(Ra=>{"use strict";a();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.UINT32_MAX=void 0;Ra.setUint64=Zoe;Ra.setInt64=Xoe;Ra.getInt64=Yoe;Ra.getUint64=Joe;Ra.UINT32_MAX=4294967295;function Zoe(t,e,r){let n=r/4294967296,i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function Xoe(t,e,r){let n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function Yoe(t,e){let r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function Joe(t,e){let r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}});var AR=_(hi=>{"use strict";a();Object.defineProperty(hi,"__esModule",{value:!0});hi.timestampExtension=hi.EXT_TIMESTAMP=void 0;hi.encodeTimeSpecToTimestamp=t8;hi.encodeDateToTimeSpec=r8;hi.encodeTimestampExtension=n8;hi.decodeTimestampToTimeSpec=i8;hi.decodeTimestampExtension=s8;var Qoe=GA(),e8=$A();hi.EXT_TIMESTAMP=-1;var eae=4294967296-1,tae=17179869184-1;function t8({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=tae)if(e===0&&t<=eae){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{let r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|r&3),s.setUint32(4,n),i}else{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),(0,e8.setInt64)(n,4,t),r}}function r8(t){let e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function n8(t){if(t instanceof Date){let e=r8(t);return t8(e)}else return null}function i8(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,s=r>>>2;return{sec:i,nsec:s}}case 12:{let r=(0,e8.getInt64)(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new Qoe.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function s8(t){let e=i8(t);return new Date(e.sec*1e3+e.nsec/1e6)}hi.timestampExtension={type:hi.EXT_TIMESTAMP,encode:n8,decode:s8}});var YA=_(XA=>{"use strict";a();Object.defineProperty(XA,"__esModule",{value:!0});XA.ExtensionCodec=void 0;var ZA=yR(),rae=AR(),_R=class t{static defaultCodec=new t;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(rae.timestampExtension)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{let i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){let i=this.builtInEncoders[n];if(i!=null){let s=i(e,r);if(s!=null){let o=-1-n;return new ZA.ExtData(o,s)}}}for(let n=0;n<this.encoders.length;n++){let i=this.encoders[n];if(i!=null){let s=i(e,r);if(s!=null){let o=n;return new ZA.ExtData(o,s)}}}return e instanceof ZA.ExtData?e:null}decode(e,r,n){let i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new ZA.ExtData(r,e)}};XA.ExtensionCodec=_R});var vR=_(SR=>{"use strict";a();Object.defineProperty(SR,"__esModule",{value:!0});SR.ensureUint8Array=iae;function nae(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function iae(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):nae(t)?new Uint8Array(t):Uint8Array.from(t)}});var wR=_(vs=>{"use strict";a();Object.defineProperty(vs,"__esModule",{value:!0});vs.Encoder=vs.DEFAULT_INITIAL_BUFFER_SIZE=vs.DEFAULT_MAX_DEPTH=void 0;var o8=WA(),sae=YA(),a8=$A(),oae=vR();vs.DEFAULT_MAX_DEPTH=100;vs.DEFAULT_INITIAL_BUFFER_SIZE=2048;var ER=class t{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??sae.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??vs.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??vs.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new t({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,r)}ensureBufferSizeToWrite(e){let r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){let r=new ArrayBuffer(e),n=new Uint8Array(r),i=new DataView(r);n.set(this.bytes),this.view=i,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let n=(0,o8.utf8Count)(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),(0,o8.utf8Encode)(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,r){let n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);let n=(0,oae.ensureUint8Array)(e);this.writeU8a(n)}encodeArray(e,r){let n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(let i of e)this.doEncode(i,r+1)}countWithoutUndefined(e,r){let n=0;for(let i of r)e[i]!==void 0&&n++;return n}encodeMap(e,r){let n=Object.keys(e);this.sortKeys&&n.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(let s of n){let o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,r+1))}}encodeExtension(e){if(typeof e.data=="function"){let n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(n);return}let r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),(0,a8.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,a8.setInt64)(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};vs.Encoder=ER});var c8=_(xR=>{"use strict";a();Object.defineProperty(xR,"__esModule",{value:!0});xR.encode=cae;var aae=wR();function cae(t,e){return new aae.Encoder(e).encodeSharedRef(t)}});var u8=_(IR=>{"use strict";a();Object.defineProperty(IR,"__esModule",{value:!0});IR.prettyByte=uae;function uae(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var l8=_(JA=>{"use strict";a();Object.defineProperty(JA,"__esModule",{value:!0});JA.CachedKeyDecoder=void 0;var lae=WA(),dae=16,fae=16,PR=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=dae,r=fae){this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){let i=this.caches[n-1];e:for(let s of i){let o=s.bytes;for(let c=0;c<n;c++)if(o[c]!==e[r+c])continue e;return s.str}return null}store(e,r){let n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){let i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;let s=(0,lae.utf8DecodeJs)(e,r,n),o=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(o,s),s}};JA.CachedKeyDecoder=PR});var e_=_(QA=>{"use strict";a();Object.defineProperty(QA,"__esModule",{value:!0});QA.Decoder=void 0;var RR=u8(),pae=YA(),mu=$A(),hae=WA(),d8=vR(),gae=l8(),wo=GA(),OR="array",ng="map_key",p8="map_value",mae=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new wo.DecodeError("The type of key must be string or number but "+typeof t)},TR=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let r=this.getUninitializedStateFromPool();r.type=OR,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){let r=this.getUninitializedStateFromPool();r.type=ng,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===OR){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===ng||e.type===p8){let n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},rg=-1,zR=new DataView(new ArrayBuffer(0)),yae=new Uint8Array(zR.buffer);try{zR.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var f8=new RangeError("Insufficient data"),bae=new gae.CachedKeyDecoder,BR=class t{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=zR;bytes=yae;headByte=rg;stack=new TR;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??pae.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??mu.UINT32_MAX,this.maxBinLength=e?.maxBinLength??mu.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??mu.UINT32_MAX,this.maxMapLength=e?.maxMapLength??mu.UINT32_MAX,this.maxExtLength=e?.maxExtLength??mu.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:bae,this.mapKeyConverter=e?.mapKeyConverter??mae}clone(){return new t({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=rg,this.stack.reset()}setBuffer(e){let r=(0,d8.ensureUint8Array)(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===rg&&!this.hasRemaining(1))this.setBuffer(e);else{let r=this.bytes.subarray(this.pos),n=(0,d8.ensureUint8Array)(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,n;for await(let c of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),r=!0}catch(u){if(!(u instanceof RangeError))throw u}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${(0,RR.prettyByte)(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,i=-1;for await(let s of e){if(r&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){let i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e<160){let i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else{let i=e-160;r=this.decodeString(i,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){let i=this.lookU8();r=this.decodeString(i,1)}else if(e===218){let i=this.lookU16();r=this.decodeString(i,2)}else if(e===219){let i=this.lookU32();r=this.decodeString(i,4)}else if(e===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===196){let i=this.lookU8();r=this.decodeBinary(i,1)}else if(e===197){let i=this.lookU16();r=this.decodeBinary(i,2)}else if(e===198){let i=this.lookU32();r=this.decodeBinary(i,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){let i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){let i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){let i=this.lookU32();r=this.decodeExtension(i,4)}else throw new wo.DecodeError(`Unrecognized type byte: ${(0,RR.prettyByte)(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===OR)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===ng){if(r==="__proto__")throw new wo.DecodeError("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=p8;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=ng;continue e}}return r}}readHeadByte(){return this.headByte===rg&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=rg}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new wo.DecodeError(`Unrecognized array type byte: ${(0,RR.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new wo.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new wo.DecodeError(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new wo.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw f8;let n=this.pos+r,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=(0,hae.utf8Decode)(this.bytes,n,e),this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===ng:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new wo.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw f8;let n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new wo.DecodeError(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+r),i=this.decodeBinary(e,r+1);return this.extensionCodec.decode(i,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=(0,mu.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,mu.getInt64)(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}};QA.Decoder=BR});var g8=_(t_=>{"use strict";a();Object.defineProperty(t_,"__esModule",{value:!0});t_.decode=Aae;t_.decodeMulti=_ae;var h8=e_();function Aae(t,e){return new h8.Decoder(e).decode(t)}function _ae(t,e){return new h8.Decoder(e).decodeMulti(t)}});var b8=_(ig=>{"use strict";a();Object.defineProperty(ig,"__esModule",{value:!0});ig.isAsyncIterable=m8;ig.asyncIterableFromStream=y8;ig.ensureAsyncIterable=Sae;function m8(t){return t[Symbol.asyncIterator]!=null}async function*y8(t){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}function Sae(t){return m8(t)?t:y8(t)}});var A8=_(sg=>{"use strict";a();Object.defineProperty(sg,"__esModule",{value:!0});sg.decodeAsync=vae;sg.decodeArrayStream=Eae;sg.decodeMultiStream=wae;var kR=e_(),CR=b8();async function vae(t,e){let r=(0,CR.ensureAsyncIterable)(t);return new kR.Decoder(e).decodeAsync(r)}function Eae(t,e){let r=(0,CR.ensureAsyncIterable)(t);return new kR.Decoder(e).decodeArrayStream(r)}function wae(t,e){let r=(0,CR.ensureAsyncIterable)(t);return new kR.Decoder(e).decodeStream(r)}});var S8=_(Ne=>{"use strict";a();Object.defineProperty(Ne,"__esModule",{value:!0});Ne.decodeTimestampExtension=Ne.encodeTimestampExtension=Ne.decodeTimestampToTimeSpec=Ne.encodeTimeSpecToTimestamp=Ne.encodeDateToTimeSpec=Ne.EXT_TIMESTAMP=Ne.ExtData=Ne.ExtensionCodec=Ne.Encoder=Ne.DecodeError=Ne.Decoder=Ne.decodeMultiStream=Ne.decodeArrayStream=Ne.decodeAsync=Ne.decodeMulti=Ne.decode=Ne.encode=void 0;var xae=c8();Object.defineProperty(Ne,"encode",{enumerable:!0,get:function(){return xae.encode}});var _8=g8();Object.defineProperty(Ne,"decode",{enumerable:!0,get:function(){return _8.decode}});Object.defineProperty(Ne,"decodeMulti",{enumerable:!0,get:function(){return _8.decodeMulti}});var MR=A8();Object.defineProperty(Ne,"decodeAsync",{enumerable:!0,get:function(){return MR.decodeAsync}});Object.defineProperty(Ne,"decodeArrayStream",{enumerable:!0,get:function(){return MR.decodeArrayStream}});Object.defineProperty(Ne,"decodeMultiStream",{enumerable:!0,get:function(){return MR.decodeMultiStream}});var Iae=e_();Object.defineProperty(Ne,"Decoder",{enumerable:!0,get:function(){return Iae.Decoder}});var Pae=GA();Object.defineProperty(Ne,"DecodeError",{enumerable:!0,get:function(){return Pae.DecodeError}});var Rae=wR();Object.defineProperty(Ne,"Encoder",{enumerable:!0,get:function(){return Rae.Encoder}});var Oae=YA();Object.defineProperty(Ne,"ExtensionCodec",{enumerable:!0,get:function(){return Oae.ExtensionCodec}});var Tae=yR();Object.defineProperty(Ne,"ExtData",{enumerable:!0,get:function(){return Tae.ExtData}});var ud=AR();Object.defineProperty(Ne,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return ud.EXT_TIMESTAMP}});Object.defineProperty(Ne,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return ud.encodeDateToTimeSpec}});Object.defineProperty(Ne,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return ud.encodeTimeSpecToTimestamp}});Object.defineProperty(Ne,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return ud.decodeTimestampToTimeSpec}});Object.defineProperty(Ne,"encodeTimestampExtension",{enumerable:!0,get:function(){return ud.encodeTimestampExtension}});Object.defineProperty(Ne,"decodeTimestampExtension",{enumerable:!0,get:function(){return ud.decodeTimestampExtension}})});var ld=_(gi=>{"use strict";a();Object.defineProperty(gi,"__esModule",{value:!0});gi.unwrapOption=gi.someOrNone=gi.lowercaseFirstLetter=gi.capitalizeFirstLetter=gi.toWords=void 0;var v8=U();function Bae(t){let e=/([a-z0-9])([A-Z])/g;return t.replace(e,"$1 $2")}gi.toWords=Bae;function zae(t){return t.charAt(0).toUpperCase()+t.slice(1)}gi.capitalizeFirstLetter=zae;function kae(t){return t.charAt(0).toLowerCase()+t.slice(1)}gi.lowercaseFirstLetter=kae;function Cae(t){return t!==void 0?(0,v8.some)(t):(0,v8.none)()}gi.someOrNone=Cae;function Mae(t){return t.__option==="Some"?t.value:void 0}gi.unwrapOption=Mae});var NR=_(fd=>{"use strict";a();Object.defineProperty(fd,"__esModule",{value:!0});fd.masterEditionFromBase=fd.masterEditionToBase=void 0;var dd=ld();function Nae(t){return{maxSupply:(0,dd.someOrNone)(t.maxSupply),name:(0,dd.someOrNone)(t.name),uri:(0,dd.someOrNone)(t.uri)}}fd.masterEditionToBase=Nae;function Lae(t){return{maxSupply:(0,dd.unwrapOption)(t.maxSupply),name:(0,dd.unwrapOption)(t.name),uri:(0,dd.unwrapOption)(t.uri)}}fd.masterEditionFromBase=Lae});var mi=_(Oa=>{"use strict";a();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.comparePluginAuthorities=Oa.pluginAuthorityFromBase=Oa.pluginAuthorityToBase=void 0;function Dae(t){return t.type==="Address"?{__kind:"Address",address:t.address}:{__kind:t.type}}Oa.pluginAuthorityToBase=Dae;function qae(t){return{type:t.__kind,address:t.address}}Oa.pluginAuthorityFromBase=qae;function Uae(t,e){return t.type!==e.type?!1:t.address===e.address}Oa.comparePluginAuthorities=Uae});var ag=_(wt=>{"use strict";a();Object.defineProperty(wt,"__esModule",{value:!0});wt.parseExternalPluginAdapterData=wt.pluginKeyToPluginType=wt.registryRecordsToPluginsList=wt.mapPlugin=wt.mapPluginFields=wt.pluginAuthorityPairV2=wt.createPluginV2=wt.pluginAuthorityPair=wt.createPlugin=wt.formPluginHeaderV1=void 0;var pd=U(),Vae=S8(),og=xe(),Kae=ld(),E8=NR(),w8=mi(),x8=gR();function Fae(t){return{key:og.Key.PluginHeaderV1,pluginRegistryOffset:t}}wt.formPluginHeaderV1=Fae;function I8(t){return t.type==="UpdateDelegate"?{__kind:t.type,fields:[t.data||{additionalDelegates:[]}]}:{__kind:t.type,fields:[t.data||{}]}}wt.createPlugin=I8;function Wae(t){let{type:e,authority:r,data:n}=t;return{plugin:I8({type:e,data:n}),authority:r?(0,pd.some)(r):(0,pd.none)()}}wt.pluginAuthorityPair=Wae;function P8(t){let{type:e}=t;return e==="UpdateDelegate"?{__kind:e,fields:[t||{additionalDelegates:[]}]}:e==="Royalties"?{__kind:e,fields:[(0,x8.royaltiesToBase)(t)]}:e==="MasterEdition"?{__kind:e,fields:[(0,E8.masterEditionToBase)(t)]}:{__kind:e,fields:[t||{}]}}wt.createPluginV2=P8;function jae({type:t,authority:e,...r}){return{plugin:P8({type:t,...r}),authority:e?(0,pd.some)((0,w8.pluginAuthorityToBase)(e)):(0,pd.none)()}}wt.pluginAuthorityPairV2=jae;function R8(t){return t.reduce((e,r)=>({...e,...r}),{})}wt.mapPluginFields=R8;function O8({plugin:t,authority:e,offset:r}){let n=(0,Kae.toWords)(t.__kind).toLowerCase().split(" ").reduce((i,s)=>i+(s.charAt(0).toUpperCase()+s.slice(1)));return t.__kind==="Royalties"?{[n]:{authority:e,offset:r,...(0,x8.royaltiesFromBase)(t.fields[0])}}:t.__kind==="MasterEdition"?{[n]:{authority:e,offset:r,...(0,E8.masterEditionFromBase)(t.fields[0])}}:{[n]:{authority:e,offset:r,..."fields"in t?R8(t.fields):{}}}}wt.mapPlugin=O8;function Hae(t,e){return t.reduce((r,n)=>{let i=(0,w8.pluginAuthorityFromBase)(n.authority),s=(0,og.getPluginSerializer)().deserialize(e,Number(n.offset))[0];return r={...r,...O8({plugin:s,authority:i,offset:n.offset})},r},{})}wt.registryRecordsToPluginsList=Hae;function Gae(t){return t.charAt(0).toUpperCase()+t.slice(1)}wt.pluginKeyToPluginType=Gae;function $ae(t,e,r){let n;if((0,pd.isSome)(e.dataOffset)&&(0,pd.isSome)(e.dataLen)){let i=r.slice(Number(e.dataOffset.value),Number(e.dataOffset.value)+Number(e.dataLen.value));if(t.schema===og.ExternalPluginAdapterSchema.Binary)n=i;else if(t.schema===og.ExternalPluginAdapterSchema.Json){if(i.length!==0)try{n=JSON.parse(new TextDecoder().decode(i))}catch(s){console.warn("Invalid JSON in external plugin data",s.message)}}else t.schema===og.ExternalPluginAdapterSchema.MsgPack&&(i.length===0?n=null:n=(0,Vae.decode)(i));return n}throw new Error("Invalid DataStore, missing dataOffset or dataLen")}wt.parseExternalPluginAdapterData=$ae});var DR=_(Es=>{"use strict";a();Object.defineProperty(Es,"__esModule",{value:!0});Es.appDataManifest=Es.appDataFromBase=Es.appDataUpdateInfoArgsToBase=Es.appDataInitInfoArgsToBase=void 0;var Zae=ag(),LR=mi();function T8(t){return{dataAuthority:(0,LR.pluginAuthorityToBase)(t.dataAuthority),initPluginAuthority:t.initPluginAuthority?(0,LR.pluginAuthorityToBase)(t.initPluginAuthority):null,schema:t.schema??null}}Es.appDataInitInfoArgsToBase=T8;function B8(t){return{schema:t.schema??null}}Es.appDataUpdateInfoArgsToBase=B8;function z8(t,e,r){return{...t,dataAuthority:(0,LR.pluginAuthorityFromBase)(t.dataAuthority),data:(0,Zae.parseExternalPluginAdapterData)(t,e,r)}}Es.appDataFromBase=z8;Es.appDataManifest={type:"AppData",fromBase:z8,initToBase:T8,updateToBase:B8}});var bu=_(Er=>{"use strict";a();Object.defineProperty(Er,"__esModule",{value:!0});Er.lifecycleChecksFromBase=Er.lifecycleChecksToBase=Er.hookableLifecycleEventToLifecycleCheckKey=Er.lifecycleCheckKeyToEnum=Er.checkResultsToAdapterCheckResult=Er.adapterCheckResultToCheckResults=Er.CheckResult=void 0;var k8=xe(),Xae=ld(),yu;(function(t){t[t.CAN_LISTEN=0]="CAN_LISTEN",t[t.CAN_APPROVE=1]="CAN_APPROVE",t[t.CAN_REJECT=2]="CAN_REJECT"})(yu=Er.CheckResult||(Er.CheckResult={}));var Yae=t=>{let e=[];return t.flags&1&&e.push(yu.CAN_LISTEN),t.flags&2&&e.push(yu.CAN_APPROVE),t.flags&4&&e.push(yu.CAN_REJECT),e};Er.adapterCheckResultToCheckResults=Yae;var Jae=t=>{let e=0;return t.forEach(r=>{switch(r){case yu.CAN_LISTEN:e|=1;break;case yu.CAN_APPROVE:e|=2;break;case yu.CAN_REJECT:e|=4;break;default:}}),{flags:e}};Er.checkResultsToAdapterCheckResult=Jae;function C8(t){return k8.HookableLifecycleEvent[(0,Xae.capitalizeFirstLetter)(t)]}Er.lifecycleCheckKeyToEnum=C8;function M8(t){return k8.HookableLifecycleEvent[t].toLowerCase()}Er.hookableLifecycleEventToLifecycleCheckKey=M8;function Qae(t){return Object.keys(t).map(e=>{let r=e,n=t[r];return n?[C8(r),(0,Er.checkResultsToAdapterCheckResult)(n)]:null}).filter(e=>e!==null)}Er.lifecycleChecksToBase=Qae;function ece(t){let e={};return t.forEach(([r,n])=>{e[M8(r)]=(0,Er.adapterCheckResultToCheckResults)(n)}),e}Er.lifecycleChecksFromBase=ece});var qR=_(hd=>{"use strict";a();Object.defineProperty(hd,"__esModule",{value:!0});hd.seedFromBase=hd.seedToBase=void 0;function tce(t){return t.type==="Address"?{__kind:"Address",fields:[t.pubkey]}:t.type==="Bytes"?{__kind:"Bytes",fields:[t.bytes]}:{__kind:t.type}}hd.seedToBase=tce;function rce(t){return t.__kind==="Address"?{type:"Address",pubkey:t.fields[0]}:t.__kind==="Bytes"?{type:"Bytes",bytes:t.fields[0]}:{type:t.__kind}}hd.seedFromBase=rce});var gd=_(mr=>{"use strict";a();Object.defineProperty(mr,"__esModule",{value:!0});mr.getExtraAccountRequiredInputs=mr.extraAccountFromBase=mr.extraAccountToBase=mr.extraAccountToAccountMeta=mr.findPreconfiguredPda=mr.PRECONFIGURED_SEED=void 0;var Ta=N(),N8=qR(),L8=ld();mr.PRECONFIGURED_SEED="mpl-core";var nce=(t,e,r)=>t.eddsa.findPda(e,[(0,Ta.string)({size:"variable"}).serialize(mr.PRECONFIGURED_SEED),(0,Ta.publicKey)().serialize(r)]);mr.findPreconfiguredPda=nce;function ice(t,e,r){let n={isSigner:e.isSigner||!1,isWritable:e.isWritable||!1},i=D8(e),s=[];if(i.forEach(o=>{r[o]||s.push(o)}),s.length)throw new Error(`Missing required inputs to derive account address: ${s.join(", ")}`);switch(e.type){case"PreconfiguredProgram":return{...n,pubkey:t.eddsa.findPda(r.program,[(0,Ta.string)({size:"variable"}).serialize(mr.PRECONFIGURED_SEED)])[0]};case"PreconfiguredCollection":return{...n,pubkey:(0,mr.findPreconfiguredPda)(t,r.program,r.collection)[0]};case"PreconfiguredOwner":return{...n,pubkey:(0,mr.findPreconfiguredPda)(t,r.program,r.owner)[0]};case"PreconfiguredRecipient":return{...n,pubkey:(0,mr.findPreconfiguredPda)(t,r.program,r.recipient)[0]};case"PreconfiguredAsset":return{...n,pubkey:(0,mr.findPreconfiguredPda)(t,r.program,r.asset)[0]};case"CustomPda":return{pubkey:t.eddsa.findPda(e.customProgramId?e.customProgramId:r.program,e.seeds.map(o=>{switch(o.type){case"Collection":return(0,Ta.publicKey)().serialize(r.collection);case"Owner":return(0,Ta.publicKey)().serialize(r.owner);case"Recipient":return(0,Ta.publicKey)().serialize(r.recipient);case"Asset":return(0,Ta.publicKey)().serialize(r.asset);case"Address":return(0,Ta.publicKey)().serialize(o.pubkey);case"Bytes":return o.bytes;default:throw new Error("Unknown seed type")}}))[0],...n};case"Address":return{...n,pubkey:e.address};default:throw new Error("Unknown extra account type")}}mr.extraAccountToAccountMeta=ice;function sce(t){let e={isSigner:t.isSigner||!1,isWritable:t.isWritable||!1};return t.type==="CustomPda"?{__kind:"CustomPda",...e,seeds:t.seeds.map(N8.seedToBase),customProgramId:(0,L8.someOrNone)(t.customProgramId)}:t.type==="Address"?{__kind:"Address",...e,address:t.address}:{__kind:t.type,...e}}mr.extraAccountToBase=sce;function oce(t){return t.__kind==="CustomPda"?{type:"CustomPda",isSigner:t.isSigner,isWritable:t.isWritable,seeds:t.seeds.map(N8.seedFromBase),customProgramId:(0,L8.unwrapOption)(t.customProgramId)}:t.__kind==="Address"?{type:"Address",isSigner:t.isSigner,isWritable:t.isWritable,address:t.address}:{type:t.__kind,isSigner:t.isSigner,isWritable:t.isWritable}}mr.extraAccountFromBase=oce;var ace={PreconfiguredOwner:"owner",PreconfiguredRecipient:"recipient",PreconfiguredAsset:"asset",PreconfiguredCollection:"collection",PreconfiguredProgram:"program"};function D8(t){let e=ace[t.type];return e?[e]:t.type==="CustomPda"?t.seeds.map(r=>{switch(r.type){case"Collection":return"collection";case"Owner":return"owner";case"Recipient":return"recipient";case"Asset":return"asset";default:return null}}).filter(r=>r):[]}mr.getExtraAccountRequiredInputs=D8});var F8=_(ws=>{"use strict";a();Object.defineProperty(ws,"__esModule",{value:!0});ws.lifecycleHookManifest=ws.lifecycleHookFromBase=ws.lifecycleHookUpdateInfoArgsToBase=ws.lifecycleHookInitInfoArgsToBase=void 0;var VR=gd(),q8=bu(),UR=mi(),cce=ag();function U8(t){return{extraAccounts:t.extraAccounts?t.extraAccounts.map(VR.extraAccountToBase):null,hookedProgram:t.hookedProgram,initPluginAuthority:t.initPluginAuthority?(0,UR.pluginAuthorityToBase)(t.initPluginAuthority):null,lifecycleChecks:(0,q8.lifecycleChecksToBase)(t.lifecycleChecks),schema:t.schema??null,dataAuthority:t.dataAuthority?(0,UR.pluginAuthorityToBase)(t.dataAuthority):null}}ws.lifecycleHookInitInfoArgsToBase=U8;function V8(t){return{lifecycleChecks:t.lifecycleChecks?(0,q8.lifecycleChecksToBase)(t.lifecycleChecks):null,extraAccounts:t.extraAccounts?t.extraAccounts.map(VR.extraAccountToBase):null,schema:t.schema??null}}ws.lifecycleHookUpdateInfoArgsToBase=V8;function K8(t,e,r){return{...t,extraAccounts:t.extraAccounts.__option==="Some"?t.extraAccounts.value.map(VR.extraAccountFromBase):void 0,data:(0,cce.parseExternalPluginAdapterData)(t,e,r),dataAuthority:t.dataAuthority.__option==="Some"?(0,UR.pluginAuthorityFromBase)(t.dataAuthority.value):void 0}}ws.lifecycleHookFromBase=K8;ws.lifecycleHookManifest={type:"LifecycleHook",fromBase:K8,initToBase:U8,updateToBase:V8}});var KR=_(md=>{"use strict";a();Object.defineProperty(md,"__esModule",{value:!0});md.validationResultsOffsetFromBase=md.validationResultsOffsetToBase=void 0;function uce(t){return t.type==="Custom"?{__kind:"Custom",fields:[t.offset]}:{__kind:t.type}}md.validationResultsOffsetToBase=uce;function lce(t){return t.__kind==="Custom"?{type:"Custom",offset:t.fields[0]}:{type:t.__kind}}md.validationResultsOffsetFromBase=lce});var WR=_(Cn=>{"use strict";a();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.oracleManifest=Cn.deserializeOracleValidation=Cn.findOracleAccount=Cn.oracleFromBase=Cn.oracleUpdateInfoArgsToBase=Cn.oracleInitInfoArgsToBase=void 0;var r_=gd(),dce=xe(),W8=bu(),fce=mi(),FR=KR();function j8(t){return{baseAddress:t.baseAddress,baseAddressConfig:t.baseAddressConfig?(0,r_.extraAccountToBase)(t.baseAddressConfig):null,lifecycleChecks:(0,W8.lifecycleChecksToBase)(t.lifecycleChecks),initPluginAuthority:t.initPluginAuthority?(0,fce.pluginAuthorityToBase)(t.initPluginAuthority):null,resultsOffset:t.resultsOffset?(0,FR.validationResultsOffsetToBase)(t.resultsOffset):null}}Cn.oracleInitInfoArgsToBase=j8;function H8(t){return{baseAddressConfig:t.baseAddressConfig?(0,r_.extraAccountToBase)(t.baseAddressConfig):null,lifecycleChecks:t.lifecycleChecks?(0,W8.lifecycleChecksToBase)(t.lifecycleChecks):null,resultsOffset:t.resultsOffset?(0,FR.validationResultsOffsetToBase)(t.resultsOffset):null}}Cn.oracleUpdateInfoArgsToBase=H8;function G8(t,e,r){return{...t,baseAddressConfig:t.baseAddressConfig.__option==="Some"?(0,r_.extraAccountFromBase)(t.baseAddressConfig.value):void 0,resultsOffset:(0,FR.validationResultsOffsetFromBase)(t.resultsOffset)}}Cn.oracleFromBase=G8;function pce(t,e,r){return e.baseAddressConfig?(0,r_.extraAccountToAccountMeta)(t,e.baseAddressConfig,{...r,program:e.baseAddress}).pubkey:e.baseAddress}Cn.findOracleAccount=pce;function hce(t,e){let r=0;return e.type==="Custom"?r=Number(e.offset):e.type==="Anchor"&&(r=8),(0,dce.getOracleValidationSerializer)().deserialize(t,r)[0]}Cn.deserializeOracleValidation=hce;Cn.oracleManifest={type:"Oracle",fromBase:G8,initToBase:j8,updateToBase:H8}});var n_=_(yd=>{"use strict";a();Object.defineProperty(yd,"__esModule",{value:!0});yd.linkedDataKeyFromBase=yd.linkedDataKeyToBase=void 0;var $8=mi();function gce(t){switch(t.type){case"LinkedLifecycleHook":return{__kind:t.type,fields:[t.hookedProgram]};case"LinkedAppData":return{__kind:t.type,fields:[(0,$8.pluginAuthorityToBase)(t.dataAuthority)]};default:throw new Error("Unknown LinkedDataKey type")}}yd.linkedDataKeyToBase=gce;function mce(t){switch(t.__kind){case"LinkedLifecycleHook":return{type:t.__kind,hookedProgram:t.fields[0]};case"LinkedAppData":return{type:t.__kind,dataAuthority:(0,$8.pluginAuthorityFromBase)(t.fields[0])};default:throw new Error("Unknown LinkedDataKey type")}}yd.linkedDataKeyFromBase=mce});var jR=_(i_=>{"use strict";a();Object.defineProperty(i_,"__esModule",{value:!0});i_.externalPluginAdapterKeyToBase=void 0;var yce=mi(),bce=n_();function Ace(t){switch(t.type){case"Oracle":return{__kind:t.type,fields:[t.baseAddress]};case"AppData":case"LinkedAppData":return{__kind:t.type,fields:[(0,yce.pluginAuthorityToBase)(t.dataAuthority)]};case"LifecycleHook":return{__kind:t.type,fields:[t.hookedProgram]};case"DataSection":return{__kind:t.type,fields:[(0,bce.linkedDataKeyToBase)(t.parentKey)]};case"AgentIdentity":return{__kind:t.type};default:throw new Error("Unknown ExternalPluginAdapterKey type")}}i_.externalPluginAdapterKeyToBase=Ace});var X8=_(Z8=>{"use strict";a();Object.defineProperty(Z8,"__esModule",{value:!0})});var Y8=_(Ba=>{"use strict";a();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.updateAuthority=Ba.ruleSet=Ba.pluginAuthority=void 0;var HR=xe();Object.defineProperty(Ba,"pluginAuthority",{enumerable:!0,get:function(){return HR.basePluginAuthority}});Object.defineProperty(Ba,"ruleSet",{enumerable:!0,get:function(){return HR.baseRuleSet}});Object.defineProperty(Ba,"updateAuthority",{enumerable:!0,get:function(){return HR.baseUpdateAuthority}})});var $R=_(xs=>{"use strict";a();Object.defineProperty(xs,"__esModule",{value:!0});xs.linkedAppDataManifest=xs.linkedAppDataFromBase=xs.linkedAppDataUpdateInfoArgsToBase=xs.linkedAppDataInitInfoArgsToBase=void 0;var GR=mi();function J8(t){return{dataAuthority:(0,GR.pluginAuthorityToBase)(t.dataAuthority),initPluginAuthority:t.initPluginAuthority?(0,GR.pluginAuthorityToBase)(t.initPluginAuthority):null,schema:t.schema??null}}xs.linkedAppDataInitInfoArgsToBase=J8;function Q8(t){return{schema:t.schema??null}}xs.linkedAppDataUpdateInfoArgsToBase=Q8;function eq(t,e,r){return{...t,dataAuthority:(0,GR.pluginAuthorityFromBase)(t.dataAuthority)}}xs.linkedAppDataFromBase=eq;xs.linkedAppDataManifest={type:"LinkedAppData",fromBase:eq,initToBase:J8,updateToBase:Q8}});var ZR=_(Is=>{"use strict";a();Object.defineProperty(Is,"__esModule",{value:!0});Is.dataSectionManifest=Is.dataSectionFromBase=Is.dataSectionUpdateInfoArgsToBase=Is.dataSectionInitInfoArgsToBase=void 0;var _ce=ag(),tq=n_(),Sce=mi();function rq(t){return{parentKey:(0,tq.linkedDataKeyToBase)(t.parentKey),schema:t.schema}}Is.dataSectionInitInfoArgsToBase=rq;function nq(t){return{}}Is.dataSectionUpdateInfoArgsToBase=nq;function iq(t,e,r){return{...t,parentKey:(0,tq.linkedDataKeyFromBase)(t.parentKey),dataAuthority:t.parentKey.__kind!=="LinkedLifecycleHook"?(0,Sce.pluginAuthorityFromBase)(t.parentKey.fields[0]):void 0,data:(0,_ce.parseExternalPluginAdapterData)(t,e,r)}}Is.dataSectionFromBase=iq;Is.dataSectionManifest={type:"DataSection",fromBase:iq,initToBase:rq,updateToBase:nq}});var JR=_(Ps=>{"use strict";a();Object.defineProperty(Ps,"__esModule",{value:!0});Ps.linkedLifecycleHookManifest=Ps.linkedLifecycleHookFromBase=Ps.linkedLifecycleHookUpdateInfoArgsToBase=Ps.linkedLifecycleHookInitInfoArgsToBase=void 0;var YR=gd(),sq=bu(),XR=mi();function oq(t){return{extraAccounts:t.extraAccounts?t.extraAccounts.map(YR.extraAccountToBase):null,hookedProgram:t.hookedProgram,initPluginAuthority:t.initPluginAuthority?(0,XR.pluginAuthorityToBase)(t.initPluginAuthority):null,lifecycleChecks:(0,sq.lifecycleChecksToBase)(t.lifecycleChecks),schema:t.schema?t.schema:null,dataAuthority:t.dataAuthority?(0,XR.pluginAuthorityToBase)(t.dataAuthority):null}}Ps.linkedLifecycleHookInitInfoArgsToBase=oq;function aq(t){return{lifecycleChecks:t.lifecycleChecks?(0,sq.lifecycleChecksToBase)(t.lifecycleChecks):null,extraAccounts:t.extraAccounts?t.extraAccounts.map(YR.extraAccountToBase):null,schema:t.schema??null}}Ps.linkedLifecycleHookUpdateInfoArgsToBase=aq;function cq(t,e,r){return{...t,extraAccounts:t.extraAccounts.__option==="Some"?t.extraAccounts.value.map(YR.extraAccountFromBase):void 0,dataAuthority:t.dataAuthority.__option==="Some"?(0,XR.pluginAuthorityFromBase)(t.dataAuthority.value):void 0}}Ps.linkedLifecycleHookFromBase=cq;Ps.linkedLifecycleHookManifest={type:"LinkedLifecycleHook",fromBase:cq,initToBase:oq,updateToBase:aq}});var QR=_(Rs=>{"use strict";a();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.agentIdentityManifest=Rs.agentIdentityFromBase=Rs.agentIdentityUpdateInfoArgsToBase=Rs.agentIdentityInitInfoArgsToBase=void 0;var uq=bu(),vce=mi();function lq(t){return{uri:t.uri,lifecycleChecks:(0,uq.lifecycleChecksToBase)(t.lifecycleChecks),initPluginAuthority:t.initPluginAuthority?(0,vce.pluginAuthorityToBase)(t.initPluginAuthority):null}}Rs.agentIdentityInitInfoArgsToBase=lq;function dq(t){return{uri:t.uri??null,lifecycleChecks:t.lifecycleChecks?(0,uq.lifecycleChecksToBase)(t.lifecycleChecks):null}}Rs.agentIdentityUpdateInfoArgsToBase=dq;function fq(t,e,r){return{...t}}Rs.agentIdentityFromBase=fq;Rs.agentIdentityManifest={type:"AgentIdentity",fromBase:fq,initToBase:lq,updateToBase:dq}});var za=_(fn=>{"use strict";a();Object.defineProperty(fn,"__esModule",{value:!0});fn.findExtraAccounts=fn.createExternalPluginAdapterUpdateInfo=fn.createExternalPluginAdapterInitInfo=fn.isExternalPluginAdapterType=fn.externalRegistryRecordsToExternalPluginAdapterList=fn.externalPluginAdapterManifests=void 0;var bd=U(),tO=Je(),Ece=xe(),pq=DR(),wce=bu(),hq=WR(),eO=gd(),gq=$R(),mq=ZR(),yq=JR(),bq=QR();fn.externalPluginAdapterManifests={LifecycleHook:tO.lifecycleHookManifest,Oracle:hq.oracleManifest,AppData:pq.appDataManifest,LinkedLifecycleHook:yq.linkedLifecycleHookManifest,LinkedAppData:gq.linkedAppDataManifest,DataSection:mq.dataSectionManifest,AgentIdentity:bq.agentIdentityManifest};function xce(t,e){let r={};return t.forEach(n=>{let i=(0,Ece.getExternalPluginAdapterSerializer)().deserialize(e,Number(n.offset))[0],s={lifecycleChecks:n.lifecycleChecks.__option==="Some"?(0,wce.lifecycleChecksFromBase)(n.lifecycleChecks.value):void 0,authority:(0,tO.pluginAuthorityFromBase)(n.authority),offset:n.offset};i.__kind==="LifecycleHook"?(r.lifecycleHooks||(r.lifecycleHooks=[]),r.lifecycleHooks.push({type:"LifecycleHook",dataOffset:(0,bd.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,bd.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,tO.lifecycleHookFromBase)(i.fields[0],n,e)})):i.__kind==="AppData"?(r.appDatas||(r.appDatas=[]),r.appDatas.push({type:"AppData",dataOffset:(0,bd.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,bd.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,pq.appDataFromBase)(i.fields[0],n,e)})):i.__kind==="Oracle"?(r.oracles||(r.oracles=[]),r.oracles.push({type:"Oracle",...s,...(0,hq.oracleFromBase)(i.fields[0],n,e)})):i.__kind==="LinkedLifecycleHook"?(r.linkedLifecycleHooks||(r.linkedLifecycleHooks=[]),r.linkedLifecycleHooks.push({type:"LinkedLifecycleHook",...s,...(0,yq.linkedLifecycleHookFromBase)(i.fields[0],n,e)})):i.__kind==="LinkedAppData"?(r.linkedAppDatas||(r.linkedAppDatas=[]),r.linkedAppDatas.push({type:"LinkedAppData",...s,...(0,gq.linkedAppDataFromBase)(i.fields[0],n,e)})):i.__kind==="DataSection"?(r.dataSections||(r.dataSections=[]),r.dataSections.push({type:"DataSection",dataOffset:(0,bd.isSome)(n.dataOffset)?n.dataOffset.value:void 0,dataLen:(0,bd.isSome)(n.dataLen)?n.dataLen.value:void 0,...s,...(0,mq.dataSectionFromBase)(i.fields[0],n,e)})):i.__kind==="AgentIdentity"&&(r.agentIdentities||(r.agentIdentities=[]),r.agentIdentities.push({type:"AgentIdentity",...s,...(0,bq.agentIdentityFromBase)(i.fields[0],n,e)}))}),r}fn.externalRegistryRecordsToExternalPluginAdapterList=xce;var Ice=t=>t.type==="LifecycleHook"||t.type==="Oracle"||t.type==="AppData"||t.type==="LinkedLifecycleHook"||t.type==="DataSection"||t.type==="LinkedAppData"||t.type==="AgentIdentity";fn.isExternalPluginAdapterType=Ice;function Pce({type:t,...e}){let r=fn.externalPluginAdapterManifests[t];return{__kind:t,fields:[r.initToBase(e)]}}fn.createExternalPluginAdapterInitInfo=Pce;function Rce({type:t,...e}){let r=fn.externalPluginAdapterManifests[t];return{__kind:t,fields:[r.updateToBase(e)]}}fn.createExternalPluginAdapterUpdateInfo=Rce;var Oce=(t,e,r,n)=>{let i=[];return r.oracles?.forEach(s=>{s.lifecycleChecks?.[e]&&(s.baseAddressConfig?i.push((0,eO.extraAccountToAccountMeta)(t,s.baseAddressConfig,{...n,program:s.baseAddress})):i.push({pubkey:s.baseAddress,isSigner:!1,isWritable:!1}))}),r.lifecycleHooks?.forEach(s=>{s.lifecycleChecks?.[e]&&(i.push({pubkey:s.hookedProgram,isSigner:!1,isWritable:!1}),s.extraAccounts?.forEach(o=>{i.push((0,eO.extraAccountToAccountMeta)(t,o,{...n,program:s.hookedProgram}))}))}),r.linkedLifecycleHooks?.forEach(s=>{s.lifecycleChecks?.[e]&&(i.push({pubkey:s.hookedProgram,isSigner:!1,isWritable:!1}),s.extraAccounts?.forEach(o=>{i.push((0,eO.extraAccountToAccountMeta)(t,o,{...n,program:s.hookedProgram}))}))}),i};fn.findExtraAccounts=Oce});var Aq=_(s_=>{"use strict";a();Object.defineProperty(s_,"__esModule",{value:!0});s_.updateAuthorityToBase=void 0;function Tce(t){return t.type==="None"?{__kind:"None"}:{__kind:t.type,fields:[t.address]}}s_.updateAuthorityToBase=Tce});var Je=_(et=>{"use strict";a();var Bce=et&&et.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),zt=et&&et.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bce(e,t,r)};Object.defineProperty(et,"__esModule",{value:!0});zt(gR(),et);zt(ag(),et);zt(DR(),et);zt(bu(),et);zt(F8(),et);zt(WR(),et);zt(jR(),et);zt(X8(),et);zt(mi(),et);zt(Y8(),et);zt(za(),et);zt(Aq(),et);zt(qR(),et);zt(gd(),et);zt(KR(),et);zt(JR(),et);zt($R(),et);zt(ZR(),et);zt(n_(),et);zt(NR(),et);zt(QR(),et)});var cg=_(ka=>{"use strict";a();Object.defineProperty(ka,"__esModule",{value:!0});ka.getPluginRegistryV1AccountDataSerializer=ka.getAdapterRegistryRecordSerializer=ka.getRegistryRecordSerializer=void 0;var ts=N(),Os=xe();function _q(){return{description:"RegistryRecordWithUnknown",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n,i]=[Os.PluginType.Attributes,e+1,!0];try{[r,n]=(0,Os.getPluginTypeSerializer)().deserialize(t,e),i=!1}catch{}let[s,o]=(0,Os.getBasePluginAuthoritySerializer)().deserialize(t,n),[c,u]=(0,ts.u64)().deserialize(t,o);return[{pluginType:r,authority:s,offset:c,isUnknown:i},u]}}}ka.getRegistryRecordSerializer=_q;function Sq(){return{description:"AdapterRegistryRecordWithUnknown",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n,i]=[Os.ExternalPluginAdapterType.AppData,e+1,!0];try{[r,n]=(0,Os.getExternalPluginAdapterTypeSerializer)().deserialize(t,e),i=!1}catch{}let[s,o]=(0,Os.getBasePluginAuthoritySerializer)().deserialize(t,n),[c,u]=(0,ts.option)((0,ts.array)((0,ts.tuple)([(0,Os.getHookableLifecycleEventSerializer)(),(0,Os.getExternalCheckResultSerializer)()]))).deserialize(t,o),[d,f]=(0,ts.u64)().deserialize(t,u),[m,A]=(0,ts.option)((0,ts.u64)()).deserialize(t,f),[v,P]=(0,ts.option)((0,ts.u64)()).deserialize(t,A);return[{pluginType:r,authority:s,lifecycleChecks:c,offset:d,isUnknown:i,dataOffset:m,dataLen:v},P]}}}ka.getAdapterRegistryRecordSerializer=Sq;function zce(){return{description:"PluginRegistryV1AccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,Os.getKeySerializer)().deserialize(t,e);if(r!==Os.Key.PluginRegistryV1)throw new Error(`Expected a PluginRegistryV1 account, got key: ${r}`);let[i,s]=(0,ts.array)(_q()).deserialize(t,n),[o,c]=(0,ts.array)(Sq()).deserialize(t,s);return[{key:r,registry:i.filter(u=>!u.isUnknown),externalRegistry:o.filter(u=>!u.isUnknown)},c]}}}ka.getPluginRegistryV1AccountDataSerializer=zce});var Eq=_(o_=>{"use strict";a();Object.defineProperty(o_,"__esModule",{value:!0});o_.getAssetV1AccountDataSerializer=void 0;var vq=xe(),kce=$D(),Cce=Je(),Mce=cg(),Nce=za(),Lce=()=>({description:"AssetAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,kce.getAssetV1AccountDataSerializer)().deserialize(t,e);if(r.key!==vq.Key.AssetV1)throw new Error(`Expected an Asset account, got key: ${r.key}`);let i,s,o,c,u=n;t.length!==n&&([i]=(0,vq.getPluginHeaderV1AccountDataSerializer)().deserialize(t,n),[s,u]=(0,Mce.getPluginRegistryV1AccountDataSerializer)().deserialize(t,Number(i.pluginRegistryOffset)),o=(0,Cce.registryRecordsToPluginsList)(s.registry,t),c=(0,Nce.externalRegistryRecordsToExternalPluginAdapterList)(s.externalRegistry,t));let d={type:r.updateAuthority.__kind,address:r.updateAuthority.__kind==="None"?void 0:r.updateAuthority.fields[0]};return[{pluginHeader:i,...o,...c,...r,updateAuthority:d},u]}});o_.getAssetV1AccountDataSerializer=Lce});var wq=_(a_=>{"use strict";a();Object.defineProperty(a_,"__esModule",{value:!0});a_.getCollectionV1AccountDataSerializer=void 0;var Ad=N(),Dce=ce();function qce(){return(0,Ad.struct)([["key",(0,Dce.getKeySerializer)()],["updateAuthority",(0,Ad.publicKey)()],["name",(0,Ad.string)()],["uri",(0,Ad.string)()],["numMinted",(0,Ad.u32)()],["currentSize",(0,Ad.u32)()]],{description:"CollectionV1AccountData"})}a_.getCollectionV1AccountDataSerializer=qce});var Pq=_(c_=>{"use strict";a();Object.defineProperty(c_,"__esModule",{value:!0});c_.getCollectionV1AccountDataSerializer=void 0;var xq=xe(),Uce=wq(),Iq=Je(),Vce=cg(),Kce=()=>({description:"CollectionAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let[r,n]=(0,Uce.getCollectionV1AccountDataSerializer)().deserialize(t,e);if(r.key!==xq.Key.CollectionV1)throw new Error(`Expected an Collection account, got key: ${r.key}`);let i,s,o,c,u=n;return t.length!==n&&([i]=(0,xq.getPluginHeaderV1AccountDataSerializer)().deserialize(t,n),[s,u]=(0,Vce.getPluginRegistryV1AccountDataSerializer)().deserialize(t,Number(i.pluginRegistryOffset)),o=(0,Iq.registryRecordsToPluginsList)(s.registry,t),c=(0,Iq.externalRegistryRecordsToExternalPluginAdapterList)(s.externalRegistry,t)),[{pluginHeader:i,...o,...c,...r},u]}});c_.getCollectionV1AccountDataSerializer=Kce});var Oq=_(u_=>{"use strict";a();Object.defineProperty(u_,"__esModule",{value:!0});u_.getGroupV1AccountDataSerializer=void 0;var ti=N(),Rq=ce();function Fce(){return(0,ti.mapSerializer)((0,ti.struct)([["key",(0,Rq.getKeySerializer)()],["updateAuthority",(0,ti.publicKey)()],["name",(0,ti.string)()],["uri",(0,ti.string)()],["collections",(0,ti.array)((0,ti.publicKey)())],["groups",(0,ti.array)((0,ti.publicKey)())],["parentGroups",(0,ti.array)((0,ti.publicKey)())],["assets",(0,ti.array)((0,ti.publicKey)())]],{description:"GroupV1AccountData"}),t=>({...t,key:Rq.Key.GroupV1}))}u_.getGroupV1AccountDataSerializer=Fce});var Bq=_(l_=>{"use strict";a();Object.defineProperty(l_,"__esModule",{value:!0});l_.getGroupV1AccountDataSerializer=void 0;var Tq=xe(),Wce=Oq(),jce=Je(),Hce=za(),Gce=cg(),$ce=()=>({description:"GroupAccountData",fixedSize:null,maxSize:null,serialize:()=>{throw new Error("Operation not supported.")},deserialize:(t,e=0)=>{let r=(0,Tq.getPluginHeaderV1AccountDataSerializer)(),n=r.fixedSize;if(n===null)throw new Error("Invalid plugin header serializer configuration.");let[i,s]=(0,Wce.getGroupV1AccountDataSerializer)().deserialize(t,e);if(i.key!==Tq.Key.GroupV1)throw new Error(`Expected a Group account, got key: ${i.key}`);let o,c,u,d,f=s;if(t.length>s&&t.length<s+n)throw new Error("Invalid Group account data: truncated plugin header.");if(t.length>=s+n){[o]=r.deserialize(t,s);let A=Number(o.pluginRegistryOffset);if(!Number.isSafeInteger(A)||A<s+n||A>=t.length)throw new Error("Invalid Group account data: plugin registry offset is out of bounds.");if([c,f]=(0,Gce.getPluginRegistryV1AccountDataSerializer)().deserialize(t,A),f>t.length)throw new Error("Invalid Group account data: plugin registry exceeds buffer length.");u=(0,jce.registryRecordsToPluginsList)(c.registry,t),d=(0,Hce.externalRegistryRecordsToExternalPluginAdapterList)(c.externalRegistry,t)}return[{pluginHeader:o,...i,...u,...d},f]}});l_.getGroupV1AccountDataSerializer=$ce});var ug=_(Ts=>{"use strict";a();var Zce=Ts&&Ts.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),d_=Ts&&Ts.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zce(e,t,r)};Object.defineProperty(Ts,"__esModule",{value:!0});d_(Eq(),Ts);d_(Pq(),Ts);d_(Bq(),Ts);d_(cg(),Ts)});var kq=_(Mn=>{"use strict";a();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.getAssetV1GpaBuilder=Mn.safeFetchAllAssetV1=Mn.fetchAllAssetV1=Mn.safeFetchAssetV1=Mn.fetchAssetV1=Mn.deserializeAssetV1=void 0;var Ca=U(),lg=N(),Xce=ug(),zq=ce();function _d(t){return(0,Ca.deserializeAccount)(t,(0,Xce.getAssetV1AccountDataSerializer)())}Mn.deserializeAssetV1=_d;async function Yce(t,e,r){let n=await t.rpc.getAccount((0,Ca.publicKey)(e,!1),r);return(0,Ca.assertAccountExists)(n,"AssetV1"),_d(n)}Mn.fetchAssetV1=Yce;async function Jce(t,e,r){let n=await t.rpc.getAccount((0,Ca.publicKey)(e,!1),r);return n.exists?_d(n):null}Mn.safeFetchAssetV1=Jce;async function Qce(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Ca.publicKey)(i,!1)),r)).map(i=>((0,Ca.assertAccountExists)(i,"AssetV1"),_d(i)))}Mn.fetchAllAssetV1=Qce;async function eue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Ca.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>_d(i))}Mn.safeFetchAllAssetV1=eue;function tue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Ca.gpaBuilder)(t,e).registerFields({key:[0,(0,zq.getKeySerializer)()],owner:[1,(0,lg.publicKey)()],updateAuthority:[33,(0,zq.getBaseUpdateAuthoritySerializer)()],name:[null,(0,lg.string)()],uri:[null,(0,lg.string)()],seq:[null,(0,lg.option)((0,lg.u64)())]}).deserializeUsing(r=>_d(r))}Mn.getAssetV1GpaBuilder=tue});var Cq=_(Nn=>{"use strict";a();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.getCollectionV1GpaBuilder=Nn.safeFetchAllCollectionV1=Nn.fetchAllCollectionV1=Nn.safeFetchCollectionV1=Nn.fetchCollectionV1=Nn.deserializeCollectionV1=void 0;var Ma=U(),dg=N(),rue=ug(),nue=ce();function Sd(t){return(0,Ma.deserializeAccount)(t,(0,rue.getCollectionV1AccountDataSerializer)())}Nn.deserializeCollectionV1=Sd;async function iue(t,e,r){let n=await t.rpc.getAccount((0,Ma.publicKey)(e,!1),r);return(0,Ma.assertAccountExists)(n,"CollectionV1"),Sd(n)}Nn.fetchCollectionV1=iue;async function sue(t,e,r){let n=await t.rpc.getAccount((0,Ma.publicKey)(e,!1),r);return n.exists?Sd(n):null}Nn.safeFetchCollectionV1=sue;async function oue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Ma.publicKey)(i,!1)),r)).map(i=>((0,Ma.assertAccountExists)(i,"CollectionV1"),Sd(i)))}Nn.fetchAllCollectionV1=oue;async function aue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Ma.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Sd(i))}Nn.safeFetchAllCollectionV1=aue;function cue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Ma.gpaBuilder)(t,e).registerFields({key:[0,(0,nue.getKeySerializer)()],updateAuthority:[1,(0,dg.publicKey)()],name:[33,(0,dg.string)()],uri:[null,(0,dg.string)()],numMinted:[null,(0,dg.u32)()],currentSize:[null,(0,dg.u32)()]}).deserializeUsing(r=>Sd(r))}Nn.getCollectionV1GpaBuilder=cue});var Nq=_(Ln=>{"use strict";a();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getGroupV1GpaBuilder=Ln.safeFetchAllGroupV1=Ln.fetchAllGroupV1=Ln.safeFetchGroupV1=Ln.fetchGroupV1=Ln.deserializeGroupV1=void 0;var Na=U(),rs=N(),uue=ug(),Mq=ce();function vd(t){return(0,Na.deserializeAccount)(t,(0,uue.getGroupV1AccountDataSerializer)())}Ln.deserializeGroupV1=vd;async function lue(t,e,r){let n=await t.rpc.getAccount((0,Na.publicKey)(e,!1),r);return(0,Na.assertAccountExists)(n,"GroupV1"),vd(n)}Ln.fetchGroupV1=lue;async function due(t,e,r){let n=await t.rpc.getAccount((0,Na.publicKey)(e,!1),r);return n.exists?vd(n):null}Ln.safeFetchGroupV1=due;async function fue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Na.publicKey)(i,!1)),r)).map(i=>((0,Na.assertAccountExists)(i,"GroupV1"),vd(i)))}Ln.fetchAllGroupV1=fue;async function pue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Na.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>vd(i))}Ln.safeFetchAllGroupV1=pue;function hue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Na.gpaBuilder)(t,e).registerFields({key:[0,(0,Mq.getKeySerializer)()],updateAuthority:[1,(0,rs.publicKey)()],name:[33,(0,rs.string)()],uri:[null,(0,rs.string)()],collections:[null,(0,rs.array)((0,rs.publicKey)())],groups:[null,(0,rs.array)((0,rs.publicKey)())],parentGroups:[null,(0,rs.array)((0,rs.publicKey)())],assets:[null,(0,rs.array)((0,rs.publicKey)())]}).deserializeUsing(r=>vd(r)).whereField("key",Mq.Key.GroupV1)}Ln.getGroupV1GpaBuilder=hue});var qq=_(Cr=>{"use strict";a();Object.defineProperty(Cr,"__esModule",{value:!0});Cr.getHashedAssetV1Size=Cr.getHashedAssetV1GpaBuilder=Cr.safeFetchAllHashedAssetV1=Cr.fetchAllHashedAssetV1=Cr.safeFetchHashedAssetV1=Cr.fetchHashedAssetV1=Cr.deserializeHashedAssetV1=Cr.getHashedAssetV1AccountDataSerializer=void 0;var La=U(),rO=N(),Lq=ce();function Dq(){return(0,rO.struct)([["key",(0,Lq.getKeySerializer)()],["hash",(0,rO.bytes)({size:32})]],{description:"HashedAssetV1AccountData"})}Cr.getHashedAssetV1AccountDataSerializer=Dq;function Ed(t){return(0,La.deserializeAccount)(t,Dq())}Cr.deserializeHashedAssetV1=Ed;async function gue(t,e,r){let n=await t.rpc.getAccount((0,La.publicKey)(e,!1),r);return(0,La.assertAccountExists)(n,"HashedAssetV1"),Ed(n)}Cr.fetchHashedAssetV1=gue;async function mue(t,e,r){let n=await t.rpc.getAccount((0,La.publicKey)(e,!1),r);return n.exists?Ed(n):null}Cr.safeFetchHashedAssetV1=mue;async function yue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,La.publicKey)(i,!1)),r)).map(i=>((0,La.assertAccountExists)(i,"HashedAssetV1"),Ed(i)))}Cr.fetchAllHashedAssetV1=yue;async function bue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,La.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Ed(i))}Cr.safeFetchAllHashedAssetV1=bue;function Aue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,La.gpaBuilder)(t,e).registerFields({key:[0,(0,Lq.getKeySerializer)()],hash:[1,(0,rO.bytes)({size:32})]}).deserializeUsing(r=>Ed(r))}Cr.getHashedAssetV1GpaBuilder=Aue;function _ue(){return 33}Cr.getHashedAssetV1Size=_ue});var Kq=_(Mr=>{"use strict";a();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.getPluginHeaderV1Size=Mr.getPluginHeaderV1GpaBuilder=Mr.safeFetchAllPluginHeaderV1=Mr.fetchAllPluginHeaderV1=Mr.safeFetchPluginHeaderV1=Mr.fetchPluginHeaderV1=Mr.deserializePluginHeaderV1=Mr.getPluginHeaderV1AccountDataSerializer=void 0;var Da=U(),nO=N(),Uq=ce();function Vq(){return(0,nO.struct)([["key",(0,Uq.getKeySerializer)()],["pluginRegistryOffset",(0,nO.u64)()]],{description:"PluginHeaderV1AccountData"})}Mr.getPluginHeaderV1AccountDataSerializer=Vq;function wd(t){return(0,Da.deserializeAccount)(t,Vq())}Mr.deserializePluginHeaderV1=wd;async function Sue(t,e,r){let n=await t.rpc.getAccount((0,Da.publicKey)(e,!1),r);return(0,Da.assertAccountExists)(n,"PluginHeaderV1"),wd(n)}Mr.fetchPluginHeaderV1=Sue;async function vue(t,e,r){let n=await t.rpc.getAccount((0,Da.publicKey)(e,!1),r);return n.exists?wd(n):null}Mr.safeFetchPluginHeaderV1=vue;async function Eue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Da.publicKey)(i,!1)),r)).map(i=>((0,Da.assertAccountExists)(i,"PluginHeaderV1"),wd(i)))}Mr.fetchAllPluginHeaderV1=Eue;async function wue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Da.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>wd(i))}Mr.safeFetchAllPluginHeaderV1=wue;function xue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,Da.gpaBuilder)(t,e).registerFields({key:[0,(0,Uq.getKeySerializer)()],pluginRegistryOffset:[1,(0,nO.u64)()]}).deserializeUsing(r=>wd(r))}Mr.getPluginHeaderV1GpaBuilder=xue;function Iue(){return 9}Mr.getPluginHeaderV1Size=Iue});var Wq=_(Dn=>{"use strict";a();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.getPluginRegistryV1GpaBuilder=Dn.safeFetchAllPluginRegistryV1=Dn.fetchAllPluginRegistryV1=Dn.safeFetchPluginRegistryV1=Dn.fetchPluginRegistryV1=Dn.deserializePluginRegistryV1=void 0;var qa=U(),Fq=N(),Pue=ug(),iO=ce();function xd(t){return(0,qa.deserializeAccount)(t,(0,Pue.getPluginRegistryV1AccountDataSerializer)())}Dn.deserializePluginRegistryV1=xd;async function Rue(t,e,r){let n=await t.rpc.getAccount((0,qa.publicKey)(e,!1),r);return(0,qa.assertAccountExists)(n,"PluginRegistryV1"),xd(n)}Dn.fetchPluginRegistryV1=Rue;async function Oue(t,e,r){let n=await t.rpc.getAccount((0,qa.publicKey)(e,!1),r);return n.exists?xd(n):null}Dn.safeFetchPluginRegistryV1=Oue;async function Tue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,qa.publicKey)(i,!1)),r)).map(i=>((0,qa.assertAccountExists)(i,"PluginRegistryV1"),xd(i)))}Dn.fetchAllPluginRegistryV1=Tue;async function Bue(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,qa.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>xd(i))}Dn.safeFetchAllPluginRegistryV1=Bue;function zue(t){let e=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d");return(0,qa.gpaBuilder)(t,e).registerFields({key:[0,(0,iO.getKeySerializer)()],registry:[1,(0,Fq.array)((0,iO.getRegistryRecordSerializer)())],externalRegistry:[null,(0,Fq.array)((0,iO.getExternalRegistryRecordSerializer)())]}).deserializeUsing(r=>xd(r))}Dn.getPluginRegistryV1GpaBuilder=zue});var sO=_(ri=>{"use strict";a();var kue=ri&&ri.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Au=ri&&ri.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kue(e,t,r)};Object.defineProperty(ri,"__esModule",{value:!0});Au(K2(),ri);Au(kq(),ri);Au(Cq(),ri);Au(Nq(),ri);Au(qq(),ri);Au(Kq(),ri);Au(Wq(),ri)});var jq=_(Z=>{"use strict";a();Object.defineProperty(Z,"__esModule",{value:!0});Z.InvalidExecutePdaError=Z.PermanentDelegatesPreventMoveError=Z.CannotAddDataSectionError=Z.InvalidPluginAdapterTargetError=Z.NoDataSourcesError=Z.UnsupportedOperationError=Z.TwoDataSourcesError=Z.CollectionMustBeEmptyError=Z.InvalidPluginOperationError=Z.MissingSignerError=Z.UninitializedOracleAccountError=Z.InvalidOracleAccountDataError=Z.DuplicateLifecycleChecksError=Z.RequiresLifecycleCheckError=Z.OracleCanRejectOnlyError=Z.MissingExternalPluginAdapterAccountError=Z.MissingAssetError=Z.ExternalPluginAdapterAlreadyExistsError=Z.ExternalPluginAdapterNotFoundError=Z.InvalidLogWrapperProgramError=Z.ConflictingAuthorityError=Z.InvalidPluginSettingError=Z.CannotRedelegateError=Z.NoApprovalsError=Z.MissingCollectionError=Z.InvalidAssetError=Z.NotAvailableError=Z.MissingSystemProgramError=Z.MissingNewOwnerError=Z.MissingUpdateAuthorityError=Z.InvalidCollectionError=Z.AlreadyDecompressedError=Z.AlreadyCompressedError=Z.NumericalOverflowErrorError=Z.PluginAlreadyExistsError=Z.CannotBurnCollectionError=Z.CannotMigratePrintsError=Z.CannotMigrateMasterWithSupplyError=Z.MissingCompressionProofError=Z.AssetIsFrozenError=Z.InvalidAuthorityError=Z.InvalidPluginError=Z.IncorrectAssetHashError=Z.IncorrectAccountError=Z.NumericalOverflowError=Z.PluginNotFoundError=Z.PluginsNotInitializedError=Z.SerializationErrorError=Z.DeserializationErrorError=Z.InvalidSystemProgramError=void 0;Z.getMplCoreErrorFromName=Z.getMplCoreErrorFromCode=Z.InconsistentGroupRelationshipError=Z.GroupNestingDepthExceededError=Z.GroupVectorFullError=Z.DuplicateEntryError=Z.GroupMustBeEmptyError=Z.AgentIdentityMustSignError=Z.BlockedByBubblegumV2Error=void 0;var me=U(),he=new Map,ge=new Map,fg=class extends me.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Z.InvalidSystemProgramError=fg;he.set(0,fg);ge.set("InvalidSystemProgram",fg);var pg=class extends me.ProgramError{constructor(e,r){super("Error deserializing account",e,r),this.name="DeserializationError",this.code=1}};Z.DeserializationErrorError=pg;he.set(1,pg);ge.set("DeserializationError",pg);var hg=class extends me.ProgramError{constructor(e,r){super("Error serializing account",e,r),this.name="SerializationError",this.code=2}};Z.SerializationErrorError=hg;he.set(2,hg);ge.set("SerializationError",hg);var gg=class extends me.ProgramError{constructor(e,r){super("Plugins not initialized",e,r),this.name="PluginsNotInitialized",this.code=3}};Z.PluginsNotInitializedError=gg;he.set(3,gg);ge.set("PluginsNotInitialized",gg);var mg=class extends me.ProgramError{constructor(e,r){super("Plugin not found",e,r),this.name="PluginNotFound",this.code=4}};Z.PluginNotFoundError=mg;he.set(4,mg);ge.set("PluginNotFound",mg);var yg=class extends me.ProgramError{constructor(e,r){super("Numerical Overflow",e,r),this.name="NumericalOverflow",this.code=5}};Z.NumericalOverflowError=yg;he.set(5,yg);ge.set("NumericalOverflow",yg);var bg=class extends me.ProgramError{constructor(e,r){super("Incorrect account",e,r),this.name="IncorrectAccount",this.code=6}};Z.IncorrectAccountError=bg;he.set(6,bg);ge.set("IncorrectAccount",bg);var Ag=class extends me.ProgramError{constructor(e,r){super("Incorrect asset hash",e,r),this.name="IncorrectAssetHash",this.code=7}};Z.IncorrectAssetHashError=Ag;he.set(7,Ag);ge.set("IncorrectAssetHash",Ag);var _g=class extends me.ProgramError{constructor(e,r){super("Invalid Plugin",e,r),this.name="InvalidPlugin",this.code=8}};Z.InvalidPluginError=_g;he.set(8,_g);ge.set("InvalidPlugin",_g);var Sg=class extends me.ProgramError{constructor(e,r){super("Invalid Authority",e,r),this.name="InvalidAuthority",this.code=9}};Z.InvalidAuthorityError=Sg;he.set(9,Sg);ge.set("InvalidAuthority",Sg);var vg=class extends me.ProgramError{constructor(e,r){super("Cannot transfer a frozen asset",e,r),this.name="AssetIsFrozen",this.code=10}};Z.AssetIsFrozenError=vg;he.set(10,vg);ge.set("AssetIsFrozen",vg);var Eg=class extends me.ProgramError{constructor(e,r){super("Missing compression proof",e,r),this.name="MissingCompressionProof",this.code=11}};Z.MissingCompressionProofError=Eg;he.set(11,Eg);ge.set("MissingCompressionProof",Eg);var wg=class extends me.ProgramError{constructor(e,r){super("Cannot migrate a master edition used for prints",e,r),this.name="CannotMigrateMasterWithSupply",this.code=12}};Z.CannotMigrateMasterWithSupplyError=wg;he.set(12,wg);ge.set("CannotMigrateMasterWithSupply",wg);var xg=class extends me.ProgramError{constructor(e,r){super("Cannot migrate a print edition",e,r),this.name="CannotMigratePrints",this.code=13}};Z.CannotMigratePrintsError=xg;he.set(13,xg);ge.set("CannotMigratePrints",xg);var Ig=class extends me.ProgramError{constructor(e,r){super("Cannot burn a collection NFT",e,r),this.name="CannotBurnCollection",this.code=14}};Z.CannotBurnCollectionError=Ig;he.set(14,Ig);ge.set("CannotBurnCollection",Ig);var Pg=class extends me.ProgramError{constructor(e,r){super("Plugin already exists",e,r),this.name="PluginAlreadyExists",this.code=15}};Z.PluginAlreadyExistsError=Pg;he.set(15,Pg);ge.set("PluginAlreadyExists",Pg);var Rg=class extends me.ProgramError{constructor(e,r){super("Numerical overflow",e,r),this.name="NumericalOverflowError",this.code=16}};Z.NumericalOverflowErrorError=Rg;he.set(16,Rg);ge.set("NumericalOverflowError",Rg);var Og=class extends me.ProgramError{constructor(e,r){super("Already compressed account",e,r),this.name="AlreadyCompressed",this.code=17}};Z.AlreadyCompressedError=Og;he.set(17,Og);ge.set("AlreadyCompressed",Og);var Tg=class extends me.ProgramError{constructor(e,r){super("Already decompressed account",e,r),this.name="AlreadyDecompressed",this.code=18}};Z.AlreadyDecompressedError=Tg;he.set(18,Tg);ge.set("AlreadyDecompressed",Tg);var Bg=class extends me.ProgramError{constructor(e,r){super("Invalid Collection passed in",e,r),this.name="InvalidCollection",this.code=19}};Z.InvalidCollectionError=Bg;he.set(19,Bg);ge.set("InvalidCollection",Bg);var zg=class extends me.ProgramError{constructor(e,r){super("Missing update authority",e,r),this.name="MissingUpdateAuthority",this.code=20}};Z.MissingUpdateAuthorityError=zg;he.set(20,zg);ge.set("MissingUpdateAuthority",zg);var kg=class extends me.ProgramError{constructor(e,r){super("Missing new owner",e,r),this.name="MissingNewOwner",this.code=21}};Z.MissingNewOwnerError=kg;he.set(21,kg);ge.set("MissingNewOwner",kg);var Cg=class extends me.ProgramError{constructor(e,r){super("Missing system program",e,r),this.name="MissingSystemProgram",this.code=22}};Z.MissingSystemProgramError=Cg;he.set(22,Cg);ge.set("MissingSystemProgram",Cg);var Mg=class extends me.ProgramError{constructor(e,r){super("Feature not available",e,r),this.name="NotAvailable",this.code=23}};Z.NotAvailableError=Mg;he.set(23,Mg);ge.set("NotAvailable",Mg);var Ng=class extends me.ProgramError{constructor(e,r){super("Invalid Asset passed in",e,r),this.name="InvalidAsset",this.code=24}};Z.InvalidAssetError=Ng;he.set(24,Ng);ge.set("InvalidAsset",Ng);var Lg=class extends me.ProgramError{constructor(e,r){super("Missing collection",e,r),this.name="MissingCollection",this.code=25}};Z.MissingCollectionError=Lg;he.set(25,Lg);ge.set("MissingCollection",Lg);var Dg=class extends me.ProgramError{constructor(e,r){super("Neither the asset or any plugins have approved this operation",e,r),this.name="NoApprovals",this.code=26}};Z.NoApprovalsError=Dg;he.set(26,Dg);ge.set("NoApprovals",Dg);var qg=class extends me.ProgramError{constructor(e,r){super("Plugin Manager cannot redelegate a delegated plugin without revoking first",e,r),this.name="CannotRedelegate",this.code=27}};Z.CannotRedelegateError=qg;he.set(27,qg);ge.set("CannotRedelegate",qg);var Ug=class extends me.ProgramError{constructor(e,r){super("Invalid setting for plugin",e,r),this.name="InvalidPluginSetting",this.code=28}};Z.InvalidPluginSettingError=Ug;he.set(28,Ug);ge.set("InvalidPluginSetting",Ug);var Vg=class extends me.ProgramError{constructor(e,r){super("Cannot specify both an update authority and collection on an asset",e,r),this.name="ConflictingAuthority",this.code=29}};Z.ConflictingAuthorityError=Vg;he.set(29,Vg);ge.set("ConflictingAuthority",Vg);var Kg=class extends me.ProgramError{constructor(e,r){super("Invalid Log Wrapper Program",e,r),this.name="InvalidLogWrapperProgram",this.code=30}};Z.InvalidLogWrapperProgramError=Kg;he.set(30,Kg);ge.set("InvalidLogWrapperProgram",Kg);var Fg=class extends me.ProgramError{constructor(e,r){super("External Plugin Adapter not found",e,r),this.name="ExternalPluginAdapterNotFound",this.code=31}};Z.ExternalPluginAdapterNotFoundError=Fg;he.set(31,Fg);ge.set("ExternalPluginAdapterNotFound",Fg);var Wg=class extends me.ProgramError{constructor(e,r){super("External Plugin Adapter already exists",e,r),this.name="ExternalPluginAdapterAlreadyExists",this.code=32}};Z.ExternalPluginAdapterAlreadyExistsError=Wg;he.set(32,Wg);ge.set("ExternalPluginAdapterAlreadyExists",Wg);var jg=class extends me.ProgramError{constructor(e,r){super("Missing asset needed for extra account PDA derivation",e,r),this.name="MissingAsset",this.code=33}};Z.MissingAssetError=jg;he.set(33,jg);ge.set("MissingAsset",jg);var Hg=class extends me.ProgramError{constructor(e,r){super("Missing account needed for external plugin adapter",e,r),this.name="MissingExternalPluginAdapterAccount",this.code=34}};Z.MissingExternalPluginAdapterAccountError=Hg;he.set(34,Hg);ge.set("MissingExternalPluginAdapterAccount",Hg);var Gg=class extends me.ProgramError{constructor(e,r){super("Oracle external plugin adapter can only be configured to reject",e,r),this.name="OracleCanRejectOnly",this.code=35}};Z.OracleCanRejectOnlyError=Gg;he.set(35,Gg);ge.set("OracleCanRejectOnly",Gg);var $g=class extends me.ProgramError{constructor(e,r){super("External plugin adapter must have at least one lifecycle check",e,r),this.name="RequiresLifecycleCheck",this.code=36}};Z.RequiresLifecycleCheckError=$g;he.set(36,$g);ge.set("RequiresLifecycleCheck",$g);var Zg=class extends me.ProgramError{constructor(e,r){super("Duplicate lifecycle checks were provided for external plugin adapter ",e,r),this.name="DuplicateLifecycleChecks",this.code=37}};Z.DuplicateLifecycleChecksError=Zg;he.set(37,Zg);ge.set("DuplicateLifecycleChecks",Zg);var Xg=class extends me.ProgramError{constructor(e,r){super("Could not read from oracle account",e,r),this.name="InvalidOracleAccountData",this.code=38}};Z.InvalidOracleAccountDataError=Xg;he.set(38,Xg);ge.set("InvalidOracleAccountData",Xg);var Yg=class extends me.ProgramError{constructor(e,r){super("Oracle account is uninitialized",e,r),this.name="UninitializedOracleAccount",this.code=39}};Z.UninitializedOracleAccountError=Yg;he.set(39,Yg);ge.set("UninitializedOracleAccount",Yg);var Jg=class extends me.ProgramError{constructor(e,r){super("Missing required signer for operation",e,r),this.name="MissingSigner",this.code=40}};Z.MissingSignerError=Jg;he.set(40,Jg);ge.set("MissingSigner",Jg);var Qg=class extends me.ProgramError{constructor(e,r){super("Invalid plugin operation",e,r),this.name="InvalidPluginOperation",this.code=41}};Z.InvalidPluginOperationError=Qg;he.set(41,Qg);ge.set("InvalidPluginOperation",Qg);var em=class extends me.ProgramError{constructor(e,r){super("Collection must be empty to be burned",e,r),this.name="CollectionMustBeEmpty",this.code=42}};Z.CollectionMustBeEmptyError=em;he.set(42,em);ge.set("CollectionMustBeEmpty",em);var tm=class extends me.ProgramError{constructor(e,r){super("Two data sources provided, only one is allowed",e,r),this.name="TwoDataSources",this.code=43}};Z.TwoDataSourcesError=tm;he.set(43,tm);ge.set("TwoDataSources",tm);var rm=class extends me.ProgramError{constructor(e,r){super("External Plugin does not support this operation",e,r),this.name="UnsupportedOperation",this.code=44}};Z.UnsupportedOperationError=rm;he.set(44,rm);ge.set("UnsupportedOperation",rm);var nm=class extends me.ProgramError{constructor(e,r){super("No data sources provided, one is required",e,r),this.name="NoDataSources",this.code=45}};Z.NoDataSourcesError=nm;he.set(45,nm);ge.set("NoDataSources",nm);var im=class extends me.ProgramError{constructor(e,r){super("This plugin adapter cannot be added to an Asset",e,r),this.name="InvalidPluginAdapterTarget",this.code=46}};Z.InvalidPluginAdapterTargetError=im;he.set(46,im);ge.set("InvalidPluginAdapterTarget",im);var sm=class extends me.ProgramError{constructor(e,r){super("Cannot add a Data Section without a linked external plugin",e,r),this.name="CannotAddDataSection",this.code=47}};Z.CannotAddDataSectionError=sm;he.set(47,sm);ge.set("CannotAddDataSection",sm);var om=class extends me.ProgramError{constructor(e,r){super("Cannot move asset to collection with permanent delegates",e,r),this.name="PermanentDelegatesPreventMove",this.code=48}};Z.PermanentDelegatesPreventMoveError=om;he.set(48,om);ge.set("PermanentDelegatesPreventMove",om);var am=class extends me.ProgramError{constructor(e,r){super("Invalid Signing PDA for Asset or Collection Execute",e,r),this.name="InvalidExecutePda",this.code=49}};Z.InvalidExecutePdaError=am;he.set(49,am);ge.set("InvalidExecutePda",am);var cm=class extends me.ProgramError{constructor(e,r){super("Bubblegum V2 Plugin limits other plugins",e,r),this.name="BlockedByBubblegumV2",this.code=50}};Z.BlockedByBubblegumV2Error=cm;he.set(50,cm);ge.set("BlockedByBubblegumV2",cm);var um=class extends me.ProgramError{constructor(e,r){super("Agent Identity Program must sign",e,r),this.name="AgentIdentityMustSign",this.code=51}};Z.AgentIdentityMustSignError=um;he.set(51,um);ge.set("AgentIdentityMustSign",um);var lm=class extends me.ProgramError{constructor(e,r){super("Group must be empty to be closed",e,r),this.name="GroupMustBeEmpty",this.code=52}};Z.GroupMustBeEmptyError=lm;he.set(52,lm);ge.set("GroupMustBeEmpty",lm);var dm=class extends me.ProgramError{constructor(e,r){super("Duplicate entry provided when adding relationships to a group",e,r),this.name="DuplicateEntry",this.code=53}};Z.DuplicateEntryError=dm;he.set(53,dm);ge.set("DuplicateEntry",dm);var fm=class extends me.ProgramError{constructor(e,r){super("Group vector is at maximum capacity",e,r),this.name="GroupVectorFull",this.code=54}};Z.GroupVectorFullError=fm;he.set(54,fm);ge.set("GroupVectorFull",fm);var pm=class extends me.ProgramError{constructor(e,r){super("Group nesting depth exceeded",e,r),this.name="GroupNestingDepthExceeded",this.code=55}};Z.GroupNestingDepthExceededError=pm;he.set(55,pm);ge.set("GroupNestingDepthExceeded",pm);var hm=class extends me.ProgramError{constructor(e,r){super("Bidirectional group relationship is inconsistent",e,r),this.name="InconsistentGroupRelationship",this.code=56}};Z.InconsistentGroupRelationshipError=hm;he.set(56,hm);ge.set("InconsistentGroupRelationship",hm);function Cue(t,e,r){let n=he.get(t);return n?new n(e,r):null}Z.getMplCoreErrorFromCode=Cue;function Mue(t,e,r){let n=ge.get(t);return n?new n(e,r):null}Z.getMplCoreErrorFromName=Mue});var oO=_(_u=>{"use strict";a();var Nue=_u&&_u.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Lue=_u&&_u.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Nue(e,t,r)};Object.defineProperty(_u,"__esModule",{value:!0});Lue(jq(),_u)});var Oe=_(Bs=>{"use strict";a();Object.defineProperty(Bs,"__esModule",{value:!0});Bs.getAccountMetasAndSigners=Bs.expectPda=Bs.expectPublicKey=Bs.expectSome=void 0;var gm=U();function Due(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Bs.expectSome=Due;function que(t){if(!t)throw new Error("Expected a PublicKey.");return(0,gm.publicKey)(t,!1)}Bs.expectPublicKey=que;function Uue(t){if(!t||!Array.isArray(t)||!(0,gm.isPda)(t))throw new Error("Expected a PDA.");return t}Bs.expectPda=Uue;function Vue(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,gm.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,gm.publicKey)(s.value,!1),isSigner:(0,gm.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Bs.getAccountMetasAndSigners=Vue});var Gq=_(Id=>{"use strict";a();Object.defineProperty(Id,"__esModule",{value:!0});Id.addAssetsToGroupV1=Id.getAddAssetsToGroupV1InstructionDataSerializer=void 0;var Kue=U(),aO=N(),Fue=Oe();function Hq(){return(0,aO.mapSerializer)((0,aO.struct)([["discriminator",(0,aO.u8)()]],{description:"AddAssetsToGroupV1InstructionData"}),t=>({...t,discriminator:35}))}Id.getAddAssetsToGroupV1InstructionDataSerializer=Hq;function Wue(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Fue.getAccountMetasAndSigners)(i,"programId",r),c=Hq().serialize({});return(0,Kue.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Id.addAssetsToGroupV1=Wue});var Zq=_(Pd=>{"use strict";a();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.addCollectionExternalPluginAdapterV1=Pd.getAddCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var jue=U(),cO=N(),Hue=Oe(),Gue=ce();function $q(){return(0,cO.mapSerializer)((0,cO.struct)([["discriminator",(0,cO.u8)()],["initInfo",(0,Gue.getBaseExternalPluginAdapterInitInfoSerializer)()]],{description:"AddCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:23}))}Pd.getAddCollectionExternalPluginAdapterV1InstructionDataSerializer=$q;function $ue(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Hue.getAccountMetasAndSigners)(s,"programId",r),u=$q().serialize(i);return(0,jue.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Pd.addCollectionExternalPluginAdapterV1=$ue});var Qq=_(Rd=>{"use strict";a();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.addCollectionPluginV1=Rd.getAddCollectionPluginV1InstructionDataSerializer=void 0;var Yq=U(),f_=N(),Zue=Oe(),Xq=ce();function Jq(){return(0,f_.mapSerializer)((0,f_.struct)([["discriminator",(0,f_.u8)()],["plugin",(0,Xq.getPluginSerializer)()],["initAuthority",(0,f_.option)((0,Xq.getBasePluginAuthoritySerializer)())]],{description:"AddCollectionPluginV1InstructionData"}),t=>({...t,discriminator:3,initAuthority:t.initAuthority??(0,Yq.none)()}))}Rd.getAddCollectionPluginV1InstructionDataSerializer=Jq;function Xue(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Zue.getAccountMetasAndSigners)(s,"programId",r),u=Jq().serialize(i);return(0,Yq.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Rd.addCollectionPluginV1=Xue});var t6=_(Od=>{"use strict";a();Object.defineProperty(Od,"__esModule",{value:!0});Od.addCollectionsToGroupV1=Od.getAddCollectionsToGroupV1InstructionDataSerializer=void 0;var Yue=U(),uO=N(),Jue=Oe();function e6(){return(0,uO.mapSerializer)((0,uO.struct)([["discriminator",(0,uO.u8)()]],{description:"AddCollectionsToGroupV1InstructionData"}),t=>({...t,discriminator:33}))}Od.getAddCollectionsToGroupV1InstructionDataSerializer=e6;function Que(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Jue.getAccountMetasAndSigners)(i,"programId",r),c=e6().serialize({});return(0,Yue.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Od.addCollectionsToGroupV1=Que});var n6=_(Td=>{"use strict";a();Object.defineProperty(Td,"__esModule",{value:!0});Td.addExternalPluginAdapterV1=Td.getAddExternalPluginAdapterV1InstructionDataSerializer=void 0;var ele=U(),lO=N(),tle=Oe(),rle=ce();function r6(){return(0,lO.mapSerializer)((0,lO.struct)([["discriminator",(0,lO.u8)()],["initInfo",(0,rle.getBaseExternalPluginAdapterInitInfoSerializer)()]],{description:"AddExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:22}))}Td.getAddExternalPluginAdapterV1InstructionDataSerializer=r6;function nle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,tle.getAccountMetasAndSigners)(s,"programId",r),u=r6().serialize(i);return(0,ele.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Td.addExternalPluginAdapterV1=nle});var s6=_(Bd=>{"use strict";a();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.addGroupsToGroupV1=Bd.getAddGroupsToGroupV1InstructionDataSerializer=void 0;var ile=U(),mm=N(),sle=Oe();function i6(){return(0,mm.mapSerializer)((0,mm.struct)([["discriminator",(0,mm.u8)()],["groups",(0,mm.array)((0,mm.publicKey)())]],{description:"AddGroupsToGroupV1InstructionData"}),t=>({...t,discriminator:37}))}Bd.getAddGroupsToGroupV1InstructionDataSerializer=i6;function ole(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={parentGroup:{index:0,isWritable:!0,value:e.parentGroup??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,sle.getAccountMetasAndSigners)(s,"programId",r),u=i6().serialize(i);return(0,ile.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Bd.addGroupsToGroupV1=ole});var u6=_(zd=>{"use strict";a();Object.defineProperty(zd,"__esModule",{value:!0});zd.addPluginV1=zd.getAddPluginV1InstructionDataSerializer=void 0;var a6=U(),p_=N(),ale=Oe(),o6=ce();function c6(){return(0,p_.mapSerializer)((0,p_.struct)([["discriminator",(0,p_.u8)()],["plugin",(0,o6.getPluginSerializer)()],["initAuthority",(0,p_.option)((0,o6.getBasePluginAuthoritySerializer)())]],{description:"AddPluginV1InstructionData"}),t=>({...t,discriminator:2,initAuthority:t.initAuthority??(0,a6.none)()}))}zd.getAddPluginV1InstructionDataSerializer=c6;function cle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ale.getAccountMetasAndSigners)(s,"programId",r),u=c6().serialize(i);return(0,a6.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}zd.addPluginV1=cle});var f6=_(kd=>{"use strict";a();Object.defineProperty(kd,"__esModule",{value:!0});kd.approveCollectionPluginAuthorityV1=kd.getApproveCollectionPluginAuthorityV1InstructionDataSerializer=void 0;var ule=U(),dO=N(),lle=Oe(),l6=ce();function d6(){return(0,dO.mapSerializer)((0,dO.struct)([["discriminator",(0,dO.u8)()],["pluginType",(0,l6.getPluginTypeSerializer)()],["newAuthority",(0,l6.getBasePluginAuthoritySerializer)()]],{description:"ApproveCollectionPluginAuthorityV1InstructionData"}),t=>({...t,discriminator:9}))}kd.getApproveCollectionPluginAuthorityV1InstructionDataSerializer=d6;function dle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,lle.getAccountMetasAndSigners)(s,"programId",r),u=d6().serialize(i);return(0,ule.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}kd.approveCollectionPluginAuthorityV1=dle});var g6=_(Cd=>{"use strict";a();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.approvePluginAuthorityV1=Cd.getApprovePluginAuthorityV1InstructionDataSerializer=void 0;var fle=U(),fO=N(),ple=Oe(),p6=ce();function h6(){return(0,fO.mapSerializer)((0,fO.struct)([["discriminator",(0,fO.u8)()],["pluginType",(0,p6.getPluginTypeSerializer)()],["newAuthority",(0,p6.getBasePluginAuthoritySerializer)()]],{description:"ApprovePluginAuthorityV1InstructionData"}),t=>({...t,discriminator:8}))}Cd.getApprovePluginAuthorityV1InstructionDataSerializer=h6;function hle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ple.getAccountMetasAndSigners)(s,"programId",r),u=h6().serialize(i);return(0,fle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Cd.approvePluginAuthorityV1=hle});var y6=_(Md=>{"use strict";a();Object.defineProperty(Md,"__esModule",{value:!0});Md.burnCollectionV1=Md.getBurnCollectionV1InstructionDataSerializer=void 0;var gle=U(),h_=N(),mle=Oe(),yle=ce();function m6(){return(0,h_.mapSerializer)((0,h_.struct)([["discriminator",(0,h_.u8)()],["compressionProof",(0,h_.option)((0,yle.getCompressionProofSerializer)())]],{description:"BurnCollectionV1InstructionData"}),t=>({...t,discriminator:13}))}Md.getBurnCollectionV1InstructionDataSerializer=m6;function ble(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!0,value:e.authority??null},logWrapper:{index:3,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,mle.getAccountMetasAndSigners)(s,"programId",r),u=m6().serialize(i);return(0,gle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Md.burnCollectionV1=ble});var _6=_(Nd=>{"use strict";a();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.burnV1=Nd.getBurnV1InstructionDataSerializer=void 0;var b6=U(),g_=N(),Ale=Oe(),_le=ce();function A6(){return(0,g_.mapSerializer)((0,g_.struct)([["discriminator",(0,g_.u8)()],["compressionProof",(0,g_.option)((0,_le.getCompressionProofSerializer)())]],{description:"BurnV1InstructionData"}),t=>({...t,discriminator:12,compressionProof:t.compressionProof??(0,b6.none)()}))}Nd.getBurnV1InstructionDataSerializer=A6;function Sle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Ale.getAccountMetasAndSigners)(s,"programId",r),u=A6().serialize(i);return(0,b6.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Nd.burnV1=Sle});var v6=_(Ld=>{"use strict";a();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.closeGroupV1=Ld.getCloseGroupV1InstructionDataSerializer=void 0;var vle=U(),pO=N(),Ele=Oe();function S6(){return(0,pO.mapSerializer)((0,pO.struct)([["discriminator",(0,pO.u8)()]],{description:"CloseGroupV1InstructionData"}),t=>({...t,discriminator:40}))}Ld.getCloseGroupV1InstructionDataSerializer=S6;function wle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null}};n.payer.value||(n.payer.value=t.payer);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Ele.getAccountMetasAndSigners)(i,"programId",r),c=S6().serialize({});return(0,vle.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ld.closeGroupV1=wle});var w6=_(Dd=>{"use strict";a();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.collect=Dd.getCollectInstructionDataSerializer=void 0;var hO=U(),gO=N(),xle=Oe();function E6(){return(0,gO.mapSerializer)((0,gO.struct)([["discriminator",(0,gO.u8)()]],{description:"CollectInstructionData"}),t=>({...t,discriminator:19}))}Dd.getCollectInstructionDataSerializer=E6;function Ile(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={recipient1:{index:0,isWritable:!0,value:e.recipient1??null},recipient2:{index:1,isWritable:!0,value:e.recipient2??null}};n.recipient1.value||(n.recipient1.value=(0,hO.publicKey)("8AT6o8Qk5T9QnZvPThMrF9bcCQLTGkyGvVZZzHgCw11v")),n.recipient2.value||(n.recipient2.value=(0,hO.publicKey)("MmHsqX4LxTfifxoH8BVRLUKrwDn1LPCac6YcCZTHhwt"));let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,xle.getAccountMetasAndSigners)(i,"programId",r),c=E6().serialize({});return(0,hO.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Dd.collect=Ile});var I6=_(qd=>{"use strict";a();Object.defineProperty(qd,"__esModule",{value:!0});qd.compressV1=qd.getCompressV1InstructionDataSerializer=void 0;var Ple=U(),mO=N(),Rle=Oe();function x6(){return(0,mO.mapSerializer)((0,mO.struct)([["discriminator",(0,mO.u8)()]],{description:"CompressV1InstructionData"}),t=>({...t,discriminator:17}))}qd.getCompressV1InstructionDataSerializer=x6;function Ole(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Rle.getAccountMetasAndSigners)(i,"programId",r),c=x6().serialize({});return(0,Ple.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}qd.compressV1=Ole});var O6=_(Ud=>{"use strict";a();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.createCollectionV1=Ud.getCreateCollectionV1InstructionDataSerializer=void 0;var P6=U(),Su=N(),Tle=Oe(),Ble=ce();function R6(){return(0,Su.mapSerializer)((0,Su.struct)([["discriminator",(0,Su.u8)()],["name",(0,Su.string)()],["uri",(0,Su.string)()],["plugins",(0,Su.option)((0,Su.array)((0,Ble.getPluginAuthorityPairSerializer)()))]],{description:"CreateCollectionV1InstructionData"}),t=>({...t,discriminator:1,plugins:t.plugins??(0,P6.none)()}))}Ud.getCreateCollectionV1InstructionDataSerializer=R6;function zle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Tle.getAccountMetasAndSigners)(s,"programId",r),u=R6().serialize(i);return(0,P6.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Ud.createCollectionV1=zle});var k6=_(Vd=>{"use strict";a();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.createCollectionV2=Vd.getCreateCollectionV2InstructionDataSerializer=void 0;var B6=U(),xo=N(),kle=Oe(),T6=ce();function z6(){return(0,xo.mapSerializer)((0,xo.struct)([["discriminator",(0,xo.u8)()],["name",(0,xo.string)()],["uri",(0,xo.string)()],["plugins",(0,xo.option)((0,xo.array)((0,T6.getPluginAuthorityPairSerializer)()))],["externalPluginAdapters",(0,xo.option)((0,xo.array)((0,T6.getBaseExternalPluginAdapterInitInfoSerializer)()))]],{description:"CreateCollectionV2InstructionData"}),t=>({...t,discriminator:21,plugins:t.plugins??(0,B6.none)(),externalPluginAdapters:t.externalPluginAdapters??[]}))}Vd.getCreateCollectionV2InstructionDataSerializer=z6;function Cle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,kle.getAccountMetasAndSigners)(s,"programId",r),u=z6().serialize(i);return(0,B6.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Vd.createCollectionV2=Cle});var M6=_(Fd=>{"use strict";a();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.createGroupV1=Fd.getCreateGroupV1InstructionDataSerializer=void 0;var Mle=U(),Kd=N(),Nle=Oe(),Lle=ce();function C6(){return(0,Kd.mapSerializer)((0,Kd.struct)([["discriminator",(0,Kd.u8)()],["name",(0,Kd.string)()],["uri",(0,Kd.string)()],["relationships",(0,Kd.array)((0,Lle.getRelationshipEntrySerializer)())]],{description:"CreateGroupV1InstructionData"}),t=>({...t,discriminator:39}))}Fd.getCreateGroupV1InstructionDataSerializer=C6;function Dle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},updateAuthority:{index:1,isWritable:!1,value:e.updateAuthority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Nle.getAccountMetasAndSigners)(s,"programId",r),u=C6().serialize(i);return(0,Mle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Fd.createGroupV1=Dle});var L6=_(Wd=>{"use strict";a();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.createV1=Wd.getCreateV1InstructionDataSerializer=void 0;var qle=U(),vu=N(),Ule=Oe(),yO=ce();function N6(){return(0,vu.mapSerializer)((0,vu.struct)([["discriminator",(0,vu.u8)()],["dataState",(0,yO.getDataStateSerializer)()],["name",(0,vu.string)()],["uri",(0,vu.string)()],["plugins",(0,vu.option)((0,vu.array)((0,yO.getPluginAuthorityPairSerializer)()))]],{description:"CreateV1InstructionData"}),t=>({...t,discriminator:0,dataState:t.dataState??yO.DataState.AccountState,plugins:t.plugins??[]}))}Wd.getCreateV1InstructionDataSerializer=N6;function Vle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},payer:{index:3,isWritable:!0,value:e.payer??null},owner:{index:4,isWritable:!1,value:e.owner??null},updateAuthority:{index:5,isWritable:!1,value:e.updateAuthority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Ule.getAccountMetasAndSigners)(s,"programId",r),u=N6().serialize(i);return(0,qle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Wd.createV1=Vle});var q6=_(jd=>{"use strict";a();Object.defineProperty(jd,"__esModule",{value:!0});jd.createV2=jd.getCreateV2InstructionDataSerializer=void 0;var Kle=U(),Io=N(),Fle=Oe(),m_=ce();function D6(){return(0,Io.mapSerializer)((0,Io.struct)([["discriminator",(0,Io.u8)()],["dataState",(0,m_.getDataStateSerializer)()],["name",(0,Io.string)()],["uri",(0,Io.string)()],["plugins",(0,Io.option)((0,Io.array)((0,m_.getPluginAuthorityPairSerializer)()))],["externalPluginAdapters",(0,Io.option)((0,Io.array)((0,m_.getBaseExternalPluginAdapterInitInfoSerializer)()))]],{description:"CreateV2InstructionData"}),t=>({...t,discriminator:20,dataState:t.dataState??m_.DataState.AccountState,plugins:t.plugins??[],externalPluginAdapters:t.externalPluginAdapters??[]}))}jd.getCreateV2InstructionDataSerializer=D6;function Wle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},payer:{index:3,isWritable:!0,value:e.payer??null},owner:{index:4,isWritable:!1,value:e.owner??null},updateAuthority:{index:5,isWritable:!1,value:e.updateAuthority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Fle.getAccountMetasAndSigners)(s,"programId",r),u=D6().serialize(i);return(0,Kle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}jd.createV2=Wle});var V6=_(Hd=>{"use strict";a();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.decompressV1=Hd.getDecompressV1InstructionDataSerializer=void 0;var jle=U(),bO=N(),Hle=Oe(),Gle=ce();function U6(){return(0,bO.mapSerializer)((0,bO.struct)([["discriminator",(0,bO.u8)()],["compressionProof",(0,Gle.getCompressionProofSerializer)()]],{description:"DecompressV1InstructionData"}),t=>({...t,discriminator:18}))}Hd.getDecompressV1InstructionDataSerializer=U6;function $le(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Hle.getAccountMetasAndSigners)(s,"programId",r),u=U6().serialize(i);return(0,jle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Hd.decompressV1=$le});var W6=_(Gd=>{"use strict";a();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.executeV1=Gd.getExecuteV1InstructionDataSerializer=void 0;var Zle=U(),ym=N(),Xle=sO(),K6=Oe();function F6(){return(0,ym.mapSerializer)((0,ym.struct)([["discriminator",(0,ym.u8)()],["instructionData",(0,ym.bytes)({size:(0,ym.u32)()})]],{description:"ExecuteV1InstructionData"}),t=>({...t,discriminator:31}))}Gd.getExecuteV1InstructionDataSerializer=F6;function Yle(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},assetSigner:{index:2,isWritable:!1,value:e.assetSigner??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},programId:{index:6,isWritable:!1,value:e.programId??null}},i={...e};n.assetSigner.value||(n.assetSigner.value=(0,Xle.findAssetSignerPda)(t,{asset:(0,K6.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1),n.programId.value||(n.programId.value=r,n.programId.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,K6.getAccountMetasAndSigners)(s,"programId",r),u=F6().serialize(i);return(0,Zle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Gd.executeV1=Yle});var H6=_($d=>{"use strict";a();Object.defineProperty($d,"__esModule",{value:!0});$d.removeAssetsFromGroupV1=$d.getRemoveAssetsFromGroupV1InstructionDataSerializer=void 0;var Jle=U(),bm=N(),Qle=Oe();function j6(){return(0,bm.mapSerializer)((0,bm.struct)([["discriminator",(0,bm.u8)()],["assets",(0,bm.array)((0,bm.publicKey)())]],{description:"RemoveAssetsFromGroupV1InstructionData"}),t=>({...t,discriminator:36}))}$d.getRemoveAssetsFromGroupV1InstructionDataSerializer=j6;function ede(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Qle.getAccountMetasAndSigners)(s,"programId",r),u=j6().serialize(i);return(0,Jle.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}$d.removeAssetsFromGroupV1=ede});var $6=_(Zd=>{"use strict";a();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.removeCollectionExternalPluginAdapterV1=Zd.getRemoveCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var tde=U(),AO=N(),rde=Oe(),nde=ce();function G6(){return(0,AO.mapSerializer)((0,AO.struct)([["discriminator",(0,AO.u8)()],["key",(0,nde.getBaseExternalPluginAdapterKeySerializer)()]],{description:"RemoveCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:25}))}Zd.getRemoveCollectionExternalPluginAdapterV1InstructionDataSerializer=G6;function ide(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,rde.getAccountMetasAndSigners)(s,"programId",r),u=G6().serialize(i);return(0,tde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Zd.removeCollectionExternalPluginAdapterV1=ide});var X6=_(Xd=>{"use strict";a();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.removeCollectionPluginV1=Xd.getRemoveCollectionPluginV1InstructionDataSerializer=void 0;var sde=U(),_O=N(),ode=Oe(),ade=ce();function Z6(){return(0,_O.mapSerializer)((0,_O.struct)([["discriminator",(0,_O.u8)()],["pluginType",(0,ade.getPluginTypeSerializer)()]],{description:"RemoveCollectionPluginV1InstructionData"}),t=>({...t,discriminator:5}))}Xd.getRemoveCollectionPluginV1InstructionDataSerializer=Z6;function cde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ode.getAccountMetasAndSigners)(s,"programId",r),u=Z6().serialize(i);return(0,sde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Xd.removeCollectionPluginV1=cde});var J6=_(Yd=>{"use strict";a();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.removeCollectionsFromGroupV1=Yd.getRemoveCollectionsFromGroupV1InstructionDataSerializer=void 0;var ude=U(),Am=N(),lde=Oe();function Y6(){return(0,Am.mapSerializer)((0,Am.struct)([["discriminator",(0,Am.u8)()],["collections",(0,Am.array)((0,Am.publicKey)())]],{description:"RemoveCollectionsFromGroupV1InstructionData"}),t=>({...t,discriminator:34}))}Yd.getRemoveCollectionsFromGroupV1InstructionDataSerializer=Y6;function dde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,lde.getAccountMetasAndSigners)(s,"programId",r),u=Y6().serialize(i);return(0,ude.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Yd.removeCollectionsFromGroupV1=dde});var e3=_(Jd=>{"use strict";a();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.removeExternalPluginAdapterV1=Jd.getRemoveExternalPluginAdapterV1InstructionDataSerializer=void 0;var fde=U(),SO=N(),pde=Oe(),hde=ce();function Q6(){return(0,SO.mapSerializer)((0,SO.struct)([["discriminator",(0,SO.u8)()],["key",(0,hde.getBaseExternalPluginAdapterKeySerializer)()]],{description:"RemoveExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:24}))}Jd.getRemoveExternalPluginAdapterV1InstructionDataSerializer=Q6;function gde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,pde.getAccountMetasAndSigners)(s,"programId",r),u=Q6().serialize(i);return(0,fde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Jd.removeExternalPluginAdapterV1=gde});var r3=_(Qd=>{"use strict";a();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.removeGroupsFromGroupV1=Qd.getRemoveGroupsFromGroupV1InstructionDataSerializer=void 0;var mde=U(),_m=N(),yde=Oe();function t3(){return(0,_m.mapSerializer)((0,_m.struct)([["discriminator",(0,_m.u8)()],["groups",(0,_m.array)((0,_m.publicKey)())]],{description:"RemoveGroupsFromGroupV1InstructionData"}),t=>({...t,discriminator:38}))}Qd.getRemoveGroupsFromGroupV1InstructionDataSerializer=t3;function bde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={parentGroup:{index:0,isWritable:!0,value:e.parentGroup??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,yde.getAccountMetasAndSigners)(s,"programId",r),u=t3().serialize(i);return(0,mde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Qd.removeGroupsFromGroupV1=bde});var i3=_(ef=>{"use strict";a();Object.defineProperty(ef,"__esModule",{value:!0});ef.removePluginV1=ef.getRemovePluginV1InstructionDataSerializer=void 0;var Ade=U(),vO=N(),_de=Oe(),Sde=ce();function n3(){return(0,vO.mapSerializer)((0,vO.struct)([["discriminator",(0,vO.u8)()],["pluginType",(0,Sde.getPluginTypeSerializer)()]],{description:"RemovePluginV1InstructionData"}),t=>({...t,discriminator:4}))}ef.getRemovePluginV1InstructionDataSerializer=n3;function vde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,_de.getAccountMetasAndSigners)(s,"programId",r),u=n3().serialize(i);return(0,Ade.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ef.removePluginV1=vde});var o3=_(tf=>{"use strict";a();Object.defineProperty(tf,"__esModule",{value:!0});tf.revokeCollectionPluginAuthorityV1=tf.getRevokeCollectionPluginAuthorityV1InstructionDataSerializer=void 0;var Ede=U(),EO=N(),wde=Oe(),xde=ce();function s3(){return(0,EO.mapSerializer)((0,EO.struct)([["discriminator",(0,EO.u8)()],["pluginType",(0,xde.getPluginTypeSerializer)()]],{description:"RevokeCollectionPluginAuthorityV1InstructionData"}),t=>({...t,discriminator:11}))}tf.getRevokeCollectionPluginAuthorityV1InstructionDataSerializer=s3;function Ide(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,wde.getAccountMetasAndSigners)(s,"programId",r),u=s3().serialize(i);return(0,Ede.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}tf.revokeCollectionPluginAuthorityV1=Ide});var c3=_(rf=>{"use strict";a();Object.defineProperty(rf,"__esModule",{value:!0});rf.revokePluginAuthorityV1=rf.getRevokePluginAuthorityV1InstructionDataSerializer=void 0;var Pde=U(),wO=N(),Rde=Oe(),Ode=ce();function a3(){return(0,wO.mapSerializer)((0,wO.struct)([["discriminator",(0,wO.u8)()],["pluginType",(0,Ode.getPluginTypeSerializer)()]],{description:"RevokePluginAuthorityV1InstructionData"}),t=>({...t,discriminator:10}))}rf.getRevokePluginAuthorityV1InstructionDataSerializer=a3;function Tde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Rde.getAccountMetasAndSigners)(s,"programId",r),u=a3().serialize(i);return(0,Pde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}rf.revokePluginAuthorityV1=Tde});var d3=_(nf=>{"use strict";a();Object.defineProperty(nf,"__esModule",{value:!0});nf.transferV1=nf.getTransferV1InstructionDataSerializer=void 0;var u3=U(),y_=N(),Bde=Oe(),zde=ce();function l3(){return(0,y_.mapSerializer)((0,y_.struct)([["discriminator",(0,y_.u8)()],["compressionProof",(0,y_.option)((0,zde.getCompressionProofSerializer)())]],{description:"TransferV1InstructionData"}),t=>({...t,discriminator:14,compressionProof:t.compressionProof??(0,u3.none)()}))}nf.getTransferV1InstructionDataSerializer=l3;function kde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},newOwner:{index:4,isWritable:!1,value:e.newOwner??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Bde.getAccountMetasAndSigners)(s,"programId",r),u=l3().serialize(i);return(0,u3.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}nf.transferV1=kde});var h3=_(sf=>{"use strict";a();Object.defineProperty(sf,"__esModule",{value:!0});sf.updateCollectionExternalPluginAdapterV1=sf.getUpdateCollectionExternalPluginAdapterV1InstructionDataSerializer=void 0;var Cde=U(),xO=N(),Mde=Oe(),f3=ce();function p3(){return(0,xO.mapSerializer)((0,xO.struct)([["discriminator",(0,xO.u8)()],["key",(0,f3.getBaseExternalPluginAdapterKeySerializer)()],["updateInfo",(0,f3.getBaseExternalPluginAdapterUpdateInfoSerializer)()]],{description:"UpdateCollectionExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:27}))}sf.getUpdateCollectionExternalPluginAdapterV1InstructionDataSerializer=p3;function Nde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Mde.getAccountMetasAndSigners)(s,"programId",r),u=p3().serialize(i);return(0,Cde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}sf.updateCollectionExternalPluginAdapterV1=Nde});var m3=_(of=>{"use strict";a();Object.defineProperty(of,"__esModule",{value:!0});of.updateCollectionInfoV1=of.getUpdateCollectionInfoV1InstructionDataSerializer=void 0;var Lde=U(),b_=N(),Dde=Oe(),qde=ce();function g3(){return(0,b_.mapSerializer)((0,b_.struct)([["discriminator",(0,b_.u8)()],["updateType",(0,qde.getUpdateTypeSerializer)()],["amount",(0,b_.u32)()]],{description:"UpdateCollectionInfoV1InstructionData"}),t=>({...t,discriminator:32}))}of.getUpdateCollectionInfoV1InstructionDataSerializer=g3;function Ude(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},bubblegumSigner:{index:1,isWritable:!1,value:e.bubblegumSigner??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Dde.getAccountMetasAndSigners)(s,"programId",r),u=g3().serialize(i);return(0,Lde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}of.updateCollectionInfoV1=Ude});var b3=_(af=>{"use strict";a();Object.defineProperty(af,"__esModule",{value:!0});af.updateCollectionPluginV1=af.getUpdateCollectionPluginV1InstructionDataSerializer=void 0;var Vde=U(),IO=N(),Kde=Oe(),Fde=ce();function y3(){return(0,IO.mapSerializer)((0,IO.struct)([["discriminator",(0,IO.u8)()],["plugin",(0,Fde.getPluginSerializer)()]],{description:"UpdateCollectionPluginV1InstructionData"}),t=>({...t,discriminator:7}))}af.getUpdateCollectionPluginV1InstructionDataSerializer=y3;function Wde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Kde.getAccountMetasAndSigners)(s,"programId",r),u=y3().serialize(i);return(0,Vde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}af.updateCollectionPluginV1=Wde});var _3=_(cf=>{"use strict";a();Object.defineProperty(cf,"__esModule",{value:!0});cf.updateCollectionV1=cf.getUpdateCollectionV1InstructionDataSerializer=void 0;var PO=U(),Eu=N(),jde=Oe();function A3(){return(0,Eu.mapSerializer)((0,Eu.struct)([["discriminator",(0,Eu.u8)()],["newName",(0,Eu.option)((0,Eu.string)())],["newUri",(0,Eu.option)((0,Eu.string)())]],{description:"UpdateCollectionV1InstructionData"}),t=>({...t,discriminator:16,newName:t.newName??(0,PO.none)(),newUri:t.newUri??(0,PO.none)()}))}cf.getUpdateCollectionV1InstructionDataSerializer=A3;function Hde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},newUpdateAuthority:{index:3,isWritable:!1,value:e.newUpdateAuthority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,jde.getAccountMetasAndSigners)(s,"programId",r),u=A3().serialize(i);return(0,PO.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}cf.updateCollectionV1=Hde});var E3=_(uf=>{"use strict";a();Object.defineProperty(uf,"__esModule",{value:!0});uf.updateExternalPluginAdapterV1=uf.getUpdateExternalPluginAdapterV1InstructionDataSerializer=void 0;var Gde=U(),RO=N(),$de=Oe(),S3=ce();function v3(){return(0,RO.mapSerializer)((0,RO.struct)([["discriminator",(0,RO.u8)()],["key",(0,S3.getBaseExternalPluginAdapterKeySerializer)()],["updateInfo",(0,S3.getBaseExternalPluginAdapterUpdateInfoSerializer)()]],{description:"UpdateExternalPluginAdapterV1InstructionData"}),t=>({...t,discriminator:26}))}uf.getUpdateExternalPluginAdapterV1InstructionDataSerializer=v3;function Zde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,$de.getAccountMetasAndSigners)(s,"programId",r),u=v3().serialize(i);return(0,Gde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}uf.updateExternalPluginAdapterV1=Zde});var x3=_(lf=>{"use strict";a();Object.defineProperty(lf,"__esModule",{value:!0});lf.updateGroupV1=lf.getUpdateGroupV1InstructionDataSerializer=void 0;var OO=U(),wu=N(),Xde=Oe();function w3(){return(0,wu.mapSerializer)((0,wu.struct)([["discriminator",(0,wu.u8)()],["newName",(0,wu.option)((0,wu.string)())],["newUri",(0,wu.option)((0,wu.string)())]],{description:"UpdateGroupV1InstructionData"}),t=>({...t,discriminator:41,newName:t.newName??(0,OO.none)(),newUri:t.newUri??(0,OO.none)()}))}lf.getUpdateGroupV1InstructionDataSerializer=w3;function Yde(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={group:{index:0,isWritable:!0,value:e.group??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},newUpdateAuthority:{index:3,isWritable:!1,value:e.newUpdateAuthority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Xde.getAccountMetasAndSigners)(s,"programId",r),u=w3().serialize(i);return(0,OO.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}lf.updateGroupV1=Yde});var P3=_(df=>{"use strict";a();Object.defineProperty(df,"__esModule",{value:!0});df.updatePluginV1=df.getUpdatePluginV1InstructionDataSerializer=void 0;var Jde=U(),TO=N(),Qde=Oe(),efe=ce();function I3(){return(0,TO.mapSerializer)((0,TO.struct)([["discriminator",(0,TO.u8)()],["plugin",(0,efe.getPluginSerializer)()]],{description:"UpdatePluginV1InstructionData"}),t=>({...t,discriminator:6}))}df.getUpdatePluginV1InstructionDataSerializer=I3;function tfe(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Qde.getAccountMetasAndSigners)(s,"programId",r),u=I3().serialize(i);return(0,Jde.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}df.updatePluginV1=tfe});var O3=_(ff=>{"use strict";a();Object.defineProperty(ff,"__esModule",{value:!0});ff.updateV1=ff.getUpdateV1InstructionDataSerializer=void 0;var A_=U(),Ua=N(),rfe=Oe(),nfe=ce();function R3(){return(0,Ua.mapSerializer)((0,Ua.struct)([["discriminator",(0,Ua.u8)()],["newName",(0,Ua.option)((0,Ua.string)())],["newUri",(0,Ua.option)((0,Ua.string)())],["newUpdateAuthority",(0,Ua.option)((0,nfe.getBaseUpdateAuthoritySerializer)())]],{description:"UpdateV1InstructionData"}),t=>({...t,discriminator:15,newName:t.newName??(0,A_.none)(),newUri:t.newUri??(0,A_.none)(),newUpdateAuthority:t.newUpdateAuthority??(0,A_.none)()}))}ff.getUpdateV1InstructionDataSerializer=R3;function ife(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!1,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,rfe.getAccountMetasAndSigners)(s,"programId",r),u=R3().serialize(i);return(0,A_.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}ff.updateV1=ife});var B3=_(pf=>{"use strict";a();Object.defineProperty(pf,"__esModule",{value:!0});pf.updateV2=pf.getUpdateV2InstructionDataSerializer=void 0;var __=U(),Va=N(),sfe=Oe(),ofe=ce();function T3(){return(0,Va.mapSerializer)((0,Va.struct)([["discriminator",(0,Va.u8)()],["newName",(0,Va.option)((0,Va.string)())],["newUri",(0,Va.option)((0,Va.string)())],["newUpdateAuthority",(0,Va.option)((0,ofe.getBaseUpdateAuthoritySerializer)())]],{description:"UpdateV2InstructionData"}),t=>({...t,discriminator:30,newName:t.newName??(0,__.none)(),newUri:t.newUri??(0,__.none)(),newUpdateAuthority:t.newUpdateAuthority??(0,__.none)()}))}pf.getUpdateV2InstructionDataSerializer=T3;function afe(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},newCollection:{index:4,isWritable:!0,value:e.newCollection??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,sfe.getAccountMetasAndSigners)(s,"programId",r),u=T3().serialize(i);return(0,__.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}pf.updateV2=afe});var k3=_(gf=>{"use strict";a();Object.defineProperty(gf,"__esModule",{value:!0});gf.writeCollectionExternalPluginAdapterDataV1=gf.getWriteCollectionExternalPluginAdapterDataV1InstructionDataSerializer=void 0;var cfe=U(),hf=N(),ufe=Oe(),lfe=ce();function z3(){return(0,hf.mapSerializer)((0,hf.struct)([["discriminator",(0,hf.u8)()],["key",(0,lfe.getBaseExternalPluginAdapterKeySerializer)()],["data",(0,hf.option)((0,hf.bytes)({size:(0,hf.u32)()}))]],{description:"WriteCollectionExternalPluginAdapterDataV1InstructionData"}),t=>({...t,discriminator:29}))}gf.getWriteCollectionExternalPluginAdapterDataV1InstructionDataSerializer=z3;function dfe(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={collection:{index:0,isWritable:!0,value:e.collection??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},buffer:{index:3,isWritable:!1,value:e.buffer??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:5,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ufe.getAccountMetasAndSigners)(s,"programId",r),u=z3().serialize(i);return(0,cfe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}gf.writeCollectionExternalPluginAdapterDataV1=dfe});var M3=_(yf=>{"use strict";a();Object.defineProperty(yf,"__esModule",{value:!0});yf.writeExternalPluginAdapterDataV1=yf.getWriteExternalPluginAdapterDataV1InstructionDataSerializer=void 0;var ffe=U(),mf=N(),pfe=Oe(),hfe=ce();function C3(){return(0,mf.mapSerializer)((0,mf.struct)([["discriminator",(0,mf.u8)()],["key",(0,hfe.getBaseExternalPluginAdapterKeySerializer)()],["data",(0,mf.option)((0,mf.bytes)({size:(0,mf.u32)()}))]],{description:"WriteExternalPluginAdapterDataV1InstructionData"}),t=>({...t,discriminator:28}))}yf.getWriteExternalPluginAdapterDataV1InstructionDataSerializer=C3;function gfe(t,e){let r=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n={asset:{index:0,isWritable:!0,value:e.asset??null},collection:{index:1,isWritable:!0,value:e.collection??null},payer:{index:2,isWritable:!0,value:e.payer??null},authority:{index:3,isWritable:!1,value:e.authority??null},buffer:{index:4,isWritable:!1,value:e.buffer??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},logWrapper:{index:6,isWritable:!1,value:e.logWrapper??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,pfe.getAccountMetasAndSigners)(s,"programId",r),u=C3().serialize(i);return(0,ffe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}yf.writeExternalPluginAdapterDataV1=gfe});var N3=_(we=>{"use strict";a();var mfe=we&&we.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ze=we&&we.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mfe(e,t,r)};Object.defineProperty(we,"__esModule",{value:!0});ze(Gq(),we);ze(Zq(),we);ze(Qq(),we);ze(t6(),we);ze(n6(),we);ze(s6(),we);ze(u6(),we);ze(f6(),we);ze(g6(),we);ze(y6(),we);ze(_6(),we);ze(v6(),we);ze(w6(),we);ze(I6(),we);ze(O6(),we);ze(k6(),we);ze(M6(),we);ze(L6(),we);ze(q6(),we);ze(V6(),we);ze(W6(),we);ze(H6(),we);ze($6(),we);ze(X6(),we);ze(J6(),we);ze(e3(),we);ze(r3(),we);ze(i3(),we);ze(o3(),we);ze(c3(),we);ze(d3(),we);ze(h3(),we);ze(m3(),we);ze(b3(),we);ze(_3(),we);ze(E3(),we);ze(x3(),we);ze(P3(),we);ze(O3(),we);ze(B3(),we);ze(k3(),we);ze(M3(),we)});var D3=_(yi=>{"use strict";a();Object.defineProperty(yi,"__esModule",{value:!0});yi.getMplCoreProgramId=yi.getMplCoreProgram=yi.createMplCoreProgram=yi.MPL_CORE_PROGRAM_ID=void 0;var L3=oO();yi.MPL_CORE_PROGRAM_ID="CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d";function yfe(){return{name:"mplCore",publicKey:yi.MPL_CORE_PROGRAM_ID,getErrorFromCode(t,e){return(0,L3.getMplCoreErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,L3.getMplCoreErrorFromName)(t,this,e)},isOnCluster(){return!0}}}yi.createMplCoreProgram=yfe;function bfe(t,e){return t.programs.get("mplCore",e)}yi.getMplCoreProgram=bfe;function Afe(t,e){return t.programs.getPublicKey("mplCore",yi.MPL_CORE_PROGRAM_ID,e)}yi.getMplCoreProgramId=Afe});var q3=_(xu=>{"use strict";a();var _fe=xu&&xu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Sfe=xu&&xu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_fe(e,t,r)};Object.defineProperty(xu,"__esModule",{value:!0});Sfe(D3(),xu)});var xe=_(bi=>{"use strict";a();var vfe=bi&&bi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),bf=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vfe(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});bf(sO(),bi);bf(oO(),bi);bf(N3(),bi);bf(q3(),bi);bf(Oe(),bi);bf(ce(),bi)});var U3=_(S_=>{"use strict";a();Object.defineProperty(S_,"__esModule",{value:!0});S_.mplCore=void 0;var Efe=xe(),wfe=()=>({install(t){t.programs.add((0,Efe.createMplCoreProgram)(),!1)}});S_.mplCore=wfe});var c4=_(Te=>{"use strict";a();Object.defineProperty(Te,"__esModule",{value:!0});Te.toBig=Te.shrSL=Te.shrSH=Te.rotrSL=Te.rotrSH=Te.rotrBL=Te.rotrBH=Te.rotr32L=Te.rotr32H=Te.rotlSL=Te.rotlSH=Te.rotlBL=Te.rotlBH=Te.add5L=Te.add5H=Te.add4L=Te.add4H=Te.add3L=Te.add3H=void 0;Te.add=t4;Te.fromBig=zO;Te.split=V3;var v_=BigInt(2**32-1),BO=BigInt(32);function zO(t,e=!1){return e?{h:Number(t&v_),l:Number(t>>BO&v_)}:{h:Number(t>>BO&v_)|0,l:Number(t&v_)|0}}function V3(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:o,l:c}=zO(t[s],e);[n[s],i[s]]=[o,c]}return[n,i]}var K3=(t,e)=>BigInt(t>>>0)<<BO|BigInt(e>>>0);Te.toBig=K3;var F3=(t,e,r)=>t>>>r;Te.shrSH=F3;var W3=(t,e,r)=>t<<32-r|e>>>r;Te.shrSL=W3;var j3=(t,e,r)=>t>>>r|e<<32-r;Te.rotrSH=j3;var H3=(t,e,r)=>t<<32-r|e>>>r;Te.rotrSL=H3;var G3=(t,e,r)=>t<<64-r|e>>>r-32;Te.rotrBH=G3;var $3=(t,e,r)=>t>>>r-32|e<<64-r;Te.rotrBL=$3;var Z3=(t,e)=>e;Te.rotr32H=Z3;var X3=(t,e)=>t;Te.rotr32L=X3;var Y3=(t,e,r)=>t<<r|e>>>32-r;Te.rotlSH=Y3;var J3=(t,e,r)=>e<<r|t>>>32-r;Te.rotlSL=J3;var Q3=(t,e,r)=>e<<r-32|t>>>64-r;Te.rotlBH=Q3;var e4=(t,e,r)=>t<<r-32|e>>>64-r;Te.rotlBL=e4;function t4(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var r4=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);Te.add3L=r4;var n4=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;Te.add3H=n4;var i4=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);Te.add4L=i4;var s4=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;Te.add4H=s4;var o4=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Te.add5L=o4;var a4=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0;Te.add5H=a4;var xfe={fromBig:zO,split:V3,toBig:K3,shrSH:F3,shrSL:W3,rotrSH:j3,rotrSL:H3,rotrBH:G3,rotrBL:$3,rotr32H:Z3,rotr32L:X3,rotlSH:Y3,rotlSL:J3,rotlBH:Q3,rotlBL:e4,add:t4,add3L:r4,add3H:n4,add4L:i4,add4H:s4,add5H:a4,add5L:o4};Te.default=xfe});var u4=_(E_=>{"use strict";a();Object.defineProperty(E_,"__esModule",{value:!0});E_.crypto=void 0;E_.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var y4=_(_e=>{"use strict";a();Object.defineProperty(_e,"__esModule",{value:!0});_e.wrapXOFConstructorWithOpts=_e.wrapConstructorWithOpts=_e.wrapConstructor=_e.Hash=_e.nextTick=_e.swap32IfBE=_e.byteSwapIfBE=_e.swap8IfBE=_e.isLE=void 0;_e.isBytes=d4;_e.anumber=kO;_e.abytes=_f;_e.ahash=Ife;_e.aexists=Pfe;_e.aoutput=Rfe;_e.u8=Ofe;_e.u32=Tfe;_e.clean=Bfe;_e.createView=zfe;_e.rotr=kfe;_e.rotl=Cfe;_e.byteSwap=MO;_e.byteSwap32=f4;_e.bytesToHex=Nfe;_e.hexToBytes=Lfe;_e.asyncLoop=qfe;_e.utf8ToBytes=NO;_e.bytesToUtf8=Ufe;_e.toBytes=w_;_e.kdfInputToBytes=Vfe;_e.concatBytes=Kfe;_e.checkOpts=Ffe;_e.createHasher=h4;_e.createOptHasher=g4;_e.createXOFer=m4;_e.randomBytes=Wfe;var Af=u4();function d4(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function kO(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function _f(t,...e){if(!d4(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Ife(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");kO(t.outputLen),kO(t.blockLen)}function Pfe(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Rfe(t,e){_f(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Ofe(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function Tfe(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Bfe(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function zfe(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function kfe(t,e){return t<<32-e|t>>>e}function Cfe(t,e){return t<<e|t>>>32-e>>>0}_e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function MO(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}_e.swap8IfBE=_e.isLE?t=>t:t=>MO(t);_e.byteSwapIfBE=_e.swap8IfBE;function f4(t){for(let e=0;e<t.length;e++)t[e]=MO(t[e]);return t}_e.swap32IfBE=_e.isLE?t=>t:f4;var p4=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mfe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Nfe(t){if(_f(t),p4)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=Mfe[t[r]];return e}var Po={_0:48,_9:57,A:65,F:70,a:97,f:102};function l4(t){if(t>=Po._0&&t<=Po._9)return t-Po._0;if(t>=Po.A&&t<=Po.F)return t-(Po.A-10);if(t>=Po.a&&t<=Po.f)return t-(Po.a-10)}function Lfe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(p4)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let o=l4(t.charCodeAt(s)),c=l4(t.charCodeAt(s+1));if(o===void 0||c===void 0){let u=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}var Dfe=async()=>{};_e.nextTick=Dfe;async function qfe(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let s=Date.now()-n;s>=0&&s<e||(await(0,_e.nextTick)(),n+=s)}}function NO(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Ufe(t){return new TextDecoder().decode(t)}function w_(t){return typeof t=="string"&&(t=NO(t)),_f(t),t}function Vfe(t){return typeof t=="string"&&(t=NO(t)),_f(t),t}function Kfe(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];_f(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}function Ffe(t,e){if(e!==void 0&&{}.toString.call(e)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(t,e)}var CO=class{};_e.Hash=CO;function h4(t){let e=n=>t().update(w_(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function g4(t){let e=(n,i)=>t(i).update(w_(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function m4(t){let e=(n,i)=>t(i).update(w_(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}_e.wrapConstructor=h4;_e.wrapConstructorWithOpts=g4;_e.wrapXOFConstructorWithOpts=m4;function Wfe(t=32){if(Af.crypto&&typeof Af.crypto.getRandomValues=="function")return Af.crypto.getRandomValues(new Uint8Array(t));if(Af.crypto&&typeof Af.crypto.randomBytes=="function")return Uint8Array.from(Af.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}});var I4=_(ot=>{"use strict";a();Object.defineProperty(ot,"__esModule",{value:!0});ot.shake256=ot.shake128=ot.keccak_512=ot.keccak_384=ot.keccak_256=ot.keccak_224=ot.sha3_512=ot.sha3_384=ot.sha3_256=ot.sha3_224=ot.Keccak=void 0;ot.keccakP=w4;var vm=c4(),pn=y4(),jfe=BigInt(0),Sm=BigInt(1),Hfe=BigInt(2),Gfe=BigInt(7),$fe=BigInt(256),Zfe=BigInt(113),_4=[],S4=[],v4=[];for(let t=0,e=Sm,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],_4.push(2*(5*n+r)),S4.push((t+1)*(t+2)/2%64);let i=jfe;for(let s=0;s<7;s++)e=(e<<Sm^(e>>Gfe)*Zfe)%$fe,e&Hfe&&(i^=Sm<<(Sm<<BigInt(s))-Sm);v4.push(i)}var E4=(0,vm.split)(v4,!0),Xfe=E4[0],Yfe=E4[1],b4=(t,e,r)=>r>32?(0,vm.rotlBH)(t,e,r):(0,vm.rotlSH)(t,e,r),A4=(t,e,r)=>r>32?(0,vm.rotlBL)(t,e,r):(0,vm.rotlSL)(t,e,r);function w4(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],m=b4(d,f,1)^r[c],A=A4(d,f,1)^r[c+1];for(let v=0;v<50;v+=10)t[o+v]^=m,t[o+v+1]^=A}let i=t[2],s=t[3];for(let o=0;o<24;o++){let c=S4[o],u=b4(i,s,c),d=A4(i,s,c),f=_4[o];i=t[f],s=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=Xfe[n],t[1]^=Yfe[n]}(0,pn.clean)(r)}var Em=class t extends pn.Hash{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,(0,pn.anumber)(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,pn.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,pn.swap32IfBE)(this.state32),w4(this.state32,this.rounds),(0,pn.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,pn.aexists)(this),e=(0,pn.toBytes)(e),(0,pn.abytes)(e);let{blockLen:r,state:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(r-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){(0,pn.aexists)(this,!1),(0,pn.abytes)(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}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,pn.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,pn.aoutput)(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,(0,pn.clean)(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new t(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};ot.Keccak=Em;var Ka=(t,e,r)=>(0,pn.createHasher)(()=>new Em(e,t,r));ot.sha3_224=Ka(6,144,224/8);ot.sha3_256=Ka(6,136,256/8);ot.sha3_384=Ka(6,104,384/8);ot.sha3_512=Ka(6,72,512/8);ot.keccak_224=Ka(1,144,224/8);ot.keccak_256=Ka(1,136,256/8);ot.keccak_384=Ka(1,104,384/8);ot.keccak_512=Ka(1,72,512/8);var x4=(t,e,r)=>(0,pn.createXOFer)((n={})=>new Em(e,t,n.dkLen===void 0?r:n.dkLen,!0));ot.shake128=x4(31,168,128/8);ot.shake256=x4(31,136,256/8)});var P4=_(x_=>{"use strict";a();Object.defineProperty(x_,"__esModule",{value:!0});x_.hash=void 0;var Jfe=N(),Qfe=I4();function epe(t){return(0,Qfe.keccak_256)(Array.isArray(t)?(0,Jfe.mergeBytes)(t):t)}x_.hash=epe});var P_=_(zs=>{"use strict";a();Object.defineProperty(zs,"__esModule",{value:!0});zs.addressPluginAuthority=zs.updatePluginAuthority=zs.ownerPluginAuthority=zs.nonePluginAuthority=void 0;var I_=Je();function tpe(){return(0,I_.pluginAuthority)("None")}zs.nonePluginAuthority=tpe;function rpe(){return(0,I_.pluginAuthority)("Owner")}zs.ownerPluginAuthority=rpe;function npe(){return(0,I_.pluginAuthority)("UpdateAuthority")}zs.updatePluginAuthority=npe;function ipe(t){return(0,I_.pluginAuthority)("Address",{address:t})}zs.addressPluginAuthority=ipe});var Sf=_(Nr=>{"use strict";a();Object.defineProperty(Nr,"__esModule",{value:!0});Nr.isAssetOwner=Nr.isFrozen=Nr.deriveAssetPlugins=Nr.deriveExternalPluginAdapters=Nr.getExternalPluginAdapterKeyAsString=Nr.collectionAddress=void 0;var spe=U(),ope=Je();function ape(t){if(t.updateAuthority.type==="Collection")return t.updateAuthority.address}Nr.collectionAddress=ape;var cpe=["oracles","appDatas","lifecycleHooks","dataSections","linkedAppDatas","agentIdentities"],upe=t=>{switch(t.type){case"Oracle":return`${t.type}-${t.baseAddress}`;case"AppData":return`${t.type}-${t.dataAuthority.type}${t.dataAuthority.address?`-${t.dataAuthority.address}`:""}`;case"LifecycleHook":return`${t.type}-${t.hookedProgram}`;case"LinkedAppData":return`${t.type}-${t.dataAuthority.type}${t.dataAuthority.address?`-${t.dataAuthority.address}`:""}`;case"DataSection":return`${t.type}-${(0,Nr.getExternalPluginAdapterKeyAsString)(t.parentKey)}`;case"AgentIdentity":return t.type;default:throw new Error("Unknown ExternalPluginAdapter type")}};Nr.getExternalPluginAdapterKeyAsString=upe;var lpe=(t,e)=>{if(!e)return t;let r={};return cpe.forEach(n=>{let i=new Set;(t[n]||e[n])&&(r[n]=[]),t[n]?.forEach(s=>{i.add((0,Nr.getExternalPluginAdapterKeyAsString)(s)),r[n]?.push(s)}),e[n]?.forEach(s=>{i.has((0,Nr.getExternalPluginAdapterKeyAsString)(s))||r[n]?.push(s)})}),r};Nr.deriveExternalPluginAdapters=lpe;function R4(t,e){if(!e)return t;let r=(0,Nr.deriveExternalPluginAdapters)(t,e);r.dataSections?.forEach(c=>{let u,d;if(c.parentKey.type==="LinkedAppData")d=c.parentKey.dataAuthority,u=r.linkedAppDatas?.find(f=>(0,ope.comparePluginAuthorities)(d,f.dataAuthority)),u&&(u.data=c.data);else throw new Error("LinkedLifecycleHook currently unsupported")});let{numMinted:n,currentSize:i,masterEdition:s,...o}=e;return{...o,...t,...r}}Nr.deriveAssetPlugins=R4;function dpe(t,e){let r=R4(t,e);return r.freezeDelegate?.frozen||r.permanentFreezeDelegate?.frozen||!1}Nr.isFrozen=dpe;function fpe(t,e){return(0,spe.publicKey)(t)===e.owner}Nr.isAssetOwner=fpe});var R_=_(Ai=>{"use strict";a();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.hasCollectionUpdateAuthority=Ai.hasAssetUpdateAuthority=Ai.hasPluginUpdateAuthority=Ai.hasPluginOwnerAuthority=Ai.hasPluginAddressAuthority=void 0;var LO=U(),O4=Sf();function ppe(t,e){return e.type==="Address"&&e.address===(0,LO.publicKey)(t)}Ai.hasPluginAddressAuthority=ppe;function hpe(t,e,r){return e.type==="Owner"&&(0,O4.isAssetOwner)(t,r)}Ai.hasPluginOwnerAuthority=hpe;function gpe(t,e,r,n){return e.type==="UpdateAuthority"&&T4(t,r,n)}Ai.hasPluginUpdateAuthority=gpe;function T4(t,e,r){let n=(0,LO.publicKey)(t),i=(0,O4.deriveAssetPlugins)(e,r);if(i.updateAuthority.type==="Collection"&&i.updateAuthority.address!==r?.publicKey)throw Error("Collection mismatch");return i.updateAuthority.type==="Address"&&i.updateAuthority.address===n||i.updateDelegate?.authority.type==="Address"&&i.updateDelegate?.authority.address===n||i.updateDelegate?.authority.type==="Owner"&&i.owner===n||i.updateAuthority.type==="Collection"&&r?.updateAuthority===n}Ai.hasAssetUpdateAuthority=T4;function mpe(t,e){let r=(0,LO.publicKey)(t);return e.updateAuthority===r||e.updateDelegate?.authority.type==="Address"&&e.updateDelegate?.authority.address===r}Ai.hasCollectionUpdateAuthority=mpe});var qO=_(Fa=>{"use strict";a();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.checkPluginAuthorities=Fa.pluginTypeFromAssetPluginKey=Fa.assetPluginKeyFromType=void 0;var ype=U(),z4=ld(),k4=xe(),DO=Sf(),B4=R_();function C4(t){return(0,z4.lowercaseFirstLetter)(k4.PluginType[t])}Fa.assetPluginKeyFromType=C4;function bpe(t){return k4.PluginType[(0,z4.capitalizeFirstLetter)(t)]}Fa.pluginTypeFromAssetPluginKey=bpe;function Ape({authority:t,pluginTypes:e,asset:r,collection:n}){let i=(0,DO.collectionAddress)(r);if(i&&i!==n?.publicKey)throw new Error("Collection mismatch");let s=(0,DO.deriveAssetPlugins)(r,n),o=(0,ype.publicKey)(t),c=(0,B4.hasAssetUpdateAuthority)(o,r,n),u=(0,DO.isAssetOwner)(o,r);return e.map(d=>{let f=s[C4(d)];return!!(f&&((0,B4.hasPluginAddressAuthority)(o,f.authority)||f.authority.type==="UpdateAuthority"&&c||f.authority.type==="Owner"&&u))})}Fa.checkPluginAuthorities=Ape});var N4=_(Xr=>{"use strict";a();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.validateUpdate=Xr.canUpdate=Xr.validateBurn=Xr.canBurn=Xr.validateTransfer=Xr.canTransfer=Xr.LifecycleValidationError=void 0;var ns=xe(),Wa=Sf(),ja=qO(),M4=R_(),ks=Je(),Ro;(function(t){t.OracleValidationFailed="Oracle validation failed.",t.NoAuthority="No authority to perform this action.",t.AssetFrozen="Asset is frozen."})(Ro=Xr.LifecycleValidationError||(Xr.LifecycleValidationError={}));function _pe(t,e,r){let n=(0,Wa.deriveAssetPlugins)(e,r);return(0,ja.checkPluginAuthorities)({authority:t,pluginTypes:[ns.PluginType.PermanentTransferDelegate],asset:n,collection:r}).some(o=>o)?!0:(0,Wa.isFrozen)(e,r)?!1:n.owner===t?!0:(0,ja.checkPluginAuthorities)({authority:t,pluginTypes:[ns.PluginType.TransferDelegate],asset:n,collection:r}).some(o=>o)}Xr.canTransfer=_pe;async function Spe(t,{authority:e,asset:r,collection:n,recipient:i}){let s=(0,Wa.deriveAssetPlugins)(r,n);if((0,ja.checkPluginAuthorities)({authority:e,pluginTypes:[ns.PluginType.PermanentTransferDelegate],asset:s,collection:n}).some(u=>u))return null;if((0,Wa.isFrozen)(r,n))return Ro.AssetFrozen;if(s.oracles?.length){let u=s.oracles.filter(d=>d.lifecycleChecks?.transfer?.includes(ks.CheckResult.CAN_REJECT)).filter(d=>!!(!d.baseAddressConfig||i||!(0,ks.getExtraAccountRequiredInputs)(d.baseAddressConfig).includes("recipient")));if(u.length){let d=u.map(A=>({pubkey:(0,ks.findOracleAccount)(t,A,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner,recipient:i}),offset:A.resultsOffset}));if(!(await t.rpc.getAccounts(d.map(A=>A.pubkey))).map((A,v)=>A.exists?(0,ks.deserializeOracleValidation)(A.data,d[v].offset):null).every(A=>A?.__kind==="Uninitialized"?!1:A?.transfer===ns.ExternalValidationResult.Pass))return Ro.OracleValidationFailed}}return s.owner===e||(0,ja.checkPluginAuthorities)({authority:e,pluginTypes:[ns.PluginType.TransferDelegate],asset:s,collection:n}).some(u=>u)?null:Ro.NoAuthority}Xr.validateTransfer=Spe;function vpe(t,e,r){let n=(0,Wa.deriveAssetPlugins)(e,r);return(0,ja.checkPluginAuthorities)({authority:t,pluginTypes:[ns.PluginType.PermanentBurnDelegate],asset:n,collection:r}).some(o=>o)?!0:(0,Wa.isFrozen)(e,r)?!1:n.owner===t?!0:(0,ja.checkPluginAuthorities)({authority:t,pluginTypes:[ns.PluginType.BurnDelegate],asset:e,collection:r}).some(o=>o)}Xr.canBurn=vpe;async function Epe(t,{authority:e,asset:r,collection:n}){let i=(0,Wa.deriveAssetPlugins)(r,n);if((0,ja.checkPluginAuthorities)({authority:e,pluginTypes:[ns.PluginType.PermanentBurnDelegate],asset:i,collection:n}).some(c=>c))return null;if((0,Wa.isFrozen)(r,n))return Ro.AssetFrozen;if(i.oracles?.length){let c=i.oracles.filter(u=>u.lifecycleChecks?.burn?.includes(ks.CheckResult.CAN_REJECT));if(c.length){let u=c.map(m=>({pubkey:(0,ks.findOracleAccount)(t,m,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner}),offset:m.resultsOffset}));if(!(await t.rpc.getAccounts(u.map(m=>m.pubkey))).map((m,A)=>m.exists?(0,ks.deserializeOracleValidation)(m.data,u[A].offset):null).every(m=>m?.__kind==="Uninitialized"?!1:m?.burn===ns.ExternalValidationResult.Pass))return Ro.OracleValidationFailed}}return i.owner===e||(0,ja.checkPluginAuthorities)({authority:e,pluginTypes:[ns.PluginType.BurnDelegate],asset:r,collection:n}).some(c=>c)?null:Ro.NoAuthority}Xr.validateBurn=Epe;function wpe(t,e,r){return(0,M4.hasAssetUpdateAuthority)(t,e,r)}Xr.canUpdate=wpe;async function xpe(t,{authority:e,asset:r,collection:n}){if(r.oracles?.length){let i=r.oracles.filter(s=>s.lifecycleChecks?.update?.includes(ks.CheckResult.CAN_REJECT));if(i.length){let s=i.map(u=>({pubkey:(0,ks.findOracleAccount)(t,u,{asset:r.publicKey,collection:n?.publicKey,owner:r.owner}),offset:u.resultsOffset}));if(!(await t.rpc.getAccounts(s.map(u=>u.pubkey))).map((u,d)=>u.exists?(0,ks.deserializeOracleValidation)(u.data,s[d].offset):null).every(u=>u?.__kind==="Uninitialized"?!1:u?.update===ns.ExternalValidationResult.Pass))return Ro.OracleValidationFailed}}return(0,M4.hasAssetUpdateAuthority)(e,r,n)?null:Ro.NoAuthority}Xr.validateUpdate=xpe});var L4=_(Lr=>{"use strict";a();Object.defineProperty(Lr,"__esModule",{value:!0});Lr.fetchCollection=Lr.fetchAllAssets=Lr.fetchAsset=Lr.fetchCollectionsByUpdateAuthority=Lr.fetchAssetsByCollection=Lr.fetchAssetsByOwner=Lr.deriveAssetPluginsWithFetch=void 0;var vf=U(),_i=xe(),Ipe=Je(),Ha=Sf(),Ppe=async(t,e)=>{let r=Array.from(new Set(e.map(s=>(0,Ha.collectionAddress)(s)))).filter(s=>!!s),i=(await(0,_i.fetchAllCollectionV1)(t,r)).reduce((s,o)=>(s[o.publicKey]=o,s),{});return e.map(s=>{let o=(0,Ha.collectionAddress)(s);return o?(0,Ha.deriveAssetPlugins)(s,i[o]):s})};Lr.deriveAssetPluginsWithFetch=Ppe;var Rpe=async(t,e,r={})=>{let n=await(0,_i.getAssetV1GpaBuilder)(t).whereField("key",_i.Key.AssetV1).whereField("owner",(0,vf.publicKey)(e)).getDeserialized();return r.skipDerivePlugins?n:(0,Lr.deriveAssetPluginsWithFetch)(t,n)};Lr.fetchAssetsByOwner=Rpe;var Ope=async(t,e,r={})=>{let n=await(0,_i.getAssetV1GpaBuilder)(t).whereField("key",_i.Key.AssetV1).whereField("updateAuthority",(0,Ipe.updateAuthority)("Collection",[(0,vf.publicKey)(e)])).getDeserialized();return r.skipDerivePlugins?n:(0,Lr.deriveAssetPluginsWithFetch)(t,n)};Lr.fetchAssetsByCollection=Ope;var Tpe=async(t,e)=>(0,_i.getCollectionV1GpaBuilder)(t).whereField("key",_i.Key.CollectionV1).whereField("updateAuthority",(0,vf.publicKey)(e)).getDeserialized();Lr.fetchCollectionsByUpdateAuthority=Tpe;var Bpe=async(t,e,r={})=>{let n=await(0,_i.fetchAssetV1)(t,(0,vf.publicKey)(e));if(r.skipDerivePlugins)return n;let i=(0,Ha.collectionAddress)(n);return i?(0,Ha.deriveAssetPlugins)(n,await(0,_i.fetchCollectionV1)(t,i)):n};Lr.fetchAsset=Bpe;var zpe=async(t,e,r={})=>{let n=r.chunkSize??1e3,i=[];for(let d=0;d<e.length;d+=n)i.push(e.slice(d,d+n));let s=(await Promise.all(i.map(d=>(0,_i.fetchAllAssetV1)(t,d.map(f=>(0,vf.publicKey)(f)))))).flat();if(r.skipDerivePlugins)return s;let o=Array.from(new Set(s.map(d=>(0,Ha.collectionAddress)(d)))).filter(d=>!!d),u=(await(0,_i.fetchAllCollectionV1)(t,o)).reduce((d,f)=>(d[f.publicKey]=f,d),{});return s.map(d=>{let f=(0,Ha.collectionAddress)(d);return f?(0,Ha.deriveAssetPlugins)(d,u[f]):d})};Lr.fetchAllAssets=zpe;var kpe=async(t,e,r)=>(0,_i.fetchCollectionV1)(t,(0,vf.publicKey)(e),r);Lr.fetchCollection=kpe});var Iu=_(is=>{"use strict";a();var Cpe=is&&is.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wm=is&&is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cpe(e,t,r)};Object.defineProperty(is,"__esModule",{value:!0});wm(Sf(),is);wm(N4(),is);wm(qO(),is);wm(R_(),is);wm(L4(),is)});var q4=_(O_=>{"use strict";a();Object.defineProperty(O_,"__esModule",{value:!0});O_.addPlugin=void 0;var D4=xe(),UO=Je(),Mpe=(t,{plugin:e,...r})=>{if((0,UO.isExternalPluginAdapterType)(e))return(0,D4.addExternalPluginAdapterV1)(t,{...r,initInfo:(0,UO.createExternalPluginAdapterInitInfo)(e)});let n=(0,UO.pluginAuthorityPairV2)(e);return(0,D4.addPluginV1)(t,{...r,plugin:n.plugin,initAuthority:n.authority})};O_.addPlugin=Mpe});var VO=_(T_=>{"use strict";a();Object.defineProperty(T_,"__esModule",{value:!0});T_.approvePluginAuthority=void 0;var U4=xe(),Npe=Je(),Lpe=(t,{plugin:e,newAuthority:r,...n})=>{let i=e.type;if(i==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,U4.approvePluginAuthorityV1)(t,{...n,pluginType:U4.PluginType[i],newAuthority:(0,Npe.pluginAuthorityToBase)(r)})};T_.approvePluginAuthority=Lpe});var V4=_(B_=>{"use strict";a();Object.defineProperty(B_,"__esModule",{value:!0});B_.burn=void 0;var Dpe=xe(),qpe=Je(),Upe=Iu(),Vpe=(t,{asset:e,collection:r,...n})=>{let i=(0,Upe.deriveExternalPluginAdapters)(e,r),s=(0,qpe.findExtraAccounts)(t,"burn",i,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner});return(0,Dpe.burnV1)(t,{...n,asset:e.publicKey,collection:r?.publicKey}).addRemainingAccounts(s)};B_.burn=Vpe});var W4=_(z_=>{"use strict";a();Object.defineProperty(z_,"__esModule",{value:!0});z_.addCollectionPlugin=void 0;var K4=xe(),Kpe=Je(),F4=za(),Fpe=(t,{plugin:e,...r})=>{if((0,F4.isExternalPluginAdapterType)(e))return(0,K4.addCollectionExternalPluginAdapterV1)(t,{...r,initInfo:(0,F4.createExternalPluginAdapterInitInfo)(e)});let n=(0,Kpe.pluginAuthorityPairV2)(e);return(0,K4.addCollectionPluginV1)(t,{...r,plugin:n.plugin,initAuthority:n.authority})};z_.addCollectionPlugin=Fpe});var H4=_(k_=>{"use strict";a();Object.defineProperty(k_,"__esModule",{value:!0});k_.approveCollectionPluginAuthority=void 0;var j4=xe(),Wpe=Je(),jpe=(t,{plugin:e,newAuthority:r,...n})=>{let i=e.type;if(i==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,j4.approveCollectionPluginAuthorityV1)(t,{...n,pluginType:j4.PluginType[i],newAuthority:(0,Wpe.pluginAuthorityToBase)(r)})};k_.approveCollectionPluginAuthority=jpe});var G4=_(C_=>{"use strict";a();Object.defineProperty(C_,"__esModule",{value:!0});C_.burnCollection=void 0;var Hpe=xe();Object.defineProperty(C_,"burnCollection",{enumerable:!0,get:function(){return Hpe.burnCollectionV1}})});var Z4=_(M_=>{"use strict";a();Object.defineProperty(M_,"__esModule",{value:!0});M_.createCollection=void 0;var Gpe=xe(),$4=Je(),$pe=za(),Zpe=(t,{plugins:e,...r})=>{let n=[],i=[];return e?.forEach(s=>{(0,$pe.isExternalPluginAdapterType)(s)?i.push(s):n.push(s)}),(0,Gpe.createCollectionV2)(t,{...r,plugins:n.map($4.pluginAuthorityPairV2),externalPluginAdapters:i.map($4.createExternalPluginAdapterInitInfo)})};M_.createCollection=Zpe});var X4=_(N_=>{"use strict";a();Object.defineProperty(N_,"__esModule",{value:!0});N_.removeCollectionPlugin=void 0;var KO=xe(),Xpe=Je(),Ype=za(),Jpe=(t,{plugin:e,...r})=>{if((0,Ype.isExternalPluginAdapterType)(e))return(0,KO.removeCollectionExternalPluginAdapterV1)(t,{...r,key:(0,Xpe.externalPluginAdapterKeyToBase)(e)});let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,KO.removeCollectionPluginV1)(t,{...r,pluginType:KO.PluginType[n]})};N_.removeCollectionPlugin=Jpe});var J4=_(L_=>{"use strict";a();Object.defineProperty(L_,"__esModule",{value:!0});L_.revokeCollectionPluginAuthority=void 0;var Y4=xe(),Qpe=(t,{plugin:e,...r})=>{let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,Y4.revokeCollectionPluginAuthorityV1)(t,{...r,pluginType:Y4.PluginType[n]})};L_.revokeCollectionPluginAuthority=Qpe});var Q4=_(D_=>{"use strict";a();Object.defineProperty(D_,"__esModule",{value:!0});D_.updateCollection=void 0;var ehe=xe(),the=(t,{name:e,uri:r,...n})=>(0,ehe.updateCollectionV1)(t,{...n,newName:e,newUri:r});D_.updateCollection=the});var tU=_(U_=>{"use strict";a();Object.defineProperty(U_,"__esModule",{value:!0});U_.updateCollectionPlugin=void 0;var eU=xe(),q_=Je(),rhe=(t,{plugin:e,...r})=>{if((0,q_.isExternalPluginAdapterType)(e)){let n=e;return(0,eU.updateCollectionExternalPluginAdapterV1)(t,{...r,updateInfo:(0,q_.createExternalPluginAdapterUpdateInfo)(n),key:(0,q_.externalPluginAdapterKeyToBase)(n.key)})}return(0,eU.updateCollectionPluginV1)(t,{...r,plugin:(0,q_.createPluginV2)(e)})};U_.updateCollectionPlugin=rhe});var rU=_(V_=>{"use strict";a();Object.defineProperty(V_,"__esModule",{value:!0});V_.writeCollectionData=void 0;var nhe=xe(),ihe=Je(),she=(t,e)=>{let{key:r,...n}=e;return(0,nhe.writeCollectionExternalPluginAdapterDataV1)(t,{...n,key:(0,ihe.externalPluginAdapterKeyToBase)(r)})};V_.writeCollectionData=she});var nU=_(In=>{"use strict";a();var ohe=In&&In.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Oo=In&&In.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ohe(e,t,r)};Object.defineProperty(In,"__esModule",{value:!0});Oo(W4(),In);Oo(H4(),In);Oo(G4(),In);Oo(Z4(),In);Oo(X4(),In);Oo(J4(),In);Oo(Q4(),In);Oo(tU(),In);Oo(rU(),In)});var sU=_(K_=>{"use strict";a();Object.defineProperty(K_,"__esModule",{value:!0});K_.create=void 0;var ahe=U(),iU=xe(),FO=Je(),che=Iu(),uhe=za(),lhe=(t,{asset:e,plugins:r,collection:n,...i})=>{let s=i.owner||i.updateAuthority||i.payer,o={oracles:[],lifecycleHooks:[]},c=[],u=[];r?.forEach(m=>{if((0,uhe.isExternalPluginAdapterType)(m))switch(c.push(m),m.type){case"Oracle":o.oracles?.push({...m,resultsOffset:m.resultsOffset||{type:"NoOffset"},baseAddress:m.baseAddress,authority:m.initPluginAuthority||{type:"UpdateAuthority"},type:"Oracle"});break;case"AppData":break;case"LifecycleHook":o.lifecycleHooks?.push({...m,hookedProgram:m.hookedProgram,authority:m.initPluginAuthority||{type:"UpdateAuthority"},type:"LifecycleHook",schema:m.schema||iU.ExternalPluginAdapterSchema.Binary});break;default:}else u.push(m)});let d=(0,che.deriveExternalPluginAdapters)(o,n),f=(0,FO.findExtraAccounts)(t,"create",d,{asset:e.publicKey,collection:n?n.publicKey:void 0,owner:s?(0,ahe.publicKey)(s):t.identity.publicKey});return(0,iU.createV2)(t,{...i,plugins:u.map(FO.pluginAuthorityPairV2),externalPluginAdapters:c.map(FO.createExternalPluginAdapterInitInfo),asset:e,collection:n?n.publicKey:void 0}).addRemainingAccounts(f)};K_.create=lhe});var aU=_(F_=>{"use strict";a();Object.defineProperty(F_,"__esModule",{value:!0});F_.execute=void 0;var WO=U(),oU=xe(),dhe=(t,e)=>fhe(t,e);F_.execute=dhe;var fhe=(t,e)=>{let r=new WO.TransactionBuilder,n=[...e.signers||[]],i=new WO.TransactionBuilder;if("getInstructions"in e.instructions)i=e.instructions;else if(Array.isArray(e.instructions))e.instructions.forEach(s=>{let o=[];s.keys.filter(c=>c.isSigner).forEach(c=>{let u=n.find(d=>d.publicKey===c.pubkey);u&&o.push(u)}),i=i.add({instruction:s,signers:o,bytesCreatedOnChain:0})});else throw new Error("No builder or instructions provided");for(let s of i.items){let[o]=(0,oU.findAssetSignerPda)(t,{asset:e.asset.publicKey}),c=(0,oU.executeV1)(t,{...e,asset:e.asset.publicKey,collection:e.collection?.publicKey,assetSigner:o,programId:s.instruction.programId,instructionData:s.instruction.data});e.executionDelegateRecord&&(c=c.addRemainingAccounts([{pubkey:(0,WO.publicKey)(e.executionDelegateRecord),isSigner:!1,isWritable:!1}])),r=r.add(c.addRemainingAccounts(s.instruction.keys.map(f=>f.pubkey===o?{pubkey:f.pubkey,isSigner:!1,isWritable:f.isWritable}:f)));let u=r.items,d=[...n,...s.signers].filter(f=>f.publicKey!==o);u[u.length-1].signers.push(...d),r=r.setItems(u)}return r}});var lU=_(Ef=>{"use strict";a();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.thawAsset=Ef.freezeAsset=void 0;var jO=U(),Ga=xe(),cU=Iu(),uU=Je(),phe=P_();function hhe(t,{asset:e,authority:r,collection:n,delegate:i}){if((0,cU.isFrozen)(e,n))throw new Error("Cannot freeze: asset is already frozen");if(e.freezeDelegate&&e.freezeDelegate.authority.type==="None")throw new Error("Cannot freeze: owner has made the freeze immutable until transfer");let s=(0,jO.transactionBuilder)();return e.freezeDelegate&&(e.freezeDelegate.authority.type!=="Owner"&&(s=s.add((0,Ga.revokePluginAuthorityV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:Ga.PluginType.FreezeDelegate,authority:r}))),s=s.add((0,Ga.removePluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:Ga.PluginType.FreezeDelegate,authority:r}))),s=s.add((0,Ga.addPluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,plugin:(0,uU.createPlugin)({type:"FreezeDelegate",data:{frozen:!0}}),initAuthority:(0,phe.addressPluginAuthority)((0,jO.publicKey)(i)),authority:r})),s}Ef.freezeAsset=hhe;function ghe(t,{asset:e,delegate:r,collection:n}){if(!(0,cU.isFrozen)(e,n))throw new Error("Cannot thaw: asset is not frozen");return(0,jO.transactionBuilder)().add((0,Ga.updatePluginV1)(t,{asset:e.publicKey,collection:n?.publicKey,plugin:(0,uU.createPlugin)({type:"FreezeDelegate",data:{frozen:!1}}),authority:r})).add((0,Ga.revokePluginAuthorityV1)(t,{asset:e.publicKey,collection:n?.publicKey,pluginType:Ga.PluginType.FreezeDelegate,authority:r}))}Ef.thawAsset=ghe});var dU=_(W_=>{"use strict";a();Object.defineProperty(W_,"__esModule",{value:!0});W_.addAssetsToGroup=void 0;var mhe=xe(),yhe=(t,e)=>(0,mhe.addAssetsToGroupV1)(t,e);W_.addAssetsToGroup=yhe});var fU=_(j_=>{"use strict";a();Object.defineProperty(j_,"__esModule",{value:!0});j_.addCollectionsToGroup=void 0;var bhe=xe(),Ahe=(t,e)=>(0,bhe.addCollectionsToGroupV1)(t,e);j_.addCollectionsToGroup=Ahe});var pU=_(H_=>{"use strict";a();Object.defineProperty(H_,"__esModule",{value:!0});H_.addGroupsToGroup=void 0;var _he=xe(),She=(t,e)=>(0,_he.addGroupsToGroupV1)(t,e);H_.addGroupsToGroup=She});var hU=_(G_=>{"use strict";a();Object.defineProperty(G_,"__esModule",{value:!0});G_.closeGroup=void 0;var vhe=xe(),Ehe=(t,e)=>(0,vhe.closeGroupV1)(t,e);G_.closeGroup=Ehe});var gU=_($_=>{"use strict";a();Object.defineProperty($_,"__esModule",{value:!0});$_.createGroup=void 0;var whe=xe(),xhe=(t,e)=>(0,whe.createGroupV1)(t,e);$_.createGroup=xhe});var mU=_(Z_=>{"use strict";a();Object.defineProperty(Z_,"__esModule",{value:!0});Z_.removeAssetsFromGroup=void 0;var Ihe=xe(),Phe=(t,e)=>(0,Ihe.removeAssetsFromGroupV1)(t,e);Z_.removeAssetsFromGroup=Phe});var yU=_(X_=>{"use strict";a();Object.defineProperty(X_,"__esModule",{value:!0});X_.removeCollectionsFromGroup=void 0;var Rhe=xe(),Ohe=(t,e)=>(0,Rhe.removeCollectionsFromGroupV1)(t,e);X_.removeCollectionsFromGroup=Ohe});var bU=_(Y_=>{"use strict";a();Object.defineProperty(Y_,"__esModule",{value:!0});Y_.removeGroupsFromGroup=void 0;var The=xe(),Bhe=(t,e)=>(0,The.removeGroupsFromGroupV1)(t,e);Y_.removeGroupsFromGroup=Bhe});var AU=_(J_=>{"use strict";a();Object.defineProperty(J_,"__esModule",{value:!0});J_.updateGroup=void 0;var zhe=xe(),khe=(t,e)=>(0,zhe.updateGroupV1)(t,e);J_.updateGroup=khe});var _U=_(Pn=>{"use strict";a();var Che=Pn&&Pn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),To=Pn&&Pn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Che(e,t,r)};Object.defineProperty(Pn,"__esModule",{value:!0});To(dU(),Pn);To(fU(),Pn);To(pU(),Pn);To(hU(),Pn);To(gU(),Pn);To(mU(),Pn);To(yU(),Pn);To(bU(),Pn);To(AU(),Pn)});var HO=_(wf=>{"use strict";a();Object.defineProperty(wf,"__esModule",{value:!0});wf.ERR_CANNOT_REVOKE=wf.ERR_CANNOT_DELEGATE=void 0;wf.ERR_CANNOT_DELEGATE="Cannot delegate. The target delegate is already either a plugin authority or the asset owner";wf.ERR_CANNOT_REVOKE="Cannot revoke. Either no plugins defined or the plugin authority is already the asset owner"});var SU=_(Q_=>{"use strict";a();Object.defineProperty(Q_,"__esModule",{value:!0});Q_.legacyDelegate=void 0;var Mhe=U(),Nhe=HO(),Lhe=xe(),GO=Je(),Dhe=P_(),qhe=VO();function Uhe(t,e,r){let n=(({freezeDelegate:f,transferDelegate:m,burnDelegate:A})=>({...f?{freezeDelegate:f}:{},...m?{transferDelegate:m}:{},...A?{burnDelegate:A}:{}}))(e);if(!Object.values(n).every(f=>{let m=e.owner,A=f.authority,v=A.address;return A.type==="Owner"?r!==m:v!==r&&v!==m}))throw new Error(Nhe.ERR_CANNOT_DELEGATE);let s=(0,Mhe.transactionBuilder)(),o=Object.keys(n),c={freezeDelegate:"FreezeDelegate",transferDelegate:"TransferDelegate",burnDelegate:"BurnDelegate"};return o.forEach(f=>{let m=c[f];s=s.add((0,qhe.approvePluginAuthority)(t,{asset:e.publicKey,plugin:{type:m},newAuthority:{type:"Address",address:r}}))}),["freezeDelegate","transferDelegate","burnDelegate"].filter(f=>!o.includes(f)).forEach(f=>{let m=f==="freezeDelegate"?(0,GO.createPlugin)({type:"FreezeDelegate",data:{frozen:!1}}):f==="transferDelegate"?(0,GO.createPlugin)({type:"TransferDelegate"}):(0,GO.createPlugin)({type:"BurnDelegate"});s=s.add((0,Lhe.addPluginV1)(t,{asset:e.publicKey,plugin:m,initAuthority:(0,Dhe.addressPluginAuthority)(r)}))}),s}Q_.legacyDelegate=Uhe});var EU=_(eS=>{"use strict";a();Object.defineProperty(eS,"__esModule",{value:!0});eS.legacyRevoke=void 0;var Vhe=U(),vU=xe(),Khe=HO(),Fhe=Je();function Whe(t,e){let r=(({freezeDelegate:o,transferDelegate:c,burnDelegate:u})=>({...o?{freezeDelegate:o}:{},...c?{transferDelegate:c}:{},...u?{burnDelegate:u}:{}}))(e),n=Object.values(r);if(!(n.length>0&&n.every(o=>{let c=e.owner,u=o.authority;return u.type!=="Owner"&&u.address!==c})))throw new Error(Khe.ERR_CANNOT_REVOKE);let s=(0,Vhe.transactionBuilder)();return Object.keys(r).forEach(o=>{let c=(0,Fhe.pluginKeyToPluginType)(o);s=s.add((0,vU.revokePluginAuthorityV1)(t,{asset:e.publicKey,pluginType:vU.PluginType[c]}))}),s}eS.legacyRevoke=Whe});var wU=_(tS=>{"use strict";a();Object.defineProperty(tS,"__esModule",{value:!0});tS.removePlugin=void 0;var $O=xe(),jhe=Je(),Hhe=jR(),Ghe=(t,{plugin:e,...r})=>{if((0,jhe.isExternalPluginAdapterType)(e))return(0,$O.removeExternalPluginAdapterV1)(t,{...r,key:(0,Hhe.externalPluginAdapterKeyToBase)(e)});let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,$O.removePluginV1)(t,{...r,pluginType:$O.PluginType[n]})};tS.removePlugin=Ghe});var IU=_(rS=>{"use strict";a();Object.defineProperty(rS,"__esModule",{value:!0});rS.revokePluginAuthority=void 0;var xU=xe(),$he=(t,{plugin:e,...r})=>{let n=e.type;if(n==="Groups")throw new Error("PluginType.Groups must be managed via group-specific instructions.");return(0,xU.revokePluginAuthorityV1)(t,{...r,pluginType:xU.PluginType[n]})};rS.revokePluginAuthority=$he});var PU=_(nS=>{"use strict";a();Object.defineProperty(nS,"__esModule",{value:!0});nS.transfer=void 0;var Zhe=U(),Xhe=xe(),Yhe=Je(),Jhe=Iu(),Qhe=(t,{asset:e,collection:r,...n})=>{let i=(0,Jhe.deriveExternalPluginAdapters)(e,r),s=(0,Yhe.findExtraAccounts)(t,"transfer",i,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner,recipient:(0,Zhe.publicKey)(n.newOwner)});return(0,Xhe.transferV1)(t,{...n,asset:e.publicKey,collection:r?.publicKey}).addRemainingAccounts(s)};nS.transfer=Qhe});var RU=_(iS=>{"use strict";a();Object.defineProperty(iS,"__esModule",{value:!0});iS.update=void 0;var ege=xe(),tge=Je(),rge=Iu(),nge=(t,{asset:e,collection:r,name:n,uri:i,...s})=>{let o=(0,rge.deriveExternalPluginAdapters)(e,r),c=(0,tge.findExtraAccounts)(t,"update",o,{asset:e.publicKey,collection:r?.publicKey,owner:e.owner});return(0,ege.updateV2)(t,{...s,asset:e.publicKey,collection:r?.publicKey,newName:n,newUri:i}).addRemainingAccounts(c)};iS.update=nge});var TU=_(oS=>{"use strict";a();Object.defineProperty(oS,"__esModule",{value:!0});oS.updatePlugin=void 0;var OU=xe(),sS=Je(),ige=(t,{plugin:e,...r})=>{if((0,sS.isExternalPluginAdapterType)(e)){let n=e;return(0,OU.updateExternalPluginAdapterV1)(t,{...r,updateInfo:(0,sS.createExternalPluginAdapterUpdateInfo)(n),key:(0,sS.externalPluginAdapterKeyToBase)(n.key)})}return(0,OU.updatePluginV1)(t,{...r,plugin:(0,sS.createPluginV2)(e)})};oS.updatePlugin=ige});var BU=_(aS=>{"use strict";a();Object.defineProperty(aS,"__esModule",{value:!0});aS.writeData=void 0;var sge=xe(),oge=Je(),age=(t,e)=>{let{key:r,...n}=e;return(0,sge.writeExternalPluginAdapterDataV1)(t,{...n,key:(0,oge.externalPluginAdapterKeyToBase)(r)})};aS.writeData=age});var zU=_(xt=>{"use strict";a();var cge=xt&&xt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),hn=xt&&xt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cge(e,t,r)};Object.defineProperty(xt,"__esModule",{value:!0});hn(q4(),xt);hn(VO(),xt);hn(V4(),xt);hn(nU(),xt);hn(sU(),xt);hn(aU(),xt);hn(lU(),xt);hn(_U(),xt);hn(SU(),xt);hn(EU(),xt);hn(wU(),xt);hn(IU(),xt);hn(PU(),xt);hn(RU(),xt);hn(TU(),xt);hn(BU(),xt)});var cS=_(ni=>{"use strict";a();var uge=ni&&ni.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Pu=ni&&ni.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uge(e,t,r)};Object.defineProperty(ni,"__esModule",{value:!0});Pu(xe(),ni);Pu(U3(),ni);Pu(P4(),ni);Pu(P_(),ni);Pu(Je(),ni);Pu(Iu(),ni);Pu(zU(),ni)});var ZO=_(uS=>{"use strict";a();Object.defineProperty(uS,"__esModule",{value:!0});uS.signAndSendAgentTransaction=void 0;async function lge(t,e,r){let n=r?.commitment??"confirmed",i=r?.preflightCommitment??"confirmed",s=r?.skipPreflight??!1,o=await t.identity.signTransaction(e.transaction),c=await t.rpc.sendTransaction(o,{skipPreflight:s,commitment:n,preflightCommitment:i});return await t.rpc.confirmTransaction(c,{strategy:{type:"blockhash",...e.blockhash},commitment:n}),c}uS.signAndSendAgentTransaction=lge});var XO=_(qn=>{"use strict";a();Object.defineProperty(qn,"__esModule",{value:!0});qn.isAgentValidationError=qn.agentValidationError=qn.isAgentApiNetworkError=qn.agentApiNetworkError=qn.isAgentApiError=qn.agentApiError=void 0;function dge(t,e,r){let n=new Error(t);return n.name="AgentApiError",n.statusCode=e,n.responseBody=r,n}qn.agentApiError=dge;function fge(t){return t instanceof Error&&t.name==="AgentApiError"}qn.isAgentApiError=fge;function pge(t,e){let r=new Error(t);return r.name="AgentApiNetworkError",r.cause=e,r}qn.agentApiNetworkError=pge;function hge(t){return t instanceof Error&&t.name==="AgentApiNetworkError"}qn.isAgentApiNetworkError=hge;function gge(t,e){let r=new Error(t);return r.name="AgentValidationError",r.field=e,r}qn.agentValidationError=gge;function mge(t){return t instanceof Error&&t.name==="AgentValidationError"}qn.isAgentValidationError=mge});var CU=_(xf=>{"use strict";a();Object.defineProperty(xf,"__esModule",{value:!0});xf.mintAndSubmitAgent=xf.mintAgent=void 0;var yge=N(),bge=ZO(),YO=XO(),Age="https://api.metaplex.com";function _ge(t){return t.baseUrl??Age}function Sge(t){return typeof t=="string"?t:t.toString()}function vge(t){return{wallet:Sge(t.wallet),network:t.network??"solana-mainnet",name:t.name,uri:t.uri,agentMetadata:t.agentMetadata}}async function kU(t,e,r){let n=e??{},i=vge(r),s=n.fetch??globalThis.fetch,o=_ge(n),c;try{c=await s(`${o}/v1/agents/mint`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}catch(A){throw(0,YO.agentApiNetworkError)(`Network error calling mintAgent: ${A.message}`,A)}let u=await c.text().catch(()=>"<unable to read body>"),d;try{d=JSON.parse(u)}catch(A){throw(0,YO.agentApiError)(`Failed to parse mintAgent response as JSON: ${A.message} \u2014 raw body: ${u}`,c.status,{rawText:u})}if(!c.ok||!d.success)throw(0,YO.agentApiError)(d.error??`API returned status ${c.status}`,c.status,d);let f=yge.base64.serialize(d.tx);return{transaction:t.transactions.deserialize(f),blockhash:d.blockhash,assetAddress:typeof d.assetAddress=="string"?d.assetAddress:d.assetAddress.toString()}}xf.mintAgent=kU;async function Ege(t,e,r,n){let i=await kU(t,e,r),s;return n?.txSender?s=await n.txSender(i.transaction):s=await(0,bge.signAndSendAgentTransaction)(t,i,{commitment:n?.commitment??"confirmed",preflightCommitment:n?.preflightCommitment??"confirmed",skipPreflight:n?.skipPreflight??!1}),{signature:s,assetAddress:i.assetAddress}}xf.mintAndSubmitAgent=Ege});var NU=_(yr=>{"use strict";a();Object.defineProperty(yr,"__esModule",{value:!0});yr.isAgentValidationError=yr.isAgentApiNetworkError=yr.isAgentApiError=yr.agentValidationError=yr.agentApiNetworkError=yr.agentApiError=yr.signAndSendAgentTransaction=yr.mintAndSubmitAgent=yr.mintAgent=void 0;var MU=CU();Object.defineProperty(yr,"mintAgent",{enumerable:!0,get:function(){return MU.mintAgent}});Object.defineProperty(yr,"mintAndSubmitAgent",{enumerable:!0,get:function(){return MU.mintAndSubmitAgent}});var wge=ZO();Object.defineProperty(yr,"signAndSendAgentTransaction",{enumerable:!0,get:function(){return wge.signAndSendAgentTransaction}});var If=XO();Object.defineProperty(yr,"agentApiError",{enumerable:!0,get:function(){return If.agentApiError}});Object.defineProperty(yr,"agentApiNetworkError",{enumerable:!0,get:function(){return If.agentApiNetworkError}});Object.defineProperty(yr,"agentValidationError",{enumerable:!0,get:function(){return If.agentValidationError}});Object.defineProperty(yr,"isAgentApiError",{enumerable:!0,get:function(){return If.isAgentApiError}});Object.defineProperty(yr,"isAgentApiNetworkError",{enumerable:!0,get:function(){return If.isAgentApiNetworkError}});Object.defineProperty(yr,"isAgentValidationError",{enumerable:!0,get:function(){return If.isAgentValidationError}})});var DU=_(Ru=>{"use strict";a();Object.defineProperty(Ru,"__esModule",{value:!0});Ru.getKeySerializer=Ru.Key=void 0;var xge=N(),LU;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentIdentityV1=1]="AgentIdentityV1",t[t.AgentIdentityV2=2]="AgentIdentityV2"})(LU=Ru.Key||(Ru.Key={}));function Ige(){return(0,xge.scalarEnum)(LU,{description:"Key"})}Ru.getKeySerializer=Ige});var lS=_(Ou=>{"use strict";a();var Pge=Ou&&Ou.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Rge=Ou&&Ou.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pge(e,t,r)};Object.defineProperty(Ou,"__esModule",{value:!0});Rge(DU(),Ou)});var FU=_(dt=>{"use strict";a();Object.defineProperty(dt,"__esModule",{value:!0});dt.safeFetchAgentIdentityV1FromSeeds=dt.fetchAgentIdentityV1FromSeeds=dt.findAgentIdentityV1Pda=dt.getAgentIdentityV1Size=dt.getAgentIdentityV1GpaBuilder=dt.safeFetchAllAgentIdentityV1=dt.fetchAllAgentIdentityV1=dt.safeFetchAgentIdentityV1=dt.fetchAgentIdentityV1=dt.deserializeAgentIdentityV1=dt.getAgentIdentityV1AccountDataSerializer=void 0;var $a=U(),Si=N(),qU=lS();function UU(){return(0,Si.mapSerializer)((0,Si.struct)([["key",(0,qU.getKeySerializer)()],["bump",(0,Si.u8)()],["padding",(0,Si.array)((0,Si.u8)(),{size:6})],["asset",(0,Si.publicKey)()]],{description:"AgentIdentityV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}dt.getAgentIdentityV1AccountDataSerializer=UU;function Pf(t){return(0,$a.deserializeAccount)(t,UU())}dt.deserializeAgentIdentityV1=Pf;async function VU(t,e,r){let n=await t.rpc.getAccount((0,$a.publicKey)(e,!1),r);return(0,$a.assertAccountExists)(n,"AgentIdentityV1"),Pf(n)}dt.fetchAgentIdentityV1=VU;async function KU(t,e,r){let n=await t.rpc.getAccount((0,$a.publicKey)(e,!1),r);return n.exists?Pf(n):null}dt.safeFetchAgentIdentityV1=KU;async function Oge(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,$a.publicKey)(i,!1)),r)).map(i=>((0,$a.assertAccountExists)(i,"AgentIdentityV1"),Pf(i)))}dt.fetchAllAgentIdentityV1=Oge;async function Tge(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,$a.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Pf(i))}dt.safeFetchAllAgentIdentityV1=Tge;function Bge(t){let e=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return(0,$a.gpaBuilder)(t,e).registerFields({key:[0,(0,qU.getKeySerializer)()],bump:[1,(0,Si.u8)()],padding:[2,(0,Si.array)((0,Si.u8)(),{size:6})],asset:[8,(0,Si.publicKey)()]}).deserializeUsing(r=>Pf(r))}dt.getAgentIdentityV1GpaBuilder=Bge;function zge(){return 40}dt.getAgentIdentityV1Size=zge;function JO(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return t.eddsa.findPda(r,[(0,Si.string)({size:"variable"}).serialize("agent_identity"),(0,Si.publicKey)().serialize(e.asset)])}dt.findAgentIdentityV1Pda=JO;async function kge(t,e,r){return VU(t,JO(t,e),r)}dt.fetchAgentIdentityV1FromSeeds=kge;async function Cge(t,e,r){return KU(t,JO(t,e),r)}dt.safeFetchAgentIdentityV1FromSeeds=Cge});var $U=_(ft=>{"use strict";a();Object.defineProperty(ft,"__esModule",{value:!0});ft.safeFetchAgentIdentityV2FromSeeds=ft.fetchAgentIdentityV2FromSeeds=ft.findAgentIdentityV2Pda=ft.getAgentIdentityV2Size=ft.getAgentIdentityV2GpaBuilder=ft.safeFetchAllAgentIdentityV2=ft.fetchAllAgentIdentityV2=ft.safeFetchAgentIdentityV2=ft.fetchAgentIdentityV2=ft.deserializeAgentIdentityV2=ft.getAgentIdentityV2AccountDataSerializer=void 0;var Un=U(),gn=N(),WU=lS();function jU(){return(0,gn.mapSerializer)((0,gn.struct)([["key",(0,WU.getKeySerializer)()],["bump",(0,gn.u8)()],["padding",(0,gn.array)((0,gn.u8)(),{size:6})],["asset",(0,gn.publicKey)()],["agentToken",(()=>{let t=(0,gn.publicKey)(),e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);if(t.fixedSize==null)throw new Error("Fixed-size options require an inner serializer with a fixed size.");if(t.fixedSize!==e.length)throw new Error("Fixed-size option sentinel length must match the inner serializer fixed size.");let{fixedSize:r}=t,n=i=>i==null?null:(0,Un.isOption)(i)?i.__option==="None"?null:i.value:i;return{description:"Option<PublicKey>",fixedSize:r,maxSize:r,serialize:i=>{let s=n(i);return s==null?e.slice():t.serialize(s)},deserialize:(i,s=0)=>{if(i.slice(s,s+r).every((f,m)=>f===e[m]))return[(0,Un.none)(),s+r];let[u,d]=t.deserialize(i,s);return[(0,Un.some)(u),d]}}})()],["reserved",(0,gn.bytes)({size:32})]],{description:"AgentIdentityV2AccountData"}),t=>({...t,padding:[0,0,0,0,0,0],reserved:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}))}ft.getAgentIdentityV2AccountDataSerializer=jU;function Rf(t){return(0,Un.deserializeAccount)(t,jU())}ft.deserializeAgentIdentityV2=Rf;async function HU(t,e,r){let n=await t.rpc.getAccount((0,Un.publicKey)(e,!1),r);return(0,Un.assertAccountExists)(n,"AgentIdentityV2"),Rf(n)}ft.fetchAgentIdentityV2=HU;async function GU(t,e,r){let n=await t.rpc.getAccount((0,Un.publicKey)(e,!1),r);return n.exists?Rf(n):null}ft.safeFetchAgentIdentityV2=GU;async function Mge(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Un.publicKey)(i,!1)),r)).map(i=>((0,Un.assertAccountExists)(i,"AgentIdentityV2"),Rf(i)))}ft.fetchAllAgentIdentityV2=Mge;async function Nge(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Un.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Rf(i))}ft.safeFetchAllAgentIdentityV2=Nge;function Lge(t){let e=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return(0,Un.gpaBuilder)(t,e).registerFields({key:[0,(0,WU.getKeySerializer)()],bump:[1,(0,gn.u8)()],padding:[2,(0,gn.array)((0,gn.u8)(),{size:6})],asset:[8,(0,gn.publicKey)()],agentToken:[40,(()=>{let r=(0,gn.publicKey)(),n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);if(r.fixedSize==null)throw new Error("Fixed-size options require an inner serializer with a fixed size.");if(r.fixedSize!==n.length)throw new Error("Fixed-size option sentinel length must match the inner serializer fixed size.");let{fixedSize:i}=r,s=o=>o==null?null:(0,Un.isOption)(o)?o.__option==="None"?null:o.value:o;return{description:"Option<PublicKey>",fixedSize:i,maxSize:i,serialize:o=>{let c=s(o);return c==null?n.slice():r.serialize(c)},deserialize:(o,c=0)=>{if(o.slice(c,c+i).every((A,v)=>A===n[v]))return[(0,Un.none)(),c+i];let[f,m]=r.deserialize(o,c);return[(0,Un.some)(f),m]}}})()],reserved:[72,(0,gn.bytes)({size:32})]}).deserializeUsing(r=>Rf(r))}ft.getAgentIdentityV2GpaBuilder=Lge;function Dge(){return 104}ft.getAgentIdentityV2Size=Dge;function QO(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p");return t.eddsa.findPda(r,[(0,gn.string)({size:"variable"}).serialize("agent_identity"),(0,gn.publicKey)().serialize(e.asset)])}ft.findAgentIdentityV2Pda=QO;async function qge(t,e,r){return HU(t,QO(t,e),r)}ft.fetchAgentIdentityV2FromSeeds=qge;async function Uge(t,e,r){return GU(t,QO(t,e),r)}ft.safeFetchAgentIdentityV2FromSeeds=Uge});var xm=_(Za=>{"use strict";a();var Vge=Za&&Za.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ZU=Za&&Za.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vge(e,t,r)};Object.defineProperty(Za,"__esModule",{value:!0});ZU(FU(),Za);ZU($U(),Za)});var XU=_($e=>{"use strict";a();Object.defineProperty($e,"__esModule",{value:!0});$e.getMplAgentIdentityErrorFromName=$e.getMplAgentIdentityErrorFromCode=$e.GenesisNotMintFundedError=$e.InvalidGenesisAccountError=$e.AgentIdentityAlreadyRegisteredError=$e.InvalidAgentIdentityError=$e.AgentTokenAlreadySetError=$e.OnlyAssetSignerCanSetAgentTokenError=$e.InvalidAgentTokenError=$e.InvalidCoreAssetError=$e.InvalidMplCoreProgramError=$e.InvalidAccountDataError=$e.InvalidInstructionDataError=$e.InvalidSystemProgramError=void 0;var vi=U(),ii=new Map,si=new Map,Im=class extends vi.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};$e.InvalidSystemProgramError=Im;ii.set(0,Im);si.set("InvalidSystemProgram",Im);var Pm=class extends vi.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};$e.InvalidInstructionDataError=Pm;ii.set(1,Pm);si.set("InvalidInstructionData",Pm);var Rm=class extends vi.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};$e.InvalidAccountDataError=Rm;ii.set(2,Rm);si.set("InvalidAccountData",Rm);var Om=class extends vi.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};$e.InvalidMplCoreProgramError=Om;ii.set(3,Om);si.set("InvalidMplCoreProgram",Om);var Tm=class extends vi.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};$e.InvalidCoreAssetError=Tm;ii.set(4,Tm);si.set("InvalidCoreAsset",Tm);var Bm=class extends vi.ProgramError{constructor(e,r){super("Invalid Agent Token",e,r),this.name="InvalidAgentToken",this.code=5}};$e.InvalidAgentTokenError=Bm;ii.set(5,Bm);si.set("InvalidAgentToken",Bm);var zm=class extends vi.ProgramError{constructor(e,r){super("Only the Asset Signer can set the agent token",e,r),this.name="OnlyAssetSignerCanSetAgentToken",this.code=6}};$e.OnlyAssetSignerCanSetAgentTokenError=zm;ii.set(6,zm);si.set("OnlyAssetSignerCanSetAgentToken",zm);var km=class extends vi.ProgramError{constructor(e,r){super("Agent Token already set",e,r),this.name="AgentTokenAlreadySet",this.code=7}};$e.AgentTokenAlreadySetError=km;ii.set(7,km);si.set("AgentTokenAlreadySet",km);var Cm=class extends vi.ProgramError{constructor(e,r){super("Invalid Agent Identity",e,r),this.name="InvalidAgentIdentity",this.code=8}};$e.InvalidAgentIdentityError=Cm;ii.set(8,Cm);si.set("InvalidAgentIdentity",Cm);var Mm=class extends vi.ProgramError{constructor(e,r){super("Agent Identity already registered",e,r),this.name="AgentIdentityAlreadyRegistered",this.code=9}};$e.AgentIdentityAlreadyRegisteredError=Mm;ii.set(9,Mm);si.set("AgentIdentityAlreadyRegistered",Mm);var Nm=class extends vi.ProgramError{constructor(e,r){super("Invalid Genesis Account",e,r),this.name="InvalidGenesisAccount",this.code=10}};$e.InvalidGenesisAccountError=Nm;ii.set(10,Nm);si.set("InvalidGenesisAccount",Nm);var Lm=class extends vi.ProgramError{constructor(e,r){super("Genesis account is not mint-funded",e,r),this.name="GenesisNotMintFunded",this.code=11}};$e.GenesisNotMintFundedError=Lm;ii.set(11,Lm);si.set("GenesisNotMintFunded",Lm);function Kge(t,e,r){let n=ii.get(t);return n?new n(e,r):null}$e.getMplAgentIdentityErrorFromCode=Kge;function Fge(t,e,r){let n=si.get(t);return n?new n(e,r):null}$e.getMplAgentIdentityErrorFromName=Fge});var eT=_(Tu=>{"use strict";a();var Wge=Tu&&Tu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),jge=Tu&&Tu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wge(e,t,r)};Object.defineProperty(Tu,"__esModule",{value:!0});jge(XU(),Tu)});var dS=_(Cs=>{"use strict";a();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.getAccountMetasAndSigners=Cs.expectPda=Cs.expectPublicKey=Cs.expectSome=void 0;var Dm=U();function Hge(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Cs.expectSome=Hge;function Gge(t){if(!t)throw new Error("Expected a PublicKey.");return(0,Dm.publicKey)(t,!1)}Cs.expectPublicKey=Gge;function $ge(t){if(!t||!Array.isArray(t)||!(0,Dm.isPda)(t))throw new Error("Expected a PDA.");return t}Cs.expectPda=$ge;function Zge(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,Dm.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,Dm.publicKey)(s.value,!1),isSigner:(0,Dm.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Cs.getAccountMetasAndSigners=Zge});var QU=_(Xa=>{"use strict";a();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.registerIdentityV1=Xa.registerIdentityV1InstructionDiscriminator=Xa.getRegisterIdentityV1InstructionDataSerializer=void 0;var Xge=U(),Of=N(),Yge=xm(),YU=dS();function JU(){return(0,Of.mapSerializer)((0,Of.struct)([["discriminator",(0,Of.u8)()],["padding",(0,Of.array)((0,Of.u8)(),{size:7})],["agentRegistrationUri",(0,Of.string)()]],{description:"RegisterIdentityV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}Xa.getRegisterIdentityV1InstructionDataSerializer=JU;Xa.registerIdentityV1InstructionDiscriminator=0;function Jge(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p"),n={agentIdentity:{index:0,isWritable:!0,value:e.agentIdentity??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}},i={...e};n.agentIdentity.value||(n.agentIdentity.value=(0,Yge.findAgentIdentityV2Pda)(t,{asset:(0,YU.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,YU.getAccountMetasAndSigners)(s,"programId",r),u=JU().serialize(i);return(0,Xge.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Xa.registerIdentityV1=Jge});var rV=_(Ya=>{"use strict";a();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.setAgentTokenV1=Ya.setAgentTokenV1InstructionDiscriminator=Ya.getSetAgentTokenV1InstructionDataSerializer=void 0;var Qge=U(),qm=N(),eme=xm(),eV=dS();function tV(){return(0,qm.mapSerializer)((0,qm.struct)([["discriminator",(0,qm.u8)()],["padding",(0,qm.array)((0,qm.u8)(),{size:7})]],{description:"SetAgentTokenV1InstructionData"}),t=>({...t,discriminator:1,padding:[0,0,0,0,0,0,0]}))}Ya.getSetAgentTokenV1InstructionDataSerializer=tV;Ya.setAgentTokenV1InstructionDiscriminator=1;function tme(t,e){let r=t.programs.getPublicKey("mplAgentIdentity","1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p"),n={agentIdentity:{index:0,isWritable:!0,value:e.agentIdentity??null},asset:{index:1,isWritable:!1,value:e.asset??null},genesisAccount:{index:2,isWritable:!1,value:e.genesisAccount??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null}};n.agentIdentity.value||(n.agentIdentity.value=(0,eme.findAgentIdentityV2Pda)(t,{asset:(0,eV.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,eV.getAccountMetasAndSigners)(i,"programId",r),c=tV().serialize({});return(0,Qge.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ya.setAgentTokenV1=tme});var tT=_(Ja=>{"use strict";a();var rme=Ja&&Ja.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),nV=Ja&&Ja.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rme(e,t,r)};Object.defineProperty(Ja,"__esModule",{value:!0});nV(QU(),Ja);nV(rV(),Ja)});var sV=_(Ei=>{"use strict";a();Object.defineProperty(Ei,"__esModule",{value:!0});Ei.getMplAgentIdentityProgramId=Ei.getMplAgentIdentityProgram=Ei.createMplAgentIdentityProgram=Ei.MPL_AGENT_IDENTITY_PROGRAM_ID=void 0;var iV=eT();Ei.MPL_AGENT_IDENTITY_PROGRAM_ID="1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p";function nme(){return{name:"mplAgentIdentity",publicKey:Ei.MPL_AGENT_IDENTITY_PROGRAM_ID,getErrorFromCode(t,e){return(0,iV.getMplAgentIdentityErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,iV.getMplAgentIdentityErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Ei.createMplAgentIdentityProgram=nme;function ime(t,e){return t.programs.get("mplAgentIdentity",e)}Ei.getMplAgentIdentityProgram=ime;function sme(t,e){return t.programs.getPublicKey("mplAgentIdentity",Ei.MPL_AGENT_IDENTITY_PROGRAM_ID,e)}Ei.getMplAgentIdentityProgramId=sme});var rT=_(Bu=>{"use strict";a();var ome=Bu&&Bu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ame=Bu&&Bu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ome(e,t,r)};Object.defineProperty(Bu,"__esModule",{value:!0});ame(sV(),Bu)});var nT=_(wi=>{"use strict";a();var cme=wi&&wi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Tf=wi&&wi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cme(e,t,r)};Object.defineProperty(wi,"__esModule",{value:!0});Tf(xm(),wi);Tf(eT(),wi);Tf(tT(),wi);Tf(rT(),wi);Tf(dS(),wi);Tf(lS(),wi)});var aV=_(zu=>{"use strict";a();Object.defineProperty(zu,"__esModule",{value:!0});zu.getKeySerializer=zu.Key=void 0;var ume=N(),oV;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentReputationV1=1]="AgentReputationV1"})(oV=zu.Key||(zu.Key={}));function lme(){return(0,ume.scalarEnum)(oV,{description:"Key"})}zu.getKeySerializer=lme});var iT=_(ku=>{"use strict";a();var dme=ku&&ku.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),fme=ku&&ku.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dme(e,t,r)};Object.defineProperty(ku,"__esModule",{value:!0});fme(aV(),ku)});var fV=_(pt=>{"use strict";a();Object.defineProperty(pt,"__esModule",{value:!0});pt.safeFetchAgentReputationV1FromSeeds=pt.fetchAgentReputationV1FromSeeds=pt.findAgentReputationV1Pda=pt.getAgentReputationV1Size=pt.getAgentReputationV1GpaBuilder=pt.safeFetchAllAgentReputationV1=pt.fetchAllAgentReputationV1=pt.safeFetchAgentReputationV1=pt.fetchAgentReputationV1=pt.deserializeAgentReputationV1=pt.getAgentReputationV1AccountDataSerializer=void 0;var Qa=U(),xi=N(),cV=iT();function uV(){return(0,xi.mapSerializer)((0,xi.struct)([["key",(0,cV.getKeySerializer)()],["bump",(0,xi.u8)()],["padding",(0,xi.array)((0,xi.u8)(),{size:6})],["asset",(0,xi.publicKey)()]],{description:"AgentReputationV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}pt.getAgentReputationV1AccountDataSerializer=uV;function Bf(t){return(0,Qa.deserializeAccount)(t,uV())}pt.deserializeAgentReputationV1=Bf;async function lV(t,e,r){let n=await t.rpc.getAccount((0,Qa.publicKey)(e,!1),r);return(0,Qa.assertAccountExists)(n,"AgentReputationV1"),Bf(n)}pt.fetchAgentReputationV1=lV;async function dV(t,e,r){let n=await t.rpc.getAccount((0,Qa.publicKey)(e,!1),r);return n.exists?Bf(n):null}pt.safeFetchAgentReputationV1=dV;async function pme(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Qa.publicKey)(i,!1)),r)).map(i=>((0,Qa.assertAccountExists)(i,"AgentReputationV1"),Bf(i)))}pt.fetchAllAgentReputationV1=pme;async function hme(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,Qa.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Bf(i))}pt.safeFetchAllAgentReputationV1=hme;function gme(t){let e=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR");return(0,Qa.gpaBuilder)(t,e).registerFields({key:[0,(0,cV.getKeySerializer)()],bump:[1,(0,xi.u8)()],padding:[2,(0,xi.array)((0,xi.u8)(),{size:6})],asset:[8,(0,xi.publicKey)()]}).deserializeUsing(r=>Bf(r))}pt.getAgentReputationV1GpaBuilder=gme;function mme(){return 40}pt.getAgentReputationV1Size=mme;function sT(t,e){let r=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR");return t.eddsa.findPda(r,[(0,xi.string)({size:"variable"}).serialize("agent_reputation"),(0,xi.publicKey)().serialize(e.asset)])}pt.findAgentReputationV1Pda=sT;async function yme(t,e,r){return lV(t,sT(t,e),r)}pt.fetchAgentReputationV1FromSeeds=yme;async function bme(t,e,r){return dV(t,sT(t,e),r)}pt.safeFetchAgentReputationV1FromSeeds=bme});var fS=_(Cu=>{"use strict";a();var Ame=Cu&&Cu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),_me=Cu&&Cu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ame(e,t,r)};Object.defineProperty(Cu,"__esModule",{value:!0});_me(fV(),Cu)});var pV=_(Dr=>{"use strict";a();Object.defineProperty(Dr,"__esModule",{value:!0});Dr.getMplAgentReputationErrorFromName=Dr.getMplAgentReputationErrorFromCode=Dr.AgentReputationAlreadyRegisteredError=Dr.InvalidCoreAssetError=Dr.InvalidMplCoreProgramError=Dr.InvalidAccountDataError=Dr.InvalidInstructionDataError=Dr.InvalidSystemProgramError=void 0;var zf=U(),Mu=new Map,Nu=new Map,Um=class extends zf.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Dr.InvalidSystemProgramError=Um;Mu.set(0,Um);Nu.set("InvalidSystemProgram",Um);var Vm=class extends zf.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};Dr.InvalidInstructionDataError=Vm;Mu.set(1,Vm);Nu.set("InvalidInstructionData",Vm);var Km=class extends zf.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};Dr.InvalidAccountDataError=Km;Mu.set(2,Km);Nu.set("InvalidAccountData",Km);var Fm=class extends zf.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};Dr.InvalidMplCoreProgramError=Fm;Mu.set(3,Fm);Nu.set("InvalidMplCoreProgram",Fm);var Wm=class extends zf.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};Dr.InvalidCoreAssetError=Wm;Mu.set(4,Wm);Nu.set("InvalidCoreAsset",Wm);var jm=class extends zf.ProgramError{constructor(e,r){super("Agent Reputation already registered",e,r),this.name="AgentReputationAlreadyRegistered",this.code=5}};Dr.AgentReputationAlreadyRegisteredError=jm;Mu.set(5,jm);Nu.set("AgentReputationAlreadyRegistered",jm);function Sme(t,e,r){let n=Mu.get(t);return n?new n(e,r):null}Dr.getMplAgentReputationErrorFromCode=Sme;function vme(t,e,r){let n=Nu.get(t);return n?new n(e,r):null}Dr.getMplAgentReputationErrorFromName=vme});var oT=_(Lu=>{"use strict";a();var Eme=Lu&&Lu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wme=Lu&&Lu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Eme(e,t,r)};Object.defineProperty(Lu,"__esModule",{value:!0});wme(pV(),Lu)});var aT=_(Ms=>{"use strict";a();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.getAccountMetasAndSigners=Ms.expectPda=Ms.expectPublicKey=Ms.expectSome=void 0;var Hm=U();function xme(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Ms.expectSome=xme;function Ime(t){if(!t)throw new Error("Expected a PublicKey.");return(0,Hm.publicKey)(t,!1)}Ms.expectPublicKey=Ime;function Pme(t){if(!t||!Array.isArray(t)||!(0,Hm.isPda)(t))throw new Error("Expected a PDA.");return t}Ms.expectPda=Pme;function Rme(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,Hm.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,Hm.publicKey)(s.value,!1),isSigner:(0,Hm.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Ms.getAccountMetasAndSigners=Rme});var mV=_(ec=>{"use strict";a();Object.defineProperty(ec,"__esModule",{value:!0});ec.registerReputationV1=ec.registerReputationV1InstructionDiscriminator=ec.getRegisterReputationV1InstructionDataSerializer=void 0;var Ome=U(),Gm=N(),Tme=fS(),hV=aT();function gV(){return(0,Gm.mapSerializer)((0,Gm.struct)([["discriminator",(0,Gm.u8)()],["padding",(0,Gm.array)((0,Gm.u8)(),{size:7})]],{description:"RegisterReputationV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}ec.getRegisterReputationV1InstructionDataSerializer=gV;ec.registerReputationV1InstructionDiscriminator=0;function Bme(t,e){let r=t.programs.getPublicKey("mplAgentReputation","REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR"),n={agentReputation:{index:0,isWritable:!0,value:e.agentReputation??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.agentReputation.value||(n.agentReputation.value=(0,Tme.findAgentReputationV1Pda)(t,{asset:(0,hV.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,hV.getAccountMetasAndSigners)(i,"programId",r),c=gV().serialize({});return(0,Ome.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}ec.registerReputationV1=Bme});var cT=_(Du=>{"use strict";a();var zme=Du&&Du.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kme=Du&&Du.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zme(e,t,r)};Object.defineProperty(Du,"__esModule",{value:!0});kme(mV(),Du)});var bV=_(Ii=>{"use strict";a();Object.defineProperty(Ii,"__esModule",{value:!0});Ii.getMplAgentReputationProgramId=Ii.getMplAgentReputationProgram=Ii.createMplAgentReputationProgram=Ii.MPL_AGENT_REPUTATION_PROGRAM_ID=void 0;var yV=oT();Ii.MPL_AGENT_REPUTATION_PROGRAM_ID="REPREG5c1gPHuHukEyANpksLdHFaJCiTrm6zJgNhRZR";function Cme(){return{name:"mplAgentReputation",publicKey:Ii.MPL_AGENT_REPUTATION_PROGRAM_ID,getErrorFromCode(t,e){return(0,yV.getMplAgentReputationErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,yV.getMplAgentReputationErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Ii.createMplAgentReputationProgram=Cme;function Mme(t,e){return t.programs.get("mplAgentReputation",e)}Ii.getMplAgentReputationProgram=Mme;function Nme(t,e){return t.programs.getPublicKey("mplAgentReputation",Ii.MPL_AGENT_REPUTATION_PROGRAM_ID,e)}Ii.getMplAgentReputationProgramId=Nme});var uT=_(qu=>{"use strict";a();var Lme=qu&&qu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Dme=qu&&qu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Lme(e,t,r)};Object.defineProperty(qu,"__esModule",{value:!0});Dme(bV(),qu)});var lT=_(Pi=>{"use strict";a();var qme=Pi&&Pi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kf=Pi&&Pi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qme(e,t,r)};Object.defineProperty(Pi,"__esModule",{value:!0});kf(fS(),Pi);kf(oT(),Pi);kf(cT(),Pi);kf(uT(),Pi);kf(aT(),Pi);kf(iT(),Pi)});var _V=_(Uu=>{"use strict";a();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.getKeySerializer=Uu.Key=void 0;var Ume=N(),AV;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.AgentValidationV1=1]="AgentValidationV1"})(AV=Uu.Key||(Uu.Key={}));function Vme(){return(0,Ume.scalarEnum)(AV,{description:"Key"})}Uu.getKeySerializer=Vme});var dT=_(Vu=>{"use strict";a();var Kme=Vu&&Vu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Fme=Vu&&Vu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kme(e,t,r)};Object.defineProperty(Vu,"__esModule",{value:!0});Fme(_V(),Vu)});var xV=_(ht=>{"use strict";a();Object.defineProperty(ht,"__esModule",{value:!0});ht.safeFetchAgentValidationV1FromSeeds=ht.fetchAgentValidationV1FromSeeds=ht.findAgentValidationV1Pda=ht.getAgentValidationV1Size=ht.getAgentValidationV1GpaBuilder=ht.safeFetchAllAgentValidationV1=ht.fetchAllAgentValidationV1=ht.safeFetchAgentValidationV1=ht.fetchAgentValidationV1=ht.deserializeAgentValidationV1=ht.getAgentValidationV1AccountDataSerializer=void 0;var tc=U(),Ri=N(),SV=dT();function vV(){return(0,Ri.mapSerializer)((0,Ri.struct)([["key",(0,SV.getKeySerializer)()],["bump",(0,Ri.u8)()],["padding",(0,Ri.array)((0,Ri.u8)(),{size:6})],["asset",(0,Ri.publicKey)()]],{description:"AgentValidationV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}ht.getAgentValidationV1AccountDataSerializer=vV;function Cf(t){return(0,tc.deserializeAccount)(t,vV())}ht.deserializeAgentValidationV1=Cf;async function EV(t,e,r){let n=await t.rpc.getAccount((0,tc.publicKey)(e,!1),r);return(0,tc.assertAccountExists)(n,"AgentValidationV1"),Cf(n)}ht.fetchAgentValidationV1=EV;async function wV(t,e,r){let n=await t.rpc.getAccount((0,tc.publicKey)(e,!1),r);return n.exists?Cf(n):null}ht.safeFetchAgentValidationV1=wV;async function Wme(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,tc.publicKey)(i,!1)),r)).map(i=>((0,tc.assertAccountExists)(i,"AgentValidationV1"),Cf(i)))}ht.fetchAllAgentValidationV1=Wme;async function jme(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,tc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Cf(i))}ht.safeFetchAllAgentValidationV1=jme;function Hme(t){let e=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi");return(0,tc.gpaBuilder)(t,e).registerFields({key:[0,(0,SV.getKeySerializer)()],bump:[1,(0,Ri.u8)()],padding:[2,(0,Ri.array)((0,Ri.u8)(),{size:6})],asset:[8,(0,Ri.publicKey)()]}).deserializeUsing(r=>Cf(r))}ht.getAgentValidationV1GpaBuilder=Hme;function Gme(){return 40}ht.getAgentValidationV1Size=Gme;function fT(t,e){let r=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi");return t.eddsa.findPda(r,[(0,Ri.string)({size:"variable"}).serialize("agent_validation"),(0,Ri.publicKey)().serialize(e.asset)])}ht.findAgentValidationV1Pda=fT;async function $me(t,e,r){return EV(t,fT(t,e),r)}ht.fetchAgentValidationV1FromSeeds=$me;async function Zme(t,e,r){return wV(t,fT(t,e),r)}ht.safeFetchAgentValidationV1FromSeeds=Zme});var pS=_(Ku=>{"use strict";a();var Xme=Ku&&Ku.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Yme=Ku&&Ku.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xme(e,t,r)};Object.defineProperty(Ku,"__esModule",{value:!0});Yme(xV(),Ku)});var IV=_(qr=>{"use strict";a();Object.defineProperty(qr,"__esModule",{value:!0});qr.getMplAgentValidationErrorFromName=qr.getMplAgentValidationErrorFromCode=qr.AgentValidationAlreadyRegisteredError=qr.InvalidCoreAssetError=qr.InvalidMplCoreProgramError=qr.InvalidAccountDataError=qr.InvalidInstructionDataError=qr.InvalidSystemProgramError=void 0;var Mf=U(),Fu=new Map,Wu=new Map,$m=class extends Mf.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};qr.InvalidSystemProgramError=$m;Fu.set(0,$m);Wu.set("InvalidSystemProgram",$m);var Zm=class extends Mf.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};qr.InvalidInstructionDataError=Zm;Fu.set(1,Zm);Wu.set("InvalidInstructionData",Zm);var Xm=class extends Mf.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};qr.InvalidAccountDataError=Xm;Fu.set(2,Xm);Wu.set("InvalidAccountData",Xm);var Ym=class extends Mf.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};qr.InvalidMplCoreProgramError=Ym;Fu.set(3,Ym);Wu.set("InvalidMplCoreProgram",Ym);var Jm=class extends Mf.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};qr.InvalidCoreAssetError=Jm;Fu.set(4,Jm);Wu.set("InvalidCoreAsset",Jm);var Qm=class extends Mf.ProgramError{constructor(e,r){super("Agent Validation already registered",e,r),this.name="AgentValidationAlreadyRegistered",this.code=5}};qr.AgentValidationAlreadyRegisteredError=Qm;Fu.set(5,Qm);Wu.set("AgentValidationAlreadyRegistered",Qm);function Jme(t,e,r){let n=Fu.get(t);return n?new n(e,r):null}qr.getMplAgentValidationErrorFromCode=Jme;function Qme(t,e,r){let n=Wu.get(t);return n?new n(e,r):null}qr.getMplAgentValidationErrorFromName=Qme});var pT=_(ju=>{"use strict";a();var e0e=ju&&ju.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t0e=ju&&ju.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e0e(e,t,r)};Object.defineProperty(ju,"__esModule",{value:!0});t0e(IV(),ju)});var hT=_(Ns=>{"use strict";a();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.getAccountMetasAndSigners=Ns.expectPda=Ns.expectPublicKey=Ns.expectSome=void 0;var e0=U();function r0e(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Ns.expectSome=r0e;function n0e(t){if(!t)throw new Error("Expected a PublicKey.");return(0,e0.publicKey)(t,!1)}Ns.expectPublicKey=n0e;function i0e(t){if(!t||!Array.isArray(t)||!(0,e0.isPda)(t))throw new Error("Expected a PDA.");return t}Ns.expectPda=i0e;function s0e(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,e0.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,e0.publicKey)(s.value,!1),isSigner:(0,e0.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Ns.getAccountMetasAndSigners=s0e});var OV=_(rc=>{"use strict";a();Object.defineProperty(rc,"__esModule",{value:!0});rc.registerValidationV1=rc.registerValidationV1InstructionDiscriminator=rc.getRegisterValidationV1InstructionDataSerializer=void 0;var o0e=U(),t0=N(),a0e=pS(),PV=hT();function RV(){return(0,t0.mapSerializer)((0,t0.struct)([["discriminator",(0,t0.u8)()],["padding",(0,t0.array)((0,t0.u8)(),{size:7})]],{description:"RegisterValidationV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}rc.getRegisterValidationV1InstructionDataSerializer=RV;rc.registerValidationV1InstructionDiscriminator=0;function c0e(t,e){let r=t.programs.getPublicKey("mplAgentValidation","VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi"),n={agentValidation:{index:0,isWritable:!0,value:e.agentValidation??null},asset:{index:1,isWritable:!0,value:e.asset??null},collection:{index:2,isWritable:!0,value:e.collection??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:5,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.agentValidation.value||(n.agentValidation.value=(0,a0e.findAgentValidationV1Pda)(t,{asset:(0,PV.expectPublicKey)(n.asset.value)})),n.payer.value||(n.payer.value=t.payer),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,PV.getAccountMetasAndSigners)(i,"programId",r),c=RV().serialize({});return(0,o0e.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}rc.registerValidationV1=c0e});var gT=_(Hu=>{"use strict";a();var u0e=Hu&&Hu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l0e=Hu&&Hu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u0e(e,t,r)};Object.defineProperty(Hu,"__esModule",{value:!0});l0e(OV(),Hu)});var BV=_(Oi=>{"use strict";a();Object.defineProperty(Oi,"__esModule",{value:!0});Oi.getMplAgentValidationProgramId=Oi.getMplAgentValidationProgram=Oi.createMplAgentValidationProgram=Oi.MPL_AGENT_VALIDATION_PROGRAM_ID=void 0;var TV=pT();Oi.MPL_AGENT_VALIDATION_PROGRAM_ID="VALREGY66A9ieJfFUNs5GrxFTy498KUoSU7TbmSePQi";function d0e(){return{name:"mplAgentValidation",publicKey:Oi.MPL_AGENT_VALIDATION_PROGRAM_ID,getErrorFromCode(t,e){return(0,TV.getMplAgentValidationErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,TV.getMplAgentValidationErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Oi.createMplAgentValidationProgram=d0e;function f0e(t,e){return t.programs.get("mplAgentValidation",e)}Oi.getMplAgentValidationProgram=f0e;function p0e(t,e){return t.programs.getPublicKey("mplAgentValidation",Oi.MPL_AGENT_VALIDATION_PROGRAM_ID,e)}Oi.getMplAgentValidationProgramId=p0e});var mT=_(Gu=>{"use strict";a();var h0e=Gu&&Gu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),g0e=Gu&&Gu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h0e(e,t,r)};Object.defineProperty(Gu,"__esModule",{value:!0});g0e(BV(),Gu)});var yT=_(Ti=>{"use strict";a();var m0e=Ti&&Ti.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Nf=Ti&&Ti.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m0e(e,t,r)};Object.defineProperty(Ti,"__esModule",{value:!0});Nf(pS(),Ti);Nf(pT(),Ti);Nf(gT(),Ti);Nf(mT(),Ti);Nf(hT(),Ti);Nf(dT(),Ti)});var kV=_($u=>{"use strict";a();Object.defineProperty($u,"__esModule",{value:!0});$u.getKeySerializer=$u.Key=void 0;var y0e=N(),zV;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.ExecutiveProfileV1=1]="ExecutiveProfileV1",t[t.ExecutionDelegateRecordV1=2]="ExecutionDelegateRecordV1"})(zV=$u.Key||($u.Key={}));function b0e(){return(0,y0e.scalarEnum)(zV,{description:"Key"})}$u.getKeySerializer=b0e});var hS=_(Zu=>{"use strict";a();var A0e=Zu&&Zu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),_0e=Zu&&Zu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A0e(e,t,r)};Object.defineProperty(Zu,"__esModule",{value:!0});_0e(kV(),Zu)});var DV=_(gt=>{"use strict";a();Object.defineProperty(gt,"__esModule",{value:!0});gt.safeFetchExecutionDelegateRecordV1FromSeeds=gt.fetchExecutionDelegateRecordV1FromSeeds=gt.findExecutionDelegateRecordV1Pda=gt.getExecutionDelegateRecordV1Size=gt.getExecutionDelegateRecordV1GpaBuilder=gt.safeFetchAllExecutionDelegateRecordV1=gt.fetchAllExecutionDelegateRecordV1=gt.safeFetchExecutionDelegateRecordV1=gt.fetchExecutionDelegateRecordV1=gt.deserializeExecutionDelegateRecordV1=gt.getExecutionDelegateRecordV1AccountDataSerializer=void 0;var nc=U(),Yr=N(),CV=hS();function MV(){return(0,Yr.mapSerializer)((0,Yr.struct)([["key",(0,CV.getKeySerializer)()],["bump",(0,Yr.u8)()],["padding",(0,Yr.array)((0,Yr.u8)(),{size:6})],["executiveProfile",(0,Yr.publicKey)()],["authority",(0,Yr.publicKey)()],["agentAsset",(0,Yr.publicKey)()]],{description:"ExecutionDelegateRecordV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0]}))}gt.getExecutionDelegateRecordV1AccountDataSerializer=MV;function Lf(t){return(0,nc.deserializeAccount)(t,MV())}gt.deserializeExecutionDelegateRecordV1=Lf;async function NV(t,e,r){let n=await t.rpc.getAccount((0,nc.publicKey)(e,!1),r);return(0,nc.assertAccountExists)(n,"ExecutionDelegateRecordV1"),Lf(n)}gt.fetchExecutionDelegateRecordV1=NV;async function LV(t,e,r){let n=await t.rpc.getAccount((0,nc.publicKey)(e,!1),r);return n.exists?Lf(n):null}gt.safeFetchExecutionDelegateRecordV1=LV;async function S0e(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,nc.publicKey)(i,!1)),r)).map(i=>((0,nc.assertAccountExists)(i,"ExecutionDelegateRecordV1"),Lf(i)))}gt.fetchAllExecutionDelegateRecordV1=S0e;async function v0e(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,nc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Lf(i))}gt.safeFetchAllExecutionDelegateRecordV1=v0e;function E0e(t){let e=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return(0,nc.gpaBuilder)(t,e).registerFields({key:[0,(0,CV.getKeySerializer)()],bump:[1,(0,Yr.u8)()],padding:[2,(0,Yr.array)((0,Yr.u8)(),{size:6})],executiveProfile:[8,(0,Yr.publicKey)()],authority:[40,(0,Yr.publicKey)()],agentAsset:[72,(0,Yr.publicKey)()]}).deserializeUsing(r=>Lf(r))}gt.getExecutionDelegateRecordV1GpaBuilder=E0e;function w0e(){return 104}gt.getExecutionDelegateRecordV1Size=w0e;function bT(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return t.eddsa.findPda(r,[(0,Yr.string)({size:"variable"}).serialize("execution_delegate_record"),(0,Yr.publicKey)().serialize(e.executiveProfile),(0,Yr.publicKey)().serialize(e.agentAsset)])}gt.findExecutionDelegateRecordV1Pda=bT;async function x0e(t,e,r){return NV(t,bT(t,e),r)}gt.fetchExecutionDelegateRecordV1FromSeeds=x0e;async function I0e(t,e,r){return LV(t,bT(t,e),r)}gt.safeFetchExecutionDelegateRecordV1FromSeeds=I0e});var FV=_(mt=>{"use strict";a();Object.defineProperty(mt,"__esModule",{value:!0});mt.safeFetchExecutiveProfileV1FromSeeds=mt.fetchExecutiveProfileV1FromSeeds=mt.findExecutiveProfileV1Pda=mt.getExecutiveProfileV1Size=mt.getExecutiveProfileV1GpaBuilder=mt.safeFetchAllExecutiveProfileV1=mt.fetchAllExecutiveProfileV1=mt.safeFetchExecutiveProfileV1=mt.fetchExecutiveProfileV1=mt.deserializeExecutiveProfileV1=mt.getExecutiveProfileV1AccountDataSerializer=void 0;var ic=U(),Ls=N(),qV=hS();function UV(){return(0,Ls.mapSerializer)((0,Ls.struct)([["key",(0,qV.getKeySerializer)()],["padding",(0,Ls.array)((0,Ls.u8)(),{size:7})],["authority",(0,Ls.publicKey)()]],{description:"ExecutiveProfileV1AccountData"}),t=>({...t,padding:[0,0,0,0,0,0,0]}))}mt.getExecutiveProfileV1AccountDataSerializer=UV;function Df(t){return(0,ic.deserializeAccount)(t,UV())}mt.deserializeExecutiveProfileV1=Df;async function VV(t,e,r){let n=await t.rpc.getAccount((0,ic.publicKey)(e,!1),r);return(0,ic.assertAccountExists)(n,"ExecutiveProfileV1"),Df(n)}mt.fetchExecutiveProfileV1=VV;async function KV(t,e,r){let n=await t.rpc.getAccount((0,ic.publicKey)(e,!1),r);return n.exists?Df(n):null}mt.safeFetchExecutiveProfileV1=KV;async function P0e(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ic.publicKey)(i,!1)),r)).map(i=>((0,ic.assertAccountExists)(i,"ExecutiveProfileV1"),Df(i)))}mt.fetchAllExecutiveProfileV1=P0e;async function R0e(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,ic.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Df(i))}mt.safeFetchAllExecutiveProfileV1=R0e;function O0e(t){let e=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return(0,ic.gpaBuilder)(t,e).registerFields({key:[0,(0,qV.getKeySerializer)()],padding:[1,(0,Ls.array)((0,Ls.u8)(),{size:7})],authority:[8,(0,Ls.publicKey)()]}).deserializeUsing(r=>Df(r))}mt.getExecutiveProfileV1GpaBuilder=O0e;function T0e(){return 40}mt.getExecutiveProfileV1Size=T0e;function AT(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S");return t.eddsa.findPda(r,[(0,Ls.string)({size:"variable"}).serialize("executive_profile"),(0,Ls.publicKey)().serialize(e.authority)])}mt.findExecutiveProfileV1Pda=AT;async function B0e(t,e,r){return VV(t,AT(t,e),r)}mt.fetchExecutiveProfileV1FromSeeds=B0e;async function z0e(t,e,r){return KV(t,AT(t,e),r)}mt.safeFetchExecutiveProfileV1FromSeeds=z0e});var WV=_(sc=>{"use strict";a();Object.defineProperty(sc,"__esModule",{value:!0});sc.findReceiptsTreePda=sc.findReceiptsAuthorityPda=sc.findReceiptsCollectionPda=void 0;var gS=N(),k0e="TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S";function _T(t,e){let r=t.programs.getPublicKey("mplAgentTools",k0e);return t.eddsa.findPda(r,e)}function C0e(t){return _T(t,[(0,gS.string)({size:"variable"}).serialize("receipts_collection")])}sc.findReceiptsCollectionPda=C0e;function M0e(t){return _T(t,[(0,gS.string)({size:"variable"}).serialize("receipts_authority")])}sc.findReceiptsAuthorityPda=M0e;function N0e(t,e){return _T(t,[(0,gS.string)({size:"variable"}).serialize("receipts_tree"),(0,gS.u64)().serialize(e.treeIndex)])}sc.findReceiptsTreePda=N0e});var zo=_(Bo=>{"use strict";a();var L0e=Bo&&Bo.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ST=Bo&&Bo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L0e(e,t,r)};Object.defineProperty(Bo,"__esModule",{value:!0});ST(DV(),Bo);ST(FV(),Bo);ST(WV(),Bo)});var jV=_(Ae=>{"use strict";a();Object.defineProperty(Ae,"__esModule",{value:!0});Ae.getMplAgentToolsErrorFromName=Ae.getMplAgentToolsErrorFromCode=Ae.InvalidCompressionProgramError=Ae.InvalidReceiptsTreeDerivationError=Ae.ReceiptsCollectionAlreadyInitializedError=Ae.InvalidReceiptsAuthorityError=Ae.InvalidReceiptsCollectionError=Ae.ReceiptUriInvalidError=Ae.ExecutiveAuthorityMismatchError=Ae.InvalidBubblegumProgramError=Ae.ExecutiveProfileMustBeInitializedError=Ae.UnauthorizedRevokeError=Ae.ExecutionDelegateRecordMustBeInitializedError=Ae.InvalidExecutiveProfileDerivationError=Ae.AssetOwnerMustBeTheOneToDelegateExecutionError=Ae.AgentIdentityNotRegisteredError=Ae.InvalidAgentIdentityError=Ae.ExecutionDelegateRecordMustBeUninitializedError=Ae.InvalidExecutionDelegateRecordDerivationError=Ae.ExecutiveProfileMustBeUninitializedError=Ae.InvalidCoreAssetError=Ae.InvalidMplCoreProgramError=Ae.InvalidAccountDataError=Ae.InvalidInstructionDataError=Ae.InvalidSystemProgramError=void 0;var St=U(),yt=new Map,bt=new Map,r0=class extends St.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Ae.InvalidSystemProgramError=r0;yt.set(0,r0);bt.set("InvalidSystemProgram",r0);var n0=class extends St.ProgramError{constructor(e,r){super("Invalid instruction data",e,r),this.name="InvalidInstructionData",this.code=1}};Ae.InvalidInstructionDataError=n0;yt.set(1,n0);bt.set("InvalidInstructionData",n0);var i0=class extends St.ProgramError{constructor(e,r){super("Invalid account data",e,r),this.name="InvalidAccountData",this.code=2}};Ae.InvalidAccountDataError=i0;yt.set(2,i0);bt.set("InvalidAccountData",i0);var s0=class extends St.ProgramError{constructor(e,r){super("Invalid MPL Core Program",e,r),this.name="InvalidMplCoreProgram",this.code=3}};Ae.InvalidMplCoreProgramError=s0;yt.set(3,s0);bt.set("InvalidMplCoreProgram",s0);var o0=class extends St.ProgramError{constructor(e,r){super("Invalid Core Asset",e,r),this.name="InvalidCoreAsset",this.code=4}};Ae.InvalidCoreAssetError=o0;yt.set(4,o0);bt.set("InvalidCoreAsset",o0);var a0=class extends St.ProgramError{constructor(e,r){super("Executive Profile must be uninitialized",e,r),this.name="ExecutiveProfileMustBeUninitialized",this.code=5}};Ae.ExecutiveProfileMustBeUninitializedError=a0;yt.set(5,a0);bt.set("ExecutiveProfileMustBeUninitialized",a0);var c0=class extends St.ProgramError{constructor(e,r){super("Invalid Execution Delegate Record Derivation",e,r),this.name="InvalidExecutionDelegateRecordDerivation",this.code=6}};Ae.InvalidExecutionDelegateRecordDerivationError=c0;yt.set(6,c0);bt.set("InvalidExecutionDelegateRecordDerivation",c0);var u0=class extends St.ProgramError{constructor(e,r){super("Execution Delegate Record must be uninitialized",e,r),this.name="ExecutionDelegateRecordMustBeUninitialized",this.code=7}};Ae.ExecutionDelegateRecordMustBeUninitializedError=u0;yt.set(7,u0);bt.set("ExecutionDelegateRecordMustBeUninitialized",u0);var l0=class extends St.ProgramError{constructor(e,r){super("Invalid Agent Identity",e,r),this.name="InvalidAgentIdentity",this.code=8}};Ae.InvalidAgentIdentityError=l0;yt.set(8,l0);bt.set("InvalidAgentIdentity",l0);var d0=class extends St.ProgramError{constructor(e,r){super("Agent Identity not registered",e,r),this.name="AgentIdentityNotRegistered",this.code=9}};Ae.AgentIdentityNotRegisteredError=d0;yt.set(9,d0);bt.set("AgentIdentityNotRegistered",d0);var f0=class extends St.ProgramError{constructor(e,r){super("Asset owner must be the one to delegate execution",e,r),this.name="AssetOwnerMustBeTheOneToDelegateExecution",this.code=10}};Ae.AssetOwnerMustBeTheOneToDelegateExecutionError=f0;yt.set(10,f0);bt.set("AssetOwnerMustBeTheOneToDelegateExecution",f0);var p0=class extends St.ProgramError{constructor(e,r){super("Invalid Executive Profile Derivation",e,r),this.name="InvalidExecutiveProfileDerivation",this.code=11}};Ae.InvalidExecutiveProfileDerivationError=p0;yt.set(11,p0);bt.set("InvalidExecutiveProfileDerivation",p0);var h0=class extends St.ProgramError{constructor(e,r){super("Execution Delegate Record must be initialized",e,r),this.name="ExecutionDelegateRecordMustBeInitialized",this.code=12}};Ae.ExecutionDelegateRecordMustBeInitializedError=h0;yt.set(12,h0);bt.set("ExecutionDelegateRecordMustBeInitialized",h0);var g0=class extends St.ProgramError{constructor(e,r){super("Authority must be asset owner or executive to revoke",e,r),this.name="UnauthorizedRevoke",this.code=13}};Ae.UnauthorizedRevokeError=g0;yt.set(13,g0);bt.set("UnauthorizedRevoke",g0);var m0=class extends St.ProgramError{constructor(e,r){super("Executive Profile must be initialized",e,r),this.name="ExecutiveProfileMustBeInitialized",this.code=14}};Ae.ExecutiveProfileMustBeInitializedError=m0;yt.set(14,m0);bt.set("ExecutiveProfileMustBeInitialized",m0);var y0=class extends St.ProgramError{constructor(e,r){super("Invalid Bubblegum Program",e,r),this.name="InvalidBubblegumProgram",this.code=15}};Ae.InvalidBubblegumProgramError=y0;yt.set(15,y0);bt.set("InvalidBubblegumProgram",y0);var b0=class extends St.ProgramError{constructor(e,r){super("Executive authority does not match the delegate record's authority",e,r),this.name="ExecutiveAuthorityMismatch",this.code=16}};Ae.ExecutiveAuthorityMismatchError=b0;yt.set(16,b0);bt.set("ExecutiveAuthorityMismatch",b0);var A0=class extends St.ProgramError{constructor(e,r){super("Receipt URI must be non-empty and within size limits",e,r),this.name="ReceiptUriInvalid",this.code=17}};Ae.ReceiptUriInvalidError=A0;yt.set(17,A0);bt.set("ReceiptUriInvalid",A0);var _0=class extends St.ProgramError{constructor(e,r){super("Supplied collection is not the canonical receipts collection PDA",e,r),this.name="InvalidReceiptsCollection",this.code=18}};Ae.InvalidReceiptsCollectionError=_0;yt.set(18,_0);bt.set("InvalidReceiptsCollection",_0);var S0=class extends St.ProgramError{constructor(e,r){super("Supplied authority is not the canonical receipts authority PDA",e,r),this.name="InvalidReceiptsAuthority",this.code=19}};Ae.InvalidReceiptsAuthorityError=S0;yt.set(19,S0);bt.set("InvalidReceiptsAuthority",S0);var v0=class extends St.ProgramError{constructor(e,r){super("Receipts collection already exists",e,r),this.name="ReceiptsCollectionAlreadyInitialized",this.code=20}};Ae.ReceiptsCollectionAlreadyInitializedError=v0;yt.set(20,v0);bt.set("ReceiptsCollectionAlreadyInitialized",v0);var E0=class extends St.ProgramError{constructor(e,r){super("Invalid receipts tree PDA derivation",e,r),this.name="InvalidReceiptsTreeDerivation",this.code=21}};Ae.InvalidReceiptsTreeDerivationError=E0;yt.set(21,E0);bt.set("InvalidReceiptsTreeDerivation",E0);var w0=class extends St.ProgramError{constructor(e,r){super("Invalid MPL Account Compression Program",e,r),this.name="InvalidCompressionProgram",this.code=22}};Ae.InvalidCompressionProgramError=w0;yt.set(22,w0);bt.set("InvalidCompressionProgram",w0);function D0e(t,e,r){let n=yt.get(t);return n?new n(e,r):null}Ae.getMplAgentToolsErrorFromCode=D0e;function q0e(t,e,r){let n=bt.get(t);return n?new n(e,r):null}Ae.getMplAgentToolsErrorFromName=q0e});var vT=_(Xu=>{"use strict";a();var U0e=Xu&&Xu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),V0e=Xu&&Xu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&U0e(e,t,r)};Object.defineProperty(Xu,"__esModule",{value:!0});V0e(jV(),Xu)});var ko=_(Ds=>{"use strict";a();Object.defineProperty(Ds,"__esModule",{value:!0});Ds.getAccountMetasAndSigners=Ds.expectPda=Ds.expectPublicKey=Ds.expectSome=void 0;var x0=U();function K0e(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Ds.expectSome=K0e;function F0e(t){if(!t)throw new Error("Expected a PublicKey.");return(0,x0.publicKey)(t,!1)}Ds.expectPublicKey=F0e;function W0e(t){if(!t||!Array.isArray(t)||!(0,x0.isPda)(t))throw new Error("Expected a PDA.");return t}Ds.expectPda=W0e;function j0e(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,x0.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,x0.publicKey)(s.value,!1),isSigner:(0,x0.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Ds.getAccountMetasAndSigners=j0e});var $V=_(oc=>{"use strict";a();Object.defineProperty(oc,"__esModule",{value:!0});oc.closeWorkReceiptV1=oc.closeWorkReceiptV1InstructionDiscriminator=oc.getCloseWorkReceiptV1InstructionDataSerializer=void 0;var H0e=U(),Jr=N(),HV=zo(),G0e=ko();function GV(){return(0,Jr.mapSerializer)((0,Jr.struct)([["discriminator",(0,Jr.u8)()],["pad",(0,Jr.array)((0,Jr.u8)(),{size:7})],["treeIndex",(0,Jr.u64)()],["root",(0,Jr.bytes)({size:32})],["dataHash",(0,Jr.bytes)({size:32})],["creatorHash",(0,Jr.bytes)({size:32})],["assetDataHash",(0,Jr.bytes)({size:32})],["flags",(0,Jr.u8)()],["pad2",(0,Jr.array)((0,Jr.u8)(),{size:7})],["nonce",(0,Jr.u64)()],["index",(0,Jr.u32)()],["pad3",(0,Jr.array)((0,Jr.u8)(),{size:4})]],{description:"CloseWorkReceiptV1InstructionData"}),t=>({...t,discriminator:6,pad:[0,0,0,0,0,0,0],pad2:[0,0,0,0,0,0,0],pad3:[0,0,0,0]}))}oc.getCloseWorkReceiptV1InstructionDataSerializer=GV;oc.closeWorkReceiptV1InstructionDiscriminator=6;function $0e(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},leafOwner:{index:1,isWritable:!1,value:e.leafOwner??null},authority:{index:2,isWritable:!1,value:e.authority??null},treeConfig:{index:3,isWritable:!0,value:e.treeConfig??null},merkleTree:{index:4,isWritable:!0,value:e.merkleTree??null},coreCollection:{index:5,isWritable:!0,value:e.coreCollection??null},mplCoreCpiSigner:{index:6,isWritable:!1,value:e.mplCoreCpiSigner??null},logWrapper:{index:7,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:8,isWritable:!1,value:e.compressionProgram??null},mplCoreProgram:{index:9,isWritable:!1,value:e.mplCoreProgram??null},bubblegumProgram:{index:10,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:11,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,HV.findReceiptsAuthorityPda)(t)),n.coreCollection.value||(n.coreCollection.value=(0,HV.findReceiptsCollectionPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,G0e.getAccountMetasAndSigners)(s,"programId",r),u=GV().serialize(i);return(0,H0e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}oc.closeWorkReceiptV1=$0e});var YV=_(ac=>{"use strict";a();Object.defineProperty(ac,"__esModule",{value:!0});ac.createReceiptsCollectionV1=ac.createReceiptsCollectionV1InstructionDiscriminator=ac.getCreateReceiptsCollectionV1InstructionDataSerializer=void 0;var Z0e=U(),I0=N(),ZV=zo(),X0e=ko();function XV(){return(0,I0.mapSerializer)((0,I0.struct)([["discriminator",(0,I0.u8)()],["padding",(0,I0.array)((0,I0.u8)(),{size:7})]],{description:"CreateReceiptsCollectionV1InstructionData"}),t=>({...t,discriminator:4,padding:[0,0,0,0,0,0,0]}))}ac.getCreateReceiptsCollectionV1InstructionDataSerializer=XV;ac.createReceiptsCollectionV1InstructionDiscriminator=4;function Y0e(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},collection:{index:1,isWritable:!0,value:e.collection??null},authority:{index:2,isWritable:!1,value:e.authority??null},mplCoreProgram:{index:3,isWritable:!1,value:e.mplCoreProgram??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.collection.value||(n.collection.value=(0,ZV.findReceiptsCollectionPda)(t)),n.authority.value||(n.authority.value=(0,ZV.findReceiptsAuthorityPda)(t)),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,X0e.getAccountMetasAndSigners)(i,"programId",r),c=XV().serialize({});return(0,Z0e.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}ac.createReceiptsCollectionV1=Y0e});var QV=_(cc=>{"use strict";a();Object.defineProperty(cc,"__esModule",{value:!0});cc.delegateExecutionV1=cc.delegateExecutionV1InstructionDiscriminator=cc.getDelegateExecutionV1InstructionDataSerializer=void 0;var J0e=U(),P0=N(),Q0e=zo(),ET=ko();function JV(){return(0,P0.mapSerializer)((0,P0.struct)([["discriminator",(0,P0.u8)()],["padding",(0,P0.array)((0,P0.u8)(),{size:7})]],{description:"DelegateExecutionV1InstructionData"}),t=>({...t,discriminator:1,padding:[0,0,0,0,0,0,0]}))}cc.getDelegateExecutionV1InstructionDataSerializer=JV;cc.delegateExecutionV1InstructionDiscriminator=1;function eye(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executiveProfile:{index:0,isWritable:!1,value:e.executiveProfile??null},agentAsset:{index:1,isWritable:!1,value:e.agentAsset??null},agentIdentity:{index:2,isWritable:!1,value:e.agentIdentity??null},executionDelegateRecord:{index:3,isWritable:!0,value:e.executionDelegateRecord??null},payer:{index:4,isWritable:!0,value:e.payer??null},authority:{index:5,isWritable:!1,value:e.authority??null},systemProgram:{index:6,isWritable:!1,value:e.systemProgram??null}};n.executionDelegateRecord.value||(n.executionDelegateRecord.value=(0,Q0e.findExecutionDelegateRecordV1Pda)(t,{executiveProfile:(0,ET.expectPublicKey)(n.executiveProfile.value),agentAsset:(0,ET.expectPublicKey)(n.agentAsset.value)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,ET.getAccountMetasAndSigners)(i,"programId",r),c=JV().serialize({});return(0,J0e.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}cc.delegateExecutionV1=eye});var rK=_(uc=>{"use strict";a();Object.defineProperty(uc,"__esModule",{value:!0});uc.mintWorkReceiptV1=uc.mintWorkReceiptV1InstructionDiscriminator=uc.getMintWorkReceiptV1InstructionDataSerializer=void 0;var tye=U(),Yu=N(),eK=zo(),rye=ko();function tK(){return(0,Yu.mapSerializer)((0,Yu.struct)([["discriminator",(0,Yu.u8)()],["pad",(0,Yu.array)((0,Yu.u8)(),{size:7})],["treeIndex",(0,Yu.u64)()],["receiptUri",(0,Yu.string)()]],{description:"MintWorkReceiptV1InstructionData"}),t=>({...t,discriminator:3,pad:[0,0,0,0,0,0,0]}))}uc.getMintWorkReceiptV1InstructionDataSerializer=tK;uc.mintWorkReceiptV1InstructionDiscriminator=3;function nye(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},executiveAuthority:{index:1,isWritable:!1,value:e.executiveAuthority??null},executionDelegateRecord:{index:2,isWritable:!1,value:e.executionDelegateRecord??null},agentAsset:{index:3,isWritable:!1,value:e.agentAsset??null},client:{index:4,isWritable:!1,value:e.client??null},authority:{index:5,isWritable:!1,value:e.authority??null},treeConfig:{index:6,isWritable:!0,value:e.treeConfig??null},merkleTree:{index:7,isWritable:!0,value:e.merkleTree??null},coreCollection:{index:8,isWritable:!0,value:e.coreCollection??null},mplCoreCpiSigner:{index:9,isWritable:!1,value:e.mplCoreCpiSigner??null},logWrapper:{index:10,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:11,isWritable:!1,value:e.compressionProgram??null},mplCoreProgram:{index:12,isWritable:!1,value:e.mplCoreProgram??null},bubblegumProgram:{index:13,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:14,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,eK.findReceiptsAuthorityPda)(t)),n.coreCollection.value||(n.coreCollection.value=(0,eK.findReceiptsCollectionPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.mplCoreProgram.value||(n.mplCoreProgram.value=t.programs.getPublicKey("mplCore","CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),n.mplCoreProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,rye.getAccountMetasAndSigners)(s,"programId",r),u=tK().serialize(i);return(0,tye.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}uc.mintWorkReceiptV1=nye});var sK=_(lc=>{"use strict";a();Object.defineProperty(lc,"__esModule",{value:!0});lc.registerExecutiveV1=lc.registerExecutiveV1InstructionDiscriminator=lc.getRegisterExecutiveV1InstructionDataSerializer=void 0;var iye=U(),R0=N(),nK=zo(),wT=ko();function iK(){return(0,R0.mapSerializer)((0,R0.struct)([["discriminator",(0,R0.u8)()],["padding",(0,R0.array)((0,R0.u8)(),{size:7})]],{description:"RegisterExecutiveV1InstructionData"}),t=>({...t,discriminator:0,padding:[0,0,0,0,0,0,0]}))}lc.getRegisterExecutiveV1InstructionDataSerializer=iK;lc.registerExecutiveV1InstructionDiscriminator=0;function sye(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executiveProfile:{index:0,isWritable:!0,value:e.executiveProfile??null},payer:{index:1,isWritable:!0,value:e.payer??null},authority:{index:2,isWritable:!1,value:e.authority??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.executiveProfile.value||(n.authority.value?n.executiveProfile.value=(0,nK.findExecutiveProfileV1Pda)(t,{authority:(0,wT.expectPublicKey)(n.authority.value)}):n.executiveProfile.value=(0,nK.findExecutiveProfileV1Pda)(t,{authority:(0,wT.expectPublicKey)(n.payer.value)})),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,wT.getAccountMetasAndSigners)(i,"programId",r),c=iK().serialize({});return(0,iye.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}lc.registerExecutiveV1=sye});var aK=_(dc=>{"use strict";a();Object.defineProperty(dc,"__esModule",{value:!0});dc.registerReceiptsTreeV1=dc.registerReceiptsTreeV1InstructionDiscriminator=dc.getRegisterReceiptsTreeV1InstructionDataSerializer=void 0;var oye=U(),ss=N(),aye=zo(),cye=ko();function oK(){return(0,ss.mapSerializer)((0,ss.struct)([["discriminator",(0,ss.u8)()],["pad",(0,ss.array)((0,ss.u8)(),{size:7})],["treeIndex",(0,ss.u64)()],["maxDepth",(0,ss.u32)()],["maxBufferSize",(0,ss.u32)()],["canopyDepth",(0,ss.u32)()],["pad2",(0,ss.array)((0,ss.u8)(),{size:4})]],{description:"RegisterReceiptsTreeV1InstructionData"}),t=>({...t,discriminator:5,pad:[0,0,0,0,0,0,0],pad2:[0,0,0,0]}))}dc.getRegisterReceiptsTreeV1InstructionDataSerializer=oK;dc.registerReceiptsTreeV1InstructionDiscriminator=5;function uye(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={payer:{index:0,isWritable:!0,value:e.payer??null},authority:{index:1,isWritable:!1,value:e.authority??null},merkleTree:{index:2,isWritable:!0,value:e.merkleTree??null},treeConfig:{index:3,isWritable:!0,value:e.treeConfig??null},logWrapper:{index:4,isWritable:!1,value:e.logWrapper??null},compressionProgram:{index:5,isWritable:!1,value:e.compressionProgram??null},bubblegumProgram:{index:6,isWritable:!1,value:e.bubblegumProgram??null},systemProgram:{index:7,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.authority.value||(n.authority.value=(0,aye.findReceiptsAuthorityPda)(t)),n.logWrapper.value||(n.logWrapper.value=t.programs.getPublicKey("mplNoop","mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"),n.logWrapper.isWritable=!1),n.compressionProgram.value||(n.compressionProgram.value=t.programs.getPublicKey("mplAccountCompression","mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"),n.compressionProgram.isWritable=!1),n.bubblegumProgram.value||(n.bubblegumProgram.value=t.programs.getPublicKey("mplBubblegum","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),n.bubblegumProgram.isWritable=!1),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,cye.getAccountMetasAndSigners)(s,"programId",r),u=oK().serialize(i);return(0,oye.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}dc.registerReceiptsTreeV1=uye});var uK=_(fc=>{"use strict";a();Object.defineProperty(fc,"__esModule",{value:!0});fc.revokeExecutionV1=fc.revokeExecutionV1InstructionDiscriminator=fc.getRevokeExecutionV1InstructionDataSerializer=void 0;var lye=U(),O0=N(),dye=ko();function cK(){return(0,O0.mapSerializer)((0,O0.struct)([["discriminator",(0,O0.u8)()],["padding",(0,O0.array)((0,O0.u8)(),{size:7})]],{description:"RevokeExecutionV1InstructionData"}),t=>({...t,discriminator:2,padding:[0,0,0,0,0,0,0]}))}fc.getRevokeExecutionV1InstructionDataSerializer=cK;fc.revokeExecutionV1InstructionDiscriminator=2;function fye(t,e){let r=t.programs.getPublicKey("mplAgentTools","TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S"),n={executionDelegateRecord:{index:0,isWritable:!0,value:e.executionDelegateRecord??null},agentAsset:{index:1,isWritable:!1,value:e.agentAsset??null},destination:{index:2,isWritable:!0,value:e.destination??null},payer:{index:3,isWritable:!0,value:e.payer??null},authority:{index:4,isWritable:!1,value:e.authority??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,dye.getAccountMetasAndSigners)(i,"programId",r),c=cK().serialize({});return(0,lye.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}fc.revokeExecutionV1=fye});var xT=_(oi=>{"use strict";a();var pye=oi&&oi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ju=oi&&oi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pye(e,t,r)};Object.defineProperty(oi,"__esModule",{value:!0});Ju($V(),oi);Ju(YV(),oi);Ju(QV(),oi);Ju(rK(),oi);Ju(sK(),oi);Ju(aK(),oi);Ju(uK(),oi)});var dK=_(Bi=>{"use strict";a();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.getMplAgentToolsProgramId=Bi.getMplAgentToolsProgram=Bi.createMplAgentToolsProgram=Bi.MPL_AGENT_TOOLS_PROGRAM_ID=void 0;var lK=vT();Bi.MPL_AGENT_TOOLS_PROGRAM_ID="TLREGni9ZEyGC3vnPZtqUh95xQ8oPqJSvNjvB7FGK8S";function hye(){return{name:"mplAgentTools",publicKey:Bi.MPL_AGENT_TOOLS_PROGRAM_ID,getErrorFromCode(t,e){return(0,lK.getMplAgentToolsErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,lK.getMplAgentToolsErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Bi.createMplAgentToolsProgram=hye;function gye(t,e){return t.programs.get("mplAgentTools",e)}Bi.getMplAgentToolsProgram=gye;function mye(t,e){return t.programs.getPublicKey("mplAgentTools",Bi.MPL_AGENT_TOOLS_PROGRAM_ID,e)}Bi.getMplAgentToolsProgramId=mye});var IT=_(Qu=>{"use strict";a();var yye=Qu&&Qu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),bye=Qu&&Qu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yye(e,t,r)};Object.defineProperty(Qu,"__esModule",{value:!0});bye(dK(),Qu)});var PT=_(zi=>{"use strict";a();var Aye=zi&&zi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),qf=zi&&zi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Aye(e,t,r)};Object.defineProperty(zi,"__esModule",{value:!0});qf(zo(),zi);qf(vT(),zi);qf(xT(),zi);qf(IT(),zi);qf(ko(),zi);qf(hS(),zi)});var fK=_(qs=>{"use strict";a();Object.defineProperty(qs,"__esModule",{value:!0});qs.mplAgentTools=qs.mplAgentValidation=qs.mplAgentReputation=qs.mplAgentIdentity=void 0;var _ye=nT(),Sye=lT(),vye=yT(),Eye=PT(),wye=()=>({install(t){t.programs.add((0,_ye.createMplAgentIdentityProgram)(),!1)}});qs.mplAgentIdentity=wye;var xye=()=>({install(t){t.programs.add((0,Sye.createMplAgentReputationProgram)(),!1)}});qs.mplAgentReputation=xye;var Iye=()=>({install(t){t.programs.add((0,vye.createMplAgentValidationProgram)(),!1)}});qs.mplAgentValidation=Iye;var Pye=()=>({install(t){t.programs.add((0,Eye.createMplAgentToolsProgram)(),!1)}});qs.mplAgentTools=Pye});var yS=_(Fe=>{"use strict";a();var pK=Fe&&Fe.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Rye=Fe&&Fe.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Vn=Fe&&Fe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pK(e,t,r)},mS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pK(e,t,r);return Rye(e,t),e};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.tools=Fe.validation=Fe.reputation=Fe.identity=void 0;Vn(NU(),Fe);Vn(fK(),Fe);Fe.identity=mS(nT());Fe.reputation=mS(lT());Fe.validation=mS(yT());Fe.tools=mS(PT());Vn(xm(),Fe);Vn(tT(),Fe);Vn(rT(),Fe);Vn(fS(),Fe);Vn(cT(),Fe);Vn(uT(),Fe);Vn(pS(),Fe);Vn(gT(),Fe);Vn(mT(),Fe);Vn(zo(),Fe);Vn(xT(),Fe);Vn(IT(),Fe)});var yK=_(Pt=>{"use strict";a();Object.defineProperty(Pt,"__esModule",{value:!0});Pt.safeFetchAddressLookupTableFromSeeds=Pt.fetchAddressLookupTableFromSeeds=Pt.findAddressLookupTablePda=Pt.getAddressLookupTableGpaBuilder=Pt.safeFetchAllAddressLookupTable=Pt.fetchAllAddressLookupTable=Pt.safeFetchAddressLookupTable=Pt.fetchAddressLookupTable=Pt.deserializeAddressLookupTable=Pt.getAddressLookupTableAccountDataSerializer=void 0;var pc=U(),It=N();function hK(){return(0,It.mapSerializer)((0,It.struct)([["discriminator",(0,It.u32)()],["deactivationSlot",(0,It.u64)()],["lastExtendedSlot",(0,It.u64)()],["lastExtendedStartIndex",(0,It.u8)()],["authority",(0,It.option)((0,It.publicKey)(),{fixed:!0})],["padding",(0,It.u16)()],["addresses",(0,It.array)((0,It.publicKey)(),{size:"remainder"})]],{description:"AddressLookupTableAccountData"}),t=>({...t,discriminator:1,padding:0}))}Pt.getAddressLookupTableAccountDataSerializer=hK;function Uf(t){return(0,pc.deserializeAccount)(t,hK())}Pt.deserializeAddressLookupTable=Uf;async function gK(t,e,r){let n=await t.rpc.getAccount((0,pc.publicKey)(e,!1),r);return(0,pc.assertAccountExists)(n,"AddressLookupTable"),Uf(n)}Pt.fetchAddressLookupTable=gK;async function mK(t,e,r){let n=await t.rpc.getAccount((0,pc.publicKey)(e,!1),r);return n.exists?Uf(n):null}Pt.safeFetchAddressLookupTable=mK;async function Oye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,pc.publicKey)(i,!1)),r)).map(i=>((0,pc.assertAccountExists)(i,"AddressLookupTable"),Uf(i)))}Pt.fetchAllAddressLookupTable=Oye;async function Tye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,pc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Uf(i))}Pt.safeFetchAllAddressLookupTable=Tye;function Bye(t){let e=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111");return(0,pc.gpaBuilder)(t,e).registerFields({discriminator:[0,(0,It.u32)()],deactivationSlot:[4,(0,It.u64)()],lastExtendedSlot:[12,(0,It.u64)()],lastExtendedStartIndex:[20,(0,It.u8)()],authority:[21,(0,It.option)((0,It.publicKey)(),{fixed:!0})],padding:[54,(0,It.u16)()],addresses:[56,(0,It.array)((0,It.publicKey)(),{size:"remainder"})]}).deserializeUsing(r=>Uf(r)).whereField("discriminator",1)}Pt.getAddressLookupTableGpaBuilder=Bye;function RT(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111");return t.eddsa.findPda(r,[(0,It.publicKey)().serialize(e.authority),(0,It.u64)().serialize(e.recentSlot)])}Pt.findAddressLookupTablePda=RT;async function zye(t,e,r){return gK(t,RT(t,e),r)}Pt.fetchAddressLookupTableFromSeeds=zye;async function kye(t,e,r){return mK(t,RT(t,e),r)}Pt.safeFetchAddressLookupTableFromSeeds=kye});var AK=_(Ur=>{"use strict";a();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getMintSize=Ur.getMintGpaBuilder=Ur.safeFetchAllMint=Ur.fetchAllMint=Ur.safeFetchMint=Ur.fetchMint=Ur.deserializeMint=Ur.getMintAccountDataSerializer=void 0;var hc=U(),wr=N();function bK(){return(0,wr.struct)([["mintAuthority",(0,wr.option)((0,wr.publicKey)(),{prefix:(0,wr.u32)(),fixed:!0})],["supply",(0,wr.u64)()],["decimals",(0,wr.u8)()],["isInitialized",(0,wr.bool)()],["freezeAuthority",(0,wr.option)((0,wr.publicKey)(),{prefix:(0,wr.u32)(),fixed:!0})]],{description:"MintAccountData"})}Ur.getMintAccountDataSerializer=bK;function Vf(t){return(0,hc.deserializeAccount)(t,bK())}Ur.deserializeMint=Vf;async function Cye(t,e,r){let n=await t.rpc.getAccount((0,hc.publicKey)(e,!1),r);return(0,hc.assertAccountExists)(n,"Mint"),Vf(n)}Ur.fetchMint=Cye;async function Mye(t,e,r){let n=await t.rpc.getAccount((0,hc.publicKey)(e,!1),r);return n.exists?Vf(n):null}Ur.safeFetchMint=Mye;async function Nye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,hc.publicKey)(i,!1)),r)).map(i=>((0,hc.assertAccountExists)(i,"Mint"),Vf(i)))}Ur.fetchAllMint=Nye;async function Lye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,hc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Vf(i))}Ur.safeFetchAllMint=Lye;function Dye(t){let e=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");return(0,hc.gpaBuilder)(t,e).registerFields({mintAuthority:[0,(0,wr.option)((0,wr.publicKey)(),{prefix:(0,wr.u32)(),fixed:!0})],supply:[36,(0,wr.u64)()],decimals:[44,(0,wr.u8)()],isInitialized:[45,(0,wr.bool)()],freezeAuthority:[46,(0,wr.option)((0,wr.publicKey)(),{prefix:(0,wr.u32)(),fixed:!0})]}).deserializeUsing(r=>Vf(r)).whereSize(82)}Ur.getMintGpaBuilder=Dye;function qye(){return 82}Ur.getMintSize=qye});var SK=_(Vr=>{"use strict";a();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.getMultisigSize=Vr.getMultisigGpaBuilder=Vr.safeFetchAllMultisig=Vr.fetchAllMultisig=Vr.safeFetchMultisig=Vr.fetchMultisig=Vr.deserializeMultisig=Vr.getMultisigAccountDataSerializer=void 0;var gc=U(),os=N();function _K(){return(0,os.struct)([["m",(0,os.u8)()],["n",(0,os.u8)()],["isInitialized",(0,os.bool)()],["signers",(0,os.array)((0,os.publicKey)(),{size:11})]],{description:"MultisigAccountData"})}Vr.getMultisigAccountDataSerializer=_K;function Kf(t){return(0,gc.deserializeAccount)(t,_K())}Vr.deserializeMultisig=Kf;async function Uye(t,e,r){let n=await t.rpc.getAccount((0,gc.publicKey)(e,!1),r);return(0,gc.assertAccountExists)(n,"Multisig"),Kf(n)}Vr.fetchMultisig=Uye;async function Vye(t,e,r){let n=await t.rpc.getAccount((0,gc.publicKey)(e,!1),r);return n.exists?Kf(n):null}Vr.safeFetchMultisig=Vye;async function Kye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,gc.publicKey)(i,!1)),r)).map(i=>((0,gc.assertAccountExists)(i,"Multisig"),Kf(i)))}Vr.fetchAllMultisig=Kye;async function Fye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,gc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Kf(i))}Vr.safeFetchAllMultisig=Fye;function Wye(t){let e=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");return(0,gc.gpaBuilder)(t,e).registerFields({m:[0,(0,os.u8)()],n:[1,(0,os.u8)()],isInitialized:[2,(0,os.bool)()],signers:[3,(0,os.array)((0,os.publicKey)(),{size:11})]}).deserializeUsing(r=>Kf(r)).whereSize(355)}Vr.getMultisigGpaBuilder=Wye;function jye(){return 355}Vr.getMultisigSize=jye});var EK=_(el=>{"use strict";a();Object.defineProperty(el,"__esModule",{value:!0});el.getAuthorityTypeSerializer=el.AuthorityType=void 0;var Hye=N(),vK;(function(t){t[t.MintTokens=0]="MintTokens",t[t.FreezeAccount=1]="FreezeAccount",t[t.AccountOwner=2]="AccountOwner",t[t.CloseAccount=3]="CloseAccount"})(vK=el.AuthorityType||(el.AuthorityType={}));function Gye(){return(0,Hye.scalarEnum)(vK,{description:"AuthorityType"})}el.getAuthorityTypeSerializer=Gye});var xK=_(tl=>{"use strict";a();Object.defineProperty(tl,"__esModule",{value:!0});tl.getTokenStateSerializer=tl.TokenState=void 0;var $ye=N(),wK;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"})(wK=tl.TokenState||(tl.TokenState={}));function Zye(){return(0,$ye.scalarEnum)(wK,{description:"TokenState"})}tl.getTokenStateSerializer=Zye});var bS=_(mc=>{"use strict";a();var Xye=mc&&mc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),IK=mc&&mc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xye(e,t,r)};Object.defineProperty(mc,"__esModule",{value:!0});IK(EK(),mc);IK(xK(),mc)});var OK=_(Kr=>{"use strict";a();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.getTokenSize=Kr.getTokenGpaBuilder=Kr.safeFetchAllToken=Kr.fetchAllToken=Kr.safeFetchToken=Kr.fetchToken=Kr.deserializeToken=Kr.getTokenAccountDataSerializer=void 0;var yc=U(),tt=N(),PK=bS();function RK(){return(0,tt.struct)([["mint",(0,tt.publicKey)()],["owner",(0,tt.publicKey)()],["amount",(0,tt.u64)()],["delegate",(0,tt.option)((0,tt.publicKey)(),{prefix:(0,tt.u32)(),fixed:!0})],["state",(0,PK.getTokenStateSerializer)()],["isNative",(0,tt.option)((0,tt.u64)(),{prefix:(0,tt.u32)(),fixed:!0})],["delegatedAmount",(0,tt.u64)()],["closeAuthority",(0,tt.option)((0,tt.publicKey)(),{prefix:(0,tt.u32)(),fixed:!0})]],{description:"TokenAccountData"})}Kr.getTokenAccountDataSerializer=RK;function Ff(t){return(0,yc.deserializeAccount)(t,RK())}Kr.deserializeToken=Ff;async function Yye(t,e,r){let n=await t.rpc.getAccount((0,yc.publicKey)(e,!1),r);return(0,yc.assertAccountExists)(n,"Token"),Ff(n)}Kr.fetchToken=Yye;async function Jye(t,e,r){let n=await t.rpc.getAccount((0,yc.publicKey)(e,!1),r);return n.exists?Ff(n):null}Kr.safeFetchToken=Jye;async function Qye(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,yc.publicKey)(i,!1)),r)).map(i=>((0,yc.assertAccountExists)(i,"Token"),Ff(i)))}Kr.fetchAllToken=Qye;async function e1e(t,e,r){return(await t.rpc.getAccounts(e.map(i=>(0,yc.publicKey)(i,!1)),r)).filter(i=>i.exists).map(i=>Ff(i))}Kr.safeFetchAllToken=e1e;function t1e(t){let e=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");return(0,yc.gpaBuilder)(t,e).registerFields({mint:[0,(0,tt.publicKey)()],owner:[32,(0,tt.publicKey)()],amount:[64,(0,tt.u64)()],delegate:[72,(0,tt.option)((0,tt.publicKey)(),{prefix:(0,tt.u32)(),fixed:!0})],state:[108,(0,PK.getTokenStateSerializer)()],isNative:[109,(0,tt.option)((0,tt.u64)(),{prefix:(0,tt.u32)(),fixed:!0})],delegatedAmount:[121,(0,tt.u64)()],closeAuthority:[129,(0,tt.option)((0,tt.publicKey)(),{prefix:(0,tt.u32)(),fixed:!0})]}).deserializeUsing(r=>Ff(r)).whereSize(165)}Kr.getTokenGpaBuilder=t1e;function r1e(){return 165}Kr.getTokenSize=r1e});var _S=_(Us=>{"use strict";a();var n1e=Us&&Us.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),AS=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n1e(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});AS(yK(),Us);AS(AK(),Us);AS(SK(),Us);AS(OK(),Us)});var BK=_(Vs=>{"use strict";a();Object.defineProperty(Vs,"__esModule",{value:!0});Vs.getMplSystemExtrasErrorFromName=Vs.getMplSystemExtrasErrorFromCode=Vs.SysExInvalidOwnerForSourceError=Vs.SysExInvalidSystemProgramError=void 0;var TK=U(),OT=new Map,TT=new Map,T0=class extends TK.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Vs.SysExInvalidSystemProgramError=T0;OT.set(0,T0);TT.set("InvalidSystemProgram",T0);var B0=class extends TK.ProgramError{constructor(e,r){super("Invalid Program Owner For The Source Account",e,r),this.name="InvalidOwnerForSource",this.code=1}};Vs.SysExInvalidOwnerForSourceError=B0;OT.set(1,B0);TT.set("InvalidOwnerForSource",B0);function i1e(t,e,r){let n=OT.get(t);return n?new n(e,r):null}Vs.getMplSystemExtrasErrorFromCode=i1e;function s1e(t,e,r){let n=TT.get(t);return n?new n(e,r):null}Vs.getMplSystemExtrasErrorFromName=s1e});var zK=_(Rt=>{"use strict";a();Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getMplTokenExtrasErrorFromName=Rt.getMplTokenExtrasErrorFromCode=Rt.TokExCannotCreateNonAssociatedTokenError=Rt.TokExInvalidTokenOwnerError=Rt.TokExInvalidTokenMintError=Rt.TokExInvalidProgramOwnerError=Rt.TokExInvalidAssociatedTokenAccountError=Rt.TokExInvalidAssociatedTokenProgramError=Rt.TokExInvalidTokenProgramError=Rt.TokExInvalidSystemProgramError=void 0;var bc=U(),Co=new Map,Mo=new Map,z0=class extends bc.ProgramError{constructor(e,r){super("Invalid System Program",e,r),this.name="InvalidSystemProgram",this.code=0}};Rt.TokExInvalidSystemProgramError=z0;Co.set(0,z0);Mo.set("InvalidSystemProgram",z0);var k0=class extends bc.ProgramError{constructor(e,r){super("Invalid Token Program",e,r),this.name="InvalidTokenProgram",this.code=1}};Rt.TokExInvalidTokenProgramError=k0;Co.set(1,k0);Mo.set("InvalidTokenProgram",k0);var C0=class extends bc.ProgramError{constructor(e,r){super("Invalid Associated Token Program",e,r),this.name="InvalidAssociatedTokenProgram",this.code=2}};Rt.TokExInvalidAssociatedTokenProgramError=C0;Co.set(2,C0);Mo.set("InvalidAssociatedTokenProgram",C0);var M0=class extends bc.ProgramError{constructor(e,r){super("Invalid Associated Token Account: it should derive from the provided mint and owner",e,r),this.name="InvalidAssociatedTokenAccount",this.code=3}};Rt.TokExInvalidAssociatedTokenAccountError=M0;Co.set(3,M0);Mo.set("InvalidAssociatedTokenAccount",M0);var N0=class extends bc.ProgramError{constructor(e,r){super("Invalid Program Owner",e,r),this.name="InvalidProgramOwner",this.code=4}};Rt.TokExInvalidProgramOwnerError=N0;Co.set(4,N0);Mo.set("InvalidProgramOwner",N0);var L0=class extends bc.ProgramError{constructor(e,r){super("Invalid Token Mint: it should be the same as the provided mint account",e,r),this.name="InvalidTokenMint",this.code=5}};Rt.TokExInvalidTokenMintError=L0;Co.set(5,L0);Mo.set("InvalidTokenMint",L0);var D0=class extends bc.ProgramError{constructor(e,r){super("Invalid Program Owner: it should be the same as the provided owner account",e,r),this.name="InvalidTokenOwner",this.code=6}};Rt.TokExInvalidTokenOwnerError=D0;Co.set(6,D0);Mo.set("InvalidTokenOwner",D0);var q0=class extends bc.ProgramError{constructor(e,r){super("Cannot create non-associated token accounts as they would need to sign the transaction. Please provide an associated token account instead",e,r),this.name="CannotCreateNonAssociatedToken",this.code=7}};Rt.TokExCannotCreateNonAssociatedTokenError=q0;Co.set(7,q0);Mo.set("CannotCreateNonAssociatedToken",q0);function o1e(t,e,r){let n=Co.get(t);return n?new n(e,r):null}Rt.getMplTokenExtrasErrorFromCode=o1e;function a1e(t,e,r){let n=Mo.get(t);return n?new n(e,r):null}Rt.getMplTokenExtrasErrorFromName=a1e});var kK=_(Wf=>{"use strict";a();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.getSplAddressLookupTableErrorFromName=Wf.getSplAddressLookupTableErrorFromCode=void 0;var c1e=new Map,u1e=new Map;function l1e(t,e,r){let n=c1e.get(t);return n?new n(e,r):null}Wf.getSplAddressLookupTableErrorFromCode=l1e;function d1e(t,e,r){let n=u1e.get(t);return n?new n(e,r):null}Wf.getSplAddressLookupTableErrorFromName=d1e});var NK=_(Ac=>{"use strict";a();Object.defineProperty(Ac,"__esModule",{value:!0});Ac.getSplAssociatedTokenErrorFromName=Ac.getSplAssociatedTokenErrorFromCode=Ac.AtaInvalidOwnerError=void 0;var f1e=U(),CK=new Map,MK=new Map,U0=class extends f1e.ProgramError{constructor(e,r){super("Associated token account owner does not match address derivation",e,r),this.name="InvalidOwner",this.code=0}};Ac.AtaInvalidOwnerError=U0;CK.set(0,U0);MK.set("InvalidOwner",U0);function p1e(t,e,r){let n=CK.get(t);return n?new n(e,r):null}Ac.getSplAssociatedTokenErrorFromCode=p1e;function h1e(t,e,r){let n=MK.get(t);return n?new n(e,r):null}Ac.getSplAssociatedTokenErrorFromName=h1e});var LK=_(jf=>{"use strict";a();Object.defineProperty(jf,"__esModule",{value:!0});jf.getSplComputeBudgetErrorFromName=jf.getSplComputeBudgetErrorFromCode=void 0;var g1e=new Map,m1e=new Map;function y1e(t,e,r){let n=g1e.get(t);return n?new n(e,r):null}jf.getSplComputeBudgetErrorFromCode=y1e;function b1e(t,e,r){let n=m1e.get(t);return n?new n(e,r):null}jf.getSplComputeBudgetErrorFromName=b1e});var DK=_(Hf=>{"use strict";a();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.getSplMemoErrorFromName=Hf.getSplMemoErrorFromCode=void 0;var A1e=new Map,_1e=new Map;function S1e(t,e,r){let n=A1e.get(t);return n?new n(e,r):null}Hf.getSplMemoErrorFromCode=S1e;function v1e(t,e,r){let n=_1e.get(t);return n?new n(e,r):null}Hf.getSplMemoErrorFromName=v1e});var qK=_(Gf=>{"use strict";a();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.getSplSystemErrorFromName=Gf.getSplSystemErrorFromCode=void 0;var E1e=new Map,w1e=new Map;function x1e(t,e,r){let n=E1e.get(t);return n?new n(e,r):null}Gf.getSplSystemErrorFromCode=x1e;function I1e(t,e,r){let n=w1e.get(t);return n?new n(e,r):null}Gf.getSplSystemErrorFromName=I1e});var UK=_(Ie=>{"use strict";a();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.getSplTokenErrorFromName=Ie.getSplTokenErrorFromCode=Ie.TokNonNativeNotSupportedError=Ie.TokMintDecimalsMismatchError=Ie.TokAccountFrozenError=Ie.TokMintCannotFreezeError=Ie.TokAuthorityTypeNotSupportedError=Ie.TokOverflowError=Ie.TokInvalidStateError=Ie.TokInvalidInstructionError=Ie.TokNonNativeHasBalanceError=Ie.TokNativeNotSupportedError=Ie.TokUninitializedStateError=Ie.TokInvalidNumberOfRequiredSignersError=Ie.TokInvalidNumberOfProvidedSignersError=Ie.TokAlreadyInUseError=Ie.TokFixedSupplyError=Ie.TokOwnerMismatchError=Ie.TokMintMismatchError=Ie.TokInvalidMintError=Ie.TokInsufficientFundsError=Ie.TokNotRentExemptError=void 0;var br=U(),kt=new Map,Ct=new Map,V0=class extends br.ProgramError{constructor(e,r){super("Lamport balance below rent-exempt threshold",e,r),this.name="NotRentExempt",this.code=0}};Ie.TokNotRentExemptError=V0;kt.set(0,V0);Ct.set("NotRentExempt",V0);var K0=class extends br.ProgramError{constructor(e,r){super("Insufficient funds",e,r),this.name="InsufficientFunds",this.code=1}};Ie.TokInsufficientFundsError=K0;kt.set(1,K0);Ct.set("InsufficientFunds",K0);var F0=class extends br.ProgramError{constructor(e,r){super("Invalid Mint",e,r),this.name="InvalidMint",this.code=2}};Ie.TokInvalidMintError=F0;kt.set(2,F0);Ct.set("InvalidMint",F0);var W0=class extends br.ProgramError{constructor(e,r){super("Account not associated with this Mint",e,r),this.name="MintMismatch",this.code=3}};Ie.TokMintMismatchError=W0;kt.set(3,W0);Ct.set("MintMismatch",W0);var j0=class extends br.ProgramError{constructor(e,r){super("Owner does not match",e,r),this.name="OwnerMismatch",this.code=4}};Ie.TokOwnerMismatchError=j0;kt.set(4,j0);Ct.set("OwnerMismatch",j0);var H0=class extends br.ProgramError{constructor(e,r){super("Fixed supply",e,r),this.name="FixedSupply",this.code=5}};Ie.TokFixedSupplyError=H0;kt.set(5,H0);Ct.set("FixedSupply",H0);var G0=class extends br.ProgramError{constructor(e,r){super("Already in use",e,r),this.name="AlreadyInUse",this.code=6}};Ie.TokAlreadyInUseError=G0;kt.set(6,G0);Ct.set("AlreadyInUse",G0);var $0=class extends br.ProgramError{constructor(e,r){super("Invalid number of provided signers",e,r),this.name="InvalidNumberOfProvidedSigners",this.code=7}};Ie.TokInvalidNumberOfProvidedSignersError=$0;kt.set(7,$0);Ct.set("InvalidNumberOfProvidedSigners",$0);var Z0=class extends br.ProgramError{constructor(e,r){super("Invalid number of required signers",e,r),this.name="InvalidNumberOfRequiredSigners",this.code=8}};Ie.TokInvalidNumberOfRequiredSignersError=Z0;kt.set(8,Z0);Ct.set("InvalidNumberOfRequiredSigners",Z0);var X0=class extends br.ProgramError{constructor(e,r){super("State is unititialized",e,r),this.name="UninitializedState",this.code=9}};Ie.TokUninitializedStateError=X0;kt.set(9,X0);Ct.set("UninitializedState",X0);var Y0=class extends br.ProgramError{constructor(e,r){super("Instruction does not support native tokens",e,r),this.name="NativeNotSupported",this.code=10}};Ie.TokNativeNotSupportedError=Y0;kt.set(10,Y0);Ct.set("NativeNotSupported",Y0);var J0=class extends br.ProgramError{constructor(e,r){super("Non-native account can only be closed if its balance is zero",e,r),this.name="NonNativeHasBalance",this.code=11}};Ie.TokNonNativeHasBalanceError=J0;kt.set(11,J0);Ct.set("NonNativeHasBalance",J0);var Q0=class extends br.ProgramError{constructor(e,r){super("Invalid instruction",e,r),this.name="InvalidInstruction",this.code=12}};Ie.TokInvalidInstructionError=Q0;kt.set(12,Q0);Ct.set("InvalidInstruction",Q0);var ey=class extends br.ProgramError{constructor(e,r){super("State is invalid for requested operation",e,r),this.name="InvalidState",this.code=13}};Ie.TokInvalidStateError=ey;kt.set(13,ey);Ct.set("InvalidState",ey);var ty=class extends br.ProgramError{constructor(e,r){super("Operation overflowed",e,r),this.name="Overflow",this.code=14}};Ie.TokOverflowError=ty;kt.set(14,ty);Ct.set("Overflow",ty);var ry=class extends br.ProgramError{constructor(e,r){super("Account does not support specified authority type",e,r),this.name="AuthorityTypeNotSupported",this.code=15}};Ie.TokAuthorityTypeNotSupportedError=ry;kt.set(15,ry);Ct.set("AuthorityTypeNotSupported",ry);var ny=class extends br.ProgramError{constructor(e,r){super("This token mint cannot freeze accounts",e,r),this.name="MintCannotFreeze",this.code=16}};Ie.TokMintCannotFreezeError=ny;kt.set(16,ny);Ct.set("MintCannotFreeze",ny);var iy=class extends br.ProgramError{constructor(e,r){super("Account is frozen",e,r),this.name="AccountFrozen",this.code=17}};Ie.TokAccountFrozenError=iy;kt.set(17,iy);Ct.set("AccountFrozen",iy);var sy=class extends br.ProgramError{constructor(e,r){super("The provided decimals value different from the Mint decimals",e,r),this.name="MintDecimalsMismatch",this.code=18}};Ie.TokMintDecimalsMismatchError=sy;kt.set(18,sy);Ct.set("MintDecimalsMismatch",sy);var oy=class extends br.ProgramError{constructor(e,r){super("Instruction does not support non-native tokens",e,r),this.name="NonNativeNotSupported",this.code=19}};Ie.TokNonNativeNotSupportedError=oy;kt.set(19,oy);Ct.set("NonNativeNotSupported",oy);function P1e(t,e,r){let n=kt.get(t);return n?new n(e,r):null}Ie.getSplTokenErrorFromCode=P1e;function R1e(t,e,r){let n=Ct.get(t);return n?new n(e,r):null}Ie.getSplTokenErrorFromName=R1e});var Ks=_(Kn=>{"use strict";a();var O1e=Kn&&Kn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),_c=Kn&&Kn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&O1e(e,t,r)};Object.defineProperty(Kn,"__esModule",{value:!0});_c(BK(),Kn);_c(zK(),Kn);_c(kK(),Kn);_c(NK(),Kn);_c(LK(),Kn);_c(DK(),Kn);_c(qK(),Kn);_c(UK(),Kn)});var Re=_(Fs=>{"use strict";a();Object.defineProperty(Fs,"__esModule",{value:!0});Fs.getAccountMetasAndSigners=Fs.expectPda=Fs.expectPublicKey=Fs.expectSome=void 0;var ay=U();function T1e(t){if(t==null)throw new Error("Expected a value but received null or undefined.");return t}Fs.expectSome=T1e;function B1e(t){if(!t)throw new Error("Expected a PublicKey.");return(0,ay.publicKey)(t,!1)}Fs.expectPublicKey=B1e;function z1e(t){if(!t||!Array.isArray(t)||!(0,ay.isPda)(t))throw new Error("Expected a PDA.");return t}Fs.expectPda=z1e;function k1e(t,e,r){let n=[],i=[];return t.forEach(s=>{if(!s.value){if(e==="omitted")return;n.push({pubkey:r,isSigner:!1,isWritable:!1});return}(0,ay.isSigner)(s.value)&&i.push(s.value),n.push({pubkey:(0,ay.publicKey)(s.value,!1),isSigner:(0,ay.isSigner)(s.value),isWritable:s.isWritable})}),[n,i]}Fs.getAccountMetasAndSigners=k1e});var FK=_($f=>{"use strict";a();Object.defineProperty($f,"__esModule",{value:!0});$f.addMemo=$f.getAddMemoInstructionDataSerializer=void 0;var C1e=U(),VK=N(),M1e=Re();function KK(){return(0,VK.struct)([["memo",(0,VK.string)()]],{description:"AddMemoInstructionData"})}$f.getAddMemoInstructionDataSerializer=KK;function N1e(t,e){let r=t.programs.getPublicKey("splMemo","Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"),n={},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,M1e.getAccountMetasAndSigners)(s,"programId",r),u=KK().serialize(i);return(0,C1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}$f.addMemo=N1e});var jK=_(Zf=>{"use strict";a();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.amountToUiAmount=Zf.getAmountToUiAmountInstructionDataSerializer=void 0;var L1e=U(),SS=N(),D1e=Re();function WK(){return(0,SS.mapSerializer)((0,SS.struct)([["discriminator",(0,SS.u8)()],["amount",(0,SS.u64)()]],{description:"AmountToUiAmountInstructionData"}),t=>({...t,discriminator:23}))}Zf.getAmountToUiAmountInstructionDataSerializer=WK;function q1e(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!1,value:e.mint??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,D1e.getAccountMetasAndSigners)(s,"programId",r),u=WK().serialize(i);return(0,L1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Zf.amountToUiAmount=q1e});var GK=_(Xf=>{"use strict";a();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.approveTokenDelegate=Xf.getApproveTokenDelegateInstructionDataSerializer=void 0;var U1e=U(),vS=N(),V1e=Re();function HK(){return(0,vS.mapSerializer)((0,vS.struct)([["discriminator",(0,vS.u8)()],["amount",(0,vS.u64)()]],{description:"ApproveTokenDelegateInstructionData"}),t=>({...t,discriminator:4}))}Xf.getApproveTokenDelegateInstructionDataSerializer=HK;function K1e(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={source:{index:0,isWritable:!0,value:e.source??null},delegate:{index:1,isWritable:!1,value:e.delegate??null},owner:{index:2,isWritable:!1,value:e.owner??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,V1e.getAccountMetasAndSigners)(s,"programId",r),u=HK().serialize(i);return(0,U1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Xf.approveTokenDelegate=K1e});var ZK=_(Yf=>{"use strict";a();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.approveTokenDelegateChecked=Yf.getApproveTokenDelegateCheckedInstructionDataSerializer=void 0;var F1e=U(),cy=N(),W1e=Re();function $K(){return(0,cy.mapSerializer)((0,cy.struct)([["discriminator",(0,cy.u8)()],["amount",(0,cy.u64)()],["decimals",(0,cy.u8)()]],{description:"ApproveTokenDelegateCheckedInstructionData"}),t=>({...t,discriminator:13}))}Yf.getApproveTokenDelegateCheckedInstructionDataSerializer=$K;function j1e(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={source:{index:0,isWritable:!0,value:e.source??null},mint:{index:1,isWritable:!1,value:e.mint??null},delegate:{index:2,isWritable:!1,value:e.delegate??null},owner:{index:3,isWritable:!1,value:e.owner??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,W1e.getAccountMetasAndSigners)(s,"programId",r),u=$K().serialize(i);return(0,F1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Yf.approveTokenDelegateChecked=j1e});var YK=_(Jf=>{"use strict";a();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.burnToken=Jf.getBurnTokenInstructionDataSerializer=void 0;var H1e=U(),ES=N(),G1e=Re();function XK(){return(0,ES.mapSerializer)((0,ES.struct)([["discriminator",(0,ES.u8)()],["amount",(0,ES.u64)()]],{description:"BurnTokenInstructionData"}),t=>({...t,discriminator:8}))}Jf.getBurnTokenInstructionDataSerializer=XK;function $1e(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!0,value:e.mint??null},authority:{index:2,isWritable:!1,value:e.authority??null}},i={...e};n.authority.value||(n.authority.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,G1e.getAccountMetasAndSigners)(s,"programId",r),u=XK().serialize(i);return(0,H1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Jf.burnToken=$1e});var QK=_(Qf=>{"use strict";a();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.burnTokenChecked=Qf.getBurnTokenCheckedInstructionDataSerializer=void 0;var Z1e=U(),uy=N(),X1e=Re();function JK(){return(0,uy.mapSerializer)((0,uy.struct)([["discriminator",(0,uy.u8)()],["amount",(0,uy.u64)()],["decimals",(0,uy.u8)()]],{description:"BurnTokenCheckedInstructionData"}),t=>({...t,discriminator:15}))}Qf.getBurnTokenCheckedInstructionDataSerializer=JK;function Y1e(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!0,value:e.mint??null},authority:{index:2,isWritable:!1,value:e.authority??null}},i={...e};n.authority.value||(n.authority.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,X1e.getAccountMetasAndSigners)(s,"programId",r),u=JK().serialize(i);return(0,Z1e.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Qf.burnTokenChecked=Y1e});var tF=_(ep=>{"use strict";a();Object.defineProperty(ep,"__esModule",{value:!0});ep.closeLut=ep.getCloseLutInstructionDataSerializer=void 0;var J1e=U(),BT=N(),Q1e=Re();function eF(){return(0,BT.mapSerializer)((0,BT.struct)([["discriminator",(0,BT.u32)()]],{description:"CloseLutInstructionData"}),t=>({...t,discriminator:4}))}ep.getCloseLutInstructionDataSerializer=eF;function ebe(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111"),n={address:{index:0,isWritable:!0,value:e.address??null},authority:{index:1,isWritable:!1,value:e.authority??null},recipient:{index:2,isWritable:!0,value:e.recipient??null}};n.authority.value||(n.authority.value=t.identity);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Q1e.getAccountMetasAndSigners)(i,"programId",r),c=eF().serialize({});return(0,J1e.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}ep.closeLut=ebe});var nF=_(tp=>{"use strict";a();Object.defineProperty(tp,"__esModule",{value:!0});tp.closeToken=tp.getCloseTokenInstructionDataSerializer=void 0;var tbe=U(),zT=N(),rbe=Re();function rF(){return(0,zT.mapSerializer)((0,zT.struct)([["discriminator",(0,zT.u8)()]],{description:"CloseTokenInstructionData"}),t=>({...t,discriminator:9}))}tp.getCloseTokenInstructionDataSerializer=rF;function nbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},destination:{index:1,isWritable:!0,value:e.destination??null},owner:{index:2,isWritable:!1,value:e.owner??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,rbe.getAccountMetasAndSigners)(i,"programId",r),c=rF().serialize({});return(0,tbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}tp.closeToken=nbe});var sF=_(np=>{"use strict";a();Object.defineProperty(np,"__esModule",{value:!0});np.createAccount=np.getCreateAccountInstructionDataSerializer=void 0;var kT=U(),rp=N(),ibe=Re();function iF(){return(0,rp.mapSerializer)((0,rp.struct)([["discriminator",(0,rp.u32)()],["lamports",(0,kT.mapAmountSerializer)((0,rp.u64)(),"SOL",9)],["space",(0,rp.u64)()],["programId",(0,rp.publicKey)()]],{description:"CreateAccountInstructionData"}),t=>({...t,discriminator:0}))}np.getCreateAccountInstructionDataSerializer=iF;function sbe(t,e){let r=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n={payer:{index:0,isWritable:!0,value:e.payer??null},newAccount:{index:1,isWritable:!0,value:e.newAccount??null}},i={...e};n.payer.value||(n.payer.value=t.payer);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,ibe.getAccountMetasAndSigners)(s,"programId",r),u=iF().serialize(i),d=Number(e.space)+kT.ACCOUNT_HEADER_SIZE;return(0,kT.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:d}])}np.createAccount=sbe});var cF=_(ip=>{"use strict";a();Object.defineProperty(ip,"__esModule",{value:!0});ip.createAccountWithRent=ip.getCreateAccountWithRentInstructionDataSerializer=void 0;var oF=U(),ly=N(),obe=Re();function aF(){return(0,ly.mapSerializer)((0,ly.struct)([["discriminator",(0,ly.u8)()],["space",(0,ly.u64)()],["programId",(0,ly.publicKey)()]],{description:"CreateAccountWithRentInstructionData"}),t=>({...t,discriminator:0}))}ip.getCreateAccountWithRentInstructionDataSerializer=aF;function abe(t,e){let r=t.programs.getPublicKey("mplSystemExtras","SysExL2WDyJi9aRZrXorrjHJut3JwHQ7R9bTyctbNNG"),n={payer:{index:0,isWritable:!0,value:e.payer??null},newAccount:{index:1,isWritable:!0,value:e.newAccount??null},systemProgram:{index:2,isWritable:!1,value:e.systemProgram??null}},i={...e};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,obe.getAccountMetasAndSigners)(s,"programId",r),u=aF().serialize(i),d=Number(e.space)+oF.ACCOUNT_HEADER_SIZE;return(0,oF.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:d}])}ip.createAccountWithRent=abe});var uF=_(wS=>{"use strict";a();Object.defineProperty(wS,"__esModule",{value:!0});wS.findAssociatedTokenPda=void 0;var CT=N();function cbe(t,e){let r=t.programs.getPublicKey("splAssociatedToken"),n=e.tokenProgramId??t.programs.getPublicKey("splToken");return t.eddsa.findPda(r,[(0,CT.publicKey)().serialize(e.owner),(0,CT.publicKey)().serialize(n),(0,CT.publicKey)().serialize(e.mint)])}wS.findAssociatedTokenPda=cbe});var lF=_(xS=>{"use strict";a();Object.defineProperty(xS,"__esModule",{value:!0});xS.resolveExtendLutBytes=void 0;var ube=(t,e,r,n)=>32*r.addresses.length;xS.resolveExtendLutBytes=ube});var sp=_(Sc=>{"use strict";a();var lbe=Sc&&Sc.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),dF=Sc&&Sc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lbe(e,t,r)};Object.defineProperty(Sc,"__esModule",{value:!0});dF(uF(),Sc);dF(lF(),Sc)});var pF=_(PS=>{"use strict";a();Object.defineProperty(PS,"__esModule",{value:!0});PS.createAssociatedToken=void 0;var fF=U(),dbe=sp(),fbe=_S(),IS=Re();function pbe(t,e){let r=t.programs.getPublicKey("splAssociatedToken","ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),n={payer:{index:0,isWritable:!0,value:e.payer??null},ata:{index:1,isWritable:!0,value:e.ata??null},owner:{index:2,isWritable:!1,value:e.owner??null},mint:{index:3,isWritable:!1,value:e.mint??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},tokenProgram:{index:5,isWritable:!1,value:e.tokenProgram??null}};n.payer.value||(n.payer.value=t.payer),n.owner.value||(n.owner.value=t.identity.publicKey),n.tokenProgram.value||(n.tokenProgram.value=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.tokenProgram.isWritable=!1),n.ata.value||(n.ata.value=(0,dbe.findAssociatedTokenPda)(t,{owner:(0,IS.expectPublicKey)(n.owner.value),mint:(0,IS.expectPublicKey)(n.mint.value),tokenProgramId:(0,IS.expectPublicKey)(n.tokenProgram.value)})),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,IS.getAccountMetasAndSigners)(i,"programId",r),c=new Uint8Array,u=(0,fbe.getTokenSize)()+fF.ACCOUNT_HEADER_SIZE;return(0,fF.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:u}])}PS.createAssociatedToken=pbe});var mF=_(op=>{"use strict";a();Object.defineProperty(op,"__esModule",{value:!0});op.createEmptyLut=op.getCreateEmptyLutInstructionDataSerializer=void 0;var hF=U(),dy=N(),hbe=_S(),RS=Re();function gF(){return(0,dy.mapSerializer)((0,dy.struct)([["discriminator",(0,dy.u32)()],["recentSlot",(0,dy.u64)()],["bump",(0,dy.u8)()]],{description:"CreateEmptyLutInstructionData"}),t=>({...t,discriminator:0}))}op.getCreateEmptyLutInstructionDataSerializer=gF;function gbe(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111"),n={address:{index:0,isWritable:!0,value:e.address??null},authority:{index:1,isWritable:!1,value:e.authority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.authority.value||(n.authority.value=t.identity),n.address.value||(n.address.value=(0,hbe.findAddressLookupTablePda)(t,{authority:(0,RS.expectPublicKey)(n.authority.value),recentSlot:(0,RS.expectSome)(i.recentSlot)})),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1),i.bump||(i.bump=(0,RS.expectPda)(n.address.value)[1]);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,RS.getAccountMetasAndSigners)(s,"programId",r),u=gF().serialize(i),d=56+hF.ACCOUNT_HEADER_SIZE;return(0,hF.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:d}])}op.createEmptyLut=gbe});var yF=_(OS=>{"use strict";a();Object.defineProperty(OS,"__esModule",{value:!0});OS.createIdempotentAssociatedToken=void 0;var mbe=U(),ybe=Re();function bbe(t,e){let r=t.programs.getPublicKey("splAssociatedToken","ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),n={payer:{index:0,isWritable:!0,value:e.payer??null},ata:{index:1,isWritable:!0,value:e.ata??null},owner:{index:2,isWritable:!1,value:e.owner??null},mint:{index:3,isWritable:!1,value:e.mint??null},systemProgram:{index:4,isWritable:!1,value:e.systemProgram??null},tokenProgram:{index:5,isWritable:!1,value:e.tokenProgram??null}};n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1),n.tokenProgram.value||(n.tokenProgram.value=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.tokenProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,ybe.getAccountMetasAndSigners)(i,"programId",r),c=new Uint8Array;return(0,mbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}OS.createIdempotentAssociatedToken=bbe});var AF=_(ap=>{"use strict";a();Object.defineProperty(ap,"__esModule",{value:!0});ap.createTokenIfMissing=ap.getCreateTokenIfMissingInstructionDataSerializer=void 0;var Abe=U(),MT=N(),_be=sp(),fy=Re();function bF(){return(0,MT.mapSerializer)((0,MT.struct)([["discriminator",(0,MT.u8)()]],{description:"CreateTokenIfMissingInstructionData"}),t=>({...t,discriminator:0}))}ap.getCreateTokenIfMissingInstructionDataSerializer=bF;function Sbe(t,e){let r=t.programs.getPublicKey("mplTokenExtras","TokExjvjJmhKaRBShsBAsbSvEWMA1AgUNK7ps4SAc2p"),n={payer:{index:0,isWritable:!0,value:e.payer??null},token:{index:1,isWritable:!1,value:e.token??null},mint:{index:2,isWritable:!1,value:e.mint??null},owner:{index:3,isWritable:!1,value:e.owner??null},ata:{index:4,isWritable:!0,value:e.ata??null},systemProgram:{index:5,isWritable:!1,value:e.systemProgram??null},tokenProgram:{index:6,isWritable:!1,value:e.tokenProgram??null},ataProgram:{index:7,isWritable:!1,value:e.ataProgram??null}};n.payer.value||(n.payer.value=t.payer),n.owner.value||(n.owner.value=t.identity.publicKey),n.tokenProgram.value||(n.tokenProgram.value=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.tokenProgram.isWritable=!1),n.ata.value||(n.ata.value=(0,_be.findAssociatedTokenPda)(t,{owner:(0,fy.expectPublicKey)(n.owner.value),mint:(0,fy.expectPublicKey)(n.mint.value),tokenProgramId:(0,fy.expectPublicKey)(n.tokenProgram.value)})),n.token.value||(n.token.value=(0,fy.expectSome)(n.ata.value)),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1),n.ataProgram.value||(n.ataProgram.value=t.programs.getPublicKey("splAssociatedToken","ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),n.ataProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,fy.getAccountMetasAndSigners)(i,"programId",r),c=bF().serialize({});return(0,Abe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}ap.createTokenIfMissing=Sbe});var SF=_(cp=>{"use strict";a();Object.defineProperty(cp,"__esModule",{value:!0});cp.deactivateLut=cp.getDeactivateLutInstructionDataSerializer=void 0;var vbe=U(),NT=N(),Ebe=Re();function _F(){return(0,NT.mapSerializer)((0,NT.struct)([["discriminator",(0,NT.u32)()]],{description:"DeactivateLutInstructionData"}),t=>({...t,discriminator:3}))}cp.getDeactivateLutInstructionDataSerializer=_F;function wbe(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111"),n={address:{index:0,isWritable:!0,value:e.address??null},authority:{index:1,isWritable:!1,value:e.authority??null}};n.authority.value||(n.authority.value=t.identity);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Ebe.getAccountMetasAndSigners)(i,"programId",r),c=_F().serialize({});return(0,vbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}cp.deactivateLut=wbe});var EF=_(lp=>{"use strict";a();Object.defineProperty(lp,"__esModule",{value:!0});lp.extendLut=lp.getExtendLutInstructionDataSerializer=void 0;var xbe=U(),up=N(),Ibe=sp(),Pbe=Re();function vF(){return(0,up.mapSerializer)((0,up.struct)([["discriminator",(0,up.u32)()],["addresses",(0,up.array)((0,up.publicKey)(),{size:(0,up.u64)()})]],{description:"ExtendLutInstructionData"}),t=>({...t,discriminator:2}))}lp.getExtendLutInstructionDataSerializer=vF;function Rbe(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111"),n={address:{index:0,isWritable:!0,value:e.address??null},authority:{index:1,isWritable:!1,value:e.authority??null},payer:{index:2,isWritable:!0,value:e.payer??null},systemProgram:{index:3,isWritable:!1,value:e.systemProgram??null}},i={...e};n.authority.value||(n.authority.value=t.identity),n.payer.value||(n.payer.value=t.payer),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Pbe.getAccountMetasAndSigners)(s,"programId",r),u=vF().serialize(i),d=(0,Ibe.resolveExtendLutBytes)(t,n,i,r);return(0,xbe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:d}])}lp.extendLut=Rbe});var xF=_(dp=>{"use strict";a();Object.defineProperty(dp,"__esModule",{value:!0});dp.freezeLut=dp.getFreezeLutInstructionDataSerializer=void 0;var Obe=U(),LT=N(),Tbe=Re();function wF(){return(0,LT.mapSerializer)((0,LT.struct)([["discriminator",(0,LT.u32)()]],{description:"FreezeLutInstructionData"}),t=>({...t,discriminator:1}))}dp.getFreezeLutInstructionDataSerializer=wF;function Bbe(t,e){let r=t.programs.getPublicKey("splAddressLookupTable","AddressLookupTab1e1111111111111111111111111"),n={address:{index:0,isWritable:!0,value:e.address??null},authority:{index:1,isWritable:!1,value:e.authority??null}};n.authority.value||(n.authority.value=t.identity);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Tbe.getAccountMetasAndSigners)(i,"programId",r),c=wF().serialize({});return(0,Obe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}dp.freezeLut=Bbe});var PF=_(fp=>{"use strict";a();Object.defineProperty(fp,"__esModule",{value:!0});fp.freezeToken=fp.getFreezeTokenInstructionDataSerializer=void 0;var zbe=U(),DT=N(),kbe=Re();function IF(){return(0,DT.mapSerializer)((0,DT.struct)([["discriminator",(0,DT.u8)()]],{description:"FreezeTokenInstructionData"}),t=>({...t,discriminator:10}))}fp.getFreezeTokenInstructionDataSerializer=IF;function Cbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!1,value:e.mint??null},owner:{index:2,isWritable:!1,value:e.owner??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,kbe.getAccountMetasAndSigners)(i,"programId",r),c=IF().serialize({});return(0,zbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}fp.freezeToken=Cbe});var OF=_(pp=>{"use strict";a();Object.defineProperty(pp,"__esModule",{value:!0});pp.getTokenDataSize=pp.getGetTokenDataSizeInstructionDataSerializer=void 0;var Mbe=U(),qT=N(),Nbe=Re();function RF(){return(0,qT.mapSerializer)((0,qT.struct)([["discriminator",(0,qT.u8)()]],{description:"GetTokenDataSizeInstructionData"}),t=>({...t,discriminator:21}))}pp.getGetTokenDataSizeInstructionDataSerializer=RF;function Lbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!1,value:e.mint??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Nbe.getAccountMetasAndSigners)(i,"programId",r),c=RF().serialize({});return(0,Mbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}pp.getTokenDataSize=Lbe});var BF=_(hp=>{"use strict";a();Object.defineProperty(hp,"__esModule",{value:!0});hp.initializeImmutableOwner=hp.getInitializeImmutableOwnerInstructionDataSerializer=void 0;var Dbe=U(),UT=N(),qbe=Re();function TF(){return(0,UT.mapSerializer)((0,UT.struct)([["discriminator",(0,UT.u8)()]],{description:"InitializeImmutableOwnerInstructionData"}),t=>({...t,discriminator:22}))}hp.getInitializeImmutableOwnerInstructionDataSerializer=TF;function Ube(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,qbe.getAccountMetasAndSigners)(i,"programId",r),c=TF().serialize({});return(0,Dbe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}hp.initializeImmutableOwner=Ube});var CF=_(gp=>{"use strict";a();Object.defineProperty(gp,"__esModule",{value:!0});gp.initializeMint=gp.getInitializeMintInstructionDataSerializer=void 0;var zF=U(),rl=N(),Vbe=Re();function kF(){return(0,rl.mapSerializer)((0,rl.struct)([["discriminator",(0,rl.u8)()],["decimals",(0,rl.u8)()],["mintAuthority",(0,rl.publicKey)()],["freezeAuthority",(0,rl.option)((0,rl.publicKey)())]],{description:"InitializeMintInstructionData"}),t=>({...t,discriminator:0}))}gp.getInitializeMintInstructionDataSerializer=kF;function Kbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!0,value:e.mint??null},rent:{index:1,isWritable:!1,value:e.rent??null}},i={...e};n.rent.value||(n.rent.value=(0,zF.publicKey)("SysvarRent111111111111111111111111111111111"));let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Vbe.getAccountMetasAndSigners)(s,"programId",r),u=kF().serialize(i);return(0,zF.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}gp.initializeMint=Kbe});var NF=_(mp=>{"use strict";a();Object.defineProperty(mp,"__esModule",{value:!0});mp.initializeMint2=mp.getInitializeMint2InstructionDataSerializer=void 0;var Fbe=U(),nl=N(),Wbe=Re();function MF(){return(0,nl.mapSerializer)((0,nl.struct)([["discriminator",(0,nl.u8)()],["decimals",(0,nl.u8)()],["mintAuthority",(0,nl.publicKey)()],["freezeAuthority",(0,nl.option)((0,nl.publicKey)())]],{description:"InitializeMint2InstructionData"}),t=>({...t,discriminator:20}))}mp.getInitializeMint2InstructionDataSerializer=MF;function jbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!0,value:e.mint??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Wbe.getAccountMetasAndSigners)(s,"programId",r),u=MF().serialize(i);return(0,Fbe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}mp.initializeMint2=jbe});var qF=_(yp=>{"use strict";a();Object.defineProperty(yp,"__esModule",{value:!0});yp.initializeMultisig=yp.getInitializeMultisigInstructionDataSerializer=void 0;var LF=U(),TS=N(),Hbe=Re();function DF(){return(0,TS.mapSerializer)((0,TS.struct)([["discriminator",(0,TS.u8)()],["m",(0,TS.u8)()]],{description:"InitializeMultisigInstructionData"}),t=>({...t,discriminator:2}))}yp.getInitializeMultisigInstructionDataSerializer=DF;function Gbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={multisig:{index:0,isWritable:!0,value:e.multisig??null},rent:{index:1,isWritable:!1,value:e.rent??null}},i={...e};n.rent.value||(n.rent.value=(0,LF.publicKey)("SysvarRent111111111111111111111111111111111"));let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Hbe.getAccountMetasAndSigners)(s,"programId",r),u=DF().serialize(i);return(0,LF.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}yp.initializeMultisig=Gbe});var VF=_(bp=>{"use strict";a();Object.defineProperty(bp,"__esModule",{value:!0});bp.initializeMultisig2=bp.getInitializeMultisig2InstructionDataSerializer=void 0;var $be=U(),BS=N(),Zbe=Re();function UF(){return(0,BS.mapSerializer)((0,BS.struct)([["discriminator",(0,BS.u8)()],["m",(0,BS.u8)()]],{description:"InitializeMultisig2InstructionData"}),t=>({...t,discriminator:19}))}bp.getInitializeMultisig2InstructionDataSerializer=UF;function Xbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={multisig:{index:0,isWritable:!0,value:e.multisig??null},signer:{index:1,isWritable:!1,value:e.signer??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Zbe.getAccountMetasAndSigners)(s,"programId",r),u=UF().serialize(i);return(0,$be.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}bp.initializeMultisig2=Xbe});var WF=_(Ap=>{"use strict";a();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.initializeToken=Ap.getInitializeTokenInstructionDataSerializer=void 0;var KF=U(),VT=N(),Ybe=Re();function FF(){return(0,VT.mapSerializer)((0,VT.struct)([["discriminator",(0,VT.u8)()]],{description:"InitializeTokenInstructionData"}),t=>({...t,discriminator:1}))}Ap.getInitializeTokenInstructionDataSerializer=FF;function Jbe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!1,value:e.mint??null},owner:{index:2,isWritable:!1,value:e.owner??null},rent:{index:3,isWritable:!1,value:e.rent??null}};n.rent.value||(n.rent.value=(0,KF.publicKey)("SysvarRent111111111111111111111111111111111"));let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,Ybe.getAccountMetasAndSigners)(i,"programId",r),c=FF().serialize({});return(0,KF.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ap.initializeToken=Jbe});var GF=_(_p=>{"use strict";a();Object.defineProperty(_p,"__esModule",{value:!0});_p.initializeToken2=_p.getInitializeToken2InstructionDataSerializer=void 0;var jF=U(),zS=N(),Qbe=Re();function HF(){return(0,zS.mapSerializer)((0,zS.struct)([["discriminator",(0,zS.u8)()],["owner",(0,zS.publicKey)()]],{description:"InitializeToken2InstructionData"}),t=>({...t,discriminator:16}))}_p.getInitializeToken2InstructionDataSerializer=HF;function eAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!1,value:e.mint??null},rent:{index:2,isWritable:!1,value:e.rent??null}},i={...e};n.rent.value||(n.rent.value=(0,jF.publicKey)("SysvarRent111111111111111111111111111111111"));let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,Qbe.getAccountMetasAndSigners)(s,"programId",r),u=HF().serialize(i);return(0,jF.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}_p.initializeToken2=eAe});var ZF=_(Sp=>{"use strict";a();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.initializeToken3=Sp.getInitializeToken3InstructionDataSerializer=void 0;var tAe=U(),kS=N(),rAe=Re();function $F(){return(0,kS.mapSerializer)((0,kS.struct)([["discriminator",(0,kS.u8)()],["owner",(0,kS.publicKey)()]],{description:"InitializeToken3InstructionData"}),t=>({...t,discriminator:18}))}Sp.getInitializeToken3InstructionDataSerializer=$F;function nAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!1,value:e.mint??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,rAe.getAccountMetasAndSigners)(s,"programId",r),u=$F().serialize(i);return(0,tAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Sp.initializeToken3=nAe});var YF=_(vp=>{"use strict";a();Object.defineProperty(vp,"__esModule",{value:!0});vp.mintTokensTo=vp.getMintTokensToInstructionDataSerializer=void 0;var iAe=U(),CS=N(),sAe=Re();function XF(){return(0,CS.mapSerializer)((0,CS.struct)([["discriminator",(0,CS.u8)()],["amount",(0,CS.u64)()]],{description:"MintTokensToInstructionData"}),t=>({...t,discriminator:7}))}vp.getMintTokensToInstructionDataSerializer=XF;function oAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!0,value:e.mint??null},token:{index:1,isWritable:!0,value:e.token??null},mintAuthority:{index:2,isWritable:!1,value:e.mintAuthority??null}},i={...e};n.mintAuthority.value||(n.mintAuthority.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,sAe.getAccountMetasAndSigners)(s,"programId",r),u=XF().serialize(i);return(0,iAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}vp.mintTokensTo=oAe});var QF=_(Ep=>{"use strict";a();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.mintTokensToChecked=Ep.getMintTokensToCheckedInstructionDataSerializer=void 0;var aAe=U(),py=N(),cAe=Re();function JF(){return(0,py.mapSerializer)((0,py.struct)([["discriminator",(0,py.u8)()],["amount",(0,py.u64)()],["decimals",(0,py.u8)()]],{description:"MintTokensToCheckedInstructionData"}),t=>({...t,discriminator:14}))}Ep.getMintTokensToCheckedInstructionDataSerializer=JF;function uAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!0,value:e.mint??null},token:{index:1,isWritable:!0,value:e.token??null},mintAuthority:{index:2,isWritable:!1,value:e.mintAuthority??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,cAe.getAccountMetasAndSigners)(s,"programId",r),u=JF().serialize(i);return(0,aAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Ep.mintTokensToChecked=uAe});var e5=_(MS=>{"use strict";a();Object.defineProperty(MS,"__esModule",{value:!0});MS.recoverNestedAssociatedToken=void 0;var lAe=U(),dAe=Re();function fAe(t,e){let r=t.programs.getPublicKey("splAssociatedToken","ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),n={nestedAssociatedAccountAddress:{index:0,isWritable:!0,value:e.nestedAssociatedAccountAddress??null},nestedTokenMintAddress:{index:1,isWritable:!1,value:e.nestedTokenMintAddress??null},destinationAssociatedAccountAddress:{index:2,isWritable:!0,value:e.destinationAssociatedAccountAddress??null},ownerAssociatedAccountAddress:{index:3,isWritable:!1,value:e.ownerAssociatedAccountAddress??null},ownerTokenMintAddress:{index:4,isWritable:!1,value:e.ownerTokenMintAddress??null},walletAddress:{index:5,isWritable:!0,value:e.walletAddress??null},tokenProgram:{index:6,isWritable:!1,value:e.tokenProgram??null}};n.tokenProgram.value||(n.tokenProgram.value=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.tokenProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,dAe.getAccountMetasAndSigners)(i,"programId",r),c=new Uint8Array;return(0,lAe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}MS.recoverNestedAssociatedToken=fAe});var r5=_(wp=>{"use strict";a();Object.defineProperty(wp,"__esModule",{value:!0});wp.requestHeapFrame=wp.getRequestHeapFrameInstructionDataSerializer=void 0;var pAe=U(),NS=N(),hAe=Re();function t5(){return(0,NS.mapSerializer)((0,NS.struct)([["discriminator",(0,NS.u8)()],["bytes",(0,NS.u32)()]],{description:"RequestHeapFrameInstructionData"}),t=>({...t,discriminator:1}))}wp.getRequestHeapFrameInstructionDataSerializer=t5;function gAe(t,e){let r=t.programs.getPublicKey("splComputeBudget","ComputeBudget111111111111111111111111111111"),n={},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,hAe.getAccountMetasAndSigners)(s,"programId",r),u=t5().serialize(i);return(0,pAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}wp.requestHeapFrame=gAe});var i5=_(xp=>{"use strict";a();Object.defineProperty(xp,"__esModule",{value:!0});xp.requestUnits=xp.getRequestUnitsInstructionDataSerializer=void 0;var mAe=U(),hy=N(),yAe=Re();function n5(){return(0,hy.mapSerializer)((0,hy.struct)([["discriminator",(0,hy.u8)()],["units",(0,hy.u32)()],["additionalFee",(0,hy.u32)()]],{description:"RequestUnitsInstructionData"}),t=>({...t,discriminator:0}))}xp.getRequestUnitsInstructionDataSerializer=n5;function bAe(t,e){let r=t.programs.getPublicKey("splComputeBudget","ComputeBudget111111111111111111111111111111"),n={},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,yAe.getAccountMetasAndSigners)(s,"programId",r),u=n5().serialize(i);return(0,mAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}xp.requestUnits=bAe});var o5=_(Ip=>{"use strict";a();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.revokeTokenDelegate=Ip.getRevokeTokenDelegateInstructionDataSerializer=void 0;var AAe=U(),KT=N(),_Ae=Re();function s5(){return(0,KT.mapSerializer)((0,KT.struct)([["discriminator",(0,KT.u8)()]],{description:"RevokeTokenDelegateInstructionData"}),t=>({...t,discriminator:5}))}Ip.getRevokeTokenDelegateInstructionDataSerializer=s5;function SAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={source:{index:0,isWritable:!0,value:e.source??null},owner:{index:1,isWritable:!1,value:e.owner??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,_Ae.getAccountMetasAndSigners)(i,"programId",r),c=s5().serialize({});return(0,AAe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Ip.revokeTokenDelegate=SAe});var c5=_(Pp=>{"use strict";a();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.setAuthority=Pp.getSetAuthorityInstructionDataSerializer=void 0;var vAe=U(),gy=N(),EAe=Re(),wAe=bS();function a5(){return(0,gy.mapSerializer)((0,gy.struct)([["discriminator",(0,gy.u8)()],["authorityType",(0,wAe.getAuthorityTypeSerializer)()],["newAuthority",(0,gy.option)((0,gy.publicKey)())]],{description:"SetAuthorityInstructionData"}),t=>({...t,discriminator:6}))}Pp.getSetAuthorityInstructionDataSerializer=a5;function xAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={owned:{index:0,isWritable:!0,value:e.owned??null},owner:{index:1,isWritable:!1,value:e.owner??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,EAe.getAccountMetasAndSigners)(s,"programId",r),u=a5().serialize(i);return(0,vAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Pp.setAuthority=xAe});var l5=_(Rp=>{"use strict";a();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.setComputeUnitLimit=Rp.getSetComputeUnitLimitInstructionDataSerializer=void 0;var IAe=U(),LS=N(),PAe=Re();function u5(){return(0,LS.mapSerializer)((0,LS.struct)([["discriminator",(0,LS.u8)()],["units",(0,LS.u32)()]],{description:"SetComputeUnitLimitInstructionData"}),t=>({...t,discriminator:2}))}Rp.getSetComputeUnitLimitInstructionDataSerializer=u5;function RAe(t,e){let r=t.programs.getPublicKey("splComputeBudget","ComputeBudget111111111111111111111111111111"),n={},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,PAe.getAccountMetasAndSigners)(s,"programId",r),u=u5().serialize(i);return(0,IAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Rp.setComputeUnitLimit=RAe});var f5=_(Op=>{"use strict";a();Object.defineProperty(Op,"__esModule",{value:!0});Op.setComputeUnitPrice=Op.getSetComputeUnitPriceInstructionDataSerializer=void 0;var OAe=U(),DS=N(),TAe=Re();function d5(){return(0,DS.mapSerializer)((0,DS.struct)([["discriminator",(0,DS.u8)()],["microLamports",(0,DS.u64)()]],{description:"SetComputeUnitPriceInstructionData"}),t=>({...t,discriminator:3}))}Op.getSetComputeUnitPriceInstructionDataSerializer=d5;function BAe(t,e){let r=t.programs.getPublicKey("splComputeBudget","ComputeBudget111111111111111111111111111111"),n={},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,TAe.getAccountMetasAndSigners)(s,"programId",r),u=d5().serialize(i);return(0,OAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Op.setComputeUnitPrice=BAe});var h5=_(Tp=>{"use strict";a();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.syncNative=Tp.getSyncNativeInstructionDataSerializer=void 0;var zAe=U(),FT=N(),kAe=Re();function p5(){return(0,FT.mapSerializer)((0,FT.struct)([["discriminator",(0,FT.u8)()]],{description:"SyncNativeInstructionData"}),t=>({...t,discriminator:17}))}Tp.getSyncNativeInstructionDataSerializer=p5;function CAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,kAe.getAccountMetasAndSigners)(i,"programId",r),c=p5().serialize({});return(0,zAe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Tp.syncNative=CAe});var m5=_(Bp=>{"use strict";a();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.thawToken=Bp.getThawTokenInstructionDataSerializer=void 0;var MAe=U(),WT=N(),NAe=Re();function g5(){return(0,WT.mapSerializer)((0,WT.struct)([["discriminator",(0,WT.u8)()]],{description:"ThawTokenInstructionData"}),t=>({...t,discriminator:11}))}Bp.getThawTokenInstructionDataSerializer=g5;function LAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={account:{index:0,isWritable:!0,value:e.account??null},mint:{index:1,isWritable:!1,value:e.mint??null},owner:{index:2,isWritable:!1,value:e.owner??null}},i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,NAe.getAccountMetasAndSigners)(i,"programId",r),c=g5().serialize({});return(0,MAe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}Bp.thawToken=LAe});var b5=_(zp=>{"use strict";a();Object.defineProperty(zp,"__esModule",{value:!0});zp.transferAllSol=zp.getTransferAllSolInstructionDataSerializer=void 0;var DAe=U(),jT=N(),qAe=Re();function y5(){return(0,jT.mapSerializer)((0,jT.struct)([["discriminator",(0,jT.u8)()]],{description:"TransferAllSolInstructionData"}),t=>({...t,discriminator:1}))}zp.getTransferAllSolInstructionDataSerializer=y5;function UAe(t,e){let r=t.programs.getPublicKey("mplSystemExtras","SysExL2WDyJi9aRZrXorrjHJut3JwHQ7R9bTyctbNNG"),n={source:{index:0,isWritable:!0,value:e.source??null},destination:{index:1,isWritable:!0,value:e.destination??null},systemProgram:{index:2,isWritable:!1,value:e.systemProgram??null}};n.source.value||(n.source.value=t.identity),n.systemProgram.value||(n.systemProgram.value=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n.systemProgram.isWritable=!1);let i=Object.values(n).sort((d,f)=>d.index-f.index),[s,o]=(0,qAe.getAccountMetasAndSigners)(i,"programId",r),c=y5().serialize({});return(0,DAe.transactionBuilder)([{instruction:{keys:s,programId:r,data:c},signers:o,bytesCreatedOnChain:0}])}zp.transferAllSol=UAe});var S5=_(kp=>{"use strict";a();Object.defineProperty(kp,"__esModule",{value:!0});kp.transferSol=kp.getTransferSolInstructionDataSerializer=void 0;var A5=U(),qS=N(),VAe=Re();function _5(){return(0,qS.mapSerializer)((0,qS.struct)([["discriminator",(0,qS.u32)()],["amount",(0,A5.mapAmountSerializer)((0,qS.u64)(),"SOL",9)]],{description:"TransferSolInstructionData"}),t=>({...t,discriminator:2}))}kp.getTransferSolInstructionDataSerializer=_5;function KAe(t,e){let r=t.programs.getPublicKey("splSystem","11111111111111111111111111111111"),n={source:{index:0,isWritable:!0,value:e.source??null},destination:{index:1,isWritable:!0,value:e.destination??null}},i={...e};n.source.value||(n.source.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,VAe.getAccountMetasAndSigners)(s,"programId",r),u=_5().serialize(i);return(0,A5.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}kp.transferSol=KAe});var E5=_(Cp=>{"use strict";a();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.transferTokens=Cp.getTransferTokensInstructionDataSerializer=void 0;var FAe=U(),US=N(),WAe=Re();function v5(){return(0,US.mapSerializer)((0,US.struct)([["discriminator",(0,US.u8)()],["amount",(0,US.u64)()]],{description:"TransferTokensInstructionData"}),t=>({...t,discriminator:3}))}Cp.getTransferTokensInstructionDataSerializer=v5;function jAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={source:{index:0,isWritable:!0,value:e.source??null},destination:{index:1,isWritable:!0,value:e.destination??null},authority:{index:2,isWritable:!1,value:e.authority??null}},i={...e};n.authority.value||(n.authority.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,WAe.getAccountMetasAndSigners)(s,"programId",r),u=v5().serialize(i);return(0,FAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Cp.transferTokens=jAe});var x5=_(Mp=>{"use strict";a();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.transferTokensChecked=Mp.getTransferTokensCheckedInstructionDataSerializer=void 0;var HAe=U(),my=N(),GAe=Re();function w5(){return(0,my.mapSerializer)((0,my.struct)([["discriminator",(0,my.u8)()],["amount",(0,my.u64)()],["decimals",(0,my.u8)()]],{description:"TransferTokensCheckedInstructionData"}),t=>({...t,discriminator:12}))}Mp.getTransferTokensCheckedInstructionDataSerializer=w5;function $Ae(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={source:{index:0,isWritable:!0,value:e.source??null},mint:{index:1,isWritable:!1,value:e.mint??null},destination:{index:2,isWritable:!0,value:e.destination??null},authority:{index:3,isWritable:!1,value:e.authority??null}},i={...e};n.authority.value||(n.authority.value=t.identity);let s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,GAe.getAccountMetasAndSigners)(s,"programId",r),u=w5().serialize(i);return(0,HAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Mp.transferTokensChecked=$Ae});var P5=_(Np=>{"use strict";a();Object.defineProperty(Np,"__esModule",{value:!0});Np.uiAmountToAmount=Np.getUiAmountToAmountInstructionDataSerializer=void 0;var ZAe=U(),VS=N(),XAe=Re();function I5(){return(0,VS.mapSerializer)((0,VS.struct)([["discriminator",(0,VS.u8)()],["uiAmount",(0,VS.u64)()]],{description:"UiAmountToAmountInstructionData"}),t=>({...t,discriminator:24}))}Np.getUiAmountToAmountInstructionDataSerializer=I5;function YAe(t,e){let r=t.programs.getPublicKey("splToken","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n={mint:{index:0,isWritable:!1,value:e.mint??null}},i={...e},s=Object.values(n).sort((f,m)=>f.index-m.index),[o,c]=(0,XAe.getAccountMetasAndSigners)(s,"programId",r),u=I5().serialize(i);return(0,ZAe.transactionBuilder)([{instruction:{keys:o,programId:r,data:u},signers:c,bytesCreatedOnChain:0}])}Np.uiAmountToAmount=YAe});var R5=_(ve=>{"use strict";a();var JAe=ve&&ve.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Be=ve&&ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JAe(e,t,r)};Object.defineProperty(ve,"__esModule",{value:!0});Be(FK(),ve);Be(jK(),ve);Be(GK(),ve);Be(ZK(),ve);Be(YK(),ve);Be(QK(),ve);Be(tF(),ve);Be(nF(),ve);Be(sF(),ve);Be(cF(),ve);Be(pF(),ve);Be(mF(),ve);Be(yF(),ve);Be(AF(),ve);Be(SF(),ve);Be(EF(),ve);Be(xF(),ve);Be(PF(),ve);Be(OF(),ve);Be(BF(),ve);Be(CF(),ve);Be(NF(),ve);Be(qF(),ve);Be(VF(),ve);Be(WF(),ve);Be(GF(),ve);Be(ZF(),ve);Be(YF(),ve);Be(QF(),ve);Be(e5(),ve);Be(r5(),ve);Be(i5(),ve);Be(o5(),ve);Be(c5(),ve);Be(l5(),ve);Be(f5(),ve);Be(h5(),ve);Be(m5(),ve);Be(b5(),ve);Be(S5(),ve);Be(E5(),ve);Be(x5(),ve);Be(P5(),ve)});var T5=_(ki=>{"use strict";a();Object.defineProperty(ki,"__esModule",{value:!0});ki.getMplSystemExtrasProgramId=ki.getMplSystemExtrasProgram=ki.createMplSystemExtrasProgram=ki.MPL_SYSTEM_EXTRAS_PROGRAM_ID=void 0;var O5=Ks();ki.MPL_SYSTEM_EXTRAS_PROGRAM_ID="SysExL2WDyJi9aRZrXorrjHJut3JwHQ7R9bTyctbNNG";function QAe(){return{name:"mplSystemExtras",publicKey:ki.MPL_SYSTEM_EXTRAS_PROGRAM_ID,getErrorFromCode(t,e){return(0,O5.getMplSystemExtrasErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,O5.getMplSystemExtrasErrorFromName)(t,this,e)},isOnCluster(){return!0}}}ki.createMplSystemExtrasProgram=QAe;function e_e(t,e){return t.programs.get("mplSystemExtras",e)}ki.getMplSystemExtrasProgram=e_e;function t_e(t,e){return t.programs.getPublicKey("mplSystemExtras",ki.MPL_SYSTEM_EXTRAS_PROGRAM_ID,e)}ki.getMplSystemExtrasProgramId=t_e});var z5=_(Ci=>{"use strict";a();Object.defineProperty(Ci,"__esModule",{value:!0});Ci.getMplTokenExtrasProgramId=Ci.getMplTokenExtrasProgram=Ci.createMplTokenExtrasProgram=Ci.MPL_TOKEN_EXTRAS_PROGRAM_ID=void 0;var B5=Ks();Ci.MPL_TOKEN_EXTRAS_PROGRAM_ID="TokExjvjJmhKaRBShsBAsbSvEWMA1AgUNK7ps4SAc2p";function r_e(){return{name:"mplTokenExtras",publicKey:Ci.MPL_TOKEN_EXTRAS_PROGRAM_ID,getErrorFromCode(t,e){return(0,B5.getMplTokenExtrasErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,B5.getMplTokenExtrasErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Ci.createMplTokenExtrasProgram=r_e;function n_e(t,e){return t.programs.get("mplTokenExtras",e)}Ci.getMplTokenExtrasProgram=n_e;function i_e(t,e){return t.programs.getPublicKey("mplTokenExtras",Ci.MPL_TOKEN_EXTRAS_PROGRAM_ID,e)}Ci.getMplTokenExtrasProgramId=i_e});var C5=_(Mi=>{"use strict";a();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.getSplAddressLookupTableProgramId=Mi.getSplAddressLookupTableProgram=Mi.createSplAddressLookupTableProgram=Mi.SPL_ADDRESS_LOOKUP_TABLE_PROGRAM_ID=void 0;var k5=Ks();Mi.SPL_ADDRESS_LOOKUP_TABLE_PROGRAM_ID="AddressLookupTab1e1111111111111111111111111";function s_e(){return{name:"splAddressLookupTable",publicKey:Mi.SPL_ADDRESS_LOOKUP_TABLE_PROGRAM_ID,getErrorFromCode(t,e){return(0,k5.getSplAddressLookupTableErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,k5.getSplAddressLookupTableErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Mi.createSplAddressLookupTableProgram=s_e;function o_e(t,e){return t.programs.get("splAddressLookupTable",e)}Mi.getSplAddressLookupTableProgram=o_e;function a_e(t,e){return t.programs.getPublicKey("splAddressLookupTable",Mi.SPL_ADDRESS_LOOKUP_TABLE_PROGRAM_ID,e)}Mi.getSplAddressLookupTableProgramId=a_e});var N5=_(Ni=>{"use strict";a();Object.defineProperty(Ni,"__esModule",{value:!0});Ni.getSplAssociatedTokenProgramId=Ni.getSplAssociatedTokenProgram=Ni.createSplAssociatedTokenProgram=Ni.SPL_ASSOCIATED_TOKEN_PROGRAM_ID=void 0;var M5=Ks();Ni.SPL_ASSOCIATED_TOKEN_PROGRAM_ID="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";function c_e(){return{name:"splAssociatedToken",publicKey:Ni.SPL_ASSOCIATED_TOKEN_PROGRAM_ID,getErrorFromCode(t,e){return(0,M5.getSplAssociatedTokenErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,M5.getSplAssociatedTokenErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Ni.createSplAssociatedTokenProgram=c_e;function u_e(t,e){return t.programs.get("splAssociatedToken",e)}Ni.getSplAssociatedTokenProgram=u_e;function l_e(t,e){return t.programs.getPublicKey("splAssociatedToken",Ni.SPL_ASSOCIATED_TOKEN_PROGRAM_ID,e)}Ni.getSplAssociatedTokenProgramId=l_e});var D5=_(Li=>{"use strict";a();Object.defineProperty(Li,"__esModule",{value:!0});Li.getSplComputeBudgetProgramId=Li.getSplComputeBudgetProgram=Li.createSplComputeBudgetProgram=Li.SPL_COMPUTE_BUDGET_PROGRAM_ID=void 0;var L5=Ks();Li.SPL_COMPUTE_BUDGET_PROGRAM_ID="ComputeBudget111111111111111111111111111111";function d_e(){return{name:"splComputeBudget",publicKey:Li.SPL_COMPUTE_BUDGET_PROGRAM_ID,getErrorFromCode(t,e){return(0,L5.getSplComputeBudgetErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,L5.getSplComputeBudgetErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Li.createSplComputeBudgetProgram=d_e;function f_e(t,e){return t.programs.get("splComputeBudget",e)}Li.getSplComputeBudgetProgram=f_e;function p_e(t,e){return t.programs.getPublicKey("splComputeBudget",Li.SPL_COMPUTE_BUDGET_PROGRAM_ID,e)}Li.getSplComputeBudgetProgramId=p_e});var U5=_(Di=>{"use strict";a();Object.defineProperty(Di,"__esModule",{value:!0});Di.getSplMemoProgramId=Di.getSplMemoProgram=Di.createSplMemoProgram=Di.SPL_MEMO_PROGRAM_ID=void 0;var q5=Ks();Di.SPL_MEMO_PROGRAM_ID="Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo";function h_e(){return{name:"splMemo",publicKey:Di.SPL_MEMO_PROGRAM_ID,getErrorFromCode(t,e){return(0,q5.getSplMemoErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,q5.getSplMemoErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Di.createSplMemoProgram=h_e;function g_e(t,e){return t.programs.get("splMemo",e)}Di.getSplMemoProgram=g_e;function m_e(t,e){return t.programs.getPublicKey("splMemo",Di.SPL_MEMO_PROGRAM_ID,e)}Di.getSplMemoProgramId=m_e});var K5=_(qi=>{"use strict";a();Object.defineProperty(qi,"__esModule",{value:!0});qi.getSplSystemProgramId=qi.getSplSystemProgram=qi.createSplSystemProgram=qi.SPL_SYSTEM_PROGRAM_ID=void 0;var V5=Ks();qi.SPL_SYSTEM_PROGRAM_ID="11111111111111111111111111111111";function y_e(){return{name:"splSystem",publicKey:qi.SPL_SYSTEM_PROGRAM_ID,getErrorFromCode(t,e){return(0,V5.getSplSystemErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,V5.getSplSystemErrorFromName)(t,this,e)},isOnCluster(){return!0}}}qi.createSplSystemProgram=y_e;function b_e(t,e){return t.programs.get("splSystem",e)}qi.getSplSystemProgram=b_e;function A_e(t,e){return t.programs.getPublicKey("splSystem",qi.SPL_SYSTEM_PROGRAM_ID,e)}qi.getSplSystemProgramId=A_e});var W5=_(Ui=>{"use strict";a();Object.defineProperty(Ui,"__esModule",{value:!0});Ui.getSplTokenProgramId=Ui.getSplTokenProgram=Ui.createSplTokenProgram=Ui.SPL_TOKEN_PROGRAM_ID=void 0;var F5=Ks();Ui.SPL_TOKEN_PROGRAM_ID="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";function __e(){return{name:"splToken",publicKey:Ui.SPL_TOKEN_PROGRAM_ID,getErrorFromCode(t,e){return(0,F5.getSplTokenErrorFromCode)(t,this,e)},getErrorFromName(t,e){return(0,F5.getSplTokenErrorFromName)(t,this,e)},isOnCluster(){return!0}}}Ui.createSplTokenProgram=__e;function S_e(t,e){return t.programs.get("splToken",e)}Ui.getSplTokenProgram=S_e;function v_e(t,e){return t.programs.getPublicKey("splToken",Ui.SPL_TOKEN_PROGRAM_ID,e)}Ui.getSplTokenProgramId=v_e});var j5=_(Fn=>{"use strict";a();var E_e=Fn&&Fn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),vc=Fn&&Fn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E_e(e,t,r)};Object.defineProperty(Fn,"__esModule",{value:!0});vc(T5(),Fn);vc(z5(),Fn);vc(C5(),Fn);vc(N5(),Fn);vc(D5(),Fn);vc(U5(),Fn);vc(K5(),Fn);vc(W5(),Fn)});var No=_(Vi=>{"use strict";a();var w_e=Vi&&Vi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Lp=Vi&&Vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w_e(e,t,r)};Object.defineProperty(Vi,"__esModule",{value:!0});Lp(_S(),Vi);Lp(Ks(),Vi);Lp(R5(),Vi);Lp(j5(),Vi);Lp(Re(),Vi);Lp(bS(),Vi)});var H5=_(KS=>{"use strict";a();Object.defineProperty(KS,"__esModule",{value:!0});KS.createLut=void 0;var x_e=U(),HT=No();function I_e(t,e){let{addresses:r,...n}=e,i=e.authority??t.identity,s=e.address??(0,HT.findAddressLookupTablePda)(t,{authority:i.publicKey,recentSlot:e.recentSlot});return[(0,x_e.transactionBuilder)().add((0,HT.createEmptyLut)(t,n)).add((0,HT.extendLut)(t,{address:s,authority:i,addresses:r,payer:e.payer})),{publicKey:s[0],addresses:r}]}KS.createLut=I_e});var G5=_(FS=>{"use strict";a();Object.defineProperty(FS,"__esModule",{value:!0});FS.createLutForTransactionBuilder=void 0;var GT=U(),$T=No(),P_e=(t,e,r,n)=>{let i=n??t.identity,s=(0,GT.uniquePublicKeys)([e.getFeePayer(t).publicKey,...e.items.flatMap(({instruction:d})=>d.keys.filter(f=>f.isSigner).map(f=>f.pubkey))]),o=(0,GT.uniquePublicKeys)(e.items.flatMap(({instruction:d})=>[d.programId,...d.keys.map(f=>f.pubkey)])).filter(d=>!s.includes(d)),c=[],u=[];return(0,GT.chunk)(o,256).forEach((d,f)=>{let m=r-f,[A]=(0,$T.findAddressLookupTablePda)(t,{authority:i.publicKey,recentSlot:m});c.push({publicKey:A,addresses:d}),u.push(...R_e(t,(0,$T.createEmptyLut)(t,{recentSlot:m}),A,i,d))}),[u,c]};FS.createLutForTransactionBuilder=P_e;function R_e(t,e,r,n,i){let s=[],o=[],c=e;return i.forEach(u=>{let d=e.add((0,$T.extendLut)(t,{address:r,addresses:[...o,u],authority:n}));d.fitsInOneTransaction(t)?(o.push(u),c=d):(o=[u],s.push(c),e=e.empty(),c=e)}),o.length>0&&s.push(c),s}});var XT=_(WS=>{"use strict";a();Object.defineProperty(WS,"__esModule",{value:!0});WS.createMint=void 0;var $5=U(),ZT=No();function O_e(t,e){return(0,$5.transactionBuilder)().add((0,ZT.createAccountWithRent)(t,{newAccount:e.mint,space:(0,ZT.getMintSize)(),programId:t.programs.get("splToken").publicKey})).add((0,ZT.initializeMint2)(t,{mint:e.mint.publicKey,decimals:e.decimals??0,mintAuthority:e.mintAuthority??t.identity.publicKey,freezeAuthority:e.freezeAuthority===void 0?(0,$5.some)(t.identity.publicKey):e.freezeAuthority}))}WS.createMint=O_e});var X5=_(jS=>{"use strict";a();Object.defineProperty(jS,"__esModule",{value:!0});jS.createMintWithAssociatedToken=void 0;var YT=U(),T_e=XT(),Z5=No(),B_e=sp();function z_e(t,e){let r={mint:e.mint.publicKey,owner:e.owner??t.identity.publicKey},n=e.amount??0,i=(0,YT.transactionBuilder)().add((0,T_e.createMint)(t,{...e,mintAuthority:e.mintAuthority?(0,YT.publicKey)(e.mintAuthority,!1):void 0})).add((0,Z5.createAssociatedToken)(t,r));return n>0&&(i=i.add((0,Z5.mintTokensTo)(t,{amount:n,mint:e.mint.publicKey,token:(0,B_e.findAssociatedTokenPda)(t,r),mintAuthority:e.mintAuthority&&(0,YT.isSigner)(e.mintAuthority)?e.mintAuthority:void 0}))),i}jS.createMintWithAssociatedToken=z_e});var Y5=_(HS=>{"use strict";a();Object.defineProperty(HS,"__esModule",{value:!0});HS.createToken=void 0;var k_e=U(),JT=No();function C_e(t,e){return(0,k_e.transactionBuilder)().add((0,JT.createAccountWithRent)(t,{newAccount:e.token,space:(0,JT.getTokenSize)(),programId:t.programs.get("splToken").publicKey})).add((0,JT.initializeToken3)(t,{account:e.token.publicKey,mint:e.mint,owner:e.owner??t.identity.publicKey}))}HS.createToken=C_e});var Q5=_(Fr=>{"use strict";a();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.fetchTokensByOwnerAndMint=Fr.fetchTokensByOwner=Fr.fetchAllMintByOwner=Fr.fetchAllMintPublicKeyByOwner=Fr.fetchAllTokenByOwnerAndMint=Fr.fetchAllTokenByOwner=void 0;var yy=U(),Dp=N(),by=No(),J5=async(t,e,r,n={})=>{let i=t.programs.get("splToken").publicKey,s=n.mint?{mint:n.mint}:{programId:i};return(await t.rpc.call("getTokenAccountsByOwner",[e,s],{...n,extra:{encoding:"base64"}})).value.filter(({account:c})=>{let u=Dp.base64.serialize(c.data[0]),d=(0,Dp.u64)().deserialize(u.slice(64,72))[0];return r(d)})},M_e=async(t,e,r={})=>{let{mint:n,tokenStrategy:i="getProgramAccounts",tokenAmountFilter:s=u=>u>0,...o}=r;if(i==="getTokenAccountsByOwner")return(await J5(t,e,s,{mint:n,...o})).map(({pubkey:d,account:f})=>(0,by.deserializeToken)({...f,data:Dp.base64.serialize(f.data[0]),publicKey:(0,yy.publicKey)(d),owner:(0,yy.publicKey)(f.owner),lamports:(0,yy.lamports)(f.lamports)}));let c=(0,by.getTokenGpaBuilder)(t).whereField("owner",e);return n&&(c=c.whereField("mint",n)),(await c.get()).filter(u=>{let d=(0,Dp.u64)().deserialize(u.data.slice(64,72))[0];return s(d)}).map(u=>(0,by.deserializeToken)(u))};Fr.fetchAllTokenByOwner=M_e;var N_e=(t,e,r,n={})=>(0,Fr.fetchAllTokenByOwner)(t,e,{...n,mint:r});Fr.fetchAllTokenByOwnerAndMint=N_e;var L_e=async(t,e,r={})=>{let{tokenStrategy:n="getProgramAccounts",tokenAmountFilter:i=o=>o>0,...s}=r;return n==="getTokenAccountsByOwner"?(await J5(t,e,i,s)).map(({account:c})=>(0,yy.publicKey)(Dp.base64.serialize(c.data[0]).slice(0,32))):(await(0,by.getTokenGpaBuilder)(t).slice(0,72).whereField("owner",e).get()).filter(o=>{let c=(0,Dp.u64)().deserialize(o.data.slice(64,72))[0];return i(c)}).map(o=>(0,yy.publicKey)(o.data.slice(0,32)))};Fr.fetchAllMintPublicKeyByOwner=L_e;var D_e=async(t,e,r={})=>{let{tokenStrategy:n,tokenAmountFilter:i,...s}=r,o=await(0,Fr.fetchAllMintPublicKeyByOwner)(t,e,r);return(0,by.fetchAllMint)(t,o,s)};Fr.fetchAllMintByOwner=D_e;Fr.fetchTokensByOwner=Fr.fetchAllTokenByOwner;Fr.fetchTokensByOwnerAndMint=Fr.fetchAllTokenByOwnerAndMint});var tW=_(GS=>{"use strict";a();Object.defineProperty(GS,"__esModule",{value:!0});GS.findLargestTokensByMint=void 0;var eW=U(),q_e=async(t,e,r={})=>(await t.rpc.call("getTokenLargestAccounts",[e],r)).value.map(({address:i,amount:s,decimals:o})=>({publicKey:(0,eW.publicKey)(i),amount:(0,eW.createAmount)(s,"splToken",o)}));GS.findLargestTokensByMint=q_e});var rW=_(il=>{"use strict";a();Object.defineProperty(il,"__esModule",{value:!0});il.mplEssentials=il.mplToolbox=void 0;var U_e=U(),Ec=No(),V_e=()=>({install(t){t.programs.add((0,Ec.createSplSystemProgram)(),!1),t.programs.add((0,Ec.createSplMemoProgram)(),!1),t.programs.add((0,Ec.createSplTokenProgram)(),!1),t.programs.add((0,Ec.createSplAssociatedTokenProgram)(),!1),t.programs.add((0,Ec.createSplAddressLookupTableProgram)(),!1),t.programs.add((0,Ec.createMplSystemExtrasProgram)(),!1),t.programs.add((0,Ec.createMplTokenExtrasProgram)(),!1),t.programs.add({...(0,Ec.createSplTokenProgram)(),name:"splToken2022",publicKey:(0,U_e.publicKey)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")},!1)}});il.mplToolbox=V_e;il.mplEssentials=il.mplToolbox});var nW=_($S=>{"use strict";a();Object.defineProperty($S,"__esModule",{value:!0});$S.getSysvar=void 0;var Ws=U(),K_e=t=>{switch(t){case"clock":return(0,Ws.publicKey)("SysvarC1ock11111111111111111111111111111111");case"epochSchedule":return(0,Ws.publicKey)("SysvarEpochSchedu1e111111111111111111111111");case"instructions":return(0,Ws.publicKey)("Sysvar1nstructions1111111111111111111111111");case"recentBlockhashes":return(0,Ws.publicKey)("SysvarRecentB1ockHashes11111111111111111111");case"rent":return(0,Ws.publicKey)("SysvarRent111111111111111111111111111111111");case"rewards":return(0,Ws.publicKey)("SysvarRewards111111111111111111111111111111");case"slotHashes":return(0,Ws.publicKey)("SysvarS1otHashes111111111111111111111111111");case"slotHistory":return(0,Ws.publicKey)("SysvarS1otHistory11111111111111111111111111");case"stakeHistory":return(0,Ws.publicKey)("SysvarStakeHistory1111111111111111111111111");default:throw new Ws.SdkError(`Unknown sysvar: ${t}`)}};$S.getSysvar=K_e});var iW=_(Qr=>{"use strict";a();var F_e=Qr&&Qr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),as=Qr&&Qr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F_e(e,t,r)};Object.defineProperty(Qr,"__esModule",{value:!0});as(No(),Qr);as(sp(),Qr);as(H5(),Qr);as(G5(),Qr);as(XT(),Qr);as(X5(),Qr);as(Y5(),Qr);as(Q5(),Qr);as(tW(),Qr);as(rW(),Qr);as(nW(),Qr)});a();a();a();a();a();var jp=t=>({__option:"Some",value:t}),ll=()=>({__option:"None"}),Nv=t=>t&&typeof t=="object"&&"__option"in t&&(t.__option==="Some"&&"value"in t||t.__option==="None"),dl=t=>t.__option==="Some";a();var Lv=t=>t!==null?jp(t):ll();a();a();a();a();a();var zy=class extends Error{name="InvalidBaseStringError";constructor(e,r,n){let i=`Expected a string of base ${r}, got [${e}].`;super(i),this.cause=n}};var Dv=t=>{let e=t.length,r=BigInt(e);return{description:`base${e}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${t}]*$`)))throw new zy(n,e);if(n==="")return new Uint8Array;let i=[...n],s=i.findIndex(m=>m!==t[0]);s=s===-1?i.length:s;let o=Array(s).fill(0);if(s===i.length)return Uint8Array.from(o);let c=i.slice(s),u=0n,d=1n;for(let m=c.length-1;m>=0;m-=1)u+=d*BigInt(t.indexOf(c[m])),d*=r;let f=[];for(;u>0n;)f.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(o.concat(f))},deserialize(n,i=0){if(n.length===0)return["",0];let s=n.slice(i),o=s.findIndex(f=>f!==0);o=o===-1?s.length:o;let c=t[0].repeat(o);if(o===s.length)return[c,n.length];let u=s.slice(o).reduce((f,m)=>f*256n+BigInt(m),0n),d=[];for(;u>0n;)d.unshift(t[Number(u%r)]),u/=r;return[c+d.join(""),n.length]}}};a();var Ar=Dv("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");a();a();var st=t=>{let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r},qv=(t,e)=>{if(t.length>=e)return t;let r=new Uint8Array(e).fill(0);return r.set(t),r},Hp=(t,e)=>qv(t.slice(0,e),e);a();var Wr=class extends Error{name="DeserializingEmptyBufferError";constructor(e){super(`Serializer [${e}] cannot deserialize empty buffers.`)}},Wn=class extends Error{name="NotEnoughBytesError";constructor(e,r,n){super(`Serializer [${e}] expected ${r} bytes, got ${n}.`)}},Hs=class extends Error{name="ExpectedFixedSizeSerializerError";constructor(e){e??="Expected a fixed-size serializer, got a variable-size one.",super(e)}};a();function fl(t,e,r){return{description:r??`fixed(${e}, ${t.description})`,fixedSize:e,maxSize:e,serialize:n=>Hp(t.serialize(n),e),deserialize:(n,i=0)=>{if(n=n.slice(i,i+e),n.length<e)throw new Wn("fixSerializer",e,n.length);t.fixedSize!==null&&(n=Hp(n,t.fixedSize));let[s]=t.deserialize(n,0);return[s,i+e]}}}a();function ky(t,e,r){return{description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize,serialize:n=>t.serialize(e(n)),deserialize:(n,i=0)=>{let[s,o]=t.deserialize(n,i);return r?[r(s,n,i),o]:[s,o]}}}a();var Uv=t=>t.replace(/\u0000/g,"");a();var pl={description:"utf8",fixedSize:null,maxSize:null,serialize(t){return new TextEncoder().encode(t)},deserialize(t,e=0){let r=new TextDecoder().decode(t.slice(e));return[Uv(r),t.length]}};a();var Pc=class extends Error{name="InvalidPublicKeyError";constructor(e,r){r=r?`. ${r}`:"",super(`The provided public key is invalid: ${e}${r}`),this.invalidPublicKey=e}};var hl=32;function _r(t,e=!0){let r=typeof t=="string"?t:typeof t=="object"&&"publicKey"in t?t.publicKey:typeof t=="object"&&"toBase58"in t?t.toBase58():Array.isArray(t)?t[0]:Ar.deserialize(t)[0];return e&&Vv(r),r}var Rc=t=>{try{return Vv(t),!0}catch{return!1}};function Vv(t){if(typeof t!="string")throw new Pc(t,"Public keys must be strings.");gl(t)}var gl=t=>{if(t.length<32||t.length>44)throw new Pc(t,"Public keys must be between 32 and 44 characters.");let e;try{e=Ar.serialize(t)}catch{throw new Pc(t,"Public keys must be base58 encoded.")}if(e.length!==hl)throw new Pc(t,`Public keys must be ${hl} bytes.`);return e};a();a();a();a();var Gp;(function(t){t.Little="le",t.Big="be"})(Gp||(Gp={}));a();var Cy=class extends RangeError{name="NumberOutOfRangeError";constructor(e,r,n,i){super(`Serializer [${e}] expected number to be between ${r} and ${n}, got ${i}.`)}};a();a();function at(t){let e,r=t.name;return t.size>1&&(e=!("endian"in t.options)||t.options.endian===Gp.Little,r+=e?"(le)":"(be)"),{description:t.options.description??r,fixedSize:t.size,maxSize:t.size,serialize(n){t.range&&Kv(t.name,t.range[0],t.range[1],n);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),n,e),new Uint8Array(i)},deserialize(n,i=0){let s=n.slice(i,i+t.size);xj("i8",s,t.size);let o=wj(s);return[t.get(o,e),i+t.size]}}}var Ej=t=>t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset),wj=t=>new DataView(Ej(t)),Kv=(t,e,r,n)=>{if(n<e||n>r)throw new Cy(t,e,r,n)},xj=(t,e,r)=>{if(e.length===0)throw new Wr(t);if(e.length<r)throw new Wn(t,r,e.length)};var Fv=(t={})=>at({name:"f32",size:4,set:(e,r,n)=>e.setFloat32(0,Number(r),n),get:(e,r)=>e.getFloat32(0,r),options:t});a();var Wv=(t={})=>at({name:"f64",size:8,set:(e,r,n)=>e.setFloat64(0,Number(r),n),get:(e,r)=>e.getFloat64(0,r),options:t});a();var jv=(t={})=>at({name:"i8",size:1,range:[-+"0x7f"-1,+"0x7f"],set:(e,r)=>e.setInt8(0,Number(r)),get:e=>e.getInt8(0),options:t});a();var Hv=(t={})=>at({name:"i16",size:2,range:[-+"0x7fff"-1,+"0x7fff"],set:(e,r,n)=>e.setInt16(0,Number(r),n),get:(e,r)=>e.getInt16(0,r),options:t});a();var Gv=(t={})=>at({name:"i32",size:4,range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(e,r,n)=>e.setInt32(0,Number(r),n),get:(e,r)=>e.getInt32(0,r),options:t});a();var $v=(t={})=>at({name:"i64",size:8,range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(e,r,n)=>e.setBigInt64(0,BigInt(r),n),get:(e,r)=>e.getBigInt64(0,r),options:t});a();var Zv=(t={})=>at({name:"i128",size:16,range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigInt64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigInt64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});a();var Ot=(t={})=>at({name:"u8",size:1,range:[0,+"0xff"],set:(e,r)=>e.setUint8(0,Number(r)),get:e=>e.getUint8(0),options:t});a();var Xv=(t={})=>at({name:"u16",size:2,range:[0,+"0xffff"],set:(e,r,n)=>e.setUint16(0,Number(r),n),get:(e,r)=>e.getUint16(0,r),options:t});a();var Wi=(t={})=>at({name:"u32",size:4,range:[0,+"0xffffffff"],set:(e,r,n)=>e.setUint32(0,Number(r),n),get:(e,r)=>e.getUint32(0,r),options:t});a();var Yv=(t={})=>at({name:"u64",size:8,range:[0,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),get:(e,r)=>e.getBigUint64(0,r),options:t});a();var Jv=(t={})=>at({name:"u128",size:16,range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(e,r,n)=>{let i=n?8:0,s=n?0:8,o=0xffffffffffffffffn;e.setBigUint64(i,BigInt(r)>>64n,n),e.setBigUint64(s,BigInt(r)&o,n)},get:(e,r)=>{let n=r?8:0,i=r?0:8,s=e.getBigUint64(n,r),o=e.getBigUint64(i,r);return(s<<64n)+o},options:t});a();var ds=(t={})=>({description:t.description??"shortU16",fixedSize:null,maxSize:3,serialize:e=>{Kv("shortU16",0,65535,e);let r=[0];for(let n=0;;n+=1){let i=e>>n*7;if(i===0)break;let s=127&i;r[n]=s,n>0&&(r[n-1]|=128)}return new Uint8Array(r)},deserialize:(e,r=0)=>{let n=0,i=0;for(;++i;){let s=i-1,o=e[r+s],c=127&o;if(n|=c<<s*7,(o&128)===0)break}return[n,r+i]}});a();a();var fs=class extends Error{name="InvalidNumberOfItemsError";constructor(e,r,n){super(`Expected [${e}] to have ${r} items, got ${n}.`)}};var My=class extends Error{name="UnrecognizedArrayLikeSerializerSizeError";constructor(e){super(`Unrecognized array-like serializer size: ${JSON.stringify(e)}`)}},Ny=class extends Error{name="InvalidDataEnumVariantError";constructor(e,r){super(`Invalid data enum variant. Expected one of [${r.join(", ")}], got "${e}".`)}},Ly=class extends Error{name="InvalidScalarEnumVariantError";constructor(e,r,n,i){super(`Invalid scalar enum variant. Expected one of [${r.join(", ")}] or a number between ${n} and ${i}, got "${e}".`)}},ml=class extends RangeError{name="EnumDiscriminatorOutOfRangeError";constructor(e,r,n){super(`Enum discriminator out of range. Expected a number between ${r} and ${n}, got ${e}.`)}};a();a();function mn(t){return t.reduce((e,r)=>e===null||r===null?null:e+r,0)}function yl(t,e,r){if(typeof t=="number")return[t,r];if(typeof t=="object")return t.deserialize(e,r);throw new My(t)}function Tn(t){return typeof t=="object"?t.description:`${t}`}function Gs(t,e){if(typeof t!="number")return null;if(t===0)return 0;let r=mn(e);return r===null?null:r*t}function bl(t,e){return typeof t=="object"?t.serialize(e):new Uint8Array}function ji(t,e={}){let r=e.size??Wi();return{description:e.description??`array(${t.description}; ${Tn(r)})`,fixedSize:Gs(r,[t.fixedSize]),maxSize:Gs(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.length!==r)throw new fs("array",r,n.length);return st([bl(r,n.length),...n.map(i=>t.serialize(i))])},deserialize:(n,i=0)=>{let s=[];if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.push(u),i=d}return[s,i]}let[o,c]=yl(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.push(d),i=f}return[s,i]}}}a();function Qv(t={}){let e=t.size??Ot();if(e.fixedSize===null)throw new Hs("Serializer [bool] requires a fixed size.");return{description:t.description??`bool(${e.description})`,fixedSize:e.fixedSize,maxSize:e.fixedSize,serialize:r=>e.serialize(r?1:0),deserialize:(r,n=0)=>{if(r.slice(n).length===0)throw new Wr("bool");let[i,s]=e.deserialize(r,n);return[i===1,s]}}}a();function Oc(t={}){let e=t.size??"variable",r=t.description??`bytes(${Tn(e)})`,n={description:r,fixedSize:null,maxSize:null,serialize:i=>new Uint8Array(i),deserialize:(i,s=0)=>{let o=i.slice(s);return[o,s+o.length]}};return e==="variable"?n:typeof e=="number"?fl(n,e,r):{description:r,fixedSize:null,maxSize:null,serialize:i=>{let s=n.serialize(i),o=e.serialize(s.length);return st([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Wr("bytes");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new Wn("bytes",u,d.length);let[f,m]=n.deserialize(d);return s+=m,[f,s]}}}a();a();function nz(t){return t.reduce((e,r)=>e===null||r===null?null:Math.max(e,r),0)}function eE(t,e={}){let r=e.size??Ot(),n=t.map(([c,u])=>`${String(c)}${u?`: ${u.description}`:""}`).join(", "),s=t.every((c,u,d)=>c[1].fixedSize===d[0][1].fixedSize)?t[0][1].fixedSize:null,o=nz(t.map(([,c])=>c.maxSize));return{description:e.description??`dataEnum(${n}; ${r.description})`,fixedSize:t.length===0?r.fixedSize:mn([r.fixedSize,s]),maxSize:t.length===0?r.maxSize:mn([r.maxSize,o]),serialize:c=>{let u=t.findIndex(([A])=>c.__kind===A);if(u<0)throw new Ny(c.__kind,t.map(([A])=>A));let d=r.serialize(u),m=t[u][1].serialize(c);return st([d,m])},deserialize:(c,u=0)=>{if(c.slice(u).length===0)throw new Wr("dataEnum");let[d,f]=r.deserialize(c,u);u=f;let m=t[Number(d)]??null;if(!m)throw new ml(d,0,t.length-1);let[A,v]=m[1].deserialize(c,u);return u=v,[{__kind:m[0],...A??{}},u]}}}a();function tE(t,e,r={}){let n=r.size??Wi();return{description:r.description??`map(${t.description}, ${e.description}; ${Tn(n)})`,fixedSize:Gs(n,[t.fixedSize,e.fixedSize]),maxSize:Gs(n,[t.maxSize,e.maxSize]),serialize:i=>{if(typeof n=="number"&&i.size!==n)throw new fs("map",n,i.size);let s=Array.from(i,([o,c])=>st([t.serialize(o),e.serialize(c)]));return st([bl(n,i.size),...s])},deserialize:(i,s=0)=>{let o=new Map;if(typeof n=="object"&&i.slice(s).length===0)return[o,s];if(n==="remainder"){for(;s<i.length;){let[d,f]=t.deserialize(i,s);s=f;let[m,A]=e.deserialize(i,s);s=A,o.set(d,m)}return[o,s]}let[c,u]=yl(n,i,s);s=u;for(let d=0;d<c;d+=1){let[f,m]=t.deserialize(i,s);s=m;let[A,v]=e.deserialize(i,s);s=v,o.set(f,A)}return[o,s]}}}a();function rE(t,e={}){let r=e.prefix??Ot(),n=e.fixed??!1,i=`; ${Tn(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new Hs("Fixed nullables can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`nullable(${t.description+i})`,fixedSize:s,maxSize:mn([r.maxSize,t.maxSize]),serialize:o=>{let c=r.serialize(+(o!==null));if(n){let d=t.fixedSize,f=o!==null?t.serialize(o).slice(0,d):new Uint8Array(d).fill(0);return st([c,f])}let u=o!==null?t.serialize(o):new Uint8Array;return st([c,u])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[null,c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[null,n?u:c];let[m,A]=t.deserialize(o,c);return c=A,[m,n?u:c]}}}a();function nE(t,e={}){let r=e.prefix??Ot(),n=e.fixed??!1,i=`; ${Tn(r)}`,s=t.fixedSize===0?r.fixedSize:null;if(n){if(t.fixedSize===null||r.fixedSize===null)throw new Hs("Fixed options can only be used with fixed-size serializers");i+="; fixed",s=r.fixedSize+t.fixedSize}return{description:e.description??`option(${t.description+i})`,fixedSize:s,maxSize:mn([r.maxSize,t.maxSize]),serialize:o=>{let c=Nv(o)?o:Lv(o),u=r.serialize(Number(dl(c)));if(n){let f=t.fixedSize,m=dl(c)?t.serialize(c.value).slice(0,f):new Uint8Array(f).fill(0);return st([u,m])}let d=dl(c)?t.serialize(c.value):new Uint8Array;return st([u,d])},deserialize:(o,c=0)=>{if(o.slice(c).length===0)return[ll(),c];let u=c+(r.fixedSize??0)+(t.fixedSize??0),[d,f]=r.deserialize(o,c);if(c=f,d===0)return[ll(),n?u:c];let[m,A]=t.deserialize(o,c);return c=A,[jp(m),n?u:c]}}}a();function Al(t={}){return{description:t.description??"publicKey",fixedSize:32,maxSize:32,serialize:e=>gl(_r(e)),deserialize:(e,r=0)=>{let n=e.slice(r,r+32);if(n.length===0)throw new Wr("publicKey");if(n.length<hl)throw new Wn("publicKey",hl,n.length);return[_r(n),r+32]}}}a();function iE(t,e={}){let r=e.size??Ot(),n=Object.keys(t),i=Object.values(t),s=i.some(m=>typeof m=="number"),o=i.filter(m=>typeof m=="string").join(", "),c=0,u=s?i.length/2-1:i.length-1,d=s?[...n]:[...new Set([...n,...i])];function f(m){let A=typeof m=="number"&&(m<c||m>u),v=typeof m=="string"&&!d.includes(m);if(A||v)throw new Ly(m,d,c,u)}return{description:e.description??`enum(${o}; ${r.description})`,fixedSize:r.fixedSize,maxSize:r.maxSize,serialize:m=>{if(f(m),typeof m=="number")return r.serialize(m);let A=i.indexOf(m);return A>=0?r.serialize(A):r.serialize(n.indexOf(m))},deserialize:(m,A=0)=>{if(m.slice(A).length===0)throw new Wr("enum");let[v,P]=r.deserialize(m,A),T=Number(v);if(A=P,T<c||T>u)throw new ml(T,c,u);return[s?T:i[T],A]}}}a();function sE(t,e={}){let r=e.size??Wi();return{description:e.description??`set(${t.description}; ${Tn(r)})`,fixedSize:Gs(r,[t.fixedSize]),maxSize:Gs(r,[t.maxSize]),serialize:n=>{if(typeof r=="number"&&n.size!==r)throw new fs("set",r,n.size);let i=Array.from(n,s=>t.serialize(s));return st([bl(r,n.size),...i])},deserialize:(n,i=0)=>{let s=new Set;if(typeof r=="object"&&n.slice(i).length===0)return[s,i];if(r==="remainder"){for(;i<n.length;){let[u,d]=t.deserialize(n,i);s.add(u),i=d}return[s,i]}let[o,c]=yl(r,n,i);i=c;for(let u=0;u<o;u+=1){let[d,f]=t.deserialize(n,i);s.add(d),i=f}return[s,i]}}}a();function $p(t={}){let e=t.size??Wi(),r=t.encoding??pl,n=t.description??`string(${r.description}; ${Tn(e)})`;return e==="variable"?{...r,description:n}:typeof e=="number"?fl(r,e,n):{description:n,fixedSize:null,maxSize:null,serialize:i=>{let s=r.serialize(i),o=e.serialize(s.length);return st([o,s])},deserialize:(i,s=0)=>{if(i.slice(s).length===0)throw new Wr("string");let[o,c]=e.deserialize(i,s),u=Number(o);s=c;let d=i.slice(s,s+u);if(d.length<u)throw new Wn("string",u,d.length);let[f,m]=r.deserialize(d);return s+=m,[f,s]}}}a();function $s(t,e={}){let r=t.map(([n,i])=>`${String(n)}: ${i.description}`).join(", ");return{description:e.description??`struct(${r})`,fixedSize:mn(t.map(([,n])=>n.fixedSize)),maxSize:mn(t.map(([,n])=>n.maxSize)),serialize:n=>{let i=t.map(([s,o])=>o.serialize(n[s]));return st(i)},deserialize:(n,i=0)=>{let s={};return t.forEach(([o,c])=>{let[u,d]=c.deserialize(n,i);i=d,s[o]=u}),[s,i]}}}a();function oE(t,e={}){let r=t.map(n=>n.description).join(", ");return{description:e.description??`tuple(${r})`,fixedSize:mn(t.map(n=>n.fixedSize)),maxSize:mn(t.map(n=>n.maxSize)),serialize:n=>{if(n.length!==t.length)throw new fs("tuple",t.length,n.length);return st(t.map((i,s)=>i.serialize(n[s])))},deserialize:(n,i=0)=>{let s=[];return t.forEach(o=>{let[c,u]=o.deserialize(n,i);s.push(c),i=u}),[s,i]}}}a();function aE(t={}){return{description:t.description??"unit",fixedSize:0,maxSize:0,serialize:()=>new Uint8Array,deserialize:(e,r=0)=>[void 0,r]}}var cE=Ar;a();a();a();var _l=class extends Error{name="UmiError";constructor(e,r,n,i){super(e),this.source=r,this.sourceDetails=n,this.cause=i,this.message=`${this.message}
Source: ${this.getFullSource()}${this.cause?`
Caused By: ${this.cause}`:""}
-`}getCapitalizedSource(){return this.source==="sdk"||this.source==="rpc"?this.source.toUpperCase():this.source[0].toUpperCase()+this.source.slice(1)}getFullSource(){let e=this.getCapitalizedSource(),r=this.sourceDetails?` > ${this.sourceDetails}`:"";return e+r}toString(){return`[${this.name}] ${this.message}`}};var fs=class extends bu{name="SdkError";constructor(e,r){super(e,"sdk",void 0,r)}};var L_=128;a();a();var Hd=t=>(t=typeof t=="object"?t.toString():t,BigInt(t));var Wg=(t,e,r)=>({basisPoints:Hd(t),identifier:e,decimals:r});var hs=t=>Wg(t,"SOL",9);var D_=t=>t.basisPoints===BigInt(0);a();var P4=["api.mainnet-beta.solana.com","ssc-dao.genesysgo.net"],R4=["api.devnet.solana.com","psytrbhymqlkfrhudd.dev.genesysgo.net"],O4=["api.testnet.solana.com"],B4=["localhost","127.0.0.1"],q_=t=>{let e=new URL(t).hostname;return P4.includes(e)?"mainnet-beta":R4.includes(e)?"devnet":O4.includes(e)?"testnet":B4.includes(e)?"localnet":t.includes("mainnet")?"mainnet-beta":t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("local")?"localnet":"custom"};a();a();a();var pr=class extends fs{name="InterfaceImplementationMissingError";constructor(e,r){let n=e.replace(/Interface$/,""),i=`Tried using ${e} but no implementation of that interface was found. Make sure an implementation is registered, e.g. via "context.${r} = new My${n}();".`;super(i)}};function rR(){let t=()=>{throw new pr("DownloaderInterface","downloader")};return{download:t,downloadJson:t}}a();function nR(){let t=()=>{throw new pr("EddsaInterface","eddsa")};return{generateKeypair:t,createKeypairFromSecretKey:t,createKeypairFromSeed:t,isOnCurve:t,findPda:t,sign:t,verify:t}}a();function iR(){return{send:()=>{throw new pr("HttpInterface","http")}}}a();function sR(){let t=()=>{throw new pr("ProgramRepositoryInterface","programs")};return{has:t,get:t,getPublicKey:t,all:t,add:t,bind:t,unbind:t,clone:t,resolveError:t}}a();function oR(){let t=()=>{throw new pr("RpcInterface","rpc")};return{getEndpoint:t,getCluster:t,getAccount:t,getAccounts:t,getProgramAccounts:t,getBlockTime:t,getBalance:t,getRent:t,getSlot:t,getGenesisHash:t,getLatestBlockhash:t,getTransaction:t,getSignatureStatuses:t,accountExists:t,airdrop:t,call:t,sendTransaction:t,simulateTransaction:t,confirmTransaction:t}}a();function aR(){let t=()=>{throw new pr("SerializerInterface","serializer")};return{tuple:t,array:t,map:t,set:t,option:t,nullable:t,struct:t,enum:t,dataEnum:t,string:t,bool:t,unit:t,u8:t,u16:t,u32:t,u64:t,u128:t,i8:t,i16:t,i32:t,i64:t,i128:t,f32:t,f64:t,bytes:t,publicKey:t}}a();a();var U_=(t,e)=>t.reduce((r,n,i)=>{let s=Math.floor(i/e);return r[s]||(r[s]=[]),r[s].push(n),r},[]);var V_=t=>({publicKey:t,async signMessage(e){return e},async signTransaction(e){return e},async signAllTransactions(e){return e}});function jg(){let t=new Error("Trying to use a NullSigner. Did you forget to set a Signer on your Umi instance? See the `signerIdentity` method for more information."),e=()=>{throw t};return{get publicKey(){throw t},signMessage:e,signTransaction:e,signAllTransactions:e}}a();function cR(){let t=()=>{throw new pr("TransactionFactoryInterface","transactions")};return{create:t,serialize:t,deserialize:t,serializeMessage:t,deserializeMessage:t}}a();function uR(){let t=()=>{throw new pr("UploaderInterface","uploader")};return{upload:t,uploadJson:t,getUploadPrice:t}}var lR=()=>({downloader:rR(),eddsa:nR(),http:iR(),identity:jg(),payer:jg(),programs:sR(),rpc:oR(),serializer:aR(),transactions:cR(),uploader:uR()});a();var F_=t=>{if(typeof t=="string"||T4(t)){let e=new Date(t),r=Math.floor(e.getTime()/1e3);return Hd(r)}return Hd(t)};var T4=t=>Object.prototype.toString.call(t)==="[object Date]";a();a();var dR=(t=20,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")=>{let r="",n=e.length;for(let i=0;i<t;i+=1)r+=e.charAt(Math.floor(Math.random()*n));return r};var K_=(t,e,r={})=>({buffer:typeof t=="string"?du.serialize(t):t,fileName:e,displayName:r.displayName??e,uniqueName:r.uniqueName??dR(),contentType:r.contentType??null,extension:r.extension??z4(e),tags:r.tags??[]});var z4=t=>{let e=t.lastIndexOf(".");return e<0?null:t.slice(e+1)};a();var Gg=()=>new Hg({method:"get",data:void 0,headers:{},url:""}),Hg=class t{constructor(e){this.request=e}asJson(){return this.contentType("application/json")}asMultipart(){return this.contentType("multipart/form-data")}asForm(){return this.contentType("application/x-www-form-urlencoded")}accept(e){return this.withHeader("accept",e)}contentType(e){return this.withHeader("content-type",e)}userAgent(e){return this.withHeader("user-agent",e)}withToken(e,r="Bearer"){return this.withHeader("authorization",`${r} ${e}`)}withHeader(e,r){return this.withHeaders({[e]:r})}withHeaders(e){return new t({...this.request,headers:{...this.request.headers,...e}})}dontFollowRedirects(){return this.followRedirects(0)}followRedirects(e){return new t({...this.request,maxRedirects:e})}withoutTimeout(){return this.withTimeout(0)}withTimeout(e){return new t({...this.request,timeout:e})}withAbortSignal(e){return new t({...this.request,signal:e})}withEndpoint(e,r){return new t({...this.request,method:e,url:r})}withParams(e){let r=new URL(this.request.url),n=new URLSearchParams(e),i=new URLSearchParams(r.searchParams);return[...n.entries()].forEach(([s,o])=>{i.append(s,o)}),r.search=i.toString(),new t({...this.request,url:r.toString()})}withData(e){return new t({...this.request,data:e})}get(e){return this.withEndpoint("get",e)}post(e){return this.withEndpoint("post",e)}put(e){return this.withEndpoint("put",e)}patch(e){return this.withEndpoint("patch",e)}delete(e){return this.withEndpoint("delete",e)}get method(){return this.request.method}get url(){return this.request.url}get data(){return this.request.data}get headers(){return this.request.headers}get maxRedirects(){return this.request.maxRedirects}get timeout(){return this.request.timeout}get signal(){return this.request.signal}};a();a();var fR=(t,e,r)=>{let n=t.message.header.numRequiredSignatures,s=t.message.accounts.slice(0,n).findIndex(c=>c===r);if(s<0)throw new Error("The provided signer is not required to sign this transaction.");let o=[...t.signatures];return o[s]=e,{...t,signatures:o}};var $g=t=>Zg(t,t.eddsa.generateKeypair()),Zg=(t,e)=>({publicKey:e.publicKey,secretKey:e.secretKey,async signMessage(r){return t.eddsa.sign(r,e)},async signTransaction(r){let n=r.serializedMessage,i=t.eddsa.sign(n,e);return fR(r,i,e.publicKey)},async signAllTransactions(r){return Promise.all(r.map(n=>this.signTransaction(n)))}});a();var W_=(t,e=!0)=>({install(r){r.identity=t,e&&(r.payer=t)}});a();var j_=()=>({...lR(),use(t){return t.install(this),this}});a();var Gd=class extends bu{name="ProgramError";constructor(e,r,n){super(e,"program",`${r.name} [${r.publicKey}]`,n),this.program=r,this.logs=n?.logs,this.logs&&(this.message+=`
+`}getCapitalizedSource(){return this.source==="sdk"||this.source==="rpc"?this.source.toUpperCase():this.source[0].toUpperCase()+this.source.slice(1)}getFullSource(){let e=this.getCapitalizedSource(),r=this.sourceDetails?` > ${this.sourceDetails}`:"";return e+r}toString(){return`[${this.name}] ${this.message}`}};var Zs=class extends _l{name="SdkError";constructor(e,r){super(e,"sdk",void 0,r)}};var uE=128;a();a();var Zp=t=>(t=typeof t=="object"?t.toString():t,BigInt(t));var Xp=(t,e,r)=>({basisPoints:Zp(t),identifier:e,decimals:r}),iz=(t,e,r)=>{let n=Xp(BigInt(10)**BigInt(r??0),e,r);return sz(n,t)};var Xs=t=>Xp(t,"SOL",9),lE=t=>iz(t,"SOL",9);var sz=(t,e)=>{if(typeof e=="bigint")return{...t,basisPoints:t.basisPoints*e};let[r,n]=e.toString().split("."),i=BigInt(r+(n??"")),s=BigInt(10)**BigInt(n?.length??0);return{...t,basisPoints:t.basisPoints*i/s}};var dE=t=>t.basisPoints===BigInt(0);a();var Ij=["api.mainnet-beta.solana.com","ssc-dao.genesysgo.net"],Pj=["api.devnet.solana.com","psytrbhymqlkfrhudd.dev.genesysgo.net"],Rj=["api.testnet.solana.com"],Oj=["localhost","127.0.0.1"],fE=t=>{let e=new URL(t).hostname;return Ij.includes(e)?"mainnet-beta":Pj.includes(e)?"devnet":Rj.includes(e)?"testnet":Oj.includes(e)?"localnet":t.includes("mainnet")?"mainnet-beta":t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("local")?"localnet":"custom"};a();a();a();var Pr=class extends Zs{name="InterfaceImplementationMissingError";constructor(e,r){let n=e.replace(/Interface$/,""),i=`Tried using ${e} but no implementation of that interface was found. Make sure an implementation is registered, e.g. via "context.${r} = new My${n}();".`;super(i)}};function oz(){let t=()=>{throw new Pr("DownloaderInterface","downloader")};return{download:t,downloadJson:t}}a();function az(){let t=()=>{throw new Pr("EddsaInterface","eddsa")};return{generateKeypair:t,createKeypairFromSecretKey:t,createKeypairFromSeed:t,isOnCurve:t,findPda:t,sign:t,verify:t}}a();function cz(){return{send:()=>{throw new Pr("HttpInterface","http")}}}a();function uz(){let t=()=>{throw new Pr("ProgramRepositoryInterface","programs")};return{has:t,get:t,getPublicKey:t,all:t,add:t,bind:t,unbind:t,clone:t,resolveError:t}}a();function lz(){let t=()=>{throw new Pr("RpcInterface","rpc")};return{getEndpoint:t,getCluster:t,getAccount:t,getAccounts:t,getProgramAccounts:t,getBlockTime:t,getBalance:t,getRent:t,getSlot:t,getGenesisHash:t,getLatestBlockhash:t,getTransaction:t,getSignatureStatuses:t,accountExists:t,airdrop:t,call:t,sendTransaction:t,simulateTransaction:t,confirmTransaction:t}}a();function dz(){let t=()=>{throw new Pr("SerializerInterface","serializer")};return{tuple:t,array:t,map:t,set:t,option:t,nullable:t,struct:t,enum:t,dataEnum:t,string:t,bool:t,unit:t,u8:t,u16:t,u32:t,u64:t,u128:t,i8:t,i16:t,i32:t,i64:t,i128:t,f32:t,f64:t,bytes:t,publicKey:t}}a();a();var pE=(t,e)=>t.reduce((r,n,i)=>{let s=Math.floor(i/e);return r[s]||(r[s]=[]),r[s].push(n),r},[]);var hE=t=>({publicKey:t,async signMessage(e){return e},async signTransaction(e){return e},async signAllTransactions(e){return e}});function Dy(){let t=new Error("Trying to use a NullSigner. Did you forget to set a Signer on your Umi instance? See the `signerIdentity` method for more information."),e=()=>{throw t};return{get publicKey(){throw t},signMessage:e,signTransaction:e,signAllTransactions:e}}a();function fz(){let t=()=>{throw new Pr("TransactionFactoryInterface","transactions")};return{create:t,serialize:t,deserialize:t,serializeMessage:t,deserializeMessage:t}}a();function pz(){let t=()=>{throw new Pr("UploaderInterface","uploader")};return{upload:t,uploadJson:t,getUploadPrice:t}}var hz=()=>({downloader:oz(),eddsa:az(),http:cz(),identity:Dy(),payer:Dy(),programs:uz(),rpc:lz(),serializer:dz(),transactions:fz(),uploader:pz()});a();var gE=t=>{if(typeof t=="string"||Tj(t)){let e=new Date(t),r=Math.floor(e.getTime()/1e3);return Zp(r)}return Zp(t)};var Tj=t=>Object.prototype.toString.call(t)==="[object Date]";a();a();var gz=(t=20,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")=>{let r="",n=e.length;for(let i=0;i<t;i+=1)r+=e.charAt(Math.floor(Math.random()*n));return r};var mE=(t,e,r={})=>({buffer:typeof t=="string"?pl.serialize(t):t,fileName:e,displayName:r.displayName??e,uniqueName:r.uniqueName??gz(),contentType:r.contentType??null,extension:r.extension??Bj(e),tags:r.tags??[]});var Bj=t=>{let e=t.lastIndexOf(".");return e<0?null:t.slice(e+1)};a();var Uy=()=>new qy({method:"get",data:void 0,headers:{},url:""}),qy=class t{constructor(e){this.request=e}asJson(){return this.contentType("application/json")}asMultipart(){return this.contentType("multipart/form-data")}asForm(){return this.contentType("application/x-www-form-urlencoded")}accept(e){return this.withHeader("accept",e)}contentType(e){return this.withHeader("content-type",e)}userAgent(e){return this.withHeader("user-agent",e)}withToken(e,r="Bearer"){return this.withHeader("authorization",`${r} ${e}`)}withHeader(e,r){return this.withHeaders({[e]:r})}withHeaders(e){return new t({...this.request,headers:{...this.request.headers,...e}})}dontFollowRedirects(){return this.followRedirects(0)}followRedirects(e){return new t({...this.request,maxRedirects:e})}withoutTimeout(){return this.withTimeout(0)}withTimeout(e){return new t({...this.request,timeout:e})}withAbortSignal(e){return new t({...this.request,signal:e})}withEndpoint(e,r){return new t({...this.request,method:e,url:r})}withParams(e){let r=new URL(this.request.url),n=new URLSearchParams(e),i=new URLSearchParams(r.searchParams);return[...n.entries()].forEach(([s,o])=>{i.append(s,o)}),r.search=i.toString(),new t({...this.request,url:r.toString()})}withData(e){return new t({...this.request,data:e})}get(e){return this.withEndpoint("get",e)}post(e){return this.withEndpoint("post",e)}put(e){return this.withEndpoint("put",e)}patch(e){return this.withEndpoint("patch",e)}delete(e){return this.withEndpoint("delete",e)}get method(){return this.request.method}get url(){return this.request.url}get data(){return this.request.data}get headers(){return this.request.headers}get maxRedirects(){return this.request.maxRedirects}get timeout(){return this.request.timeout}get signal(){return this.request.signal}};a();a();var mz=(t,e,r)=>{let n=t.message.header.numRequiredSignatures,s=t.message.accounts.slice(0,n).findIndex(c=>c===r);if(s<0)throw new Error("The provided signer is not required to sign this transaction.");let o=[...t.signatures];return o[s]=e,{...t,signatures:o}};var Vy=t=>Ky(t,t.eddsa.generateKeypair()),Ky=(t,e)=>({publicKey:e.publicKey,secretKey:e.secretKey,async signMessage(r){return t.eddsa.sign(r,e)},async signTransaction(r){let n=r.serializedMessage,i=t.eddsa.sign(n,e);return mz(r,i,e.publicKey)},async signAllTransactions(r){return Promise.all(r.map(n=>this.signTransaction(n)))}});a();var yE=(t,e=!0)=>({install(r){r.identity=t,e&&(r.payer=t)}});a();var bE=()=>({...hz(),use(t){return t.install(this),this}});a();var Yp=class extends _l{name="ProgramError";constructor(e,r,n){super(e,"program",`${r.name} [${r.publicKey}]`,n),this.program=r,this.logs=n?.logs,this.logs&&(this.message+=`
Program Logs:
${this.logs.map(i=>`| ${i}`).join(`
`)}
-`)}};a();a();a();function hR(t){let e=async(i,s={})=>{let o=await t.http.send(Gg().get(i).withAbortSignal(s.signal));return K_(o.body,i)};return{download:async(i,s={})=>Promise.all(i.map(o=>e(o,s))),downloadJson:async(i,s={})=>(await t.http.send(Gg().get(i).withAbortSignal(s.signal))).data}}a();var H_=()=>({install(t){t.downloader=hR(t)}});a();a();a();a();a();a();var ve=Pr(Ba());a();a();a();a();a();var Ca=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Qr(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function mi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function pt(t,...e){if(!Qr(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Yg(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");mi(t.outputLen),mi(t.blockLen)}function gs(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Xg(t,e){pt(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function gR(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Kn(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Jg(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function bi(t,e){return t<<32-e|t>>>e}var k4=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function C4(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function N4(t){for(let e=0;e<t.length;e++)t[e]=C4(t[e]);return t}var G_=k4?t=>t:N4,yR=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",M4=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ur(t){if(pt(t),yR)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=M4[t[r]];return e}var ps={_0:48,_9:57,A:65,F:70,a:97,f:102};function pR(t){if(t>=ps._0&&t<=ps._9)return t-ps._0;if(t>=ps.A&&t<=ps.F)return t-(ps.A-10);if(t>=ps.a&&t<=ps.f)return t-(ps.a-10)}function _i(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(yR)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let o=pR(t.charCodeAt(s)),c=pR(t.charCodeAt(s+1));if(o===void 0||c===void 0){let u=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}function $d(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Na(t){return typeof t=="string"&&(t=$d(t)),pt(t),t}function vt(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];pt(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}var Xs=class{};function Zd(t){let e=n=>t().update(Na(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function ys(t=32){if(Ca&&typeof Ca.getRandomValues=="function")return Ca.getRandomValues(new Uint8Array(t));if(Ca&&typeof Ca.randomBytes=="function")return Uint8Array.from(Ca.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function L4(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),c=Number(r&s),u=n?4:0,d=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+d,c,n)}function mR(t,e,r){return t&e^~t&r}function bR(t,e,r){return t&e^t&r^e&r}var Yd=class extends Xs{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=Jg(this.buffer)}update(e){gs(this),e=Na(e),pt(e);let{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let u=Jg(e);for(;i<=s-o;o+=i)this.process(u,o);continue}n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){gs(this),Xg(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;r[o++]=128,Kn(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let m=o;m<i;m++)r[m]=0;L4(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=Jg(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,f=this.get();if(d>f.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<d;m++)c.setUint32(4*m,f[m],s)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=c,i%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},ms=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var Or=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);a();var Qg=BigInt(4294967295),_R=BigInt(32);function D4(t,e=!1){return e?{h:Number(t&Qg),l:Number(t>>_R&Qg)}:{h:Number(t>>_R&Qg)|0,l:Number(t&Qg)|0}}function e0(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:o,l:c}=D4(t[s],e);[n[s],i[s]]=[o,c]}return[n,i]}var $_=(t,e,r)=>t>>>r,Z_=(t,e,r)=>t<<32-r|e>>>r,Ma=(t,e,r)=>t>>>r|e<<32-r,La=(t,e,r)=>t<<32-r|e>>>r,Xd=(t,e,r)=>t<<64-r|e>>>r-32,Jd=(t,e,r)=>t>>>r-32|e<<64-r;var AR=(t,e,r)=>t<<r|e>>>32-r,SR=(t,e,r)=>e<<r|t>>>32-r,vR=(t,e,r)=>e<<r-32|t>>>64-r,ER=(t,e,r)=>t<<r-32|e>>>64-r;function Ni(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var wR=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),xR=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,IR=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),PR=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,RR=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),OR=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0;var U4=Uint32Array.from([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]),Js=new Uint32Array(64),t0=class extends Yd{constructor(e=32){super(64,e,8,!1),this.A=ms[0]|0,this.B=ms[1]|0,this.C=ms[2]|0,this.D=ms[3]|0,this.E=ms[4]|0,this.F=ms[5]|0,this.G=ms[6]|0,this.H=ms[7]|0}get(){let{A:e,B:r,C:n,D:i,E:s,F:o,G:c,H:u}=this;return[e,r,n,i,s,o,c,u]}set(e,r,n,i,s,o,c,u){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=u|0}process(e,r){for(let m=0;m<16;m++,r+=4)Js[m]=e.getUint32(r,!1);for(let m=16;m<64;m++){let _=Js[m-15],v=Js[m-2],P=bi(_,7)^bi(_,18)^_>>>3,B=bi(v,17)^bi(v,19)^v>>>10;Js[m]=B+Js[m-7]+P+Js[m-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:u,G:d,H:f}=this;for(let m=0;m<64;m++){let _=bi(c,6)^bi(c,11)^bi(c,25),v=f+_+mR(c,u,d)+U4[m]+Js[m]|0,B=(bi(n,2)^bi(n,13)^bi(n,22))+bR(n,i,s)|0;f=d,d=u,u=c,c=o+v|0,o=s,s=i,i=n,n=v+B|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(n,i,s,o,c,u,d,f)}roundClean(){Kn(Js)}destroy(){this.set(0,0,0,0,0,0,0,0),Kn(this.buffer)}};var BR=e0(["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","0xf40e35855771202a","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(t=>BigInt(t))),V4=BR[0],F4=BR[1],Qs=new Uint32Array(80),eo=new Uint32Array(80),Y_=class extends Yd{constructor(e=64){super(128,e,16,!1),this.Ah=Or[0]|0,this.Al=Or[1]|0,this.Bh=Or[2]|0,this.Bl=Or[3]|0,this.Ch=Or[4]|0,this.Cl=Or[5]|0,this.Dh=Or[6]|0,this.Dl=Or[7]|0,this.Eh=Or[8]|0,this.El=Or[9]|0,this.Fh=Or[10]|0,this.Fl=Or[11]|0,this.Gh=Or[12]|0,this.Gl=Or[13]|0,this.Hh=Or[14]|0,this.Hl=Or[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:u,Eh:d,El:f,Fh:m,Fl:_,Gh:v,Gl:P,Hh:B,Hl:k}=this;return[e,r,n,i,s,o,c,u,d,f,m,_,v,P,B,k]}set(e,r,n,i,s,o,c,u,d,f,m,_,v,P,B,k){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=u|0,this.Eh=d|0,this.El=f|0,this.Fh=m|0,this.Fl=_|0,this.Gh=v|0,this.Gl=P|0,this.Hh=B|0,this.Hl=k|0}process(e,r){for(let M=0;M<16;M++,r+=4)Qs[M]=e.getUint32(r),eo[M]=e.getUint32(r+=4);for(let M=16;M<80;M++){let F=Qs[M-15]|0,Q=eo[M-15]|0,W=Ma(F,Q,1)^Ma(F,Q,8)^$_(F,Q,7),Z=La(F,Q,1)^La(F,Q,8)^Z_(F,Q,7),H=Qs[M-2]|0,N=eo[M-2]|0,K=Ma(H,N,19)^Xd(H,N,61)^$_(H,N,6),Y=La(H,N,19)^Jd(H,N,61)^Z_(H,N,6),J=IR(Z,Y,eo[M-7],eo[M-16]),w=PR(J,W,K,Qs[M-7],Qs[M-16]);Qs[M]=w|0,eo[M]=J|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:u,Dh:d,Dl:f,Eh:m,El:_,Fh:v,Fl:P,Gh:B,Gl:k,Hh:T,Hl:L}=this;for(let M=0;M<80;M++){let F=Ma(m,_,14)^Ma(m,_,18)^Xd(m,_,41),Q=La(m,_,14)^La(m,_,18)^Jd(m,_,41),W=m&v^~m&B,Z=_&P^~_&k,H=RR(L,Q,Z,F4[M],eo[M]),N=OR(H,T,F,W,V4[M],Qs[M]),K=H|0,Y=Ma(n,i,28)^Xd(n,i,34)^Xd(n,i,39),J=La(n,i,28)^Jd(n,i,34)^Jd(n,i,39),w=n&s^n&c^s&c,l=i&o^i&u^o&u;T=B|0,L=k|0,B=v|0,k=P|0,v=m|0,P=_|0,{h:m,l:_}=Ni(d|0,f|0,N|0,K|0),d=c|0,f=u|0,c=s|0,u=o|0,s=n|0,o=i|0;let h=wR(K,J,l);n=xR(h,N,Y,w),i=h|0}({h:n,l:i}=Ni(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=Ni(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:u}=Ni(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:f}=Ni(this.Dh|0,this.Dl|0,d|0,f|0),{h:m,l:_}=Ni(this.Eh|0,this.El|0,m|0,_|0),{h:v,l:P}=Ni(this.Fh|0,this.Fl|0,v|0,P|0),{h:B,l:k}=Ni(this.Gh|0,this.Gl|0,B|0,k|0),{h:T,l:L}=Ni(this.Hh|0,this.Hl|0,T|0,L|0),this.set(n,i,s,o,c,u,d,f,m,_,v,P,B,k,T,L)}roundClean(){Kn(Qs,eo)}destroy(){Kn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var r0=Zd(()=>new t0);var n0=Zd(()=>new Y_);a();a();var Q_=BigInt(0),J_=BigInt(1);function bs(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function In(t,e,r=""){let n=Qr(t),i=t?.length,s=e!==void 0;if(!n||s&&i!==e){let o=r&&`"${r}" `,c=s?` of length ${e}`:"",u=n?`length=${i}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+c+", got "+u)}return t}function Qd(t){let e=t.toString(16);return e.length&1?"0"+e:e}function TR(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Q_:BigInt("0x"+t)}function _u(t){return TR(ur(t))}function _s(t){return pt(t),TR(ur(Uint8Array.from(t).reverse()))}function i0(t,e){return _i(t.toString(16).padStart(e*2,"0"))}function eA(t,e){return i0(t,e).reverse()}function He(t,e,r){let n;if(typeof e=="string")try{n=_i(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(Qr(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function zR(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function tA(t){return Uint8Array.from(t)}var X_=t=>typeof t=="bigint"&&Q_<=t;function kR(t,e,r){return X_(t)&&X_(e)&&X_(r)&&e<=t&&t<r}function ef(t,e,r,n){if(!kR(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function s0(t){let e;for(e=0;t>Q_;t>>=J_,e+=1);return e}var to=t=>(J_<<BigInt(t))-J_;function CR(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=v=>new Uint8Array(v),i=v=>Uint8Array.of(v),s=n(t),o=n(t),c=0,u=()=>{s.fill(1),o.fill(0),c=0},d=(...v)=>r(o,s,...v),f=(v=n(0))=>{o=d(i(0),v),s=d(),v.length!==0&&(o=d(i(1),v),s=d())},m=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let v=0,P=[];for(;v<e;){s=d();let B=s.slice();P.push(B),v+=s.length}return vt(...P)};return(v,P)=>{u(),f(v);let B;for(;!(B=P(m()));)f();return u(),B}}function ro(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){let c=t[i];if(o&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}var rA=()=>{throw new Error("not implemented")};function Au(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let s=t(r,...n);return e.set(r,s),s}}a();var en=BigInt(0),gr=BigInt(1),Da=BigInt(2),LR=BigInt(3),DR=BigInt(4),qR=BigInt(5),W4=BigInt(7),UR=BigInt(8),j4=BigInt(9),VR=BigInt(16);function mt(t,e){let r=t%e;return r>=en?r:e+r}function nt(t,e,r){let n=t;for(;e-- >en;)n*=n,n%=r;return n}function NR(t,e){if(t===en)throw new Error("invert: expected non-zero number");if(e<=en)throw new Error("invert: expected positive modulus, got "+e);let r=mt(t,e),n=e,i=en,s=gr,o=gr,c=en;for(;r!==en;){let d=n/r,f=n%r,m=i-o*d,_=s-c*d;n=r,r=f,i=o,s=c,o=m,c=_}if(n!==gr)throw new Error("invert: does not exist");return mt(i,e)}function nA(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function FR(t,e){let r=(t.ORDER+gr)/DR,n=t.pow(e,r);return nA(t,n,e),n}function H4(t,e){let r=(t.ORDER-qR)/UR,n=t.mul(e,Da),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Da),i),c=t.mul(s,t.sub(o,t.ONE));return nA(t,c,e),c}function G4(t){let e=Pn(t),r=KR(t),n=r(e,e.neg(e.ONE)),i=r(e,n),s=r(e,e.neg(n)),o=(t+W4)/VR;return(c,u)=>{let d=c.pow(u,o),f=c.mul(d,n),m=c.mul(d,i),_=c.mul(d,s),v=c.eql(c.sqr(f),u),P=c.eql(c.sqr(m),u);d=c.cmov(d,f,v),f=c.cmov(_,m,P);let B=c.eql(c.sqr(f),u),k=c.cmov(d,f,B);return nA(c,k,u),k}}function KR(t){if(t<LR)throw new Error("sqrt is not defined for small field");let e=t-gr,r=0;for(;e%Da===en;)e/=Da,r++;let n=Da,i=Pn(t);for(;MR(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return FR;let s=i.pow(n,e),o=(e+gr)/Da;return function(u,d){if(u.is0(d))return d;if(MR(u,d)!==1)throw new Error("Cannot find square root");let f=r,m=u.mul(u.ONE,s),_=u.pow(d,e),v=u.pow(d,o);for(;!u.eql(_,u.ONE);){if(u.is0(_))return u.ZERO;let P=1,B=u.sqr(_);for(;!u.eql(B,u.ONE);)if(P++,B=u.sqr(B),P===f)throw new Error("Cannot find square root");let k=gr<<BigInt(f-P-1),T=u.pow(m,k);f=P,m=u.sqr(T),_=u.mul(_,m),v=u.mul(v,T)}return v}}function $4(t){return t%DR===LR?FR:t%UR===qR?H4:t%VR===j4?G4(t):KR(t)}var As=(t,e)=>(mt(t,e)&gr)===gr,Z4=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function iA(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=Z4.reduce((n,i)=>(n[i]="function",n),e);return ro(t,r),t}function Y4(t,e,r){if(r<en)throw new Error("invalid exponent, negatives unsupported");if(r===en)return t.ONE;if(r===gr)return e;let n=t.ONE,i=e;for(;r>en;)r&gr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=gr;return n}function tf(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,c,u)=>t.is0(c)?o:(n[u]=o,t.mul(o,c)),t.ONE),s=t.inv(i);return e.reduceRight((o,c,u)=>t.is0(c)?o:(n[u]=t.mul(o,n[u]),t.mul(o,c)),s),n}function MR(t,e){let r=(t.ORDER-gr)/Da,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function o0(t,e){e!==void 0&&mi(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Pn(t,e,r=!1,n={}){if(t<=en)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s,o=!1,c;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let _=e;_.BITS&&(i=_.BITS),_.sqrt&&(s=_.sqrt),typeof _.isLE=="boolean"&&(r=_.isLE),typeof _.modFromBytes=="boolean"&&(o=_.modFromBytes),c=_.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);let{nBitLength:u,nByteLength:d}=o0(t,i);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,m=Object.freeze({ORDER:t,isLE:r,BITS:u,BYTES:d,MASK:to(u),ZERO:en,ONE:gr,allowedLengths:c,create:_=>mt(_,t),isValid:_=>{if(typeof _!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof _);return en<=_&&_<t},is0:_=>_===en,isValidNot0:_=>!m.is0(_)&&m.isValid(_),isOdd:_=>(_&gr)===gr,neg:_=>mt(-_,t),eql:(_,v)=>_===v,sqr:_=>mt(_*_,t),add:(_,v)=>mt(_+v,t),sub:(_,v)=>mt(_-v,t),mul:(_,v)=>mt(_*v,t),pow:(_,v)=>Y4(m,_,v),div:(_,v)=>mt(_*NR(v,t),t),sqrN:_=>_*_,addN:(_,v)=>_+v,subN:(_,v)=>_-v,mulN:(_,v)=>_*v,inv:_=>NR(_,t),sqrt:s||(_=>(f||(f=$4(t)),f(m,_))),toBytes:_=>r?eA(_,d):i0(_,d),fromBytes:(_,v=!0)=>{if(c){if(!c.includes(_.length)||_.length>d)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+_.length);let B=new Uint8Array(d);B.set(_,r?0:B.length-_.length),_=B}if(_.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+_.length);let P=r?_s(_):_u(_);if(o&&(P=mt(P,t)),!v&&!m.isValid(P))throw new Error("invalid field element: outside of range 0..ORDER");return P},invertBatch:_=>tf(m,_),cmov:(_,v,P)=>P?v:_});return Object.freeze(m)}function WR(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function sA(t){let e=WR(t);return e+Math.ceil(e/2)}function oA(t,e,r=!1){let n=t.length,i=WR(e),s=sA(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let o=r?_s(t):_u(t),c=mt(o,e-gr)+gr;return r?eA(c,i):i0(c,i)}var Su=BigInt(0),qa=BigInt(1);function rf(t,e){let r=e.negate();return t?r:e}function Ss(t,e){let r=tf(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function $R(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function aA(t,e){$R(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=to(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function jR(t,e,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,c=Number(t&i),u=t>>o;c>n&&(c-=s,u+=qa);let d=e*n,f=d+Math.abs(c)-1,m=c===0,_=c<0,v=e%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:_,isNegF:v,offsetF:d}}function X4(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function J4(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var cA=new WeakMap,ZR=new WeakMap;function uA(t){return ZR.get(t)||1}function HR(t){if(t!==Su)throw new Error("invalid wNAF")}var vu=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>Su;)r&qa&&(n=n.add(i)),i=i.double(),r>>=qa;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=aA(r,this.bits),s=[],o=e,c=o;for(let u=0;u<n;u++){c=o,s.push(c);for(let d=1;d<i;d++)c=c.add(o),s.push(c);o=c.double()}return s}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE,o=aA(e,this.bits);for(let c=0;c<o.windows;c++){let{nextN:u,offset:d,isZero:f,isNeg:m,isNegF:_,offsetF:v}=jR(n,c,o);n=u,f?s=s.add(rf(_,r[v])):i=i.add(rf(m,r[d]))}return HR(n),{p:i,f:s}}wNAFUnsafe(e,r,n,i=this.ZERO){let s=aA(e,this.bits);for(let o=0;o<s.windows&&n!==Su;o++){let{nextN:c,offset:u,isZero:d,isNeg:f}=jR(n,o,s);if(n=c,!d){let m=r[u];i=i.add(f?m.negate():m)}}return HR(n),i}getPrecomputes(e,r,n){let i=cA.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),cA.set(r,i))),i}cached(e,r,n){let i=uA(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let s=uA(e);return s===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),r,i)}createCache(e,r){$R(r,this.bits),ZR.set(e,r),cA.delete(e)}hasCache(e){return uA(e)!==1}};function YR(t,e,r,n){let i=e,s=t.ZERO,o=t.ZERO;for(;r>Su||n>Su;)r&qa&&(s=s.add(i)),n&qa&&(o=o.add(i)),i=i.double(),r>>=qa,n>>=qa;return{p1:s,p2:o}}function Eu(t,e,r,n){X4(r,t),J4(n,e);let i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");let o=t.ZERO,c=s0(BigInt(i)),u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);let d=to(u),f=new Array(Number(d)+1).fill(o),m=Math.floor((e.BITS-1)/u)*u,_=o;for(let v=m;v>=0;v-=u){f.fill(o);for(let B=0;B<s;B++){let k=n[B],T=Number(k>>BigInt(v)&d);f[T]=f[T].add(r[B])}let P=o;for(let B=f.length-1,k=o;B>0;B--)k=k.add(f[B]),P=P.add(k);if(_=_.add(P),v!==0)for(let B=0;B<u;B++)_=_.double()}return _}function GR(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return iA(e),e}else return Pn(t,{isLE:r})}function a0(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let u of["p","n","h"]){let d=e[u];if(!(typeof d=="bigint"&&d>Su))throw new Error(`CURVE.${u} must be positive bigint`)}let i=GR(e.p,r.Fp,n),s=GR(e.n,r.Fn,n),c=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let u of c)if(!i.isValid(e[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:s}}a();var no=BigInt(0),yr=BigInt(1),lA=BigInt(2),Q4=BigInt(8);function eU(t,e,r,n){let i=t.sqr(r),s=t.sqr(n),o=t.add(t.mul(e.a,i),s),c=t.add(t.ONE,t.mul(e.d,t.mul(i,s)));return t.eql(o,c)}function tU(t,e={}){let r=a0("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o}=s;ro(e,{},{uvRatio:"function"});let c=lA<<BigInt(i.BYTES*8)-yr,u=k=>n.create(k),d=e.uvRatio||((k,T)=>{try{return{isValid:!0,value:n.sqrt(n.div(k,T))}}catch{return{isValid:!1,value:no}}});if(!eU(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(k,T,L=!1){let M=L?yr:no;return ef("coordinate "+k,T,M,c),T}function m(k){if(!(k instanceof P))throw new Error("ExtendedPoint expected")}let _=Au((k,T)=>{let{X:L,Y:M,Z:F}=k,Q=k.is0();T==null&&(T=Q?Q4:n.inv(F));let W=u(L*T),Z=u(M*T),H=n.mul(F,T);if(Q)return{x:no,y:yr};if(H!==yr)throw new Error("invZ was invalid");return{x:W,y:Z}}),v=Au(k=>{let{a:T,d:L}=s;if(k.is0())throw new Error("bad point: ZERO");let{X:M,Y:F,Z:Q,T:W}=k,Z=u(M*M),H=u(F*F),N=u(Q*Q),K=u(N*N),Y=u(Z*T),J=u(N*u(Y+H)),w=u(K+u(L*u(Z*H)));if(J!==w)throw new Error("bad point: equation left != right (1)");let l=u(M*F),h=u(Q*W);if(l!==h)throw new Error("bad point: equation left != right (2)");return!0});class P{constructor(T,L,M,F){this.X=f("x",T),this.Y=f("y",L),this.Z=f("z",M,!0),this.T=f("t",F),Object.freeze(this)}static CURVE(){return s}static fromAffine(T){if(T instanceof P)throw new Error("extended point not allowed");let{x:L,y:M}=T||{};return f("x",L),f("y",M),new P(L,M,yr,u(L*M))}static fromBytes(T,L=!1){let M=n.BYTES,{a:F,d:Q}=s;T=tA(In(T,M,"point")),bs(L,"zip215");let W=tA(T),Z=T[M-1];W[M-1]=Z&-129;let H=_s(W),N=L?c:n.ORDER;ef("point.y",H,no,N);let K=u(H*H),Y=u(K-yr),J=u(Q*K-F),{isValid:w,value:l}=d(Y,J);if(!w)throw new Error("bad point: invalid y coordinate");let h=(l&yr)===yr,A=(Z&128)!==0;if(!L&&l===no&&A)throw new Error("bad point: x=0 and x_0=1");return A!==h&&(l=u(-l)),P.fromAffine({x:l,y:H})}static fromHex(T,L=!1){return P.fromBytes(He("point",T),L)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,L=!0){return B.createCache(this,T),L||this.multiply(lA),this}assertValidity(){v(this)}equals(T){m(T);let{X:L,Y:M,Z:F}=this,{X:Q,Y:W,Z}=T,H=u(L*Z),N=u(Q*F),K=u(M*Z),Y=u(W*F);return H===N&&K===Y}is0(){return this.equals(P.ZERO)}negate(){return new P(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:T}=s,{X:L,Y:M,Z:F}=this,Q=u(L*L),W=u(M*M),Z=u(lA*u(F*F)),H=u(T*Q),N=L+M,K=u(u(N*N)-Q-W),Y=H+W,J=Y-Z,w=H-W,l=u(K*J),h=u(Y*w),A=u(K*w),E=u(J*Y);return new P(l,h,E,A)}add(T){m(T);let{a:L,d:M}=s,{X:F,Y:Q,Z:W,T:Z}=this,{X:H,Y:N,Z:K,T:Y}=T,J=u(F*H),w=u(Q*N),l=u(Z*M*Y),h=u(W*K),A=u((F+Q)*(H+N)-J-w),E=h-l,x=h+l,O=u(w-L*J),C=u(A*E),I=u(x*O),b=u(A*O),R=u(E*x);return new P(C,I,R,b)}subtract(T){return this.add(T.negate())}multiply(T){if(!i.isValidNot0(T))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:L,f:M}=B.cached(this,T,F=>Ss(P,F));return Ss(P,[L,M])[0]}multiplyUnsafe(T,L=P.ZERO){if(!i.isValid(T))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return T===no?P.ZERO:this.is0()||T===yr?this:B.unsafe(this,T,M=>Ss(P,M),L)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return B.unsafe(this,s.n).is0()}toAffine(T){return _(this,T)}clearCofactor(){return o===yr?this:this.multiplyUnsafe(o)}toBytes(){let{x:T,y:L}=this.toAffine(),M=n.toBytes(L);return M[M.length-1]|=T&yr?128:0,M}toHex(){return ur(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(T){return Ss(P,T)}static msm(T,L){return Eu(P,i,T,L)}_setWindowSize(T){this.precompute(T)}toRawBytes(){return this.toBytes()}}P.BASE=new P(s.Gx,s.Gy,yr,u(s.Gx*s.Gy)),P.ZERO=new P(no,yr,yr,no),P.Fp=n,P.Fn=i;let B=new vu(P,i.BITS);return P.BASE.precompute(8),P}var c0=class{constructor(e){this.ep=e}static fromBytes(e){rA()}static fromHex(e){rA()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return ur(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};function rU(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');ro(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:s,Fn:o}=t,c=r.randomBytes||ys,u=r.adjustScalarBytes||(N=>N),d=r.domain||((N,K,Y)=>{if(bs(Y,"phflag"),K.length||Y)throw new Error("Contexts/pre-hash are not supported");return N});function f(N){return o.create(_s(N))}function m(N){let K=M.secretKey;N=He("private key",N,K);let Y=He("hashed private key",e(N),2*K),J=u(Y.slice(0,K)),w=Y.slice(K,2*K),l=f(J);return{head:J,prefix:w,scalar:l}}function _(N){let{head:K,prefix:Y,scalar:J}=m(N),w=i.multiply(J),l=w.toBytes();return{head:K,prefix:Y,scalar:J,point:w,pointBytes:l}}function v(N){return _(N).pointBytes}function P(N=Uint8Array.of(),...K){let Y=vt(...K);return f(e(d(Y,He("context",N),!!n)))}function B(N,K,Y={}){N=He("message",N),n&&(N=n(N));let{prefix:J,scalar:w,pointBytes:l}=_(K),h=P(Y.context,J,N),A=i.multiply(h).toBytes(),E=P(Y.context,A,l,N),x=o.create(h+E*w);if(!o.isValid(x))throw new Error("sign failed: invalid s");let O=vt(A,o.toBytes(x));return In(O,M.signature,"result")}let k={zip215:!0};function T(N,K,Y,J=k){let{context:w,zip215:l}=J,h=M.signature;N=He("signature",N,h),K=He("message",K),Y=He("publicKey",Y,M.publicKey),l!==void 0&&bs(l,"zip215"),n&&(K=n(K));let A=h/2,E=N.subarray(0,A),x=_s(N.subarray(A,h)),O,C,I;try{O=t.fromBytes(Y,l),C=t.fromBytes(E,l),I=i.multiplyUnsafe(x)}catch{return!1}if(!l&&O.isSmallOrder())return!1;let b=P(w,C.toBytes(),O.toBytes(),K);return C.add(O.multiplyUnsafe(b)).subtract(I).clearCofactor().is0()}let L=s.BYTES,M={secretKey:L,publicKey:L,signature:2*L,seed:L};function F(N=c(M.seed)){return In(N,M.seed,"seed")}function Q(N){let K=H.randomSecretKey(N);return{secretKey:K,publicKey:v(K)}}function W(N){return Qr(N)&&N.length===o.BYTES}function Z(N,K){try{return!!t.fromBytes(N,K)}catch{return!1}}let H={getExtendedPublicKey:_,randomSecretKey:F,isValidSecretKey:W,isValidPublicKey:Z,toMontgomery(N){let{y:K}=t.fromBytes(N),Y=M.publicKey,J=Y===32;if(!J&&Y!==57)throw new Error("only defined for 25519 and 448");let w=J?s.div(yr+K,yr-K):s.div(K-yr,K+yr);return s.toBytes(w)},toMontgomerySecret(N){let K=M.secretKey;In(N,K);let Y=e(N.subarray(0,K));return u(Y).subarray(0,K)},randomPrivateKey:F,precompute(N=8,K=t.BASE){return K.precompute(N,!1)}};return Object.freeze({keygen:Q,getPublicKey:v,sign:B,verify:T,utils:H,Point:t,lengths:M})}function nU(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=Pn(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},s={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:s}}function iU(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function XR(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=nU(t),s=tU(e,r),o=rU(s,n,i);return iU(t,o)}var sU=BigInt(0),vs=BigInt(1),JR=BigInt(2),Pbe=BigInt(3),oU=BigInt(5),aU=BigInt(8),wu=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),nf={p:wu,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:aU,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function cU(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=wu,c=t*t%s*t%s,u=nt(c,JR,s)*c%s,d=nt(u,vs,s)*t%s,f=nt(d,oU,s)*d%s,m=nt(f,e,s)*f%s,_=nt(m,r,s)*m%s,v=nt(_,n,s)*_%s,P=nt(v,i,s)*v%s,B=nt(P,i,s)*v%s,k=nt(B,e,s)*f%s;return{pow_p_5_8:nt(k,JR,s)*t%s,b2:c}}function uU(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var dA=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function pA(t,e){let r=wu,n=mt(e*e*e,r),i=mt(n*n*e,r),s=cU(t*i).pow_p_5_8,o=mt(t*n*s,r),c=mt(e*o*o,r),u=o,d=mt(o*dA,r),f=c===t,m=c===mt(-t,r),_=c===mt(-t*dA,r);return f&&(o=u),(m||_)&&(o=d),As(o,r)&&(o=mt(-o,r)),{isValid:f||m,value:o}}var io=Pn(nf.p,{isLE:!0}),lU=Pn(nf.n,{isLE:!0}),dU={...nf,Fp:io,hash:n0,adjustScalarBytes:uU,uvRatio:pA},hn=XR(dU);var fA=dA,fU=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),hU=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),pU=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),gU=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),QR=t=>pA(vs,t),yU=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),hA=t=>hn.Point.Fp.create(_s(t)&yU);function eO(t){let{d:e}=nf,r=wu,n=T=>io.create(T),i=n(fA*t*t),s=n((i+vs)*pU),o=BigInt(-1),c=n((o-e*i)*n(i+e)),{isValid:u,value:d}=pA(s,c),f=n(d*t);As(f,r)||(f=n(-f)),u||(d=f),u||(o=i);let m=n(o*(i-vs)*gU-c),_=d*d,v=n((d+d)*c),P=n(m*fU),B=n(vs-_),k=n(vs+_);return new hn.Point(n(v*k),n(B*P),n(P*k),n(v*B))}function mU(t){pt(t,64);let e=hA(t.subarray(0,32)),r=eO(e),n=hA(t.subarray(32,64)),i=eO(n);return new Es(r.add(i))}var Es=class t extends c0{constructor(e){super(e)}static fromAffine(e){return new t(hn.Point.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static hashToCurve(e){return mU(He("ristrettoHash",e,64))}static fromBytes(e){pt(e,32);let{a:r,d:n}=nf,i=wu,s=F=>io.create(F),o=hA(e);if(!zR(io.toBytes(o),e)||As(o,i))throw new Error("invalid ristretto255 encoding 1");let c=s(o*o),u=s(vs+r*c),d=s(vs-r*c),f=s(u*u),m=s(d*d),_=s(r*n*f-m),{isValid:v,value:P}=QR(s(_*m)),B=s(P*d),k=s(P*B*_),T=s((o+o)*B);As(T,i)&&(T=s(-T));let L=s(u*k),M=s(T*L);if(!v||As(M,i)||L===sU)throw new Error("invalid ristretto255 encoding 2");return new t(new hn.Point(T,L,vs,M))}static fromHex(e){return t.fromBytes(He("ristrettoHex",e,32))}static msm(e,r){return Eu(t,hn.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,s=wu,o=k=>io.create(k),c=o(o(n+r)*o(n-r)),u=o(e*r),d=o(u*u),{value:f}=QR(o(c*d)),m=o(f*c),_=o(f*u),v=o(m*_*i),P;if(As(i*v,s)){let k=o(r*fA),T=o(e*fA);e=k,r=T,P=o(m*hU)}else P=_;As(e*v,s)&&(r=o(-r));let B=o((n-r)*P);return As(B,s)&&(B=o(-B)),io.toBytes(B)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:s}=e.ep,o=d=>io.create(d),c=o(r*s)===o(n*i),u=o(n*s)===o(r*i);return c||u}is0(){return this.equals(t.ZERO)}};Es.BASE=new Es(hn.Point.BASE);Es.ZERO=new Es(hn.Point.ZERO);Es.Fp=io;Es.Fn=lU;var dS=Pr(yA()),mr=Pr(cO());a();var _A=r0;var Du=Pr(bO()),z=Pr(RA()),KB=Pr(RA());a();a();var UU=1,VU=2,FU=3,KU=4,WU=5,jU=6,HU=7,GU=8,$U=9,ZU=10,YU=-32700,XU=-32603,JU=-32602,QU=-32601,eV=-32600,tV=-32016,rV=-32015,nV=-32014,iV=-32013,sV=-32012,oV=-32011,aV=-32010,cV=-32009,uV=-32008,lV=-32007,dV=-32006,fV=-32005,hV=-32004,pV=-32003,gV=-32002,yV=-32001,mV=28e5,bV=2800001,_V=2800002,AV=2800003,SV=2800004,vV=2800005,EV=2800006,wV=2800007,xV=2800008,IV=2800009,PV=2800010,RV=2800011,OV=323e4,BV=32300001,TV=3230002,zV=3230003,kV=3230004,CV=361e4,NV=3610001,MV=3610002,LV=3610003,DV=3610004,qV=3610005,UV=3610006,VV=3610007,FV=3611e3,KV=3704e3,WV=3704001,jV=3704002,HV=3704003,GV=3704004,$V=4128e3,ZV=4128001,YV=4128002,XV=4615e3,JV=4615001,QV=4615002,eF=4615003,tF=4615004,rF=4615005,nF=4615006,iF=4615007,sF=4615008,oF=4615009,aF=4615010,cF=4615011,uF=4615012,lF=4615013,dF=4615014,fF=4615015,hF=4615016,pF=4615017,gF=4615018,yF=4615019,mF=4615020,bF=4615021,_F=4615022,AF=4615023,SF=4615024,vF=4615025,EF=4615026,wF=4615027,xF=4615028,IF=4615029,PF=4615030,RF=4615031,OF=4615032,BF=4615033,TF=4615034,zF=4615035,kF=4615036,CF=4615037,NF=4615038,MF=4615039,LF=4615040,DF=4615041,qF=4615042,UF=4615043,VF=4615044,FF=4615045,KF=4615046,WF=4615047,jF=4615048,HF=4615049,GF=4615050,$F=4615051,ZF=4615052,YF=4615053,XF=4615054,JF=5508e3,QF=5508001,eK=5508002,tK=5508003,rK=5508004,nK=5508005,iK=5508006,sK=5508007,oK=5508008,aK=5508009,cK=5508010,uK=5508011,lK=5663e3,dK=5663001,fK=5663002,hK=5663003,pK=5663004,gK=5663005,yK=5663006,mK=5663007,bK=5663008,_K=5663009,AK=5663010,SK=5663011,vK=5663012,EK=5663013,wK=5663014,xK=5663015,IK=5663016,PK=5663017,RK=5663018,OK=5663019,BK=5663020,TK=705e4,zK=7050001,kK=7050002,CK=7050003,NK=7050004,MK=7050005,LK=7050006,DK=7050007,qK=7050008,UK=7050009,VK=7050010,FK=7050011,KK=7050012,WK=7050013,jK=7050014,HK=7050015,GK=7050016,$K=7050017,ZK=7050018,YK=7050019,XK=7050020,JK=7050021,QK=7050022,e5=7050023,t5=7050024,r5=7050025,n5=7050026,i5=7050027,s5=7050028,o5=7050029,a5=7050030,c5=7050031,u5=7050032,l5=7050033,d5=7050034,f5=7050035,h5=7050036,OA=8078e3,BA=8078001,_O=8078002,AO=8078003,TA=8078004,zA=8078005,kA=8078006,p5=8078007,g5=8078008,y5=8078009,m5=8078010,CA=8078011,b5=8078012,SO=8078013,vO=8078014,_5=8078015,A5=8078016,S5=8078017,v5=8078018,E5=8078019,EO=8078020,wO=8078021,w5=8078022,x5=81e5,I5=8100001,P5=8100002,R5=8100003,O5=819e4,B5=8190001,T5=8190002,z5=8190003,k5=8190004,C5=99e5,N5=9900001,M5=9900002,L5=9900003,D5=9900004;function xO(t){return Array.isArray(t)?"%5B"+t.map(xO).join("%2C%20")+"%5D":typeof t=="bigint"?`${t}n`:encodeURIComponent(String(t!=null&&Object.getPrototypeOf(t)===null?{...t}:t))}function q5([t,e]){return`${t}=${xO(e)}`}function U5(t){let e=Object.entries(t).map(q5).join("&");return btoa(e)}var e_e={[OV]:"Account not found at address: $address",[kV]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[zV]:"Expected decoded account at address: $address",[TV]:"Failed to decode account data at address: $address",[BV]:"Accounts not found at addresses: $addresses",[IV]:"Unable to find a viable program address bump seed.",[_V]:"$putativeAddress is not a base58-encoded address.",[mV]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[AV]:"The `CryptoKey` must be an `Ed25519` public key.",[RV]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[xV]:"Invalid seeds; point must fall off the Ed25519 curve.",[SV]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[EV]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[wV]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[vV]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[PV]:"Program address cannot end with PDA marker.",[bV]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[KU]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[UU]:"The network has progressed past the last block for which this transaction could have been committed.",[OA]:"Codec [$codecDescription] cannot decode empty byte arrays.",[w5]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[EO]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[zA]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[kA]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[TA]:"Encoder and decoder must either both be fixed-size or variable-size.",[g5]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[_O]:"Expected a fixed-size codec, got a variable-size one.",[SO]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[AO]:"Expected a variable-size codec, got a fixed-size one.",[E5]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[BA]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[v5]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[y5]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[m5]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[_5]:"Invalid literal union variant. Expected one of [$variants], got $value.",[p5]:"Expected [$codecDescription] to have $expected items, got $actual.",[b5]:"Invalid value $value for base $base with alphabet $alphabet.",[A5]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[CA]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[vO]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[wO]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[S5]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[FV]:"No random values implementation could be found.",[oF]:"instruction requires an uninitialized account",[AF]:"instruction tries to borrow reference for an account which is already borrowed",[SF]:"instruction left account with an outstanding borrowed reference",[bF]:"program other than the account's owner changed the size of the account data",[rF]:"account data too small for instruction",[_F]:"instruction expected an executable account",[KF]:"An account does not have enough lamports to be rent-exempt",[jF]:"Program arithmetic overflowed",[FF]:"Failed to serialize or deserialize account data: $encodedData",[XF]:"Builtin programs must consume compute units",[OF]:"Cross-program invocation call depth too deep",[NF]:"Computational budget exceeded",[EF]:"custom program error: #$code",[pF]:"instruction contains duplicate accounts",[vF]:"instruction modifications of multiply-passed account differ",[PF]:"executable accounts must be rent exempt",[xF]:"instruction changed executable accounts data",[IF]:"instruction changed the balance of an executable account",[gF]:"instruction changed executable bit of an account",[dF]:"instruction modified data of an account it does not own",[lF]:"instruction spent from the balance of an account it does not own",[JV]:"generic instruction error",[GF]:"Provided owner is not allowed",[UF]:"Account is immutable",[VF]:"Incorrect authority provided",[iF]:"incorrect program id for instruction",[nF]:"insufficient funds for instruction",[tF]:"invalid account data for instruction",[WF]:"Invalid account owner",[QV]:"invalid program argument",[wF]:"program returned invalid error code",[eF]:"invalid instruction data",[CF]:"Failed to reallocate account data",[kF]:"Provided seeds do not result in a valid address",[$F]:"Accounts data allocations exceeded the maximum allowed per transaction",[ZF]:"Max accounts exceeded",[YF]:"Max instruction trace length exceeded",[zF]:"Length of the seed is too long for address generation",[BF]:"An account required by the instruction is missing",[sF]:"missing required signature for instruction",[uF]:"instruction illegally modified the program id of an account",[mF]:"insufficient account keys for instruction",[MF]:"Cross-program invocation with unauthorized signer or writable account",[LF]:"Failed to create program execution environment",[qF]:"Program failed to compile",[DF]:"Program failed to complete",[hF]:"instruction modified data of a read-only account",[fF]:"instruction changed the balance of a read-only account",[TF]:"Cross-program invocation reentrancy not allowed for this instruction",[yF]:"instruction modified rent epoch of an account",[cF]:"sum of account balances before and after instruction do not match",[aF]:"instruction requires an initialized account",[XV]:"",[RF]:"Unsupported program id",[HF]:"Unsupported sysvar",[$V]:"The instruction does not have any accounts.",[ZV]:"The instruction does not have any data.",[YV]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[WU]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[VU]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[M5]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[D5]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[N5]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[C5]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[L5]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[XU]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[JU]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[eV]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[QU]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[YU]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[sV]:"$__serverMessage",[yV]:"$__serverMessage",[hV]:"$__serverMessage",[nV]:"$__serverMessage",[aV]:"$__serverMessage",[cV]:"$__serverMessage",[tV]:"Minimum context slot has not been reached",[fV]:"Node is unhealthy; behind by $numSlotsBehind slots",[uV]:"No snapshot",[gV]:"Transaction simulation failed",[lV]:"$__serverMessage",[oV]:"Transaction history is not available from this node",[dV]:"$__serverMessage",[iV]:"Transaction signature length mismatch",[pV]:"Transaction signature verification failure",[rV]:"$__serverMessage",[KV]:"Key pair bytes must be of length 64, got $byteLength.",[WV]:"Expected private key bytes with length 32. Actual length: $actualLength.",[jV]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[GV]:"The provided private key does not match the provided public key.",[HV]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[jU]:"Lamports value must be in the range [0, 2e64-1]",[HU]:"`$value` cannot be parsed as a `BigInt`",[ZU]:"$message",[GU]:"`$value` cannot be parsed as a `Number`",[FU]:"No nonce account could be found at address `$nonceAccountAddress`",[O5]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[T5]:"WebSocket was closed before payload could be added to the send buffer",[z5]:"WebSocket connection closed",[k5]:"WebSocket failed to connect",[B5]:"Failed to obtain a subscription id from the server",[R5]:"Could not find an API plan for RPC method: `$method`",[x5]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[P5]:"HTTP error ($statusCode): $message",[I5]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[JF]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[QF]:"The provided value does not implement the `KeyPairSigner` interface",[tK]:"The provided value does not implement the `MessageModifyingSigner` interface",[rK]:"The provided value does not implement the `MessagePartialSigner` interface",[eK]:"The provided value does not implement any of the `MessageSigner` interfaces",[iK]:"The provided value does not implement the `TransactionModifyingSigner` interface",[sK]:"The provided value does not implement the `TransactionPartialSigner` interface",[oK]:"The provided value does not implement the `TransactionSendingSigner` interface",[nK]:"The provided value does not implement any of the `TransactionSigner` interfaces",[aK]:"More than one `TransactionSendingSigner` was identified.",[cK]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[uK]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[VV]:"Cannot export a non-extractable key.",[NV]:"No digest implementation could be found.",[CV]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[MV]:`This runtime does not support the generation of Ed25519 key pairs.
+`)}};a();a();a();function yz(t){let e=async(i,s={})=>{let o=await t.http.send(Uy().get(i).withAbortSignal(s.signal));return mE(o.body,i)};return{download:async(i,s={})=>Promise.all(i.map(o=>e(o,s))),downloadJson:async(i,s={})=>(await t.http.send(Uy().get(i).withAbortSignal(s.signal))).data}}a();var AE=()=>({install(t){t.downloader=yz(t)}});a();a();a();a();a();a();var Ee=xr(Ic());a();a();a();a();a();var Tc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function yn(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Hi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function At(t,...e){if(!yn(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Fy(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Hi(t.outputLen),Hi(t.blockLen)}function Js(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Wy(t,e){At(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Az(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ci(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function jy(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Gi(t,e){return t<<32-e|t>>>e}var zj=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function kj(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Cj(t){for(let e=0;e<t.length;e++)t[e]=kj(t[e]);return t}var _E=zj?t=>t:Cj,_z=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mj=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Sr(t){if(At(t),_z)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=Mj[t[r]];return e}var Ys={_0:48,_9:57,A:65,F:70,a:97,f:102};function bz(t){if(t>=Ys._0&&t<=Ys._9)return t-Ys._0;if(t>=Ys.A&&t<=Ys.F)return t-(Ys.A-10);if(t>=Ys.a&&t<=Ys.f)return t-(Ys.a-10)}function $i(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(_z)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let o=bz(t.charCodeAt(s)),c=bz(t.charCodeAt(s+1));if(o===void 0||c===void 0){let u=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}function Jp(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Bc(t){return typeof t=="string"&&(t=Jp(t)),At(t),t}function Tt(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];At(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}var Do=class{};function Qp(t){let e=n=>t().update(Bc(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Qs(t=32){if(Tc&&typeof Tc.getRandomValues=="function")return Tc.getRandomValues(new Uint8Array(t));if(Tc&&typeof Tc.randomBytes=="function")return Uint8Array.from(Tc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function Nj(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),c=Number(r&s),u=n?4:0,d=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+d,c,n)}function Sz(t,e,r){return t&e^~t&r}function vz(t,e,r){return t&e^t&r^e&r}var eh=class extends Do{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=jy(this.buffer)}update(e){Js(this),e=Bc(e),At(e);let{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let u=jy(e);for(;i<=s-o;o+=i)this.process(u,o);continue}n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Js(this),Wy(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;r[o++]=128,ci(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let m=o;m<i;m++)r[m]=0;Nj(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=jy(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,f=this.get();if(d>f.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<d;m++)c.setUint32(4*m,f[m],s)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=c,i%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},eo=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var jr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);a();var Hy=BigInt(4294967295),Ez=BigInt(32);function Lj(t,e=!1){return e?{h:Number(t&Hy),l:Number(t>>Ez&Hy)}:{h:Number(t>>Ez&Hy)|0,l:Number(t&Hy)|0}}function Gy(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:o,l:c}=Lj(t[s],e);[n[s],i[s]]=[o,c]}return[n,i]}var SE=(t,e,r)=>t>>>r,vE=(t,e,r)=>t<<32-r|e>>>r,zc=(t,e,r)=>t>>>r|e<<32-r,kc=(t,e,r)=>t<<32-r|e>>>r,th=(t,e,r)=>t<<64-r|e>>>r-32,rh=(t,e,r)=>t>>>r-32|e<<64-r;var wz=(t,e,r)=>t<<r|e>>>32-r,xz=(t,e,r)=>e<<r|t>>>32-r,Iz=(t,e,r)=>e<<r-32|t>>>64-r,Pz=(t,e,r)=>t<<r-32|e>>>64-r;function ps(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Rz=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Oz=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Tz=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Bz=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,zz=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),kz=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0;var qj=Uint32Array.from([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]),qo=new Uint32Array(64),$y=class extends eh{constructor(e=32){super(64,e,8,!1),this.A=eo[0]|0,this.B=eo[1]|0,this.C=eo[2]|0,this.D=eo[3]|0,this.E=eo[4]|0,this.F=eo[5]|0,this.G=eo[6]|0,this.H=eo[7]|0}get(){let{A:e,B:r,C:n,D:i,E:s,F:o,G:c,H:u}=this;return[e,r,n,i,s,o,c,u]}set(e,r,n,i,s,o,c,u){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=u|0}process(e,r){for(let m=0;m<16;m++,r+=4)qo[m]=e.getUint32(r,!1);for(let m=16;m<64;m++){let A=qo[m-15],v=qo[m-2],P=Gi(A,7)^Gi(A,18)^A>>>3,T=Gi(v,17)^Gi(v,19)^v>>>10;qo[m]=T+qo[m-7]+P+qo[m-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:u,G:d,H:f}=this;for(let m=0;m<64;m++){let A=Gi(c,6)^Gi(c,11)^Gi(c,25),v=f+A+Sz(c,u,d)+qj[m]+qo[m]|0,T=(Gi(n,2)^Gi(n,13)^Gi(n,22))+vz(n,i,s)|0;f=d,d=u,u=c,c=o+v|0,o=s,s=i,i=n,n=v+T|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(n,i,s,o,c,u,d,f)}roundClean(){ci(qo)}destroy(){this.set(0,0,0,0,0,0,0,0),ci(this.buffer)}};var Cz=Gy(["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","0xf40e35855771202a","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(t=>BigInt(t))),Uj=Cz[0],Vj=Cz[1],Uo=new Uint32Array(80),Vo=new Uint32Array(80),EE=class extends eh{constructor(e=64){super(128,e,16,!1),this.Ah=jr[0]|0,this.Al=jr[1]|0,this.Bh=jr[2]|0,this.Bl=jr[3]|0,this.Ch=jr[4]|0,this.Cl=jr[5]|0,this.Dh=jr[6]|0,this.Dl=jr[7]|0,this.Eh=jr[8]|0,this.El=jr[9]|0,this.Fh=jr[10]|0,this.Fl=jr[11]|0,this.Gh=jr[12]|0,this.Gl=jr[13]|0,this.Hh=jr[14]|0,this.Hl=jr[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:u,Eh:d,El:f,Fh:m,Fl:A,Gh:v,Gl:P,Hh:T,Hl:k}=this;return[e,r,n,i,s,o,c,u,d,f,m,A,v,P,T,k]}set(e,r,n,i,s,o,c,u,d,f,m,A,v,P,T,k){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=u|0,this.Eh=d|0,this.El=f|0,this.Fh=m|0,this.Fl=A|0,this.Gh=v|0,this.Gl=P|0,this.Hh=T|0,this.Hl=k|0}process(e,r){for(let L=0;L<16;L++,r+=4)Uo[L]=e.getUint32(r),Vo[L]=e.getUint32(r+=4);for(let L=16;L<80;L++){let F=Uo[L-15]|0,ee=Vo[L-15]|0,j=zc(F,ee,1)^zc(F,ee,8)^SE(F,ee,7),X=kc(F,ee,1)^kc(F,ee,8)^vE(F,ee,7),G=Uo[L-2]|0,M=Vo[L-2]|0,W=zc(G,M,19)^th(G,M,61)^SE(G,M,6),Y=kc(G,M,19)^rh(G,M,61)^vE(G,M,6),Q=Tz(X,Y,Vo[L-7],Vo[L-16]),w=Bz(Q,j,W,Uo[L-7],Uo[L-16]);Uo[L]=w|0,Vo[L]=Q|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:u,Dh:d,Dl:f,Eh:m,El:A,Fh:v,Fl:P,Gh:T,Gl:k,Hh:B,Hl:D}=this;for(let L=0;L<80;L++){let F=zc(m,A,14)^zc(m,A,18)^th(m,A,41),ee=kc(m,A,14)^kc(m,A,18)^rh(m,A,41),j=m&v^~m&T,X=A&P^~A&k,G=zz(D,ee,X,Vj[L],Vo[L]),M=kz(G,B,F,j,Uj[L],Uo[L]),W=G|0,Y=zc(n,i,28)^th(n,i,34)^th(n,i,39),Q=kc(n,i,28)^rh(n,i,34)^rh(n,i,39),w=n&s^n&c^s&c,l=i&o^i&u^o&u;B=T|0,D=k|0,T=v|0,k=P|0,v=m|0,P=A|0,{h:m,l:A}=ps(d|0,f|0,M|0,W|0),d=c|0,f=u|0,c=s|0,u=o|0,s=n|0,o=i|0;let y=Rz(W,Q,l);n=Oz(y,M,Y,w),i=y|0}({h:n,l:i}=ps(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=ps(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:u}=ps(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:f}=ps(this.Dh|0,this.Dl|0,d|0,f|0),{h:m,l:A}=ps(this.Eh|0,this.El|0,m|0,A|0),{h:v,l:P}=ps(this.Fh|0,this.Fl|0,v|0,P|0),{h:T,l:k}=ps(this.Gh|0,this.Gl|0,T|0,k|0),{h:B,l:D}=ps(this.Hh|0,this.Hl|0,B|0,D|0),this.set(n,i,s,o,c,u,d,f,m,A,v,P,T,k,B,D)}roundClean(){ci(Uo,Vo)}destroy(){ci(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Zy=Qp(()=>new $y);var Xy=Qp(()=>new EE);a();a();var IE=BigInt(0),xE=BigInt(1);function to(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function jn(t,e,r=""){let n=yn(t),i=t?.length,s=e!==void 0;if(!n||s&&i!==e){let o=r&&`"${r}" `,c=s?` of length ${e}`:"",u=n?`length=${i}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+c+", got "+u)}return t}function nh(t){let e=t.toString(16);return e.length&1?"0"+e:e}function Mz(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?IE:BigInt("0x"+t)}function Sl(t){return Mz(Sr(t))}function ro(t){return At(t),Mz(Sr(Uint8Array.from(t).reverse()))}function Yy(t,e){return $i(t.toString(16).padStart(e*2,"0"))}function PE(t,e){return Yy(t,e).reverse()}function Xe(t,e,r){let n;if(typeof e=="string")try{n=$i(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(yn(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function Nz(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function RE(t){return Uint8Array.from(t)}var wE=t=>typeof t=="bigint"&&IE<=t;function Lz(t,e,r){return wE(t)&&wE(e)&&wE(r)&&e<=t&&t<r}function ih(t,e,r,n){if(!Lz(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Jy(t){let e;for(e=0;t>IE;t>>=xE,e+=1);return e}var Ko=t=>(xE<<BigInt(t))-xE;function Dz(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=v=>new Uint8Array(v),i=v=>Uint8Array.of(v),s=n(t),o=n(t),c=0,u=()=>{s.fill(1),o.fill(0),c=0},d=(...v)=>r(o,s,...v),f=(v=n(0))=>{o=d(i(0),v),s=d(),v.length!==0&&(o=d(i(1),v),s=d())},m=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let v=0,P=[];for(;v<e;){s=d();let T=s.slice();P.push(T),v+=s.length}return Tt(...P)};return(v,P)=>{u(),f(v);let T;for(;!(T=P(m()));)f();return u(),T}}function Fo(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){let c=t[i];if(o&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}var OE=()=>{throw new Error("not implemented")};function vl(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let s=t(r,...n);return e.set(r,s),s}}a();var bn=BigInt(0),Rr=BigInt(1),Cc=BigInt(2),Vz=BigInt(3),Kz=BigInt(4),Fz=BigInt(5),Fj=BigInt(7),Wz=BigInt(8),Wj=BigInt(9),jz=BigInt(16);function vt(t,e){let r=t%e;return r>=bn?r:e+r}function ct(t,e,r){let n=t;for(;e-- >bn;)n*=n,n%=r;return n}function qz(t,e){if(t===bn)throw new Error("invert: expected non-zero number");if(e<=bn)throw new Error("invert: expected positive modulus, got "+e);let r=vt(t,e),n=e,i=bn,s=Rr,o=Rr,c=bn;for(;r!==bn;){let d=n/r,f=n%r,m=i-o*d,A=s-c*d;n=r,r=f,i=o,s=c,o=m,c=A}if(n!==Rr)throw new Error("invert: does not exist");return vt(i,e)}function TE(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function Hz(t,e){let r=(t.ORDER+Rr)/Kz,n=t.pow(e,r);return TE(t,n,e),n}function jj(t,e){let r=(t.ORDER-Fz)/Wz,n=t.mul(e,Cc),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Cc),i),c=t.mul(s,t.sub(o,t.ONE));return TE(t,c,e),c}function Hj(t){let e=Hn(t),r=Gz(t),n=r(e,e.neg(e.ONE)),i=r(e,n),s=r(e,e.neg(n)),o=(t+Fj)/jz;return(c,u)=>{let d=c.pow(u,o),f=c.mul(d,n),m=c.mul(d,i),A=c.mul(d,s),v=c.eql(c.sqr(f),u),P=c.eql(c.sqr(m),u);d=c.cmov(d,f,v),f=c.cmov(A,m,P);let T=c.eql(c.sqr(f),u),k=c.cmov(d,f,T);return TE(c,k,u),k}}function Gz(t){if(t<Vz)throw new Error("sqrt is not defined for small field");let e=t-Rr,r=0;for(;e%Cc===bn;)e/=Cc,r++;let n=Cc,i=Hn(t);for(;Uz(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Hz;let s=i.pow(n,e),o=(e+Rr)/Cc;return function(u,d){if(u.is0(d))return d;if(Uz(u,d)!==1)throw new Error("Cannot find square root");let f=r,m=u.mul(u.ONE,s),A=u.pow(d,e),v=u.pow(d,o);for(;!u.eql(A,u.ONE);){if(u.is0(A))return u.ZERO;let P=1,T=u.sqr(A);for(;!u.eql(T,u.ONE);)if(P++,T=u.sqr(T),P===f)throw new Error("Cannot find square root");let k=Rr<<BigInt(f-P-1),B=u.pow(m,k);f=P,m=u.sqr(B),A=u.mul(A,m),v=u.mul(v,B)}return v}}function Gj(t){return t%Kz===Vz?Hz:t%Wz===Fz?jj:t%jz===Wj?Hj(t):Gz(t)}var no=(t,e)=>(vt(t,e)&Rr)===Rr,$j=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function BE(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=$j.reduce((n,i)=>(n[i]="function",n),e);return Fo(t,r),t}function Zj(t,e,r){if(r<bn)throw new Error("invalid exponent, negatives unsupported");if(r===bn)return t.ONE;if(r===Rr)return e;let n=t.ONE,i=e;for(;r>bn;)r&Rr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Rr;return n}function sh(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,c,u)=>t.is0(c)?o:(n[u]=o,t.mul(o,c)),t.ONE),s=t.inv(i);return e.reduceRight((o,c,u)=>t.is0(c)?o:(n[u]=t.mul(o,n[u]),t.mul(o,c)),s),n}function Uz(t,e){let r=(t.ORDER-Rr)/Cc,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function Qy(t,e){e!==void 0&&Hi(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Hn(t,e,r=!1,n={}){if(t<=bn)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s,o=!1,c;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let A=e;A.BITS&&(i=A.BITS),A.sqrt&&(s=A.sqrt),typeof A.isLE=="boolean"&&(r=A.isLE),typeof A.modFromBytes=="boolean"&&(o=A.modFromBytes),c=A.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);let{nBitLength:u,nByteLength:d}=Qy(t,i);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,m=Object.freeze({ORDER:t,isLE:r,BITS:u,BYTES:d,MASK:Ko(u),ZERO:bn,ONE:Rr,allowedLengths:c,create:A=>vt(A,t),isValid:A=>{if(typeof A!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof A);return bn<=A&&A<t},is0:A=>A===bn,isValidNot0:A=>!m.is0(A)&&m.isValid(A),isOdd:A=>(A&Rr)===Rr,neg:A=>vt(-A,t),eql:(A,v)=>A===v,sqr:A=>vt(A*A,t),add:(A,v)=>vt(A+v,t),sub:(A,v)=>vt(A-v,t),mul:(A,v)=>vt(A*v,t),pow:(A,v)=>Zj(m,A,v),div:(A,v)=>vt(A*qz(v,t),t),sqrN:A=>A*A,addN:(A,v)=>A+v,subN:(A,v)=>A-v,mulN:(A,v)=>A*v,inv:A=>qz(A,t),sqrt:s||(A=>(f||(f=Gj(t)),f(m,A))),toBytes:A=>r?PE(A,d):Yy(A,d),fromBytes:(A,v=!0)=>{if(c){if(!c.includes(A.length)||A.length>d)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+A.length);let T=new Uint8Array(d);T.set(A,r?0:T.length-A.length),A=T}if(A.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+A.length);let P=r?ro(A):Sl(A);if(o&&(P=vt(P,t)),!v&&!m.isValid(P))throw new Error("invalid field element: outside of range 0..ORDER");return P},invertBatch:A=>sh(m,A),cmov:(A,v,P)=>P?v:A});return Object.freeze(m)}function $z(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function zE(t){let e=$z(t);return e+Math.ceil(e/2)}function kE(t,e,r=!1){let n=t.length,i=$z(e),s=zE(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let o=r?ro(t):Sl(t),c=vt(o,e-Rr)+Rr;return r?PE(c,i):Yy(c,i)}var El=BigInt(0),Mc=BigInt(1);function oh(t,e){let r=e.negate();return t?r:e}function io(t,e){let r=sh(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function Jz(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function CE(t,e){Jz(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Ko(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function Zz(t,e,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,c=Number(t&i),u=t>>o;c>n&&(c-=s,u+=Mc);let d=e*n,f=d+Math.abs(c)-1,m=c===0,A=c<0,v=e%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:A,isNegF:v,offsetF:d}}function Xj(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Yj(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var ME=new WeakMap,Qz=new WeakMap;function NE(t){return Qz.get(t)||1}function Xz(t){if(t!==El)throw new Error("invalid wNAF")}var wl=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>El;)r&Mc&&(n=n.add(i)),i=i.double(),r>>=Mc;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=CE(r,this.bits),s=[],o=e,c=o;for(let u=0;u<n;u++){c=o,s.push(c);for(let d=1;d<i;d++)c=c.add(o),s.push(c);o=c.double()}return s}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE,o=CE(e,this.bits);for(let c=0;c<o.windows;c++){let{nextN:u,offset:d,isZero:f,isNeg:m,isNegF:A,offsetF:v}=Zz(n,c,o);n=u,f?s=s.add(oh(A,r[v])):i=i.add(oh(m,r[d]))}return Xz(n),{p:i,f:s}}wNAFUnsafe(e,r,n,i=this.ZERO){let s=CE(e,this.bits);for(let o=0;o<s.windows&&n!==El;o++){let{nextN:c,offset:u,isZero:d,isNeg:f}=Zz(n,o,s);if(n=c,!d){let m=r[u];i=i.add(f?m.negate():m)}}return Xz(n),i}getPrecomputes(e,r,n){let i=ME.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),ME.set(r,i))),i}cached(e,r,n){let i=NE(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let s=NE(e);return s===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),r,i)}createCache(e,r){Jz(r,this.bits),Qz.set(e,r),ME.delete(e)}hasCache(e){return NE(e)!==1}};function ek(t,e,r,n){let i=e,s=t.ZERO,o=t.ZERO;for(;r>El||n>El;)r&Mc&&(s=s.add(i)),n&Mc&&(o=o.add(i)),i=i.double(),r>>=Mc,n>>=Mc;return{p1:s,p2:o}}function xl(t,e,r,n){Xj(r,t),Yj(n,e);let i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");let o=t.ZERO,c=Jy(BigInt(i)),u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);let d=Ko(u),f=new Array(Number(d)+1).fill(o),m=Math.floor((e.BITS-1)/u)*u,A=o;for(let v=m;v>=0;v-=u){f.fill(o);for(let T=0;T<s;T++){let k=n[T],B=Number(k>>BigInt(v)&d);f[B]=f[B].add(r[T])}let P=o;for(let T=f.length-1,k=o;T>0;T--)k=k.add(f[T]),P=P.add(k);if(A=A.add(P),v!==0)for(let T=0;T<u;T++)A=A.double()}return A}function Yz(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return BE(e),e}else return Hn(t,{isLE:r})}function e1(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let u of["p","n","h"]){let d=e[u];if(!(typeof d=="bigint"&&d>El))throw new Error(`CURVE.${u} must be positive bigint`)}let i=Yz(e.p,r.Fp,n),s=Yz(e.n,r.Fn,n),c=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let u of c)if(!i.isValid(e[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:s}}a();var Wo=BigInt(0),Or=BigInt(1),LE=BigInt(2),Jj=BigInt(8);function Qj(t,e,r,n){let i=t.sqr(r),s=t.sqr(n),o=t.add(t.mul(e.a,i),s),c=t.add(t.ONE,t.mul(e.d,t.mul(i,s)));return t.eql(o,c)}function eH(t,e={}){let r=e1("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o}=s;Fo(e,{},{uvRatio:"function"});let c=LE<<BigInt(i.BYTES*8)-Or,u=k=>n.create(k),d=e.uvRatio||((k,B)=>{try{return{isValid:!0,value:n.sqrt(n.div(k,B))}}catch{return{isValid:!1,value:Wo}}});if(!Qj(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(k,B,D=!1){let L=D?Or:Wo;return ih("coordinate "+k,B,L,c),B}function m(k){if(!(k instanceof P))throw new Error("ExtendedPoint expected")}let A=vl((k,B)=>{let{X:D,Y:L,Z:F}=k,ee=k.is0();B==null&&(B=ee?Jj:n.inv(F));let j=u(D*B),X=u(L*B),G=n.mul(F,B);if(ee)return{x:Wo,y:Or};if(G!==Or)throw new Error("invZ was invalid");return{x:j,y:X}}),v=vl(k=>{let{a:B,d:D}=s;if(k.is0())throw new Error("bad point: ZERO");let{X:L,Y:F,Z:ee,T:j}=k,X=u(L*L),G=u(F*F),M=u(ee*ee),W=u(M*M),Y=u(X*B),Q=u(M*u(Y+G)),w=u(W+u(D*u(X*G)));if(Q!==w)throw new Error("bad point: equation left != right (1)");let l=u(L*F),y=u(ee*j);if(l!==y)throw new Error("bad point: equation left != right (2)");return!0});class P{constructor(B,D,L,F){this.X=f("x",B),this.Y=f("y",D),this.Z=f("z",L,!0),this.T=f("t",F),Object.freeze(this)}static CURVE(){return s}static fromAffine(B){if(B instanceof P)throw new Error("extended point not allowed");let{x:D,y:L}=B||{};return f("x",D),f("y",L),new P(D,L,Or,u(D*L))}static fromBytes(B,D=!1){let L=n.BYTES,{a:F,d:ee}=s;B=RE(jn(B,L,"point")),to(D,"zip215");let j=RE(B),X=B[L-1];j[L-1]=X&-129;let G=ro(j),M=D?c:n.ORDER;ih("point.y",G,Wo,M);let W=u(G*G),Y=u(W-Or),Q=u(ee*W-F),{isValid:w,value:l}=d(Y,Q);if(!w)throw new Error("bad point: invalid y coordinate");let y=(l&Or)===Or,S=(X&128)!==0;if(!D&&l===Wo&&S)throw new Error("bad point: x=0 and x_0=1");return S!==y&&(l=u(-l)),P.fromAffine({x:l,y:G})}static fromHex(B,D=!1){return P.fromBytes(Xe("point",B),D)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(B=8,D=!0){return T.createCache(this,B),D||this.multiply(LE),this}assertValidity(){v(this)}equals(B){m(B);let{X:D,Y:L,Z:F}=this,{X:ee,Y:j,Z:X}=B,G=u(D*X),M=u(ee*F),W=u(L*X),Y=u(j*F);return G===M&&W===Y}is0(){return this.equals(P.ZERO)}negate(){return new P(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:B}=s,{X:D,Y:L,Z:F}=this,ee=u(D*D),j=u(L*L),X=u(LE*u(F*F)),G=u(B*ee),M=D+L,W=u(u(M*M)-ee-j),Y=G+j,Q=Y-X,w=G-j,l=u(W*Q),y=u(Y*w),S=u(W*w),E=u(Q*Y);return new P(l,y,E,S)}add(B){m(B);let{a:D,d:L}=s,{X:F,Y:ee,Z:j,T:X}=this,{X:G,Y:M,Z:W,T:Y}=B,Q=u(F*G),w=u(ee*M),l=u(X*L*Y),y=u(j*W),S=u((F+ee)*(G+M)-Q-w),E=y-l,x=y+l,O=u(w-D*Q),C=u(S*E),I=u(x*O),b=u(S*O),R=u(E*x);return new P(C,I,R,b)}subtract(B){return this.add(B.negate())}multiply(B){if(!i.isValidNot0(B))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:D,f:L}=T.cached(this,B,F=>io(P,F));return io(P,[D,L])[0]}multiplyUnsafe(B,D=P.ZERO){if(!i.isValid(B))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return B===Wo?P.ZERO:this.is0()||B===Or?this:T.unsafe(this,B,L=>io(P,L),D)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return T.unsafe(this,s.n).is0()}toAffine(B){return A(this,B)}clearCofactor(){return o===Or?this:this.multiplyUnsafe(o)}toBytes(){let{x:B,y:D}=this.toAffine(),L=n.toBytes(D);return L[L.length-1]|=B&Or?128:0,L}toHex(){return Sr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(B){return io(P,B)}static msm(B,D){return xl(P,i,B,D)}_setWindowSize(B){this.precompute(B)}toRawBytes(){return this.toBytes()}}P.BASE=new P(s.Gx,s.Gy,Or,u(s.Gx*s.Gy)),P.ZERO=new P(Wo,Or,Or,Wo),P.Fp=n,P.Fn=i;let T=new wl(P,i.BITS);return P.BASE.precompute(8),P}var t1=class{constructor(e){this.ep=e}static fromBytes(e){OE()}static fromHex(e){OE()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return Sr(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};function tH(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');Fo(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:s,Fn:o}=t,c=r.randomBytes||Qs,u=r.adjustScalarBytes||(M=>M),d=r.domain||((M,W,Y)=>{if(to(Y,"phflag"),W.length||Y)throw new Error("Contexts/pre-hash are not supported");return M});function f(M){return o.create(ro(M))}function m(M){let W=L.secretKey;M=Xe("private key",M,W);let Y=Xe("hashed private key",e(M),2*W),Q=u(Y.slice(0,W)),w=Y.slice(W,2*W),l=f(Q);return{head:Q,prefix:w,scalar:l}}function A(M){let{head:W,prefix:Y,scalar:Q}=m(M),w=i.multiply(Q),l=w.toBytes();return{head:W,prefix:Y,scalar:Q,point:w,pointBytes:l}}function v(M){return A(M).pointBytes}function P(M=Uint8Array.of(),...W){let Y=Tt(...W);return f(e(d(Y,Xe("context",M),!!n)))}function T(M,W,Y={}){M=Xe("message",M),n&&(M=n(M));let{prefix:Q,scalar:w,pointBytes:l}=A(W),y=P(Y.context,Q,M),S=i.multiply(y).toBytes(),E=P(Y.context,S,l,M),x=o.create(y+E*w);if(!o.isValid(x))throw new Error("sign failed: invalid s");let O=Tt(S,o.toBytes(x));return jn(O,L.signature,"result")}let k={zip215:!0};function B(M,W,Y,Q=k){let{context:w,zip215:l}=Q,y=L.signature;M=Xe("signature",M,y),W=Xe("message",W),Y=Xe("publicKey",Y,L.publicKey),l!==void 0&&to(l,"zip215"),n&&(W=n(W));let S=y/2,E=M.subarray(0,S),x=ro(M.subarray(S,y)),O,C,I;try{O=t.fromBytes(Y,l),C=t.fromBytes(E,l),I=i.multiplyUnsafe(x)}catch{return!1}if(!l&&O.isSmallOrder())return!1;let b=P(w,C.toBytes(),O.toBytes(),W);return C.add(O.multiplyUnsafe(b)).subtract(I).clearCofactor().is0()}let D=s.BYTES,L={secretKey:D,publicKey:D,signature:2*D,seed:D};function F(M=c(L.seed)){return jn(M,L.seed,"seed")}function ee(M){let W=G.randomSecretKey(M);return{secretKey:W,publicKey:v(W)}}function j(M){return yn(M)&&M.length===o.BYTES}function X(M,W){try{return!!t.fromBytes(M,W)}catch{return!1}}let G={getExtendedPublicKey:A,randomSecretKey:F,isValidSecretKey:j,isValidPublicKey:X,toMontgomery(M){let{y:W}=t.fromBytes(M),Y=L.publicKey,Q=Y===32;if(!Q&&Y!==57)throw new Error("only defined for 25519 and 448");let w=Q?s.div(Or+W,Or-W):s.div(W-Or,W+Or);return s.toBytes(w)},toMontgomerySecret(M){let W=L.secretKey;jn(M,W);let Y=e(M.subarray(0,W));return u(Y).subarray(0,W)},randomPrivateKey:F,precompute(M=8,W=t.BASE){return W.precompute(M,!1)}};return Object.freeze({keygen:ee,getPublicKey:v,sign:T,verify:B,utils:G,Point:t,lengths:L})}function rH(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=Hn(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},s={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:s}}function nH(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function tk(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=rH(t),s=eH(e,r),o=tH(s,n,i);return nH(t,o)}var iH=BigInt(0),so=BigInt(1),rk=BigInt(2),HOe=BigInt(3),sH=BigInt(5),oH=BigInt(8),Il=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),ah={p:Il,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:oH,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function aH(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=Il,c=t*t%s*t%s,u=ct(c,rk,s)*c%s,d=ct(u,so,s)*t%s,f=ct(d,sH,s)*d%s,m=ct(f,e,s)*f%s,A=ct(m,r,s)*m%s,v=ct(A,n,s)*A%s,P=ct(v,i,s)*v%s,T=ct(P,i,s)*v%s,k=ct(T,e,s)*f%s;return{pow_p_5_8:ct(k,rk,s)*t%s,b2:c}}function cH(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var DE=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function VE(t,e){let r=Il,n=vt(e*e*e,r),i=vt(n*n*e,r),s=aH(t*i).pow_p_5_8,o=vt(t*n*s,r),c=vt(e*o*o,r),u=o,d=vt(o*DE,r),f=c===t,m=c===vt(-t,r),A=c===vt(-t*DE,r);return f&&(o=u),(m||A)&&(o=d),no(o,r)&&(o=vt(-o,r)),{isValid:f||m,value:o}}var jo=Hn(ah.p,{isLE:!0}),uH=Hn(ah.n,{isLE:!0}),lH={...ah,Fp:jo,hash:Xy,adjustScalarBytes:cH,uvRatio:VE},Bn=tk(lH);var qE=DE,dH=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),fH=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),pH=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),hH=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),nk=t=>VE(so,t),gH=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),UE=t=>Bn.Point.Fp.create(ro(t)&gH);function ik(t){let{d:e}=ah,r=Il,n=B=>jo.create(B),i=n(qE*t*t),s=n((i+so)*pH),o=BigInt(-1),c=n((o-e*i)*n(i+e)),{isValid:u,value:d}=VE(s,c),f=n(d*t);no(f,r)||(f=n(-f)),u||(d=f),u||(o=i);let m=n(o*(i-so)*hH-c),A=d*d,v=n((d+d)*c),P=n(m*dH),T=n(so-A),k=n(so+A);return new Bn.Point(n(v*k),n(T*P),n(P*k),n(v*T))}function mH(t){At(t,64);let e=UE(t.subarray(0,32)),r=ik(e),n=UE(t.subarray(32,64)),i=ik(n);return new oo(r.add(i))}var oo=class t extends t1{constructor(e){super(e)}static fromAffine(e){return new t(Bn.Point.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static hashToCurve(e){return mH(Xe("ristrettoHash",e,64))}static fromBytes(e){At(e,32);let{a:r,d:n}=ah,i=Il,s=F=>jo.create(F),o=UE(e);if(!Nz(jo.toBytes(o),e)||no(o,i))throw new Error("invalid ristretto255 encoding 1");let c=s(o*o),u=s(so+r*c),d=s(so-r*c),f=s(u*u),m=s(d*d),A=s(r*n*f-m),{isValid:v,value:P}=nk(s(A*m)),T=s(P*d),k=s(P*T*A),B=s((o+o)*T);no(B,i)&&(B=s(-B));let D=s(u*k),L=s(B*D);if(!v||no(L,i)||D===iH)throw new Error("invalid ristretto255 encoding 2");return new t(new Bn.Point(B,D,so,L))}static fromHex(e){return t.fromBytes(Xe("ristrettoHex",e,32))}static msm(e,r){return xl(t,Bn.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,s=Il,o=k=>jo.create(k),c=o(o(n+r)*o(n-r)),u=o(e*r),d=o(u*u),{value:f}=nk(o(c*d)),m=o(f*c),A=o(f*u),v=o(m*A*i),P;if(no(i*v,s)){let k=o(r*qE),B=o(e*qE);e=k,r=B,P=o(m*fH)}else P=A;no(e*v,s)&&(r=o(-r));let T=o((n-r)*P);return no(T,s)&&(T=o(-T)),jo.toBytes(T)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:s}=e.ep,o=d=>jo.create(d),c=o(r*s)===o(n*i),u=o(n*s)===o(r*i);return c||u}is0(){return this.equals(t.ZERO)}};oo.BASE=new oo(Bn.Point.BASE);oo.ZERO=new oo(Bn.Point.ZERO);oo.Fp=jo;oo.Fn=uH;var Dw=xr(FE()),Tr=xr(fk());a();var HE=Zy;var Ul=xr(vk()),z=xr(tw()),GC=xr(tw());a();a();var qH=1,UH=2,VH=3,KH=4,FH=5,WH=6,jH=7,HH=8,GH=9,$H=10,ZH=-32700,XH=-32603,YH=-32602,JH=-32601,QH=-32600,e7=-32016,t7=-32015,r7=-32014,n7=-32013,i7=-32012,s7=-32011,o7=-32010,a7=-32009,c7=-32008,u7=-32007,l7=-32006,d7=-32005,f7=-32004,p7=-32003,h7=-32002,g7=-32001,m7=28e5,y7=2800001,b7=2800002,A7=2800003,_7=2800004,S7=2800005,v7=2800006,E7=2800007,w7=2800008,x7=2800009,I7=2800010,P7=2800011,R7=323e4,O7=32300001,T7=3230002,B7=3230003,z7=3230004,k7=361e4,C7=3610001,M7=3610002,N7=3610003,L7=3610004,D7=3610005,q7=3610006,U7=3610007,V7=3611e3,K7=3704e3,F7=3704001,W7=3704002,j7=3704003,H7=3704004,G7=4128e3,$7=4128001,Z7=4128002,X7=4615e3,Y7=4615001,J7=4615002,Q7=4615003,eG=4615004,tG=4615005,rG=4615006,nG=4615007,iG=4615008,sG=4615009,oG=4615010,aG=4615011,cG=4615012,uG=4615013,lG=4615014,dG=4615015,fG=4615016,pG=4615017,hG=4615018,gG=4615019,mG=4615020,yG=4615021,bG=4615022,AG=4615023,_G=4615024,SG=4615025,vG=4615026,EG=4615027,wG=4615028,xG=4615029,IG=4615030,PG=4615031,RG=4615032,OG=4615033,TG=4615034,BG=4615035,zG=4615036,kG=4615037,CG=4615038,MG=4615039,NG=4615040,LG=4615041,DG=4615042,qG=4615043,UG=4615044,VG=4615045,KG=4615046,FG=4615047,WG=4615048,jG=4615049,HG=4615050,GG=4615051,$G=4615052,ZG=4615053,XG=4615054,YG=5508e3,JG=5508001,QG=5508002,e$=5508003,t$=5508004,r$=5508005,n$=5508006,i$=5508007,s$=5508008,o$=5508009,a$=5508010,c$=5508011,u$=5663e3,l$=5663001,d$=5663002,f$=5663003,p$=5663004,h$=5663005,g$=5663006,m$=5663007,y$=5663008,b$=5663009,A$=5663010,_$=5663011,S$=5663012,v$=5663013,E$=5663014,w$=5663015,x$=5663016,I$=5663017,P$=5663018,R$=5663019,O$=5663020,T$=705e4,B$=7050001,z$=7050002,k$=7050003,C$=7050004,M$=7050005,N$=7050006,L$=7050007,D$=7050008,q$=7050009,U$=7050010,V$=7050011,K$=7050012,F$=7050013,W$=7050014,j$=7050015,H$=7050016,G$=7050017,$$=7050018,Z$=7050019,X$=7050020,Y$=7050021,J$=7050022,Q$=7050023,e9=7050024,t9=7050025,r9=7050026,n9=7050027,i9=7050028,s9=7050029,o9=7050030,a9=7050031,c9=7050032,u9=7050033,l9=7050034,d9=7050035,f9=7050036,rw=8078e3,nw=8078001,Ek=8078002,wk=8078003,iw=8078004,sw=8078005,ow=8078006,p9=8078007,h9=8078008,g9=8078009,m9=8078010,aw=8078011,y9=8078012,xk=8078013,Ik=8078014,b9=8078015,A9=8078016,_9=8078017,S9=8078018,v9=8078019,Pk=8078020,Rk=8078021,E9=8078022,w9=81e5,x9=8100001,I9=8100002,P9=8100003,R9=819e4,O9=8190001,T9=8190002,B9=8190003,z9=8190004,k9=99e5,C9=9900001,M9=9900002,N9=9900003,L9=9900004;function Ok(t){return Array.isArray(t)?"%5B"+t.map(Ok).join("%2C%20")+"%5D":typeof t=="bigint"?`${t}n`:encodeURIComponent(String(t!=null&&Object.getPrototypeOf(t)===null?{...t}:t))}function D9([t,e]){return`${t}=${Ok(e)}`}function q9(t){let e=Object.entries(t).map(D9).join("&");return btoa(e)}var ATe={[R7]:"Account not found at address: $address",[z7]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[B7]:"Expected decoded account at address: $address",[T7]:"Failed to decode account data at address: $address",[O7]:"Accounts not found at addresses: $addresses",[x7]:"Unable to find a viable program address bump seed.",[b7]:"$putativeAddress is not a base58-encoded address.",[m7]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[A7]:"The `CryptoKey` must be an `Ed25519` public key.",[P7]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[w7]:"Invalid seeds; point must fall off the Ed25519 curve.",[_7]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[v7]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[E7]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[S7]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[I7]:"Program address cannot end with PDA marker.",[y7]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[KH]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[qH]:"The network has progressed past the last block for which this transaction could have been committed.",[rw]:"Codec [$codecDescription] cannot decode empty byte arrays.",[E9]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[Pk]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[sw]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[ow]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[iw]:"Encoder and decoder must either both be fixed-size or variable-size.",[h9]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[Ek]:"Expected a fixed-size codec, got a variable-size one.",[xk]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[wk]:"Expected a variable-size codec, got a fixed-size one.",[v9]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[nw]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[S9]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[g9]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[m9]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[b9]:"Invalid literal union variant. Expected one of [$variants], got $value.",[p9]:"Expected [$codecDescription] to have $expected items, got $actual.",[y9]:"Invalid value $value for base $base with alphabet $alphabet.",[A9]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[aw]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[Ik]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[Rk]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[_9]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[V7]:"No random values implementation could be found.",[sG]:"instruction requires an uninitialized account",[AG]:"instruction tries to borrow reference for an account which is already borrowed",[_G]:"instruction left account with an outstanding borrowed reference",[yG]:"program other than the account's owner changed the size of the account data",[tG]:"account data too small for instruction",[bG]:"instruction expected an executable account",[KG]:"An account does not have enough lamports to be rent-exempt",[WG]:"Program arithmetic overflowed",[VG]:"Failed to serialize or deserialize account data: $encodedData",[XG]:"Builtin programs must consume compute units",[RG]:"Cross-program invocation call depth too deep",[CG]:"Computational budget exceeded",[vG]:"custom program error: #$code",[pG]:"instruction contains duplicate accounts",[SG]:"instruction modifications of multiply-passed account differ",[IG]:"executable accounts must be rent exempt",[wG]:"instruction changed executable accounts data",[xG]:"instruction changed the balance of an executable account",[hG]:"instruction changed executable bit of an account",[lG]:"instruction modified data of an account it does not own",[uG]:"instruction spent from the balance of an account it does not own",[Y7]:"generic instruction error",[HG]:"Provided owner is not allowed",[qG]:"Account is immutable",[UG]:"Incorrect authority provided",[nG]:"incorrect program id for instruction",[rG]:"insufficient funds for instruction",[eG]:"invalid account data for instruction",[FG]:"Invalid account owner",[J7]:"invalid program argument",[EG]:"program returned invalid error code",[Q7]:"invalid instruction data",[kG]:"Failed to reallocate account data",[zG]:"Provided seeds do not result in a valid address",[GG]:"Accounts data allocations exceeded the maximum allowed per transaction",[$G]:"Max accounts exceeded",[ZG]:"Max instruction trace length exceeded",[BG]:"Length of the seed is too long for address generation",[OG]:"An account required by the instruction is missing",[iG]:"missing required signature for instruction",[cG]:"instruction illegally modified the program id of an account",[mG]:"insufficient account keys for instruction",[MG]:"Cross-program invocation with unauthorized signer or writable account",[NG]:"Failed to create program execution environment",[DG]:"Program failed to compile",[LG]:"Program failed to complete",[fG]:"instruction modified data of a read-only account",[dG]:"instruction changed the balance of a read-only account",[TG]:"Cross-program invocation reentrancy not allowed for this instruction",[gG]:"instruction modified rent epoch of an account",[aG]:"sum of account balances before and after instruction do not match",[oG]:"instruction requires an initialized account",[X7]:"",[PG]:"Unsupported program id",[jG]:"Unsupported sysvar",[G7]:"The instruction does not have any accounts.",[$7]:"The instruction does not have any data.",[Z7]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[FH]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[UH]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[M9]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[L9]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[C9]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[k9]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[N9]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[XH]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[YH]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[QH]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[JH]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[ZH]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[i7]:"$__serverMessage",[g7]:"$__serverMessage",[f7]:"$__serverMessage",[r7]:"$__serverMessage",[o7]:"$__serverMessage",[a7]:"$__serverMessage",[e7]:"Minimum context slot has not been reached",[d7]:"Node is unhealthy; behind by $numSlotsBehind slots",[c7]:"No snapshot",[h7]:"Transaction simulation failed",[u7]:"$__serverMessage",[s7]:"Transaction history is not available from this node",[l7]:"$__serverMessage",[n7]:"Transaction signature length mismatch",[p7]:"Transaction signature verification failure",[t7]:"$__serverMessage",[K7]:"Key pair bytes must be of length 64, got $byteLength.",[F7]:"Expected private key bytes with length 32. Actual length: $actualLength.",[W7]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[H7]:"The provided private key does not match the provided public key.",[j7]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[WH]:"Lamports value must be in the range [0, 2e64-1]",[jH]:"`$value` cannot be parsed as a `BigInt`",[$H]:"$message",[HH]:"`$value` cannot be parsed as a `Number`",[VH]:"No nonce account could be found at address `$nonceAccountAddress`",[R9]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[T9]:"WebSocket was closed before payload could be added to the send buffer",[B9]:"WebSocket connection closed",[z9]:"WebSocket failed to connect",[O9]:"Failed to obtain a subscription id from the server",[P9]:"Could not find an API plan for RPC method: `$method`",[w9]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[I9]:"HTTP error ($statusCode): $message",[x9]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[YG]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[JG]:"The provided value does not implement the `KeyPairSigner` interface",[e$]:"The provided value does not implement the `MessageModifyingSigner` interface",[t$]:"The provided value does not implement the `MessagePartialSigner` interface",[QG]:"The provided value does not implement any of the `MessageSigner` interfaces",[n$]:"The provided value does not implement the `TransactionModifyingSigner` interface",[i$]:"The provided value does not implement the `TransactionPartialSigner` interface",[s$]:"The provided value does not implement the `TransactionSendingSigner` interface",[r$]:"The provided value does not implement any of the `TransactionSigner` interfaces",[o$]:"More than one `TransactionSendingSigner` was identified.",[a$]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[c$]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[U7]:"Cannot export a non-extractable key.",[C7]:"No digest implementation could be found.",[k7]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[M7]:`This runtime does not support the generation of Ed25519 key pairs.
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
-For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[LV]:"No signature verification implementation could be found.",[DV]:"No key generation implementation could be found.",[qV]:"No signing implementation could be found.",[UV]:"No key export implementation could be found.",[$U]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[GK]:"Transaction processing left an account with an outstanding borrowed reference",[zK]:"Account in use",[kK]:"Account loaded twice",[CK]:"Attempt to debit an account but found no record of a prior credit.",[e5]:"Transaction loads an address table account that doesn't exist",[DK]:"This transaction has already been processed",[qK]:"Blockhash not found",[UK]:"Loader call chain is too deep",[HK]:"Transactions are currently disabled due to cluster maintenance",[a5]:"Transaction contains a duplicate instruction ($index) that is not allowed",[MK]:"Insufficient funds for fee",[c5]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[LK]:"This account may not be used to pay transaction fees",[FK]:"Transaction contains an invalid account reference",[r5]:"Transaction loads an address table account with invalid data",[n5]:"Transaction address table lookup uses an invalid index",[t5]:"Transaction loads an address table account with an invalid owner",[l5]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[WK]:"This program may not be used for executing instructions",[i5]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[YK]:"Transaction loads a writable account that cannot be written",[u5]:"Transaction exceeded max loaded accounts data size cap",[VK]:"Transaction requires a fee but has no signature present",[NK]:"Attempt to load a program that does not exist",[f5]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[d5]:"ResanitizationNeeded",[jK]:"Transaction failed to sanitize accounts offsets correctly",[KK]:"Transaction did not pass signature verification",[QK]:"Transaction locked too many accounts",[h5]:"Sum of account balances before and after transaction do not match",[TK]:"The transaction failed with the error `$errorName`",[ZK]:"Transaction version is unsupported",[JK]:"Transaction would exceed account data limit within the block",[o5]:"Transaction would exceed total account data limit",[XK]:"Transaction would exceed max account limit within the block",[$K]:"Transaction would exceed max Block Cost Limit",[s5]:"Transaction would exceed max Vote Cost Limit",[xK]:"Attempted to sign a transaction with an address that is not a signer for it",[AK]:"Transaction is missing an address at index: $index.",[IK]:"Transaction has no expected signers therefore it cannot be encoded",[BK]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[fK]:"Transaction does not have a blockhash lifetime",[hK]:"Transaction is not a durable nonce transaction",[gK]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[yK]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[bK]:"No fee payer set in CompiledTransaction",[mK]:"Could not find program address at index $index",[RK]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[OK]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[SK]:"Transaction is missing a fee payer.",[vK]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[wK]:"Transaction first instruction is not advance nonce account instruction.",[EK]:"Transaction with no instructions cannot be durable nonce transaction.",[lK]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[dK]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[PK]:"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",[_K]:"Transaction is missing signatures for addresses: $addresses.",[pK]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"};function V5(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${U5(e)}'`),`${r}\``}}var ao=class extends Error{cause=this.cause;context;constructor(...[t,e]){let r,n;if(e){let{cause:s,...o}=e;s&&(n={cause:s}),Object.keys(o).length>0&&(r=o)}let i=V5(t,r);super(i,n),this.context={__code:t,...r},this.name="SolanaError"}};a();function F5(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function IO(t){return Object.freeze({...t,encode:e=>{let r=new Uint8Array(F5(e,t));return t.write(e,r,0),r}})}function PO(t){return Object.freeze({...t,decode:(e,r=0)=>t.read(e,r)[0]})}function Ou(t){return"fixedSize"in t&&typeof t.fixedSize=="number"}function RO(t,e){if(Ou(t)!==Ou(e))throw new ao(TA);if(Ou(t)&&Ou(e)&&t.fixedSize!==e.fixedSize)throw new ao(zA,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!Ou(t)&&!Ou(e)&&t.maxSize!==e.maxSize)throw new ao(kA,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function OO(t,e,r=0){if(e.length-r<=0)throw new ao(OA,{codecDescription:t})}function BO(t,e,r,n=0){let i=r.length-n;if(i<e)throw new ao(BA,{bytesLength:i,codecDescription:t,expected:e})}function K5(t,e,r,n){if(n<e||n>r)throw new ao(CA,{codecDescription:t,max:r,min:e,value:n})}function TO(t){return t?.endian!==1}function W5(t){return IO({fixedSize:t.size,write(e,r,n){t.range&&K5(t.name,t.range[0],t.range[1],e);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,TO(t.config)),r.set(new Uint8Array(i),n),n+t.size}})}function j5(t){return PO({fixedSize:t.size,read(e,r=0){OO(t.name,e,r),BO(t.name,t.size,e,r);let n=new DataView(H5(e,r,t.size));return[t.get(n,TO(t.config)),r+t.size]}})}function H5(t,e,r){let n=t.byteOffset+(e??0),i=r??t.byteLength;return t.buffer.slice(n,n+i)}var NA=(t={})=>W5({config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),size:8}),G5=(t={})=>j5({config:t,get:(e,r)=>e.getBigUint64(0,r),name:"u64",size:8}),zO=(t={})=>RO(NA(t),G5(t));a();var MA=class extends TypeError{constructor(e,r){let n,{message:i,explanation:s,...o}=e,{path:c}=e,u=c.length===0?i:`At path: ${c.join(".")} -- ${i}`;super(s??u),s!=null&&(this.cause=u),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}};function $5(t){return lf(t)&&typeof t[Symbol.iterator]=="function"}function lf(t){return typeof t=="object"&&t!=null}function L0(t){return lf(t)&&!Array.isArray(t)}function Ai(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Z5(t){let{done:e,value:r}=t.next();return e?void 0:r}function Y5(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});let{path:i,branch:s}=e,{type:o}=r,{refinement:c,message:u=`Expected a value of type \`${o}\`${c?` with refinement \`${c}\``:""}, but received: \`${Ai(n)}\``}=t;return{value:n,type:o,refinement:c,key:i[i.length-1],path:i,branch:s,...t,message:u}}function*kO(t,e,r,n){$5(t)||(t=[t]);for(let i of t){let s=Y5(i,e,r,n);s&&(yield s)}}function*LA(t,e,r={}){let{path:n=[],branch:i=[t],coerce:s=!1,mask:o=!1}=r,c={path:n,branch:i,mask:o};s&&(t=e.coercer(t,c));let u="valid";for(let d of e.validator(t,c))d.explanation=r.message,u="not_valid",yield[d,void 0];for(let[d,f,m]of e.entries(t,c)){let _=LA(f,m,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,f],coerce:s,mask:o,message:r.message});for(let v of _)v[0]?(u=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(f=v[1],d===void 0?t=f:t instanceof Map?t.set(d,f):t instanceof Set?t.add(f):lf(t)&&(f!==void 0||d in t)&&(t[d]=f))}if(u!=="not_valid")for(let d of e.refiner(t,c))d.explanation=r.message,u="not_refined",yield[d,void 0];u==="valid"&&(yield[void 0,t])}var Wn=class{constructor(e){let{type:r,schema:n,validator:i,refiner:s,coercer:o=u=>u,entries:c=function*(){}}=e;this.type=r,this.schema=n,this.entries=c,this.coercer=o,i?this.validator=(u,d)=>{let f=i(u,d);return kO(f,d,this,u)}:this.validator=()=>[],s?this.refiner=(u,d)=>{let f=s(u,d);return kO(f,d,this,u)}:this.refiner=()=>[]}assert(e,r){return CO(e,this,r)}create(e,r){return se(e,this,r)}is(e){return NO(e,this)}mask(e,r){return X5(e,this,r)}validate(e,r={}){return df(e,this,r)}};function CO(t,e,r){let n=df(t,e,{message:r});if(n[0])throw n[0]}function se(t,e,r){let n=df(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function X5(t,e,r){let n=df(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function NO(t,e){return!df(t,e)[0]}function df(t,e,r={}){let n=LA(t,e,r),i=Z5(n);return i[0]?[new MA(i[0],function*(){for(let o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function Ka(t,e){return new Wn({type:t,schema:null,validator:e})}function MO(){return Ka("any",()=>!0)}function ce(t){return new Wn({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${Ai(e)}`}})}function Si(){return Ka("boolean",t=>typeof t=="boolean")}function D0(t){return Ka("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Ai(e)}`)}function it(t){let e=Ai(t),r=typeof t;return new Wn({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Ai(n)}`}})}function J5(){return Ka("never",()=>!1)}function ue(t){return new Wn({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function D(){return Ka("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Ai(t)}`)}function me(t){return new Wn({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function DA(t,e){return new Wn({type:"record",schema:null,*entries(r){if(lf(r))for(let n in r){let i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return L0(r)||`Expected an object, but received: ${Ai(r)}`},coercer(r){return L0(r)?{...r}:r}})}function ne(){return Ka("string",t=>typeof t=="string"||`Expected a string, but received: ${Ai(t)}`)}function q0(t){let e=J5();return new Wn({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${Ai(r)}`},coercer(r){return Array.isArray(r)?r.slice():r}})}function X(t){let e=Object.keys(t);return new Wn({type:"type",schema:t,*entries(r){if(lf(r))for(let n of e)yield[n,r[n],t[n]]},validator(r){return L0(r)||`Expected an object, but received: ${Ai(r)}`},coercer(r){return L0(r)?{...r}:r}})}function qr(t){let e=t.map(r=>r.type).join(" | ");return new Wn({type:"union",schema:null,coercer(r,n){for(let i of t){let[s,o]=i.validate(r,{coerce:!0,mask:n.mask});if(!s)return o}return r},validator(r,n){let i=[];for(let s of t){let[...o]=LA(r,s,n),[c]=o;if(c[0])for(let[u]of o)u&&i.push(u);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Ai(r)}`,...i]}})}function Wa(){return Ka("unknown",()=>!0)}function Bu(t,e,r){return new Wn({...t,coercer:(n,i)=>NO(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}var WB=Pr(oB());a();var uB=Pr(Ba(),1);a();var H0=Pr(cB(),1);var wW=class extends H0.default{socket;constructor(t,e){super(),this.socket=new window.WebSocket(t,e.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=r=>this.emit("message",r.data),this.socket.onerror=r=>this.emit("error",r),this.socket.onclose=r=>{this.emit("close",r.code,r.reason)}}send(t,e,r){let n=r||e;try{this.socket.send(t),n()}catch(i){n(i)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}};function lB(t,e){return new wW(t,e)}var xW=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},dB=class extends H0.default{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(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...o}={},c,u){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=c||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new xW,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(t,e,r,n){return!n&&typeof r=="object"&&(n=r,r=null),new Promise((i,s)=>{if(!this.ready)return s(new Error("socket not ready"));let o=this.generate_request_id(t,e),c={jsonrpc:"2.0",method:t,params:e||void 0,id:o};this.socket.send(this.dataPack.encode(c),n,u=>{if(u)return s(u);this.queue[o]={promise:[i,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(new Error("reply timeout"))},r))})})}async login(t){let e=await this.call("rpc.login",t);if(!e)throw new Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise((r,n)=>{if(!this.ready)return n(new Error("socket not ready"));let i={jsonrpc:"2.0",method:t,params:e};this.socket.send(this.dataPack.encode(i),s=>{if(s)return n(s);r()})})}async subscribe(t){typeof t=="string"&&(t=[t]);let e=await this.call("rpc.on",t);if(typeof t=="string"&&e[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){typeof t=="string"&&(t=[t]);let e=await this.call("rpc.off",t);if(typeof t=="string"&&e[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket&&this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:r})=>{r instanceof ArrayBuffer&&(r=uB.Buffer.from(r).toString());try{r=this.dataPack.decode(r)}catch{return}if(r.notification&&this.listeners(r.notification).length){if(!Object.keys(r.params).length)return this.emit(r.notification);let n=[r.notification];if(r.params.constructor===Object)n.push(r.params);else for(let i=0;i<r.params.length;i++)n.push(r.params[i]);return Promise.resolve().then(()=>{this.emit.apply(this,n)})}if(!this.queue[r.id])return r.method?Promise.resolve().then(()=>{this.emit(r.method,r?.params)}):void 0;"error"in r=="result"in r&&this.queue[r.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[r.id].timeout&&clearTimeout(this.queue[r.id].timeout),r.error?this.queue[r.id].promise[1](r.error):this.queue[r.id].promise[0](r.result),delete this.queue[r.id]}),this.socket.addEventListener("error",r=>this.emit("error",r)),this.socket.addEventListener("close",({code:r,reason:n})=>{this.ready&&setTimeout(()=>this.emit("close",r,n),0),this.ready=!1,this.socket=void 0,r!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,e),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,n),1))})}};a();var IW=BigInt(0),mf=BigInt(1),PW=BigInt(2),RW=BigInt(7),OW=BigInt(256),BW=BigInt(113),pB=[],gB=[],yB=[];for(let t=0,e=mf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],pB.push(2*(5*n+r)),gB.push((t+1)*(t+2)/2%64);let i=IW;for(let s=0;s<7;s++)e=(e<<mf^(e>>RW)*BW)%OW,e&PW&&(i^=mf<<(mf<<BigInt(s))-mf);yB.push(i)}var mB=e0(yB,!0),TW=mB[0],zW=mB[1],fB=(t,e,r)=>r>32?vR(t,e,r):AR(t,e,r),hB=(t,e,r)=>r>32?ER(t,e,r):SR(t,e,r);function kW(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],m=fB(d,f,1)^r[c],_=hB(d,f,1)^r[c+1];for(let v=0;v<50;v+=10)t[o+v]^=m,t[o+v+1]^=_}let i=t[2],s=t[3];for(let o=0;o<24;o++){let c=gB[o],u=fB(i,s,c),d=hB(i,s,c),f=pB[o];i=t[f],s=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=TW[n],t[1]^=zW[n]}Kn(r)}var ZA=class t extends Xs{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,mi(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=gR(this.state)}clone(){return this._cloneInto()}keccak(){G_(this.state32),kW(this.state32,this.rounds),G_(this.state32),this.posOut=0,this.pos=0}update(e){gs(this),e=Na(e),pt(e);let{blockLen:r,state:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(r-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){gs(this,!1),pt(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return mi(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Xg(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,Kn(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new t(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}},CW=(t,e,r)=>Zd(()=>new ZA(e,t,r));var YA=CW(1,136,256/8);a();a();a();a();var G0=class extends Xs{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Yg(e);let n=Na(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),Kn(s)}update(e){return gs(this),this.iHash.update(e),this}digestInto(e){gs(this),pt(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=o,e.outputLen=c,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},XA=(t,e,r)=>new G0(t,e).update(r).digest();XA.create=(t,e)=>new G0(t,e);var bB=(t,e)=>(t+(t>=0?e:-e)/_B)/e;function NW(t,e,r){let[[n,i],[s,o]]=e,c=bB(o*t,r),u=bB(-i*t,r),d=t-c*n-u*s,f=-c*i-u*o,m=d<Ps,_=f<Ps;m&&(d=-d),_&&(f=-f);let v=to(Math.ceil(s0(r)/2))+zu;if(d<Ps||d>=v||f<Ps||f>=v)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:m,k1:d,k2neg:_,k2:f}}function QA(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function JA(t,e){let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return bs(r.lowS,"lowS"),bs(r.prehash,"prehash"),r.format!==void 0&&QA(r.format),r}var eS=class extends Error{constructor(e=""){super(e)}},Is={Err:eS,_tlv:{encode:(t,e)=>{let{Err:r}=Is;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=Qd(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?Qd(i.length/2|128):"";return Qd(t)+s+i+e},decode(t,e){let{Err:r}=Is,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],s=!!(i&128),o=0;if(!s)o=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let d=e.subarray(n,n+u);if(d.length!==u)throw new r("tlv.decode: length bytes not complete");if(d[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of d)o=o<<8|f;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}let c=e.subarray(n,n+o);if(c.length!==o)throw new r("tlv.decode: wrong value length");return{v:c,l:e.subarray(n+o)}}},_int:{encode(t){let{Err:e}=Is;if(t<Ps)throw new e("integer: negative integers are not allowed");let r=Qd(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=Is;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return _u(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=Is,i=He("signature",t),{v:s,l:o}=n.decode(48,i);if(o.length)throw new e("invalid signature: left bytes after parsing");let{v:c,l:u}=n.decode(2,s),{v:d,l:f}=n.decode(2,u);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(d)}},hexFromSig(t){let{_tlv:e,_int:r}=Is,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),s=n+i;return e.encode(48,s)}},Ps=BigInt(0),zu=BigInt(1),_B=BigInt(2),$0=BigInt(3),MW=BigInt(4);function Tu(t,e){let{BYTES:r}=t,n;if(typeof e=="bigint")n=e;else{let i=He("private key",e);try{n=t.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function LW(t,e={}){let r=a0("weierstrass",t,e),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o,n:c}=s;ro(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:u}=e;if(u&&(!n.is0(s.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let d=SB(n,i);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(J,w,l){let{x:h,y:A}=w.toAffine(),E=n.toBytes(h);if(bs(l,"isCompressed"),l){f();let x=!n.isOdd(A);return vt(AB(x),E)}else return vt(Uint8Array.of(4),E,n.toBytes(A))}function _(J){In(J,void 0,"Point");let{publicKey:w,publicKeyUncompressed:l}=d,h=J.length,A=J[0],E=J.subarray(1);if(h===w&&(A===2||A===3)){let x=n.fromBytes(E);if(!n.isValid(x))throw new Error("bad point: is not on curve, wrong x");let O=B(x),C;try{C=n.sqrt(O)}catch(R){let ee=R instanceof Error?": "+R.message:"";throw new Error("bad point: is not on curve, sqrt error"+ee)}f();let I=n.isOdd(C);return(A&1)===1!==I&&(C=n.neg(C)),{x,y:C}}else if(h===l&&A===4){let x=n.BYTES,O=n.fromBytes(E.subarray(0,x)),C=n.fromBytes(E.subarray(x,x*2));if(!k(O,C))throw new Error("bad point: is not on curve");return{x:O,y:C}}else throw new Error(`bad point: got length ${h}, expected compressed=${w} or uncompressed=${l}`)}let v=e.toBytes||m,P=e.fromBytes||_;function B(J){let w=n.sqr(J),l=n.mul(w,J);return n.add(n.add(l,n.mul(J,s.a)),s.b)}function k(J,w){let l=n.sqr(w),h=B(J);return n.eql(l,h)}if(!k(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let T=n.mul(n.pow(s.a,$0),MW),L=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(T,L)))throw new Error("bad curve params: a or b");function M(J,w,l=!1){if(!n.isValid(w)||l&&n.is0(w))throw new Error(`bad point coordinate ${J}`);return w}function F(J){if(!(J instanceof N))throw new Error("ProjectivePoint expected")}function Q(J){if(!u||!u.basises)throw new Error("no endo");return NW(J,u.basises,i.ORDER)}let W=Au((J,w)=>{let{X:l,Y:h,Z:A}=J;if(n.eql(A,n.ONE))return{x:l,y:h};let E=J.is0();w==null&&(w=E?n.ONE:n.inv(A));let x=n.mul(l,w),O=n.mul(h,w),C=n.mul(A,w);if(E)return{x:n.ZERO,y:n.ZERO};if(!n.eql(C,n.ONE))throw new Error("invZ was invalid");return{x,y:O}}),Z=Au(J=>{if(J.is0()){if(e.allowInfinityPoint&&!n.is0(J.Y))return;throw new Error("bad point: ZERO")}let{x:w,y:l}=J.toAffine();if(!n.isValid(w)||!n.isValid(l))throw new Error("bad point: x or y not field elements");if(!k(w,l))throw new Error("bad point: equation left != right");if(!J.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function H(J,w,l,h,A){return l=new N(n.mul(l.X,J),l.Y,l.Z),w=rf(h,w),l=rf(A,l),w.add(l)}class N{constructor(w,l,h){this.X=M("x",w),this.Y=M("y",l,!0),this.Z=M("z",h),Object.freeze(this)}static CURVE(){return s}static fromAffine(w){let{x:l,y:h}=w||{};if(!w||!n.isValid(l)||!n.isValid(h))throw new Error("invalid affine point");if(w instanceof N)throw new Error("projective point not allowed");return n.is0(l)&&n.is0(h)?N.ZERO:new N(l,h,n.ONE)}static fromBytes(w){let l=N.fromAffine(P(In(w,void 0,"point")));return l.assertValidity(),l}static fromHex(w){return N.fromBytes(He("pointHex",w))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,l=!0){return Y.createCache(this,w),l||this.multiply($0),this}assertValidity(){Z(this)}hasEvenY(){let{y:w}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(w)}equals(w){F(w);let{X:l,Y:h,Z:A}=this,{X:E,Y:x,Z:O}=w,C=n.eql(n.mul(l,O),n.mul(E,A)),I=n.eql(n.mul(h,O),n.mul(x,A));return C&&I}negate(){return new N(this.X,n.neg(this.Y),this.Z)}double(){let{a:w,b:l}=s,h=n.mul(l,$0),{X:A,Y:E,Z:x}=this,O=n.ZERO,C=n.ZERO,I=n.ZERO,b=n.mul(A,A),R=n.mul(E,E),ee=n.mul(x,x),te=n.mul(A,E);return te=n.add(te,te),I=n.mul(A,x),I=n.add(I,I),O=n.mul(w,I),C=n.mul(h,ee),C=n.add(O,C),O=n.sub(R,C),C=n.add(R,C),C=n.mul(O,C),O=n.mul(te,O),I=n.mul(h,I),ee=n.mul(w,ee),te=n.sub(b,ee),te=n.mul(w,te),te=n.add(te,I),I=n.add(b,b),b=n.add(I,b),b=n.add(b,ee),b=n.mul(b,te),C=n.add(C,b),ee=n.mul(E,x),ee=n.add(ee,ee),b=n.mul(ee,te),O=n.sub(O,b),I=n.mul(ee,R),I=n.add(I,I),I=n.add(I,I),new N(O,C,I)}add(w){F(w);let{X:l,Y:h,Z:A}=this,{X:E,Y:x,Z:O}=w,C=n.ZERO,I=n.ZERO,b=n.ZERO,R=s.a,ee=n.mul(s.b,$0),te=n.mul(l,E),oe=n.mul(h,x),de=n.mul(A,O),xe=n.add(l,h),Se=n.add(E,x);xe=n.mul(xe,Se),Se=n.add(te,oe),xe=n.sub(xe,Se),Se=n.add(l,A);let Qe=n.add(E,O);return Se=n.mul(Se,Qe),Qe=n.add(te,de),Se=n.sub(Se,Qe),Qe=n.add(h,A),C=n.add(x,O),Qe=n.mul(Qe,C),C=n.add(oe,de),Qe=n.sub(Qe,C),b=n.mul(R,Se),C=n.mul(ee,de),b=n.add(C,b),C=n.sub(oe,b),b=n.add(oe,b),I=n.mul(C,b),oe=n.add(te,te),oe=n.add(oe,te),de=n.mul(R,de),Se=n.mul(ee,Se),oe=n.add(oe,de),de=n.sub(te,de),de=n.mul(R,de),Se=n.add(Se,de),te=n.mul(oe,Se),I=n.add(I,te),te=n.mul(Qe,Se),C=n.mul(xe,C),C=n.sub(C,te),te=n.mul(xe,oe),b=n.mul(Qe,b),b=n.add(b,te),new N(C,I,b)}subtract(w){return this.add(w.negate())}is0(){return this.equals(N.ZERO)}multiply(w){let{endo:l}=e;if(!i.isValidNot0(w))throw new Error("invalid scalar: out of range");let h,A,E=x=>Y.cached(this,x,O=>Ss(N,O));if(l){let{k1neg:x,k1:O,k2neg:C,k2:I}=Q(w),{p:b,f:R}=E(O),{p:ee,f:te}=E(I);A=R.add(te),h=H(l.beta,b,ee,x,C)}else{let{p:x,f:O}=E(w);h=x,A=O}return Ss(N,[h,A])[0]}multiplyUnsafe(w){let{endo:l}=e,h=this;if(!i.isValid(w))throw new Error("invalid scalar: out of range");if(w===Ps||h.is0())return N.ZERO;if(w===zu)return h;if(Y.hasCache(this))return this.multiply(w);if(l){let{k1neg:A,k1:E,k2neg:x,k2:O}=Q(w),{p1:C,p2:I}=YR(N,h,E,O);return H(l.beta,C,I,A,x)}else return Y.unsafe(h,w)}multiplyAndAddUnsafe(w,l,h){let A=this.multiplyUnsafe(l).add(w.multiplyUnsafe(h));return A.is0()?void 0:A}toAffine(w){return W(this,w)}isTorsionFree(){let{isTorsionFree:w}=e;return o===zu?!0:w?w(N,this):Y.unsafe(this,c).is0()}clearCofactor(){let{clearCofactor:w}=e;return o===zu?this:w?w(N,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(w=!0){return bs(w,"isCompressed"),this.assertValidity(),v(N,this,w)}toHex(w=!0){return ur(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(w=!0){return this.toBytes(w)}_setWindowSize(w){this.precompute(w)}static normalizeZ(w){return Ss(N,w)}static msm(w,l){return Eu(N,i,w,l)}static fromPrivateKey(w){return N.BASE.multiply(Tu(i,w))}}N.BASE=new N(s.Gx,s.Gy,n.ONE),N.ZERO=new N(n.ZERO,n.ONE,n.ZERO),N.Fp=n,N.Fn=i;let K=i.BITS,Y=new vu(N,e.endo?Math.ceil(K/2):K);return N.BASE.precompute(8),N}function AB(t){return Uint8Array.of(t?2:3)}function SB(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function DW(t,e={}){let{Fn:r}=t,n=e.randomBytes||ys,i=Object.assign(SB(t.Fp,r),{seed:sA(r.ORDER)});function s(v){try{return!!Tu(r,v)}catch{return!1}}function o(v,P){let{publicKey:B,publicKeyUncompressed:k}=i;try{let T=v.length;return P===!0&&T!==B||P===!1&&T!==k?!1:!!t.fromBytes(v)}catch{return!1}}function c(v=n(i.seed)){return oA(In(v,i.seed,"seed"),r.ORDER)}function u(v,P=!0){return t.BASE.multiply(Tu(r,v)).toBytes(P)}function d(v){let P=c(v);return{secretKey:P,publicKey:u(P)}}function f(v){if(typeof v=="bigint")return!1;if(v instanceof t)return!0;let{secretKey:P,publicKey:B,publicKeyUncompressed:k}=i;if(r.allowedLengths||P===B)return;let T=He("key",v).length;return T===B||T===k}function m(v,P,B=!0){if(f(v)===!0)throw new Error("first arg must be private key");if(f(P)===!1)throw new Error("second arg must be public key");let k=Tu(r,v);return t.fromHex(P).multiply(k).toBytes(B)}return Object.freeze({getPublicKey:u,getSharedSecret:m,keygen:d,Point:t,utils:{isValidSecretKey:s,isValidPublicKey:o,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:v=>Tu(r,v),precompute(v=8,P=t.BASE){return P.precompute(v,!1)}},lengths:i})}function qW(t,e,r={}){Yg(e),ro(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||ys,i=r.hmac||((l,...h)=>XA(e,l,vt(...h))),{Fp:s,Fn:o}=t,{ORDER:c,BITS:u}=o,{keygen:d,getPublicKey:f,getSharedSecret:m,utils:_,lengths:v}=DW(t,r),P={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},B="compact";function k(l){let h=c>>zu;return l>h}function T(l,h){if(!o.isValidNot0(h))throw new Error(`invalid signature ${l}: out of range 1..Point.Fn.ORDER`);return h}function L(l,h){QA(h);let A=v.signature,E=h==="compact"?A:h==="recovered"?A+1:void 0;return In(l,E,`${h} signature`)}class M{constructor(h,A,E){this.r=T("r",h),this.s=T("s",A),E!=null&&(this.recovery=E),Object.freeze(this)}static fromBytes(h,A=B){L(h,A);let E;if(A==="der"){let{r:I,s:b}=Is.toSig(In(h));return new M(I,b)}A==="recovered"&&(E=h[0],A="compact",h=h.subarray(1));let x=o.BYTES,O=h.subarray(0,x),C=h.subarray(x,x*2);return new M(o.fromBytes(O),o.fromBytes(C),E)}static fromHex(h,A){return this.fromBytes(_i(h),A)}addRecoveryBit(h){return new M(this.r,this.s,h)}recoverPublicKey(h){let A=s.ORDER,{r:E,s:x,recovery:O}=this;if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");if(c*_B<A&&O>1)throw new Error("recovery id is ambiguous for h>1 curve");let I=O===2||O===3?E+c:E;if(!s.isValid(I))throw new Error("recovery id 2 or 3 invalid");let b=s.toBytes(I),R=t.fromBytes(vt(AB((O&1)===0),b)),ee=o.inv(I),te=Q(He("msgHash",h)),oe=o.create(-te*ee),de=o.create(x*ee),xe=t.BASE.multiplyUnsafe(oe).add(R.multiplyUnsafe(de));if(xe.is0())throw new Error("point at infinify");return xe.assertValidity(),xe}hasHighS(){return k(this.s)}toBytes(h=B){if(QA(h),h==="der")return _i(Is.hexFromSig(this));let A=o.toBytes(this.r),E=o.toBytes(this.s);if(h==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return vt(Uint8Array.of(this.recovery),A,E)}return vt(A,E)}toHex(h){return ur(this.toBytes(h))}assertValidity(){}static fromCompact(h){return M.fromBytes(He("sig",h),"compact")}static fromDER(h){return M.fromBytes(He("sig",h),"der")}normalizeS(){return this.hasHighS()?new M(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ur(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ur(this.toBytes("compact"))}}let F=r.bits2int||function(h){if(h.length>8192)throw new Error("input is too large");let A=_u(h),E=h.length*8-u;return E>0?A>>BigInt(E):A},Q=r.bits2int_modN||function(h){return o.create(F(h))},W=to(u);function Z(l){return ef("num < 2^"+u,l,Ps,W),o.toBytes(l)}function H(l,h){return In(l,void 0,"message"),h?In(e(l),void 0,"prehashed message"):l}function N(l,h,A){if(["recovered","canonical"].some(oe=>oe in A))throw new Error("sign() legacy options not supported");let{lowS:E,prehash:x,extraEntropy:O}=JA(A,P);l=H(l,x);let C=Q(l),I=Tu(o,h),b=[Z(I),Z(C)];if(O!=null&&O!==!1){let oe=O===!0?n(v.secretKey):O;b.push(He("extraEntropy",oe))}let R=vt(...b),ee=C;function te(oe){let de=F(oe);if(!o.isValidNot0(de))return;let xe=o.inv(de),Se=t.BASE.multiply(de).toAffine(),Qe=o.create(Se.x);if(Qe===Ps)return;let Ue=o.create(xe*o.create(ee+Qe*I));if(Ue===Ps)return;let Ze=(Se.x===Qe?0:2)|Number(Se.y&zu),Ud=Ue;return E&&k(Ue)&&(Ud=o.neg(Ue),Ze^=1),new M(Qe,Ud,Ze)}return{seed:R,k2sig:te}}function K(l,h,A={}){l=He("message",l);let{seed:E,k2sig:x}=N(l,h,A);return CR(e.outputLen,o.BYTES,i)(E,x)}function Y(l){let h,A=typeof l=="string"||Qr(l),E=!A&&l!==null&&typeof l=="object"&&typeof l.r=="bigint"&&typeof l.s=="bigint";if(!A&&!E)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(E)h=new M(l.r,l.s);else if(A){try{h=M.fromBytes(He("sig",l),"der")}catch(x){if(!(x instanceof Is.Err))throw x}if(!h)try{h=M.fromBytes(He("sig",l),"compact")}catch{return!1}}return h||!1}function J(l,h,A,E={}){let{lowS:x,prehash:O,format:C}=JA(E,P);if(A=He("publicKey",A),h=H(He("message",h),O),"strict"in E)throw new Error("options.strict was renamed to lowS");let I=C===void 0?Y(l):M.fromBytes(He("sig",l),C);if(I===!1)return!1;try{let b=t.fromBytes(A);if(x&&I.hasHighS())return!1;let{r:R,s:ee}=I,te=Q(h),oe=o.inv(ee),de=o.create(te*oe),xe=o.create(R*oe),Se=t.BASE.multiplyUnsafe(de).add(b.multiplyUnsafe(xe));return Se.is0()?!1:o.create(Se.x)===R}catch{return!1}}function w(l,h,A={}){let{prehash:E}=JA(A,P);return h=H(h,E),M.fromBytes(l,"recovered").recoverPublicKey(h).toBytes()}return Object.freeze({keygen:d,getPublicKey:f,getSharedSecret:m,utils:_,lengths:v,Point:t,sign:K,verify:J,recoverPublicKey:w,Signature:M,hash:e})}function UW(t){let e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0,i=Pn(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),s={Fp:r,Fn:i,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:s}}function VW(t){let{CURVE:e,curveOpts:r}=UW(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function FW(t,e){let r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,o0(r.Fn.ORDER,r.Fn.BITS))})}function vB(t){let{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:i}=VW(t),s=LW(e,r),o=qW(s,n,i);return FW(t,o)}function EB(t,e){let r=n=>vB({...t,hash:n});return{...r(e),create:r}}var rS={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},KW={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var wB=BigInt(2);function WW(t){let e=rS.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),c=BigInt(44),u=BigInt(88),d=t*t*t%e,f=d*d*t%e,m=nt(f,r,e)*f%e,_=nt(m,r,e)*f%e,v=nt(_,wB,e)*d%e,P=nt(v,i,e)*v%e,B=nt(P,s,e)*P%e,k=nt(B,c,e)*B%e,T=nt(k,u,e)*k%e,L=nt(T,c,e)*B%e,M=nt(L,r,e)*f%e,F=nt(M,o,e)*P%e,Q=nt(F,n,e)*d%e,W=nt(Q,wB,e);if(!tS.eql(tS.sqr(W),t))throw new Error("Cannot find square root");return W}var tS=Pn(rS.p,{sqrt:WW}),Z0=EB({...rS,Fp:tS,lowS:!0,endo:KW},r0);var tSe=hn.utils.randomPrivateKey,xB=()=>{let t=hn.utils.randomPrivateKey(),e=fS(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},fS=hn.getPublicKey;function IB(t){try{return hn.ExtendedPoint.fromHex(t),!0}catch{return!1}}var xS=(t,e)=>hn.sign(t,e.slice(0,32)),jW=hn.verify,ke=t=>ve.Buffer.isBuffer(t)?t:t instanceof Uint8Array?ve.Buffer.from(t.buffer,t.byteOffset,t.byteLength):ve.Buffer.from(t),hS=class{constructor(e){Object.assign(this,e)}encode(){return ve.Buffer.from((0,Du.serialize)(J0,this))}static decode(e){return(0,Du.deserialize)(J0,this,e)}static decodeUnchecked(e){return(0,Du.deserializeUnchecked)(J0,this,e)}};var J0=new Map,jB,HW=32,po=32;function GW(t){return t._bn!==void 0}var PB=1,be=class t extends hS{constructor(e){if(super({}),this._bn=void 0,GW(e))this._bn=e._bn;else{if(typeof e=="string"){let r=mr.default.decode(e);if(r.length!=po)throw new Error("Invalid public key input");this._bn=new dS.default(r)}else this._bn=new dS.default(e);if(this._bn.byteLength()>po)throw new Error("Invalid public key input")}}static unique(){let e=new t(PB);return PB+=1,new t(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return mr.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(ve.Buffer);if(e.length===po)return e;let r=ve.Buffer.alloc(32);return e.copy(r,32-e.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,r,n){let i=ve.Buffer.concat([e.toBuffer(),ve.Buffer.from(r),n.toBuffer()]),s=_A(i);return new t(s)}static createProgramAddressSync(e,r){let n=ve.Buffer.alloc(0);e.forEach(function(s){if(s.length>HW)throw new TypeError("Max seed length exceeded");n=ve.Buffer.concat([n,ke(s)])}),n=ve.Buffer.concat([n,r.toBuffer(),ve.Buffer.from("ProgramDerivedAddress")]);let i=_A(n);if(IB(i))throw new Error("Invalid seeds, address must fall off the curve");return new t(i)}static async createProgramAddress(e,r){return this.createProgramAddressSync(e,r)}static findProgramAddressSync(e,r){let n=255,i;for(;n!=0;){try{let s=e.concat(ve.Buffer.from([n]));i=this.createProgramAddressSync(s,r)}catch(s){if(s instanceof TypeError)throw s;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,r){return this.findProgramAddressSync(e,r)}static isOnCurve(e){let r=new t(e);return IB(r.toBytes())}};jB=be;be.default=new jB("11111111111111111111111111111111");J0.set(be,{kind:"struct",fields:[["_bn","u256"]]});var rSe=new be("BPFLoader1111111111111111111111111111111111"),Ga=1232,IS=127,Sf=64,Q0=class extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}};Object.defineProperty(Q0.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var ey=class extends Error{constructor(e,r){super(`Transaction was not confirmed in ${r.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(ey.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Ha=class extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}};Object.defineProperty(Ha.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Cu=class{constructor(e,r){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=r}keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let r of this.keySegments()){if(e<r.length)return r[e];e-=r.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");let n=new Map;this.keySegments().flat().forEach((s,o)=>{n.set(s.toBase58(),o)});let i=s=>{let o=n.get(s.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return e.map(s=>({programIdIndex:i(s.programId),accountKeyIndexes:s.keys.map(o=>i(o.pubkey)),data:s.data}))}},Te=(t="publicKey")=>z.blob(32,t),$W=(t="signature")=>z.blob(64,t),ku=(t="string")=>{let e=z.struct([z.u32("length"),z.u32("lengthPadding"),z.blob(z.offset(z.u32(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(s,o)=>r(s,o).chars.toString(),i.encode=(s,o,c)=>{let u={chars:ve.Buffer.from(s,"utf8")};return n(u,o,c)},i.alloc=s=>z.u32().span+z.u32().span+ve.Buffer.from(s,"utf8").length,i},ZW=(t="authorized")=>z.struct([Te("staker"),Te("withdrawer")],t),YW=(t="lockup")=>z.struct([z.ns64("unixTimestamp"),z.ns64("epoch"),Te("custodian")],t),XW=(t="voteInit")=>z.struct([Te("nodePubkey"),Te("authorizedVoter"),Te("authorizedWithdrawer"),z.u8("commission")],t),JW=(t="voteAuthorizeWithSeedArgs")=>z.struct([z.u32("voteAuthorizationType"),Te("currentAuthorityDerivedKeyOwnerPubkey"),ku("currentAuthorityDerivedKeySeed"),Te("newAuthorized")],t);function HB(t,e){let r=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){let s=e[i.property];if(Array.isArray(s))return s.length*r(i.elementLayout)}else if("fields"in i)return HB({layout:i},e[i.property]);return 0},n=0;return t.layout.fields.forEach(i=>{n+=r(i)}),n}function On(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(n&127)<<r*7,r+=1,(n&128)===0)break}return e}function Bn(t,e){let r=e;for(;;){let n=r&127;if(r>>=7,r==0){t.push(n);break}else n|=128,t.push(n)}}function Ke(t,e){if(!t)throw new Error(e||"Assertion failed")}var ty=class t{constructor(e,r){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=r}static compile(e,r){let n=new Map,i=o=>{let c=o.toBase58(),u=n.get(c);return u===void 0&&(u={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(c,u)),u},s=i(r);s.isSigner=!0,s.isWritable=!0;for(let o of e){i(o.programId).isInvoked=!0;for(let c of o.keys){let u=i(c.pubkey);u.isSigner||=c.isSigner,u.isWritable||=c.isWritable}}return new t(r,n)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];Ke(e.length<=256,"Max static account keys length exceeded");let r=e.filter(([,u])=>u.isSigner&&u.isWritable),n=e.filter(([,u])=>u.isSigner&&!u.isWritable),i=e.filter(([,u])=>!u.isSigner&&u.isWritable),s=e.filter(([,u])=>!u.isSigner&&!u.isWritable),o={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:s.length};{Ke(r.length>0,"Expected at least one writable signer key");let[u]=r[0];Ke(u===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let c=[...r.map(([u])=>new be(u)),...n.map(([u])=>new be(u)),...i.map(([u])=>new be(u)),...s.map(([u])=>new be(u))];return[o,c]}extractTableLookup(e){let[r,n]=this.drainKeysFoundInLookupTable(e.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[i,s]=this.drainKeysFoundInLookupTable(e.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:s}]}drainKeysFoundInLookupTable(e,r){let n=new Array,i=new Array;for(let[s,o]of this.keyMetaMap.entries())if(r(o)){let c=new be(s),u=e.findIndex(d=>d.equals(c));u>=0&&(Ke(u<256,"Max lookup table index exceeded"),n.push(u),i.push(c),this.keyMetaMap.delete(s))}return[n,i]}},GB="Reached end of buffer unexpectedly";function Os(t){if(t.length===0)throw new Error(GB);return t.shift()}function Tn(t,...e){let[r]=e;if(e.length===2?r+(e[1]??0)>t.length:r>=t.length)throw new Error(GB);return t.splice(...e)}var vi=class t{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(r=>new be(r)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:mr.default.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Cu(this.staticAccountKeys)}static compile(e){let r=ty.compile(e.instructions,e.payerKey),[n,i]=r.getMessageComponents(),o=new Cu(i).compileInstructions(e.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:mr.default.encode(c.data)}));return new t({header:n,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:o})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){let n=e-r,s=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n<s}else{let n=r-this.header.numReadonlySignedAccounts;return e<n}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,r)=>!this.isProgramId(r))}serialize(){let e=this.accountKeys.length,r=[];Bn(r,e);let n=this.instructions.map(m=>{let{accounts:_,programIdIndex:v}=m,P=Array.from(mr.default.decode(m.data)),B=[];Bn(B,_.length);let k=[];return Bn(k,P.length),{programIdIndex:v,keyIndicesCount:ve.Buffer.from(B),keyIndices:_,dataLength:ve.Buffer.from(k),data:P}}),i=[];Bn(i,n.length);let s=ve.Buffer.alloc(Ga);ve.Buffer.from(i).copy(s);let o=i.length;n.forEach(m=>{let v=z.struct([z.u8("programIdIndex"),z.blob(m.keyIndicesCount.length,"keyIndicesCount"),z.seq(z.u8("keyIndex"),m.keyIndices.length,"keyIndices"),z.blob(m.dataLength.length,"dataLength"),z.seq(z.u8("userdatum"),m.data.length,"data")]).encode(m,s,o);o+=v}),s=s.slice(0,o);let c=z.struct([z.blob(1,"numRequiredSignatures"),z.blob(1,"numReadonlySignedAccounts"),z.blob(1,"numReadonlyUnsignedAccounts"),z.blob(r.length,"keyCount"),z.seq(Te("key"),e,"keys"),Te("recentBlockhash")]),u={numRequiredSignatures:ve.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:ve.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:ve.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:ve.Buffer.from(r),keys:this.accountKeys.map(m=>ke(m.toBytes())),recentBlockhash:mr.default.decode(this.recentBlockhash)},d=ve.Buffer.alloc(2048),f=c.encode(u,d);return s.copy(d,f),d.slice(0,f+s.length)}static from(e){let r=[...e],n=Os(r);if(n!==(n&IS))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=Os(r),s=Os(r),o=On(r),c=[];for(let _=0;_<o;_++){let v=Tn(r,0,po);c.push(new be(ve.Buffer.from(v)))}let u=Tn(r,0,po),d=On(r),f=[];for(let _=0;_<d;_++){let v=Os(r),P=On(r),B=Tn(r,0,P),k=On(r),T=Tn(r,0,k),L=mr.default.encode(ve.Buffer.from(T));f.push({programIdIndex:v,accounts:B,data:L})}let m={header:{numRequiredSignatures:n,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:s},recentBlockhash:mr.default.encode(ve.Buffer.from(u)),accountKeys:c,instructions:f};return new t(m)}},$a=class t{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(let r of this.addressTableLookups)e+=r.readonlyIndexes.length+r.writableIndexes.length;return e}getAccountKeys(e){let r;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");r=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)r=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 Cu(this.staticAccountKeys,r)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){let i=e-n,s=this.addressTableLookups.reduce((o,c)=>o+c.writableIndexes.length,0);return i<s}else if(e>=this.header.numRequiredSignatures){let i=e-r,o=n-r-this.header.numReadonlyUnsignedAccounts;return i<o}else{let i=r-this.header.numReadonlySignedAccounts;return e<i}}resolveAddressTableLookups(e){let r={writable:[],readonly:[]};for(let n of this.addressTableLookups){let i=e.find(s=>s.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(let s of n.writableIndexes)if(s<i.state.addresses.length)r.writable.push(i.state.addresses[s]);else throw new Error(`Failed to find address for index ${s} in address lookup table ${n.accountKey.toBase58()}`);for(let s of n.readonlyIndexes)if(s<i.state.addresses.length)r.readonly.push(i.state.addresses[s]);else throw new Error(`Failed to find address for index ${s} in address lookup table ${n.accountKey.toBase58()}`)}return r}static compile(e){let r=ty.compile(e.instructions,e.payerKey),n=new Array,i={writable:new Array,readonly:new Array},s=e.addressLookupTableAccounts||[];for(let f of s){let m=r.extractTableLookup(f);if(m!==void 0){let[_,{writable:v,readonly:P}]=m;n.push(_),i.writable.push(...v),i.readonly.push(...P)}}let[o,c]=r.getMessageComponents(),d=new Cu(c,i).compileInstructions(e.instructions);return new t({header:o,staticAccountKeys:c,recentBlockhash:e.recentBlockhash,compiledInstructions:d,addressTableLookups:n})}serialize(){let e=Array();Bn(e,this.staticAccountKeys.length);let r=this.serializeInstructions(),n=Array();Bn(n,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),s=Array();Bn(s,this.addressTableLookups.length);let o=z.struct([z.u8("prefix"),z.struct([z.u8("numRequiredSignatures"),z.u8("numReadonlySignedAccounts"),z.u8("numReadonlyUnsignedAccounts")],"header"),z.blob(e.length,"staticAccountKeysLength"),z.seq(Te(),this.staticAccountKeys.length,"staticAccountKeys"),Te("recentBlockhash"),z.blob(n.length,"instructionsLength"),z.blob(r.length,"serializedInstructions"),z.blob(s.length,"addressTableLookupsLength"),z.blob(i.length,"serializedAddressTableLookups")]),c=new Uint8Array(Ga),d=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(f=>f.toBytes()),recentBlockhash:mr.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(s),serializedAddressTableLookups:i},c);return c.slice(0,d)}serializeInstructions(){let e=0,r=new Uint8Array(Ga);for(let n of this.compiledInstructions){let i=Array();Bn(i,n.accountKeyIndexes.length);let s=Array();Bn(s,n.data.length);let o=z.struct([z.u8("programIdIndex"),z.blob(i.length,"encodedAccountKeyIndexesLength"),z.seq(z.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),z.blob(s.length,"encodedDataLength"),z.blob(n.data.length,"data")]);e+=o.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(s),data:n.data},r,e)}return r.slice(0,e)}serializeAddressTableLookups(){let e=0,r=new Uint8Array(Ga);for(let n of this.addressTableLookups){let i=Array();Bn(i,n.writableIndexes.length);let s=Array();Bn(s,n.readonlyIndexes.length);let o=z.struct([Te("accountKey"),z.blob(i.length,"encodedWritableIndexesLength"),z.seq(z.u8(),n.writableIndexes.length,"writableIndexes"),z.blob(s.length,"encodedReadonlyIndexesLength"),z.seq(z.u8(),n.readonlyIndexes.length,"readonlyIndexes")]);e+=o.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(s),readonlyIndexes:n.readonlyIndexes},r,e)}return r.slice(0,e)}static deserialize(e){let r=[...e],n=Os(r),i=n&IS;Ke(n!==i,"Expected versioned message but received legacy message");let s=i;Ke(s===0,`Expected versioned message with version 0 but found version ${s}`);let o={numRequiredSignatures:Os(r),numReadonlySignedAccounts:Os(r),numReadonlyUnsignedAccounts:Os(r)},c=[],u=On(r);for(let P=0;P<u;P++)c.push(new be(Tn(r,0,po)));let d=mr.default.encode(Tn(r,0,po)),f=On(r),m=[];for(let P=0;P<f;P++){let B=Os(r),k=On(r),T=Tn(r,0,k),L=On(r),M=new Uint8Array(Tn(r,0,L));m.push({programIdIndex:B,accountKeyIndexes:T,data:M})}let _=On(r),v=[];for(let P=0;P<_;P++){let B=new be(Tn(r,0,po)),k=On(r),T=Tn(r,0,k),L=On(r),M=Tn(r,0,L);v.push({accountKey:B,writableIndexes:T,readonlyIndexes:M})}return new t({header:o,staticAccountKeys:c,recentBlockhash:d,compiledInstructions:m,addressTableLookups:v})}},$B={deserializeMessageVersion(t){let e=t[0],r=e&IS;return r===e?"legacy":r},deserialize:t=>{let e=$B.deserializeMessageVersion(t);if(e==="legacy")return vi.from(t);if(e===0)return $a.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}},fo=(function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t})({}),QW=ve.Buffer.alloc(Sf).fill(0),je=class{constructor(e){this.keys=void 0,this.programId=void 0,this.data=ve.Buffer.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:r,isWritable:n})=>({pubkey:e.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}},De=class t{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")){let{minContextSlot:r,nonceInfo:n}=e;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){let{blockhash:r,lastValidBlockHeight:n}=e;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{let{recentBlockhash:r,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new je(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,r;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(e=this.recentBlockhash,r=this.instructions),!e)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let B=0;B<r.length;B++)if(r[B].programId===void 0)throw new Error(`Transaction instruction index ${B} has undefined program id`);let i=[],s=[];r.forEach(B=>{B.keys.forEach(T=>{s.push({...T})});let k=B.programId.toString();i.includes(k)||i.push(k)}),i.forEach(B=>{s.push({pubkey:new be(B),isSigner:!1,isWritable:!1})});let o=[];s.forEach(B=>{let k=B.pubkey.toString(),T=o.findIndex(L=>L.pubkey.toString()===k);T>-1?(o[T].isWritable=o[T].isWritable||B.isWritable,o[T].isSigner=o[T].isSigner||B.isSigner):o.push(B)}),o.sort(function(B,k){if(B.isSigner!==k.isSigner)return B.isSigner?-1:1;if(B.isWritable!==k.isWritable)return B.isWritable?-1:1;let T={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return B.pubkey.toBase58().localeCompare(k.pubkey.toBase58(),"en",T)});let c=o.findIndex(B=>B.pubkey.equals(n));if(c>-1){let[B]=o.splice(c,1);B.isSigner=!0,B.isWritable=!0,o.unshift(B)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(let B of this.signatures){let k=o.findIndex(T=>T.pubkey.equals(B.publicKey));if(k>-1)o[k].isSigner||(o[k].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."));else throw new Error(`unknown signer: ${B.publicKey.toString()}`)}let u=0,d=0,f=0,m=[],_=[];o.forEach(({pubkey:B,isSigner:k,isWritable:T})=>{k?(m.push(B.toString()),u+=1,T||(d+=1)):(_.push(B.toString()),T||(f+=1))});let v=m.concat(_),P=r.map(B=>{let{data:k,programId:T}=B;return{programIdIndex:v.indexOf(T.toString()),accounts:B.keys.map(L=>v.indexOf(L.pubkey.toString())),data:mr.default.encode(k)}});return P.forEach(B=>{Ke(B.programIdIndex>=0),B.accounts.forEach(k=>Ke(k>=0))}),new vi({header:{numRequiredSignatures:u,numReadonlySignedAccounts:d,numReadonlyUnsignedAccounts:f},accountKeys:v,recentBlockhash:e,instructions:P})}_compile(){let e=this.compileMessage(),r=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,s)=>r[s].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");let r=new Set;this.signatures=e.filter(n=>{let i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let s of e){let o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}this.signatures=n.map(s=>({signature:null,publicKey:s.publicKey}));let i=this._compile();this._partialSign(i,...n)}partialSign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let s of e){let o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}let i=this._compile();this._partialSign(i,...n)}_partialSign(e,...r){let n=e.serialize();r.forEach(i=>{let s=xS(n,i.secretKey);this._addSignature(i.publicKey,ke(s))})}addSignature(e,r){this._compile(),this._addSignature(e,r)}_addSignature(e,r){Ke(r.length===64);let n=this.signatures.findIndex(i=>e.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=ve.Buffer.from(r)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,r){let n={};for(let{signature:i,publicKey:s}of this.signatures)i===null?r&&(n.missing||=[]).push(s):jW(i,e,s.toBytes())||(n.invalid||=[]).push(s);return n.invalid||n.missing?n:void 0}serialize(e){let{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(n){let s=this._getMessageSignednessErrors(i,r);if(s){let o="Signature verification failed.";throw s.invalid&&(o+=`
+For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[N7]:"No signature verification implementation could be found.",[L7]:"No key generation implementation could be found.",[D7]:"No signing implementation could be found.",[q7]:"No key export implementation could be found.",[GH]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[H$]:"Transaction processing left an account with an outstanding borrowed reference",[B$]:"Account in use",[z$]:"Account loaded twice",[k$]:"Attempt to debit an account but found no record of a prior credit.",[Q$]:"Transaction loads an address table account that doesn't exist",[L$]:"This transaction has already been processed",[D$]:"Blockhash not found",[q$]:"Loader call chain is too deep",[j$]:"Transactions are currently disabled due to cluster maintenance",[o9]:"Transaction contains a duplicate instruction ($index) that is not allowed",[M$]:"Insufficient funds for fee",[a9]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[N$]:"This account may not be used to pay transaction fees",[V$]:"Transaction contains an invalid account reference",[t9]:"Transaction loads an address table account with invalid data",[r9]:"Transaction address table lookup uses an invalid index",[e9]:"Transaction loads an address table account with an invalid owner",[u9]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[F$]:"This program may not be used for executing instructions",[n9]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[Z$]:"Transaction loads a writable account that cannot be written",[c9]:"Transaction exceeded max loaded accounts data size cap",[U$]:"Transaction requires a fee but has no signature present",[C$]:"Attempt to load a program that does not exist",[d9]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[l9]:"ResanitizationNeeded",[W$]:"Transaction failed to sanitize accounts offsets correctly",[K$]:"Transaction did not pass signature verification",[J$]:"Transaction locked too many accounts",[f9]:"Sum of account balances before and after transaction do not match",[T$]:"The transaction failed with the error `$errorName`",[$$]:"Transaction version is unsupported",[Y$]:"Transaction would exceed account data limit within the block",[s9]:"Transaction would exceed total account data limit",[X$]:"Transaction would exceed max account limit within the block",[G$]:"Transaction would exceed max Block Cost Limit",[i9]:"Transaction would exceed max Vote Cost Limit",[w$]:"Attempted to sign a transaction with an address that is not a signer for it",[A$]:"Transaction is missing an address at index: $index.",[x$]:"Transaction has no expected signers therefore it cannot be encoded",[O$]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[d$]:"Transaction does not have a blockhash lifetime",[f$]:"Transaction is not a durable nonce transaction",[h$]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[g$]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[y$]:"No fee payer set in CompiledTransaction",[m$]:"Could not find program address at index $index",[P$]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[R$]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[_$]:"Transaction is missing a fee payer.",[S$]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[E$]:"Transaction first instruction is not advance nonce account instruction.",[v$]:"Transaction with no instructions cannot be durable nonce transaction.",[u$]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[l$]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[I$]:"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",[b$]:"Transaction is missing signatures for addresses: $addresses.",[p$]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"};function U9(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${q9(e)}'`),`${r}\``}}var $o=class extends Error{cause=this.cause;context;constructor(...[t,e]){let r,n;if(e){let{cause:s,...o}=e;s&&(n={cause:s}),Object.keys(o).length>0&&(r=o)}let i=U9(t,r);super(i,n),this.context={__code:t,...r},this.name="SolanaError"}};a();function V9(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function Tk(t){return Object.freeze({...t,encode:e=>{let r=new Uint8Array(V9(e,t));return t.write(e,r,0),r}})}function Bk(t){return Object.freeze({...t,decode:(e,r=0)=>t.read(e,r)[0]})}function Bl(t){return"fixedSize"in t&&typeof t.fixedSize=="number"}function zk(t,e){if(Bl(t)!==Bl(e))throw new $o(iw);if(Bl(t)&&Bl(e)&&t.fixedSize!==e.fixedSize)throw new $o(sw,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!Bl(t)&&!Bl(e)&&t.maxSize!==e.maxSize)throw new $o(ow,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function kk(t,e,r=0){if(e.length-r<=0)throw new $o(rw,{codecDescription:t})}function Ck(t,e,r,n=0){let i=r.length-n;if(i<e)throw new $o(nw,{bytesLength:i,codecDescription:t,expected:e})}function K9(t,e,r,n){if(n<e||n>r)throw new $o(aw,{codecDescription:t,max:r,min:e,value:n})}function Mk(t){return t?.endian!==1}function F9(t){return Tk({fixedSize:t.size,write(e,r,n){t.range&&K9(t.name,t.range[0],t.range[1],e);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,Mk(t.config)),r.set(new Uint8Array(i),n),n+t.size}})}function W9(t){return Bk({fixedSize:t.size,read(e,r=0){kk(t.name,e,r),Ck(t.name,t.size,e,r);let n=new DataView(j9(e,r,t.size));return[t.get(n,Mk(t.config)),r+t.size]}})}function j9(t,e,r){let n=t.byteOffset+(e??0),i=r??t.byteLength;return t.buffer.slice(n,n+i)}var cw=(t={})=>F9({config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),size:8}),H9=(t={})=>W9({config:t,get:(e,r)=>e.getBigUint64(0,r),name:"u64",size:8}),Nk=(t={})=>zk(cw(t),H9(t));a();var uw=class extends TypeError{constructor(e,r){let n,{message:i,explanation:s,...o}=e,{path:c}=e,u=c.length===0?i:`At path: ${c.join(".")} -- ${i}`;super(s??u),s!=null&&(this.cause=u),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}};function G9(t){return ph(t)&&typeof t[Symbol.iterator]=="function"}function ph(t){return typeof t=="object"&&t!=null}function T1(t){return ph(t)&&!Array.isArray(t)}function Zi(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function $9(t){let{done:e,value:r}=t.next();return e?void 0:r}function Z9(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});let{path:i,branch:s}=e,{type:o}=r,{refinement:c,message:u=`Expected a value of type \`${o}\`${c?` with refinement \`${c}\``:""}, but received: \`${Zi(n)}\``}=t;return{value:n,type:o,refinement:c,key:i[i.length-1],path:i,branch:s,...t,message:u}}function*Lk(t,e,r,n){G9(t)||(t=[t]);for(let i of t){let s=Z9(i,e,r,n);s&&(yield s)}}function*lw(t,e,r={}){let{path:n=[],branch:i=[t],coerce:s=!1,mask:o=!1}=r,c={path:n,branch:i,mask:o};s&&(t=e.coercer(t,c));let u="valid";for(let d of e.validator(t,c))d.explanation=r.message,u="not_valid",yield[d,void 0];for(let[d,f,m]of e.entries(t,c)){let A=lw(f,m,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,f],coerce:s,mask:o,message:r.message});for(let v of A)v[0]?(u=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(f=v[1],d===void 0?t=f:t instanceof Map?t.set(d,f):t instanceof Set?t.add(f):ph(t)&&(f!==void 0||d in t)&&(t[d]=f))}if(u!=="not_valid")for(let d of e.refiner(t,c))d.explanation=r.message,u="not_refined",yield[d,void 0];u==="valid"&&(yield[void 0,t])}var ui=class{constructor(e){let{type:r,schema:n,validator:i,refiner:s,coercer:o=u=>u,entries:c=function*(){}}=e;this.type=r,this.schema=n,this.entries=c,this.coercer=o,i?this.validator=(u,d)=>{let f=i(u,d);return Lk(f,d,this,u)}:this.validator=()=>[],s?this.refiner=(u,d)=>{let f=s(u,d);return Lk(f,d,this,u)}:this.refiner=()=>[]}assert(e,r){return Dk(e,this,r)}create(e,r){return ae(e,this,r)}is(e){return qk(e,this)}mask(e,r){return X9(e,this,r)}validate(e,r={}){return hh(e,this,r)}};function Dk(t,e,r){let n=hh(t,e,{message:r});if(n[0])throw n[0]}function ae(t,e,r){let n=hh(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function X9(t,e,r){let n=hh(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function qk(t,e){return!hh(t,e)[0]}function hh(t,e,r={}){let n=lw(t,e,r),i=$9(n);return i[0]?[new uw(i[0],function*(){for(let o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function qc(t,e){return new ui({type:t,schema:null,validator:e})}function Uk(){return qc("any",()=>!0)}function ue(t){return new ui({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${Zi(e)}`}})}function Xi(){return qc("boolean",t=>typeof t=="boolean")}function B1(t){return qc("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Zi(e)}`)}function ut(t){let e=Zi(t),r=typeof t;return new ui({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Zi(n)}`}})}function Y9(){return qc("never",()=>!1)}function le(t){return new ui({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function q(){return qc("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Zi(t)}`)}function ye(t){return new ui({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function dw(t,e){return new ui({type:"record",schema:null,*entries(r){if(ph(r))for(let n in r){let i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return T1(r)||`Expected an object, but received: ${Zi(r)}`},coercer(r){return T1(r)?{...r}:r}})}function ne(){return qc("string",t=>typeof t=="string"||`Expected a string, but received: ${Zi(t)}`)}function z1(t){let e=Y9();return new ui({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${Zi(r)}`},coercer(r){return Array.isArray(r)?r.slice():r}})}function J(t){let e=Object.keys(t);return new ui({type:"type",schema:t,*entries(r){if(ph(r))for(let n of e)yield[n,r[n],t[n]]},validator(r){return T1(r)||`Expected an object, but received: ${Zi(r)}`},coercer(r){return T1(r)?{...r}:r}})}function rn(t){let e=t.map(r=>r.type).join(" | ");return new ui({type:"union",schema:null,coercer(r,n){for(let i of t){let[s,o]=i.validate(r,{coerce:!0,mask:n.mask});if(!s)return o}return r},validator(r,n){let i=[];for(let s of t){let[...o]=lw(r,s,n),[c]=o;if(c[0])for(let[u]of o)u&&i.push(u);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Zi(r)}`,...i]}})}function Uc(){return qc("unknown",()=>!0)}function zl(t,e,r){return new ui({...t,coercer:(n,i)=>qk(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}var $C=xr(lC());a();var pC=xr(Ic(),1);a();var q1=xr(fC(),1);var EZ=class extends q1.default{socket;constructor(t,e){super(),this.socket=new window.WebSocket(t,e.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=r=>this.emit("message",r.data),this.socket.onerror=r=>this.emit("error",r),this.socket.onclose=r=>{this.emit("close",r.code,r.reason)}}send(t,e,r){let n=r||e;try{this.socket.send(t),n()}catch(i){n(i)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}};function hC(t,e){return new EZ(t,e)}var wZ=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},gC=class extends q1.default{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(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...o}={},c,u){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=c||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new wZ,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(t,e,r,n){return!n&&typeof r=="object"&&(n=r,r=null),new Promise((i,s)=>{if(!this.ready)return s(new Error("socket not ready"));let o=this.generate_request_id(t,e),c={jsonrpc:"2.0",method:t,params:e||void 0,id:o};this.socket.send(this.dataPack.encode(c),n,u=>{if(u)return s(u);this.queue[o]={promise:[i,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(new Error("reply timeout"))},r))})})}async login(t){let e=await this.call("rpc.login",t);if(!e)throw new Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise((r,n)=>{if(!this.ready)return n(new Error("socket not ready"));let i={jsonrpc:"2.0",method:t,params:e};this.socket.send(this.dataPack.encode(i),s=>{if(s)return n(s);r()})})}async subscribe(t){typeof t=="string"&&(t=[t]);let e=await this.call("rpc.on",t);if(typeof t=="string"&&e[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){typeof t=="string"&&(t=[t]);let e=await this.call("rpc.off",t);if(typeof t=="string"&&e[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket&&this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:r})=>{r instanceof ArrayBuffer&&(r=pC.Buffer.from(r).toString());try{r=this.dataPack.decode(r)}catch{return}if(r.notification&&this.listeners(r.notification).length){if(!Object.keys(r.params).length)return this.emit(r.notification);let n=[r.notification];if(r.params.constructor===Object)n.push(r.params);else for(let i=0;i<r.params.length;i++)n.push(r.params[i]);return Promise.resolve().then(()=>{this.emit.apply(this,n)})}if(!this.queue[r.id])return r.method?Promise.resolve().then(()=>{this.emit(r.method,r?.params)}):void 0;"error"in r=="result"in r&&this.queue[r.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[r.id].timeout&&clearTimeout(this.queue[r.id].timeout),r.error?this.queue[r.id].promise[1](r.error):this.queue[r.id].promise[0](r.result),delete this.queue[r.id]}),this.socket.addEventListener("error",r=>this.emit("error",r)),this.socket.addEventListener("close",({code:r,reason:n})=>{this.ready&&setTimeout(()=>this.emit("close",r,n),0),this.ready=!1,this.socket=void 0,r!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,e),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,n),1))})}};a();var xZ=BigInt(0),_h=BigInt(1),IZ=BigInt(2),PZ=BigInt(7),RZ=BigInt(256),OZ=BigInt(113),bC=[],AC=[],_C=[];for(let t=0,e=_h,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],bC.push(2*(5*n+r)),AC.push((t+1)*(t+2)/2%64);let i=xZ;for(let s=0;s<7;s++)e=(e<<_h^(e>>PZ)*OZ)%RZ,e&IZ&&(i^=_h<<(_h<<BigInt(s))-_h);_C.push(i)}var SC=Gy(_C,!0),TZ=SC[0],BZ=SC[1],mC=(t,e,r)=>r>32?Iz(t,e,r):wz(t,e,r),yC=(t,e,r)=>r>32?Pz(t,e,r):xz(t,e,r);function zZ(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],m=mC(d,f,1)^r[c],A=yC(d,f,1)^r[c+1];for(let v=0;v<50;v+=10)t[o+v]^=m,t[o+v+1]^=A}let i=t[2],s=t[3];for(let o=0;o<24;o++){let c=AC[o],u=mC(i,s,c),d=yC(i,s,c),f=bC[o];i=t[f],s=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=TZ[n],t[1]^=BZ[n]}ci(r)}var vw=class t extends Do{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,Hi(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Az(this.state)}clone(){return this._cloneInto()}keccak(){_E(this.state32),zZ(this.state32,this.rounds),_E(this.state32),this.posOut=0,this.pos=0}update(e){Js(this),e=Bc(e),At(e);let{blockLen:r,state:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(r-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Js(this,!1),At(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Hi(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Wy(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,ci(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new t(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}},kZ=(t,e,r)=>Qp(()=>new vw(e,t,r));var Ew=kZ(1,136,256/8);a();a();a();a();var U1=class extends Do{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Fy(e);let n=Bc(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),ci(s)}update(e){return Js(this),this.iHash.update(e),this}digestInto(e){Js(this),At(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=o,e.outputLen=c,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ww=(t,e,r)=>new U1(t,e).update(r).digest();ww.create=(t,e)=>new U1(t,e);var vC=(t,e)=>(t+(t>=0?e:-e)/EC)/e;function CZ(t,e,r){let[[n,i],[s,o]]=e,c=vC(o*t,r),u=vC(-i*t,r),d=t-c*n-u*s,f=-c*i-u*o,m=d<lo,A=f<lo;m&&(d=-d),A&&(f=-f);let v=Ko(Math.ceil(Jy(r)/2))+Cl;if(d<lo||d>=v||f<lo||f>=v)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:m,k1:d,k2neg:A,k2:f}}function Iw(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function xw(t,e){let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return to(r.lowS,"lowS"),to(r.prehash,"prehash"),r.format!==void 0&&Iw(r.format),r}var Pw=class extends Error{constructor(e=""){super(e)}},uo={Err:Pw,_tlv:{encode:(t,e)=>{let{Err:r}=uo;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=nh(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?nh(i.length/2|128):"";return nh(t)+s+i+e},decode(t,e){let{Err:r}=uo,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],s=!!(i&128),o=0;if(!s)o=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let d=e.subarray(n,n+u);if(d.length!==u)throw new r("tlv.decode: length bytes not complete");if(d[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of d)o=o<<8|f;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}let c=e.subarray(n,n+o);if(c.length!==o)throw new r("tlv.decode: wrong value length");return{v:c,l:e.subarray(n+o)}}},_int:{encode(t){let{Err:e}=uo;if(t<lo)throw new e("integer: negative integers are not allowed");let r=nh(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=uo;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Sl(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=uo,i=Xe("signature",t),{v:s,l:o}=n.decode(48,i);if(o.length)throw new e("invalid signature: left bytes after parsing");let{v:c,l:u}=n.decode(2,s),{v:d,l:f}=n.decode(2,u);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(d)}},hexFromSig(t){let{_tlv:e,_int:r}=uo,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),s=n+i;return e.encode(48,s)}},lo=BigInt(0),Cl=BigInt(1),EC=BigInt(2),V1=BigInt(3),MZ=BigInt(4);function kl(t,e){let{BYTES:r}=t,n;if(typeof e=="bigint")n=e;else{let i=Xe("private key",e);try{n=t.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function NZ(t,e={}){let r=e1("weierstrass",t,e),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o,n:c}=s;Fo(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:u}=e;if(u&&(!n.is0(s.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let d=xC(n,i);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(Q,w,l){let{x:y,y:S}=w.toAffine(),E=n.toBytes(y);if(to(l,"isCompressed"),l){f();let x=!n.isOdd(S);return Tt(wC(x),E)}else return Tt(Uint8Array.of(4),E,n.toBytes(S))}function A(Q){jn(Q,void 0,"Point");let{publicKey:w,publicKeyUncompressed:l}=d,y=Q.length,S=Q[0],E=Q.subarray(1);if(y===w&&(S===2||S===3)){let x=n.fromBytes(E);if(!n.isValid(x))throw new Error("bad point: is not on curve, wrong x");let O=T(x),C;try{C=n.sqrt(O)}catch(R){let re=R instanceof Error?": "+R.message:"";throw new Error("bad point: is not on curve, sqrt error"+re)}f();let I=n.isOdd(C);return(S&1)===1!==I&&(C=n.neg(C)),{x,y:C}}else if(y===l&&S===4){let x=n.BYTES,O=n.fromBytes(E.subarray(0,x)),C=n.fromBytes(E.subarray(x,x*2));if(!k(O,C))throw new Error("bad point: is not on curve");return{x:O,y:C}}else throw new Error(`bad point: got length ${y}, expected compressed=${w} or uncompressed=${l}`)}let v=e.toBytes||m,P=e.fromBytes||A;function T(Q){let w=n.sqr(Q),l=n.mul(w,Q);return n.add(n.add(l,n.mul(Q,s.a)),s.b)}function k(Q,w){let l=n.sqr(w),y=T(Q);return n.eql(l,y)}if(!k(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let B=n.mul(n.pow(s.a,V1),MZ),D=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(B,D)))throw new Error("bad curve params: a or b");function L(Q,w,l=!1){if(!n.isValid(w)||l&&n.is0(w))throw new Error(`bad point coordinate ${Q}`);return w}function F(Q){if(!(Q instanceof M))throw new Error("ProjectivePoint expected")}function ee(Q){if(!u||!u.basises)throw new Error("no endo");return CZ(Q,u.basises,i.ORDER)}let j=vl((Q,w)=>{let{X:l,Y:y,Z:S}=Q;if(n.eql(S,n.ONE))return{x:l,y};let E=Q.is0();w==null&&(w=E?n.ONE:n.inv(S));let x=n.mul(l,w),O=n.mul(y,w),C=n.mul(S,w);if(E)return{x:n.ZERO,y:n.ZERO};if(!n.eql(C,n.ONE))throw new Error("invZ was invalid");return{x,y:O}}),X=vl(Q=>{if(Q.is0()){if(e.allowInfinityPoint&&!n.is0(Q.Y))return;throw new Error("bad point: ZERO")}let{x:w,y:l}=Q.toAffine();if(!n.isValid(w)||!n.isValid(l))throw new Error("bad point: x or y not field elements");if(!k(w,l))throw new Error("bad point: equation left != right");if(!Q.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function G(Q,w,l,y,S){return l=new M(n.mul(l.X,Q),l.Y,l.Z),w=oh(y,w),l=oh(S,l),w.add(l)}class M{constructor(w,l,y){this.X=L("x",w),this.Y=L("y",l,!0),this.Z=L("z",y),Object.freeze(this)}static CURVE(){return s}static fromAffine(w){let{x:l,y}=w||{};if(!w||!n.isValid(l)||!n.isValid(y))throw new Error("invalid affine point");if(w instanceof M)throw new Error("projective point not allowed");return n.is0(l)&&n.is0(y)?M.ZERO:new M(l,y,n.ONE)}static fromBytes(w){let l=M.fromAffine(P(jn(w,void 0,"point")));return l.assertValidity(),l}static fromHex(w){return M.fromBytes(Xe("pointHex",w))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,l=!0){return Y.createCache(this,w),l||this.multiply(V1),this}assertValidity(){X(this)}hasEvenY(){let{y:w}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(w)}equals(w){F(w);let{X:l,Y:y,Z:S}=this,{X:E,Y:x,Z:O}=w,C=n.eql(n.mul(l,O),n.mul(E,S)),I=n.eql(n.mul(y,O),n.mul(x,S));return C&&I}negate(){return new M(this.X,n.neg(this.Y),this.Z)}double(){let{a:w,b:l}=s,y=n.mul(l,V1),{X:S,Y:E,Z:x}=this,O=n.ZERO,C=n.ZERO,I=n.ZERO,b=n.mul(S,S),R=n.mul(E,E),re=n.mul(x,x),te=n.mul(S,E);return te=n.add(te,te),I=n.mul(S,x),I=n.add(I,I),O=n.mul(w,I),C=n.mul(y,re),C=n.add(O,C),O=n.sub(R,C),C=n.add(R,C),C=n.mul(O,C),O=n.mul(te,O),I=n.mul(y,I),re=n.mul(w,re),te=n.sub(b,re),te=n.mul(w,te),te=n.add(te,I),I=n.add(b,b),b=n.add(I,b),b=n.add(b,re),b=n.mul(b,te),C=n.add(C,b),re=n.mul(E,x),re=n.add(re,re),b=n.mul(re,te),O=n.sub(O,b),I=n.mul(re,R),I=n.add(I,I),I=n.add(I,I),new M(O,C,I)}add(w){F(w);let{X:l,Y:y,Z:S}=this,{X:E,Y:x,Z:O}=w,C=n.ZERO,I=n.ZERO,b=n.ZERO,R=s.a,re=n.mul(s.b,V1),te=n.mul(l,E),se=n.mul(y,x),fe=n.mul(S,O),Pe=n.add(l,y),Se=n.add(E,x);Pe=n.mul(Pe,Se),Se=n.add(te,se),Pe=n.sub(Pe,Se),Se=n.add(l,S);let it=n.add(E,O);return Se=n.mul(Se,it),it=n.add(te,fe),Se=n.sub(Se,it),it=n.add(y,S),C=n.add(x,O),it=n.mul(it,C),C=n.add(se,fe),it=n.sub(it,C),b=n.mul(R,Se),C=n.mul(re,fe),b=n.add(C,b),C=n.sub(se,b),b=n.add(se,b),I=n.mul(C,b),se=n.add(te,te),se=n.add(se,te),fe=n.mul(R,fe),Se=n.mul(re,Se),se=n.add(se,fe),fe=n.sub(te,fe),fe=n.mul(R,fe),Se=n.add(Se,fe),te=n.mul(se,Se),I=n.add(I,te),te=n.mul(it,Se),C=n.mul(Pe,C),C=n.sub(C,te),te=n.mul(Pe,se),b=n.mul(it,b),b=n.add(b,te),new M(C,I,b)}subtract(w){return this.add(w.negate())}is0(){return this.equals(M.ZERO)}multiply(w){let{endo:l}=e;if(!i.isValidNot0(w))throw new Error("invalid scalar: out of range");let y,S,E=x=>Y.cached(this,x,O=>io(M,O));if(l){let{k1neg:x,k1:O,k2neg:C,k2:I}=ee(w),{p:b,f:R}=E(O),{p:re,f:te}=E(I);S=R.add(te),y=G(l.beta,b,re,x,C)}else{let{p:x,f:O}=E(w);y=x,S=O}return io(M,[y,S])[0]}multiplyUnsafe(w){let{endo:l}=e,y=this;if(!i.isValid(w))throw new Error("invalid scalar: out of range");if(w===lo||y.is0())return M.ZERO;if(w===Cl)return y;if(Y.hasCache(this))return this.multiply(w);if(l){let{k1neg:S,k1:E,k2neg:x,k2:O}=ee(w),{p1:C,p2:I}=ek(M,y,E,O);return G(l.beta,C,I,S,x)}else return Y.unsafe(y,w)}multiplyAndAddUnsafe(w,l,y){let S=this.multiplyUnsafe(l).add(w.multiplyUnsafe(y));return S.is0()?void 0:S}toAffine(w){return j(this,w)}isTorsionFree(){let{isTorsionFree:w}=e;return o===Cl?!0:w?w(M,this):Y.unsafe(this,c).is0()}clearCofactor(){let{clearCofactor:w}=e;return o===Cl?this:w?w(M,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(w=!0){return to(w,"isCompressed"),this.assertValidity(),v(M,this,w)}toHex(w=!0){return Sr(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(w=!0){return this.toBytes(w)}_setWindowSize(w){this.precompute(w)}static normalizeZ(w){return io(M,w)}static msm(w,l){return xl(M,i,w,l)}static fromPrivateKey(w){return M.BASE.multiply(kl(i,w))}}M.BASE=new M(s.Gx,s.Gy,n.ONE),M.ZERO=new M(n.ZERO,n.ONE,n.ZERO),M.Fp=n,M.Fn=i;let W=i.BITS,Y=new wl(M,e.endo?Math.ceil(W/2):W);return M.BASE.precompute(8),M}function wC(t){return Uint8Array.of(t?2:3)}function xC(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function LZ(t,e={}){let{Fn:r}=t,n=e.randomBytes||Qs,i=Object.assign(xC(t.Fp,r),{seed:zE(r.ORDER)});function s(v){try{return!!kl(r,v)}catch{return!1}}function o(v,P){let{publicKey:T,publicKeyUncompressed:k}=i;try{let B=v.length;return P===!0&&B!==T||P===!1&&B!==k?!1:!!t.fromBytes(v)}catch{return!1}}function c(v=n(i.seed)){return kE(jn(v,i.seed,"seed"),r.ORDER)}function u(v,P=!0){return t.BASE.multiply(kl(r,v)).toBytes(P)}function d(v){let P=c(v);return{secretKey:P,publicKey:u(P)}}function f(v){if(typeof v=="bigint")return!1;if(v instanceof t)return!0;let{secretKey:P,publicKey:T,publicKeyUncompressed:k}=i;if(r.allowedLengths||P===T)return;let B=Xe("key",v).length;return B===T||B===k}function m(v,P,T=!0){if(f(v)===!0)throw new Error("first arg must be private key");if(f(P)===!1)throw new Error("second arg must be public key");let k=kl(r,v);return t.fromHex(P).multiply(k).toBytes(T)}return Object.freeze({getPublicKey:u,getSharedSecret:m,keygen:d,Point:t,utils:{isValidSecretKey:s,isValidPublicKey:o,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:v=>kl(r,v),precompute(v=8,P=t.BASE){return P.precompute(v,!1)}},lengths:i})}function DZ(t,e,r={}){Fy(e),Fo(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||Qs,i=r.hmac||((l,...y)=>ww(e,l,Tt(...y))),{Fp:s,Fn:o}=t,{ORDER:c,BITS:u}=o,{keygen:d,getPublicKey:f,getSharedSecret:m,utils:A,lengths:v}=LZ(t,r),P={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},T="compact";function k(l){let y=c>>Cl;return l>y}function B(l,y){if(!o.isValidNot0(y))throw new Error(`invalid signature ${l}: out of range 1..Point.Fn.ORDER`);return y}function D(l,y){Iw(y);let S=v.signature,E=y==="compact"?S:y==="recovered"?S+1:void 0;return jn(l,E,`${y} signature`)}class L{constructor(y,S,E){this.r=B("r",y),this.s=B("s",S),E!=null&&(this.recovery=E),Object.freeze(this)}static fromBytes(y,S=T){D(y,S);let E;if(S==="der"){let{r:I,s:b}=uo.toSig(jn(y));return new L(I,b)}S==="recovered"&&(E=y[0],S="compact",y=y.subarray(1));let x=o.BYTES,O=y.subarray(0,x),C=y.subarray(x,x*2);return new L(o.fromBytes(O),o.fromBytes(C),E)}static fromHex(y,S){return this.fromBytes($i(y),S)}addRecoveryBit(y){return new L(this.r,this.s,y)}recoverPublicKey(y){let S=s.ORDER,{r:E,s:x,recovery:O}=this;if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");if(c*EC<S&&O>1)throw new Error("recovery id is ambiguous for h>1 curve");let I=O===2||O===3?E+c:E;if(!s.isValid(I))throw new Error("recovery id 2 or 3 invalid");let b=s.toBytes(I),R=t.fromBytes(Tt(wC((O&1)===0),b)),re=o.inv(I),te=ee(Xe("msgHash",y)),se=o.create(-te*re),fe=o.create(x*re),Pe=t.BASE.multiplyUnsafe(se).add(R.multiplyUnsafe(fe));if(Pe.is0())throw new Error("point at infinify");return Pe.assertValidity(),Pe}hasHighS(){return k(this.s)}toBytes(y=T){if(Iw(y),y==="der")return $i(uo.hexFromSig(this));let S=o.toBytes(this.r),E=o.toBytes(this.s);if(y==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Tt(Uint8Array.of(this.recovery),S,E)}return Tt(S,E)}toHex(y){return Sr(this.toBytes(y))}assertValidity(){}static fromCompact(y){return L.fromBytes(Xe("sig",y),"compact")}static fromDER(y){return L.fromBytes(Xe("sig",y),"der")}normalizeS(){return this.hasHighS()?new L(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Sr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Sr(this.toBytes("compact"))}}let F=r.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");let S=Sl(y),E=y.length*8-u;return E>0?S>>BigInt(E):S},ee=r.bits2int_modN||function(y){return o.create(F(y))},j=Ko(u);function X(l){return ih("num < 2^"+u,l,lo,j),o.toBytes(l)}function G(l,y){return jn(l,void 0,"message"),y?jn(e(l),void 0,"prehashed message"):l}function M(l,y,S){if(["recovered","canonical"].some(se=>se in S))throw new Error("sign() legacy options not supported");let{lowS:E,prehash:x,extraEntropy:O}=xw(S,P);l=G(l,x);let C=ee(l),I=kl(o,y),b=[X(I),X(C)];if(O!=null&&O!==!1){let se=O===!0?n(v.secretKey):O;b.push(Xe("extraEntropy",se))}let R=Tt(...b),re=C;function te(se){let fe=F(se);if(!o.isValidNot0(fe))return;let Pe=o.inv(fe),Se=t.BASE.multiply(fe).toAffine(),it=o.create(Se.x);if(it===lo)return;let We=o.create(Pe*o.create(re+it*I));if(We===lo)return;let Qe=(Se.x===it?0:2)|Number(Se.y&Cl),Fp=We;return E&&k(We)&&(Fp=o.neg(We),Qe^=1),new L(it,Fp,Qe)}return{seed:R,k2sig:te}}function W(l,y,S={}){l=Xe("message",l);let{seed:E,k2sig:x}=M(l,y,S);return Dz(e.outputLen,o.BYTES,i)(E,x)}function Y(l){let y,S=typeof l=="string"||yn(l),E=!S&&l!==null&&typeof l=="object"&&typeof l.r=="bigint"&&typeof l.s=="bigint";if(!S&&!E)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(E)y=new L(l.r,l.s);else if(S){try{y=L.fromBytes(Xe("sig",l),"der")}catch(x){if(!(x instanceof uo.Err))throw x}if(!y)try{y=L.fromBytes(Xe("sig",l),"compact")}catch{return!1}}return y||!1}function Q(l,y,S,E={}){let{lowS:x,prehash:O,format:C}=xw(E,P);if(S=Xe("publicKey",S),y=G(Xe("message",y),O),"strict"in E)throw new Error("options.strict was renamed to lowS");let I=C===void 0?Y(l):L.fromBytes(Xe("sig",l),C);if(I===!1)return!1;try{let b=t.fromBytes(S);if(x&&I.hasHighS())return!1;let{r:R,s:re}=I,te=ee(y),se=o.inv(re),fe=o.create(te*se),Pe=o.create(R*se),Se=t.BASE.multiplyUnsafe(fe).add(b.multiplyUnsafe(Pe));return Se.is0()?!1:o.create(Se.x)===R}catch{return!1}}function w(l,y,S={}){let{prehash:E}=xw(S,P);return y=G(y,E),L.fromBytes(l,"recovered").recoverPublicKey(y).toBytes()}return Object.freeze({keygen:d,getPublicKey:f,getSharedSecret:m,utils:A,lengths:v,Point:t,sign:W,verify:Q,recoverPublicKey:w,Signature:L,hash:e})}function qZ(t){let e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0,i=Hn(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),s={Fp:r,Fn:i,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:s}}function UZ(t){let{CURVE:e,curveOpts:r}=qZ(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function VZ(t,e){let r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,Qy(r.Fn.ORDER,r.Fn.BITS))})}function IC(t){let{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:i}=UZ(t),s=NZ(e,r),o=DZ(s,n,i);return VZ(t,o)}function PC(t,e){let r=n=>IC({...t,hash:n});return{...r(e),create:r}}var Ow={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},KZ={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var RC=BigInt(2);function FZ(t){let e=Ow.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),c=BigInt(44),u=BigInt(88),d=t*t*t%e,f=d*d*t%e,m=ct(f,r,e)*f%e,A=ct(m,r,e)*f%e,v=ct(A,RC,e)*d%e,P=ct(v,i,e)*v%e,T=ct(P,s,e)*P%e,k=ct(T,c,e)*T%e,B=ct(k,u,e)*k%e,D=ct(B,c,e)*T%e,L=ct(D,r,e)*f%e,F=ct(L,o,e)*P%e,ee=ct(F,n,e)*d%e,j=ct(ee,RC,e);if(!Rw.eql(Rw.sqr(j),t))throw new Error("Cannot find square root");return j}var Rw=Hn(Ow.p,{sqrt:FZ}),K1=PC({...Ow,Fp:Rw,lowS:!0,endo:KZ},Zy);var _ze=Bn.utils.randomPrivateKey,OC=()=>{let t=Bn.utils.randomPrivateKey(),e=qw(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},qw=Bn.getPublicKey;function TC(t){try{return Bn.ExtendedPoint.fromHex(t),!0}catch{return!1}}var Jw=(t,e)=>Bn.sign(t,e.slice(0,32)),WZ=Bn.verify,Le=t=>Ee.Buffer.isBuffer(t)?t:t instanceof Uint8Array?Ee.Buffer.from(t.buffer,t.byteOffset,t.byteLength):Ee.Buffer.from(t),Uw=class{constructor(e){Object.assign(this,e)}encode(){return Ee.Buffer.from((0,Ul.serialize)(j1,this))}static decode(e){return(0,Ul.deserialize)(j1,this,e)}static decodeUnchecked(e){return(0,Ul.deserializeUnchecked)(j1,this,e)}};var j1=new Map,ZC,jZ=32,ea=32;function HZ(t){return t._bn!==void 0}var BC=1,be=class t extends Uw{constructor(e){if(super({}),this._bn=void 0,HZ(e))this._bn=e._bn;else{if(typeof e=="string"){let r=Tr.default.decode(e);if(r.length!=ea)throw new Error("Invalid public key input");this._bn=new Dw.default(r)}else this._bn=new Dw.default(e);if(this._bn.byteLength()>ea)throw new Error("Invalid public key input")}}static unique(){let e=new t(BC);return BC+=1,new t(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return Tr.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(Ee.Buffer);if(e.length===ea)return e;let r=Ee.Buffer.alloc(32);return e.copy(r,32-e.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,r,n){let i=Ee.Buffer.concat([e.toBuffer(),Ee.Buffer.from(r),n.toBuffer()]),s=HE(i);return new t(s)}static createProgramAddressSync(e,r){let n=Ee.Buffer.alloc(0);e.forEach(function(s){if(s.length>jZ)throw new TypeError("Max seed length exceeded");n=Ee.Buffer.concat([n,Le(s)])}),n=Ee.Buffer.concat([n,r.toBuffer(),Ee.Buffer.from("ProgramDerivedAddress")]);let i=HE(n);if(TC(i))throw new Error("Invalid seeds, address must fall off the curve");return new t(i)}static async createProgramAddress(e,r){return this.createProgramAddressSync(e,r)}static findProgramAddressSync(e,r){let n=255,i;for(;n!=0;){try{let s=e.concat(Ee.Buffer.from([n]));i=this.createProgramAddressSync(s,r)}catch(s){if(s instanceof TypeError)throw s;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,r){return this.findProgramAddressSync(e,r)}static isOnCurve(e){let r=new t(e);return TC(r.toBytes())}};ZC=be;be.default=new ZC("11111111111111111111111111111111");j1.set(be,{kind:"struct",fields:[["_bn","u256"]]});var Sze=new be("BPFLoader1111111111111111111111111111111111"),Fc=1232,Qw=127,wh=64,H1=class extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}};Object.defineProperty(H1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var G1=class extends Error{constructor(e,r){super(`Transaction was not confirmed in ${r.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(G1.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Kc=class extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}};Object.defineProperty(Kc.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Nl=class{constructor(e,r){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=r}keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let r of this.keySegments()){if(e<r.length)return r[e];e-=r.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");let n=new Map;this.keySegments().flat().forEach((s,o)=>{n.set(s.toBase58(),o)});let i=s=>{let o=n.get(s.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return e.map(s=>({programIdIndex:i(s.programId),accountKeyIndexes:s.keys.map(o=>i(o.pubkey)),data:s.data}))}},Me=(t="publicKey")=>z.blob(32,t),GZ=(t="signature")=>z.blob(64,t),Ml=(t="string")=>{let e=z.struct([z.u32("length"),z.u32("lengthPadding"),z.blob(z.offset(z.u32(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(s,o)=>r(s,o).chars.toString(),i.encode=(s,o,c)=>{let u={chars:Ee.Buffer.from(s,"utf8")};return n(u,o,c)},i.alloc=s=>z.u32().span+z.u32().span+Ee.Buffer.from(s,"utf8").length,i},$Z=(t="authorized")=>z.struct([Me("staker"),Me("withdrawer")],t),ZZ=(t="lockup")=>z.struct([z.ns64("unixTimestamp"),z.ns64("epoch"),Me("custodian")],t),XZ=(t="voteInit")=>z.struct([Me("nodePubkey"),Me("authorizedVoter"),Me("authorizedWithdrawer"),z.u8("commission")],t),YZ=(t="voteAuthorizeWithSeedArgs")=>z.struct([z.u32("voteAuthorizationType"),Me("currentAuthorityDerivedKeyOwnerPubkey"),Ml("currentAuthorityDerivedKeySeed"),Me("newAuthorized")],t);function XC(t,e){let r=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){let s=e[i.property];if(Array.isArray(s))return s.length*r(i.elementLayout)}else if("fields"in i)return XC({layout:i},e[i.property]);return 0},n=0;return t.layout.fields.forEach(i=>{n+=r(i)}),n}function $n(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(n&127)<<r*7,r+=1,(n&128)===0)break}return e}function Zn(t,e){let r=e;for(;;){let n=r&127;if(r>>=7,r==0){t.push(n);break}else n|=128,t.push(n)}}function Ge(t,e){if(!t)throw new Error(e||"Assertion failed")}var $1=class t{constructor(e,r){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=r}static compile(e,r){let n=new Map,i=o=>{let c=o.toBase58(),u=n.get(c);return u===void 0&&(u={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(c,u)),u},s=i(r);s.isSigner=!0,s.isWritable=!0;for(let o of e){i(o.programId).isInvoked=!0;for(let c of o.keys){let u=i(c.pubkey);u.isSigner||=c.isSigner,u.isWritable||=c.isWritable}}return new t(r,n)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];Ge(e.length<=256,"Max static account keys length exceeded");let r=e.filter(([,u])=>u.isSigner&&u.isWritable),n=e.filter(([,u])=>u.isSigner&&!u.isWritable),i=e.filter(([,u])=>!u.isSigner&&u.isWritable),s=e.filter(([,u])=>!u.isSigner&&!u.isWritable),o={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:s.length};{Ge(r.length>0,"Expected at least one writable signer key");let[u]=r[0];Ge(u===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let c=[...r.map(([u])=>new be(u)),...n.map(([u])=>new be(u)),...i.map(([u])=>new be(u)),...s.map(([u])=>new be(u))];return[o,c]}extractTableLookup(e){let[r,n]=this.drainKeysFoundInLookupTable(e.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[i,s]=this.drainKeysFoundInLookupTable(e.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:s}]}drainKeysFoundInLookupTable(e,r){let n=new Array,i=new Array;for(let[s,o]of this.keyMetaMap.entries())if(r(o)){let c=new be(s),u=e.findIndex(d=>d.equals(c));u>=0&&(Ge(u<256,"Max lookup table index exceeded"),n.push(u),i.push(c),this.keyMetaMap.delete(s))}return[n,i]}},YC="Reached end of buffer unexpectedly";function po(t){if(t.length===0)throw new Error(YC);return t.shift()}function Xn(t,...e){let[r]=e;if(e.length===2?r+(e[1]??0)>t.length:r>=t.length)throw new Error(YC);return t.splice(...e)}var Yi=class t{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(r=>new be(r)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Tr.default.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Nl(this.staticAccountKeys)}static compile(e){let r=$1.compile(e.instructions,e.payerKey),[n,i]=r.getMessageComponents(),o=new Nl(i).compileInstructions(e.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:Tr.default.encode(c.data)}));return new t({header:n,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:o})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){let n=e-r,s=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n<s}else{let n=r-this.header.numReadonlySignedAccounts;return e<n}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,r)=>!this.isProgramId(r))}serialize(){let e=this.accountKeys.length,r=[];Zn(r,e);let n=this.instructions.map(m=>{let{accounts:A,programIdIndex:v}=m,P=Array.from(Tr.default.decode(m.data)),T=[];Zn(T,A.length);let k=[];return Zn(k,P.length),{programIdIndex:v,keyIndicesCount:Ee.Buffer.from(T),keyIndices:A,dataLength:Ee.Buffer.from(k),data:P}}),i=[];Zn(i,n.length);let s=Ee.Buffer.alloc(Fc);Ee.Buffer.from(i).copy(s);let o=i.length;n.forEach(m=>{let v=z.struct([z.u8("programIdIndex"),z.blob(m.keyIndicesCount.length,"keyIndicesCount"),z.seq(z.u8("keyIndex"),m.keyIndices.length,"keyIndices"),z.blob(m.dataLength.length,"dataLength"),z.seq(z.u8("userdatum"),m.data.length,"data")]).encode(m,s,o);o+=v}),s=s.slice(0,o);let c=z.struct([z.blob(1,"numRequiredSignatures"),z.blob(1,"numReadonlySignedAccounts"),z.blob(1,"numReadonlyUnsignedAccounts"),z.blob(r.length,"keyCount"),z.seq(Me("key"),e,"keys"),Me("recentBlockhash")]),u={numRequiredSignatures:Ee.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ee.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ee.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ee.Buffer.from(r),keys:this.accountKeys.map(m=>Le(m.toBytes())),recentBlockhash:Tr.default.decode(this.recentBlockhash)},d=Ee.Buffer.alloc(2048),f=c.encode(u,d);return s.copy(d,f),d.slice(0,f+s.length)}static from(e){let r=[...e],n=po(r);if(n!==(n&Qw))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=po(r),s=po(r),o=$n(r),c=[];for(let A=0;A<o;A++){let v=Xn(r,0,ea);c.push(new be(Ee.Buffer.from(v)))}let u=Xn(r,0,ea),d=$n(r),f=[];for(let A=0;A<d;A++){let v=po(r),P=$n(r),T=Xn(r,0,P),k=$n(r),B=Xn(r,0,k),D=Tr.default.encode(Ee.Buffer.from(B));f.push({programIdIndex:v,accounts:T,data:D})}let m={header:{numRequiredSignatures:n,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:s},recentBlockhash:Tr.default.encode(Ee.Buffer.from(u)),accountKeys:c,instructions:f};return new t(m)}},Wc=class t{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(let r of this.addressTableLookups)e+=r.readonlyIndexes.length+r.writableIndexes.length;return e}getAccountKeys(e){let r;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");r=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)r=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 Nl(this.staticAccountKeys,r)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let r=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){let i=e-n,s=this.addressTableLookups.reduce((o,c)=>o+c.writableIndexes.length,0);return i<s}else if(e>=this.header.numRequiredSignatures){let i=e-r,o=n-r-this.header.numReadonlyUnsignedAccounts;return i<o}else{let i=r-this.header.numReadonlySignedAccounts;return e<i}}resolveAddressTableLookups(e){let r={writable:[],readonly:[]};for(let n of this.addressTableLookups){let i=e.find(s=>s.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(let s of n.writableIndexes)if(s<i.state.addresses.length)r.writable.push(i.state.addresses[s]);else throw new Error(`Failed to find address for index ${s} in address lookup table ${n.accountKey.toBase58()}`);for(let s of n.readonlyIndexes)if(s<i.state.addresses.length)r.readonly.push(i.state.addresses[s]);else throw new Error(`Failed to find address for index ${s} in address lookup table ${n.accountKey.toBase58()}`)}return r}static compile(e){let r=$1.compile(e.instructions,e.payerKey),n=new Array,i={writable:new Array,readonly:new Array},s=e.addressLookupTableAccounts||[];for(let f of s){let m=r.extractTableLookup(f);if(m!==void 0){let[A,{writable:v,readonly:P}]=m;n.push(A),i.writable.push(...v),i.readonly.push(...P)}}let[o,c]=r.getMessageComponents(),d=new Nl(c,i).compileInstructions(e.instructions);return new t({header:o,staticAccountKeys:c,recentBlockhash:e.recentBlockhash,compiledInstructions:d,addressTableLookups:n})}serialize(){let e=Array();Zn(e,this.staticAccountKeys.length);let r=this.serializeInstructions(),n=Array();Zn(n,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),s=Array();Zn(s,this.addressTableLookups.length);let o=z.struct([z.u8("prefix"),z.struct([z.u8("numRequiredSignatures"),z.u8("numReadonlySignedAccounts"),z.u8("numReadonlyUnsignedAccounts")],"header"),z.blob(e.length,"staticAccountKeysLength"),z.seq(Me(),this.staticAccountKeys.length,"staticAccountKeys"),Me("recentBlockhash"),z.blob(n.length,"instructionsLength"),z.blob(r.length,"serializedInstructions"),z.blob(s.length,"addressTableLookupsLength"),z.blob(i.length,"serializedAddressTableLookups")]),c=new Uint8Array(Fc),d=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(f=>f.toBytes()),recentBlockhash:Tr.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(s),serializedAddressTableLookups:i},c);return c.slice(0,d)}serializeInstructions(){let e=0,r=new Uint8Array(Fc);for(let n of this.compiledInstructions){let i=Array();Zn(i,n.accountKeyIndexes.length);let s=Array();Zn(s,n.data.length);let o=z.struct([z.u8("programIdIndex"),z.blob(i.length,"encodedAccountKeyIndexesLength"),z.seq(z.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),z.blob(s.length,"encodedDataLength"),z.blob(n.data.length,"data")]);e+=o.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(s),data:n.data},r,e)}return r.slice(0,e)}serializeAddressTableLookups(){let e=0,r=new Uint8Array(Fc);for(let n of this.addressTableLookups){let i=Array();Zn(i,n.writableIndexes.length);let s=Array();Zn(s,n.readonlyIndexes.length);let o=z.struct([Me("accountKey"),z.blob(i.length,"encodedWritableIndexesLength"),z.seq(z.u8(),n.writableIndexes.length,"writableIndexes"),z.blob(s.length,"encodedReadonlyIndexesLength"),z.seq(z.u8(),n.readonlyIndexes.length,"readonlyIndexes")]);e+=o.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(s),readonlyIndexes:n.readonlyIndexes},r,e)}return r.slice(0,e)}static deserialize(e){let r=[...e],n=po(r),i=n&Qw;Ge(n!==i,"Expected versioned message but received legacy message");let s=i;Ge(s===0,`Expected versioned message with version 0 but found version ${s}`);let o={numRequiredSignatures:po(r),numReadonlySignedAccounts:po(r),numReadonlyUnsignedAccounts:po(r)},c=[],u=$n(r);for(let P=0;P<u;P++)c.push(new be(Xn(r,0,ea)));let d=Tr.default.encode(Xn(r,0,ea)),f=$n(r),m=[];for(let P=0;P<f;P++){let T=po(r),k=$n(r),B=Xn(r,0,k),D=$n(r),L=new Uint8Array(Xn(r,0,D));m.push({programIdIndex:T,accountKeyIndexes:B,data:L})}let A=$n(r),v=[];for(let P=0;P<A;P++){let T=new be(Xn(r,0,ea)),k=$n(r),B=Xn(r,0,k),D=$n(r),L=Xn(r,0,D);v.push({accountKey:T,writableIndexes:B,readonlyIndexes:L})}return new t({header:o,staticAccountKeys:c,recentBlockhash:d,compiledInstructions:m,addressTableLookups:v})}},JC={deserializeMessageVersion(t){let e=t[0],r=e&Qw;return r===e?"legacy":r},deserialize:t=>{let e=JC.deserializeMessageVersion(t);if(e==="legacy")return Yi.from(t);if(e===0)return Wc.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}},Jo=(function(t){return t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID",t})({}),JZ=Ee.Buffer.alloc(wh).fill(0),Ze=class{constructor(e){this.keys=void 0,this.programId=void 0,this.data=Ee.Buffer.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:r,isWritable:n})=>({pubkey:e.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}},Ke=class t{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")){let{minContextSlot:r,nonceInfo:n}=e;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){let{blockhash:r,lastValidBlockHeight:n}=e;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{let{recentBlockhash:r,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new Ze(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,r;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(e=this.recentBlockhash,r=this.instructions),!e)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let T=0;T<r.length;T++)if(r[T].programId===void 0)throw new Error(`Transaction instruction index ${T} has undefined program id`);let i=[],s=[];r.forEach(T=>{T.keys.forEach(B=>{s.push({...B})});let k=T.programId.toString();i.includes(k)||i.push(k)}),i.forEach(T=>{s.push({pubkey:new be(T),isSigner:!1,isWritable:!1})});let o=[];s.forEach(T=>{let k=T.pubkey.toString(),B=o.findIndex(D=>D.pubkey.toString()===k);B>-1?(o[B].isWritable=o[B].isWritable||T.isWritable,o[B].isSigner=o[B].isSigner||T.isSigner):o.push(T)}),o.sort(function(T,k){if(T.isSigner!==k.isSigner)return T.isSigner?-1:1;if(T.isWritable!==k.isWritable)return T.isWritable?-1:1;let B={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return T.pubkey.toBase58().localeCompare(k.pubkey.toBase58(),"en",B)});let c=o.findIndex(T=>T.pubkey.equals(n));if(c>-1){let[T]=o.splice(c,1);T.isSigner=!0,T.isWritable=!0,o.unshift(T)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(let T of this.signatures){let k=o.findIndex(B=>B.pubkey.equals(T.publicKey));if(k>-1)o[k].isSigner||(o[k].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."));else throw new Error(`unknown signer: ${T.publicKey.toString()}`)}let u=0,d=0,f=0,m=[],A=[];o.forEach(({pubkey:T,isSigner:k,isWritable:B})=>{k?(m.push(T.toString()),u+=1,B||(d+=1)):(A.push(T.toString()),B||(f+=1))});let v=m.concat(A),P=r.map(T=>{let{data:k,programId:B}=T;return{programIdIndex:v.indexOf(B.toString()),accounts:T.keys.map(D=>v.indexOf(D.pubkey.toString())),data:Tr.default.encode(k)}});return P.forEach(T=>{Ge(T.programIdIndex>=0),T.accounts.forEach(k=>Ge(k>=0))}),new Yi({header:{numRequiredSignatures:u,numReadonlySignedAccounts:d,numReadonlyUnsignedAccounts:f},accountKeys:v,recentBlockhash:e,instructions:P})}_compile(){let e=this.compileMessage(),r=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,s)=>r[s].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");let r=new Set;this.signatures=e.filter(n=>{let i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let s of e){let o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}this.signatures=n.map(s=>({signature:null,publicKey:s.publicKey}));let i=this._compile();this._partialSign(i,...n)}partialSign(...e){if(e.length===0)throw new Error("No signers");let r=new Set,n=[];for(let s of e){let o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}let i=this._compile();this._partialSign(i,...n)}_partialSign(e,...r){let n=e.serialize();r.forEach(i=>{let s=Jw(n,i.secretKey);this._addSignature(i.publicKey,Le(s))})}addSignature(e,r){this._compile(),this._addSignature(e,r)}_addSignature(e,r){Ge(r.length===64);let n=this.signatures.findIndex(i=>e.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=Ee.Buffer.from(r)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,r){let n={};for(let{signature:i,publicKey:s}of this.signatures)i===null?r&&(n.missing||=[]).push(s):WZ(i,e,s.toBytes())||(n.invalid||=[]).push(s);return n.invalid||n.missing?n:void 0}serialize(e){let{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(n){let s=this._getMessageSignednessErrors(i,r);if(s){let o="Signature verification failed.";throw s.invalid&&(o+=`
Invalid signature for public key${s.invalid.length===1?"":"(s)"} [\`${s.invalid.map(c=>c.toBase58()).join("`, `")}\`].`),s.missing&&(o+=`
-Missing signature for public key${s.missing.length===1?"":"(s)"} [\`${s.missing.map(c=>c.toBase58()).join("`, `")}\`].`),new Error(o)}}return this._serialize(i)}_serialize(e){let{signatures:r}=this,n=[];Bn(n,r.length);let i=n.length+r.length*64+e.length,s=ve.Buffer.alloc(i);return Ke(r.length<256),ve.Buffer.from(n).copy(s,0),r.forEach(({signature:o},c)=>{o!==null&&(Ke(o.length===64,"signature has invalid length"),ve.Buffer.from(o).copy(s,n.length+c*64))}),e.copy(s,n.length+r.length*64),Ke(s.length<=Ga,`Transaction too large: ${s.length} > ${Ga}`),s}get keys(){return Ke(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Ke(this.instructions.length===1),this.instructions[0].programId}get data(){return Ke(this.instructions.length===1),this.instructions[0].data}static from(e){let r=[...e],n=On(r),i=[];for(let s=0;s<n;s++){let o=Tn(r,0,Sf);i.push(mr.default.encode(ve.Buffer.from(o)))}return t.populate(vi.from(r),i)}static populate(e,r=[]){let n=new t;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),r.forEach((i,s)=>{let o={signature:i==mr.default.encode(QW)?null:mr.default.decode(i),publicKey:e.accountKeys[s]};n.signatures.push(o)}),e.instructions.forEach(i=>{let s=i.accounts.map(o=>{let c=e.accountKeys[o];return{pubkey:c,isSigner:n.signatures.some(u=>u.publicKey.toString()===c.toString())||e.isAccountSigner(o),isWritable:e.isAccountWritable(o)}});n.instructions.push(new je({keys:s,programId:e.accountKeys[i.programIdIndex],data:mr.default.decode(i.data)}))}),n._message=e,n._json=n.toJSON(),n}};var go=class t{get version(){return this.message.version}constructor(e,r){if(this.signatures=void 0,this.message=void 0,r!==void 0)Ke(r.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{let n=[];for(let i=0;i<e.header.numRequiredSignatures;i++)n.push(new Uint8Array(Sf));this.signatures=n}this.message=e}serialize(){let e=this.message.serialize(),r=Array();Bn(r,this.signatures.length);let n=z.struct([z.blob(r.length,"encodedSignaturesLength"),z.seq($W(),this.signatures.length,"signatures"),z.blob(e.length,"serializedMessage")]),i=new Uint8Array(2048),s=n.encode({encodedSignaturesLength:new Uint8Array(r),signatures:this.signatures,serializedMessage:e},i);return i.slice(0,s)}static deserialize(e){let r=[...e],n=[],i=On(r);for(let o=0;o<i;o++)n.push(new Uint8Array(Tn(r,0,Sf)));let s=$B.deserialize(new Uint8Array(r));return new t(s,n)}sign(e){let r=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of e){let s=n.findIndex(o=>o.equals(i.publicKey));Ke(s>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[s]=xS(r,i.secretKey)}}addSignature(e,r){Ke(r.byteLength===64,"Signature must be 64 bytes long");let i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(e));Ke(i>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}},ej=160,tj=64,rj=ej/tj,ZB=1e3/rj,Rs=new be("SysvarC1ock11111111111111111111111111111111"),nSe=new be("SysvarEpochSchedu1e111111111111111111111111"),iSe=new be("Sysvar1nstructions1111111111111111111111111"),nS=new be("SysvarRecentB1ockHashes11111111111111111111"),vf=new be("SysvarRent111111111111111111111111111111111"),sSe=new be("SysvarRewards111111111111111111111111111111"),oSe=new be("SysvarS1otHashes111111111111111111111111111"),aSe=new be("SysvarS1otHistory11111111111111111111111111"),iS=new be("SysvarStakeHistory1111111111111111111111111"),Ef=class extends Error{constructor({action:e,signature:r,transactionMessage:n,logs:i}){let s=i?`Logs:
+Missing signature for public key${s.missing.length===1?"":"(s)"} [\`${s.missing.map(c=>c.toBase58()).join("`, `")}\`].`),new Error(o)}}return this._serialize(i)}_serialize(e){let{signatures:r}=this,n=[];Zn(n,r.length);let i=n.length+r.length*64+e.length,s=Ee.Buffer.alloc(i);return Ge(r.length<256),Ee.Buffer.from(n).copy(s,0),r.forEach(({signature:o},c)=>{o!==null&&(Ge(o.length===64,"signature has invalid length"),Ee.Buffer.from(o).copy(s,n.length+c*64))}),e.copy(s,n.length+r.length*64),Ge(s.length<=Fc,`Transaction too large: ${s.length} > ${Fc}`),s}get keys(){return Ge(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Ge(this.instructions.length===1),this.instructions[0].programId}get data(){return Ge(this.instructions.length===1),this.instructions[0].data}static from(e){let r=[...e],n=$n(r),i=[];for(let s=0;s<n;s++){let o=Xn(r,0,wh);i.push(Tr.default.encode(Ee.Buffer.from(o)))}return t.populate(Yi.from(r),i)}static populate(e,r=[]){let n=new t;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),r.forEach((i,s)=>{let o={signature:i==Tr.default.encode(JZ)?null:Tr.default.decode(i),publicKey:e.accountKeys[s]};n.signatures.push(o)}),e.instructions.forEach(i=>{let s=i.accounts.map(o=>{let c=e.accountKeys[o];return{pubkey:c,isSigner:n.signatures.some(u=>u.publicKey.toString()===c.toString())||e.isAccountSigner(o),isWritable:e.isAccountWritable(o)}});n.instructions.push(new Ze({keys:s,programId:e.accountKeys[i.programIdIndex],data:Tr.default.decode(i.data)}))}),n._message=e,n._json=n.toJSON(),n}};var ta=class t{get version(){return this.message.version}constructor(e,r){if(this.signatures=void 0,this.message=void 0,r!==void 0)Ge(r.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{let n=[];for(let i=0;i<e.header.numRequiredSignatures;i++)n.push(new Uint8Array(wh));this.signatures=n}this.message=e}serialize(){let e=this.message.serialize(),r=Array();Zn(r,this.signatures.length);let n=z.struct([z.blob(r.length,"encodedSignaturesLength"),z.seq(GZ(),this.signatures.length,"signatures"),z.blob(e.length,"serializedMessage")]),i=new Uint8Array(2048),s=n.encode({encodedSignaturesLength:new Uint8Array(r),signatures:this.signatures,serializedMessage:e},i);return i.slice(0,s)}static deserialize(e){let r=[...e],n=[],i=$n(r);for(let o=0;o<i;o++)n.push(new Uint8Array(Xn(r,0,wh)));let s=JC.deserialize(new Uint8Array(r));return new t(s,n)}sign(e){let r=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of e){let s=n.findIndex(o=>o.equals(i.publicKey));Ge(s>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[s]=Jw(r,i.secretKey)}}addSignature(e,r){Ge(r.byteLength===64,"Signature must be 64 bytes long");let i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(e));Ge(i>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}},QZ=160,eX=64,tX=QZ/eX,QC=1e3/tX,fo=new be("SysvarC1ock11111111111111111111111111111111"),vze=new be("SysvarEpochSchedu1e111111111111111111111111"),Eze=new be("Sysvar1nstructions1111111111111111111111111"),Tw=new be("SysvarRecentB1ockHashes11111111111111111111"),xh=new be("SysvarRent111111111111111111111111111111111"),wze=new be("SysvarRewards111111111111111111111111111111"),xze=new be("SysvarS1otHashes111111111111111111111111111"),Ize=new be("SysvarS1otHistory11111111111111111111111111"),Bw=new be("SysvarStakeHistory1111111111111111111111111"),Ih=class extends Error{constructor({action:e,signature:r,transactionMessage:n,logs:i}){let s=i?`Logs:
${JSON.stringify(i.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",c;switch(e){case"send":c=`Transaction ${r} resulted in an error.
${n}. `+s+o;break;case"simulate":c=`Simulation failed.
Message: ${n}.
-`+s+o;break;default:c=`Unknown action '${(u=>u)(e)}'`}super(c),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=r,this.transactionMessage=n,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let e=this.transactionLogs;if(!(e!=null&&typeof e=="object"&&"then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((r,n)=>{e.getTransaction(this.signature).then(i=>{if(i&&i.meta&&i.meta.logMessages){let s=i.meta.logMessages;this.transactionLogs=s,r(s)}else n(new Error("Log messages not found"))}).catch(n)})),await this.transactionLogs}};var he=class extends Error{constructor({code:e,message:r,data:n},i){super(i!=null?`${i}: ${r}`:r),this.code=void 0,this.data=void 0,this.code=e,this.data=n,this.name="SolanaJSONRPCError"}};async function RB(t,e,r,n){let i=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},s=await t.sendTransaction(e,r,i),o;if(e.recentBlockhash!=null&&e.lastValidBlockHeight!=null)o=(await t.confirmTransaction({abortSignal:n?.abortSignal,signature:s,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},n&&n.commitment)).value;else if(e.minNonceContextSlot!=null&&e.nonceInfo!=null){let{nonceInstruction:c}=e.nonceInfo,u=c.keys[0].pubkey;o=(await t.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:u,nonceValue:e.nonceInfo.nonce,signature:s},n&&n.commitment)).value}else n?.abortSignal!=null&&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."),o=(await t.confirmTransaction(s,n&&n.commitment)).value;if(o.err)throw s!=null?new Ef({action:"send",signature:s,transactionMessage:`Status: (${JSON.stringify(o)})`}):new Error(`Transaction ${s} failed (${JSON.stringify(o)})`);return s}function ja(t){return new Promise(e=>setTimeout(e,t))}function Ne(t,e){let r=t.layout.span>=0?t.layout.span:HB(t,e),n=ve.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}var nj=z.nu64("lamportsPerSignature"),YB=z.struct([z.u32("version"),z.u32("state"),Te("authorizedPubkey"),Te("nonce"),z.struct([nj],"feeCalculator")]),OB=YB.span,pS=class t{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){let r=YB.decode(ke(e),0);return new t({authorizedPubkey:new be(r.authorizedPubkey),nonce:new be(r.nonce).toString(),feeCalculator:r.feeCalculator})}};function Nu(t){let e=(0,KB.blob)(8,t),r=e.decode.bind(e),n=e.encode.bind(e),i=e,s=zO();return i.decode=(o,c)=>{let u=r(o,c);return s.decode(u)},i.encode=(o,c,u)=>{let d=s.encode(o);return n(d,c,u)},i}var jn=Object.freeze({Create:{index:0,layout:z.struct([z.u32("instruction"),z.ns64("lamports"),z.ns64("space"),Te("programId")])},Assign:{index:1,layout:z.struct([z.u32("instruction"),Te("programId")])},Transfer:{index:2,layout:z.struct([z.u32("instruction"),Nu("lamports")])},CreateWithSeed:{index:3,layout:z.struct([z.u32("instruction"),Te("base"),ku("seed"),z.ns64("lamports"),z.ns64("space"),Te("programId")])},AdvanceNonceAccount:{index:4,layout:z.struct([z.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:z.struct([z.u32("instruction"),Te("authorized")])},AuthorizeNonceAccount:{index:7,layout:z.struct([z.u32("instruction"),Te("authorized")])},Allocate:{index:8,layout:z.struct([z.u32("instruction"),z.ns64("space")])},AllocateWithSeed:{index:9,layout:z.struct([z.u32("instruction"),Te("base"),ku("seed"),z.ns64("space"),Te("programId")])},AssignWithSeed:{index:10,layout:z.struct([z.u32("instruction"),Te("base"),ku("seed"),Te("programId")])},TransferWithSeed:{index:11,layout:z.struct([z.u32("instruction"),Nu("lamports"),ku("seed"),Te("programId")])},UpgradeNonceAccount:{index:12,layout:z.struct([z.u32("instruction")])}}),nn=class t{constructor(){}static createAccount(e){let r=jn.Create,n=Ne(r,{lamports:e.lamports,space:e.space,programId:ke(e.programId.toBuffer())});return new je({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:n})}static transfer(e){let r,n;if("basePubkey"in e){let i=jn.TransferWithSeed;r=Ne(i,{lamports:BigInt(e.lamports),seed:e.seed,programId:ke(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}]}else{let i=jn.Transfer;r=Ne(i,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new je({keys:n,programId:this.programId,data:r})}static assign(e){let r,n;if("basePubkey"in e){let i=jn.AssignWithSeed;r=Ne(i,{base:ke(e.basePubkey.toBuffer()),seed:e.seed,programId:ke(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=jn.Assign;r=Ne(i,{programId:ke(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new je({keys:n,programId:this.programId,data:r})}static createAccountWithSeed(e){let r=jn.CreateWithSeed,n=Ne(r,{base:ke(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:ke(e.programId.toBuffer())}),i=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||i.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new je({keys:i,programId:this.programId,data:n})}static createNonceAccount(e){let r=new De;"basePubkey"in e&&"seed"in e?r.add(t.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:OB,programId:this.programId})):r.add(t.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:OB,programId:this.programId}));let n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return r.add(this.nonceInitialize(n)),r}static nonceInitialize(e){let r=jn.InitializeNonceAccount,n=Ne(r,{authorized:ke(e.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:nS,isSigner:!1,isWritable:!1},{pubkey:vf,isSigner:!1,isWritable:!1}],programId:this.programId,data:n};return new je(i)}static nonceAdvance(e){let r=jn.AdvanceNonceAccount,n=Ne(r),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:nS,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n};return new je(i)}static nonceWithdraw(e){let r=jn.WithdrawNonceAccount,n=Ne(r,{lamports:e.lamports});return new je({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:nS,isSigner:!1,isWritable:!1},{pubkey:vf,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static nonceAuthorize(e){let r=jn.AuthorizeNonceAccount,n=Ne(r,{authorized:ke(e.newAuthorizedPubkey.toBuffer())});return new je({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static allocate(e){let r,n;if("basePubkey"in e){let i=jn.AllocateWithSeed;r=Ne(i,{base:ke(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:ke(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=jn.Allocate;r=Ne(i,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new je({keys:n,programId:this.programId,data:r})}};nn.programId=new be("11111111111111111111111111111111");var ij=Ga-300,gS=class t{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/t.chunkSize)+1+1)}static async load(e,r,n,i,s){{let m=await e.getMinimumBalanceForRentExemption(s.length),_=await e.getAccountInfo(n.publicKey,"confirmed"),v=null;if(_!==null){if(_.executable)return console.error("Program load failed, account is already executable"),!1;_.data.length!==s.length&&(v=v||new De,v.add(nn.allocate({accountPubkey:n.publicKey,space:s.length}))),_.owner.equals(i)||(v=v||new De,v.add(nn.assign({accountPubkey:n.publicKey,programId:i}))),_.lamports<m&&(v=v||new De,v.add(nn.transfer({fromPubkey:r.publicKey,toPubkey:n.publicKey,lamports:m-_.lamports})))}else v=new De().add(nn.createAccount({fromPubkey:r.publicKey,newAccountPubkey:n.publicKey,lamports:m>0?m:1,space:s.length,programId:i}));v!==null&&await RB(e,v,[r,n],{commitment:"confirmed"})}let o=z.struct([z.u32("instruction"),z.u32("offset"),z.u32("bytesLength"),z.u32("bytesLengthPadding"),z.seq(z.u8("byte"),z.offset(z.u32(),-8),"bytes")]),c=t.chunkSize,u=0,d=s,f=[];for(;d.length>0;){let m=d.slice(0,c),_=ve.Buffer.alloc(c+16);o.encode({instruction:0,offset:u,bytes:m,bytesLength:0,bytesLengthPadding:0},_);let v=new De().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:_});f.push(RB(e,v,[r,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await ja(1e3/4),u+=c,d=d.slice(c)}await Promise.all(f);{let m=z.struct([z.u32("instruction")]),_=ve.Buffer.alloc(m.span);m.encode({instruction:1},_);let v=new De().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:vf,isSigner:!1,isWritable:!1}],programId:i,data:_}),P="processed",B=await e.sendTransaction(v,[r,n],{preflightCommitment:P}),{context:k,value:T}=await e.confirmTransaction({signature:B,lastValidBlockHeight:v.lastValidBlockHeight,blockhash:v.recentBlockhash},P);if(T.err)throw new Error(`Transaction ${B} failed (${JSON.stringify(T)})`);for(;;){try{if(await e.getSlot({commitment:P})>k.slot)break}catch{}await new Promise(L=>setTimeout(L,Math.round(ZB/2)))}}return!0}};gS.chunkSize=ij;var cSe=new be("BPFLoader2111111111111111111111111111111111");function sj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sS,BB;function oj(){if(BB)return sS;BB=1;var t=Object.prototype.toString,e=Object.keys||function(n){var i=[];for(var s in n)i.push(s);return i};function r(n,i){var s,o,c,u,d,f,m;if(n===!0)return"true";if(n===!1)return"false";switch(typeof n){case"object":if(n===null)return null;if(n.toJSON&&typeof n.toJSON=="function")return r(n.toJSON(),i);if(m=t.call(n),m==="[object Array]"){for(c="[",o=n.length-1,s=0;s<o;s++)c+=r(n[s],!0)+",";return o>-1&&(c+=r(n[s],!0)),c+"]"}else if(m==="[object Object]"){for(u=e(n).sort(),o=u.length,c="",s=0;s<o;)d=u[s],f=r(n[d],!1),f!==void 0&&(c&&(c+=","),c+=JSON.stringify(d)+":"+f),s++;return"{"+c+"}"}else return JSON.stringify(n);case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(n);default:return isFinite(n)?n:null}}return sS=function(n){var i=r(n,!1);if(i!==void 0)return""+i},sS}var aj=oj(),TB=sj(aj),bf=32;function oS(t){let e=0;for(;t>1;)t/=2,e++;return e}function cj(t){return t===0?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t|=t>>32,t+1)}var yS=class{constructor(e,r,n,i,s){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=r,this.warmup=n,this.firstNormalEpoch=i,this.firstNormalSlot=s}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){let r=oS(cj(e+bf+1))-oS(bf)-1,n=this.getSlotsInEpoch(r),i=e-(n-bf);return[r,i]}else{let r=e-this.firstNormalSlot,n=Math.floor(r/this.slotsPerEpoch),i=this.firstNormalEpoch+n,s=r%this.slotsPerEpoch;return[i,s]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*bf:(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+oS(bf)):this.slotsPerEpoch}},uj=globalThis.fetch,mS=class extends dB{constructor(e,r,n){let i=s=>{let o=lB(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...r});return"socket"in o?this.underlyingSocket=o.socket:this.underlyingSocket=o,o};super(i,e,r,n),this.underlyingSocket=void 0}call(...e){let r=this.underlyingSocket?.readyState;return r===1?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 "+r+")"))}notify(...e){let r=this.underlyingSocket?.readyState;return r===1?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 "+r+")"))}};function lj(t,e){let r;try{r=t.layout.decode(e)}catch(n){throw new Error("invalid instruction; "+n)}if(r.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}var zB=56,Mu=class{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){let e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){let r=lj(dj,e),n=e.length-zB;Ke(n>=0,"lookup table is invalid"),Ke(n%32===0,"lookup table is invalid");let i=n/32,{addresses:s}=z.struct([z.seq(Te(),i,"addresses")]).decode(e.slice(zB));return{deactivationSlot:r.deactivationSlot,lastExtendedSlot:r.lastExtendedSlot,lastExtendedSlotStartIndex:r.lastExtendedStartIndex,authority:r.authority.length!==0?new be(r.authority[0]):void 0,addresses:s.map(o=>new be(o))}}},dj={index:1,layout:z.struct([z.u32("typeIndex"),Nu("deactivationSlot"),z.nu64("lastExtendedSlot"),z.u8("lastExtendedStartIndex"),z.u8(),z.seq(Te(),z.offset(z.u8(),-1),"authority")])},fj=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function hj(t){let e=t.match(fj);if(e==null)throw TypeError(`Failed to validate endpoint URL \`${t}\``);let[r,n,i,s]=e,o=t.startsWith("https:")?"wss:":"ws:",c=i==null?null:parseInt(i.slice(1),10),u=c==null?"":`:${c+1}`;return`${o}//${n}${u}${s}`}var gt=Bu(D0(be),ne(),t=>new be(t)),XB=q0([ne(),it("base64")]),PS=Bu(D0(ve.Buffer),XB,t=>ve.Buffer.from(t[0],"base64")),pj=30*1e3;function gj(t){if(/^https?:/.test(t)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}function Xe(t){let e,r;if(typeof t=="string")e=t;else if(t){let{commitment:n,...i}=t;e=n,r=i}return{commitment:e,config:r}}function kB(t){return t.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function JB(t){return qr([X({jsonrpc:it("2.0"),id:ne(),result:t}),X({jsonrpc:it("2.0"),id:ne(),error:X({code:Wa(),message:ne(),data:me(MO())})})])}var yj=JB(Wa());function Oe(t){return Bu(JB(t),yj,e=>"error"in e?e:{...e,result:se(e.result,t)})}function Et(t){return Oe(X({context:X({slot:D()}),value:t}))}function sy(t){return X({context:X({slot:D()}),value:t})}function aS(t,e){return t===0?new $a({header:e.header,staticAccountKeys:e.accountKeys.map(r=>new be(r)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(r=>({programIdIndex:r.programIdIndex,accountKeyIndexes:r.accounts,data:mr.default.decode(r.data)})),addressTableLookups:e.addressTableLookups}):new vi(e)}var mj=X({foundation:D(),foundationTerm:D(),initial:D(),taper:D(),terminal:D()}),bj=Oe(ce(ue(X({epoch:D(),effectiveSlot:D(),amount:D(),postBalance:D(),commission:me(ue(D()))})))),_j=ce(X({slot:D(),prioritizationFee:D()})),Aj=X({total:D(),validator:D(),foundation:D(),epoch:D()}),Sj=X({epoch:D(),slotIndex:D(),slotsInEpoch:D(),absoluteSlot:D(),blockHeight:me(D()),transactionCount:me(D())}),vj=X({slotsPerEpoch:D(),leaderScheduleSlotOffset:D(),warmup:Si(),firstNormalEpoch:D(),firstNormalSlot:D()}),Ej=DA(ne(),ce(D())),Za=ue(qr([X({}),ne()])),wj=X({err:Za}),xj=it("receivedSignature"),Ij=X({"solana-core":ne(),"feature-set":me(D())}),Pj=X({program:ne(),programId:gt,parsed:Wa()}),Rj=X({programId:gt,accounts:ce(gt),data:ne()}),CB=Et(X({err:ue(qr([X({}),ne()])),logs:ue(ce(ne())),accounts:me(ue(ce(ue(X({executable:Si(),owner:ne(),lamports:D(),data:ce(ne()),rentEpoch:me(D())}))))),unitsConsumed:me(D()),returnData:me(ue(X({programId:ne(),data:q0([ne(),it("base64")])}))),innerInstructions:me(ue(ce(X({index:D(),instructions:ce(qr([Pj,Rj]))}))))})),Oj=Et(X({byIdentity:DA(ne(),ce(D())),range:X({firstSlot:D(),lastSlot:D()})}));function Bj(t,e,r,n,i,s){let o=r||uj,c;s!=null&&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.");let u;return n&&(u=async(f,m)=>{let _=await new Promise((v,P)=>{try{n(f,m,(B,k)=>v([B,k]))}catch(B){P(B)}});return await o(..._)}),new WB.default(async(f,m)=>{let _={method:"POST",body:f,agent:c,headers:Object.assign({"Content-Type":"application/json"},e||{},BH)};try{let v=5,P,B=500;for(;u?P=await u(t,_):P=await o(t,_),!(P.status!==429||i===!0||(v-=1,v===0));)console.error(`Server responded with ${P.status} ${P.statusText}. Retrying after ${B}ms delay...`),await ja(B),B*=2;let k=await P.text();P.ok?m(null,k):m(new Error(`${P.status} ${P.statusText}: ${k}`))}catch(v){v instanceof Error&&m(v)}},{})}function Tj(t){return(e,r)=>new Promise((n,i)=>{t.request(e,r,(s,o)=>{if(s){i(s);return}n(o)})})}function zj(t){return e=>new Promise((r,n)=>{e.length===0&&r([]);let i=e.map(s=>t.request(s.methodName,s.args));t.request(i,(s,o)=>{if(s){n(s);return}r(o)})})}var kj=Oe(mj),Cj=Oe(Aj),Nj=Oe(_j),Mj=Oe(Sj),Lj=Oe(vj),Dj=Oe(Ej),qj=Oe(D()),Uj=Et(X({total:D(),circulating:D(),nonCirculating:D(),nonCirculatingAccounts:ce(gt)})),bS=X({amount:ne(),uiAmount:ue(D()),decimals:D(),uiAmountString:me(ne())}),Vj=Et(ce(X({address:gt,amount:ne(),uiAmount:ue(D()),decimals:D(),uiAmountString:me(ne())}))),Fj=Et(ce(X({pubkey:gt,account:X({executable:Si(),owner:gt,lamports:D(),data:PS,rentEpoch:D()})}))),_S=X({program:ne(),parsed:Wa(),space:D()}),Kj=Et(ce(X({pubkey:gt,account:X({executable:Si(),owner:gt,lamports:D(),data:_S,rentEpoch:D()})}))),Wj=Et(ce(X({lamports:D(),address:gt}))),wf=X({executable:Si(),owner:gt,lamports:D(),data:PS,rentEpoch:D()}),jj=X({pubkey:gt,account:wf}),Hj=Bu(qr([D0(ve.Buffer),_S]),qr([XB,_S]),t=>Array.isArray(t)?se(t,PS):t),AS=X({executable:Si(),owner:gt,lamports:D(),data:Hj,rentEpoch:D()}),Gj=X({pubkey:gt,account:AS}),$j=X({state:qr([it("active"),it("inactive"),it("activating"),it("deactivating")]),active:D(),inactive:D()}),Zj=Oe(ce(X({signature:ne(),slot:D(),err:Za,memo:ue(ne()),blockTime:me(ue(D()))}))),Yj=Oe(ce(X({signature:ne(),slot:D(),err:Za,memo:ue(ne()),blockTime:me(ue(D()))}))),Xj=X({subscription:D(),result:sy(wf)}),Jj=X({pubkey:gt,account:wf}),Qj=X({subscription:D(),result:sy(Jj)}),eH=X({parent:D(),slot:D(),root:D()}),tH=X({subscription:D(),result:eH}),rH=qr([X({type:qr([it("firstShredReceived"),it("completed"),it("optimisticConfirmation"),it("root")]),slot:D(),timestamp:D()}),X({type:it("createdBank"),parent:D(),slot:D(),timestamp:D()}),X({type:it("frozen"),slot:D(),timestamp:D(),stats:X({numTransactionEntries:D(),numSuccessfulTransactions:D(),numFailedTransactions:D(),maxTransactionsPerEntry:D()})}),X({type:it("dead"),slot:D(),timestamp:D(),err:ne()})]),nH=X({subscription:D(),result:rH}),iH=X({subscription:D(),result:sy(qr([wj,xj]))}),sH=X({subscription:D(),result:D()}),oH=X({pubkey:ne(),gossip:ue(ne()),tpu:ue(ne()),rpc:ue(ne()),version:ue(ne())}),NB=X({votePubkey:ne(),nodePubkey:ne(),activatedStake:D(),epochVoteAccount:Si(),epochCredits:ce(q0([D(),D(),D()])),commission:D(),lastVote:D(),rootSlot:ue(D())}),aH=Oe(X({current:ce(NB),delinquent:ce(NB)})),cH=qr([it("processed"),it("confirmed"),it("finalized")]),uH=X({slot:D(),confirmations:ue(D()),err:Za,confirmationStatus:me(cH)}),lH=Et(ce(ue(uH))),dH=Oe(D()),QB=X({accountKey:gt,writableIndexes:ce(D()),readonlyIndexes:ce(D())}),RS=X({signatures:ce(ne()),message:X({accountKeys:ce(ne()),header:X({numRequiredSignatures:D(),numReadonlySignedAccounts:D(),numReadonlyUnsignedAccounts:D()}),instructions:ce(X({accounts:ce(D()),data:ne(),programIdIndex:D()})),recentBlockhash:ne(),addressTableLookups:me(ce(QB))})}),eT=X({pubkey:gt,signer:Si(),writable:Si(),source:me(qr([it("transaction"),it("lookupTable")]))}),tT=X({accountKeys:ce(eT),signatures:ce(ne())}),rT=X({parsed:Wa(),program:ne(),programId:gt}),nT=X({accounts:ce(gt),data:ne(),programId:gt}),fH=qr([nT,rT]),hH=qr([X({parsed:Wa(),program:ne(),programId:ne()}),X({accounts:ce(ne()),data:ne(),programId:ne()})]),iT=Bu(fH,hH,t=>"accounts"in t?se(t,nT):se(t,rT)),sT=X({signatures:ce(ne()),message:X({accountKeys:ce(eT),instructions:ce(iT),recentBlockhash:ne(),addressTableLookups:me(ue(ce(QB)))})}),ry=X({accountIndex:D(),mint:ne(),owner:me(ne()),programId:me(ne()),uiTokenAmount:bS}),oT=X({writable:ce(gt),readonly:ce(gt)}),oy=X({err:Za,fee:D(),innerInstructions:me(ue(ce(X({index:D(),instructions:ce(X({accounts:ce(D()),data:ne(),programIdIndex:D()}))})))),preBalances:ce(D()),postBalances:ce(D()),logMessages:me(ue(ce(ne()))),preTokenBalances:me(ue(ce(ry))),postTokenBalances:me(ue(ce(ry))),loadedAddresses:me(oT),computeUnitsConsumed:me(D()),costUnits:me(D())}),OS=X({err:Za,fee:D(),innerInstructions:me(ue(ce(X({index:D(),instructions:ce(iT)})))),preBalances:ce(D()),postBalances:ce(D()),logMessages:me(ue(ce(ne()))),preTokenBalances:me(ue(ce(ry))),postTokenBalances:me(ue(ce(ry))),loadedAddresses:me(oT),computeUnitsConsumed:me(D()),costUnits:me(D())}),qu=qr([it(0),it("legacy")]),Ya=X({pubkey:ne(),lamports:D(),postBalance:ue(D()),rewardType:ue(ne()),commission:me(ue(D()))}),pH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),transactions:ce(X({transaction:RS,meta:ue(oy),version:me(qu)})),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),gH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),yH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),transactions:ce(X({transaction:tT,meta:ue(oy),version:me(qu)})),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),mH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),transactions:ce(X({transaction:sT,meta:ue(OS),version:me(qu)})),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),bH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),transactions:ce(X({transaction:tT,meta:ue(OS),version:me(qu)})),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),_H=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),rewards:me(ce(Ya)),blockTime:ue(D()),blockHeight:ue(D())}))),AH=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),transactions:ce(X({transaction:RS,meta:ue(oy)})),rewards:me(ce(Ya)),blockTime:ue(D())}))),MB=Oe(ue(X({blockhash:ne(),previousBlockhash:ne(),parentSlot:D(),signatures:ce(ne()),blockTime:ue(D())}))),cS=Oe(ue(X({slot:D(),meta:ue(oy),blockTime:me(ue(D())),transaction:RS,version:me(qu)}))),Y0=Oe(ue(X({slot:D(),transaction:sT,meta:ue(OS),blockTime:me(ue(D())),version:me(qu)}))),SH=Et(X({blockhash:ne(),lastValidBlockHeight:D()})),vH=Et(Si()),EH=X({slot:D(),numTransactions:D(),numSlots:D(),samplePeriodSecs:D()}),wH=Oe(ce(EH)),xH=Et(ue(X({feeCalculator:X({lamportsPerSignature:D()})}))),IH=Oe(ne()),PH=Oe(ne()),RH=X({err:Za,logs:ce(ne()),signature:ne()}),OH=X({result:sy(RH),subscription:D()}),BH={"solana-client":"js/1.0.0-maintenance"},Lu=class{constructor(e,r){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=(()=>{let d={};return async f=>{let{commitment:m,config:_}=Xe(f),v=this._buildArgs([],m,void 0,_),P=TB(v);return d[P]=d[P]??(async()=>{try{let B=await this._rpcRequest("getBlockHeight",v),k=se(B,Oe(D()));if("error"in k)throw new he(k.error,"failed to get block height information");return k.result}finally{delete d[P]}})(),await d[P]}})();let n,i,s,o,c,u;r&&typeof r=="string"?this._commitment=r:r&&(this._commitment=r.commitment,this._confirmTransactionInitialTimeout=r.confirmTransactionInitialTimeout,n=r.wsEndpoint,i=r.httpHeaders,s=r.fetch,o=r.fetchMiddleware,c=r.disableRetryOnRateLimit,u=r.httpAgent),this._rpcEndpoint=gj(e),this._rpcWsEndpoint=n||hj(e),this._rpcClient=Bj(e,i,s,o,c,u),this._rpcRequest=Tj(this._rpcClient),this._rpcBatchRequest=zj(this._rpcClient),this._rpcWebSocket=new mS(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,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgs([e.toBase58()],n,void 0,i),o=await this._rpcRequest("getBalance",s),c=se(o,Et(D()));if("error"in c)throw new he(c.error,`failed to get balance for ${e.toBase58()}`);return c.result}async getBalance(e,r){return await this.getBalanceAndContext(e,r).then(n=>n.value).catch(n=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+n)})}async getBlockTime(e){let r=await this._rpcRequest("getBlockTime",[e]),n=se(r,Oe(ue(D())));if("error"in n)throw new he(n.error,`failed to get block time for slot ${e}`);return n.result}async getMinimumLedgerSlot(){let e=await this._rpcRequest("minimumLedgerSlot",[]),r=se(e,Oe(D()));if("error"in r)throw new he(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){let e=await this._rpcRequest("getFirstAvailableBlock",[]),r=se(e,qj);if("error"in r)throw new he(r.error,"failed to get first available block");return r.result}async getSupply(e){let r={};typeof e=="string"?r={commitment:e}:e?r={...e,commitment:e&&e.commitment||this.commitment}:r={commitment:this.commitment};let n=await this._rpcRequest("getSupply",[r]),i=se(n,Uj);if("error"in i)throw new he(i.error,"failed to get supply");return i.result}async getTokenSupply(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenSupply",n),s=se(i,Et(bS));if("error"in s)throw new he(s.error,"failed to get token supply");return s.result}async getTokenAccountBalance(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenAccountBalance",n),s=se(i,Et(bS));if("error"in s)throw new he(s.error,"failed to get token account balance");return s.result}async getTokenAccountsByOwner(e,r,n){let{commitment:i,config:s}=Xe(n),o=[e.toBase58()];"mint"in r?o.push({mint:r.mint.toBase58()}):o.push({programId:r.programId.toBase58()});let c=this._buildArgs(o,i,"base64",s),u=await this._rpcRequest("getTokenAccountsByOwner",c),d=se(u,Fj);if("error"in d)throw new he(d.error,`failed to get token accounts owned by account ${e.toBase58()}`);return d.result}async getParsedTokenAccountsByOwner(e,r,n){let i=[e.toBase58()];"mint"in r?i.push({mint:r.mint.toBase58()}):i.push({programId:r.programId.toBase58()});let s=this._buildArgs(i,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",s),c=se(o,Kj);if("error"in c)throw new he(c.error,`failed to get token accounts owned by account ${e.toBase58()}`);return c.result}async getLargestAccounts(e){let r={...e,commitment:e&&e.commitment||this.commitment},n=r.filter||r.commitment?[r]:[],i=await this._rpcRequest("getLargestAccounts",n),s=se(i,Wj);if("error"in s)throw new he(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenLargestAccounts",n),s=se(i,Vj);if("error"in s)throw new he(s.error,"failed to get token largest accounts");return s.result}async getAccountInfoAndContext(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgs([e.toBase58()],n,"base64",i),o=await this._rpcRequest("getAccountInfo",s),c=se(o,Et(ue(wf)));if("error"in c)throw new he(c.error,`failed to get info about account ${e.toBase58()}`);return c.result}async getParsedAccountInfo(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgs([e.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getAccountInfo",s),c=se(o,Et(ue(AS)));if("error"in c)throw new he(c.error,`failed to get info about account ${e.toBase58()}`);return c.result}async getAccountInfo(e,r){try{return(await this.getAccountInfoAndContext(e,r)).value}catch(n){throw new Error("failed to get info about account "+e.toBase58()+": "+n)}}async getMultipleParsedAccounts(e,r){let{commitment:n,config:i}=Xe(r),s=e.map(d=>d.toBase58()),o=this._buildArgs([s],n,"jsonParsed",i),c=await this._rpcRequest("getMultipleAccounts",o),u=se(c,Et(ce(ue(AS))));if("error"in u)throw new he(u.error,`failed to get info for accounts ${s}`);return u.result}async getMultipleAccountsInfoAndContext(e,r){let{commitment:n,config:i}=Xe(r),s=e.map(d=>d.toBase58()),o=this._buildArgs([s],n,"base64",i),c=await this._rpcRequest("getMultipleAccounts",o),u=se(c,Et(ce(ue(wf))));if("error"in u)throw new he(u.error,`failed to get info for accounts ${s}`);return u.result}async getMultipleAccountsInfo(e,r){return(await this.getMultipleAccountsInfoAndContext(e,r)).value}async getStakeActivation(e,r,n){let{commitment:i,config:s}=Xe(r),o=this._buildArgs([e.toBase58()],i,void 0,{...s,epoch:n??s?.epoch}),c=await this._rpcRequest("getStakeActivation",o),u=se(c,Oe($j));if("error"in u)throw new he(u.error,`failed to get Stake Activation ${e.toBase58()}`);return u.result}async getProgramAccounts(e,r){let{commitment:n,config:i}=Xe(r),{encoding:s,...o}=i||{},c=this._buildArgs([e.toBase58()],n,s||"base64",{...o,...o.filters?{filters:kB(o.filters)}:null}),u=await this._rpcRequest("getProgramAccounts",c),d=ce(jj),f=o.withContext===!0?se(u,Et(d)):se(u,Oe(d));if("error"in f)throw new he(f.error,`failed to get accounts owned by program ${e.toBase58()}`);return f.result}async getParsedProgramAccounts(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgs([e.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getProgramAccounts",s),c=se(o,Oe(ce(Gj)));if("error"in c)throw new he(c.error,`failed to get accounts owned by program ${e.toBase58()}`);return c.result}async confirmTransaction(e,r){let n;if(typeof e=="string")n=e;else{let s=e;if(s.abortSignal?.aborted)return Promise.reject(s.abortSignal.reason);n=s.signature}let i;try{i=mr.default.decode(n)}catch{throw new Error("signature must be base58 encoded: "+n)}return Ke(i.length===64,"signature has invalid length"),typeof e=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:r||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:r||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((r,n)=>{e!=null&&(e.aborted?n(e.reason):e.addEventListener("abort",()=>{n(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:r}){let n,i,s=!1,o=new Promise((u,d)=>{try{n=this.onSignature(r,(m,_)=>{n=void 0;let v={context:_,value:m};u({__type:fo.PROCESSED,response:v})},e);let f=new Promise(m=>{n==null?m():i=this._onSubscriptionStateChange(n,_=>{_==="subscribed"&&m()})});(async()=>{if(await f,s)return;let m=await this.getSignatureStatus(r);if(s||m==null)return;let{context:_,value:v}=m;if(v!=null)if(v?.err)d(v.err);else{switch(e){case"confirmed":case"single":case"singleGossip":{if(v.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(v.confirmationStatus==="processed"||v.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}s=!0,u({__type:fo.PROCESSED,response:{context:_,value:v}})}})()}catch(f){d(f)}});return{abortConfirmation:()=>{i&&(i(),i=void 0),n!=null&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:r,lastValidBlockHeight:n,signature:i}}){let s=!1,o=new Promise(m=>{let _=async()=>{try{return await this.getBlockHeight(e)}catch{return-1}};(async()=>{let v=await _();if(!s){for(;v<=n;)if(await ja(1e3),s||(v=await _(),s))return;m({__type:fo.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:c,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:e,signature:i}),d=this.getCancellationPromise(r),f;try{let m=await Promise.race([d,u,o]);if(m.__type===fo.PROCESSED)f=m.response;else throw new Q0(i)}finally{s=!0,c()}return f}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:r,minContextSlot:n,nonceAccountPubkey:i,nonceValue:s,signature:o}}){let c=!1,u=new Promise(v=>{let P=s,B=null,k=async()=>{try{let{context:T,value:L}=await this.getNonceAndContext(i,{commitment:e,minContextSlot:n});return B=T.slot,L?.nonce}catch{return P}};(async()=>{if(P=await k(),!c)for(;;){if(s!==P){v({__type:fo.NONCE_INVALID,slotInWhichNonceDidAdvance:B});return}if(await ja(2e3),c||(P=await k(),c))return}})()}),{abortConfirmation:d,confirmationPromise:f}=this.getTransactionConfirmationPromise({commitment:e,signature:o}),m=this.getCancellationPromise(r),_;try{let v=await Promise.race([m,f,u]);if(v.__type===fo.PROCESSED)_=v.response;else{let P;for(;;){let B=await this.getSignatureStatus(o);if(B==null)break;if(B.context.slot<(v.slotInWhichNonceDidAdvance??n)){await ja(400);continue}P=B;break}if(P?.value){let B=e||"finalized",{confirmationStatus:k}=P.value;switch(B){case"processed":case"recent":if(k!=="processed"&&k!=="confirmed"&&k!=="finalized")throw new Ha(o);break;case"confirmed":case"single":case"singleGossip":if(k!=="confirmed"&&k!=="finalized")throw new Ha(o);break;case"finalized":case"max":case"root":if(k!=="finalized")throw new Ha(o);break;default:}_={context:P.context,value:{err:P.value.err}}}else throw new Ha(o)}}finally{c=!0,d()}return _}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:r}){let n,i=new Promise(u=>{let d=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{d=this._confirmTransactionInitialTimeout||3e4;break}}n=setTimeout(()=>u({__type:fo.TIMED_OUT,timeoutMs:d}),d)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:r}),c;try{let u=await Promise.race([o,i]);if(u.__type===fo.PROCESSED)c=u.response;else throw new ey(r,u.timeoutMs/1e3)}finally{clearTimeout(n),s()}return c}async getClusterNodes(){let e=await this._rpcRequest("getClusterNodes",[]),r=se(e,Oe(ce(oH)));if("error"in r)throw new he(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(e){let r=this._buildArgs([],e),n=await this._rpcRequest("getVoteAccounts",r),i=se(n,aH);if("error"in i)throw new he(i.error,"failed to get vote accounts");return i.result}async getSlot(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlot",i),o=se(s,Oe(D()));if("error"in o)throw new he(o.error,"failed to get slot");return o.result}async getSlotLeader(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlotLeader",i),o=se(s,Oe(ne()));if("error"in o)throw new he(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(e,r){let n=[e,r],i=await this._rpcRequest("getSlotLeaders",n),s=se(i,Oe(ce(gt)));if("error"in s)throw new he(s.error,"failed to get slot leaders");return s.result}async getSignatureStatus(e,r){let{context:n,value:i}=await this.getSignatureStatuses([e],r);Ke(i.length===1);let s=i[0];return{context:n,value:s}}async getSignatureStatuses(e,r){let n=[e];r&&n.push(r);let i=await this._rpcRequest("getSignatureStatuses",n),s=se(i,lH);if("error"in s)throw new he(s.error,"failed to get signature status");return s.result}async getTransactionCount(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getTransactionCount",i),o=se(s,Oe(D()));if("error"in o)throw new he(o.error,"failed to get transaction count");return o.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){let r=this._buildArgs([],e),n=await this._rpcRequest("getInflationGovernor",r),i=se(n,kj);if("error"in i)throw new he(i.error,"failed to get inflation");return i.result}async getInflationReward(e,r,n){let{commitment:i,config:s}=Xe(n),o=this._buildArgs([e.map(d=>d.toBase58())],i,void 0,{...s,epoch:r??s?.epoch}),c=await this._rpcRequest("getInflationReward",o),u=se(c,bj);if("error"in u)throw new he(u.error,"failed to get inflation reward");return u.result}async getInflationRate(){let e=await this._rpcRequest("getInflationRate",[]),r=se(e,Cj);if("error"in r)throw new he(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getEpochInfo",i),o=se(s,Mj);if("error"in o)throw new he(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){let e=await this._rpcRequest("getEpochSchedule",[]),r=se(e,Lj);if("error"in r)throw new he(r.error,"failed to get epoch schedule");let n=r.result;return new yS(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){let e=await this._rpcRequest("getLeaderSchedule",[]),r=se(e,Dj);if("error"in r)throw new he(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(e,r){let n=this._buildArgs([e],r),i=await this._rpcRequest("getMinimumBalanceForRentExemption",n),s=se(i,dH);return"error"in s?(console.warn("Unable to fetch minimum balance for rent exemption"),0):s.result}async getRecentBlockhashAndContext(e){let{context:r,value:{blockhash:n}}=await this.getLatestBlockhashAndContext(e);return{context:r,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(){return{}}}}}}async getRecentPerformanceSamples(e){let r=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),n=se(r,wH);if("error"in n)throw new he(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(e,r){let n=this._buildArgs([e],r),i=await this._rpcRequest("getFeeCalculatorForBlockhash",n),s=se(i,xH);if("error"in s)throw new he(s.error,"failed to get fee calculator");let{context:o,value:c}=s.result;return{context:o,value:c!==null?c.feeCalculator:null}}async getFeeForMessage(e,r){let n=ke(e.serialize()).toString("base64"),i=this._buildArgs([n],r),s=await this._rpcRequest("getFeeForMessage",i),o=se(s,Et(ue(D())));if("error"in o)throw new he(o.error,"failed to get fee for message");if(o.result===null)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(e){let r=e?.lockedWritableAccounts?.map(o=>o.toBase58()),n=r?.length?[r]:[],i=await this._rpcRequest("getRecentPrioritizationFees",n),s=se(i,Nj);if("error"in s)throw new he(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhashAndContext(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getLatestBlockhash",i),o=se(s,SH);if("error"in o)throw new he(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgs([e],n,void 0,i),o=await this._rpcRequest("isBlockhashValid",s),c=se(o,vH);if("error"in c)throw new he(c.error,"failed to determine if the blockhash `"+e+"`is valid");return c.result}async getVersion(){let e=await this._rpcRequest("getVersion",[]),r=se(e,Oe(Ij));if("error"in r)throw new he(r.error,"failed to get version");return r.result}async getGenesisHash(){let e=await this._rpcRequest("getGenesisHash",[]),r=se(e,Oe(ne()));if("error"in r)throw new he(r.error,"failed to get genesis hash");return r.result}async getBlock(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgsAtLeastConfirmed([e],n,void 0,i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let c=se(o,yH);if("error"in c)throw c.error;return c.result}case"none":{let c=se(o,gH);if("error"in c)throw c.error;return c.result}default:{let c=se(o,pH);if("error"in c)throw c.error;let{result:u}=c;return u?{...u,transactions:u.transactions.map(({transaction:d,meta:f,version:m})=>({meta:f,transaction:{...d,message:aS(m,d.message)},version:m}))}:null}}}catch(c){throw new he(c,"failed to get confirmed block")}}async getParsedBlock(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let c=se(o,bH);if("error"in c)throw c.error;return c.result}case"none":{let c=se(o,_H);if("error"in c)throw c.error;return c.result}default:{let c=se(o,mH);if("error"in c)throw c.error;return c.result}}}catch(c){throw new he(c,"failed to get block")}}async getBlockProduction(e){let r,n;if(typeof e=="string")n=e;else if(e){let{commitment:c,...u}=e;n=c,r=u}let i=this._buildArgs([],n,"base64",r),s=await this._rpcRequest("getBlockProduction",i),o=se(s,Oj);if("error"in o)throw new he(o.error,"failed to get block production information");return o.result}async getTransaction(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgsAtLeastConfirmed([e],n,void 0,i),o=await this._rpcRequest("getTransaction",s),c=se(o,cS);if("error"in c)throw new he(c.error,"failed to get transaction");let u=c.result;return u&&{...u,transaction:{...u.transaction,message:aS(u.version,u.transaction.message)}}}async getParsedTransaction(e,r){let{commitment:n,config:i}=Xe(r),s=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",i),o=await this._rpcRequest("getTransaction",s),c=se(o,Y0);if("error"in c)throw new he(c.error,"failed to get transaction");return c.result}async getParsedTransactions(e,r){let{commitment:n,config:i}=Xe(r),s=e.map(u=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([u],n,"jsonParsed",i)}));return(await this._rpcBatchRequest(s)).map(u=>{let d=se(u,Y0);if("error"in d)throw new he(d.error,"failed to get transactions");return d.result})}async getTransactions(e,r){let{commitment:n,config:i}=Xe(r),s=e.map(u=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([u],n,void 0,i)}));return(await this._rpcBatchRequest(s)).map(u=>{let d=se(u,cS);if("error"in d)throw new he(d.error,"failed to get transactions");let f=d.result;return f&&{...f,transaction:{...f.transaction,message:aS(f.version,f.transaction.message)}}})}async getConfirmedBlock(e,r){let n=this._buildArgsAtLeastConfirmed([e],r),i=await this._rpcRequest("getBlock",n),s=se(i,AH);if("error"in s)throw new he(s.error,"failed to get confirmed block");let o=s.result;if(!o)throw new Error("Confirmed block "+e+" not found");let c={...o,transactions:o.transactions.map(({transaction:u,meta:d})=>{let f=new vi(u.message);return{meta:d,transaction:{...u,message:f}}})};return{...c,transactions:c.transactions.map(({transaction:u,meta:d})=>({meta:d,transaction:De.populate(u.message,u.signatures)}))}}async getBlocks(e,r,n){let i=this._buildArgsAtLeastConfirmed(r!==void 0?[e,r]:[e],n),s=await this._rpcRequest("getBlocks",i),o=se(s,Oe(ce(D())));if("error"in o)throw new he(o.error,"failed to get blocks");return o.result}async getBlockSignatures(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=se(i,MB);if("error"in s)throw new he(s.error,"failed to get block");let o=s.result;if(!o)throw new Error("Block "+e+" not found");return o}async getConfirmedBlockSignatures(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=se(i,MB);if("error"in s)throw new he(s.error,"failed to get confirmed block");let o=s.result;if(!o)throw new Error("Confirmed block "+e+" not found");return o}async getConfirmedTransaction(e,r){let n=this._buildArgsAtLeastConfirmed([e],r),i=await this._rpcRequest("getTransaction",n),s=se(i,cS);if("error"in s)throw new he(s.error,"failed to get transaction");let o=s.result;if(!o)return o;let c=new vi(o.transaction.message),u=o.transaction.signatures;return{...o,transaction:De.populate(c,u)}}async getParsedConfirmedTransaction(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed"),i=await this._rpcRequest("getTransaction",n),s=se(i,Y0);if("error"in s)throw new he(s.error,"failed to get confirmed transaction");return s.result}async getParsedConfirmedTransactions(e,r){let n=e.map(o=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([o],r,"jsonParsed")}));return(await this._rpcBatchRequest(n)).map(o=>{let c=se(o,Y0);if("error"in c)throw new he(c.error,"failed to get confirmed transactions");return c.result})}async getConfirmedSignaturesForAddress(e,r,n){let i={},s=await this.getFirstAvailableBlock();for(;!("until"in i)&&(r--,!(r<=0||r<s));)try{let u=await this.getConfirmedBlockSignatures(r,"finalized");u.signatures.length>0&&(i.until=u.signatures[u.signatures.length-1].toString())}catch(u){if(u instanceof Error&&u.message.includes("skipped"))continue;throw u}let o=await this.getSlot("finalized");for(;!("before"in i)&&(n++,!(n>o));)try{let u=await this.getConfirmedBlockSignatures(n);u.signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString())}catch(u){if(u instanceof Error&&u.message.includes("skipped"))continue;throw u}return(await this.getConfirmedSignaturesForAddress2(e,i)).map(u=>u.signature)}async getConfirmedSignaturesForAddress2(e,r,n){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,r),s=await this._rpcRequest("getConfirmedSignaturesForAddress2",i),o=se(s,Zj);if("error"in o)throw new he(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(e,r,n){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,r),s=await this._rpcRequest("getSignaturesForAddress",i),o=se(s,Yj);if("error"in o)throw new he(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(e,r){let{context:n,value:i}=await this.getAccountInfoAndContext(e,r),s=null;return i!==null&&(s=new Mu({key:e,state:Mu.deserialize(i.data)})),{context:n,value:s}}async getNonceAndContext(e,r){let{context:n,value:i}=await this.getAccountInfoAndContext(e,r),s=null;return i!==null&&(s=pS.fromAccountData(i.data)),{context:n,value:s}}async getNonce(e,r){return await this.getNonceAndContext(e,r).then(n=>n.value).catch(n=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+n)})}async requestAirdrop(e,r){let n=await this._rpcRequest("requestAirdrop",[e.toBase58(),r]),i=se(n,IH);if("error"in i)throw new he(i.error,`airdrop to ${e.toBase58()} failed`);return i.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await ja(100);let n=Date.now()-this._blockhashInfo.lastFetch>=pj;if(this._blockhashInfo.latestBlockhash!==null&&!n)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let e=Date.now(),r=this._blockhashInfo.latestBlockhash,n=r?r.blockhash:null;for(let i=0;i<50;i++){let s=await this.getLatestBlockhash("finalized");if(n!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await ja(ZB/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){let{commitment:r,config:n}=Xe(e),i=this._buildArgs([],r,"base64",n),s=await this._rpcRequest("getStakeMinimumDelegation",i),o=se(s,Et(D()));if("error"in o)throw new he(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(e,r,n){if("message"in e){let B=e.serialize(),k=ve.Buffer.from(B).toString("base64");if(Array.isArray(r)||n!==void 0)throw new Error("Invalid arguments");let T=r||{};T.encoding="base64","commitment"in T||(T.commitment=this.commitment),r&&typeof r=="object"&&"innerInstructions"in r&&(T.innerInstructions=r.innerInstructions);let L=[k,T],M=await this._rpcRequest("simulateTransaction",L),F=se(M,CB);if("error"in F)throw new Error("failed to simulate transaction: "+F.error.message);return F.result}let i;if(e instanceof De){let P=e;i=new De,i.feePayer=P.feePayer,i.instructions=e.instructions,i.nonceInfo=P.nonceInfo,i.signatures=P.signatures}else i=De.populate(e),i._message=i._json=void 0;if(r!==void 0&&!Array.isArray(r))throw new Error("Invalid arguments");let s=r;if(i.nonceInfo&&s)i.sign(...s);else{let P=this._disableBlockhashCaching;for(;;){let B=await this._blockhashWithExpiryBlockHeight(P);if(i.lastValidBlockHeight=B.lastValidBlockHeight,i.recentBlockhash=B.blockhash,!s)break;if(i.sign(...s),!i.signature)throw new Error("!signature");let k=i.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(k)&&!this._blockhashInfo.transactionSignatures.includes(k)){this._blockhashInfo.simulatedSignatures.push(k);break}else P=!0}}let o=i._compile(),c=o.serialize(),d=i._serialize(c).toString("base64"),f={encoding:"base64",commitment:this.commitment};if(n){let P=(Array.isArray(n)?n:o.nonProgramIds()).map(B=>B.toBase58());f.accounts={encoding:"base64",addresses:P}}s&&(f.sigVerify=!0),r&&typeof r=="object"&&"innerInstructions"in r&&(f.innerInstructions=r.innerInstructions);let m=[d,f],_=await this._rpcRequest("simulateTransaction",m),v=se(_,CB);if("error"in v){let P;if("data"in v.error&&(P=v.error.data.logs,P&&Array.isArray(P))){let B=`
- `,k=B+P.join(B);console.error(v.error.message,k)}throw new Ef({action:"simulate",signature:"",transactionMessage:v.error.message,logs:P})}return v.result}async sendTransaction(e,r,n){if("version"in e){if(r&&Array.isArray(r))throw new Error("Invalid arguments");let o=e.serialize();return await this.sendRawTransaction(o,r)}if(r===void 0||!Array.isArray(r))throw new Error("Invalid arguments");let i=r;if(e.nonceInfo)e.sign(...i);else{let o=this._disableBlockhashCaching;for(;;){let c=await this._blockhashWithExpiryBlockHeight(o);if(e.lastValidBlockHeight=c.lastValidBlockHeight,e.recentBlockhash=c.blockhash,e.sign(...i),!e.signature)throw new Error("!signature");let u=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(u))o=!0;else{this._blockhashInfo.transactionSignatures.push(u);break}}}let s=e.serialize();return await this.sendRawTransaction(s,n)}async sendRawTransaction(e,r){let n=ke(e).toString("base64");return await this.sendEncodedTransaction(n,r)}async sendEncodedTransaction(e,r){let n={encoding:"base64"},i=r&&r.skipPreflight,s=i===!0?"processed":r&&r.preflightCommitment||this.commitment;r&&r.maxRetries!=null&&(n.maxRetries=r.maxRetries),r&&r.minContextSlot!=null&&(n.minContextSlot=r.minContextSlot),i&&(n.skipPreflight=i),s&&(n.preflightCommitment=s);let o=[e,n],c=await this._rpcRequest("sendTransaction",o),u=se(c,PH);if("error"in u){let d;throw"data"in u.error&&(d=u.error.data.logs),new Ef({action:i?"send":"simulate",signature:"",transactionMessage:u.error.message,logs:d})}return u.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){if(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),e===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([r,n])=>{this._setSubscription(r,{...n,state:"pending"})})}_setSubscription(e,r){let n=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=r,n!==r.state){let i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach(s=>{try{s(r.state)}catch{}})}}_onSubscriptionStateChange(e,r){let n=this._subscriptionHashByClientSubscriptionId[e];if(n==null)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return i.add(r),()=>{i.delete(r),i.size===0&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(n){n instanceof Error&&console.log(`Error when closing socket connection: ${n.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}let e=this._rpcWebSocketGeneration,r=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async n=>{let i=this._subscriptionsByHash[n];if(i!==void 0)switch(i.state){case"pending":case"unsubscribed":if(i.callbacks.size===0){delete this._subscriptionsByHash[n],i.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{let{args:s,method:o}=i;try{this._setSubscription(n,{...i,state:"subscribing"});let c=await this._rpcWebSocket.call(o,s);this._setSubscription(n,{...i,serverSubscriptionId:c,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[c]=i.callbacks,await this._updateSubscriptions()}catch(c){if(console.error(`Received ${c instanceof Error?"":"JSON-RPC "}error calling \`${o}\``,{args:s,error:c}),!r())return;this._setSubscription(n,{...i,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":i.callbacks.size===0&&await(async()=>{let{serverSubscriptionId:s,unsubscribeMethod:o}=i;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(n,{...i,state:"unsubscribing"}),this._setSubscription(n,{...i,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[s])}catch(c){if(c instanceof Error&&console.error(`${o} error:`,c.message),!r())return;this._setSubscription(n,{...i,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(n,{...i,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(e,r){let n=this._subscriptionCallbacksByServerSubscriptionId[e];n!==void 0&&n.forEach(i=>{try{i(...r)}catch(s){console.error(s)}})}_wsOnAccountNotification(e){let{result:r,subscription:n}=se(e,Xj);this._handleServerNotification(n,[r.value,r.context])}_makeSubscription(e,r){let n=this._nextClientSubscriptionId++,i=TB([e.method,r]),s=this._subscriptionsByHash[i];return s===void 0?this._subscriptionsByHash[i]={...e,args:r,callbacks:new Set([e.callback]),state:"pending"}:s.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];let o=this._subscriptionsByHash[i];Ke(o!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),o.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,r,n){let{commitment:i,config:s}=Xe(n),o=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",s);return this._makeSubscription({callback:r,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){let{result:r,subscription:n}=se(e,Qj);this._handleServerNotification(n,[{accountId:r.value.pubkey,accountInfo:r.value.account},r.context])}onProgramAccountChange(e,r,n,i){let{commitment:s,config:o}=Xe(n),c=this._buildArgs([e.toBase58()],s||this._commitment||"finalized","base64",o||(i?{filters:kB(i)}:void 0));return this._makeSubscription({callback:r,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},c)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,r,n){let i=this._buildArgs([typeof e=="object"?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:r,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){let{result:r,subscription:n}=se(e,OH);this._handleServerNotification(n,[r.value,r.context])}_wsOnSlotNotification(e){let{result:r,subscription:n}=se(e,tH);this._handleServerNotification(n,[r])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){let{result:r,subscription:n}=se(e,nH);this._handleServerNotification(n,[r])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,r){let n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${r}' events could not be found.`)}_buildArgs(e,r,n,i){let s=r||this._commitment;if(s||n||i){let o={};n&&(o.encoding=n),s&&(o.commitment=s),i&&(o=Object.assign(o,i)),e.push(o)}return e}_buildArgsAtLeastConfirmed(e,r,n,i){let s=r||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,r,n,i)}_wsOnSignatureNotification(e){let{result:r,subscription:n}=se(e,iH);r.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,r.value==="receivedSignature"?[{type:"received"},r.context]:[{type:"status",result:r.value},r.context])}onSignature(e,r,n){let i=this._buildArgs([e],n||this._commitment||"finalized"),s=this._makeSubscription({callback:(o,c)=>{if(o.type==="status"){r(o.result,c);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}onSignatureWithOptions(e,r,n){let{commitment:i,...s}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([e],i,void 0,s),c=this._makeSubscription({callback:(u,d)=>{r(u,d);try{this.removeSignatureListener(c)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return c}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){let{result:r,subscription:n}=se(e,sH);this._handleServerNotification(n,[r])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}},yo=class t{constructor(e){this._keypair=void 0,this._keypair=e??xB()}static generate(){return new t(xB())}static fromSecretKey(e,r){if(e.byteLength!==64)throw new Error("bad secret key size");let n=e.slice(32,64);if(!r||!r.skipValidation){let i=e.slice(0,32),s=fS(i);for(let o=0;o<32;o++)if(n[o]!==s[o])throw new Error("provided secretKey is invalid")}return new t({publicKey:n,secretKey:e})}static fromSeed(e){let r=fS(e),n=new Uint8Array(64);return n.set(e),n.set(r,32),new t({publicKey:r,secretKey:n})}get publicKey(){return new be(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},_f=Object.freeze({CreateLookupTable:{index:0,layout:z.struct([z.u32("instruction"),Nu("recentSlot"),z.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:z.struct([z.u32("instruction")])},ExtendLookupTable:{index:2,layout:z.struct([z.u32("instruction"),Nu(),z.seq(Te(),z.offset(z.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:z.struct([z.u32("instruction")])},CloseLookupTable:{index:4,layout:z.struct([z.u32("instruction")])}});var SS=class{constructor(){}static createLookupTable(e){let[r,n]=be.findProgramAddressSync([e.authority.toBuffer(),NA().encode(e.recentSlot)],this.programId),i=_f.CreateLookupTable,s=Ne(i,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),o=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:nn.programId,isSigner:!1,isWritable:!1}];return[new je({programId:this.programId,keys:o,data:s}),r]}static freezeLookupTable(e){let r=_f.FreezeLookupTable,n=Ne(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new je({programId:this.programId,keys:i,data:n})}static extendLookupTable(e){let r=_f.ExtendLookupTable,n=Ne(r,{addresses:e.addresses.map(s=>s.toBytes())}),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&i.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:nn.programId,isSigner:!1,isWritable:!1}),new je({programId:this.programId,keys:i,data:n})}static deactivateLookupTable(e){let r=_f.DeactivateLookupTable,n=Ne(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new je({programId:this.programId,keys:i,data:n})}static closeLookupTable(e){let r=_f.CloseLookupTable,n=Ne(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new je({programId:this.programId,keys:i,data:n})}};SS.programId=new be("AddressLookupTab1e1111111111111111111111111");var X0=Object.freeze({RequestUnits:{index:0,layout:z.struct([z.u8("instruction"),z.u32("units"),z.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:z.struct([z.u8("instruction"),z.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:z.struct([z.u8("instruction"),z.u32("units")])},SetComputeUnitPrice:{index:3,layout:z.struct([z.u8("instruction"),Nu("microLamports")])}}),vS=class{constructor(){}static requestUnits(e){let r=X0.RequestUnits,n=Ne(r,e);return new je({keys:[],programId:this.programId,data:n})}static requestHeapFrame(e){let r=X0.RequestHeapFrame,n=Ne(r,e);return new je({keys:[],programId:this.programId,data:n})}static setComputeUnitLimit(e){let r=X0.SetComputeUnitLimit,n=Ne(r,e);return new je({keys:[],programId:this.programId,data:n})}static setComputeUnitPrice(e){let r=X0.SetComputeUnitPrice,n=Ne(r,{microLamports:BigInt(e.microLamports)});return new je({keys:[],programId:this.programId,data:n})}};vS.programId=new be("ComputeBudget111111111111111111111111111111");var LB=64,DB=32,qB=64,UB=z.struct([z.u8("numSignatures"),z.u8("padding"),z.u16("signatureOffset"),z.u16("signatureInstructionIndex"),z.u16("publicKeyOffset"),z.u16("publicKeyInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u16("messageInstructionIndex")]),ES=class t{constructor(){}static createInstructionWithPublicKey(e){let{publicKey:r,message:n,signature:i,instructionIndex:s}=e;Ke(r.length===DB,`Public Key must be ${DB} bytes but received ${r.length} bytes`),Ke(i.length===qB,`Signature must be ${qB} bytes but received ${i.length} bytes`);let o=UB.span,c=o+r.length,u=c+i.length,d=1,f=ve.Buffer.alloc(u+n.length),m=s??65535;return UB.encode({numSignatures:d,padding:0,signatureOffset:c,signatureInstructionIndex:m,publicKeyOffset:o,publicKeyInstructionIndex:m,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:m},f),f.fill(r,o),f.fill(i,c),f.fill(n,u),new je({keys:[],programId:t.programId,data:f})}static createInstructionWithPrivateKey(e){let{privateKey:r,message:n,instructionIndex:i}=e;Ke(r.length===LB,`Private key must be ${LB} bytes but received ${r.length} bytes`);try{let s=yo.fromSecretKey(r),o=s.publicKey.toBytes(),c=xS(n,s.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:c,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};ES.programId=new be("Ed25519SigVerify111111111111111111111111111");var TH=(t,e)=>{let r=Z0.sign(t,e);return[r.toCompactRawBytes(),r.recovery]};Z0.utils.isValidPrivateKey;var zH=Z0.getPublicKey,VB=32,uS=20,FB=64,kH=11,lS=z.struct([z.u8("numSignatures"),z.u16("signatureOffset"),z.u8("signatureInstructionIndex"),z.u16("ethAddressOffset"),z.u8("ethAddressInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u8("messageInstructionIndex"),z.blob(20,"ethAddress"),z.blob(64,"signature"),z.u8("recoveryId")]),wS=class t{constructor(){}static publicKeyToEthAddress(e){Ke(e.length===FB,`Public key must be ${FB} bytes but received ${e.length} bytes`);try{return ve.Buffer.from(YA(ke(e))).slice(-uS)}catch(r){throw new Error(`Error constructing Ethereum address: ${r}`)}}static createInstructionWithPublicKey(e){let{publicKey:r,message:n,signature:i,recoveryId:s,instructionIndex:o}=e;return t.createInstructionWithEthAddress({ethAddress:t.publicKeyToEthAddress(r),message:n,signature:i,recoveryId:s,instructionIndex:o})}static createInstructionWithEthAddress(e){let{ethAddress:r,message:n,signature:i,recoveryId:s,instructionIndex:o=0}=e,c;typeof r=="string"?r.startsWith("0x")?c=ve.Buffer.from(r.substr(2),"hex"):c=ve.Buffer.from(r,"hex"):c=r,Ke(c.length===uS,`Address must be ${uS} bytes but received ${c.length} bytes`);let u=1+kH,d=u,f=u+c.length,m=f+i.length+1,_=1,v=ve.Buffer.alloc(lS.span+n.length);return lS.encode({numSignatures:_,signatureOffset:f,signatureInstructionIndex:o,ethAddressOffset:d,ethAddressInstructionIndex:o,messageDataOffset:m,messageDataSize:n.length,messageInstructionIndex:o,signature:ke(i),ethAddress:ke(c),recoveryId:s},v),v.fill(ke(n),lS.span),new je({keys:[],programId:t.programId,data:v})}static createInstructionWithPrivateKey(e){let{privateKey:r,message:n,instructionIndex:i}=e;Ke(r.length===VB,`Private key must be ${VB} bytes but received ${r.length} bytes`);try{let s=ke(r),o=zH(s,!1).slice(1),c=ve.Buffer.from(YA(ke(n))),[u,d]=TH(c,s);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:u,recoveryId:d,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};wS.programId=new be("KeccakSecp256k11111111111111111111111111111");var aT,CH=new be("StakeConfig11111111111111111111111111111111");var xf=class{constructor(e,r,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=r,this.custodian=n}};aT=xf;xf.default=new aT(0,0,be.default);var ho=Object.freeze({Initialize:{index:0,layout:z.struct([z.u32("instruction"),ZW(),YW()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),Te("newAuthorized"),z.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:z.struct([z.u32("instruction")])},Split:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Withdraw:{index:4,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Deactivate:{index:5,layout:z.struct([z.u32("instruction")])},Merge:{index:7,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:z.struct([z.u32("instruction"),Te("newAuthorized"),z.u32("stakeAuthorizationType"),ku("authoritySeed"),Te("authorityOwner")])}}),uSe=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),ny=class{constructor(){}static initialize(e){let{stakePubkey:r,authorized:n,lockup:i}=e,s=i||xf.default,o=ho.Initialize,c=Ne(o,{authorized:{staker:ke(n.staker.toBuffer()),withdrawer:ke(n.withdrawer.toBuffer())},lockup:{unixTimestamp:s.unixTimestamp,epoch:s.epoch,custodian:ke(s.custodian.toBuffer())}}),u={keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:vf,isSigner:!1,isWritable:!1}],programId:this.programId,data:c};return new je(u)}static createAccountWithSeed(e){let r=new De;r.add(nn.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:i,lockup:s}=e;return r.add(this.initialize({stakePubkey:n,authorized:i,lockup:s}))}static createAccount(e){let r=new De;r.add(nn.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:i,lockup:s}=e;return r.add(this.initialize({stakePubkey:n,authorized:i,lockup:s}))}static delegate(e){let{stakePubkey:r,authorizedPubkey:n,votePubkey:i}=e,s=ho.Delegate,o=Ne(s);return new De().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:iS,isSigner:!1,isWritable:!1},{pubkey:CH,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static authorize(e){let{stakePubkey:r,authorizedPubkey:n,newAuthorizedPubkey:i,stakeAuthorizationType:s,custodianPubkey:o}=e,c=ho.Authorize,u=Ne(c,{newAuthorized:ke(i.toBuffer()),stakeAuthorizationType:s.index}),d=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&d.push({pubkey:o,isSigner:!0,isWritable:!1}),new De().add({keys:d,programId:this.programId,data:u})}static authorizeWithSeed(e){let{stakePubkey:r,authorityBase:n,authoritySeed:i,authorityOwner:s,newAuthorizedPubkey:o,stakeAuthorizationType:c,custodianPubkey:u}=e,d=ho.AuthorizeWithSeed,f=Ne(d,{newAuthorized:ke(o.toBuffer()),stakeAuthorizationType:c.index,authoritySeed:i,authorityOwner:ke(s.toBuffer())}),m=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Rs,isSigner:!1,isWritable:!1}];return u&&m.push({pubkey:u,isSigner:!0,isWritable:!1}),new De().add({keys:m,programId:this.programId,data:f})}static splitInstruction(e){let{stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:s}=e,o=ho.Split,c=Ne(o,{lamports:s});return new je({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static split(e,r){let n=new De;return n.add(nn.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:r,space:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,r){let{stakePubkey:n,authorizedPubkey:i,splitStakePubkey:s,basePubkey:o,seed:c,lamports:u}=e,d=new De;return d.add(nn.allocate({accountPubkey:s,basePubkey:o,seed:c,space:this.space,programId:this.programId})),r&&r>0&&d.add(nn.transfer({fromPubkey:e.authorizedPubkey,toPubkey:s,lamports:r})),d.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:i,splitStakePubkey:s,lamports:u}))}static merge(e){let{stakePubkey:r,sourceStakePubKey:n,authorizedPubkey:i}=e,s=ho.Merge,o=Ne(s);return new De().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:iS,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static withdraw(e){let{stakePubkey:r,authorizedPubkey:n,toPubkey:i,lamports:s,custodianPubkey:o}=e,c=ho.Withdraw,u=Ne(c,{lamports:s}),d=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:iS,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&d.push({pubkey:o,isSigner:!0,isWritable:!1}),new De().add({keys:d,programId:this.programId,data:u})}static deactivate(e){let{stakePubkey:r,authorizedPubkey:n}=e,i=ho.Deactivate,s=Ne(i);return new De().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}};ny.programId=new be("Stake11111111111111111111111111111111111111");ny.space=200;var Af=Object.freeze({InitializeAccount:{index:0,layout:z.struct([z.u32("instruction"),XW()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),Te("newAuthorized"),z.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:z.struct([z.u32("instruction"),JW()])}}),lSe=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),iy=class t{constructor(){}static initializeAccount(e){let{votePubkey:r,nodePubkey:n,voteInit:i}=e,s=Af.InitializeAccount,o=Ne(s,{voteInit:{nodePubkey:ke(i.nodePubkey.toBuffer()),authorizedVoter:ke(i.authorizedVoter.toBuffer()),authorizedWithdrawer:ke(i.authorizedWithdrawer.toBuffer()),commission:i.commission}}),c={keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:vf,isSigner:!1,isWritable:!1},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o};return new je(c)}static createAccount(e){let r=new De;return r.add(nn.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),r.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){let{votePubkey:r,authorizedPubkey:n,newAuthorizedPubkey:i,voteAuthorizationType:s}=e,o=Af.Authorize,c=Ne(o,{newAuthorized:ke(i.toBuffer()),voteAuthorizationType:s.index}),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new De().add({keys:u,programId:this.programId,data:c})}static authorizeWithSeed(e){let{currentAuthorityDerivedKeyBasePubkey:r,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:s,voteAuthorizationType:o,votePubkey:c}=e,u=Af.AuthorizeWithSeed,d=Ne(u,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:ke(n.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:ke(s.toBuffer()),voteAuthorizationType:o.index}}),f=[{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:Rs,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return new De().add({keys:f,programId:this.programId,data:d})}static withdraw(e){let{votePubkey:r,authorizedWithdrawerPubkey:n,lamports:i,toPubkey:s}=e,o=Af.Withdraw,c=Ne(o,{lamports:i}),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new De().add({keys:u,programId:this.programId,data:c})}static safeWithdraw(e,r,n){if(e.lamports>r-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return t.withdraw(e)}static updateValidatorIdentity(e){let{votePubkey:r,authorizedWithdrawerPubkey:n,nodePubkey:i}=e,s=Af.UpdateValidatorIdentity,o=Ne(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new De().add({keys:c,programId:this.programId,data:o})}};iy.programId=new be("Vote111111111111111111111111111111111111111");iy.space=3762;var dSe=new be("Va1idator1nfo111111111111111111111111111111"),fSe=X({name:ne(),website:me(ne()),details:me(ne()),iconUrl:me(ne()),keybaseUsername:me(ne())});var hSe=new be("Vote111111111111111111111111111111111111111"),pSe=z.struct([Te("nodePubkey"),Te("authorizedWithdrawer"),z.u8("commission"),z.nu64(),z.seq(z.struct([z.nu64("slot"),z.u32("confirmationCount")]),z.offset(z.u32(),-8),"votes"),z.u8("rootSlotValid"),z.nu64("rootSlot"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),Te("authorizedVoter")]),z.offset(z.u32(),-8),"authorizedVoters"),z.struct([z.seq(z.struct([Te("authorizedPubkey"),z.nu64("epochOfLastAuthorizedSwitch"),z.nu64("targetEpoch")]),32,"buf"),z.nu64("idx"),z.u8("isEmpty")],"priorVoters"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),z.nu64("credits"),z.nu64("prevCredits")]),z.offset(z.u32(),-8),"epochCredits"),z.struct([z.nu64("slot"),z.nu64("timestamp")],"lastTimestamp")]);var cT=Pr(Ba(),1);a();function sn(t){return t.toBase58()}function bt(t){return new be(t)}function BS(t){return new je({keys:t.keys.map(e=>({...e,pubkey:bt(e.pubkey)})),programId:bt(t.programId),data:cT.Buffer.from(t.data)})}a();function If(t){return{publicKey:sn(t.publicKey),secretKey:t.secretKey}}a();a();function Uu(t){return{version:t.version,header:t.header,accounts:t.staticAccountKeys.map(sn),blockhash:t.recentBlockhash,instructions:t.compiledInstructions.map(e=>({programIndex:e.programIdIndex,accountIndexes:e.accountKeyIndexes,data:new Uint8Array(e.data)})),addressLookupTables:t.addressTableLookups.map(e=>({publicKey:sn(e.accountKey),writableIndexes:e.writableIndexes,readonlyIndexes:e.readonlyIndexes}))}}function TS(t){return t.version==="legacy"?new vi({header:t.header,accountKeys:t.accounts.map(bt),recentBlockhash:t.blockhash,instructions:t.instructions.map(e=>({programIdIndex:e.programIndex,accounts:e.accountIndexes,data:M_.deserialize(e.data)[0]}))}):new $a({header:t.header,staticAccountKeys:t.accounts.map(bt),recentBlockhash:t.blockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIndex,accountKeyIndexes:e.accountIndexes,data:e.data})),addressTableLookups:t.addressLookupTables.map(e=>({accountKey:bt(e.publicKey),writableIndexes:e.writableIndexes,readonlyIndexes:e.readonlyIndexes}))})}function zS(t){return t.version==="legacy"?vi.compile({payerKey:bt(t.payer),instructions:t.instructions.map(BS),recentBlockhash:t.blockhash}):$a.compile({payerKey:bt(t.payer),instructions:t.instructions.map(BS),recentBlockhash:t.blockhash,addressLookupTableAccounts:t.addressLookupTables?.map(e=>new Mu({key:bt(e.publicKey),state:{addresses:e.addresses.map(bt),authority:void 0,deactivationSlot:BigInt(`0x${"ff".repeat(8)}`),lastExtendedSlot:0,lastExtendedSlotStartIndex:0}}))})}function kS(t){return new go(TS(t.message),t.signatures)}a();a();a();var MS=BigInt(0),NS=BigInt(1);function ay(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function Pf(t,e,r=""){let n=Qr(t),i=t?.length,s=e!==void 0;if(!n||s&&i!==e){let o=r&&`"${r}" `,c=s?` of length ${e}`:"",u=n?`length=${i}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+c+", got "+u)}return t}function uT(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?MS:BigInt("0x"+t)}function lT(t){return uT(ur(t))}function mo(t){return pt(t),uT(ur(Uint8Array.from(t).reverse()))}function LS(t,e){return _i(t.toString(16).padStart(e*2,"0"))}function dT(t,e){return LS(t,e).reverse()}function zn(t,e,r){let n;if(typeof e=="string")try{n=_i(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(Qr(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function fT(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function DS(t){return Uint8Array.from(t)}var CS=t=>typeof t=="bigint"&&MS<=t;function NH(t,e,r){return CS(t)&&CS(e)&&CS(r)&&e<=t&&t<r}function qS(t,e,r,n){if(!NH(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function hT(t){let e;for(e=0;t>MS;t>>=NS,e+=1);return e}var Rf=t=>(NS<<BigInt(t))-NS;function Of(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){let c=t[i];if(o&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}var US=()=>{throw new Error("not implemented")};function VS(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let s=t(r,...n);return e.set(r,s),s}}a();var on=BigInt(0),jr=BigInt(1),Xa=BigInt(2),yT=BigInt(3),mT=BigInt(4),bT=BigInt(5),MH=BigInt(7),_T=BigInt(8),LH=BigInt(9),AT=BigInt(16);function sr(t,e){let r=t%e;return r>=on?r:e+r}function Ei(t,e,r){let n=t;for(;e-- >on;)n*=n,n%=r;return n}function pT(t,e){if(t===on)throw new Error("invert: expected non-zero number");if(e<=on)throw new Error("invert: expected positive modulus, got "+e);let r=sr(t,e),n=e,i=on,s=jr,o=jr,c=on;for(;r!==on;){let d=n/r,f=n%r,m=i-o*d,_=s-c*d;n=r,r=f,i=o,s=c,o=m,c=_}if(n!==jr)throw new Error("invert: does not exist");return sr(i,e)}function FS(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function ST(t,e){let r=(t.ORDER+jr)/mT,n=t.pow(e,r);return FS(t,n,e),n}function DH(t,e){let r=(t.ORDER-bT)/_T,n=t.mul(e,Xa),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Xa),i),c=t.mul(s,t.sub(o,t.ONE));return FS(t,c,e),c}function qH(t){let e=Ts(t),r=vT(t),n=r(e,e.neg(e.ONE)),i=r(e,n),s=r(e,e.neg(n)),o=(t+MH)/AT;return(c,u)=>{let d=c.pow(u,o),f=c.mul(d,n),m=c.mul(d,i),_=c.mul(d,s),v=c.eql(c.sqr(f),u),P=c.eql(c.sqr(m),u);d=c.cmov(d,f,v),f=c.cmov(_,m,P);let B=c.eql(c.sqr(f),u),k=c.cmov(d,f,B);return FS(c,k,u),k}}function vT(t){if(t<yT)throw new Error("sqrt is not defined for small field");let e=t-jr,r=0;for(;e%Xa===on;)e/=Xa,r++;let n=Xa,i=Ts(t);for(;gT(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return ST;let s=i.pow(n,e),o=(e+jr)/Xa;return function(u,d){if(u.is0(d))return d;if(gT(u,d)!==1)throw new Error("Cannot find square root");let f=r,m=u.mul(u.ONE,s),_=u.pow(d,e),v=u.pow(d,o);for(;!u.eql(_,u.ONE);){if(u.is0(_))return u.ZERO;let P=1,B=u.sqr(_);for(;!u.eql(B,u.ONE);)if(P++,B=u.sqr(B),P===f)throw new Error("Cannot find square root");let k=jr<<BigInt(f-P-1),T=u.pow(m,k);f=P,m=u.sqr(T),_=u.mul(_,m),v=u.mul(v,T)}return v}}function UH(t){return t%mT===yT?ST:t%_T===bT?DH:t%AT===LH?qH(t):vT(t)}var Bs=(t,e)=>(sr(t,e)&jr)===jr,VH=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ET(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=VH.reduce((n,i)=>(n[i]="function",n),e);return Of(t,r),t}function FH(t,e,r){if(r<on)throw new Error("invalid exponent, negatives unsupported");if(r===on)return t.ONE;if(r===jr)return e;let n=t.ONE,i=e;for(;r>on;)r&jr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=jr;return n}function cy(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,c,u)=>t.is0(c)?o:(n[u]=o,t.mul(o,c)),t.ONE),s=t.inv(i);return e.reduceRight((o,c,u)=>t.is0(c)?o:(n[u]=t.mul(o,n[u]),t.mul(o,c)),s),n}function gT(t,e){let r=(t.ORDER-jr)/Xa,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function wT(t,e){e!==void 0&&mi(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Ts(t,e,r=!1,n={}){if(t<=on)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s,o=!1,c;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let _=e;_.BITS&&(i=_.BITS),_.sqrt&&(s=_.sqrt),typeof _.isLE=="boolean"&&(r=_.isLE),typeof _.modFromBytes=="boolean"&&(o=_.modFromBytes),c=_.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);let{nBitLength:u,nByteLength:d}=wT(t,i);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,m=Object.freeze({ORDER:t,isLE:r,BITS:u,BYTES:d,MASK:Rf(u),ZERO:on,ONE:jr,allowedLengths:c,create:_=>sr(_,t),isValid:_=>{if(typeof _!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof _);return on<=_&&_<t},is0:_=>_===on,isValidNot0:_=>!m.is0(_)&&m.isValid(_),isOdd:_=>(_&jr)===jr,neg:_=>sr(-_,t),eql:(_,v)=>_===v,sqr:_=>sr(_*_,t),add:(_,v)=>sr(_+v,t),sub:(_,v)=>sr(_-v,t),mul:(_,v)=>sr(_*v,t),pow:(_,v)=>FH(m,_,v),div:(_,v)=>sr(_*pT(v,t),t),sqrN:_=>_*_,addN:(_,v)=>_+v,subN:(_,v)=>_-v,mulN:(_,v)=>_*v,inv:_=>pT(_,t),sqrt:s||(_=>(f||(f=UH(t)),f(m,_))),toBytes:_=>r?dT(_,d):LS(_,d),fromBytes:(_,v=!0)=>{if(c){if(!c.includes(_.length)||_.length>d)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+_.length);let B=new Uint8Array(d);B.set(_,r?0:B.length-_.length),_=B}if(_.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+_.length);let P=r?mo(_):lT(_);if(o&&(P=sr(P,t)),!v&&!m.isValid(P))throw new Error("invalid field element: outside of range 0..ORDER");return P},invertBatch:_=>cy(m,_),cmov:(_,v,P)=>P?v:_});return Object.freeze(m)}var uy=BigInt(0),HS=BigInt(1);function xT(t,e){let r=e.negate();return t?r:e}function Bf(t,e){let r=cy(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function OT(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function KS(t,e){OT(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Rf(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function IT(t,e,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,c=Number(t&i),u=t>>o;c>n&&(c-=s,u+=HS);let d=e*n,f=d+Math.abs(c)-1,m=c===0,_=c<0,v=e%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:_,isNegF:v,offsetF:d}}function KH(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function WH(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var WS=new WeakMap,BT=new WeakMap;function jS(t){return BT.get(t)||1}function PT(t){if(t!==uy)throw new Error("invalid wNAF")}var ly=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>uy;)r&HS&&(n=n.add(i)),i=i.double(),r>>=HS;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=KS(r,this.bits),s=[],o=e,c=o;for(let u=0;u<n;u++){c=o,s.push(c);for(let d=1;d<i;d++)c=c.add(o),s.push(c);o=c.double()}return s}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE,o=KS(e,this.bits);for(let c=0;c<o.windows;c++){let{nextN:u,offset:d,isZero:f,isNeg:m,isNegF:_,offsetF:v}=IT(n,c,o);n=u,f?s=s.add(xT(_,r[v])):i=i.add(xT(m,r[d]))}return PT(n),{p:i,f:s}}wNAFUnsafe(e,r,n,i=this.ZERO){let s=KS(e,this.bits);for(let o=0;o<s.windows&&n!==uy;o++){let{nextN:c,offset:u,isZero:d,isNeg:f}=IT(n,o,s);if(n=c,!d){let m=r[u];i=i.add(f?m.negate():m)}}return PT(n),i}getPrecomputes(e,r,n){let i=WS.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),WS.set(r,i))),i}cached(e,r,n){let i=jS(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let s=jS(e);return s===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),r,i)}createCache(e,r){OT(r,this.bits),BT.set(e,r),WS.delete(e)}hasCache(e){return jS(e)!==1}};function dy(t,e,r,n){KH(r,t),WH(n,e);let i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");let o=t.ZERO,c=hT(BigInt(i)),u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);let d=Rf(u),f=new Array(Number(d)+1).fill(o),m=Math.floor((e.BITS-1)/u)*u,_=o;for(let v=m;v>=0;v-=u){f.fill(o);for(let B=0;B<s;B++){let k=n[B],T=Number(k>>BigInt(v)&d);f[T]=f[T].add(r[B])}let P=o;for(let B=f.length-1,k=o;B>0;B--)k=k.add(f[B]),P=P.add(k);if(_=_.add(P),v!==0)for(let B=0;B<u;B++)_=_.double()}return _}function RT(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return ET(e),e}else return Ts(t,{isLE:r})}function TT(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let u of["p","n","h"]){let d=e[u];if(!(typeof d=="bigint"&&d>uy))throw new Error(`CURVE.${u} must be positive bigint`)}let i=RT(e.p,r.Fp,n),s=RT(e.n,r.Fn,n),c=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let u of c)if(!i.isValid(e[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:s}}a();var bo=BigInt(0),br=BigInt(1),GS=BigInt(2),jH=BigInt(8);function HH(t,e,r,n){let i=t.sqr(r),s=t.sqr(n),o=t.add(t.mul(e.a,i),s),c=t.add(t.ONE,t.mul(e.d,t.mul(i,s)));return t.eql(o,c)}function GH(t,e={}){let r=TT("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o}=s;Of(e,{},{uvRatio:"function"});let c=GS<<BigInt(i.BYTES*8)-br,u=k=>n.create(k),d=e.uvRatio||((k,T)=>{try{return{isValid:!0,value:n.sqrt(n.div(k,T))}}catch{return{isValid:!1,value:bo}}});if(!HH(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(k,T,L=!1){let M=L?br:bo;return qS("coordinate "+k,T,M,c),T}function m(k){if(!(k instanceof P))throw new Error("ExtendedPoint expected")}let _=VS((k,T)=>{let{X:L,Y:M,Z:F}=k,Q=k.is0();T==null&&(T=Q?jH:n.inv(F));let W=u(L*T),Z=u(M*T),H=n.mul(F,T);if(Q)return{x:bo,y:br};if(H!==br)throw new Error("invZ was invalid");return{x:W,y:Z}}),v=VS(k=>{let{a:T,d:L}=s;if(k.is0())throw new Error("bad point: ZERO");let{X:M,Y:F,Z:Q,T:W}=k,Z=u(M*M),H=u(F*F),N=u(Q*Q),K=u(N*N),Y=u(Z*T),J=u(N*u(Y+H)),w=u(K+u(L*u(Z*H)));if(J!==w)throw new Error("bad point: equation left != right (1)");let l=u(M*F),h=u(Q*W);if(l!==h)throw new Error("bad point: equation left != right (2)");return!0});class P{constructor(T,L,M,F){this.X=f("x",T),this.Y=f("y",L),this.Z=f("z",M,!0),this.T=f("t",F),Object.freeze(this)}static CURVE(){return s}static fromAffine(T){if(T instanceof P)throw new Error("extended point not allowed");let{x:L,y:M}=T||{};return f("x",L),f("y",M),new P(L,M,br,u(L*M))}static fromBytes(T,L=!1){let M=n.BYTES,{a:F,d:Q}=s;T=DS(Pf(T,M,"point")),ay(L,"zip215");let W=DS(T),Z=T[M-1];W[M-1]=Z&-129;let H=mo(W),N=L?c:n.ORDER;qS("point.y",H,bo,N);let K=u(H*H),Y=u(K-br),J=u(Q*K-F),{isValid:w,value:l}=d(Y,J);if(!w)throw new Error("bad point: invalid y coordinate");let h=(l&br)===br,A=(Z&128)!==0;if(!L&&l===bo&&A)throw new Error("bad point: x=0 and x_0=1");return A!==h&&(l=u(-l)),P.fromAffine({x:l,y:H})}static fromHex(T,L=!1){return P.fromBytes(zn("point",T),L)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,L=!0){return B.createCache(this,T),L||this.multiply(GS),this}assertValidity(){v(this)}equals(T){m(T);let{X:L,Y:M,Z:F}=this,{X:Q,Y:W,Z}=T,H=u(L*Z),N=u(Q*F),K=u(M*Z),Y=u(W*F);return H===N&&K===Y}is0(){return this.equals(P.ZERO)}negate(){return new P(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:T}=s,{X:L,Y:M,Z:F}=this,Q=u(L*L),W=u(M*M),Z=u(GS*u(F*F)),H=u(T*Q),N=L+M,K=u(u(N*N)-Q-W),Y=H+W,J=Y-Z,w=H-W,l=u(K*J),h=u(Y*w),A=u(K*w),E=u(J*Y);return new P(l,h,E,A)}add(T){m(T);let{a:L,d:M}=s,{X:F,Y:Q,Z:W,T:Z}=this,{X:H,Y:N,Z:K,T:Y}=T,J=u(F*H),w=u(Q*N),l=u(Z*M*Y),h=u(W*K),A=u((F+Q)*(H+N)-J-w),E=h-l,x=h+l,O=u(w-L*J),C=u(A*E),I=u(x*O),b=u(A*O),R=u(E*x);return new P(C,I,R,b)}subtract(T){return this.add(T.negate())}multiply(T){if(!i.isValidNot0(T))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:L,f:M}=B.cached(this,T,F=>Bf(P,F));return Bf(P,[L,M])[0]}multiplyUnsafe(T,L=P.ZERO){if(!i.isValid(T))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return T===bo?P.ZERO:this.is0()||T===br?this:B.unsafe(this,T,M=>Bf(P,M),L)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return B.unsafe(this,s.n).is0()}toAffine(T){return _(this,T)}clearCofactor(){return o===br?this:this.multiplyUnsafe(o)}toBytes(){let{x:T,y:L}=this.toAffine(),M=n.toBytes(L);return M[M.length-1]|=T&br?128:0,M}toHex(){return ur(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(T){return Bf(P,T)}static msm(T,L){return dy(P,i,T,L)}_setWindowSize(T){this.precompute(T)}toRawBytes(){return this.toBytes()}}P.BASE=new P(s.Gx,s.Gy,br,u(s.Gx*s.Gy)),P.ZERO=new P(bo,br,br,bo),P.Fp=n,P.Fn=i;let B=new ly(P,i.BITS);return P.BASE.precompute(8),P}var fy=class{constructor(e){this.ep=e}static fromBytes(e){US()}static fromHex(e){US()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return ur(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};function $H(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');Of(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:s,Fn:o}=t,c=r.randomBytes||ys,u=r.adjustScalarBytes||(N=>N),d=r.domain||((N,K,Y)=>{if(ay(Y,"phflag"),K.length||Y)throw new Error("Contexts/pre-hash are not supported");return N});function f(N){return o.create(mo(N))}function m(N){let K=M.secretKey;N=zn("private key",N,K);let Y=zn("hashed private key",e(N),2*K),J=u(Y.slice(0,K)),w=Y.slice(K,2*K),l=f(J);return{head:J,prefix:w,scalar:l}}function _(N){let{head:K,prefix:Y,scalar:J}=m(N),w=i.multiply(J),l=w.toBytes();return{head:K,prefix:Y,scalar:J,point:w,pointBytes:l}}function v(N){return _(N).pointBytes}function P(N=Uint8Array.of(),...K){let Y=vt(...K);return f(e(d(Y,zn("context",N),!!n)))}function B(N,K,Y={}){N=zn("message",N),n&&(N=n(N));let{prefix:J,scalar:w,pointBytes:l}=_(K),h=P(Y.context,J,N),A=i.multiply(h).toBytes(),E=P(Y.context,A,l,N),x=o.create(h+E*w);if(!o.isValid(x))throw new Error("sign failed: invalid s");let O=vt(A,o.toBytes(x));return Pf(O,M.signature,"result")}let k={zip215:!0};function T(N,K,Y,J=k){let{context:w,zip215:l}=J,h=M.signature;N=zn("signature",N,h),K=zn("message",K),Y=zn("publicKey",Y,M.publicKey),l!==void 0&&ay(l,"zip215"),n&&(K=n(K));let A=h/2,E=N.subarray(0,A),x=mo(N.subarray(A,h)),O,C,I;try{O=t.fromBytes(Y,l),C=t.fromBytes(E,l),I=i.multiplyUnsafe(x)}catch{return!1}if(!l&&O.isSmallOrder())return!1;let b=P(w,C.toBytes(),O.toBytes(),K);return C.add(O.multiplyUnsafe(b)).subtract(I).clearCofactor().is0()}let L=s.BYTES,M={secretKey:L,publicKey:L,signature:2*L,seed:L};function F(N=c(M.seed)){return Pf(N,M.seed,"seed")}function Q(N){let K=H.randomSecretKey(N);return{secretKey:K,publicKey:v(K)}}function W(N){return Qr(N)&&N.length===o.BYTES}function Z(N,K){try{return!!t.fromBytes(N,K)}catch{return!1}}let H={getExtendedPublicKey:_,randomSecretKey:F,isValidSecretKey:W,isValidPublicKey:Z,toMontgomery(N){let{y:K}=t.fromBytes(N),Y=M.publicKey,J=Y===32;if(!J&&Y!==57)throw new Error("only defined for 25519 and 448");let w=J?s.div(br+K,br-K):s.div(K-br,K+br);return s.toBytes(w)},toMontgomerySecret(N){let K=M.secretKey;Pf(N,K);let Y=e(N.subarray(0,K));return u(Y).subarray(0,K)},randomPrivateKey:F,precompute(N=8,K=t.BASE){return K.precompute(N,!1)}};return Object.freeze({keygen:Q,getPublicKey:v,sign:B,verify:T,utils:H,Point:t,lengths:M})}function ZH(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=Ts(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},s={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:s}}function YH(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function zT(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=ZH(t),s=GH(e,r),o=$H(s,n,i);return YH(t,o)}var XH=BigInt(0),zs=BigInt(1),kT=BigInt(2),bve=BigInt(3),JH=BigInt(5),QH=BigInt(8),Vu=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Tf={p:Vu,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:QH,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function e7(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=Vu,c=t*t%s*t%s,u=Ei(c,kT,s)*c%s,d=Ei(u,zs,s)*t%s,f=Ei(d,JH,s)*d%s,m=Ei(f,e,s)*f%s,_=Ei(m,r,s)*m%s,v=Ei(_,n,s)*_%s,P=Ei(v,i,s)*v%s,B=Ei(P,i,s)*v%s,k=Ei(B,e,s)*f%s;return{pow_p_5_8:Ei(k,kT,s)*t%s,b2:c}}function t7(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var $S=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function XS(t,e){let r=Vu,n=sr(e*e*e,r),i=sr(n*n*e,r),s=e7(t*i).pow_p_5_8,o=sr(t*n*s,r),c=sr(e*o*o,r),u=o,d=sr(o*$S,r),f=c===t,m=c===sr(-t,r),_=c===sr(-t*$S,r);return f&&(o=u),(m||_)&&(o=d),Bs(o,r)&&(o=sr(-o,r)),{isValid:f||m,value:o}}var _o=Ts(Tf.p,{isLE:!0}),r7=Ts(Tf.n,{isLE:!0}),n7={...Tf,Fp:_o,hash:n0,adjustScalarBytes:t7,uvRatio:XS},qi=zT(n7);var ZS=$S,i7=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),s7=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),o7=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),a7=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),CT=t=>XS(zs,t),c7=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),YS=t=>qi.Point.Fp.create(mo(t)&c7);function NT(t){let{d:e}=Tf,r=Vu,n=T=>_o.create(T),i=n(ZS*t*t),s=n((i+zs)*o7),o=BigInt(-1),c=n((o-e*i)*n(i+e)),{isValid:u,value:d}=XS(s,c),f=n(d*t);Bs(f,r)||(f=n(-f)),u||(d=f),u||(o=i);let m=n(o*(i-zs)*a7-c),_=d*d,v=n((d+d)*c),P=n(m*i7),B=n(zs-_),k=n(zs+_);return new qi.Point(n(v*k),n(B*P),n(P*k),n(v*B))}function u7(t){pt(t,64);let e=YS(t.subarray(0,32)),r=NT(e),n=YS(t.subarray(32,64)),i=NT(n);return new ks(r.add(i))}var ks=class t extends fy{constructor(e){super(e)}static fromAffine(e){return new t(qi.Point.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static hashToCurve(e){return u7(zn("ristrettoHash",e,64))}static fromBytes(e){pt(e,32);let{a:r,d:n}=Tf,i=Vu,s=F=>_o.create(F),o=YS(e);if(!fT(_o.toBytes(o),e)||Bs(o,i))throw new Error("invalid ristretto255 encoding 1");let c=s(o*o),u=s(zs+r*c),d=s(zs-r*c),f=s(u*u),m=s(d*d),_=s(r*n*f-m),{isValid:v,value:P}=CT(s(_*m)),B=s(P*d),k=s(P*B*_),T=s((o+o)*B);Bs(T,i)&&(T=s(-T));let L=s(u*k),M=s(T*L);if(!v||Bs(M,i)||L===XH)throw new Error("invalid ristretto255 encoding 2");return new t(new qi.Point(T,L,zs,M))}static fromHex(e){return t.fromBytes(zn("ristrettoHex",e,32))}static msm(e,r){return dy(t,qi.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,s=Vu,o=k=>_o.create(k),c=o(o(n+r)*o(n-r)),u=o(e*r),d=o(u*u),{value:f}=CT(o(c*d)),m=o(f*c),_=o(f*u),v=o(m*_*i),P;if(Bs(i*v,s)){let k=o(r*ZS),T=o(e*ZS);e=k,r=T,P=o(m*s7)}else P=_;Bs(e*v,s)&&(r=o(-r));let B=o((n-r)*P);return Bs(B,s)&&(B=o(-B)),_o.toBytes(B)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:s}=e.ep,o=d=>_o.create(d),c=o(r*s)===o(n*i),u=o(n*s)===o(r*i);return c||u}is0(){return this.equals(t.ZERO)}};ks.BASE=new ks(qi.Point.BASE);ks.ZERO=new ks(qi.Point.ZERO);ks.Fp=_o;ks.Fn=r7;function MT(){return{generateKeypair:()=>If(yo.generate()),createKeypairFromSecretKey:c=>If(yo.fromSecretKey(c)),createKeypairFromSeed:c=>If(yo.fromSeed(c)),isOnCurve:c=>be.isOnCurve(bt(hr(c))),findPda:(c,u)=>{let[d,f]=be.findProgramAddressSync(u,bt(hr(c)));return[sn(d),f]},sign:(c,u)=>qi.sign(c,u.secretKey.slice(0,32)),verify:(c,u,d)=>qi.verify(u,c,hu(d))}}var JS=()=>({install(t){t.eddsa=MT()}});a();a();a();var LT=(...t)=>globalThis.fetch(...t),kve=globalThis.Headers,Cve=globalThis.Request,Nve=globalThis.Response;function DT(){return{send:async t=>{let e=t.headers?Object.entries(t.headers).reduce((d,[f,m])=>({...d,[f.toLowerCase()]:(Array.isArray(m)?m.join(", "):m).toLowerCase()}),{}):{},r=e["content-type"]?.includes("application/json")??!1,n;r&&t.data?n=JSON.stringify(t.data):n=t.data;let i={method:t.method,body:n,headers:e,follow:t.maxRedirects,signal:t.signal,timeout:t.timeout},s=await LT(t.url,i),o=s.headers.get("content-type")?.includes("application/json")??!1,c=await s.text();return{data:(o?JSON.parse(c):void 0)??c,body:c,ok:s.ok,status:s.status,statusText:s.statusText,headers:Object.fromEntries(s.headers.entries())}}}}a();var QS=()=>({install(t){t.http=DT()}});a();a();a();var hy=class extends fs{name="ProgramNotRecognizedError";constructor(e,r){let n=!za(e),i=e,s=r==="*"?"any":`the [${r}]`,o=`The provided program ${n?"name":"address"} [${i}] is not recognized in ${s} cluster. Did you forget to register this program? If so, you may use "context.programs.add(myProgram)" to fix this.`;super(o),this.identifier=e,this.cluster=r}},py=class extends Gd{name="ProgramErrorNotRecognizedError";constructor(e,r){let n=r.code?` of code [${r.code}]`:"",i=`The program [${e.name}] at address [${e.publicKey}] raised an error${n} that is not recognized by the programs registered on the SDK. Please check the underlying program error below for more details.`;super(i,e,r)}};function ev(t,e=[],r={}){let n=[...e],i={...r},s=(k,T="current")=>{let L=u(T),M=B(k);return za(M)?L.some(F=>F.publicKey===M):L.some(F=>F.name===M)},o=(k,T="current")=>{let L=P(T),M=u(T),F=B(k),Q=za(F)?M.find(W=>W.publicKey===F):M.find(W=>W.name===F);if(!Q)throw new hy(F,L);return Q},c=(k,T,L)=>{try{return o(k,L).publicKey}catch(M){if(T===void 0)throw M;return hr(T)}},u=(k="current")=>{let T=P(k);return T==="*"?n:n.filter(L=>L.isOnCluster(T))},d=(k,T=!0)=>{!T&&s(k.publicKey,"*")||n.unshift(k)},f=(k,T)=>{i[k]=T,B(k)},m=k=>{delete i[k]},_=()=>ev(t,n,i),v=(k,T)=>{if(!Array.isArray(k.logs)||k.logs.length===0)return null;let L=k.logs.join(`
-`),M=/Error processing Instruction (\d+):/,F=k.message.match(M)?.[1]??null,Q=/Custom program error: (0x[a-f0-9]+)/i,W=L.match(Q)?.[1]??null,Z=W?parseInt(W,16):null;if(F===null||Z===null)return null;let H=parseInt(F,10),N=T.message.instructions?.[H]?.programIndex??null,K=N?T.message.accounts[N]:null;if(!K)return null;let Y;try{Y=o(K)}catch{return null}return Y.getErrorFromCode(Z,k)??new py(Y,k)},P=k=>k==="current"?t.rpc.getCluster():k,B=(k,T=[])=>{if(za(k)||i[k]===void 0)return k;let L=[...T,k];if(T.includes(k))throw new Error(`Circular binding detected: ${L.join(" -> ")}`);return B(i[k],L)};return{has:s,get:o,getPublicKey:c,all:u,add:d,bind:f,unbind:m,clone:_,resolveError:v}}a();var tv=()=>({install(t){t.programs=ev(t)}});a();a();a();function rv(t,e,r){let n=null,i=()=>n||(typeof e=="string"?n=new Lu(e,r):n=e,n),s=q_(i().rpcEndpoint),o=async(W,Z={})=>{let H=await i().getAccountInfo(bt(W),Z);return qT(H,W)},c=async(W,Z={})=>(await i().getMultipleAccountsInfo(W.map(bt),Z)).map((N,K)=>qT(N,W[K])),u=async(W,Z={})=>(await i().getProgramAccounts(bt(W),{...Z,filters:Z.filters?.map(N=>l7(N))})).map(({pubkey:N,account:K})=>UT(K,sn(N))),d=async(W,Z={})=>{let H=await i().getBlockTime(W);return H?F_(H):null},f=async(W,Z={})=>{let H=await i().getBalance(bt(W),Z);return hs(H)},m=async()=>await i().getGenesisHash(),_=async(W,Z={})=>{let H=N=>i().getMinimumBalanceForRentExemption(N,Z.commitment);if(Z.includesHeaderBytes??!1){let N=await H(0),K=BigInt(N)/BigInt(L_);return hs(K*BigInt(W))}return hs(await H(W))},v=async(W={})=>i().getLatestBlockhash(W),P=async(W,Z={})=>{let H=await i().getTransaction(cr.deserialize(W)[0],{commitment:Z.commitment,maxSupportedTransactionVersion:0});if(!H)return null;if(!H.meta)throw new Error("Transaction meta is missing.");let{transaction:N,meta:K}=H,Y=Uu(N.message),J=l=>sn(new be(l)),w=l=>({accountIndex:l.accountIndex,amount:Wg(l.uiTokenAmount.amount,"splToken",l.uiTokenAmount.decimals),mint:J(l.mint),owner:l.owner?J(l.owner):null});return{response:{blockTime:H.blockTime!=null?BigInt(H.blockTime):void 0,slot:BigInt(H.slot),version:H.version},message:Y,serializedMessage:t.transactions.serializeMessage(Y),signatures:N.signatures.map(cr.serialize),meta:{fee:hs(K.fee),logs:K.logMessages??[],preBalances:K.preBalances.map(hs),postBalances:K.postBalances.map(hs),preTokenBalances:(K.preTokenBalances??[]).map(w),postTokenBalances:(K.postTokenBalances??[]).map(w),innerInstructions:K.innerInstructions?.map(l=>({index:l.index,instructions:l.instructions.map(h=>({programIndex:h.programIdIndex,accountIndexes:h.accounts,data:cr.serialize(h.data)}))}))??null,loadedAddresses:{writable:(K.loadedAddresses?.writable??[]).map(sn),readonly:(K.loadedAddresses?.readonly??[]).map(sn)},computeUnitsConsumed:K.computeUnitsConsumed?BigInt(K.computeUnitsConsumed):null,costUnits:K.costUnits?BigInt(K.costUnits):null,err:K.err}}},B=async(W,Z={})=>(await i().getSignatureStatuses(W.map(N=>cr.deserialize(N)[0]),{searchTransactionHistory:Z?.searchTransactionHistory??!1})).value.map(N=>N?{slot:N.slot,confirmations:N.confirmations,error:N.err,commitment:N.confirmationStatus??null}:null),k=async(W,Z={})=>!D_(await f(W,Z)),T=async(W,Z,H={})=>{let N=await i().requestAirdrop(bt(W),Number(Z.basisPoints));if(H.strategy){await Q(cr.serialize(N),H);return}await Q(cr.serialize(N),{...H,strategy:{type:"blockhash",...await v()}})},L=async(W,Z,H={})=>{let N=i()._rpcClient,K=Array.isArray(Z)?f7([...Z],H.commitment,H.extra):h7(Z,H.commitment,H.extra);return new Promise((Y,J)=>{let w=(l,h)=>{l?J(l):Y(h.result)};H.id?N.request(W,K,H.id,w):N.request(W,K,w)})},M=async(W,Z={})=>{try{let H=await i().sendRawTransaction(t.transactions.serialize(W),Z);return cr.serialize(H)}catch(H){let N=null;throw H instanceof Error&&"logs"in H&&(N=t.programs.resolveError(H,W)),N||H}},F=async(W,Z={})=>{try{let H=kS(W);return(await i().simulateTransaction(H,{sigVerify:Z.verifySignatures,accounts:{addresses:Z.accounts||[],encoding:"base64"},replaceRecentBlockhash:Z.replaceRecentBlockhash})).value}catch(H){let N=null;throw H instanceof Error&&"logs"in H&&(N=t.programs.resolveError(H,W)),N||H}},Q=async(W,Z)=>i().confirmTransaction(d7(W,Z),Z.commitment);return{getEndpoint:()=>i().rpcEndpoint,getCluster:()=>s,getAccount:o,getAccounts:c,getProgramAccounts:u,getBlockTime:d,getGenesisHash:m,getBalance:f,getRent:_,getSlot:async(W={})=>i().getSlot(W),getLatestBlockhash:v,getTransaction:P,getSignatureStatuses:B,accountExists:k,airdrop:T,call:L,sendTransaction:M,simulateTransaction:F,confirmTransaction:Q,get connection(){return i()}}}function UT(t,e){return{executable:t.executable,owner:sn(t.owner),lamports:hs(t.lamports),rentEpoch:t.rentEpoch?BigInt(t.rentEpoch):void 0,publicKey:e,data:new Uint8Array(t.data)}}function qT(t,e){return t?{...UT(t,e),exists:!0}:{exists:!1,publicKey:e}}function l7(t){if(!("memcmp"in t))return t;let{bytes:e,...r}=t.memcmp;return{memcmp:{...r,bytes:cr.deserialize(e)[0]}}}function d7(t,e){return e.strategy.type==="blockhash"?{...e.strategy,signature:cr.deserialize(t)[0]}:{...e.strategy,signature:cr.deserialize(t)[0],nonceAccountPubkey:bt(e.strategy.nonceAccountPubkey)}}function f7(t,e,r){if(!e&&!r)return t;let n={};return e&&(n.commitment=e),r&&(n={...n,...r}),t.push(n),t}function h7(t={},e,r){if(!e&&!r)return t;let n={...t};return e&&(n.commitment=e),r&&Object.assign(n,r),n}function gy(t,e){return{install(r){r.rpc=typeof t=="string"?rv(r,t,e):rv(r,t)}}}a();a();var VT=(t,e=100)=>({...t,getAccounts:async(r,n)=>{let i=U_(r,e).map(o=>t.getAccounts(o,n));return(await Promise.all(i)).flat()}});a();var nv=(t=100)=>({install(e){e.rpc=VT(e.rpc,t)}});a();a();function FT(t={}){return{tuple:C_,array:yi,map:O_,set:k_,option:T_,nullable:B_,struct:ds,enum:z_,dataEnum:R_,string:jd,bool:P_,unit:N_,u8:St,u16:w_,u32:gi,u64:x_,u128:I_,i8:__,i16:A_,i32:S_,i64:v_,i128:E_,f32:m_,f64:b_,bytes:ka,publicKey:mu}}a();var iv=(t={})=>({install(e){e.serializer=FT(t)}});a();a();a();var KT=128,p7=127;function WT(){let t=_=>{let v=zS(_),P=Uu(v),B=new go(v,_.signatures);return{message:P,serializedMessage:n(P),signatures:B.signatures}},e=_=>s().serialize(_),r=_=>s().deserialize(_)[0],n=_=>o().serialize(_),i=_=>o().deserialize(_)[0],s=()=>({...qg(ds([["signatures",yi(ka({size:64}),{size:ki()})],["serializedMessage",ka()]]),_=>_,_=>({..._,message:i(_.serializedMessage)})),description:"Transaction"}),o=()=>({description:"TransactionMessage",fixedSize:null,maxSize:null,serialize:_=>c(_.version).serialize(_),deserialize:(_,v=0)=>{let[P]=u().deserialize(_,v);return c(P).deserialize(_,v)}}),c=_=>ds([["version",u()],["header",d()],["accounts",yi(mu(),{size:ki()})],["blockhash",jd({encoding:cr,size:32})],["instructions",yi(f(),{size:ki()})],["addressLookupTables",yi(m(),{size:_==="legacy"?0:ki()})]]),u=()=>({description:"TransactionVersion",fixedSize:null,maxSize:1,serialize:_=>_==="legacy"?new Uint8Array([]):new Uint8Array([KT|_]),deserialize:(_,v=0)=>{let P=_.slice(v);if(P.length===0||(P[0]&KT)===0)return["legacy",v];let B=P[0]&p7;if(B>0)throw new fs(`Unsupported transaction version: ${B}.`);return[B,v+1]}}),d=()=>ds([["numRequiredSignatures",St()],["numReadonlySignedAccounts",St()],["numReadonlyUnsignedAccounts",St()]]),f=()=>ds([["programIndex",St()],["accountIndexes",yi(St(),{size:ki()})],["data",ka({size:ki()})]]),m=()=>ds([["publicKey",mu()],["writableIndexes",yi(St(),{size:ki()})],["readonlyIndexes",yi(St(),{size:ki()})]]);return{create:t,serialize:e,deserialize:r,serializeMessage:n,deserializeMessage:i}}var sv=()=>({install(t){t.transactions=WT()}});function ov(t,e){return{install(r){r.use(iv()),r.use(tv()),r.use(QS()),r.use(H_()),r.use(JS()),r.use(typeof t=="string"?gy(t,e):gy(t)),r.use(nv(e?.getAccountsChunkSize)),r.use(sv())}}}function jT(t,e){return j_().use(typeof t=="string"?ov(t,e):ov(t,e))}var Tb=Pr(gb(),1),zq=Pr(wb(),1);a();var Rb=Pr(gb(),1);var dq=Pr(wb(),1);a();var Bde="https://eips.ethereum.org/EIPS/eip-8004#registration-v1";function Tde(t){if(typeof p.Buffer<"u")return p.Buffer.from(t,"utf8").toString("base64");let e=new TextEncoder().encode(t),r="";for(let n of e)r+=String.fromCharCode(n);return btoa(r)}var zde=t=>Tde(JSON.stringify(t));function Ld(t){return`data:application/json;base64,${zde(t)}`}function xb({name:t,image:e,animationUrl:r,description:n,externalUrl:i,attributes:s}={}){if(!t)throw Object.assign(new Error("asset metadata requires a name"),{code:"validation_error"});let o={name:t};return e&&(o.image=e),r&&(o.animation_url=r),n&&(o.description=n),i&&(o.external_url=i),Array.isArray(s)&&s.length&&(o.attributes=s.map(c=>({trait_type:String(c.key??c.trait_type),value:String(c.value)}))),o}function Ib({name:t,description:e,image:r,modelUrl:n,services:i,active:s=!0,x402Support:o=!1,registrations:c=[],supportedTrust:u=["reputation"]}={}){if(!t)throw Object.assign(new Error("registration requires a name"),{code:"validation_error"});let d={type:Bde,name:t,description:e||""};return r&&(d.image=r),n&&(d.model={uri:n}),Array.isArray(i)&&i.length&&(d.services=i.map(f=>({name:String(f.name),endpoint:String(f.endpoint)}))),d.active=s!==!1,d.x402Support=!!o,Array.isArray(c)&&c.length&&(d.registrations=c.map(f=>({agentId:String(f.agentId??f.agent_id),agentRegistry:String(f.agentRegistry??f.agent_registry)}))),d.supportedTrust=Array.isArray(u)&&u.length?u.map(String):["reputation"],d}function Pb(t,e){return{agentId:String(t),agentRegistry:`solana:${e==="devnet"?103:101}:metaplex`}}function lq(t){return{agentId:String(t),agentRegistry:"https://three.ws"}}function kde({creator:t,royaltyBasisPoints:e=500,royaltyCreators:r,verifiedCreator:n=!0,immutableMetadata:i=!0,attributes:s,permanentFreeze:o=!1,permanentTransfer:c=!1,permanentBurn:u=!1,addBlocker:d=!1}={}){let f=[],m=Number(e);if(!Number.isInteger(m)||m<0||m>1e4)throw Object.assign(new Error(`royalty_basis_points must be an integer 0..10000 (got ${e})`),{code:"validation_error"});if(m>0){let _=(r?.length?r:[{address:t,percentage:100}]).map(P=>({address:hr(P.address),percentage:Number(P.percentage)})),v=_.reduce((P,B)=>P+B.percentage,0);if(v!==100)throw Object.assign(new Error(`royalty creator percentages must sum to 100 (got ${v})`),{code:"validation_error"});f.push({type:"Royalties",basisPoints:m,creators:_,ruleSet:(0,Rb.ruleSet)("None")})}return n&&f.push({type:"VerifiedCreators",signatures:[{address:hr(t),verified:!0}]}),i&&f.push({type:"ImmutableMetadata"}),Array.isArray(s)&&s.length&&f.push({type:"Attributes",attributeList:s.map(_=>({key:String(_.key),value:String(_.value)}))}),o&&f.push({type:"PermanentFreezeDelegate",frozen:!1}),c&&f.push({type:"PermanentTransferDelegate"}),u&&f.push({type:"PermanentBurnDelegate"}),d&&f.push({type:"AddBlocker"}),f}function fq(t,{network:e,creator:r,owner:n,collection:i,name:s,description:o="",image:c,modelUrl:u,externalUrl:d,metadataAttributes:f,metadataUri:m,services:_,active:v=!0,x402Support:P=!1,registrations:B,threeWsAgentId:k,supportedTrust:T,registrationUri:L,royaltyBasisPoints:M,royaltyCreators:F,verifiedCreator:Q,immutableMetadata:W,attributes:Z,permanentFreeze:H,permanentTransfer:N,permanentBurn:K,addBlocker:Y}={}){let J=$g(t),w=J.publicKey.toString(),l=m?null:xb({name:s,image:c,animationUrl:u,description:void 0,externalUrl:d,attributes:f}),h=m||Ld(l),A=B?.length?B:k?[lq(k)]:[Pb(w,e)],E=L?null:Ib({name:s,description:o,image:c,modelUrl:u,services:_,active:v,x402Support:P,registrations:A,supportedTrust:T}),x=L||Ld(E),O={asset:J,name:s,uri:h,plugins:kde({creator:r,royaltyBasisPoints:M,royaltyCreators:F,verifiedCreator:Q,immutableMetadata:W,attributes:Z,permanentFreeze:H,permanentTransfer:N,permanentBurn:K,addBlocker:Y})};n&&(O.owner=hr(n)),i&&(O.collection=hr(i));let C={asset:J.publicKey,agentRegistrationUri:x};i&&(C.collection=hr(i));let I=(0,Rb.create)(t,O),b=(0,dq.registerIdentityV1)(t,C),R=I.add(b),ee=R.fitsInOneTransaction(t);return{atomic:ee,builders:ee?[R]:[I,b],createBuilder:I,registerBuilder:b,combinedBuilder:R,assetSigner:J,assetMetadata:l,metadataUri:h,registration:E,registrationUri:x}}var hq=t=>new Promise(e=>setTimeout(e,t));async function Cde(t,e,{tries:r=12,delayMs:n=1500}={}){for(let i=0;i<r;i++){let s=await t.rpc.getAccount(e).catch(()=>null);if(s?.exists&&s.data?.length)return!0;await hq(n)}return!1}function Nde(t){return/Invalid Core Asset|custom program error: 0x4/i.test(t?.message||"")}async function pq(t,e,{toBase58Signature:r}){let n={confirm:{commitment:"confirmed"}};if(e.atomic){let o=await e.combinedBuilder.sendAndConfirm(t,n);return{signatures:[r(o.signature)],atomic:!0}}let i=await e.createBuilder.sendAndConfirm(t,n);await Cde(t,e.assetSigner.publicKey);let s;for(let o=0;;o++)try{s=await e.registerBuilder.sendAndConfirm(t,n);break}catch(c){if(!Nde(c)||o>=4)throw c;await hq(2e3)}return{signatures:[r(i.signature),r(s.signature)],atomic:!1}}a();a();a();function Mde(t){if(t.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let d=0;d<e.length;d++)e[d]=255;for(let d=0;d<t.length;d++){let f=t.charAt(d),m=f.charCodeAt(0);if(e[m]!==255)throw new TypeError(f+" is ambiguous");e[m]=d}let r=t.length,n=t.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";let f=0,m=0,_=0,v=d.length;for(;_!==v&&d[_]===0;)_++,f++;let P=(v-_)*s+1>>>0,B=new Uint8Array(P);for(;_!==v;){let L=d[_],M=0;for(let F=P-1;(L!==0||M<m)&&F!==-1;F--,M++)L+=256*B[F]>>>0,B[F]=L%r>>>0,L=L/r>>>0;if(L!==0)throw new Error("Non-zero carry");m=M,_++}let k=P-m;for(;k!==P&&B[k]===0;)k++;let T=n.repeat(f);for(;k<P;++k)T+=t.charAt(B[k]);return T}function c(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;let f=0,m=0,_=0;for(;d[f]===n;)m++,f++;let v=(d.length-f)*i+1>>>0,P=new Uint8Array(v);for(;f<d.length;){let L=d.charCodeAt(f);if(L>255)return;let M=e[L];if(M===255)return;let F=0;for(let Q=v-1;(M!==0||F<_)&&Q!==-1;Q--,F++)M+=r*P[Q]>>>0,P[Q]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");_=F,f++}let B=v-_;for(;B!==v&&P[B]===0;)B++;let k=new Uint8Array(m+(v-B)),T=m;for(;B!==v;)k[T++]=P[B++];return k}function u(d){let f=c(d);if(f)return f;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:c,decode:u}}var gq=Mde;var Lde="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Pg=gq(Lde);var mq=Pr(gb(),1);var Vde=Pr(wb(),1);a();function Pa(t,e){let r=typeof g<"u"&&g.env?g.env[t]:void 0;return r!==void 0&&String(r).trim()!==""?String(r).trim():e}var yq=(()=>{let t=Pa("METAPLEX_AGENT_NETWORK",Pa("SOLANA_NETWORK","mainnet")).toLowerCase();if(t==="devnet")return"devnet";if(t==="mainnet"||t==="mainnet-beta")return"mainnet";throw Object.assign(new Error(`METAPLEX_AGENT_NETWORK must be "mainnet" or "devnet" (got "${t}")`),{code:"bad_network_config"})})(),Dde={mainnet:"https://api.mainnet-beta.solana.com",devnet:"https://api.devnet.solana.com"};function qde(t){let e;try{e=new URL(t)}catch{throw Object.assign(new Error(`SOLANA_RPC_URL is not a valid URL: "${t}"`),{code:"bad_rpc_url"})}if(e.protocol==="https:")return t;let r=["localhost","127.0.0.1","0.0.0.0","::1"].includes(e.hostname);if(e.protocol==="http:"&&r)return t;throw Object.assign(new Error(`SOLANA_RPC_URL must be https (got "${e.protocol}//${e.hostname}"). Only http://localhost is allowed for local dev.`),{code:"insecure_rpc_url"})}var ZLe=qde(Pa("SOLANA_RPC_URL",Dde[yq]));var Ude=Pa("SOLANA_SECRET_KEY",Pa("FUNDER_SECRET","")),YLe=Pa("THREE_WS_BASE","https://three.ws").replace(/\/+$/,""),XLe=(()=>{let t=Pa("REQUIRE_CONFIRM");return t===void 0?!0:!["0","false","no","off"].includes(String(t).toLowerCase())})(),JLe=(()=>{let t=Pa("THREE_WS_TIMEOUT_MS");if(t===void 0)return 3e4;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw Object.assign(new Error(`THREE_WS_TIMEOUT_MS must be a positive number (got "${t}")`),{code:"bad_config"});return e})();var bq=1e9,iDe=Math.floor(.004*bq),sDe=Math.floor(.003*bq);function _q(t){return typeof t=="string"?t:Pg.encode(t)}a();var rP="map.rpc.custom",Aq="https://api.devnet.solana.com",Ob="https://three.ws/api/solana-rpc";function nP(t){try{return JSON.parse(localStorage.getItem(rP)||"{}")[t]||""}catch{return""}}function iP(t,e){let r={};try{r=JSON.parse(localStorage.getItem(rP)||"{}")}catch{r={}}e?r[t]=e:delete r[t],localStorage.setItem(rP,JSON.stringify(r))}async function Rg(t,e,r=[]){let n=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:e,params:r})});if(!n.ok)throw new Error(`${e} returned HTTP ${n.status}`);let i=await n.json();if(i.error)throw new Error(i.error.message||`${e} failed`);return i.result}async function tP(t){try{let e=await Rg(t,"getHealth");return e==="ok"||e===void 0}catch{return!1}}var Sq={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1"};async function vq(t,e){let r;try{r=new URL(t)}catch{return{ok:!1,message:"That is not a valid URL."}}if(r.protocol!=="https:")return{ok:!1,message:"The endpoint must be https."};let n;try{n=await Rg(t,"getGenesisHash")}catch(i){return{ok:!1,message:`The endpoint did not answer: ${i.message}`}}if(n!==Sq[e]){let i=Object.entries(Sq).find(([,s])=>s===n)?.[0];return{ok:!1,message:i?`That endpoint is on ${i}, not ${e}.`:"That endpoint is on an unrecognised cluster."}}return{ok:!0,message:"Endpoint verified."}}async function Eq(t){let e=nP(t);return e?{endpoint:e,source:"custom"}:t==="devnet"?await tP(Aq)?{endpoint:Aq,source:"public"}:await tP(Ob+"?net=devnet")?{endpoint:Ob+"?net=devnet",source:"threews"}:{endpoint:null,source:"none"}:await tP(Ob)?{endpoint:Ob,source:"threews"}:{endpoint:null,source:"none"}}a();var aP="map.wallet.v1",wq=31e4,Fde=[{id:"phantom",label:"Phantom",find:()=>window.phantom?.solana?.isPhantom&&window.phantom.solana},{id:"solflare",label:"Solflare",find:()=>window.solflare?.isSolflare&&window.solflare},{id:"backpack",label:"Backpack",find:()=>window.backpack?.solana},{id:"seeker",label:"Seeker",find:()=>window.threeWsWallet?.isThreeWs&&window.threeWsWallet},{id:"solana",label:"Browser wallet",find:()=>window.solana}];function cP(){let t=new Set,e=[];for(let r of Fde){let n=null;try{n=r.find()}catch{n=null}!n||t.has(n)||(t.add(n),e.push({id:r.id,label:r.label,provider:n}))}return e}var Kde=new TextEncoder,fDe=new TextDecoder,sP=t=>btoa(String.fromCharCode(...new Uint8Array(t))),oP=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0));async function xq(t,e){let r=await crypto.subtle.importKey("raw",Kde.encode(t),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:wq,hash:"SHA-256"},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Wde(t,e){let r=crypto.getRandomValues(new Uint8Array(16)),n=crypto.getRandomValues(new Uint8Array(12)),i=await xq(e,r),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,t);return{v:1,kdf:"PBKDF2-SHA256",iterations:wq,salt:sP(r),iv:sP(n),data:sP(s)}}async function jde(t,e){let r=await xq(e,oP(t.salt)),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:oP(t.iv)},r,oP(t.data));return new Uint8Array(n)}function uP(){try{let t=localStorage.getItem(aP);return t?JSON.parse(t):null}catch{return null}}function Iq(){return!!uP()}function lP(){return uP()?.address||null}function Pq(){localStorage.removeItem(aP)}var Dd=class t{#e;constructor(e){this.#e=e}get address(){return this.#e.publicKey.toString()}signer(e){return Zg(e,this.#e)}exportSecretKey(){return Pg.encode(this.#e.secretKey)}static async create(e,r){let n=e.eddsa.generateKeypair();return await t.#t(n,r),new t(n)}static async importSecret(e,r,n){let i=String(r).trim(),s;if(i.startsWith("[")?s=Uint8Array.from(JSON.parse(i)):s=Pg.decode(i),s.length!==64)throw new Error(`A Solana secret key is 64 bytes; that one is ${s.length}.`);let o=e.eddsa.createKeypairFromSecretKey(s);return await t.#t(o,n),new t(o)}static async unlock(e,r){let n=uP();if(!n)throw new Error("No wallet has been created in this browser yet.");let i;try{i=await jde(n.secret,r)}catch{throw Object.assign(new Error("That passphrase does not unlock this wallet."),{code:"bad_passphrase"})}let s=e.eddsa.createKeypairFromSecretKey(i);return new t(s)}static async#t(e,r){let n=await Wde(e.secretKey,r);localStorage.setItem(aP,JSON.stringify({address:e.publicKey.toString(),createdAt:new Date().toISOString(),secret:n}))}};function dP(t,e){let r={type:"solana-keypair-backup",createdBy:"Metaplex Agent Deployer (three.ws)",address:t,secretKey:e,note:"Anyone with this secret key controls this wallet and everything it holds. Keep it offline. Import it into Phantom, Solflare, or the Solana CLI with this base58 string.",exportedAt:new Date().toISOString()};return new Blob([JSON.stringify(r,null,2)],{type:"application/json"})}a();var Bb="https://three.ws";async function fP(t,{timeoutMs:e=15e3}={}){let r=new AbortController,n=setTimeout(()=>r.abort(),e);try{let i=await fetch(t,{signal:r.signal,headers:{accept:"application/json"}});if(!i.ok)throw new Error(`three.ws returned HTTP ${i.status}`);return await i.json()}finally{clearTimeout(n)}}var Rq=t=>({id:t.avatarId||t.id,name:t.name||"Untitled",description:t.description||"",image:t.image||"",modelUrl:t.glbUrl||"",pageUrl:`${Bb}/avatars/${t.avatarId||t.id}`});async function Oq({query:t="",limit:e=12,cursor:r=""}={}){let n=new URLSearchParams({source:"avatar",only3d:"1",limit:String(e)});t&&n.set("q",t),r&&n.set("cursor",r);let i=await fP(`${Bb}/api/explore?${n}`);return{items:(i.items||[]).filter(o=>o.glbUrl).map(Rq),cursor:i.nextCursor||i.cursor||""}}async function Bq(t){let e=String(t||"").trim();if(!e)throw new Error("Paste a three.ws avatar link or id.");let r=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i)?.[0];if(!r)throw new Error("That does not contain a three.ws avatar id.");let n=await fP(`${Bb}/api/explore-item?kind=avatar&id=${r}`);if(!n.item)throw new Error("No three.ws avatar with that id.");let i=Rq(n.item);if(!i.modelUrl)throw new Error("That avatar has no 3D model to attach.");return i}async function Tq(t=8){return((await fP(`${Bb}/api/deployments?chain=101&network=mainnet&limit=${t}`))?.data?.deployments||[]).map(r=>({asset:r.agent_id,name:r.name||r.agent_id.slice(0,6),image:r.image||"",has3d:!!r.has_3d,x402:!!r.x402_support,at:r.registered_at}))}var V=t=>document.getElementById(t),pi=t=>String(t??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),pP=t=>t&&t.length>12?`${t.slice(0,4)}\u2026${t.slice(-4)}`:t||"",zb=t=>new Promise(e=>setTimeout(e,t)),qd=.007,fe={network:"devnet",endpoint:null,endpointSource:"none",wallet:null,source:"custom",previewDoc:"registration",pickerCursor:"",deploying:!1};function kq(t){return jT(t).use((0,Tb.mplCore)()).use((0,zq.mplAgentIdentity)())}function gP(){return kq(fe.endpoint||"https://api.devnet.solana.com")}V("theme-toggle").addEventListener("click",()=>{let t=document.documentElement.getAttribute("data-theme")==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("map.theme",t)}catch{}});document.addEventListener("click",t=>{let e=t.target.closest(".copy");if(!e)return;let r=V(e.dataset.copy);r&&navigator.clipboard.writeText(r.textContent.trim()).then(()=>{let n=e.textContent;e.textContent="Copied",e.classList.add("done"),setTimeout(()=>{e.textContent=n,e.classList.remove("done")},1400)})});async function kb(t){fe.network=t;for(let n of document.querySelectorAll(".net-btn")){let i=n.dataset.net===t;n.classList.toggle("active",i),n.setAttribute("aria-checked",String(i))}V("rail-net").textContent=t==="devnet"?"Devnet (rehearsal)":"Solana mainnet",V("rail-rpc").textContent="Checking endpoint\u2026",V("airdrop-btn").hidden=!(t==="devnet"&&fe.wallet);let{endpoint:e,source:r}=await Eq(t);fe.endpoint=e,fe.endpointSource=r,V("rail-rpc").textContent=r==="custom"?`Your endpoint: ${new URL(e).host}`:r==="threews"?"three.ws public proxy":r==="public"?"Solana public devnet":"No endpoint available. Add your own to continue.",fe.wallet&&Cb(),wn()}V("rpc-btn").addEventListener("click",()=>{V("rpc-modal-net").textContent=fe.network,V("rpc-input").value=nP(fe.network),V("rpc-error").hidden=!0,V("rpc-ok").hidden=!0,V("rpc-modal").showModal()});V("rpc-save").addEventListener("click",async()=>{let t=V("rpc-input").value.trim();if(V("rpc-error").hidden=!0,V("rpc-ok").hidden=!0,!t){V("rpc-error").textContent="Paste an endpoint URL first.",V("rpc-error").hidden=!1;return}V("rpc-save").disabled=!0,V("rpc-save").textContent="Verifying\u2026";let e=await vq(t,fe.network);if(V("rpc-save").disabled=!1,V("rpc-save").textContent="Verify and save",!e.ok){V("rpc-error").textContent=e.message,V("rpc-error").hidden=!1;return}iP(fe.network,t),V("rpc-ok").textContent=`${e.message} Using it for ${fe.network}.`,V("rpc-ok").hidden=!1,await kb(fe.network),setTimeout(()=>V("rpc-modal").close(),900)});V("rpc-clear").addEventListener("click",async()=>{iP(fe.network,""),V("rpc-input").value="",await kb(fe.network),V("rpc-modal").close()});for(let t of document.querySelectorAll(".net-btn"))t.addEventListener("click",()=>kb(t.dataset.net));function Tg(){let t=cP();V("injected-list").innerHTML=t.map((r,n)=>`<button type="button" class="choice" data-injected="${n}"><span class="choice-ic" aria-hidden="true">${pi(r.label.slice(0,1))}</span><span class="choice-body"><strong>${pi(r.label)}</strong><small>Detected in this browser</small></span></button>`).join("");for(let r of V("injected-list").querySelectorAll("[data-injected]"))r.addEventListener("click",()=>Hde(t[Number(r.dataset.injected)]));V("no-wallet-hint").hidden=t.length>0;let e=Iq();V("unlock-wallet-btn").hidden=!e,V("create-wallet-btn").hidden=e,e&&(V("unlock-wallet-sub").textContent=`Wallet ${pP(lP())} is stored in this browser.`)}async function Hde(t){V("wallet-error").hidden=!0;try{let r=(await t.provider.connect())?.publicKey||t.provider.publicKey;if(!r)throw new Error("The wallet connected but gave no address.");zg({kind:"injected",label:t.label,address:r.toString(),provider:t.provider})}catch(e){Cq(/reject|denied|4001/i.test(e?.message||"")?"The wallet dismissed the request. Try again when you are ready.":`Could not connect: ${e?.message||e}`)}}function zg(t){fe.wallet=t,V("wallet-choices").hidden=!0,V("wallet-connected").hidden=!1,V("wallet-status").textContent="Connected",V("wallet-kind").textContent=t.kind==="hosted"?"This browser":t.label,V("wallet-address").textContent=pP(t.address),V("wallet-address").title=t.address,V("wallet-manage-btn").hidden=t.kind!=="hosted",V("airdrop-btn").hidden=fe.network!=="devnet",Cb(),wn()}function Cq(t){V("wallet-error").textContent=t,V("wallet-error").hidden=!1}V("disconnect-btn").addEventListener("click",()=>{try{fe.wallet?.provider?.disconnect?.()}catch{}fe.wallet=null,V("wallet-choices").hidden=!1,V("wallet-connected").hidden=!0,V("wallet-status").textContent="Not connected",Tg(),wn()});async function Cb(){if(!fe.wallet||!fe.endpoint){V("wallet-balance").textContent="";return}try{let e=((await Rg(fe.endpoint,"getBalance",[fe.wallet.address]))?.value??0)/1e9;fe.balance=e,V("wallet-balance").textContent=`${e.toFixed(4)} SOL`;let r=e<qd;V("funding-warn").hidden=!r,r&&(V("funding-warn").textContent=fe.network==="devnet"?`This wallet holds ${e.toFixed(4)} SOL. A mint costs about ${qd} SOL. Use "Get devnet SOL" above, it is free.`:`This wallet holds ${e.toFixed(4)} SOL. A mint costs about ${qd} SOL. Send some SOL to ${fe.wallet.address} and it will update here.`)}catch{V("wallet-balance").textContent="balance unavailable"}wn()}V("airdrop-btn").addEventListener("click",async()=>{if(!fe.wallet||!fe.endpoint)return;let t=V("airdrop-btn");t.disabled=!0,t.textContent="Requesting\u2026";try{await Rg(fe.endpoint,"requestAirdrop",[fe.wallet.address,1e9]);for(let e=0;e<12&&(await zb(2e3),await Cb(),!((fe.balance||0)>0));e++);}catch(e){Cq(`The devnet faucet declined: ${e?.message||e}. Faucets rate-limit hard; wait a minute, or use https://faucet.solana.com with your address.`)}finally{t.disabled=!1,t.textContent="Get devnet SOL"}});function kg(t){return V("wallet-modal-body").innerHTML=t,V("wallet-modal").showModal(),V("wallet-modal-body")}V("create-wallet-btn").addEventListener("click",()=>{let t=kg(`
+`+s+o;break;default:c=`Unknown action '${(u=>u)(e)}'`}super(c),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=r,this.transactionMessage=n,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let e=this.transactionLogs;if(!(e!=null&&typeof e=="object"&&"then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((r,n)=>{e.getTransaction(this.signature).then(i=>{if(i&&i.meta&&i.meta.logMessages){let s=i.meta.logMessages;this.transactionLogs=s,r(s)}else n(new Error("Log messages not found"))}).catch(n)})),await this.transactionLogs}};var pe=class extends Error{constructor({code:e,message:r,data:n},i){super(i!=null?`${i}: ${r}`:r),this.code=void 0,this.data=void 0,this.code=e,this.data=n,this.name="SolanaJSONRPCError"}};async function zC(t,e,r,n){let i=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},s=await t.sendTransaction(e,r,i),o;if(e.recentBlockhash!=null&&e.lastValidBlockHeight!=null)o=(await t.confirmTransaction({abortSignal:n?.abortSignal,signature:s,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},n&&n.commitment)).value;else if(e.minNonceContextSlot!=null&&e.nonceInfo!=null){let{nonceInstruction:c}=e.nonceInfo,u=c.keys[0].pubkey;o=(await t.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:u,nonceValue:e.nonceInfo.nonce,signature:s},n&&n.commitment)).value}else n?.abortSignal!=null&&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."),o=(await t.confirmTransaction(s,n&&n.commitment)).value;if(o.err)throw s!=null?new Ih({action:"send",signature:s,transactionMessage:`Status: (${JSON.stringify(o)})`}):new Error(`Transaction ${s} failed (${JSON.stringify(o)})`);return s}function Vc(t){return new Promise(e=>setTimeout(e,t))}function qe(t,e){let r=t.layout.span>=0?t.layout.span:XC(t,e),n=Ee.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}var rX=z.nu64("lamportsPerSignature"),eM=z.struct([z.u32("version"),z.u32("state"),Me("authorizedPubkey"),Me("nonce"),z.struct([rX],"feeCalculator")]),kC=eM.span,Vw=class t{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){let r=eM.decode(Le(e),0);return new t({authorizedPubkey:new be(r.authorizedPubkey),nonce:new be(r.nonce).toString(),feeCalculator:r.feeCalculator})}};function Ll(t){let e=(0,GC.blob)(8,t),r=e.decode.bind(e),n=e.encode.bind(e),i=e,s=Nk();return i.decode=(o,c)=>{let u=r(o,c);return s.decode(u)},i.encode=(o,c,u)=>{let d=s.encode(o);return n(d,c,u)},i}var li=Object.freeze({Create:{index:0,layout:z.struct([z.u32("instruction"),z.ns64("lamports"),z.ns64("space"),Me("programId")])},Assign:{index:1,layout:z.struct([z.u32("instruction"),Me("programId")])},Transfer:{index:2,layout:z.struct([z.u32("instruction"),Ll("lamports")])},CreateWithSeed:{index:3,layout:z.struct([z.u32("instruction"),Me("base"),Ml("seed"),z.ns64("lamports"),z.ns64("space"),Me("programId")])},AdvanceNonceAccount:{index:4,layout:z.struct([z.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:z.struct([z.u32("instruction"),Me("authorized")])},AuthorizeNonceAccount:{index:7,layout:z.struct([z.u32("instruction"),Me("authorized")])},Allocate:{index:8,layout:z.struct([z.u32("instruction"),z.ns64("space")])},AllocateWithSeed:{index:9,layout:z.struct([z.u32("instruction"),Me("base"),Ml("seed"),z.ns64("space"),Me("programId")])},AssignWithSeed:{index:10,layout:z.struct([z.u32("instruction"),Me("base"),Ml("seed"),Me("programId")])},TransferWithSeed:{index:11,layout:z.struct([z.u32("instruction"),Ll("lamports"),Ml("seed"),Me("programId")])},UpgradeNonceAccount:{index:12,layout:z.struct([z.u32("instruction")])}}),Sn=class t{constructor(){}static createAccount(e){let r=li.Create,n=qe(r,{lamports:e.lamports,space:e.space,programId:Le(e.programId.toBuffer())});return new Ze({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:n})}static transfer(e){let r,n;if("basePubkey"in e){let i=li.TransferWithSeed;r=qe(i,{lamports:BigInt(e.lamports),seed:e.seed,programId:Le(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}]}else{let i=li.Transfer;r=qe(i,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new Ze({keys:n,programId:this.programId,data:r})}static assign(e){let r,n;if("basePubkey"in e){let i=li.AssignWithSeed;r=qe(i,{base:Le(e.basePubkey.toBuffer()),seed:e.seed,programId:Le(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=li.Assign;r=qe(i,{programId:Le(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:n,programId:this.programId,data:r})}static createAccountWithSeed(e){let r=li.CreateWithSeed,n=qe(r,{base:Le(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:Le(e.programId.toBuffer())}),i=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||i.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Ze({keys:i,programId:this.programId,data:n})}static createNonceAccount(e){let r=new Ke;"basePubkey"in e&&"seed"in e?r.add(t.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:kC,programId:this.programId})):r.add(t.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:kC,programId:this.programId}));let n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return r.add(this.nonceInitialize(n)),r}static nonceInitialize(e){let r=li.InitializeNonceAccount,n=qe(r,{authorized:Le(e.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Tw,isSigner:!1,isWritable:!1},{pubkey:xh,isSigner:!1,isWritable:!1}],programId:this.programId,data:n};return new Ze(i)}static nonceAdvance(e){let r=li.AdvanceNonceAccount,n=qe(r),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Tw,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n};return new Ze(i)}static nonceWithdraw(e){let r=li.WithdrawNonceAccount,n=qe(r,{lamports:e.lamports});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Tw,isSigner:!1,isWritable:!1},{pubkey:xh,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static nonceAuthorize(e){let r=li.AuthorizeNonceAccount,n=qe(r,{authorized:Le(e.newAuthorizedPubkey.toBuffer())});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static allocate(e){let r,n;if("basePubkey"in e){let i=li.AllocateWithSeed;r=qe(i,{base:Le(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:Le(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=li.Allocate;r=qe(i,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:n,programId:this.programId,data:r})}};Sn.programId=new be("11111111111111111111111111111111");var nX=Fc-300,Kw=class t{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/t.chunkSize)+1+1)}static async load(e,r,n,i,s){{let m=await e.getMinimumBalanceForRentExemption(s.length),A=await e.getAccountInfo(n.publicKey,"confirmed"),v=null;if(A!==null){if(A.executable)return console.error("Program load failed, account is already executable"),!1;A.data.length!==s.length&&(v=v||new Ke,v.add(Sn.allocate({accountPubkey:n.publicKey,space:s.length}))),A.owner.equals(i)||(v=v||new Ke,v.add(Sn.assign({accountPubkey:n.publicKey,programId:i}))),A.lamports<m&&(v=v||new Ke,v.add(Sn.transfer({fromPubkey:r.publicKey,toPubkey:n.publicKey,lamports:m-A.lamports})))}else v=new Ke().add(Sn.createAccount({fromPubkey:r.publicKey,newAccountPubkey:n.publicKey,lamports:m>0?m:1,space:s.length,programId:i}));v!==null&&await zC(e,v,[r,n],{commitment:"confirmed"})}let o=z.struct([z.u32("instruction"),z.u32("offset"),z.u32("bytesLength"),z.u32("bytesLengthPadding"),z.seq(z.u8("byte"),z.offset(z.u32(),-8),"bytes")]),c=t.chunkSize,u=0,d=s,f=[];for(;d.length>0;){let m=d.slice(0,c),A=Ee.Buffer.alloc(c+16);o.encode({instruction:0,offset:u,bytes:m,bytesLength:0,bytesLengthPadding:0},A);let v=new Ke().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:A});f.push(zC(e,v,[r,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await Vc(1e3/4),u+=c,d=d.slice(c)}await Promise.all(f);{let m=z.struct([z.u32("instruction")]),A=Ee.Buffer.alloc(m.span);m.encode({instruction:1},A);let v=new Ke().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:xh,isSigner:!1,isWritable:!1}],programId:i,data:A}),P="processed",T=await e.sendTransaction(v,[r,n],{preflightCommitment:P}),{context:k,value:B}=await e.confirmTransaction({signature:T,lastValidBlockHeight:v.lastValidBlockHeight,blockhash:v.recentBlockhash},P);if(B.err)throw new Error(`Transaction ${T} failed (${JSON.stringify(B)})`);for(;;){try{if(await e.getSlot({commitment:P})>k.slot)break}catch{}await new Promise(D=>setTimeout(D,Math.round(QC/2)))}}return!0}};Kw.chunkSize=nX;var Pze=new be("BPFLoader2111111111111111111111111111111111");function iX(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zw,CC;function sX(){if(CC)return zw;CC=1;var t=Object.prototype.toString,e=Object.keys||function(n){var i=[];for(var s in n)i.push(s);return i};function r(n,i){var s,o,c,u,d,f,m;if(n===!0)return"true";if(n===!1)return"false";switch(typeof n){case"object":if(n===null)return null;if(n.toJSON&&typeof n.toJSON=="function")return r(n.toJSON(),i);if(m=t.call(n),m==="[object Array]"){for(c="[",o=n.length-1,s=0;s<o;s++)c+=r(n[s],!0)+",";return o>-1&&(c+=r(n[s],!0)),c+"]"}else if(m==="[object Object]"){for(u=e(n).sort(),o=u.length,c="",s=0;s<o;)d=u[s],f=r(n[d],!1),f!==void 0&&(c&&(c+=","),c+=JSON.stringify(d)+":"+f),s++;return"{"+c+"}"}else return JSON.stringify(n);case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(n);default:return isFinite(n)?n:null}}return zw=function(n){var i=r(n,!1);if(i!==void 0)return""+i},zw}var oX=sX(),MC=iX(oX),Sh=32;function kw(t){let e=0;for(;t>1;)t/=2,e++;return e}function aX(t){return t===0?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t|=t>>32,t+1)}var Fw=class{constructor(e,r,n,i,s){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=r,this.warmup=n,this.firstNormalEpoch=i,this.firstNormalSlot=s}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){let r=kw(aX(e+Sh+1))-kw(Sh)-1,n=this.getSlotsInEpoch(r),i=e-(n-Sh);return[r,i]}else{let r=e-this.firstNormalSlot,n=Math.floor(r/this.slotsPerEpoch),i=this.firstNormalEpoch+n,s=r%this.slotsPerEpoch;return[i,s]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*Sh:(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+kw(Sh)):this.slotsPerEpoch}},cX=globalThis.fetch,Ww=class extends gC{constructor(e,r,n){let i=s=>{let o=hC(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...r});return"socket"in o?this.underlyingSocket=o.socket:this.underlyingSocket=o,o};super(i,e,r,n),this.underlyingSocket=void 0}call(...e){let r=this.underlyingSocket?.readyState;return r===1?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 "+r+")"))}notify(...e){let r=this.underlyingSocket?.readyState;return r===1?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 "+r+")"))}};function uX(t,e){let r;try{r=t.layout.decode(e)}catch(n){throw new Error("invalid instruction; "+n)}if(r.typeIndex!==t.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}var NC=56,Dl=class{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){let e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){let r=uX(lX,e),n=e.length-NC;Ge(n>=0,"lookup table is invalid"),Ge(n%32===0,"lookup table is invalid");let i=n/32,{addresses:s}=z.struct([z.seq(Me(),i,"addresses")]).decode(e.slice(NC));return{deactivationSlot:r.deactivationSlot,lastExtendedSlot:r.lastExtendedSlot,lastExtendedSlotStartIndex:r.lastExtendedStartIndex,authority:r.authority.length!==0?new be(r.authority[0]):void 0,addresses:s.map(o=>new be(o))}}},lX={index:1,layout:z.struct([z.u32("typeIndex"),Ll("deactivationSlot"),z.nu64("lastExtendedSlot"),z.u8("lastExtendedStartIndex"),z.u8(),z.seq(Me(),z.offset(z.u8(),-1),"authority")])},dX=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function fX(t){let e=t.match(dX);if(e==null)throw TypeError(`Failed to validate endpoint URL \`${t}\``);let[r,n,i,s]=e,o=t.startsWith("https:")?"wss:":"ws:",c=i==null?null:parseInt(i.slice(1),10),u=c==null?"":`:${c+1}`;return`${o}//${n}${u}${s}`}var _t=zl(B1(be),ne(),t=>new be(t)),tM=z1([ne(),ut("base64")]),ex=zl(B1(Ee.Buffer),tM,t=>Ee.Buffer.from(t[0],"base64")),pX=30*1e3;function hX(t){if(/^https?:/.test(t)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}function rt(t){let e,r;if(typeof t=="string")e=t;else if(t){let{commitment:n,...i}=t;e=n,r=i}return{commitment:e,config:r}}function LC(t){return t.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function rM(t){return rn([J({jsonrpc:ut("2.0"),id:ne(),result:t}),J({jsonrpc:ut("2.0"),id:ne(),error:J({code:Uc(),message:ne(),data:ye(Uk())})})])}var gX=rM(Uc());function ke(t){return zl(rM(t),gX,e=>"error"in e?e:{...e,result:ae(e.result,t)})}function Bt(t){return ke(J({context:J({slot:q()}),value:t}))}function J1(t){return J({context:J({slot:q()}),value:t})}function Cw(t,e){return t===0?new Wc({header:e.header,staticAccountKeys:e.accountKeys.map(r=>new be(r)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(r=>({programIdIndex:r.programIdIndex,accountKeyIndexes:r.accounts,data:Tr.default.decode(r.data)})),addressTableLookups:e.addressTableLookups}):new Yi(e)}var mX=J({foundation:q(),foundationTerm:q(),initial:q(),taper:q(),terminal:q()}),yX=ke(ue(le(J({epoch:q(),effectiveSlot:q(),amount:q(),postBalance:q(),commission:ye(le(q()))})))),bX=ue(J({slot:q(),prioritizationFee:q()})),AX=J({total:q(),validator:q(),foundation:q(),epoch:q()}),_X=J({epoch:q(),slotIndex:q(),slotsInEpoch:q(),absoluteSlot:q(),blockHeight:ye(q()),transactionCount:ye(q())}),SX=J({slotsPerEpoch:q(),leaderScheduleSlotOffset:q(),warmup:Xi(),firstNormalEpoch:q(),firstNormalSlot:q()}),vX=dw(ne(),ue(q())),jc=le(rn([J({}),ne()])),EX=J({err:jc}),wX=ut("receivedSignature"),xX=J({"solana-core":ne(),"feature-set":ye(q())}),IX=J({program:ne(),programId:_t,parsed:Uc()}),PX=J({programId:_t,accounts:ue(_t),data:ne()}),DC=Bt(J({err:le(rn([J({}),ne()])),logs:le(ue(ne())),accounts:ye(le(ue(le(J({executable:Xi(),owner:ne(),lamports:q(),data:ue(ne()),rentEpoch:ye(q())}))))),unitsConsumed:ye(q()),returnData:ye(le(J({programId:ne(),data:z1([ne(),ut("base64")])}))),innerInstructions:ye(le(ue(J({index:q(),instructions:ue(rn([IX,PX]))}))))})),RX=Bt(J({byIdentity:dw(ne(),ue(q())),range:J({firstSlot:q(),lastSlot:q()})}));function OX(t,e,r,n,i,s){let o=r||cX,c;s!=null&&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.");let u;return n&&(u=async(f,m)=>{let A=await new Promise((v,P)=>{try{n(f,m,(T,k)=>v([T,k]))}catch(T){P(T)}});return await o(...A)}),new $C.default(async(f,m)=>{let A={method:"POST",body:f,agent:c,headers:Object.assign({"Content-Type":"application/json"},e||{},OY)};try{let v=5,P,T=500;for(;u?P=await u(t,A):P=await o(t,A),!(P.status!==429||i===!0||(v-=1,v===0));)console.error(`Server responded with ${P.status} ${P.statusText}. Retrying after ${T}ms delay...`),await Vc(T),T*=2;let k=await P.text();P.ok?m(null,k):m(new Error(`${P.status} ${P.statusText}: ${k}`))}catch(v){v instanceof Error&&m(v)}},{})}function TX(t){return(e,r)=>new Promise((n,i)=>{t.request(e,r,(s,o)=>{if(s){i(s);return}n(o)})})}function BX(t){return e=>new Promise((r,n)=>{e.length===0&&r([]);let i=e.map(s=>t.request(s.methodName,s.args));t.request(i,(s,o)=>{if(s){n(s);return}r(o)})})}var zX=ke(mX),kX=ke(AX),CX=ke(bX),MX=ke(_X),NX=ke(SX),LX=ke(vX),DX=ke(q()),qX=Bt(J({total:q(),circulating:q(),nonCirculating:q(),nonCirculatingAccounts:ue(_t)})),jw=J({amount:ne(),uiAmount:le(q()),decimals:q(),uiAmountString:ye(ne())}),UX=Bt(ue(J({address:_t,amount:ne(),uiAmount:le(q()),decimals:q(),uiAmountString:ye(ne())}))),VX=Bt(ue(J({pubkey:_t,account:J({executable:Xi(),owner:_t,lamports:q(),data:ex,rentEpoch:q()})}))),Hw=J({program:ne(),parsed:Uc(),space:q()}),KX=Bt(ue(J({pubkey:_t,account:J({executable:Xi(),owner:_t,lamports:q(),data:Hw,rentEpoch:q()})}))),FX=Bt(ue(J({lamports:q(),address:_t}))),Ph=J({executable:Xi(),owner:_t,lamports:q(),data:ex,rentEpoch:q()}),WX=J({pubkey:_t,account:Ph}),jX=zl(rn([B1(Ee.Buffer),Hw]),rn([tM,Hw]),t=>Array.isArray(t)?ae(t,ex):t),Gw=J({executable:Xi(),owner:_t,lamports:q(),data:jX,rentEpoch:q()}),HX=J({pubkey:_t,account:Gw}),GX=J({state:rn([ut("active"),ut("inactive"),ut("activating"),ut("deactivating")]),active:q(),inactive:q()}),$X=ke(ue(J({signature:ne(),slot:q(),err:jc,memo:le(ne()),blockTime:ye(le(q()))}))),ZX=ke(ue(J({signature:ne(),slot:q(),err:jc,memo:le(ne()),blockTime:ye(le(q()))}))),XX=J({subscription:q(),result:J1(Ph)}),YX=J({pubkey:_t,account:Ph}),JX=J({subscription:q(),result:J1(YX)}),QX=J({parent:q(),slot:q(),root:q()}),eY=J({subscription:q(),result:QX}),tY=rn([J({type:rn([ut("firstShredReceived"),ut("completed"),ut("optimisticConfirmation"),ut("root")]),slot:q(),timestamp:q()}),J({type:ut("createdBank"),parent:q(),slot:q(),timestamp:q()}),J({type:ut("frozen"),slot:q(),timestamp:q(),stats:J({numTransactionEntries:q(),numSuccessfulTransactions:q(),numFailedTransactions:q(),maxTransactionsPerEntry:q()})}),J({type:ut("dead"),slot:q(),timestamp:q(),err:ne()})]),rY=J({subscription:q(),result:tY}),nY=J({subscription:q(),result:J1(rn([EX,wX]))}),iY=J({subscription:q(),result:q()}),sY=J({pubkey:ne(),gossip:le(ne()),tpu:le(ne()),rpc:le(ne()),version:le(ne())}),qC=J({votePubkey:ne(),nodePubkey:ne(),activatedStake:q(),epochVoteAccount:Xi(),epochCredits:ue(z1([q(),q(),q()])),commission:q(),lastVote:q(),rootSlot:le(q())}),oY=ke(J({current:ue(qC),delinquent:ue(qC)})),aY=rn([ut("processed"),ut("confirmed"),ut("finalized")]),cY=J({slot:q(),confirmations:le(q()),err:jc,confirmationStatus:ye(aY)}),uY=Bt(ue(le(cY))),lY=ke(q()),nM=J({accountKey:_t,writableIndexes:ue(q()),readonlyIndexes:ue(q())}),tx=J({signatures:ue(ne()),message:J({accountKeys:ue(ne()),header:J({numRequiredSignatures:q(),numReadonlySignedAccounts:q(),numReadonlyUnsignedAccounts:q()}),instructions:ue(J({accounts:ue(q()),data:ne(),programIdIndex:q()})),recentBlockhash:ne(),addressTableLookups:ye(ue(nM))})}),iM=J({pubkey:_t,signer:Xi(),writable:Xi(),source:ye(rn([ut("transaction"),ut("lookupTable")]))}),sM=J({accountKeys:ue(iM),signatures:ue(ne())}),oM=J({parsed:Uc(),program:ne(),programId:_t}),aM=J({accounts:ue(_t),data:ne(),programId:_t}),dY=rn([aM,oM]),fY=rn([J({parsed:Uc(),program:ne(),programId:ne()}),J({accounts:ue(ne()),data:ne(),programId:ne()})]),cM=zl(dY,fY,t=>"accounts"in t?ae(t,aM):ae(t,oM)),uM=J({signatures:ue(ne()),message:J({accountKeys:ue(iM),instructions:ue(cM),recentBlockhash:ne(),addressTableLookups:ye(le(ue(nM)))})}),Z1=J({accountIndex:q(),mint:ne(),owner:ye(ne()),programId:ye(ne()),uiTokenAmount:jw}),lM=J({writable:ue(_t),readonly:ue(_t)}),Q1=J({err:jc,fee:q(),innerInstructions:ye(le(ue(J({index:q(),instructions:ue(J({accounts:ue(q()),data:ne(),programIdIndex:q()}))})))),preBalances:ue(q()),postBalances:ue(q()),logMessages:ye(le(ue(ne()))),preTokenBalances:ye(le(ue(Z1))),postTokenBalances:ye(le(ue(Z1))),loadedAddresses:ye(lM),computeUnitsConsumed:ye(q()),costUnits:ye(q())}),rx=J({err:jc,fee:q(),innerInstructions:ye(le(ue(J({index:q(),instructions:ue(cM)})))),preBalances:ue(q()),postBalances:ue(q()),logMessages:ye(le(ue(ne()))),preTokenBalances:ye(le(ue(Z1))),postTokenBalances:ye(le(ue(Z1))),loadedAddresses:ye(lM),computeUnitsConsumed:ye(q()),costUnits:ye(q())}),Vl=rn([ut(0),ut("legacy")]),Hc=J({pubkey:ne(),lamports:q(),postBalance:le(q()),rewardType:le(ne()),commission:ye(le(q()))}),pY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),transactions:ue(J({transaction:tx,meta:le(Q1),version:ye(Vl)})),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),hY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),gY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),transactions:ue(J({transaction:sM,meta:le(Q1),version:ye(Vl)})),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),mY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),transactions:ue(J({transaction:uM,meta:le(rx),version:ye(Vl)})),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),yY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),transactions:ue(J({transaction:sM,meta:le(rx),version:ye(Vl)})),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),bY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),rewards:ye(ue(Hc)),blockTime:le(q()),blockHeight:le(q())}))),AY=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),transactions:ue(J({transaction:tx,meta:le(Q1)})),rewards:ye(ue(Hc)),blockTime:le(q())}))),UC=ke(le(J({blockhash:ne(),previousBlockhash:ne(),parentSlot:q(),signatures:ue(ne()),blockTime:le(q())}))),Mw=ke(le(J({slot:q(),meta:le(Q1),blockTime:ye(le(q())),transaction:tx,version:ye(Vl)}))),F1=ke(le(J({slot:q(),transaction:uM,meta:le(rx),blockTime:ye(le(q())),version:ye(Vl)}))),_Y=Bt(J({blockhash:ne(),lastValidBlockHeight:q()})),SY=Bt(Xi()),vY=J({slot:q(),numTransactions:q(),numSlots:q(),samplePeriodSecs:q()}),EY=ke(ue(vY)),wY=Bt(le(J({feeCalculator:J({lamportsPerSignature:q()})}))),xY=ke(ne()),IY=ke(ne()),PY=J({err:jc,logs:ue(ne()),signature:ne()}),RY=J({result:J1(PY),subscription:q()}),OY={"solana-client":"js/1.0.0-maintenance"},ql=class{constructor(e,r){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=(()=>{let d={};return async f=>{let{commitment:m,config:A}=rt(f),v=this._buildArgs([],m,void 0,A),P=MC(v);return d[P]=d[P]??(async()=>{try{let T=await this._rpcRequest("getBlockHeight",v),k=ae(T,ke(q()));if("error"in k)throw new pe(k.error,"failed to get block height information");return k.result}finally{delete d[P]}})(),await d[P]}})();let n,i,s,o,c,u;r&&typeof r=="string"?this._commitment=r:r&&(this._commitment=r.commitment,this._confirmTransactionInitialTimeout=r.confirmTransactionInitialTimeout,n=r.wsEndpoint,i=r.httpHeaders,s=r.fetch,o=r.fetchMiddleware,c=r.disableRetryOnRateLimit,u=r.httpAgent),this._rpcEndpoint=hX(e),this._rpcWsEndpoint=n||fX(e),this._rpcClient=OX(e,i,s,o,c,u),this._rpcRequest=TX(this._rpcClient),this._rpcBatchRequest=BX(this._rpcClient),this._rpcWebSocket=new Ww(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,r){let{commitment:n,config:i}=rt(r),s=this._buildArgs([e.toBase58()],n,void 0,i),o=await this._rpcRequest("getBalance",s),c=ae(o,Bt(q()));if("error"in c)throw new pe(c.error,`failed to get balance for ${e.toBase58()}`);return c.result}async getBalance(e,r){return await this.getBalanceAndContext(e,r).then(n=>n.value).catch(n=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+n)})}async getBlockTime(e){let r=await this._rpcRequest("getBlockTime",[e]),n=ae(r,ke(le(q())));if("error"in n)throw new pe(n.error,`failed to get block time for slot ${e}`);return n.result}async getMinimumLedgerSlot(){let e=await this._rpcRequest("minimumLedgerSlot",[]),r=ae(e,ke(q()));if("error"in r)throw new pe(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){let e=await this._rpcRequest("getFirstAvailableBlock",[]),r=ae(e,DX);if("error"in r)throw new pe(r.error,"failed to get first available block");return r.result}async getSupply(e){let r={};typeof e=="string"?r={commitment:e}:e?r={...e,commitment:e&&e.commitment||this.commitment}:r={commitment:this.commitment};let n=await this._rpcRequest("getSupply",[r]),i=ae(n,qX);if("error"in i)throw new pe(i.error,"failed to get supply");return i.result}async getTokenSupply(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenSupply",n),s=ae(i,Bt(jw));if("error"in s)throw new pe(s.error,"failed to get token supply");return s.result}async getTokenAccountBalance(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenAccountBalance",n),s=ae(i,Bt(jw));if("error"in s)throw new pe(s.error,"failed to get token account balance");return s.result}async getTokenAccountsByOwner(e,r,n){let{commitment:i,config:s}=rt(n),o=[e.toBase58()];"mint"in r?o.push({mint:r.mint.toBase58()}):o.push({programId:r.programId.toBase58()});let c=this._buildArgs(o,i,"base64",s),u=await this._rpcRequest("getTokenAccountsByOwner",c),d=ae(u,VX);if("error"in d)throw new pe(d.error,`failed to get token accounts owned by account ${e.toBase58()}`);return d.result}async getParsedTokenAccountsByOwner(e,r,n){let i=[e.toBase58()];"mint"in r?i.push({mint:r.mint.toBase58()}):i.push({programId:r.programId.toBase58()});let s=this._buildArgs(i,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",s),c=ae(o,KX);if("error"in c)throw new pe(c.error,`failed to get token accounts owned by account ${e.toBase58()}`);return c.result}async getLargestAccounts(e){let r={...e,commitment:e&&e.commitment||this.commitment},n=r.filter||r.commitment?[r]:[],i=await this._rpcRequest("getLargestAccounts",n),s=ae(i,FX);if("error"in s)throw new pe(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(e,r){let n=this._buildArgs([e.toBase58()],r),i=await this._rpcRequest("getTokenLargestAccounts",n),s=ae(i,UX);if("error"in s)throw new pe(s.error,"failed to get token largest accounts");return s.result}async getAccountInfoAndContext(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgs([e.toBase58()],n,"base64",i),o=await this._rpcRequest("getAccountInfo",s),c=ae(o,Bt(le(Ph)));if("error"in c)throw new pe(c.error,`failed to get info about account ${e.toBase58()}`);return c.result}async getParsedAccountInfo(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgs([e.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getAccountInfo",s),c=ae(o,Bt(le(Gw)));if("error"in c)throw new pe(c.error,`failed to get info about account ${e.toBase58()}`);return c.result}async getAccountInfo(e,r){try{return(await this.getAccountInfoAndContext(e,r)).value}catch(n){throw new Error("failed to get info about account "+e.toBase58()+": "+n)}}async getMultipleParsedAccounts(e,r){let{commitment:n,config:i}=rt(r),s=e.map(d=>d.toBase58()),o=this._buildArgs([s],n,"jsonParsed",i),c=await this._rpcRequest("getMultipleAccounts",o),u=ae(c,Bt(ue(le(Gw))));if("error"in u)throw new pe(u.error,`failed to get info for accounts ${s}`);return u.result}async getMultipleAccountsInfoAndContext(e,r){let{commitment:n,config:i}=rt(r),s=e.map(d=>d.toBase58()),o=this._buildArgs([s],n,"base64",i),c=await this._rpcRequest("getMultipleAccounts",o),u=ae(c,Bt(ue(le(Ph))));if("error"in u)throw new pe(u.error,`failed to get info for accounts ${s}`);return u.result}async getMultipleAccountsInfo(e,r){return(await this.getMultipleAccountsInfoAndContext(e,r)).value}async getStakeActivation(e,r,n){let{commitment:i,config:s}=rt(r),o=this._buildArgs([e.toBase58()],i,void 0,{...s,epoch:n??s?.epoch}),c=await this._rpcRequest("getStakeActivation",o),u=ae(c,ke(GX));if("error"in u)throw new pe(u.error,`failed to get Stake Activation ${e.toBase58()}`);return u.result}async getProgramAccounts(e,r){let{commitment:n,config:i}=rt(r),{encoding:s,...o}=i||{},c=this._buildArgs([e.toBase58()],n,s||"base64",{...o,...o.filters?{filters:LC(o.filters)}:null}),u=await this._rpcRequest("getProgramAccounts",c),d=ue(WX),f=o.withContext===!0?ae(u,Bt(d)):ae(u,ke(d));if("error"in f)throw new pe(f.error,`failed to get accounts owned by program ${e.toBase58()}`);return f.result}async getParsedProgramAccounts(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgs([e.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getProgramAccounts",s),c=ae(o,ke(ue(HX)));if("error"in c)throw new pe(c.error,`failed to get accounts owned by program ${e.toBase58()}`);return c.result}async confirmTransaction(e,r){let n;if(typeof e=="string")n=e;else{let s=e;if(s.abortSignal?.aborted)return Promise.reject(s.abortSignal.reason);n=s.signature}let i;try{i=Tr.default.decode(n)}catch{throw new Error("signature must be base58 encoded: "+n)}return Ge(i.length===64,"signature has invalid length"),typeof e=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:r||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:r||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((r,n)=>{e!=null&&(e.aborted?n(e.reason):e.addEventListener("abort",()=>{n(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:r}){let n,i,s=!1,o=new Promise((u,d)=>{try{n=this.onSignature(r,(m,A)=>{n=void 0;let v={context:A,value:m};u({__type:Jo.PROCESSED,response:v})},e);let f=new Promise(m=>{n==null?m():i=this._onSubscriptionStateChange(n,A=>{A==="subscribed"&&m()})});(async()=>{if(await f,s)return;let m=await this.getSignatureStatus(r);if(s||m==null)return;let{context:A,value:v}=m;if(v!=null)if(v?.err)d(v.err);else{switch(e){case"confirmed":case"single":case"singleGossip":{if(v.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(v.confirmationStatus==="processed"||v.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}s=!0,u({__type:Jo.PROCESSED,response:{context:A,value:v}})}})()}catch(f){d(f)}});return{abortConfirmation:()=>{i&&(i(),i=void 0),n!=null&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:r,lastValidBlockHeight:n,signature:i}}){let s=!1,o=new Promise(m=>{let A=async()=>{try{return await this.getBlockHeight(e)}catch{return-1}};(async()=>{let v=await A();if(!s){for(;v<=n;)if(await Vc(1e3),s||(v=await A(),s))return;m({__type:Jo.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:c,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:e,signature:i}),d=this.getCancellationPromise(r),f;try{let m=await Promise.race([d,u,o]);if(m.__type===Jo.PROCESSED)f=m.response;else throw new H1(i)}finally{s=!0,c()}return f}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:r,minContextSlot:n,nonceAccountPubkey:i,nonceValue:s,signature:o}}){let c=!1,u=new Promise(v=>{let P=s,T=null,k=async()=>{try{let{context:B,value:D}=await this.getNonceAndContext(i,{commitment:e,minContextSlot:n});return T=B.slot,D?.nonce}catch{return P}};(async()=>{if(P=await k(),!c)for(;;){if(s!==P){v({__type:Jo.NONCE_INVALID,slotInWhichNonceDidAdvance:T});return}if(await Vc(2e3),c||(P=await k(),c))return}})()}),{abortConfirmation:d,confirmationPromise:f}=this.getTransactionConfirmationPromise({commitment:e,signature:o}),m=this.getCancellationPromise(r),A;try{let v=await Promise.race([m,f,u]);if(v.__type===Jo.PROCESSED)A=v.response;else{let P;for(;;){let T=await this.getSignatureStatus(o);if(T==null)break;if(T.context.slot<(v.slotInWhichNonceDidAdvance??n)){await Vc(400);continue}P=T;break}if(P?.value){let T=e||"finalized",{confirmationStatus:k}=P.value;switch(T){case"processed":case"recent":if(k!=="processed"&&k!=="confirmed"&&k!=="finalized")throw new Kc(o);break;case"confirmed":case"single":case"singleGossip":if(k!=="confirmed"&&k!=="finalized")throw new Kc(o);break;case"finalized":case"max":case"root":if(k!=="finalized")throw new Kc(o);break;default:}A={context:P.context,value:{err:P.value.err}}}else throw new Kc(o)}}finally{c=!0,d()}return A}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:r}){let n,i=new Promise(u=>{let d=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{d=this._confirmTransactionInitialTimeout||3e4;break}}n=setTimeout(()=>u({__type:Jo.TIMED_OUT,timeoutMs:d}),d)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:r}),c;try{let u=await Promise.race([o,i]);if(u.__type===Jo.PROCESSED)c=u.response;else throw new G1(r,u.timeoutMs/1e3)}finally{clearTimeout(n),s()}return c}async getClusterNodes(){let e=await this._rpcRequest("getClusterNodes",[]),r=ae(e,ke(ue(sY)));if("error"in r)throw new pe(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(e){let r=this._buildArgs([],e),n=await this._rpcRequest("getVoteAccounts",r),i=ae(n,oY);if("error"in i)throw new pe(i.error,"failed to get vote accounts");return i.result}async getSlot(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlot",i),o=ae(s,ke(q()));if("error"in o)throw new pe(o.error,"failed to get slot");return o.result}async getSlotLeader(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlotLeader",i),o=ae(s,ke(ne()));if("error"in o)throw new pe(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(e,r){let n=[e,r],i=await this._rpcRequest("getSlotLeaders",n),s=ae(i,ke(ue(_t)));if("error"in s)throw new pe(s.error,"failed to get slot leaders");return s.result}async getSignatureStatus(e,r){let{context:n,value:i}=await this.getSignatureStatuses([e],r);Ge(i.length===1);let s=i[0];return{context:n,value:s}}async getSignatureStatuses(e,r){let n=[e];r&&n.push(r);let i=await this._rpcRequest("getSignatureStatuses",n),s=ae(i,uY);if("error"in s)throw new pe(s.error,"failed to get signature status");return s.result}async getTransactionCount(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getTransactionCount",i),o=ae(s,ke(q()));if("error"in o)throw new pe(o.error,"failed to get transaction count");return o.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){let r=this._buildArgs([],e),n=await this._rpcRequest("getInflationGovernor",r),i=ae(n,zX);if("error"in i)throw new pe(i.error,"failed to get inflation");return i.result}async getInflationReward(e,r,n){let{commitment:i,config:s}=rt(n),o=this._buildArgs([e.map(d=>d.toBase58())],i,void 0,{...s,epoch:r??s?.epoch}),c=await this._rpcRequest("getInflationReward",o),u=ae(c,yX);if("error"in u)throw new pe(u.error,"failed to get inflation reward");return u.result}async getInflationRate(){let e=await this._rpcRequest("getInflationRate",[]),r=ae(e,kX);if("error"in r)throw new pe(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getEpochInfo",i),o=ae(s,MX);if("error"in o)throw new pe(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){let e=await this._rpcRequest("getEpochSchedule",[]),r=ae(e,NX);if("error"in r)throw new pe(r.error,"failed to get epoch schedule");let n=r.result;return new Fw(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){let e=await this._rpcRequest("getLeaderSchedule",[]),r=ae(e,LX);if("error"in r)throw new pe(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(e,r){let n=this._buildArgs([e],r),i=await this._rpcRequest("getMinimumBalanceForRentExemption",n),s=ae(i,lY);return"error"in s?(console.warn("Unable to fetch minimum balance for rent exemption"),0):s.result}async getRecentBlockhashAndContext(e){let{context:r,value:{blockhash:n}}=await this.getLatestBlockhashAndContext(e);return{context:r,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(){return{}}}}}}async getRecentPerformanceSamples(e){let r=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),n=ae(r,EY);if("error"in n)throw new pe(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(e,r){let n=this._buildArgs([e],r),i=await this._rpcRequest("getFeeCalculatorForBlockhash",n),s=ae(i,wY);if("error"in s)throw new pe(s.error,"failed to get fee calculator");let{context:o,value:c}=s.result;return{context:o,value:c!==null?c.feeCalculator:null}}async getFeeForMessage(e,r){let n=Le(e.serialize()).toString("base64"),i=this._buildArgs([n],r),s=await this._rpcRequest("getFeeForMessage",i),o=ae(s,Bt(le(q())));if("error"in o)throw new pe(o.error,"failed to get fee for message");if(o.result===null)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(e){let r=e?.lockedWritableAccounts?.map(o=>o.toBase58()),n=r?.length?[r]:[],i=await this._rpcRequest("getRecentPrioritizationFees",n),s=ae(i,CX);if("error"in s)throw new pe(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhashAndContext(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getLatestBlockhash",i),o=ae(s,_Y);if("error"in o)throw new pe(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgs([e],n,void 0,i),o=await this._rpcRequest("isBlockhashValid",s),c=ae(o,SY);if("error"in c)throw new pe(c.error,"failed to determine if the blockhash `"+e+"`is valid");return c.result}async getVersion(){let e=await this._rpcRequest("getVersion",[]),r=ae(e,ke(xX));if("error"in r)throw new pe(r.error,"failed to get version");return r.result}async getGenesisHash(){let e=await this._rpcRequest("getGenesisHash",[]),r=ae(e,ke(ne()));if("error"in r)throw new pe(r.error,"failed to get genesis hash");return r.result}async getBlock(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgsAtLeastConfirmed([e],n,void 0,i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let c=ae(o,gY);if("error"in c)throw c.error;return c.result}case"none":{let c=ae(o,hY);if("error"in c)throw c.error;return c.result}default:{let c=ae(o,pY);if("error"in c)throw c.error;let{result:u}=c;return u?{...u,transactions:u.transactions.map(({transaction:d,meta:f,version:m})=>({meta:f,transaction:{...d,message:Cw(m,d.message)},version:m}))}:null}}}catch(c){throw new pe(c,"failed to get confirmed block")}}async getParsedBlock(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let c=ae(o,yY);if("error"in c)throw c.error;return c.result}case"none":{let c=ae(o,bY);if("error"in c)throw c.error;return c.result}default:{let c=ae(o,mY);if("error"in c)throw c.error;return c.result}}}catch(c){throw new pe(c,"failed to get block")}}async getBlockProduction(e){let r,n;if(typeof e=="string")n=e;else if(e){let{commitment:c,...u}=e;n=c,r=u}let i=this._buildArgs([],n,"base64",r),s=await this._rpcRequest("getBlockProduction",i),o=ae(s,RX);if("error"in o)throw new pe(o.error,"failed to get block production information");return o.result}async getTransaction(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgsAtLeastConfirmed([e],n,void 0,i),o=await this._rpcRequest("getTransaction",s),c=ae(o,Mw);if("error"in c)throw new pe(c.error,"failed to get transaction");let u=c.result;return u&&{...u,transaction:{...u.transaction,message:Cw(u.version,u.transaction.message)}}}async getParsedTransaction(e,r){let{commitment:n,config:i}=rt(r),s=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",i),o=await this._rpcRequest("getTransaction",s),c=ae(o,F1);if("error"in c)throw new pe(c.error,"failed to get transaction");return c.result}async getParsedTransactions(e,r){let{commitment:n,config:i}=rt(r),s=e.map(u=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([u],n,"jsonParsed",i)}));return(await this._rpcBatchRequest(s)).map(u=>{let d=ae(u,F1);if("error"in d)throw new pe(d.error,"failed to get transactions");return d.result})}async getTransactions(e,r){let{commitment:n,config:i}=rt(r),s=e.map(u=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([u],n,void 0,i)}));return(await this._rpcBatchRequest(s)).map(u=>{let d=ae(u,Mw);if("error"in d)throw new pe(d.error,"failed to get transactions");let f=d.result;return f&&{...f,transaction:{...f.transaction,message:Cw(f.version,f.transaction.message)}}})}async getConfirmedBlock(e,r){let n=this._buildArgsAtLeastConfirmed([e],r),i=await this._rpcRequest("getBlock",n),s=ae(i,AY);if("error"in s)throw new pe(s.error,"failed to get confirmed block");let o=s.result;if(!o)throw new Error("Confirmed block "+e+" not found");let c={...o,transactions:o.transactions.map(({transaction:u,meta:d})=>{let f=new Yi(u.message);return{meta:d,transaction:{...u,message:f}}})};return{...c,transactions:c.transactions.map(({transaction:u,meta:d})=>({meta:d,transaction:Ke.populate(u.message,u.signatures)}))}}async getBlocks(e,r,n){let i=this._buildArgsAtLeastConfirmed(r!==void 0?[e,r]:[e],n),s=await this._rpcRequest("getBlocks",i),o=ae(s,ke(ue(q())));if("error"in o)throw new pe(o.error,"failed to get blocks");return o.result}async getBlockSignatures(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=ae(i,UC);if("error"in s)throw new pe(s.error,"failed to get block");let o=s.result;if(!o)throw new Error("Block "+e+" not found");return o}async getConfirmedBlockSignatures(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=ae(i,UC);if("error"in s)throw new pe(s.error,"failed to get confirmed block");let o=s.result;if(!o)throw new Error("Confirmed block "+e+" not found");return o}async getConfirmedTransaction(e,r){let n=this._buildArgsAtLeastConfirmed([e],r),i=await this._rpcRequest("getTransaction",n),s=ae(i,Mw);if("error"in s)throw new pe(s.error,"failed to get transaction");let o=s.result;if(!o)return o;let c=new Yi(o.transaction.message),u=o.transaction.signatures;return{...o,transaction:Ke.populate(c,u)}}async getParsedConfirmedTransaction(e,r){let n=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed"),i=await this._rpcRequest("getTransaction",n),s=ae(i,F1);if("error"in s)throw new pe(s.error,"failed to get confirmed transaction");return s.result}async getParsedConfirmedTransactions(e,r){let n=e.map(o=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([o],r,"jsonParsed")}));return(await this._rpcBatchRequest(n)).map(o=>{let c=ae(o,F1);if("error"in c)throw new pe(c.error,"failed to get confirmed transactions");return c.result})}async getConfirmedSignaturesForAddress(e,r,n){let i={},s=await this.getFirstAvailableBlock();for(;!("until"in i)&&(r--,!(r<=0||r<s));)try{let u=await this.getConfirmedBlockSignatures(r,"finalized");u.signatures.length>0&&(i.until=u.signatures[u.signatures.length-1].toString())}catch(u){if(u instanceof Error&&u.message.includes("skipped"))continue;throw u}let o=await this.getSlot("finalized");for(;!("before"in i)&&(n++,!(n>o));)try{let u=await this.getConfirmedBlockSignatures(n);u.signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString())}catch(u){if(u instanceof Error&&u.message.includes("skipped"))continue;throw u}return(await this.getConfirmedSignaturesForAddress2(e,i)).map(u=>u.signature)}async getConfirmedSignaturesForAddress2(e,r,n){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,r),s=await this._rpcRequest("getConfirmedSignaturesForAddress2",i),o=ae(s,$X);if("error"in o)throw new pe(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(e,r,n){let i=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,r),s=await this._rpcRequest("getSignaturesForAddress",i),o=ae(s,ZX);if("error"in o)throw new pe(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(e,r){let{context:n,value:i}=await this.getAccountInfoAndContext(e,r),s=null;return i!==null&&(s=new Dl({key:e,state:Dl.deserialize(i.data)})),{context:n,value:s}}async getNonceAndContext(e,r){let{context:n,value:i}=await this.getAccountInfoAndContext(e,r),s=null;return i!==null&&(s=Vw.fromAccountData(i.data)),{context:n,value:s}}async getNonce(e,r){return await this.getNonceAndContext(e,r).then(n=>n.value).catch(n=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+n)})}async requestAirdrop(e,r){let n=await this._rpcRequest("requestAirdrop",[e.toBase58(),r]),i=ae(n,xY);if("error"in i)throw new pe(i.error,`airdrop to ${e.toBase58()} failed`);return i.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await Vc(100);let n=Date.now()-this._blockhashInfo.lastFetch>=pX;if(this._blockhashInfo.latestBlockhash!==null&&!n)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let e=Date.now(),r=this._blockhashInfo.latestBlockhash,n=r?r.blockhash:null;for(let i=0;i<50;i++){let s=await this.getLatestBlockhash("finalized");if(n!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await Vc(QC/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){let{commitment:r,config:n}=rt(e),i=this._buildArgs([],r,"base64",n),s=await this._rpcRequest("getStakeMinimumDelegation",i),o=ae(s,Bt(q()));if("error"in o)throw new pe(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(e,r,n){if("message"in e){let T=e.serialize(),k=Ee.Buffer.from(T).toString("base64");if(Array.isArray(r)||n!==void 0)throw new Error("Invalid arguments");let B=r||{};B.encoding="base64","commitment"in B||(B.commitment=this.commitment),r&&typeof r=="object"&&"innerInstructions"in r&&(B.innerInstructions=r.innerInstructions);let D=[k,B],L=await this._rpcRequest("simulateTransaction",D),F=ae(L,DC);if("error"in F)throw new Error("failed to simulate transaction: "+F.error.message);return F.result}let i;if(e instanceof Ke){let P=e;i=new Ke,i.feePayer=P.feePayer,i.instructions=e.instructions,i.nonceInfo=P.nonceInfo,i.signatures=P.signatures}else i=Ke.populate(e),i._message=i._json=void 0;if(r!==void 0&&!Array.isArray(r))throw new Error("Invalid arguments");let s=r;if(i.nonceInfo&&s)i.sign(...s);else{let P=this._disableBlockhashCaching;for(;;){let T=await this._blockhashWithExpiryBlockHeight(P);if(i.lastValidBlockHeight=T.lastValidBlockHeight,i.recentBlockhash=T.blockhash,!s)break;if(i.sign(...s),!i.signature)throw new Error("!signature");let k=i.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(k)&&!this._blockhashInfo.transactionSignatures.includes(k)){this._blockhashInfo.simulatedSignatures.push(k);break}else P=!0}}let o=i._compile(),c=o.serialize(),d=i._serialize(c).toString("base64"),f={encoding:"base64",commitment:this.commitment};if(n){let P=(Array.isArray(n)?n:o.nonProgramIds()).map(T=>T.toBase58());f.accounts={encoding:"base64",addresses:P}}s&&(f.sigVerify=!0),r&&typeof r=="object"&&"innerInstructions"in r&&(f.innerInstructions=r.innerInstructions);let m=[d,f],A=await this._rpcRequest("simulateTransaction",m),v=ae(A,DC);if("error"in v){let P;if("data"in v.error&&(P=v.error.data.logs,P&&Array.isArray(P))){let T=`
+ `,k=T+P.join(T);console.error(v.error.message,k)}throw new Ih({action:"simulate",signature:"",transactionMessage:v.error.message,logs:P})}return v.result}async sendTransaction(e,r,n){if("version"in e){if(r&&Array.isArray(r))throw new Error("Invalid arguments");let o=e.serialize();return await this.sendRawTransaction(o,r)}if(r===void 0||!Array.isArray(r))throw new Error("Invalid arguments");let i=r;if(e.nonceInfo)e.sign(...i);else{let o=this._disableBlockhashCaching;for(;;){let c=await this._blockhashWithExpiryBlockHeight(o);if(e.lastValidBlockHeight=c.lastValidBlockHeight,e.recentBlockhash=c.blockhash,e.sign(...i),!e.signature)throw new Error("!signature");let u=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(u))o=!0;else{this._blockhashInfo.transactionSignatures.push(u);break}}}let s=e.serialize();return await this.sendRawTransaction(s,n)}async sendRawTransaction(e,r){let n=Le(e).toString("base64");return await this.sendEncodedTransaction(n,r)}async sendEncodedTransaction(e,r){let n={encoding:"base64"},i=r&&r.skipPreflight,s=i===!0?"processed":r&&r.preflightCommitment||this.commitment;r&&r.maxRetries!=null&&(n.maxRetries=r.maxRetries),r&&r.minContextSlot!=null&&(n.minContextSlot=r.minContextSlot),i&&(n.skipPreflight=i),s&&(n.preflightCommitment=s);let o=[e,n],c=await this._rpcRequest("sendTransaction",o),u=ae(c,IY);if("error"in u){let d;throw"data"in u.error&&(d=u.error.data.logs),new Ih({action:i?"send":"simulate",signature:"",transactionMessage:u.error.message,logs:d})}return u.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){if(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),e===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([r,n])=>{this._setSubscription(r,{...n,state:"pending"})})}_setSubscription(e,r){let n=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=r,n!==r.state){let i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach(s=>{try{s(r.state)}catch{}})}}_onSubscriptionStateChange(e,r){let n=this._subscriptionHashByClientSubscriptionId[e];if(n==null)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return i.add(r),()=>{i.delete(r),i.size===0&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(n){n instanceof Error&&console.log(`Error when closing socket connection: ${n.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}let e=this._rpcWebSocketGeneration,r=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async n=>{let i=this._subscriptionsByHash[n];if(i!==void 0)switch(i.state){case"pending":case"unsubscribed":if(i.callbacks.size===0){delete this._subscriptionsByHash[n],i.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{let{args:s,method:o}=i;try{this._setSubscription(n,{...i,state:"subscribing"});let c=await this._rpcWebSocket.call(o,s);this._setSubscription(n,{...i,serverSubscriptionId:c,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[c]=i.callbacks,await this._updateSubscriptions()}catch(c){if(console.error(`Received ${c instanceof Error?"":"JSON-RPC "}error calling \`${o}\``,{args:s,error:c}),!r())return;this._setSubscription(n,{...i,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":i.callbacks.size===0&&await(async()=>{let{serverSubscriptionId:s,unsubscribeMethod:o}=i;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(n,{...i,state:"unsubscribing"}),this._setSubscription(n,{...i,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[s])}catch(c){if(c instanceof Error&&console.error(`${o} error:`,c.message),!r())return;this._setSubscription(n,{...i,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(n,{...i,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(e,r){let n=this._subscriptionCallbacksByServerSubscriptionId[e];n!==void 0&&n.forEach(i=>{try{i(...r)}catch(s){console.error(s)}})}_wsOnAccountNotification(e){let{result:r,subscription:n}=ae(e,XX);this._handleServerNotification(n,[r.value,r.context])}_makeSubscription(e,r){let n=this._nextClientSubscriptionId++,i=MC([e.method,r]),s=this._subscriptionsByHash[i];return s===void 0?this._subscriptionsByHash[i]={...e,args:r,callbacks:new Set([e.callback]),state:"pending"}:s.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];let o=this._subscriptionsByHash[i];Ge(o!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),o.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,r,n){let{commitment:i,config:s}=rt(n),o=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",s);return this._makeSubscription({callback:r,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){let{result:r,subscription:n}=ae(e,JX);this._handleServerNotification(n,[{accountId:r.value.pubkey,accountInfo:r.value.account},r.context])}onProgramAccountChange(e,r,n,i){let{commitment:s,config:o}=rt(n),c=this._buildArgs([e.toBase58()],s||this._commitment||"finalized","base64",o||(i?{filters:LC(i)}:void 0));return this._makeSubscription({callback:r,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},c)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,r,n){let i=this._buildArgs([typeof e=="object"?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:r,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){let{result:r,subscription:n}=ae(e,RY);this._handleServerNotification(n,[r.value,r.context])}_wsOnSlotNotification(e){let{result:r,subscription:n}=ae(e,eY);this._handleServerNotification(n,[r])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){let{result:r,subscription:n}=ae(e,rY);this._handleServerNotification(n,[r])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,r){let n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${r}' events could not be found.`)}_buildArgs(e,r,n,i){let s=r||this._commitment;if(s||n||i){let o={};n&&(o.encoding=n),s&&(o.commitment=s),i&&(o=Object.assign(o,i)),e.push(o)}return e}_buildArgsAtLeastConfirmed(e,r,n,i){let s=r||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,r,n,i)}_wsOnSignatureNotification(e){let{result:r,subscription:n}=ae(e,nY);r.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,r.value==="receivedSignature"?[{type:"received"},r.context]:[{type:"status",result:r.value},r.context])}onSignature(e,r,n){let i=this._buildArgs([e],n||this._commitment||"finalized"),s=this._makeSubscription({callback:(o,c)=>{if(o.type==="status"){r(o.result,c);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}onSignatureWithOptions(e,r,n){let{commitment:i,...s}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([e],i,void 0,s),c=this._makeSubscription({callback:(u,d)=>{r(u,d);try{this.removeSignatureListener(c)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return c}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){let{result:r,subscription:n}=ae(e,iY);this._handleServerNotification(n,[r])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}},ra=class t{constructor(e){this._keypair=void 0,this._keypair=e??OC()}static generate(){return new t(OC())}static fromSecretKey(e,r){if(e.byteLength!==64)throw new Error("bad secret key size");let n=e.slice(32,64);if(!r||!r.skipValidation){let i=e.slice(0,32),s=qw(i);for(let o=0;o<32;o++)if(n[o]!==s[o])throw new Error("provided secretKey is invalid")}return new t({publicKey:n,secretKey:e})}static fromSeed(e){let r=qw(e),n=new Uint8Array(64);return n.set(e),n.set(r,32),new t({publicKey:r,secretKey:n})}get publicKey(){return new be(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},vh=Object.freeze({CreateLookupTable:{index:0,layout:z.struct([z.u32("instruction"),Ll("recentSlot"),z.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:z.struct([z.u32("instruction")])},ExtendLookupTable:{index:2,layout:z.struct([z.u32("instruction"),Ll(),z.seq(Me(),z.offset(z.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:z.struct([z.u32("instruction")])},CloseLookupTable:{index:4,layout:z.struct([z.u32("instruction")])}});var $w=class{constructor(){}static createLookupTable(e){let[r,n]=be.findProgramAddressSync([e.authority.toBuffer(),cw().encode(e.recentSlot)],this.programId),i=vh.CreateLookupTable,s=qe(i,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),o=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Sn.programId,isSigner:!1,isWritable:!1}];return[new Ze({programId:this.programId,keys:o,data:s}),r]}static freezeLookupTable(e){let r=vh.FreezeLookupTable,n=qe(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Ze({programId:this.programId,keys:i,data:n})}static extendLookupTable(e){let r=vh.ExtendLookupTable,n=qe(r,{addresses:e.addresses.map(s=>s.toBytes())}),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&i.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Sn.programId,isSigner:!1,isWritable:!1}),new Ze({programId:this.programId,keys:i,data:n})}static deactivateLookupTable(e){let r=vh.DeactivateLookupTable,n=qe(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Ze({programId:this.programId,keys:i,data:n})}static closeLookupTable(e){let r=vh.CloseLookupTable,n=qe(r),i=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new Ze({programId:this.programId,keys:i,data:n})}};$w.programId=new be("AddressLookupTab1e1111111111111111111111111");var W1=Object.freeze({RequestUnits:{index:0,layout:z.struct([z.u8("instruction"),z.u32("units"),z.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:z.struct([z.u8("instruction"),z.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:z.struct([z.u8("instruction"),z.u32("units")])},SetComputeUnitPrice:{index:3,layout:z.struct([z.u8("instruction"),Ll("microLamports")])}}),Zw=class{constructor(){}static requestUnits(e){let r=W1.RequestUnits,n=qe(r,e);return new Ze({keys:[],programId:this.programId,data:n})}static requestHeapFrame(e){let r=W1.RequestHeapFrame,n=qe(r,e);return new Ze({keys:[],programId:this.programId,data:n})}static setComputeUnitLimit(e){let r=W1.SetComputeUnitLimit,n=qe(r,e);return new Ze({keys:[],programId:this.programId,data:n})}static setComputeUnitPrice(e){let r=W1.SetComputeUnitPrice,n=qe(r,{microLamports:BigInt(e.microLamports)});return new Ze({keys:[],programId:this.programId,data:n})}};Zw.programId=new be("ComputeBudget111111111111111111111111111111");var VC=64,KC=32,FC=64,WC=z.struct([z.u8("numSignatures"),z.u8("padding"),z.u16("signatureOffset"),z.u16("signatureInstructionIndex"),z.u16("publicKeyOffset"),z.u16("publicKeyInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u16("messageInstructionIndex")]),Xw=class t{constructor(){}static createInstructionWithPublicKey(e){let{publicKey:r,message:n,signature:i,instructionIndex:s}=e;Ge(r.length===KC,`Public Key must be ${KC} bytes but received ${r.length} bytes`),Ge(i.length===FC,`Signature must be ${FC} bytes but received ${i.length} bytes`);let o=WC.span,c=o+r.length,u=c+i.length,d=1,f=Ee.Buffer.alloc(u+n.length),m=s??65535;return WC.encode({numSignatures:d,padding:0,signatureOffset:c,signatureInstructionIndex:m,publicKeyOffset:o,publicKeyInstructionIndex:m,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:m},f),f.fill(r,o),f.fill(i,c),f.fill(n,u),new Ze({keys:[],programId:t.programId,data:f})}static createInstructionWithPrivateKey(e){let{privateKey:r,message:n,instructionIndex:i}=e;Ge(r.length===VC,`Private key must be ${VC} bytes but received ${r.length} bytes`);try{let s=ra.fromSecretKey(r),o=s.publicKey.toBytes(),c=Jw(n,s.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:c,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};Xw.programId=new be("Ed25519SigVerify111111111111111111111111111");var TY=(t,e)=>{let r=K1.sign(t,e);return[r.toCompactRawBytes(),r.recovery]};K1.utils.isValidPrivateKey;var BY=K1.getPublicKey,jC=32,Nw=20,HC=64,zY=11,Lw=z.struct([z.u8("numSignatures"),z.u16("signatureOffset"),z.u8("signatureInstructionIndex"),z.u16("ethAddressOffset"),z.u8("ethAddressInstructionIndex"),z.u16("messageDataOffset"),z.u16("messageDataSize"),z.u8("messageInstructionIndex"),z.blob(20,"ethAddress"),z.blob(64,"signature"),z.u8("recoveryId")]),Yw=class t{constructor(){}static publicKeyToEthAddress(e){Ge(e.length===HC,`Public key must be ${HC} bytes but received ${e.length} bytes`);try{return Ee.Buffer.from(Ew(Le(e))).slice(-Nw)}catch(r){throw new Error(`Error constructing Ethereum address: ${r}`)}}static createInstructionWithPublicKey(e){let{publicKey:r,message:n,signature:i,recoveryId:s,instructionIndex:o}=e;return t.createInstructionWithEthAddress({ethAddress:t.publicKeyToEthAddress(r),message:n,signature:i,recoveryId:s,instructionIndex:o})}static createInstructionWithEthAddress(e){let{ethAddress:r,message:n,signature:i,recoveryId:s,instructionIndex:o=0}=e,c;typeof r=="string"?r.startsWith("0x")?c=Ee.Buffer.from(r.substr(2),"hex"):c=Ee.Buffer.from(r,"hex"):c=r,Ge(c.length===Nw,`Address must be ${Nw} bytes but received ${c.length} bytes`);let u=1+zY,d=u,f=u+c.length,m=f+i.length+1,A=1,v=Ee.Buffer.alloc(Lw.span+n.length);return Lw.encode({numSignatures:A,signatureOffset:f,signatureInstructionIndex:o,ethAddressOffset:d,ethAddressInstructionIndex:o,messageDataOffset:m,messageDataSize:n.length,messageInstructionIndex:o,signature:Le(i),ethAddress:Le(c),recoveryId:s},v),v.fill(Le(n),Lw.span),new Ze({keys:[],programId:t.programId,data:v})}static createInstructionWithPrivateKey(e){let{privateKey:r,message:n,instructionIndex:i}=e;Ge(r.length===jC,`Private key must be ${jC} bytes but received ${r.length} bytes`);try{let s=Le(r),o=BY(s,!1).slice(1),c=Ee.Buffer.from(Ew(Le(n))),[u,d]=TY(c,s);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:u,recoveryId:d,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};Yw.programId=new be("KeccakSecp256k11111111111111111111111111111");var dM,kY=new be("StakeConfig11111111111111111111111111111111");var Rh=class{constructor(e,r,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=r,this.custodian=n}};dM=Rh;Rh.default=new dM(0,0,be.default);var Qo=Object.freeze({Initialize:{index:0,layout:z.struct([z.u32("instruction"),$Z(),ZZ()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),Me("newAuthorized"),z.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:z.struct([z.u32("instruction")])},Split:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Withdraw:{index:4,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},Deactivate:{index:5,layout:z.struct([z.u32("instruction")])},Merge:{index:7,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:z.struct([z.u32("instruction"),Me("newAuthorized"),z.u32("stakeAuthorizationType"),Ml("authoritySeed"),Me("authorityOwner")])}}),Rze=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),X1=class{constructor(){}static initialize(e){let{stakePubkey:r,authorized:n,lockup:i}=e,s=i||Rh.default,o=Qo.Initialize,c=qe(o,{authorized:{staker:Le(n.staker.toBuffer()),withdrawer:Le(n.withdrawer.toBuffer())},lockup:{unixTimestamp:s.unixTimestamp,epoch:s.epoch,custodian:Le(s.custodian.toBuffer())}}),u={keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:xh,isSigner:!1,isWritable:!1}],programId:this.programId,data:c};return new Ze(u)}static createAccountWithSeed(e){let r=new Ke;r.add(Sn.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:i,lockup:s}=e;return r.add(this.initialize({stakePubkey:n,authorized:i,lockup:s}))}static createAccount(e){let r=new Ke;r.add(Sn.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:i,lockup:s}=e;return r.add(this.initialize({stakePubkey:n,authorized:i,lockup:s}))}static delegate(e){let{stakePubkey:r,authorizedPubkey:n,votePubkey:i}=e,s=Qo.Delegate,o=qe(s);return new Ke().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:Bw,isSigner:!1,isWritable:!1},{pubkey:kY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static authorize(e){let{stakePubkey:r,authorizedPubkey:n,newAuthorizedPubkey:i,stakeAuthorizationType:s,custodianPubkey:o}=e,c=Qo.Authorize,u=qe(c,{newAuthorized:Le(i.toBuffer()),stakeAuthorizationType:s.index}),d=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&d.push({pubkey:o,isSigner:!0,isWritable:!1}),new Ke().add({keys:d,programId:this.programId,data:u})}static authorizeWithSeed(e){let{stakePubkey:r,authorityBase:n,authoritySeed:i,authorityOwner:s,newAuthorizedPubkey:o,stakeAuthorizationType:c,custodianPubkey:u}=e,d=Qo.AuthorizeWithSeed,f=qe(d,{newAuthorized:Le(o.toBuffer()),stakeAuthorizationType:c.index,authoritySeed:i,authorityOwner:Le(s.toBuffer())}),m=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:fo,isSigner:!1,isWritable:!1}];return u&&m.push({pubkey:u,isSigner:!0,isWritable:!1}),new Ke().add({keys:m,programId:this.programId,data:f})}static splitInstruction(e){let{stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:s}=e,o=Qo.Split,c=qe(o,{lamports:s});return new Ze({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static split(e,r){let n=new Ke;return n.add(Sn.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:r,space:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,r){let{stakePubkey:n,authorizedPubkey:i,splitStakePubkey:s,basePubkey:o,seed:c,lamports:u}=e,d=new Ke;return d.add(Sn.allocate({accountPubkey:s,basePubkey:o,seed:c,space:this.space,programId:this.programId})),r&&r>0&&d.add(Sn.transfer({fromPubkey:e.authorizedPubkey,toPubkey:s,lamports:r})),d.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:i,splitStakePubkey:s,lamports:u}))}static merge(e){let{stakePubkey:r,sourceStakePubKey:n,authorizedPubkey:i}=e,s=Qo.Merge,o=qe(s);return new Ke().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:Bw,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static withdraw(e){let{stakePubkey:r,authorizedPubkey:n,toPubkey:i,lamports:s,custodianPubkey:o}=e,c=Qo.Withdraw,u=qe(c,{lamports:s}),d=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:Bw,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&d.push({pubkey:o,isSigner:!0,isWritable:!1}),new Ke().add({keys:d,programId:this.programId,data:u})}static deactivate(e){let{stakePubkey:r,authorizedPubkey:n}=e,i=Qo.Deactivate,s=qe(i);return new Ke().add({keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}};X1.programId=new be("Stake11111111111111111111111111111111111111");X1.space=200;var Eh=Object.freeze({InitializeAccount:{index:0,layout:z.struct([z.u32("instruction"),XZ()])},Authorize:{index:1,layout:z.struct([z.u32("instruction"),Me("newAuthorized"),z.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:z.struct([z.u32("instruction"),z.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:z.struct([z.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:z.struct([z.u32("instruction"),YZ()])}}),Oze=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Y1=class t{constructor(){}static initializeAccount(e){let{votePubkey:r,nodePubkey:n,voteInit:i}=e,s=Eh.InitializeAccount,o=qe(s,{voteInit:{nodePubkey:Le(i.nodePubkey.toBuffer()),authorizedVoter:Le(i.authorizedVoter.toBuffer()),authorizedWithdrawer:Le(i.authorizedWithdrawer.toBuffer()),commission:i.commission}}),c={keys:[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:xh,isSigner:!1,isWritable:!1},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o};return new Ze(c)}static createAccount(e){let r=new Ke;return r.add(Sn.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),r.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){let{votePubkey:r,authorizedPubkey:n,newAuthorizedPubkey:i,voteAuthorizationType:s}=e,o=Eh.Authorize,c=qe(o,{newAuthorized:Le(i.toBuffer()),voteAuthorizationType:s.index}),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Ke().add({keys:u,programId:this.programId,data:c})}static authorizeWithSeed(e){let{currentAuthorityDerivedKeyBasePubkey:r,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:s,voteAuthorizationType:o,votePubkey:c}=e,u=Eh.AuthorizeWithSeed,d=qe(u,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Le(n.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:Le(s.toBuffer()),voteAuthorizationType:o.index}}),f=[{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:fo,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return new Ke().add({keys:f,programId:this.programId,data:d})}static withdraw(e){let{votePubkey:r,authorizedWithdrawerPubkey:n,lamports:i,toPubkey:s}=e,o=Eh.Withdraw,c=qe(o,{lamports:i}),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new Ke().add({keys:u,programId:this.programId,data:c})}static safeWithdraw(e,r,n){if(e.lamports>r-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return t.withdraw(e)}static updateValidatorIdentity(e){let{votePubkey:r,authorizedWithdrawerPubkey:n,nodePubkey:i}=e,s=Eh.UpdateValidatorIdentity,o=qe(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Ke().add({keys:c,programId:this.programId,data:o})}};Y1.programId=new be("Vote111111111111111111111111111111111111111");Y1.space=3762;var Tze=new be("Va1idator1nfo111111111111111111111111111111"),Bze=J({name:ne(),website:ye(ne()),details:ye(ne()),iconUrl:ye(ne()),keybaseUsername:ye(ne())});var zze=new be("Vote111111111111111111111111111111111111111"),kze=z.struct([Me("nodePubkey"),Me("authorizedWithdrawer"),z.u8("commission"),z.nu64(),z.seq(z.struct([z.nu64("slot"),z.u32("confirmationCount")]),z.offset(z.u32(),-8),"votes"),z.u8("rootSlotValid"),z.nu64("rootSlot"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),Me("authorizedVoter")]),z.offset(z.u32(),-8),"authorizedVoters"),z.struct([z.seq(z.struct([Me("authorizedPubkey"),z.nu64("epochOfLastAuthorizedSwitch"),z.nu64("targetEpoch")]),32,"buf"),z.nu64("idx"),z.u8("isEmpty")],"priorVoters"),z.nu64(),z.seq(z.struct([z.nu64("epoch"),z.nu64("credits"),z.nu64("prevCredits")]),z.offset(z.u32(),-8),"epochCredits"),z.struct([z.nu64("slot"),z.nu64("timestamp")],"lastTimestamp")]);var fM=xr(Ic(),1);a();function vn(t){return t.toBase58()}function Et(t){return new be(t)}function nx(t){return new Ze({keys:t.keys.map(e=>({...e,pubkey:Et(e.pubkey)})),programId:Et(t.programId),data:fM.Buffer.from(t.data)})}a();function Oh(t){return{publicKey:vn(t.publicKey),secretKey:t.secretKey}}a();a();function Kl(t){return{version:t.version,header:t.header,accounts:t.staticAccountKeys.map(vn),blockhash:t.recentBlockhash,instructions:t.compiledInstructions.map(e=>({programIndex:e.programIdIndex,accountIndexes:e.accountKeyIndexes,data:new Uint8Array(e.data)})),addressLookupTables:t.addressTableLookups.map(e=>({publicKey:vn(e.accountKey),writableIndexes:e.writableIndexes,readonlyIndexes:e.readonlyIndexes}))}}function ix(t){return t.version==="legacy"?new Yi({header:t.header,accountKeys:t.accounts.map(Et),recentBlockhash:t.blockhash,instructions:t.instructions.map(e=>({programIdIndex:e.programIndex,accounts:e.accountIndexes,data:cE.deserialize(e.data)[0]}))}):new Wc({header:t.header,staticAccountKeys:t.accounts.map(Et),recentBlockhash:t.blockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIndex,accountKeyIndexes:e.accountIndexes,data:e.data})),addressTableLookups:t.addressLookupTables.map(e=>({accountKey:Et(e.publicKey),writableIndexes:e.writableIndexes,readonlyIndexes:e.readonlyIndexes}))})}function sx(t){return t.version==="legacy"?Yi.compile({payerKey:Et(t.payer),instructions:t.instructions.map(nx),recentBlockhash:t.blockhash}):Wc.compile({payerKey:Et(t.payer),instructions:t.instructions.map(nx),recentBlockhash:t.blockhash,addressLookupTableAccounts:t.addressLookupTables?.map(e=>new Dl({key:Et(e.publicKey),state:{addresses:e.addresses.map(Et),authority:void 0,deactivationSlot:BigInt(`0x${"ff".repeat(8)}`),lastExtendedSlot:0,lastExtendedSlotStartIndex:0}}))})}function ox(t){return new ta(ix(t.message),t.signatures)}a();a();a();var ux=BigInt(0),cx=BigInt(1);function eb(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function Th(t,e,r=""){let n=yn(t),i=t?.length,s=e!==void 0;if(!n||s&&i!==e){let o=r&&`"${r}" `,c=s?` of length ${e}`:"",u=n?`length=${i}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+c+", got "+u)}return t}function pM(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?ux:BigInt("0x"+t)}function hM(t){return pM(Sr(t))}function na(t){return At(t),pM(Sr(Uint8Array.from(t).reverse()))}function lx(t,e){return $i(t.toString(16).padStart(e*2,"0"))}function gM(t,e){return lx(t,e).reverse()}function Yn(t,e,r){let n;if(typeof e=="string")try{n=$i(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(yn(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function mM(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function dx(t){return Uint8Array.from(t)}var ax=t=>typeof t=="bigint"&&ux<=t;function CY(t,e,r){return ax(t)&&ax(e)&&ax(r)&&e<=t&&t<r}function fx(t,e,r,n){if(!CY(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function yM(t){let e;for(e=0;t>ux;t>>=cx,e+=1);return e}var Bh=t=>(cx<<BigInt(t))-cx;function zh(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){let c=t[i];if(o&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}var px=()=>{throw new Error("not implemented")};function hx(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let s=t(r,...n);return e.set(r,s),s}}a();var En=BigInt(0),un=BigInt(1),Gc=BigInt(2),_M=BigInt(3),SM=BigInt(4),vM=BigInt(5),MY=BigInt(7),EM=BigInt(8),NY=BigInt(9),wM=BigInt(16);function gr(t,e){let r=t%e;return r>=En?r:e+r}function Ji(t,e,r){let n=t;for(;e-- >En;)n*=n,n%=r;return n}function bM(t,e){if(t===En)throw new Error("invert: expected non-zero number");if(e<=En)throw new Error("invert: expected positive modulus, got "+e);let r=gr(t,e),n=e,i=En,s=un,o=un,c=En;for(;r!==En;){let d=n/r,f=n%r,m=i-o*d,A=s-c*d;n=r,r=f,i=o,s=c,o=m,c=A}if(n!==un)throw new Error("invert: does not exist");return gr(i,e)}function gx(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function xM(t,e){let r=(t.ORDER+un)/SM,n=t.pow(e,r);return gx(t,n,e),n}function LY(t,e){let r=(t.ORDER-vM)/EM,n=t.mul(e,Gc),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Gc),i),c=t.mul(s,t.sub(o,t.ONE));return gx(t,c,e),c}function DY(t){let e=go(t),r=IM(t),n=r(e,e.neg(e.ONE)),i=r(e,n),s=r(e,e.neg(n)),o=(t+MY)/wM;return(c,u)=>{let d=c.pow(u,o),f=c.mul(d,n),m=c.mul(d,i),A=c.mul(d,s),v=c.eql(c.sqr(f),u),P=c.eql(c.sqr(m),u);d=c.cmov(d,f,v),f=c.cmov(A,m,P);let T=c.eql(c.sqr(f),u),k=c.cmov(d,f,T);return gx(c,k,u),k}}function IM(t){if(t<_M)throw new Error("sqrt is not defined for small field");let e=t-un,r=0;for(;e%Gc===En;)e/=Gc,r++;let n=Gc,i=go(t);for(;AM(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return xM;let s=i.pow(n,e),o=(e+un)/Gc;return function(u,d){if(u.is0(d))return d;if(AM(u,d)!==1)throw new Error("Cannot find square root");let f=r,m=u.mul(u.ONE,s),A=u.pow(d,e),v=u.pow(d,o);for(;!u.eql(A,u.ONE);){if(u.is0(A))return u.ZERO;let P=1,T=u.sqr(A);for(;!u.eql(T,u.ONE);)if(P++,T=u.sqr(T),P===f)throw new Error("Cannot find square root");let k=un<<BigInt(f-P-1),B=u.pow(m,k);f=P,m=u.sqr(B),A=u.mul(A,m),v=u.mul(v,B)}return v}}function qY(t){return t%SM===_M?xM:t%EM===vM?LY:t%wM===NY?DY(t):IM(t)}var ho=(t,e)=>(gr(t,e)&un)===un,UY=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function PM(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=UY.reduce((n,i)=>(n[i]="function",n),e);return zh(t,r),t}function VY(t,e,r){if(r<En)throw new Error("invalid exponent, negatives unsupported");if(r===En)return t.ONE;if(r===un)return e;let n=t.ONE,i=e;for(;r>En;)r&un&&(n=t.mul(n,i)),i=t.sqr(i),r>>=un;return n}function tb(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,c,u)=>t.is0(c)?o:(n[u]=o,t.mul(o,c)),t.ONE),s=t.inv(i);return e.reduceRight((o,c,u)=>t.is0(c)?o:(n[u]=t.mul(o,n[u]),t.mul(o,c)),s),n}function AM(t,e){let r=(t.ORDER-un)/Gc,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function RM(t,e){e!==void 0&&Hi(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function go(t,e,r=!1,n={}){if(t<=En)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s,o=!1,c;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let A=e;A.BITS&&(i=A.BITS),A.sqrt&&(s=A.sqrt),typeof A.isLE=="boolean"&&(r=A.isLE),typeof A.modFromBytes=="boolean"&&(o=A.modFromBytes),c=A.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);let{nBitLength:u,nByteLength:d}=RM(t,i);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,m=Object.freeze({ORDER:t,isLE:r,BITS:u,BYTES:d,MASK:Bh(u),ZERO:En,ONE:un,allowedLengths:c,create:A=>gr(A,t),isValid:A=>{if(typeof A!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof A);return En<=A&&A<t},is0:A=>A===En,isValidNot0:A=>!m.is0(A)&&m.isValid(A),isOdd:A=>(A&un)===un,neg:A=>gr(-A,t),eql:(A,v)=>A===v,sqr:A=>gr(A*A,t),add:(A,v)=>gr(A+v,t),sub:(A,v)=>gr(A-v,t),mul:(A,v)=>gr(A*v,t),pow:(A,v)=>VY(m,A,v),div:(A,v)=>gr(A*bM(v,t),t),sqrN:A=>A*A,addN:(A,v)=>A+v,subN:(A,v)=>A-v,mulN:(A,v)=>A*v,inv:A=>bM(A,t),sqrt:s||(A=>(f||(f=qY(t)),f(m,A))),toBytes:A=>r?gM(A,d):lx(A,d),fromBytes:(A,v=!0)=>{if(c){if(!c.includes(A.length)||A.length>d)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+A.length);let T=new Uint8Array(d);T.set(A,r?0:T.length-A.length),A=T}if(A.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+A.length);let P=r?na(A):hM(A);if(o&&(P=gr(P,t)),!v&&!m.isValid(P))throw new Error("invalid field element: outside of range 0..ORDER");return P},invertBatch:A=>tb(m,A),cmov:(A,v,P)=>P?v:A});return Object.freeze(m)}var rb=BigInt(0),Ax=BigInt(1);function OM(t,e){let r=e.negate();return t?r:e}function kh(t,e){let r=tb(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function kM(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function mx(t,e){kM(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Bh(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function TM(t,e,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,c=Number(t&i),u=t>>o;c>n&&(c-=s,u+=Ax);let d=e*n,f=d+Math.abs(c)-1,m=c===0,A=c<0,v=e%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:A,isNegF:v,offsetF:d}}function KY(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function FY(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var yx=new WeakMap,CM=new WeakMap;function bx(t){return CM.get(t)||1}function BM(t){if(t!==rb)throw new Error("invalid wNAF")}var nb=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>rb;)r&Ax&&(n=n.add(i)),i=i.double(),r>>=Ax;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=mx(r,this.bits),s=[],o=e,c=o;for(let u=0;u<n;u++){c=o,s.push(c);for(let d=1;d<i;d++)c=c.add(o),s.push(c);o=c.double()}return s}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE,o=mx(e,this.bits);for(let c=0;c<o.windows;c++){let{nextN:u,offset:d,isZero:f,isNeg:m,isNegF:A,offsetF:v}=TM(n,c,o);n=u,f?s=s.add(OM(A,r[v])):i=i.add(OM(m,r[d]))}return BM(n),{p:i,f:s}}wNAFUnsafe(e,r,n,i=this.ZERO){let s=mx(e,this.bits);for(let o=0;o<s.windows&&n!==rb;o++){let{nextN:c,offset:u,isZero:d,isNeg:f}=TM(n,o,s);if(n=c,!d){let m=r[u];i=i.add(f?m.negate():m)}}return BM(n),i}getPrecomputes(e,r,n){let i=yx.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),yx.set(r,i))),i}cached(e,r,n){let i=bx(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let s=bx(e);return s===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),r,i)}createCache(e,r){kM(r,this.bits),CM.set(e,r),yx.delete(e)}hasCache(e){return bx(e)!==1}};function ib(t,e,r,n){KY(r,t),FY(n,e);let i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");let o=t.ZERO,c=yM(BigInt(i)),u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);let d=Bh(u),f=new Array(Number(d)+1).fill(o),m=Math.floor((e.BITS-1)/u)*u,A=o;for(let v=m;v>=0;v-=u){f.fill(o);for(let T=0;T<s;T++){let k=n[T],B=Number(k>>BigInt(v)&d);f[B]=f[B].add(r[T])}let P=o;for(let T=f.length-1,k=o;T>0;T--)k=k.add(f[T]),P=P.add(k);if(A=A.add(P),v!==0)for(let T=0;T<u;T++)A=A.double()}return A}function zM(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return PM(e),e}else return go(t,{isLE:r})}function MM(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let u of["p","n","h"]){let d=e[u];if(!(typeof d=="bigint"&&d>rb))throw new Error(`CURVE.${u} must be positive bigint`)}let i=zM(e.p,r.Fp,n),s=zM(e.n,r.Fn,n),c=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let u of c)if(!i.isValid(e[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:s}}a();var ia=BigInt(0),Br=BigInt(1),_x=BigInt(2),WY=BigInt(8);function jY(t,e,r,n){let i=t.sqr(r),s=t.sqr(n),o=t.add(t.mul(e.a,i),s),c=t.add(t.ONE,t.mul(e.d,t.mul(i,s)));return t.eql(o,c)}function HY(t,e={}){let r=MM("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o}=s;zh(e,{},{uvRatio:"function"});let c=_x<<BigInt(i.BYTES*8)-Br,u=k=>n.create(k),d=e.uvRatio||((k,B)=>{try{return{isValid:!0,value:n.sqrt(n.div(k,B))}}catch{return{isValid:!1,value:ia}}});if(!jY(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(k,B,D=!1){let L=D?Br:ia;return fx("coordinate "+k,B,L,c),B}function m(k){if(!(k instanceof P))throw new Error("ExtendedPoint expected")}let A=hx((k,B)=>{let{X:D,Y:L,Z:F}=k,ee=k.is0();B==null&&(B=ee?WY:n.inv(F));let j=u(D*B),X=u(L*B),G=n.mul(F,B);if(ee)return{x:ia,y:Br};if(G!==Br)throw new Error("invZ was invalid");return{x:j,y:X}}),v=hx(k=>{let{a:B,d:D}=s;if(k.is0())throw new Error("bad point: ZERO");let{X:L,Y:F,Z:ee,T:j}=k,X=u(L*L),G=u(F*F),M=u(ee*ee),W=u(M*M),Y=u(X*B),Q=u(M*u(Y+G)),w=u(W+u(D*u(X*G)));if(Q!==w)throw new Error("bad point: equation left != right (1)");let l=u(L*F),y=u(ee*j);if(l!==y)throw new Error("bad point: equation left != right (2)");return!0});class P{constructor(B,D,L,F){this.X=f("x",B),this.Y=f("y",D),this.Z=f("z",L,!0),this.T=f("t",F),Object.freeze(this)}static CURVE(){return s}static fromAffine(B){if(B instanceof P)throw new Error("extended point not allowed");let{x:D,y:L}=B||{};return f("x",D),f("y",L),new P(D,L,Br,u(D*L))}static fromBytes(B,D=!1){let L=n.BYTES,{a:F,d:ee}=s;B=dx(Th(B,L,"point")),eb(D,"zip215");let j=dx(B),X=B[L-1];j[L-1]=X&-129;let G=na(j),M=D?c:n.ORDER;fx("point.y",G,ia,M);let W=u(G*G),Y=u(W-Br),Q=u(ee*W-F),{isValid:w,value:l}=d(Y,Q);if(!w)throw new Error("bad point: invalid y coordinate");let y=(l&Br)===Br,S=(X&128)!==0;if(!D&&l===ia&&S)throw new Error("bad point: x=0 and x_0=1");return S!==y&&(l=u(-l)),P.fromAffine({x:l,y:G})}static fromHex(B,D=!1){return P.fromBytes(Yn("point",B),D)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(B=8,D=!0){return T.createCache(this,B),D||this.multiply(_x),this}assertValidity(){v(this)}equals(B){m(B);let{X:D,Y:L,Z:F}=this,{X:ee,Y:j,Z:X}=B,G=u(D*X),M=u(ee*F),W=u(L*X),Y=u(j*F);return G===M&&W===Y}is0(){return this.equals(P.ZERO)}negate(){return new P(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:B}=s,{X:D,Y:L,Z:F}=this,ee=u(D*D),j=u(L*L),X=u(_x*u(F*F)),G=u(B*ee),M=D+L,W=u(u(M*M)-ee-j),Y=G+j,Q=Y-X,w=G-j,l=u(W*Q),y=u(Y*w),S=u(W*w),E=u(Q*Y);return new P(l,y,E,S)}add(B){m(B);let{a:D,d:L}=s,{X:F,Y:ee,Z:j,T:X}=this,{X:G,Y:M,Z:W,T:Y}=B,Q=u(F*G),w=u(ee*M),l=u(X*L*Y),y=u(j*W),S=u((F+ee)*(G+M)-Q-w),E=y-l,x=y+l,O=u(w-D*Q),C=u(S*E),I=u(x*O),b=u(S*O),R=u(E*x);return new P(C,I,R,b)}subtract(B){return this.add(B.negate())}multiply(B){if(!i.isValidNot0(B))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:D,f:L}=T.cached(this,B,F=>kh(P,F));return kh(P,[D,L])[0]}multiplyUnsafe(B,D=P.ZERO){if(!i.isValid(B))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return B===ia?P.ZERO:this.is0()||B===Br?this:T.unsafe(this,B,L=>kh(P,L),D)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return T.unsafe(this,s.n).is0()}toAffine(B){return A(this,B)}clearCofactor(){return o===Br?this:this.multiplyUnsafe(o)}toBytes(){let{x:B,y:D}=this.toAffine(),L=n.toBytes(D);return L[L.length-1]|=B&Br?128:0,L}toHex(){return Sr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(B){return kh(P,B)}static msm(B,D){return ib(P,i,B,D)}_setWindowSize(B){this.precompute(B)}toRawBytes(){return this.toBytes()}}P.BASE=new P(s.Gx,s.Gy,Br,u(s.Gx*s.Gy)),P.ZERO=new P(ia,Br,Br,ia),P.Fp=n,P.Fn=i;let T=new nb(P,i.BITS);return P.BASE.precompute(8),P}var sb=class{constructor(e){this.ep=e}static fromBytes(e){px()}static fromHex(e){px()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return Sr(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};function GY(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');zh(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:s,Fn:o}=t,c=r.randomBytes||Qs,u=r.adjustScalarBytes||(M=>M),d=r.domain||((M,W,Y)=>{if(eb(Y,"phflag"),W.length||Y)throw new Error("Contexts/pre-hash are not supported");return M});function f(M){return o.create(na(M))}function m(M){let W=L.secretKey;M=Yn("private key",M,W);let Y=Yn("hashed private key",e(M),2*W),Q=u(Y.slice(0,W)),w=Y.slice(W,2*W),l=f(Q);return{head:Q,prefix:w,scalar:l}}function A(M){let{head:W,prefix:Y,scalar:Q}=m(M),w=i.multiply(Q),l=w.toBytes();return{head:W,prefix:Y,scalar:Q,point:w,pointBytes:l}}function v(M){return A(M).pointBytes}function P(M=Uint8Array.of(),...W){let Y=Tt(...W);return f(e(d(Y,Yn("context",M),!!n)))}function T(M,W,Y={}){M=Yn("message",M),n&&(M=n(M));let{prefix:Q,scalar:w,pointBytes:l}=A(W),y=P(Y.context,Q,M),S=i.multiply(y).toBytes(),E=P(Y.context,S,l,M),x=o.create(y+E*w);if(!o.isValid(x))throw new Error("sign failed: invalid s");let O=Tt(S,o.toBytes(x));return Th(O,L.signature,"result")}let k={zip215:!0};function B(M,W,Y,Q=k){let{context:w,zip215:l}=Q,y=L.signature;M=Yn("signature",M,y),W=Yn("message",W),Y=Yn("publicKey",Y,L.publicKey),l!==void 0&&eb(l,"zip215"),n&&(W=n(W));let S=y/2,E=M.subarray(0,S),x=na(M.subarray(S,y)),O,C,I;try{O=t.fromBytes(Y,l),C=t.fromBytes(E,l),I=i.multiplyUnsafe(x)}catch{return!1}if(!l&&O.isSmallOrder())return!1;let b=P(w,C.toBytes(),O.toBytes(),W);return C.add(O.multiplyUnsafe(b)).subtract(I).clearCofactor().is0()}let D=s.BYTES,L={secretKey:D,publicKey:D,signature:2*D,seed:D};function F(M=c(L.seed)){return Th(M,L.seed,"seed")}function ee(M){let W=G.randomSecretKey(M);return{secretKey:W,publicKey:v(W)}}function j(M){return yn(M)&&M.length===o.BYTES}function X(M,W){try{return!!t.fromBytes(M,W)}catch{return!1}}let G={getExtendedPublicKey:A,randomSecretKey:F,isValidSecretKey:j,isValidPublicKey:X,toMontgomery(M){let{y:W}=t.fromBytes(M),Y=L.publicKey,Q=Y===32;if(!Q&&Y!==57)throw new Error("only defined for 25519 and 448");let w=Q?s.div(Br+W,Br-W):s.div(W-Br,W+Br);return s.toBytes(w)},toMontgomerySecret(M){let W=L.secretKey;Th(M,W);let Y=e(M.subarray(0,W));return u(Y).subarray(0,W)},randomPrivateKey:F,precompute(M=8,W=t.BASE){return W.precompute(M,!1)}};return Object.freeze({keygen:ee,getPublicKey:v,sign:T,verify:B,utils:G,Point:t,lengths:L})}function $Y(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=go(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},s={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:s}}function ZY(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function NM(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=$Y(t),s=HY(e,r),o=GY(s,n,i);return ZY(t,o)}var XY=BigInt(0),mo=BigInt(1),LM=BigInt(2),Lke=BigInt(3),YY=BigInt(5),JY=BigInt(8),Fl=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Ch={p:Fl,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:JY,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function QY(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=Fl,c=t*t%s*t%s,u=Ji(c,LM,s)*c%s,d=Ji(u,mo,s)*t%s,f=Ji(d,YY,s)*d%s,m=Ji(f,e,s)*f%s,A=Ji(m,r,s)*m%s,v=Ji(A,n,s)*A%s,P=Ji(v,i,s)*v%s,T=Ji(P,i,s)*v%s,k=Ji(T,e,s)*f%s;return{pow_p_5_8:Ji(k,LM,s)*t%s,b2:c}}function eJ(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var Sx=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function wx(t,e){let r=Fl,n=gr(e*e*e,r),i=gr(n*n*e,r),s=QY(t*i).pow_p_5_8,o=gr(t*n*s,r),c=gr(e*o*o,r),u=o,d=gr(o*Sx,r),f=c===t,m=c===gr(-t,r),A=c===gr(-t*Sx,r);return f&&(o=u),(m||A)&&(o=d),ho(o,r)&&(o=gr(-o,r)),{isValid:f||m,value:o}}var sa=go(Ch.p,{isLE:!0}),tJ=go(Ch.n,{isLE:!0}),rJ={...Ch,Fp:sa,hash:Xy,adjustScalarBytes:eJ,uvRatio:wx},ys=NM(rJ);var vx=Sx,nJ=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),iJ=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),sJ=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),oJ=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),DM=t=>wx(mo,t),aJ=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ex=t=>ys.Point.Fp.create(na(t)&aJ);function qM(t){let{d:e}=Ch,r=Fl,n=B=>sa.create(B),i=n(vx*t*t),s=n((i+mo)*sJ),o=BigInt(-1),c=n((o-e*i)*n(i+e)),{isValid:u,value:d}=wx(s,c),f=n(d*t);ho(f,r)||(f=n(-f)),u||(d=f),u||(o=i);let m=n(o*(i-mo)*oJ-c),A=d*d,v=n((d+d)*c),P=n(m*nJ),T=n(mo-A),k=n(mo+A);return new ys.Point(n(v*k),n(T*P),n(P*k),n(v*T))}function cJ(t){At(t,64);let e=Ex(t.subarray(0,32)),r=qM(e),n=Ex(t.subarray(32,64)),i=qM(n);return new yo(r.add(i))}var yo=class t extends sb{constructor(e){super(e)}static fromAffine(e){return new t(ys.Point.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static hashToCurve(e){return cJ(Yn("ristrettoHash",e,64))}static fromBytes(e){At(e,32);let{a:r,d:n}=Ch,i=Fl,s=F=>sa.create(F),o=Ex(e);if(!mM(sa.toBytes(o),e)||ho(o,i))throw new Error("invalid ristretto255 encoding 1");let c=s(o*o),u=s(mo+r*c),d=s(mo-r*c),f=s(u*u),m=s(d*d),A=s(r*n*f-m),{isValid:v,value:P}=DM(s(A*m)),T=s(P*d),k=s(P*T*A),B=s((o+o)*T);ho(B,i)&&(B=s(-B));let D=s(u*k),L=s(B*D);if(!v||ho(L,i)||D===XY)throw new Error("invalid ristretto255 encoding 2");return new t(new ys.Point(B,D,mo,L))}static fromHex(e){return t.fromBytes(Yn("ristrettoHex",e,32))}static msm(e,r){return ib(t,ys.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,s=Fl,o=k=>sa.create(k),c=o(o(n+r)*o(n-r)),u=o(e*r),d=o(u*u),{value:f}=DM(o(c*d)),m=o(f*c),A=o(f*u),v=o(m*A*i),P;if(ho(i*v,s)){let k=o(r*vx),B=o(e*vx);e=k,r=B,P=o(m*iJ)}else P=A;ho(e*v,s)&&(r=o(-r));let T=o((n-r)*P);return ho(T,s)&&(T=o(-T)),sa.toBytes(T)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:s}=e.ep,o=d=>sa.create(d),c=o(r*s)===o(n*i),u=o(n*s)===o(r*i);return c||u}is0(){return this.equals(t.ZERO)}};yo.BASE=new yo(ys.Point.BASE);yo.ZERO=new yo(ys.Point.ZERO);yo.Fp=sa;yo.Fn=tJ;function UM(){return{generateKeypair:()=>Oh(ra.generate()),createKeypairFromSecretKey:c=>Oh(ra.fromSecretKey(c)),createKeypairFromSeed:c=>Oh(ra.fromSeed(c)),isOnCurve:c=>be.isOnCurve(Et(_r(c))),findPda:(c,u)=>{let[d,f]=be.findProgramAddressSync(u,Et(_r(c)));return[vn(d),f]},sign:(c,u)=>ys.sign(c,u.secretKey.slice(0,32)),verify:(c,u,d)=>ys.verify(u,c,gl(d))}}var xx=()=>({install(t){t.eddsa=UM()}});a();a();a();var VM=(...t)=>globalThis.fetch(...t),Jke=globalThis.Headers,Qke=globalThis.Request,eCe=globalThis.Response;function KM(){return{send:async t=>{let e=t.headers?Object.entries(t.headers).reduce((d,[f,m])=>({...d,[f.toLowerCase()]:(Array.isArray(m)?m.join(", "):m).toLowerCase()}),{}):{},r=e["content-type"]?.includes("application/json")??!1,n;r&&t.data?n=JSON.stringify(t.data):n=t.data;let i={method:t.method,body:n,headers:e,follow:t.maxRedirects,signal:t.signal,timeout:t.timeout},s=await VM(t.url,i),o=s.headers.get("content-type")?.includes("application/json")??!1,c=await s.text();return{data:(o?JSON.parse(c):void 0)??c,body:c,ok:s.ok,status:s.status,statusText:s.statusText,headers:Object.fromEntries(s.headers.entries())}}}}a();var Ix=()=>({install(t){t.http=KM()}});a();a();a();var ob=class extends Zs{name="ProgramNotRecognizedError";constructor(e,r){let n=!Rc(e),i=e,s=r==="*"?"any":`the [${r}]`,o=`The provided program ${n?"name":"address"} [${i}] is not recognized in ${s} cluster. Did you forget to register this program? If so, you may use "context.programs.add(myProgram)" to fix this.`;super(o),this.identifier=e,this.cluster=r}},ab=class extends Yp{name="ProgramErrorNotRecognizedError";constructor(e,r){let n=r.code?` of code [${r.code}]`:"",i=`The program [${e.name}] at address [${e.publicKey}] raised an error${n} that is not recognized by the programs registered on the SDK. Please check the underlying program error below for more details.`;super(i,e,r)}};function Px(t,e=[],r={}){let n=[...e],i={...r},s=(k,B="current")=>{let D=u(B),L=T(k);return Rc(L)?D.some(F=>F.publicKey===L):D.some(F=>F.name===L)},o=(k,B="current")=>{let D=P(B),L=u(B),F=T(k),ee=Rc(F)?L.find(j=>j.publicKey===F):L.find(j=>j.name===F);if(!ee)throw new ob(F,D);return ee},c=(k,B,D)=>{try{return o(k,D).publicKey}catch(L){if(B===void 0)throw L;return _r(B)}},u=(k="current")=>{let B=P(k);return B==="*"?n:n.filter(D=>D.isOnCluster(B))},d=(k,B=!0)=>{!B&&s(k.publicKey,"*")||n.unshift(k)},f=(k,B)=>{i[k]=B,T(k)},m=k=>{delete i[k]},A=()=>Px(t,n,i),v=(k,B)=>{if(!Array.isArray(k.logs)||k.logs.length===0)return null;let D=k.logs.join(`
+`),L=/Error processing Instruction (\d+):/,F=k.message.match(L)?.[1]??null,ee=/Custom program error: (0x[a-f0-9]+)/i,j=D.match(ee)?.[1]??null,X=j?parseInt(j,16):null;if(F===null||X===null)return null;let G=parseInt(F,10),M=B.message.instructions?.[G]?.programIndex??null,W=M?B.message.accounts[M]:null;if(!W)return null;let Y;try{Y=o(W)}catch{return null}return Y.getErrorFromCode(X,k)??new ab(Y,k)},P=k=>k==="current"?t.rpc.getCluster():k,T=(k,B=[])=>{if(Rc(k)||i[k]===void 0)return k;let D=[...B,k];if(B.includes(k))throw new Error(`Circular binding detected: ${D.join(" -> ")}`);return T(i[k],D)};return{has:s,get:o,getPublicKey:c,all:u,add:d,bind:f,unbind:m,clone:A,resolveError:v}}a();var Rx=()=>({install(t){t.programs=Px(t)}});a();a();a();function Ox(t,e,r){let n=null,i=()=>n||(typeof e=="string"?n=new ql(e,r):n=e,n),s=fE(i().rpcEndpoint),o=async(j,X={})=>{let G=await i().getAccountInfo(Et(j),X);return FM(G,j)},c=async(j,X={})=>(await i().getMultipleAccountsInfo(j.map(Et),X)).map((M,W)=>FM(M,j[W])),u=async(j,X={})=>(await i().getProgramAccounts(Et(j),{...X,filters:X.filters?.map(M=>uJ(M))})).map(({pubkey:M,account:W})=>WM(W,vn(M))),d=async(j,X={})=>{let G=await i().getBlockTime(j);return G?gE(G):null},f=async(j,X={})=>{let G=await i().getBalance(Et(j),X);return Xs(G)},m=async()=>await i().getGenesisHash(),A=async(j,X={})=>{let G=M=>i().getMinimumBalanceForRentExemption(M,X.commitment);if(X.includesHeaderBytes??!1){let M=await G(0),W=BigInt(M)/BigInt(uE);return Xs(W*BigInt(j))}return Xs(await G(j))},v=async(j={})=>i().getLatestBlockhash(j),P=async(j,X={})=>{let G=await i().getTransaction(Ar.deserialize(j)[0],{commitment:X.commitment,maxSupportedTransactionVersion:0});if(!G)return null;if(!G.meta)throw new Error("Transaction meta is missing.");let{transaction:M,meta:W}=G,Y=Kl(M.message),Q=l=>vn(new be(l)),w=l=>({accountIndex:l.accountIndex,amount:Xp(l.uiTokenAmount.amount,"splToken",l.uiTokenAmount.decimals),mint:Q(l.mint),owner:l.owner?Q(l.owner):null});return{response:{blockTime:G.blockTime!=null?BigInt(G.blockTime):void 0,slot:BigInt(G.slot),version:G.version},message:Y,serializedMessage:t.transactions.serializeMessage(Y),signatures:M.signatures.map(Ar.serialize),meta:{fee:Xs(W.fee),logs:W.logMessages??[],preBalances:W.preBalances.map(Xs),postBalances:W.postBalances.map(Xs),preTokenBalances:(W.preTokenBalances??[]).map(w),postTokenBalances:(W.postTokenBalances??[]).map(w),innerInstructions:W.innerInstructions?.map(l=>({index:l.index,instructions:l.instructions.map(y=>({programIndex:y.programIdIndex,accountIndexes:y.accounts,data:Ar.serialize(y.data)}))}))??null,loadedAddresses:{writable:(W.loadedAddresses?.writable??[]).map(vn),readonly:(W.loadedAddresses?.readonly??[]).map(vn)},computeUnitsConsumed:W.computeUnitsConsumed?BigInt(W.computeUnitsConsumed):null,costUnits:W.costUnits?BigInt(W.costUnits):null,err:W.err}}},T=async(j,X={})=>(await i().getSignatureStatuses(j.map(M=>Ar.deserialize(M)[0]),{searchTransactionHistory:X?.searchTransactionHistory??!1})).value.map(M=>M?{slot:M.slot,confirmations:M.confirmations,error:M.err,commitment:M.confirmationStatus??null}:null),k=async(j,X={})=>!dE(await f(j,X)),B=async(j,X,G={})=>{let M=await i().requestAirdrop(Et(j),Number(X.basisPoints));if(G.strategy){await ee(Ar.serialize(M),G);return}await ee(Ar.serialize(M),{...G,strategy:{type:"blockhash",...await v()}})},D=async(j,X,G={})=>{let M=i()._rpcClient,W=Array.isArray(X)?dJ([...X],G.commitment,G.extra):fJ(X,G.commitment,G.extra);return new Promise((Y,Q)=>{let w=(l,y)=>{l?Q(l):Y(y.result)};G.id?M.request(j,W,G.id,w):M.request(j,W,w)})},L=async(j,X={})=>{try{let G=await i().sendRawTransaction(t.transactions.serialize(j),X);return Ar.serialize(G)}catch(G){let M=null;throw G instanceof Error&&"logs"in G&&(M=t.programs.resolveError(G,j)),M||G}},F=async(j,X={})=>{try{let G=ox(j);return(await i().simulateTransaction(G,{sigVerify:X.verifySignatures,accounts:{addresses:X.accounts||[],encoding:"base64"},replaceRecentBlockhash:X.replaceRecentBlockhash})).value}catch(G){let M=null;throw G instanceof Error&&"logs"in G&&(M=t.programs.resolveError(G,j)),M||G}},ee=async(j,X)=>i().confirmTransaction(lJ(j,X),X.commitment);return{getEndpoint:()=>i().rpcEndpoint,getCluster:()=>s,getAccount:o,getAccounts:c,getProgramAccounts:u,getBlockTime:d,getGenesisHash:m,getBalance:f,getRent:A,getSlot:async(j={})=>i().getSlot(j),getLatestBlockhash:v,getTransaction:P,getSignatureStatuses:T,accountExists:k,airdrop:B,call:D,sendTransaction:L,simulateTransaction:F,confirmTransaction:ee,get connection(){return i()}}}function WM(t,e){return{executable:t.executable,owner:vn(t.owner),lamports:Xs(t.lamports),rentEpoch:t.rentEpoch?BigInt(t.rentEpoch):void 0,publicKey:e,data:new Uint8Array(t.data)}}function FM(t,e){return t?{...WM(t,e),exists:!0}:{exists:!1,publicKey:e}}function uJ(t){if(!("memcmp"in t))return t;let{bytes:e,...r}=t.memcmp;return{memcmp:{...r,bytes:Ar.deserialize(e)[0]}}}function lJ(t,e){return e.strategy.type==="blockhash"?{...e.strategy,signature:Ar.deserialize(t)[0]}:{...e.strategy,signature:Ar.deserialize(t)[0],nonceAccountPubkey:Et(e.strategy.nonceAccountPubkey)}}function dJ(t,e,r){if(!e&&!r)return t;let n={};return e&&(n.commitment=e),r&&(n={...n,...r}),t.push(n),t}function fJ(t={},e,r){if(!e&&!r)return t;let n={...t};return e&&(n.commitment=e),r&&Object.assign(n,r),n}function cb(t,e){return{install(r){r.rpc=typeof t=="string"?Ox(r,t,e):Ox(r,t)}}}a();a();var jM=(t,e=100)=>({...t,getAccounts:async(r,n)=>{let i=pE(r,e).map(o=>t.getAccounts(o,n));return(await Promise.all(i)).flat()}});a();var Tx=(t=100)=>({install(e){e.rpc=jM(e.rpc,t)}});a();a();function HM(t={}){return{tuple:oE,array:ji,map:tE,set:sE,option:nE,nullable:rE,struct:$s,enum:iE,dataEnum:eE,string:$p,bool:Qv,unit:aE,u8:Ot,u16:Xv,u32:Wi,u64:Yv,u128:Jv,i8:jv,i16:Hv,i32:Gv,i64:$v,i128:Zv,f32:Fv,f64:Wv,bytes:Oc,publicKey:Al}}a();var Bx=(t={})=>({install(e){e.serializer=HM(t)}});a();a();a();var GM=128,pJ=127;function $M(){let t=A=>{let v=sx(A),P=Kl(v),T=new ta(v,A.signatures);return{message:P,serializedMessage:n(P),signatures:T.signatures}},e=A=>s().serialize(A),r=A=>s().deserialize(A)[0],n=A=>o().serialize(A),i=A=>o().deserialize(A)[0],s=()=>({...ky($s([["signatures",ji(Oc({size:64}),{size:ds()})],["serializedMessage",Oc()]]),A=>A,A=>({...A,message:i(A.serializedMessage)})),description:"Transaction"}),o=()=>({description:"TransactionMessage",fixedSize:null,maxSize:null,serialize:A=>c(A.version).serialize(A),deserialize:(A,v=0)=>{let[P]=u().deserialize(A,v);return c(P).deserialize(A,v)}}),c=A=>$s([["version",u()],["header",d()],["accounts",ji(Al(),{size:ds()})],["blockhash",$p({encoding:Ar,size:32})],["instructions",ji(f(),{size:ds()})],["addressLookupTables",ji(m(),{size:A==="legacy"?0:ds()})]]),u=()=>({description:"TransactionVersion",fixedSize:null,maxSize:1,serialize:A=>A==="legacy"?new Uint8Array([]):new Uint8Array([GM|A]),deserialize:(A,v=0)=>{let P=A.slice(v);if(P.length===0||(P[0]&GM)===0)return["legacy",v];let T=P[0]&pJ;if(T>0)throw new Zs(`Unsupported transaction version: ${T}.`);return[T,v+1]}}),d=()=>$s([["numRequiredSignatures",Ot()],["numReadonlySignedAccounts",Ot()],["numReadonlyUnsignedAccounts",Ot()]]),f=()=>$s([["programIndex",Ot()],["accountIndexes",ji(Ot(),{size:ds()})],["data",Oc({size:ds()})]]),m=()=>$s([["publicKey",Al()],["writableIndexes",ji(Ot(),{size:ds()})],["readonlyIndexes",ji(Ot(),{size:ds()})]]);return{create:t,serialize:e,deserialize:r,serializeMessage:n,deserializeMessage:i}}var zx=()=>({install(t){t.transactions=$M()}});function kx(t,e){return{install(r){r.use(Bx()),r.use(Rx()),r.use(Ix()),r.use(AE()),r.use(xx()),r.use(typeof t=="string"?cb(t,e):cb(t)),r.use(Tx(e?.getAccountsChunkSize)),r.use(zx())}}}function ZM(t,e){return bE().use(typeof t=="string"?kx(t,e):kx(t,e))}var rv=xr(cS(),1),zW=xr(yS(),1);a();var Ay=xr(cS(),1);var oW=xr(iW(),1),aW=xr(yS(),1);a();var W_e="https://eips.ethereum.org/EIPS/eip-8004#registration-v1";function j_e(t){if(typeof p.Buffer<"u")return p.Buffer.from(t,"utf8").toString("base64");let e=new TextEncoder().encode(t),r="";for(let n of e)r+=String.fromCharCode(n);return btoa(r)}var H_e=t=>j_e(JSON.stringify(t));function qp(t){return`data:application/json;base64,${H_e(t)}`}function ZS({name:t,image:e,animationUrl:r,description:n,externalUrl:i,attributes:s}={}){if(!t)throw Object.assign(new Error("asset metadata requires a name"),{code:"validation_error"});let o={name:t};return e&&(o.image=e),r&&(o.animation_url=r),n&&(o.description=n),i&&(o.external_url=i),Array.isArray(s)&&s.length&&(o.attributes=s.map(c=>({trait_type:String(c.key??c.trait_type),value:String(c.value)}))),o}function XS({name:t,description:e,image:r,modelUrl:n,services:i,active:s=!0,x402Support:o=!1,registrations:c=[],supportedTrust:u=["reputation"]}={}){if(!t)throw Object.assign(new Error("registration requires a name"),{code:"validation_error"});let d={type:W_e,name:t,description:e||""};return r&&(d.image=r),n&&(d.model={uri:n}),Array.isArray(i)&&i.length&&(d.services=i.map(f=>({name:String(f.name),endpoint:String(f.endpoint)}))),d.active=s!==!1,d.x402Support=!!o,Array.isArray(c)&&c.length&&(d.registrations=c.map(f=>({agentId:String(f.agentId??f.agent_id),agentRegistry:String(f.agentRegistry??f.agent_registry)}))),d.supportedTrust=Array.isArray(u)&&u.length?u.map(String):["reputation"],d}function YS(t,e){return{agentId:String(t),agentRegistry:`solana:${e==="devnet"?103:101}:metaplex`}}function sW(t){return{agentId:String(t),agentRegistry:"https://three.ws"}}function G_e({creator:t,royaltyBasisPoints:e=500,royaltyCreators:r,verifiedCreator:n=!0,immutableMetadata:i=!0,attributes:s,permanentFreeze:o=!1,permanentTransfer:c=!1,permanentBurn:u=!1,addBlocker:d=!1}={}){let f=[],m=Number(e);if(!Number.isInteger(m)||m<0||m>1e4)throw Object.assign(new Error(`royalty_basis_points must be an integer 0..10000 (got ${e})`),{code:"validation_error"});if(m>0){let A=(r?.length?r:[{address:t,percentage:100}]).map(P=>({address:_r(P.address),percentage:Number(P.percentage)})),v=A.reduce((P,T)=>P+T.percentage,0);if(v!==100)throw Object.assign(new Error(`royalty creator percentages must sum to 100 (got ${v})`),{code:"validation_error"});f.push({type:"Royalties",basisPoints:m,creators:A,ruleSet:(0,Ay.ruleSet)("None")})}return n&&f.push({type:"VerifiedCreators",signatures:[{address:_r(t),verified:!0}]}),i&&f.push({type:"ImmutableMetadata"}),Array.isArray(s)&&s.length&&f.push({type:"Attributes",attributeList:s.map(A=>({key:String(A.key),value:String(A.value)}))}),o&&f.push({type:"PermanentFreezeDelegate",frozen:!1}),c&&f.push({type:"PermanentTransferDelegate"}),u&&f.push({type:"PermanentBurnDelegate"}),d&&f.push({type:"AddBlocker"}),f}function cW(t,{network:e,creator:r,owner:n,collection:i,name:s,description:o="",image:c,modelUrl:u,externalUrl:d,metadataAttributes:f,metadataUri:m,services:A,active:v=!0,x402Support:P=!1,registrations:T,threeWsAgentId:k,supportedTrust:B,registrationUri:D,royaltyBasisPoints:L,royaltyCreators:F,verifiedCreator:ee,immutableMetadata:j,attributes:X,permanentFreeze:G,permanentTransfer:M,permanentBurn:W,addBlocker:Y,feeLamports:Q=0,feeWallet:w}={}){let l=Vy(t),y=l.publicKey.toString(),S=m?null:ZS({name:s,image:c,animationUrl:u,description:void 0,externalUrl:d,attributes:f}),E=m||qp(S),x=T?.length?T:k?[sW(k)]:[YS(y,e)],O=D?null:XS({name:s,description:o,image:c,modelUrl:u,services:A,active:v,x402Support:P,registrations:x,supportedTrust:B}),C=D||qp(O),I={asset:l,name:s,uri:E,plugins:G_e({creator:r,royaltyBasisPoints:L,royaltyCreators:F,verifiedCreator:ee,immutableMetadata:j,attributes:X,permanentFreeze:G,permanentTransfer:M,permanentBurn:W,addBlocker:Y})};n&&(I.owner=_r(n)),i&&(I.collection=_r(i));let b={asset:l.publicKey,agentRegistrationUri:C};i&&(b.collection=_r(i));let R=Math.max(0,Math.floor(Number(Q)||0));if(R>0&&!w)throw Object.assign(new Error("feeLamports was set without a feeWallet to pay it to"),{code:"validation_error"});let re=R>0?(0,oW.transferSol)(t,{destination:_r(w),amount:lE(R/1e9)}).add((0,Ay.create)(t,I)):(0,Ay.create)(t,I),te=(0,aW.registerIdentityV1)(t,b),se=re.add(te),fe=se.fitsInOneTransaction(t);return{atomic:fe,feeLamports:R,feeWallet:R>0?String(w):null,builders:fe?[se]:[re,te],createBuilder:re,registerBuilder:te,combinedBuilder:se,assetSigner:l,assetMetadata:S,metadataUri:E,registration:O,registrationUri:C}}var uW=t=>new Promise(e=>setTimeout(e,t));async function $_e(t,e,{tries:r=12,delayMs:n=1500}={}){for(let i=0;i<r;i++){let s=await t.rpc.getAccount(e).catch(()=>null);if(s?.exists&&s.data?.length)return!0;await uW(n)}return!1}function Z_e(t){return/Invalid Core Asset|custom program error: 0x4/i.test(t?.message||"")}async function lW(t,e,{toBase58Signature:r}){let n={confirm:{commitment:"confirmed"}};if(e.atomic){let o=await e.combinedBuilder.sendAndConfirm(t,n);return{signatures:[r(o.signature)],atomic:!0}}let i=await e.createBuilder.sendAndConfirm(t,n);await $_e(t,e.assetSigner.publicKey);let s;for(let o=0;;o++)try{s=await e.registerBuilder.sendAndConfirm(t,n);break}catch(c){if(!Z_e(c)||o>=4)throw c;await uW(2e3)}return{signatures:[r(i.signature),r(s.signature)],atomic:!1}}a();a();a();function X_e(t){if(t.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let d=0;d<e.length;d++)e[d]=255;for(let d=0;d<t.length;d++){let f=t.charAt(d),m=f.charCodeAt(0);if(e[m]!==255)throw new TypeError(f+" is ambiguous");e[m]=d}let r=t.length,n=t.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";let f=0,m=0,A=0,v=d.length;for(;A!==v&&d[A]===0;)A++,f++;let P=(v-A)*s+1>>>0,T=new Uint8Array(P);for(;A!==v;){let D=d[A],L=0;for(let F=P-1;(D!==0||L<m)&&F!==-1;F--,L++)D+=256*T[F]>>>0,T[F]=D%r>>>0,D=D/r>>>0;if(D!==0)throw new Error("Non-zero carry");m=L,A++}let k=P-m;for(;k!==P&&T[k]===0;)k++;let B=n.repeat(f);for(;k<P;++k)B+=t.charAt(T[k]);return B}function c(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;let f=0,m=0,A=0;for(;d[f]===n;)m++,f++;let v=(d.length-f)*i+1>>>0,P=new Uint8Array(v);for(;f<d.length;){let D=d.charCodeAt(f);if(D>255)return;let L=e[D];if(L===255)return;let F=0;for(let ee=v-1;(L!==0||F<A)&&ee!==-1;ee--,F++)L+=r*P[ee]>>>0,P[ee]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");A=F,f++}let T=v-A;for(;T!==v&&P[T]===0;)T++;let k=new Uint8Array(m+(v-T)),B=m;for(;T!==v;)k[B++]=P[T++];return k}function u(d){let f=c(d);if(f)return f;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:c,decode:u}}var dW=X_e;var Y_e="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",_y=dW(Y_e);var yW=xr(cS(),1);var rSe=xr(yS(),1);a();function Ki(t,e){let r=typeof h<"u"&&h.env?h.env[t]:void 0;return r!==void 0&&String(r).trim()!==""?String(r).trim():e}var fW=(()=>{let t=Ki("METAPLEX_AGENT_NETWORK",Ki("SOLANA_NETWORK","mainnet")).toLowerCase();if(t==="devnet")return"devnet";if(t==="mainnet"||t==="mainnet-beta")return"mainnet";throw Object.assign(new Error(`METAPLEX_AGENT_NETWORK must be "mainnet" or "devnet" (got "${t}")`),{code:"bad_network_config"})})(),J_e={mainnet:"https://api.mainnet-beta.solana.com",devnet:"https://api.devnet.solana.com"};function Q_e(t){let e;try{e=new URL(t)}catch{throw Object.assign(new Error(`SOLANA_RPC_URL is not a valid URL: "${t}"`),{code:"bad_rpc_url"})}if(e.protocol==="https:")return t;let r=["localhost","127.0.0.1","0.0.0.0","::1"].includes(e.hostname);if(e.protocol==="http:"&&r)return t;throw Object.assign(new Error(`SOLANA_RPC_URL must be https (got "${e.protocol}//${e.hostname}"). Only http://localhost is allowed for local dev.`),{code:"insecure_rpc_url"})}var v7e=Q_e(Ki("SOLANA_RPC_URL",J_e[fW]));var eSe=Ki("SOLANA_SECRET_KEY",Ki("FUNDER_SECRET","")),pW=Ki("THREE_WS_BASE","https://three.ws").replace(/\/+$/,""),E7e=(()=>{let t=Ki("REQUIRE_CONFIRM");return t===void 0?!0:!["0","false","no","off"].includes(String(t).toLowerCase())})(),tSe=(()=>{let t=Ki("THREE_WS_TIMEOUT_MS");if(t===void 0)return 3e4;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw Object.assign(new Error(`THREE_WS_TIMEOUT_MS must be a positive number (got "${t}")`),{code:"bad_config"});return e})(),QT=Ki("THREE_MINT","FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump"),JS=6,hW=Ki("DEPLOY_FEE_WALLET","WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW");function eB(t,e){let r=Ki(t);if(r===void 0)return e;let n=Number(r);if(!Number.isFinite(n)||n<0)throw Object.assign(new Error(`${t} must be a non-negative number (got "${r}")`),{code:"bad_config"});return n}var gW=eB("DEPLOY_FEE_SOL",.02),mW=(()=>{let t=Ki("DEPLOY_FEE_ENABLED");return t===void 0?!0:!["0","false","no","off"].includes(String(t).toLowerCase())})(),sl=eB("THREE_HALF_PRICE_AT",5e4),Sy=eB("THREE_FREE_AT",25e4);var Up=1e9,O7e=Math.floor(.004*Up),T7e=Math.floor(.003*Up);function bW(t){return typeof t=="string"?t:_y.encode(t)}a();var nSe=`${pW}/api/three-token/stats`;function tB(){let t=Math.round(gW*Up);return{enabled:mW&&t>0,mint:QT,fee_wallet:hW,standard_sol:t/Up,standard_lamports:t,half_price_at_three:sl,free_at_three:Sy,devnet_sol:0,funds:"the three.ws $THREE buyback wallet",ledger:nSe}}async function iSe(t,e,{mint:r=QT}={}){let i=(await t.rpc.call("getTokenAccountsByOwner",[String(e),{mint:String(r)},{encoding:"jsonParsed"}]))?.value||[],s=0n;for(let o of i){let c=o?.account?.data?.parsed?.info?.tokenAmount?.amount;c!==void 0&&(s+=BigInt(c))}return{tokens:Number(s)/10**JS,atomics:s,accounts:i.length}}function sSe(t){return t>=Sy?{tier:"holder_free",multiplier:0}:t>=sl?{tier:"holder_half",multiplier:.5}:{tier:"standard",multiplier:1}}function oSe(t){if(t>=Sy)return null;let e=t>=sl?Sy:sl,r=t>=sl?"holder_free":"holder_half",n=Math.max(0,e-t);return{tier:r,at_three:e,need_three:Math.round(n*10**JS)/10**JS}}var QS=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2});async function AW(t,{network:e,payer:r}={}){let n=tB(),i={schedule:n,three_tokens:null,wallet:n.fee_wallet};if(!n.enabled)return{...i,lamports:0,sol:0,tier:"disabled",wallet:null,reason:"DEPLOY_FEE_ENABLED is off"};if(e!=="mainnet")return{...i,lamports:0,sol:0,tier:"devnet",wallet:null,reason:"devnet deploys are free"};if(!r)return{...i,lamports:n.standard_lamports,sol:n.standard_sol,tier:"standard",reason:"no paying wallet to check for $THREE"};let s=null,o=null;try{s=await iSe(t,r)}catch(m){o=m?.message||String(m)}if(s===null)return{...i,lamports:n.standard_lamports,sol:n.standard_sol,tier:"standard",three_balance_error:o,reason:"could not read the wallet $THREE balance, so the holder discount could not be applied"};let{tier:c,multiplier:u}=sSe(s.tokens),d=Math.round(n.standard_lamports*u),f=c==="holder_free"?`wallet holds ${QS(s.tokens)} $THREE: deploy fee waived`:c==="holder_half"?`wallet holds ${QS(s.tokens)} $THREE: deploy fee halved`:`wallet holds ${QS(s.tokens)} $THREE, under the ${QS(sl)} half-price threshold`;return{...i,lamports:d,sol:d/Up,tier:c,three_tokens:s.tokens,next_tier:oSe(s.tokens),wallet:d>0?n.fee_wallet:null,reason:f}}a();var nB="map.rpc.custom",_W="https://api.devnet.solana.com",ev="https://three.ws/api/solana-rpc";function iB(t){try{return JSON.parse(localStorage.getItem(nB)||"{}")[t]||""}catch{return""}}function sB(t,e){let r={};try{r=JSON.parse(localStorage.getItem(nB)||"{}")}catch{r={}}e?r[t]=e:delete r[t],localStorage.setItem(nB,JSON.stringify(r))}async function vy(t,e,r=[]){let n=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:e,params:r})});if(!n.ok)throw new Error(`${e} returned HTTP ${n.status}`);let i=await n.json();if(i.error)throw new Error(i.error.message||`${e} failed`);return i.result}async function rB(t){try{let e=await vy(t,"getHealth");return e==="ok"||e===void 0}catch{return!1}}var SW={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1"};async function vW(t,e){let r;try{r=new URL(t)}catch{return{ok:!1,message:"That is not a valid URL."}}if(r.protocol!=="https:")return{ok:!1,message:"The endpoint must be https."};let n;try{n=await vy(t,"getGenesisHash")}catch(i){return{ok:!1,message:`The endpoint did not answer: ${i.message}`}}if(n!==SW[e]){let i=Object.entries(SW).find(([,s])=>s===n)?.[0];return{ok:!1,message:i?`That endpoint is on ${i}, not ${e}.`:"That endpoint is on an unrecognised cluster."}}return{ok:!0,message:"Endpoint verified."}}async function EW(t){let e=iB(t);return e?{endpoint:e,source:"custom"}:t==="devnet"?await rB(_W)?{endpoint:_W,source:"public"}:await rB(ev+"?net=devnet")?{endpoint:ev+"?net=devnet",source:"threews"}:{endpoint:null,source:"none"}:await rB(ev)?{endpoint:ev,source:"threews"}:{endpoint:null,source:"none"}}a();var cB="map.wallet.v1",wW=31e4,aSe=[{id:"phantom",label:"Phantom",find:()=>window.phantom?.solana?.isPhantom&&window.phantom.solana},{id:"solflare",label:"Solflare",find:()=>window.solflare?.isSolflare&&window.solflare},{id:"backpack",label:"Backpack",find:()=>window.backpack?.solana},{id:"seeker",label:"Seeker",find:()=>window.threeWsWallet?.isThreeWs&&window.threeWsWallet},{id:"solana",label:"Browser wallet",find:()=>window.solana}];function uB(){let t=new Set,e=[];for(let r of aSe){let n=null;try{n=r.find()}catch{n=null}!n||t.has(n)||(t.add(n),e.push({id:r.id,label:r.label,provider:n}))}return e}var cSe=new TextEncoder,K7e=new TextDecoder,oB=t=>btoa(String.fromCharCode(...new Uint8Array(t))),aB=t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0));async function xW(t,e){let r=await crypto.subtle.importKey("raw",cSe.encode(t),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:wW,hash:"SHA-256"},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function uSe(t,e){let r=crypto.getRandomValues(new Uint8Array(16)),n=crypto.getRandomValues(new Uint8Array(12)),i=await xW(e,r),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,t);return{v:1,kdf:"PBKDF2-SHA256",iterations:wW,salt:oB(r),iv:oB(n),data:oB(s)}}async function lSe(t,e){let r=await xW(e,aB(t.salt)),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:aB(t.iv)},r,aB(t.data));return new Uint8Array(n)}function lB(){try{let t=localStorage.getItem(cB);return t?JSON.parse(t):null}catch{return null}}function IW(){return!!lB()}function dB(){return lB()?.address||null}function PW(){localStorage.removeItem(cB)}var Vp=class t{#e;constructor(e){this.#e=e}get address(){return this.#e.publicKey.toString()}signer(e){return Ky(e,this.#e)}exportSecretKey(){return _y.encode(this.#e.secretKey)}static async create(e,r){let n=e.eddsa.generateKeypair();return await t.#t(n,r),new t(n)}static async importSecret(e,r,n){let i=String(r).trim(),s;if(i.startsWith("[")?s=Uint8Array.from(JSON.parse(i)):s=_y.decode(i),s.length!==64)throw new Error(`A Solana secret key is 64 bytes; that one is ${s.length}.`);let o=e.eddsa.createKeypairFromSecretKey(s);return await t.#t(o,n),new t(o)}static async unlock(e,r){let n=lB();if(!n)throw new Error("No wallet has been created in this browser yet.");let i;try{i=await lSe(n.secret,r)}catch{throw Object.assign(new Error("That passphrase does not unlock this wallet."),{code:"bad_passphrase"})}let s=e.eddsa.createKeypairFromSecretKey(i);return new t(s)}static async#t(e,r){let n=await uSe(e.secretKey,r);localStorage.setItem(cB,JSON.stringify({address:e.publicKey.toString(),createdAt:new Date().toISOString(),secret:n}))}};function fB(t,e){let r={type:"solana-keypair-backup",createdBy:"Metaplex Agent Deployer (three.ws)",address:t,secretKey:e,note:"Anyone with this secret key controls this wallet and everything it holds. Keep it offline. Import it into Phantom, Solflare, or the Solana CLI with this base58 string.",exportedAt:new Date().toISOString()};return new Blob([JSON.stringify(r,null,2)],{type:"application/json"})}a();var tv="https://three.ws";async function pB(t,{timeoutMs:e=15e3}={}){let r=new AbortController,n=setTimeout(()=>r.abort(),e);try{let i=await fetch(t,{signal:r.signal,headers:{accept:"application/json"}});if(!i.ok)throw new Error(`three.ws returned HTTP ${i.status}`);return await i.json()}finally{clearTimeout(n)}}var RW=t=>({id:t.avatarId||t.id,name:t.name||"Untitled",description:t.description||"",image:t.image||"",modelUrl:t.glbUrl||"",pageUrl:`${tv}/avatars/${t.avatarId||t.id}`});async function OW({query:t="",limit:e=12,cursor:r=""}={}){let n=new URLSearchParams({source:"avatar",only3d:"1",limit:String(e)});t&&n.set("q",t),r&&n.set("cursor",r);let i=await pB(`${tv}/api/explore?${n}`);return{items:(i.items||[]).filter(o=>o.glbUrl).map(RW),cursor:i.nextCursor||i.cursor||""}}async function TW(t){let e=String(t||"").trim();if(!e)throw new Error("Paste a three.ws avatar link or id.");let r=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i)?.[0];if(!r)throw new Error("That does not contain a three.ws avatar id.");let n=await pB(`${tv}/api/explore-item?kind=avatar&id=${r}`);if(!n.item)throw new Error("No three.ws avatar with that id.");let i=RW(n.item);if(!i.modelUrl)throw new Error("That avatar has no 3D model to attach.");return i}async function BW(t=8){return((await pB(`${tv}/api/deployments?chain=101&network=mainnet&limit=${t}`))?.data?.deployments||[]).map(r=>({asset:r.agent_id,name:r.name||r.agent_id.slice(0,6),image:r.image||"",has3d:!!r.has_3d,x402:!!r.x402_support,at:r.registered_at}))}var K=t=>document.getElementById(t),Fi=t=>String(t??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),gB=t=>t&&t.length>12?`${t.slice(0,4)}\u2026${t.slice(-4)}`:t||"",nv=t=>new Promise(e=>setTimeout(e,t)),dSe=.007,cs=tB(),ie={network:"devnet",endpoint:null,endpointSource:"none",wallet:null,source:"custom",previewDoc:"registration",pickerCursor:"",deploying:!1,fee:null};function iv(){let t=ie.fee?ie.fee.sol:ie.network==="mainnet"&&cs.enabled?cs.standard_sol:0;return Math.round((dSe+t)*1e6)/1e6}function mB(t){return ZM(t).use((0,rv.mplCore)()).use((0,zW.mplAgentIdentity)())}function yB(){return mB(ie.endpoint||"https://api.devnet.solana.com")}K("theme-toggle").addEventListener("click",()=>{let t=document.documentElement.getAttribute("data-theme")==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("map.theme",t)}catch{}});document.addEventListener("click",t=>{let e=t.target.closest(".copy");if(!e)return;let r=K(e.dataset.copy);r&&navigator.clipboard.writeText(r.textContent.trim()).then(()=>{let n=e.textContent;e.textContent="Copied",e.classList.add("done"),setTimeout(()=>{e.textContent=n,e.classList.remove("done")},1400)})});async function sv(t){ie.network=t;for(let n of document.querySelectorAll(".net-btn")){let i=n.dataset.net===t;n.classList.toggle("active",i),n.setAttribute("aria-checked",String(i))}K("rail-net").textContent=t==="devnet"?"Devnet (rehearsal)":"Solana mainnet",K("rail-rpc").textContent="Checking endpoint\u2026",K("airdrop-btn").hidden=!(t==="devnet"&&ie.wallet);let{endpoint:e,source:r}=await EW(t);ie.endpoint=e,ie.endpointSource=r,K("rail-rpc").textContent=r==="custom"?`Your endpoint: ${new URL(e).host}`:r==="threews"?"three.ws public proxy":r==="public"?"Solana public devnet":"No endpoint available. Add your own to continue.",ie.wallet&&ov(),Rn()}K("rpc-btn").addEventListener("click",()=>{K("rpc-modal-net").textContent=ie.network,K("rpc-input").value=iB(ie.network),K("rpc-error").hidden=!0,K("rpc-ok").hidden=!0,K("rpc-modal").showModal()});K("rpc-save").addEventListener("click",async()=>{let t=K("rpc-input").value.trim();if(K("rpc-error").hidden=!0,K("rpc-ok").hidden=!0,!t){K("rpc-error").textContent="Paste an endpoint URL first.",K("rpc-error").hidden=!1;return}K("rpc-save").disabled=!0,K("rpc-save").textContent="Verifying\u2026";let e=await vW(t,ie.network);if(K("rpc-save").disabled=!1,K("rpc-save").textContent="Verify and save",!e.ok){K("rpc-error").textContent=e.message,K("rpc-error").hidden=!1;return}sB(ie.network,t),K("rpc-ok").textContent=`${e.message} Using it for ${ie.network}.`,K("rpc-ok").hidden=!1,await sv(ie.network),setTimeout(()=>K("rpc-modal").close(),900)});K("rpc-clear").addEventListener("click",async()=>{sB(ie.network,""),K("rpc-input").value="",await sv(ie.network),K("rpc-modal").close()});for(let t of document.querySelectorAll(".net-btn"))t.addEventListener("click",()=>sv(t.dataset.net));function xy(){let t=uB();K("injected-list").innerHTML=t.map((r,n)=>`<button type="button" class="choice" data-injected="${n}"><span class="choice-ic" aria-hidden="true">${Fi(r.label.slice(0,1))}</span><span class="choice-body"><strong>${Fi(r.label)}</strong><small>Detected in this browser</small></span></button>`).join("");for(let r of K("injected-list").querySelectorAll("[data-injected]"))r.addEventListener("click",()=>fSe(t[Number(r.dataset.injected)]));K("no-wallet-hint").hidden=t.length>0;let e=IW();K("unlock-wallet-btn").hidden=!e,K("create-wallet-btn").hidden=e,e&&(K("unlock-wallet-sub").textContent=`Wallet ${gB(dB())} is stored in this browser.`)}async function fSe(t){K("wallet-error").hidden=!0;try{let r=(await t.provider.connect())?.publicKey||t.provider.publicKey;if(!r)throw new Error("The wallet connected but gave no address.");Iy({kind:"injected",label:t.label,address:r.toString(),provider:t.provider})}catch(e){kW(/reject|denied|4001/i.test(e?.message||"")?"The wallet dismissed the request. Try again when you are ready.":`Could not connect: ${e?.message||e}`)}}function Iy(t){ie.wallet=t,K("wallet-choices").hidden=!0,K("wallet-connected").hidden=!1,K("wallet-status").textContent="Connected",K("wallet-kind").textContent=t.kind==="hosted"?"This browser":t.label,K("wallet-address").textContent=gB(t.address),K("wallet-address").title=t.address,K("wallet-manage-btn").hidden=t.kind!=="hosted",K("airdrop-btn").hidden=ie.network!=="devnet",ov(),Rn()}function kW(t){K("wallet-error").textContent=t,K("wallet-error").hidden=!1}K("disconnect-btn").addEventListener("click",()=>{try{ie.wallet?.provider?.disconnect?.()}catch{}ie.wallet=null,K("wallet-choices").hidden=!1,K("wallet-connected").hidden=!0,K("wallet-status").textContent="Not connected",xy(),Rn()});async function pSe(){if(!ie.wallet||!ie.endpoint){ie.fee=null;return}try{ie.fee=await AW(mB(ie.endpoint),{network:ie.network,payer:ie.wallet.address})}catch{ie.fee=ie.network==="mainnet"?{sol:cs.standard_sol,lamports:cs.standard_lamports,wallet:cs.fee_wallet,tier:"standard"}:{sol:0,lamports:0,wallet:null,tier:"devnet"}}Rn()}async function ov(){if(!ie.wallet||!ie.endpoint){K("wallet-balance").textContent="";return}pSe();try{let e=((await vy(ie.endpoint,"getBalance",[ie.wallet.address]))?.value??0)/1e9;ie.balance=e,K("wallet-balance").textContent=`${e.toFixed(4)} SOL`;let r=iv(),n=e<r;K("funding-warn").hidden=!n,n&&(K("funding-warn").textContent=ie.network==="devnet"?`This wallet holds ${e.toFixed(4)} SOL. A deploy costs about ${r} SOL. Use "Get devnet SOL" above, it is free.`:`This wallet holds ${e.toFixed(4)} SOL. A deploy costs about ${r} SOL. Send some SOL to ${ie.wallet.address} and it will update here.`)}catch{K("wallet-balance").textContent="balance unavailable"}Rn()}K("airdrop-btn").addEventListener("click",async()=>{if(!ie.wallet||!ie.endpoint)return;let t=K("airdrop-btn");t.disabled=!0,t.textContent="Requesting\u2026";try{await vy(ie.endpoint,"requestAirdrop",[ie.wallet.address,1e9]);for(let e=0;e<12&&(await nv(2e3),await ov(),!((ie.balance||0)>0));e++);}catch(e){kW(`The devnet faucet declined: ${e?.message||e}. Faucets rate-limit hard; wait a minute, or use https://faucet.solana.com with your address.`)}finally{t.disabled=!1,t.textContent="Get devnet SOL"}});function Py(t){return K("wallet-modal-body").innerHTML=t,K("wallet-modal").showModal(),K("wallet-modal-body")}K("create-wallet-btn").addEventListener("click",()=>{let t=Py(`
<h3>Create a wallet</h3>
<p>This makes a real Solana wallet inside your browser. The secret key is encrypted with the passphrase you choose and stored only on this device. We never see it: this page has no server.</p>
<label class="field"><span class="label">Passphrase</span><input type="password" id="m-pass" autocomplete="new-password" placeholder="At least 8 characters" /></label>
@@ -38,39 +38,39 @@ Message: ${n}.
<div class="modal-actions">
<button type="button" class="btn btn-ghost" id="m-import">I have a secret key</button>
<button type="button" class="btn btn-primary" id="m-create">Create wallet</button>
- </div>`);t.querySelector("#m-create").addEventListener("click",async()=>{let e=t.querySelector("#m-pass").value,r=t.querySelector("#m-pass2").value,n=t.querySelector("#m-err");if(e.length<8)return Bg(n,"Use at least 8 characters.");if(e!==r)return Bg(n,"The two passphrases do not match.");let i=await Dd.create(gP(),e);$de(i)}),t.querySelector("#m-import").addEventListener("click",()=>Gde())});function Bg(t,e){t.textContent=e,t.hidden=!1}function Gde(){let t=kg(`
+ </div>`);t.querySelector("#m-create").addEventListener("click",async()=>{let e=t.querySelector("#m-pass").value,r=t.querySelector("#m-pass2").value,n=t.querySelector("#m-err");if(e.length<8)return wy(n,"Use at least 8 characters.");if(e!==r)return wy(n,"The two passphrases do not match.");let i=await Vp.create(yB(),e);gSe(i)}),t.querySelector("#m-import").addEventListener("click",()=>hSe())});function wy(t,e){t.textContent=e,t.hidden=!1}function hSe(){let t=Py(`
<h3>Import a wallet</h3>
<p>Paste a base58 secret key (or a JSON byte array). It is encrypted with your passphrase and stored only in this browser.</p>
<label class="field"><span class="label">Secret key</span><input type="password" id="m-secret" autocomplete="off" placeholder="base58 secret key" /></label>
<label class="field"><span class="label">Passphrase to encrypt it</span><input type="password" id="m-pass" autocomplete="new-password" placeholder="At least 8 characters" /></label>
<p class="error" id="m-err" role="alert" hidden></p>
- <div class="modal-actions"><button type="button" class="btn btn-primary" id="m-go">Import</button></div>`);t.querySelector("#m-go").addEventListener("click",async()=>{let e=t.querySelector("#m-err"),r=t.querySelector("#m-pass").value;if(r.length<8)return Bg(e,"Use at least 8 characters.");try{let n=await Dd.importSecret(gP(),t.querySelector("#m-secret").value,r);V("wallet-modal").close(),zg({kind:"hosted",address:n.address,hosted:n}),Tg()}catch(n){Bg(e,n.message)}})}function $de(t){let e=t.exportSecretKey(),r=kg(`
+ <div class="modal-actions"><button type="button" class="btn btn-primary" id="m-go">Import</button></div>`);t.querySelector("#m-go").addEventListener("click",async()=>{let e=t.querySelector("#m-err"),r=t.querySelector("#m-pass").value;if(r.length<8)return wy(e,"Use at least 8 characters.");try{let n=await Vp.importSecret(yB(),t.querySelector("#m-secret").value,r);K("wallet-modal").close(),Iy({kind:"hosted",address:n.address,hosted:n}),xy()}catch(n){wy(e,n.message)}})}function gSe(t){let e=t.exportSecretKey(),r=Py(`
<h3>Back this up now</h3>
<p>This secret key IS the wallet. Anyone who has it controls the agent you are about to mint and anything it holds.</p>
- <div class="secret-box" id="m-secret-text">${pi(e)}</div>
+ <div class="secret-box" id="m-secret-text">${Fi(e)}</div>
<div class="modal-actions" style="justify-content:flex-start">
<button type="button" class="btn btn-ghost btn-sm copy" data-copy="m-secret-text">Copy</button>
<button type="button" class="btn btn-ghost btn-sm" id="m-download">Download backup file</button>
</div>
<p class="danger-note" style="margin-top:16px">Store it somewhere only you can reach: a password manager, not a chat window. This page cannot recover it for you.</p>
<label class="check" style="margin-top:16px"><input type="checkbox" id="m-ack" /> <span>I saved it somewhere safe</span></label>
- <div class="modal-actions"><button type="button" class="btn btn-primary" id="m-done" disabled>Use this wallet</button></div>`);r.querySelector("#m-download").addEventListener("click",()=>{let n=URL.createObjectURL(dP(t.address,e)),i=document.createElement("a");i.href=n,i.download=`solana-wallet-${t.address.slice(0,8)}.json`,i.click(),URL.revokeObjectURL(n)}),r.querySelector("#m-ack").addEventListener("change",n=>{r.querySelector("#m-done").disabled=!n.target.checked}),r.querySelector("#m-done").addEventListener("click",()=>{V("wallet-modal").close(),zg({kind:"hosted",address:t.address,hosted:t}),Tg()})}V("unlock-wallet-btn").addEventListener("click",()=>{let t=kg(`
+ <div class="modal-actions"><button type="button" class="btn btn-primary" id="m-done" disabled>Use this wallet</button></div>`);r.querySelector("#m-download").addEventListener("click",()=>{let n=URL.createObjectURL(fB(t.address,e)),i=document.createElement("a");i.href=n,i.download=`solana-wallet-${t.address.slice(0,8)}.json`,i.click(),URL.revokeObjectURL(n)}),r.querySelector("#m-ack").addEventListener("change",n=>{r.querySelector("#m-done").disabled=!n.target.checked}),r.querySelector("#m-done").addEventListener("click",()=>{K("wallet-modal").close(),Iy({kind:"hosted",address:t.address,hosted:t}),xy()})}K("unlock-wallet-btn").addEventListener("click",()=>{let t=Py(`
<h3>Unlock your wallet</h3>
- <p>Wallet <code>${pi(pP(lP()))}</code> is stored in this browser. Enter the passphrase you set when you created it.</p>
+ <p>Wallet <code>${Fi(gB(dB()))}</code> is stored in this browser. Enter the passphrase you set when you created it.</p>
<label class="field"><span class="label">Passphrase</span><input type="password" id="m-pass" autocomplete="current-password" /></label>
<p class="error" id="m-err" role="alert" hidden></p>
<div class="modal-actions">
<button type="button" class="btn btn-ghost" id="m-forget">Forget this wallet</button>
<button type="button" class="btn btn-primary" id="m-unlock">Unlock</button>
- </div>`),e=async()=>{let r=t.querySelector("#m-err");try{let n=await Dd.unlock(gP(),t.querySelector("#m-pass").value);V("wallet-modal").close(),zg({kind:"hosted",address:n.address,hosted:n})}catch(n){Bg(r,n.message)}};t.querySelector("#m-unlock").addEventListener("click",e),t.querySelector("#m-pass").addEventListener("keydown",r=>{r.key==="Enter"&&e()}),t.querySelector("#m-forget").addEventListener("click",()=>{confirm("Remove this wallet from the browser? Without your backup the key is gone for good.")&&(Pq(),V("wallet-modal").close(),Tg())})});V("wallet-manage-btn").addEventListener("click",()=>{let t=fe.wallet?.hosted;if(!t)return;let e=kg(`
+ </div>`),e=async()=>{let r=t.querySelector("#m-err");try{let n=await Vp.unlock(yB(),t.querySelector("#m-pass").value);K("wallet-modal").close(),Iy({kind:"hosted",address:n.address,hosted:n})}catch(n){wy(r,n.message)}};t.querySelector("#m-unlock").addEventListener("click",e),t.querySelector("#m-pass").addEventListener("keydown",r=>{r.key==="Enter"&&e()}),t.querySelector("#m-forget").addEventListener("click",()=>{confirm("Remove this wallet from the browser? Without your backup the key is gone for good.")&&(PW(),K("wallet-modal").close(),xy())})});K("wallet-manage-btn").addEventListener("click",()=>{let t=ie.wallet?.hosted;if(!t)return;let e=Py(`
<h3>Your wallet</h3>
- <p>Address <code>${pi(t.address)}</code></p>
+ <p>Address <code>${Fi(t.address)}</code></p>
<div class="modal-actions" style="justify-content:flex-start">
<button type="button" class="btn btn-ghost btn-sm" id="m-reveal">Reveal secret key</button>
<button type="button" class="btn btn-ghost btn-sm" id="m-download">Download backup</button>
</div>
<div id="m-secret-wrap" hidden><div class="secret-box" id="m-secret-text"></div></div>
- <p class="danger-note" style="margin-top:16px">Import this key into Phantom or Solflare any time to use the same wallet there.</p>`);e.querySelector("#m-reveal").addEventListener("click",()=>{e.querySelector("#m-secret-text").textContent=t.exportSecretKey(),e.querySelector("#m-secret-wrap").hidden=!1}),e.querySelector("#m-download").addEventListener("click",()=>{let r=URL.createObjectURL(dP(t.address,t.exportSecretKey())),n=document.createElement("a");n.href=r,n.download=`solana-wallet-${t.address.slice(0,8)}.json`,n.click(),URL.revokeObjectURL(r)})});for(let t of document.querySelectorAll(".seg-btn"))t.addEventListener("click",()=>{fe.source=t.dataset.source;for(let e of document.querySelectorAll(".seg-btn"))e.classList.toggle("active",e===t),e.setAttribute("aria-checked",String(e===t));V("source-custom").hidden=fe.source!=="custom",V("source-threews").hidden=fe.source!=="threews",fe.source==="threews"&&!V("avatar-picker").dataset.loaded&&Nq()});async function Nq(t=!1){let e=V("avatar-picker");t||(e.innerHTML='<div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div>');try{let{items:r,cursor:n}=await Oq({limit:8,cursor:t?fe.pickerCursor:""});if(fe.pickerCursor=n,t||(e.innerHTML=""),!r.length&&!t){e.innerHTML='<p class="hint">No three.ws avatars available right now. Paste a link above, or use your own URLs.</p>';return}for(let i of r){let s=document.createElement("button");s.type="button",s.className="picker-item",s.innerHTML=`<img src="${pi(i.image)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" /><span>${pi(i.name)}</span>`,s.addEventListener("click",()=>Mq(i,s)),e.appendChild(s)}e.dataset.loaded="1",V("picker-more").hidden=!n}catch{e.innerHTML='<p class="hint">Could not reach three.ws just now. Paste an avatar link above, or use your own URLs.</p>'}}V("picker-more").addEventListener("click",()=>Nq(!0));function Mq(t,e){for(let r of V("avatar-picker").querySelectorAll(".picker-item"))r.classList.remove("selected");e&&e.classList.add("selected"),fe.imported=t,V("f-name").value.trim()||(V("f-name").value=t.name.slice(0,60)),!V("f-description").value.trim()&&t.description&&(V("f-description").value=t.description),V("f-image").value=t.image,V("f-model").value=t.modelUrl,V("name-count").textContent=String(V("f-name").value.length),wn()}V("import-btn").addEventListener("click",async()=>{let t=V("import-error");t.hidden=!0,V("import-btn").disabled=!0;try{Mq(await Bq(V("f-threews").value),null)}catch(e){t.textContent=e.message,t.hidden=!1}finally{V("import-btn").disabled=!1}});function yP(t,e){let r=document.createElement("div");return r.className="row",r.innerHTML=`${e}<button type="button" class="row-del" aria-label="Remove">&times;</button>`,r.querySelector(".row-del").addEventListener("click",()=>{r.remove(),wn()}),r.addEventListener("input",wn),V(t).appendChild(r),r}V("add-service").addEventListener("click",()=>yP("services-rows",'<input type="text" class="svc-name" placeholder="Name, e.g. chat" aria-label="Service name" /><input type="url" class="svc-url" placeholder="https://\u2026" aria-label="Service endpoint" />'));V("add-creator").addEventListener("click",()=>yP("creators-rows",'<input type="text" class="cr-addr" placeholder="Wallet address" aria-label="Recipient address" /><input type="number" class="cr-pct narrow" min="0" max="100" placeholder="%" aria-label="Share" />'));V("add-attr").addEventListener("click",()=>yP("attrs-rows",'<input type="text" class="at-key" placeholder="key" aria-label="Attribute key" /><input type="text" class="at-val" placeholder="value" aria-label="Attribute value" />'));var hP=(t,e)=>[...V(t).querySelectorAll(".row")].map(e);function Lq(){let t=hP("creators-rows",r=>({address:r.querySelector(".cr-addr").value.trim(),percentage:Number(r.querySelector(".cr-pct").value)})).filter(r=>r.address),e=V("f-trust").value.split(",").map(r=>r.trim()).filter(Boolean);return{network:fe.network,creator:fe.wallet?.address||"11111111111111111111111111111111",owner:V("f-owner").value.trim()||void 0,collection:V("f-collection").value.trim()||void 0,name:V("f-name").value.trim(),description:V("f-description").value.trim(),image:V("f-image").value.trim()||void 0,modelUrl:V("f-model").value.trim()||void 0,services:hP("services-rows",r=>({name:r.querySelector(".svc-name").value.trim(),endpoint:r.querySelector(".svc-url").value.trim()})).filter(r=>r.name&&r.endpoint),active:V("f-active").checked,x402Support:V("f-x402").checked,supportedTrust:e.length?e:["reputation"],royaltyBasisPoints:Number(V("f-royalty").value||0),royaltyCreators:t.length?t:void 0,verifiedCreator:V("p-verified").checked,immutableMetadata:V("p-immutable").checked,attributes:hP("attrs-rows",r=>({key:r.querySelector(".at-key").value.trim(),value:r.querySelector(".at-val").value.trim()})).filter(r=>r.key),permanentFreeze:V("p-freeze").checked,permanentTransfer:V("p-transfer").checked,permanentBurn:V("p-burn").checked,addBlocker:V("p-addblocker").checked,metadataUri:V("f-metadata-uri").value.trim()||void 0,registrationUri:V("f-registration-uri").value.trim()||void 0}}function Dq(t){if(!t.name)return"Name your agent to continue";if(!Number.isInteger(t.royaltyBasisPoints)||t.royaltyBasisPoints<0||t.royaltyBasisPoints>1e4)return"Royalty must be between 0 and 10000 bps";if(t.royaltyCreators){let e=t.royaltyCreators.reduce((r,n)=>r+n.percentage,0);if(e!==100)return`Royalty shares total ${e}%, they must total 100%`}return fe.wallet?fe.endpoint?typeof fe.balance=="number"&&fe.balance<qd?"Not enough SOL to cover the mint":null:"Add an RPC endpoint to continue":"Connect a wallet first"}function wn(){let t=Lq(),e=t.name||"Your agent";V("preview-name").textContent=e,V("preview-desc").textContent=t.description||"Fill in the form and watch exactly what lands on-chain.",V("preview-initial").textContent=(t.name||"A").slice(0,1).toUpperCase();let r=V("preview-img");t.image&&r.dataset.src!==t.image?(r.dataset.src=t.image,r.src=t.image,r.hidden=!1,V("preview-initial").hidden=!0,r.onerror=()=>{r.hidden=!0,r.dataset.src="",V("preview-initial").hidden=!1}):t.image||(r.hidden=!0,r.dataset.src="",V("preview-initial").hidden=!1);let n=[];t.modelUrl&&n.push(["3D body",!0]),t.x402Support&&n.push(["x402",!0]),t.services.length&&n.push([`${t.services.length} service${t.services.length>1?"s":""}`,!0]);for(let u of t.supportedTrust)n.push([u,!1]);n.push([fe.network,fe.network==="mainnet"]),V("preview-chips").innerHTML=n.map(([u,d])=>`<span${d?' class="on"':""}>${pi(u)}</span>`).join("");let i=Ib({name:e,description:t.description,image:t.image,modelUrl:t.modelUrl,services:t.services,active:t.active,x402Support:t.x402Support,registrations:[Pb("<assigned when it mints>",t.network)],supportedTrust:t.supportedTrust}),s=xb({name:e,image:t.image,animationUrl:t.modelUrl});V("json-out").firstElementChild.textContent=JSON.stringify(fe.previewDoc==="registration"?i:s,null,2);let o=Ld(i).length+Ld(s).length;V("cost-line").textContent=`~${qd} SOL \xB7 ${o.toLocaleString()} bytes on-chain`,V("royalty-pct").textContent=`${(t.royaltyBasisPoints/100).toFixed(t.royaltyBasisPoints%100?2:0)}%`;let c=V("deploy-btn");if(fe.deploying)c.disabled=!0,c.textContent="Deploying\u2026";else{let u=Dq(t);c.disabled=!!u,c.textContent=u||`Deploy on ${fe.network==="devnet"?"devnet":"mainnet"}`}}for(let t of["f-name","f-description","f-image","f-model","f-royalty","f-trust","f-collection","f-owner","f-metadata-uri","f-registration-uri"])V(t).addEventListener("input",wn);for(let t of["f-x402","f-active","p-verified","p-immutable","p-freeze","p-transfer","p-burn","p-addblocker"])V(t).addEventListener("change",wn);V("f-name").addEventListener("input",()=>{V("name-count").textContent=String(V("f-name").value.length)});for(let t of document.querySelectorAll(".tab"))t.addEventListener("click",()=>{fe.previewDoc=t.dataset.doc;for(let e of document.querySelectorAll(".tab"))e.classList.toggle("active",e===t),e.setAttribute("aria-selected",String(e===t));wn()});function Og(t,e=[]){V("stages").hidden=!1;for(let r of V("stages").children)r.classList.toggle("active",r.dataset.stage===t),r.classList.toggle("done",e.includes(r.dataset.stage))}async function Zde(){let t=Lq();if(!(fe.deploying||Dq(t))){fe.deploying=!0,wn(),V("deploy-error").hidden=!0,V("success").hidden=!0,Og("build");try{let e=kq(fe.endpoint),r=fe.wallet.kind==="hosted";e.use(W_(r?fe.wallet.hosted.signer(e):V_(hr(fe.wallet.address))));let n=fq(e,t),i=n.assetSigner.publicKey.toString(),s;if(r)Og("mint",["build"]),{signatures:s}=await pq(e,n,{toBase58Signature:_q});else{let c=[];for(let _ of n.builders)c.push(await _.buildAndSign(e));let u=c.map(_=>{let v=e.transactions.serialize(_);try{return go.deserialize(v)}catch{return De.from(v)}});Og("sign",["build"]);let d=fe.wallet.provider,f=typeof d.signAllTransactions=="function"?await d.signAllTransactions(u):await Promise.all(u.map(_=>d.signTransaction(_))),m=new Lu(fe.endpoint,"confirmed");s=[];for(let _=0;_<f.length;_++){Og(_===0?"mint":"register",["build","sign",..._?["mint"]:[]]);let v=await Yde(m,f[_].serialize());await Xde(m,v),s.push(v),_===0&&f.length>1&&await Jde(m,i)}}Og("done",["build","sign","mint","register"]);let[o]=(0,Tb.findAssetSignerPda)(e,{asset:hr(i)});efe(i,o.toString(),s),Cb(),qq()}catch(e){V("deploy-error").textContent=Qde(e),V("deploy-error").hidden=!1,V("stages").hidden=!0}finally{fe.deploying=!1,wn()}}}async function Yde(t,e){for(let r=0;;r++)try{return await t.sendRawTransaction(e,{skipPreflight:!1})}catch(n){if(!/Invalid Core Asset|custom program error: 0x4/i.test(n?.message||"")||r>=4)throw n;await zb(2e3)}}async function Xde(t,e){for(let r=0;r<45;r++){let{value:n}=await t.getSignatureStatuses([e]),i=n?.[0];if(i?.err)throw new Error(`The network rejected the transaction: ${JSON.stringify(i.err)}`);if(i?.confirmationStatus==="confirmed"||i?.confirmationStatus==="finalized")return;await zb(2e3)}throw new Error(`Timed out waiting for ${e} to confirm. Check the explorer before trying again.`)}async function Jde(t,e){for(let r=0;r<10;r++){if(await t.getAccountInfo(new be(e)).catch(()=>null))return;await zb(1500)}}function Qde(t){let e=t?.message||String(t);return/reject|denied|declined|4001/i.test(e)?"You dismissed the signature request. Nothing was spent.":/insufficient|0x1\b/i.test(e)?`Not enough SOL for the mint (about ${qd} SOL). Top the wallet up and try again.`:/blockhash|expired/i.test(e)?"The transaction expired before it was signed. Press deploy again to rebuild it.":/403|forbidden/i.test(e)?'The RPC endpoint refused the request. Add your own endpoint with "Use my own RPC".':`Deploy failed: ${e}`}function efe(t,e,r){V("out-asset").textContent=t,V("out-wallet").textContent=e;let n=fe.network==="devnet",i=[!n&&[`https://www.metaplex.com/agents/${t}`,"Metaplex page"],[`https://core.metaplex.com/explorer/${t}${n?"?env=devnet":""}`,"Core explorer"],[`https://solscan.io/account/${t}${n?"?cluster=devnet":""}`,"Solscan"],...r.map((s,o)=>[`https://solscan.io/tx/${s}${n?"?cluster=devnet":""}`,r.length>1?o===0?"Mint transaction":"Registration":"Transaction"])].filter(Boolean);V("out-links").innerHTML=i.map(([s,o])=>`<a href="${s}" target="_blank" rel="noopener">${pi(o)}</a>`).join(""),V("success").hidden=!1,V("success").scrollIntoView({behavior:"smooth",block:"nearest"})}V("deploy-btn").addEventListener("click",Zde);V("again-btn").addEventListener("click",()=>{V("success").hidden=!0,V("stages").hidden=!0,V("f-name").value="",V("f-description").value="",V("name-count").textContent="0",wn(),document.querySelector(".app-head").scrollIntoView({behavior:"smooth"})});async function qq(){let t=V("recent-row");try{let e=(await Tq(8)).slice(0,8);if(!e.length){t.innerHTML='<p class="recent-empty">Nothing has landed in the last stretch. Yours could be next.</p>';return}t.innerHTML=e.map(r=>`<a class="recent-card" href="https://www.metaplex.com/agents/${pi(r.asset)}" target="_blank" rel="noopener">`+(r.image?`<img src="${pi(r.image)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`:'<img alt="" />')+`<span class="recent-meta"><strong>${pi(r.name)}</strong><small>${r.has3d?"3D \xB7 ":""}${r.x402?"x402 \xB7 ":""}${new Date(r.at).toLocaleDateString()}</small></span></a>`).join("")}catch{t.innerHTML='<p class="recent-empty">The live feed is unreachable right now. <a href="https://three.ws/deployments" target="_blank" rel="noopener">Open it on three.ws</a>.</p>'}}Tg();wn();kb("devnet");qq();for(let t of cP())t.provider?.connect?.({onlyIfTrusted:!0}).then(e=>{let r=e?.publicKey||t.provider.publicKey;r&&!fe.wallet&&zg({kind:"injected",label:t.label,address:r.toString(),provider:t.provider})}).catch(()=>{});
+ <p class="danger-note" style="margin-top:16px">Import this key into Phantom or Solflare any time to use the same wallet there.</p>`);e.querySelector("#m-reveal").addEventListener("click",()=>{e.querySelector("#m-secret-text").textContent=t.exportSecretKey(),e.querySelector("#m-secret-wrap").hidden=!1}),e.querySelector("#m-download").addEventListener("click",()=>{let r=URL.createObjectURL(fB(t.address,t.exportSecretKey())),n=document.createElement("a");n.href=r,n.download=`solana-wallet-${t.address.slice(0,8)}.json`,n.click(),URL.revokeObjectURL(r)})});for(let t of document.querySelectorAll(".seg-btn"))t.addEventListener("click",()=>{ie.source=t.dataset.source;for(let e of document.querySelectorAll(".seg-btn"))e.classList.toggle("active",e===t),e.setAttribute("aria-checked",String(e===t));K("source-custom").hidden=ie.source!=="custom",K("source-threews").hidden=ie.source!=="threews",ie.source==="threews"&&!K("avatar-picker").dataset.loaded&&CW()});async function CW(t=!1){let e=K("avatar-picker");t||(e.innerHTML='<div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div>');try{let{items:r,cursor:n}=await OW({limit:8,cursor:t?ie.pickerCursor:""});if(ie.pickerCursor=n,t||(e.innerHTML=""),!r.length&&!t){e.innerHTML='<p class="hint">No three.ws avatars available right now. Paste a link above, or use your own URLs.</p>';return}for(let i of r){let s=document.createElement("button");s.type="button",s.className="picker-item",s.innerHTML=`<img src="${Fi(i.image)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" /><span>${Fi(i.name)}</span>`,s.addEventListener("click",()=>MW(i,s)),e.appendChild(s)}e.dataset.loaded="1",K("picker-more").hidden=!n}catch{e.innerHTML='<p class="hint">Could not reach three.ws just now. Paste an avatar link above, or use your own URLs.</p>'}}K("picker-more").addEventListener("click",()=>CW(!0));function MW(t,e){for(let r of K("avatar-picker").querySelectorAll(".picker-item"))r.classList.remove("selected");e&&e.classList.add("selected"),ie.imported=t,K("f-name").value.trim()||(K("f-name").value=t.name.slice(0,60)),!K("f-description").value.trim()&&t.description&&(K("f-description").value=t.description),K("f-image").value=t.image,K("f-model").value=t.modelUrl,K("name-count").textContent=String(K("f-name").value.length),Rn()}K("import-btn").addEventListener("click",async()=>{let t=K("import-error");t.hidden=!0,K("import-btn").disabled=!0;try{MW(await TW(K("f-threews").value),null)}catch(e){t.textContent=e.message,t.hidden=!1}finally{K("import-btn").disabled=!1}});function bB(t,e){let r=document.createElement("div");return r.className="row",r.innerHTML=`${e}<button type="button" class="row-del" aria-label="Remove">&times;</button>`,r.querySelector(".row-del").addEventListener("click",()=>{r.remove(),Rn()}),r.addEventListener("input",Rn),K(t).appendChild(r),r}K("add-service").addEventListener("click",()=>bB("services-rows",'<input type="text" class="svc-name" placeholder="Name, e.g. chat" aria-label="Service name" /><input type="url" class="svc-url" placeholder="https://\u2026" aria-label="Service endpoint" />'));K("add-creator").addEventListener("click",()=>bB("creators-rows",'<input type="text" class="cr-addr" placeholder="Wallet address" aria-label="Recipient address" /><input type="number" class="cr-pct narrow" min="0" max="100" placeholder="%" aria-label="Share" />'));K("add-attr").addEventListener("click",()=>bB("attrs-rows",'<input type="text" class="at-key" placeholder="key" aria-label="Attribute key" /><input type="text" class="at-val" placeholder="value" aria-label="Attribute value" />'));var hB=(t,e)=>[...K(t).querySelectorAll(".row")].map(e);function NW(){let t=hB("creators-rows",r=>({address:r.querySelector(".cr-addr").value.trim(),percentage:Number(r.querySelector(".cr-pct").value)})).filter(r=>r.address),e=K("f-trust").value.split(",").map(r=>r.trim()).filter(Boolean);return{network:ie.network,creator:ie.wallet?.address||"11111111111111111111111111111111",owner:K("f-owner").value.trim()||void 0,collection:K("f-collection").value.trim()||void 0,name:K("f-name").value.trim(),description:K("f-description").value.trim(),image:K("f-image").value.trim()||void 0,modelUrl:K("f-model").value.trim()||void 0,services:hB("services-rows",r=>({name:r.querySelector(".svc-name").value.trim(),endpoint:r.querySelector(".svc-url").value.trim()})).filter(r=>r.name&&r.endpoint),active:K("f-active").checked,x402Support:K("f-x402").checked,supportedTrust:e.length?e:["reputation"],royaltyBasisPoints:Number(K("f-royalty").value||0),royaltyCreators:t.length?t:void 0,verifiedCreator:K("p-verified").checked,immutableMetadata:K("p-immutable").checked,attributes:hB("attrs-rows",r=>({key:r.querySelector(".at-key").value.trim(),value:r.querySelector(".at-val").value.trim()})).filter(r=>r.key),permanentFreeze:K("p-freeze").checked,permanentTransfer:K("p-transfer").checked,permanentBurn:K("p-burn").checked,addBlocker:K("p-addblocker").checked,metadataUri:K("f-metadata-uri").value.trim()||void 0,registrationUri:K("f-registration-uri").value.trim()||void 0,feeLamports:ie.fee?.lamports||0,feeWallet:ie.fee?.wallet||void 0}}function LW(t){if(!t.name)return"Name your agent to continue";if(!Number.isInteger(t.royaltyBasisPoints)||t.royaltyBasisPoints<0||t.royaltyBasisPoints>1e4)return"Royalty must be between 0 and 10000 bps";if(t.royaltyCreators){let e=t.royaltyCreators.reduce((r,n)=>r+n.percentage,0);if(e!==100)return`Royalty shares total ${e}%, they must total 100%`}return ie.wallet?ie.endpoint?typeof ie.balance=="number"&&ie.balance<iv()?"Not enough SOL to cover the deploy":null:"Add an RPC endpoint to continue":"Connect a wallet first"}var Kp=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2});function mSe(){let t=K("fee-note");if(!t)return;let e='<a href="https://three.ws/three" target="_blank" rel="noopener">$THREE</a>',r=`Holding ${Kp(cs.half_price_at_three)} ${e} halves it, ${Kp(cs.free_at_three)} waives it.`;if(!cs.enabled){t.innerHTML="No deploy fee is configured on this build.";return}if(ie.network==="devnet"){t.innerHTML=`Devnet rehearsals are free: no deploy fee, only devnet rent. Mainnet adds a ${cs.standard_sol} SOL deploy fee that funds ${e} buybacks. ${r}`;return}if(!ie.wallet||!ie.fee){t.innerHTML=`Mainnet deploys carry a ${cs.standard_sol} SOL fee that funds ${e} buybacks. ${r}`;return}let n=ie.fee.three_tokens;if(ie.fee.tier==="holder_free"){t.innerHTML=`Deploy fee waived: this wallet holds ${Kp(n)} ${e}. You pay network rent only.`;return}if(ie.fee.tier==="holder_half"){t.innerHTML=`Deploy fee halved to ${ie.fee.sol} SOL: this wallet holds ${Kp(n)} ${e}. ${Kp(cs.free_at_three)} waives it entirely.`;return}let i=ie.fee.next_tier?.need_three;t.innerHTML=`Includes a ${ie.fee.sol} SOL deploy fee that funds ${e} buybacks.`+(i?` ${Kp(i)} more $THREE in this wallet halves it.`:` ${r}`)}function Rn(){let t=NW(),e=t.name||"Your agent";K("preview-name").textContent=e,K("preview-desc").textContent=t.description||"Fill in the form and watch exactly what lands on-chain.",K("preview-initial").textContent=(t.name||"A").slice(0,1).toUpperCase();let r=K("preview-img");t.image&&r.dataset.src!==t.image?(r.dataset.src=t.image,r.src=t.image,r.hidden=!1,K("preview-initial").hidden=!0,r.onerror=()=>{r.hidden=!0,r.dataset.src="",K("preview-initial").hidden=!1}):t.image||(r.hidden=!0,r.dataset.src="",K("preview-initial").hidden=!1);let n=[];t.modelUrl&&n.push(["3D body",!0]),t.x402Support&&n.push(["x402",!0]),t.services.length&&n.push([`${t.services.length} service${t.services.length>1?"s":""}`,!0]);for(let u of t.supportedTrust)n.push([u,!1]);n.push([ie.network,ie.network==="mainnet"]),K("preview-chips").innerHTML=n.map(([u,d])=>`<span${d?' class="on"':""}>${Fi(u)}</span>`).join("");let i=XS({name:e,description:t.description,image:t.image,modelUrl:t.modelUrl,services:t.services,active:t.active,x402Support:t.x402Support,registrations:[YS("<assigned when it mints>",t.network)],supportedTrust:t.supportedTrust}),s=ZS({name:e,image:t.image,animationUrl:t.modelUrl});K("json-out").firstElementChild.textContent=JSON.stringify(ie.previewDoc==="registration"?i:s,null,2);let o=qp(i).length+qp(s).length;K("cost-line").textContent=`~${iv()} SOL \xB7 ${o.toLocaleString()} bytes on-chain`,mSe(),K("royalty-pct").textContent=`${(t.royaltyBasisPoints/100).toFixed(t.royaltyBasisPoints%100?2:0)}%`;let c=K("deploy-btn");if(ie.deploying)c.disabled=!0,c.textContent="Deploying\u2026";else{let u=LW(t);c.disabled=!!u,c.textContent=u||`Deploy on ${ie.network==="devnet"?"devnet":"mainnet"}`}}for(let t of["f-name","f-description","f-image","f-model","f-royalty","f-trust","f-collection","f-owner","f-metadata-uri","f-registration-uri"])K(t).addEventListener("input",Rn);for(let t of["f-x402","f-active","p-verified","p-immutable","p-freeze","p-transfer","p-burn","p-addblocker"])K(t).addEventListener("change",Rn);K("f-name").addEventListener("input",()=>{K("name-count").textContent=String(K("f-name").value.length)});for(let t of document.querySelectorAll(".tab"))t.addEventListener("click",()=>{ie.previewDoc=t.dataset.doc;for(let e of document.querySelectorAll(".tab"))e.classList.toggle("active",e===t),e.setAttribute("aria-selected",String(e===t));Rn()});function Ey(t,e=[]){K("stages").hidden=!1;for(let r of K("stages").children)r.classList.toggle("active",r.dataset.stage===t),r.classList.toggle("done",e.includes(r.dataset.stage))}async function ySe(){let t=NW();if(!(ie.deploying||LW(t))){ie.deploying=!0,Rn(),K("deploy-error").hidden=!0,K("success").hidden=!0,Ey("build");try{let e=mB(ie.endpoint),r=ie.wallet.kind==="hosted";e.use(yE(r?ie.wallet.hosted.signer(e):hE(_r(ie.wallet.address))));let n=cW(e,t),i=n.assetSigner.publicKey.toString(),s;if(r)Ey("mint",["build"]),{signatures:s}=await lW(e,n,{toBase58Signature:bW});else{let c=[];for(let A of n.builders)c.push(await A.buildAndSign(e));let u=c.map(A=>{let v=e.transactions.serialize(A);try{return ta.deserialize(v)}catch{return Ke.from(v)}});Ey("sign",["build"]);let d=ie.wallet.provider,f=typeof d.signAllTransactions=="function"?await d.signAllTransactions(u):await Promise.all(u.map(A=>d.signTransaction(A))),m=new ql(ie.endpoint,"confirmed");s=[];for(let A=0;A<f.length;A++){Ey(A===0?"mint":"register",["build","sign",...A?["mint"]:[]]);let v=await bSe(m,f[A].serialize());await ASe(m,v),s.push(v),A===0&&f.length>1&&await _Se(m,i)}}Ey("done",["build","sign","mint","register"]);let[o]=(0,rv.findAssetSignerPda)(e,{asset:_r(i)});vSe(i,o.toString(),s),ov(),DW()}catch(e){K("deploy-error").textContent=SSe(e),K("deploy-error").hidden=!1,K("stages").hidden=!0}finally{ie.deploying=!1,Rn()}}}async function bSe(t,e){for(let r=0;;r++)try{return await t.sendRawTransaction(e,{skipPreflight:!1})}catch(n){if(!/Invalid Core Asset|custom program error: 0x4/i.test(n?.message||"")||r>=4)throw n;await nv(2e3)}}async function ASe(t,e){for(let r=0;r<45;r++){let{value:n}=await t.getSignatureStatuses([e]),i=n?.[0];if(i?.err)throw new Error(`The network rejected the transaction: ${JSON.stringify(i.err)}`);if(i?.confirmationStatus==="confirmed"||i?.confirmationStatus==="finalized")return;await nv(2e3)}throw new Error(`Timed out waiting for ${e} to confirm. Check the explorer before trying again.`)}async function _Se(t,e){for(let r=0;r<10;r++){if(await t.getAccountInfo(new be(e)).catch(()=>null))return;await nv(1500)}}function SSe(t){let e=t?.message||String(t);return/reject|denied|declined|4001/i.test(e)?"You dismissed the signature request. Nothing was spent.":/insufficient|0x1\b/i.test(e)?`Not enough SOL for the deploy (about ${iv()} SOL). Top the wallet up and try again.`:/blockhash|expired/i.test(e)?"The transaction expired before it was signed. Press deploy again to rebuild it.":/403|forbidden/i.test(e)?'The RPC endpoint refused the request. Add your own endpoint with "Use my own RPC".':`Deploy failed: ${e}`}function vSe(t,e,r){K("out-asset").textContent=t,K("out-wallet").textContent=e;let n=ie.network==="devnet",i=[!n&&[`https://www.metaplex.com/agents/${t}`,"Metaplex page"],[`https://core.metaplex.com/explorer/${t}${n?"?env=devnet":""}`,"Core explorer"],[`https://solscan.io/account/${t}${n?"?cluster=devnet":""}`,"Solscan"],...r.map((s,o)=>[`https://solscan.io/tx/${s}${n?"?cluster=devnet":""}`,r.length>1?o===0?"Mint transaction":"Registration":"Transaction"])].filter(Boolean);K("out-links").innerHTML=i.map(([s,o])=>`<a href="${s}" target="_blank" rel="noopener">${Fi(o)}</a>`).join(""),K("success").hidden=!1,K("success").scrollIntoView({behavior:"smooth",block:"nearest"})}K("deploy-btn").addEventListener("click",ySe);K("again-btn").addEventListener("click",()=>{K("success").hidden=!0,K("stages").hidden=!0,K("f-name").value="",K("f-description").value="",K("name-count").textContent="0",Rn(),document.querySelector(".app-head").scrollIntoView({behavior:"smooth"})});async function DW(){let t=K("recent-row");try{let e=(await BW(8)).slice(0,8);if(!e.length){t.innerHTML='<p class="recent-empty">Nothing has landed in the last stretch. Yours could be next.</p>';return}t.innerHTML=e.map(r=>`<a class="recent-card" href="https://www.metaplex.com/agents/${Fi(r.asset)}" target="_blank" rel="noopener">`+(r.image?`<img src="${Fi(r.image)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'" />`:'<img alt="" />')+`<span class="recent-meta"><strong>${Fi(r.name)}</strong><small>${r.has3d?"3D \xB7 ":""}${r.x402?"x402 \xB7 ":""}${new Date(r.at).toLocaleDateString()}</small></span></a>`).join("")}catch{t.innerHTML='<p class="recent-empty">The live feed is unreachable right now. <a href="https://three.ws/deployments" target="_blank" rel="noopener">Open it on three.ws</a>.</p>'}}xy();Rn();sv("devnet");DW();for(let t of uB())t.provider?.connect?.({onlyIfTrusted:!0}).then(e=>{let r=e?.publicKey||t.provider.publicKey;r&&!ie.wallet&&Iy({kind:"injected",label:t.label,address:r.toString(),provider:t.provider})}).catch(()=>{});
/*! Bundled license information:
ieee754/index.js:
diff --git a/packages/metaplex-agent-mcp/docs/docs.html b/packages/metaplex-agent-mcp/docs/docs.html
index ece4a6780..4f598e87e 100644
--- a/packages/metaplex-agent-mcp/docs/docs.html
+++ b/packages/metaplex-agent-mcp/docs/docs.html
@@ -58,6 +58,7 @@
<li><a href="#deploy-web">Deploy in the browser</a></li>
<li><a href="#wallets">Wallets and keys</a></li>
<li><a href="#costs">Costs and networks</a></li>
+ <li><a href="#three">The deploy fee and $THREE</a></li>
</ul>
</div>
<div>
@@ -153,14 +154,17 @@
<table>
<thead><tr><th>What</th><th>Cost</th><th>Why</th></tr></thead>
<tbody>
- <tr><td>Core asset</td><td>~0.004 SOL</td><td>Rent for the account holding your agent, plus the fee</td></tr>
- <tr><td>Identity registration</td><td>~0.003 SOL</td><td>Rent for the identity PDA, plus the fee</td></tr>
- <tr><td>Total</td><td><strong>~0.007 SOL</strong></td><td>Paid once, by the wallet you deploy from</td></tr>
+ <tr><td>Core asset</td><td>~0.004 SOL</td><td>Rent for the account holding your agent, plus the network fee</td></tr>
+ <tr><td>Identity registration</td><td>~0.003 SOL</td><td>Rent for the identity PDA, plus the network fee</td></tr>
+ <tr><td>Deploy fee (mainnet)</td><td>0.02 SOL</td><td>The protocol fee, which funds $THREE buybacks. Free on devnet, and waived for $THREE holders</td></tr>
+ <tr><td>Total</td><td><strong>~0.027 SOL</strong></td><td>Paid once, by the wallet you deploy from</td></tr>
</tbody>
</table>
<p>
- Rent is a deposit held by the network for as long as the accounts exist, not a fee to anyone. There is no
- charge from this site or from three.ws: it takes no cut and has no server in the path.
+ Rent is a deposit held by the network for as long as the accounts exist, not a fee to anyone: close the
+ accounts and it comes back. The deploy fee is the one charge that is ours, it is shown in the deployer
+ before you sign anything, and it is the whole business model of this tool. See
+ <a href="#three">the deploy fee and $THREE</a>.
</p>
<h3>RPC endpoints</h3>
<p>
@@ -174,6 +178,43 @@
</p>
</section>
+ <section id="three">
+ <h2>The deploy fee and $THREE</h2>
+ <p>
+ A mainnet deploy carries a flat <strong>0.02 SOL</strong> fee. It travels in the same transaction that
+ creates your agent, so a deploy that fails, is rejected, or expires costs you nothing, and it is always
+ shown, with its recipient, before you sign. Devnet deploys never pay it: a full end-to-end rehearsal is
+ free.
+ </p>
+ <p>
+ The fee is paid to the wallet the three.ws
+ <a href="https://three.ws/three" target="_blank" rel="noopener">$THREE</a> buyback lane spends from, and the
+ public ledger of what that lane has bought lives at
+ <a href="https://three.ws/api/three-token/stats" target="_blank" rel="noopener">/api/three-token/stats</a>.
+ Deploys fund buybacks; there is no other revenue in this tool.
+ </p>
+ <h3>Holding $THREE makes it cheaper, then free</h3>
+ <table>
+ <thead><tr><th>$THREE in the paying wallet</th><th>Deploy fee</th></tr></thead>
+ <tbody>
+ <tr><td>Any amount under 50,000</td><td>0.02 SOL</td></tr>
+ <tr><td>50,000 or more</td><td>0.01 SOL</td></tr>
+ <tr><td>250,000 or more</td><td>Free</td></tr>
+ </tbody>
+ </table>
+ <p>
+ The balance is read live from the chain when the transaction is built. Nothing is staked, escrowed,
+ locked, or spent to earn the discount: you hold the tokens, in your own wallet, and keep them. Deploy a
+ fleet and the waiver applies to every one of them.
+ </p>
+ <p>
+ From MCP, <code>three_status</code> prices your next deploy against any wallet and returns the live
+ $THREE market and buyback figures. <code>agent_wallet</code> reports the same tier for the wallet it
+ looks up. Self-hosting a fork with different economics is a matter of
+ <code>DEPLOY_FEE_SOL</code>, <code>DEPLOY_FEE_WALLET</code>, and <code>DEPLOY_FEE_ENABLED</code>.
+ </p>
+ </section>
+
<section id="mcp">
<h2>MCP setup</h2>
<p>
@@ -215,7 +256,11 @@
<tr><td><code>SOLANA_RPC_URL</code></td><td>public endpoint</td><td>Your own HTTPS RPC. Recommended for anything beyond a trial.</td></tr>
<tr><td><code>METAPLEX_AGENT_NETWORK</code></td><td><code>mainnet</code></td><td>Default cluster. Every tool also takes a per-call <code>network</code>.</td></tr>
<tr><td><code>REQUIRE_CONFIRM</code></td><td><code>true</code></td><td>Refuse to spend until a call repeats with <code>confirm: true</code>.</td></tr>
- <tr><td><code>THREE_WS_BASE</code></td><td><code>https://three.ws</code></td><td>Host backing <code>list_onchain_agents</code>.</td></tr>
+ <tr><td><code>THREE_WS_BASE</code></td><td><code>https://three.ws</code></td><td>Host backing <code>list_onchain_agents</code> and <code>three_status</code>.</td></tr>
+ <tr><td><code>DEPLOY_FEE_SOL</code></td><td><code>0.02</code></td><td>The mainnet deploy fee, in SOL. See <a href="#three">the deploy fee and $THREE</a>.</td></tr>
+ <tr><td><code>DEPLOY_FEE_WALLET</code></td><td>three.ws buyback wallet</td><td>Where the fee is paid. Change it only when self-hosting a fork.</td></tr>
+ <tr><td><code>DEPLOY_FEE_ENABLED</code></td><td><code>true</code></td><td>Set false to build a fork that charges nothing.</td></tr>
+ <tr><td><code>THREE_HALF_PRICE_AT</code> / <code>THREE_FREE_AT</code></td><td><code>50000</code> / <code>250000</code></td><td>$THREE balances that halve, then waive, the fee.</td></tr>
</tbody>
</table>
<h3>A first session</h3>
@@ -239,7 +284,7 @@ get_onchain_agent { "asset": "&lt;returned address&gt;", "network": "devnet" }</
<tr>
<td><code>mint_onchain_agent</code></td>
<td>Mints the Core asset and registers the identity, signed by your key. Returns a full preview unless <code>confirm: true</code>.</td>
- <td>~0.007 SOL</td>
+ <td>~0.027 SOL</td>
</tr>
<tr>
<td><code>prepare_agent_mint</code></td>
@@ -276,6 +321,11 @@ get_onchain_agent { "asset": "&lt;returned address&gt;", "network": "devnet" }</
<td>The newest registrations from the live feed. <code>all_chains: true</code> adds EVM ERC-8004 registrations.</td>
<td>No</td>
</tr>
+ <tr>
+ <td><code>three_status</code></td>
+ <td>Prices your next deploy: the fee schedule, a wallet's live $THREE balance and tier, and the public buyback ledger.</td>
+ <td>No</td>
+ </tr>
</tbody>
</table>
<h3>Every mint option</h3>
diff --git a/packages/metaplex-agent-mcp/docs/index.html b/packages/metaplex-agent-mcp/docs/index.html
index 7dd7d9026..1de7ea9ef 100644
--- a/packages/metaplex-agent-mcp/docs/index.html
+++ b/packages/metaplex-agent-mcp/docs/index.html
@@ -74,7 +74,7 @@
<a class="btn btn-ghost btn-lg" href="docs.html">Read the docs</a>
</div>
<dl class="hero-stats">
- <div><dt>Cost to deploy</dt><dd>~0.007 SOL</dd></div>
+ <div><dt>Cost to deploy</dt><dd>~0.027 SOL</dd></div>
<div><dt>Time</dt><dd>Under a minute</dd></div>
<div><dt>Rehearsal</dt><dd>Free on devnet</dd></div>
</dl>
@@ -343,6 +343,7 @@
<h3 id="h-deploy">Deploy</h3>
<span class="cost" id="cost-line">~0.007 SOL</span>
</div>
+ <p class="fee-note" id="fee-note">Devnet rehearsals are free. Mainnet adds a deploy fee that funds $THREE buybacks, waived for holders.</p>
<button type="button" class="btn btn-primary btn-block" id="deploy-btn" disabled>Connect a wallet first</button>
<ol class="stages" id="stages" hidden>
<li data-stage="build">Building the transaction</li>
diff --git a/packages/metaplex-agent-mcp/docs/styles.css b/packages/metaplex-agent-mcp/docs/styles.css
index b565a9585..3fd97648c 100644
--- a/packages/metaplex-agent-mcp/docs/styles.css
+++ b/packages/metaplex-agent-mcp/docs/styles.css
@@ -201,6 +201,9 @@ code, pre { font-family: var(--mono); }
}
.card-status { margin-left: auto; font-size: 12px; color: var(--ink-4); font-family: var(--mono); }
.cost { margin-left: auto; font-size: 13px; font-family: var(--mono); color: var(--ink-3); }
+.fee-note { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-4); }
+.fee-note a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
+.fee-note a:hover { color: var(--ink); }
/* ── Wallet choices ───────────────────────────────────────────────────── */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
diff --git a/packages/metaplex-agent-mcp/site/docs.html b/packages/metaplex-agent-mcp/site/docs.html
index ece4a6780..4f598e87e 100644
--- a/packages/metaplex-agent-mcp/site/docs.html
+++ b/packages/metaplex-agent-mcp/site/docs.html
@@ -58,6 +58,7 @@
<li><a href="#deploy-web">Deploy in the browser</a></li>
<li><a href="#wallets">Wallets and keys</a></li>
<li><a href="#costs">Costs and networks</a></li>
+ <li><a href="#three">The deploy fee and $THREE</a></li>
</ul>
</div>
<div>
@@ -153,14 +154,17 @@
<table>
<thead><tr><th>What</th><th>Cost</th><th>Why</th></tr></thead>
<tbody>
- <tr><td>Core asset</td><td>~0.004 SOL</td><td>Rent for the account holding your agent, plus the fee</td></tr>
- <tr><td>Identity registration</td><td>~0.003 SOL</td><td>Rent for the identity PDA, plus the fee</td></tr>
- <tr><td>Total</td><td><strong>~0.007 SOL</strong></td><td>Paid once, by the wallet you deploy from</td></tr>
+ <tr><td>Core asset</td><td>~0.004 SOL</td><td>Rent for the account holding your agent, plus the network fee</td></tr>
+ <tr><td>Identity registration</td><td>~0.003 SOL</td><td>Rent for the identity PDA, plus the network fee</td></tr>
+ <tr><td>Deploy fee (mainnet)</td><td>0.02 SOL</td><td>The protocol fee, which funds $THREE buybacks. Free on devnet, and waived for $THREE holders</td></tr>
+ <tr><td>Total</td><td><strong>~0.027 SOL</strong></td><td>Paid once, by the wallet you deploy from</td></tr>
</tbody>
</table>
<p>
- Rent is a deposit held by the network for as long as the accounts exist, not a fee to anyone. There is no
- charge from this site or from three.ws: it takes no cut and has no server in the path.
+ Rent is a deposit held by the network for as long as the accounts exist, not a fee to anyone: close the
+ accounts and it comes back. The deploy fee is the one charge that is ours, it is shown in the deployer
+ before you sign anything, and it is the whole business model of this tool. See
+ <a href="#three">the deploy fee and $THREE</a>.
</p>
<h3>RPC endpoints</h3>
<p>
@@ -174,6 +178,43 @@
</p>
</section>
+ <section id="three">
+ <h2>The deploy fee and $THREE</h2>
+ <p>
+ A mainnet deploy carries a flat <strong>0.02 SOL</strong> fee. It travels in the same transaction that
+ creates your agent, so a deploy that fails, is rejected, or expires costs you nothing, and it is always
+ shown, with its recipient, before you sign. Devnet deploys never pay it: a full end-to-end rehearsal is
+ free.
+ </p>
+ <p>
+ The fee is paid to the wallet the three.ws
+ <a href="https://three.ws/three" target="_blank" rel="noopener">$THREE</a> buyback lane spends from, and the
+ public ledger of what that lane has bought lives at
+ <a href="https://three.ws/api/three-token/stats" target="_blank" rel="noopener">/api/three-token/stats</a>.
+ Deploys fund buybacks; there is no other revenue in this tool.
+ </p>
+ <h3>Holding $THREE makes it cheaper, then free</h3>
+ <table>
+ <thead><tr><th>$THREE in the paying wallet</th><th>Deploy fee</th></tr></thead>
+ <tbody>
+ <tr><td>Any amount under 50,000</td><td>0.02 SOL</td></tr>
+ <tr><td>50,000 or more</td><td>0.01 SOL</td></tr>
+ <tr><td>250,000 or more</td><td>Free</td></tr>
+ </tbody>
+ </table>
+ <p>
+ The balance is read live from the chain when the transaction is built. Nothing is staked, escrowed,
+ locked, or spent to earn the discount: you hold the tokens, in your own wallet, and keep them. Deploy a
+ fleet and the waiver applies to every one of them.
+ </p>
+ <p>
+ From MCP, <code>three_status</code> prices your next deploy against any wallet and returns the live
+ $THREE market and buyback figures. <code>agent_wallet</code> reports the same tier for the wallet it
+ looks up. Self-hosting a fork with different economics is a matter of
+ <code>DEPLOY_FEE_SOL</code>, <code>DEPLOY_FEE_WALLET</code>, and <code>DEPLOY_FEE_ENABLED</code>.
+ </p>
+ </section>
+
<section id="mcp">
<h2>MCP setup</h2>
<p>
@@ -215,7 +256,11 @@
<tr><td><code>SOLANA_RPC_URL</code></td><td>public endpoint</td><td>Your own HTTPS RPC. Recommended for anything beyond a trial.</td></tr>
<tr><td><code>METAPLEX_AGENT_NETWORK</code></td><td><code>mainnet</code></td><td>Default cluster. Every tool also takes a per-call <code>network</code>.</td></tr>
<tr><td><code>REQUIRE_CONFIRM</code></td><td><code>true</code></td><td>Refuse to spend until a call repeats with <code>confirm: true</code>.</td></tr>
- <tr><td><code>THREE_WS_BASE</code></td><td><code>https://three.ws</code></td><td>Host backing <code>list_onchain_agents</code>.</td></tr>
+ <tr><td><code>THREE_WS_BASE</code></td><td><code>https://three.ws</code></td><td>Host backing <code>list_onchain_agents</code> and <code>three_status</code>.</td></tr>
+ <tr><td><code>DEPLOY_FEE_SOL</code></td><td><code>0.02</code></td><td>The mainnet deploy fee, in SOL. See <a href="#three">the deploy fee and $THREE</a>.</td></tr>
+ <tr><td><code>DEPLOY_FEE_WALLET</code></td><td>three.ws buyback wallet</td><td>Where the fee is paid. Change it only when self-hosting a fork.</td></tr>
+ <tr><td><code>DEPLOY_FEE_ENABLED</code></td><td><code>true</code></td><td>Set false to build a fork that charges nothing.</td></tr>
+ <tr><td><code>THREE_HALF_PRICE_AT</code> / <code>THREE_FREE_AT</code></td><td><code>50000</code> / <code>250000</code></td><td>$THREE balances that halve, then waive, the fee.</td></tr>
</tbody>
</table>
<h3>A first session</h3>
@@ -239,7 +284,7 @@ get_onchain_agent { "asset": "&lt;returned address&gt;", "network": "devnet" }</
<tr>
<td><code>mint_onchain_agent</code></td>
<td>Mints the Core asset and registers the identity, signed by your key. Returns a full preview unless <code>confirm: true</code>.</td>
- <td>~0.007 SOL</td>
+ <td>~0.027 SOL</td>
</tr>
<tr>
<td><code>prepare_agent_mint</code></td>
@@ -276,6 +321,11 @@ get_onchain_agent { "asset": "&lt;returned address&gt;", "network": "devnet" }</
<td>The newest registrations from the live feed. <code>all_chains: true</code> adds EVM ERC-8004 registrations.</td>
<td>No</td>
</tr>
+ <tr>
+ <td><code>three_status</code></td>
+ <td>Prices your next deploy: the fee schedule, a wallet's live $THREE balance and tier, and the public buyback ledger.</td>
+ <td>No</td>
+ </tr>
</tbody>
</table>
<h3>Every mint option</h3>
diff --git a/packages/metaplex-agent-mcp/site/index.html b/packages/metaplex-agent-mcp/site/index.html
index 7dd7d9026..1de7ea9ef 100644
--- a/packages/metaplex-agent-mcp/site/index.html
+++ b/packages/metaplex-agent-mcp/site/index.html
@@ -74,7 +74,7 @@
<a class="btn btn-ghost btn-lg" href="docs.html">Read the docs</a>
</div>
<dl class="hero-stats">
- <div><dt>Cost to deploy</dt><dd>~0.007 SOL</dd></div>
+ <div><dt>Cost to deploy</dt><dd>~0.027 SOL</dd></div>
<div><dt>Time</dt><dd>Under a minute</dd></div>
<div><dt>Rehearsal</dt><dd>Free on devnet</dd></div>
</dl>
@@ -343,6 +343,7 @@
<h3 id="h-deploy">Deploy</h3>
<span class="cost" id="cost-line">~0.007 SOL</span>
</div>
+ <p class="fee-note" id="fee-note">Devnet rehearsals are free. Mainnet adds a deploy fee that funds $THREE buybacks, waived for holders.</p>
<button type="button" class="btn btn-primary btn-block" id="deploy-btn" disabled>Connect a wallet first</button>
<ol class="stages" id="stages" hidden>
<li data-stage="build">Building the transaction</li>
diff --git a/packages/metaplex-agent-mcp/site/src/app.js b/packages/metaplex-agent-mcp/site/src/app.js
index f84bd18db..6a6175f99 100644
--- a/packages/metaplex-agent-mcp/site/src/app.js
+++ b/packages/metaplex-agent-mcp/site/src/app.js
@@ -24,6 +24,7 @@ import {
jsonDataUri,
} from '../../src/lib/registration.js';
import { toBase58Signature } from '../../src/lib/solana.js';
+import { resolveDeployFee, feeSchedule } from '../../src/lib/three.js';
import { resolveEndpoint, validateRpc, saveCustomRpc, customRpc, rpcCall } from './rpc.js';
import {
detectInjected,
@@ -41,6 +42,7 @@ const short = (a) => (a && a.length > 12 ? `${a.slice(0, 4)}…${a.slice(-4)}` :
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const MINT_COST_SOL = 0.007;
+const FEE = feeSchedule();
const state = {
network: 'devnet',
@@ -51,8 +53,23 @@ const state = {
previewDoc: 'registration',
pickerCursor: '',
deploying: false,
+ fee: null, // resolved $THREE deploy fee for the connected wallet, see refreshFee()
};
+/**
+ * Total SOL this deploy costs right now: rent + network fees + the deploy fee.
+ * With no wallet connected there is no balance to price the fee against, so
+ * mainnet quotes the standard fee rather than a number nobody can actually pay.
+ */
+function deployCostSol() {
+ const fee = state.fee
+ ? state.fee.sol
+ : state.network === 'mainnet' && FEE.enabled
+ ? FEE.standard_sol
+ : 0;
+ return Math.round((MINT_COST_SOL + fee) * 1e6) / 1e6;
+}
+
/* ── Umi ──────────────────────────────────────────────────────────────── */
function umiFor(endpoint) {
@@ -239,23 +256,49 @@ $('disconnect-btn').addEventListener('click', () => {
render();
});
+/**
+ * Price the deploy fee for the connected wallet: mainnet only, waived or halved
+ * by the wallet's live $THREE balance. Never blocks the deployer; an unresolved
+ * fee falls back to the standard schedule so the cost shown is never too low.
+ */
+async function refreshFee() {
+ if (!state.wallet || !state.endpoint) {
+ state.fee = null;
+ return;
+ }
+ try {
+ state.fee = await resolveDeployFee(umiFor(state.endpoint), {
+ network: state.network,
+ payer: state.wallet.address,
+ });
+ } catch {
+ state.fee =
+ state.network === 'mainnet'
+ ? { sol: FEE.standard_sol, lamports: FEE.standard_lamports, wallet: FEE.fee_wallet, tier: 'standard' }
+ : { sol: 0, lamports: 0, wallet: null, tier: 'devnet' };
+ }
+ render();
+}
+
async function refreshBalance() {
if (!state.wallet || !state.endpoint) {
$('wallet-balance').textContent = '';
return;
}
+ refreshFee();
try {
const result = await rpcCall(state.endpoint, 'getBalance', [state.wallet.address]);
const sol = (result?.value ?? 0) / 1e9;
state.balance = sol;
$('wallet-balance').textContent = `${sol.toFixed(4)} SOL`;
- const short_ = sol < MINT_COST_SOL;
+ const need = deployCostSol();
+ const short_ = sol < need;
$('funding-warn').hidden = !short_;
if (short_) {
$('funding-warn').textContent =
state.network === 'devnet'
- ? `This wallet holds ${sol.toFixed(4)} SOL. A mint costs about ${MINT_COST_SOL} SOL. Use "Get devnet SOL" above, it is free.`
- : `This wallet holds ${sol.toFixed(4)} SOL. A mint costs about ${MINT_COST_SOL} SOL. Send some SOL to ${state.wallet.address} and it will update here.`;
+ ? `This wallet holds ${sol.toFixed(4)} SOL. A deploy costs about ${need} SOL. Use "Get devnet SOL" above, it is free.`
+ : `This wallet holds ${sol.toFixed(4)} SOL. A deploy costs about ${need} SOL. Send some SOL to ${state.wallet.address} and it will update here.`;
}
} catch {
$('wallet-balance').textContent = 'balance unavailable';
@@ -589,6 +632,8 @@ function params() {
addBlocker: $('p-addblocker').checked,
metadataUri: $('f-metadata-uri').value.trim() || undefined,
registrationUri: $('f-registration-uri').value.trim() || undefined,
+ feeLamports: state.fee?.lamports || 0,
+ feeWallet: state.fee?.wallet || undefined,
};
}
@@ -603,12 +648,53 @@ function problemWith(p) {
}
if (!state.wallet) return 'Connect a wallet first';
if (!state.endpoint) return 'Add an RPC endpoint to continue';
- if (typeof state.balance === 'number' && state.balance < MINT_COST_SOL) return 'Not enough SOL to cover the mint';
+ if (typeof state.balance === 'number' && state.balance < deployCostSol()) return 'Not enough SOL to cover the deploy';
return null;
}
/* ── Render ───────────────────────────────────────────────────────────── */
+const num = (n) => Number(n).toLocaleString('en-US', { maximumFractionDigits: 2 });
+
+/**
+ * The one line that explains what the deploy fee is, why it is that number, and
+ * how to make it smaller. Every state is written out: no wallet, devnet, and
+ * each of the three mainnet tiers.
+ */
+function renderFeeNote() {
+ const el = $('fee-note');
+ if (!el) return;
+ const link = '<a href="https://three.ws/three" target="_blank" rel="noopener">$THREE</a>';
+ const schedule = `Holding ${num(FEE.half_price_at_three)} ${link} halves it, ${num(FEE.free_at_three)} waives it.`;
+
+ if (!FEE.enabled) {
+ el.innerHTML = 'No deploy fee is configured on this build.';
+ return;
+ }
+ if (state.network === 'devnet') {
+ el.innerHTML = `Devnet rehearsals are free: no deploy fee, only devnet rent. Mainnet adds a ${FEE.standard_sol} SOL deploy fee that funds ${link} buybacks. ${schedule}`;
+ return;
+ }
+ if (!state.wallet || !state.fee) {
+ el.innerHTML = `Mainnet deploys carry a ${FEE.standard_sol} SOL fee that funds ${link} buybacks. ${schedule}`;
+ return;
+ }
+ const held = state.fee.three_tokens;
+ if (state.fee.tier === 'holder_free') {
+ el.innerHTML = `Deploy fee waived: this wallet holds ${num(held)} ${link}. You pay network rent only.`;
+ return;
+ }
+ if (state.fee.tier === 'holder_half') {
+ el.innerHTML = `Deploy fee halved to ${state.fee.sol} SOL: this wallet holds ${num(held)} ${link}. ${num(FEE.free_at_three)} waives it entirely.`;
+ return;
+ }
+ const need = state.fee.next_tier?.need_three;
+ el.innerHTML =
+ `Includes a ${state.fee.sol} SOL deploy fee that funds ${link} buybacks.` +
+ (need ? ` ${num(need)} more $THREE in this wallet halves it.` : ` ${schedule}`);
+}
+
+
function render() {
const p = params();
const name = p.name || 'Your agent';
@@ -662,7 +748,8 @@ function render() {
);
const bytes = jsonDataUri(registration).length + jsonDataUri(metadata).length;
- $('cost-line').textContent = `~${MINT_COST_SOL} SOL · ${bytes.toLocaleString()} bytes on-chain`;
+ $('cost-line').textContent = `~${deployCostSol()} SOL · ${bytes.toLocaleString()} bytes on-chain`;
+ renderFeeNote();
$('royalty-pct').textContent = `${(p.royaltyBasisPoints / 100).toFixed(p.royaltyBasisPoints % 100 ? 2 : 0)}%`;
const btn = $('deploy-btn');
@@ -812,7 +899,7 @@ async function waitForAccount(conn, address) {
function explain(err) {
const msg = err?.message || String(err);
if (/reject|denied|declined|4001/i.test(msg)) return 'You dismissed the signature request. Nothing was spent.';
- if (/insufficient|0x1\b/i.test(msg)) return `Not enough SOL for the mint (about ${MINT_COST_SOL} SOL). Top the wallet up and try again.`;
+ if (/insufficient|0x1\b/i.test(msg)) return `Not enough SOL for the deploy (about ${deployCostSol()} SOL). Top the wallet up and try again.`;
if (/blockhash|expired/i.test(msg)) return 'The transaction expired before it was signed. Press deploy again to rebuild it.';
if (/403|forbidden/i.test(msg)) return 'The RPC endpoint refused the request. Add your own endpoint with "Use my own RPC".';
return `Deploy failed: ${msg}`;
diff --git a/packages/metaplex-agent-mcp/site/styles.css b/packages/metaplex-agent-mcp/site/styles.css
index b565a9585..3fd97648c 100644
--- a/packages/metaplex-agent-mcp/site/styles.css
+++ b/packages/metaplex-agent-mcp/site/styles.css
@@ -201,6 +201,9 @@ code, pre { font-family: var(--mono); }
}
.card-status { margin-left: auto; font-size: 12px; color: var(--ink-4); font-family: var(--mono); }
.cost { margin-left: auto; font-size: 13px; font-family: var(--mono); color: var(--ink-3); }
+.fee-note { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-4); }
+.fee-note a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
+.fee-note a:hover { color: var(--ink); }
/* ── Wallet choices ───────────────────────────────────────────────────── */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }