import{loadFtContractSnapshot as s,__tla as __tla_0}from"./mts-ft-BpjmaKfh.js";import{loadUnshieldedFtContractSnapshot as c,__tla as __tla_1}from"./mts-ft-unshielded-DCj9HHmo.js";import{ar as i,__tla as __tla_2}from"./_virtual_wxt-plugins-D2Qy6pl9.js";import{az as r,aA as h,aB as u,aC as f,aD as w,__tla as __tla_3}from"./UnlockedWallet-B6hSmM5s.js";import{aE as D,aF as E,aG as G,__tla as __tla_4}from"./UnlockedWallet-B6hSmM5s.js";import{__tla as __tla_5}from"./index-YPJa-kxZ.js";import"./contract-state-cache-5DyKqU8u.js";import{__tla as __tla_6}from"./contract-state-fetch-B2eVmQET.js";import{__tla as __tla_7}from"./TeamThemeProvider-BMMWqJEv.js";import{__tla as __tla_8}from"./debounce-D1Adyjvd.js";import{__tla as __tla_9}from"./headers-DBBLE3ii.js";import{__tla as __tla_10}from"./gateway-auth-C4f--iOs.js";import{__tla as __tla_11}from"./vault-state-DXmi8wtw.js";let K;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})(),(()=>{try{return __tla_2}catch{}})(),(()=>{try{return __tla_3}catch{}})(),(()=>{try{return __tla_4}catch{}})(),(()=>{try{return __tla_5}catch{}})(),(()=>{try{return __tla_6}catch{}})(),(()=>{try{return __tla_7}catch{}})(),(()=>{try{return __tla_8}catch{}})(),(()=>{try{return __tla_9}catch{}})(),(()=>{try{return __tla_10}catch{}})(),(()=>{try{return __tla_11}catch{}})()]).then(async()=>{function B(e){const n=r({shieldedBalances:e.shieldedBalances,unshieldedBalances:e.unshieldedBalances,allowZeroTokenColor:e.dialect==="canonical"}),d=e.managedFtContracts??[],t=new Map;for(const o of d)t.set(i(o.contractAddress),o.kind??"shielded");const l=new Set;for(const o of d){const a=i(o.contractAddress);l.add(a)}return{candidates:Array.from(l),kindByContract:t,shieldedBalances:n.shielded,unshieldedBalances:n.unshielded}}async function g(e,n){const d=e.plan.kindByContract.get(n);if(d==="unshielded")return{contractAddress:n,shielded:null,unshielded:await e.snapshots.loadUnshielded(n)};if(d==="shielded")return{contractAddress:n,shielded:await e.snapshots.loadShielded(n),unshielded:null};const t=await e.snapshots.loadShielded(n);return t?{contractAddress:n,shielded:t,unshielded:null}:{contractAddress:n,shielded:null,unshielded:await e.snapshots.loadUnshielded(n)}}function F(e,n,d){const{contractAddress:t,shielded:l,unshielded:o}=d;return l?u({snapshot:l,network:e.network,shieldedBalances:e.plan.shieldedBalances,unshieldedBalances:e.plan.unshieldedBalances}):o?f({snapshot:o,tokenColor:t,network:e.network,activeOwnerHex:e.activeOwnerHex,activeCoinPublicKeyHex:e.activeCoinPublicKeyHex}):w({contractAddress:t,managed:n.get(t),network:e.network,shieldedBalances:e.plan.shieldedBalances,unshieldedBalances:e.plan.unshieldedBalances})}async function k(e){const n=new Map;for(const l of e.managedFtContracts??[]){const o=i(l.contractAddress);n.set(o,{...l,contractAddress:o})}const d=await Promise.all(e.plan.candidates.map(l=>g(e,l))),t=[];for(const l of d){const o=F(e,n,l);o&&t.push(o)}return h(t)}K=async function(e){if(!e.indexerUrl&&!e.apiBaseUrl)return[];const n=e.managedFtContracts??[],d=B({dialect:"canonical",managedFtContracts:n,shieldedBalances:e.shieldedBalances,unshieldedBalances:e.unshieldedBalances});return d.candidates.length===0?[]:k({plan:d,network:e.network,managedFtContracts:n,activeOwnerHex:e.activeOwnerHex,activeCoinPublicKeyHex:e.activeCoinPublicKeyHex,snapshots:{loadShielded:t=>s({network:e.network,contractAddress:t}),loadUnshielded:t=>c({network:e.network,contractAddress:t})}})}});export{D as deserializeFtHoldings,K as resolveFtHoldings,E as resolveFtMediaUrl,G as serializeFtHoldings,__tla};