@ecency/sdk 2.3.91 → 2.3.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import {useQuery,useInfiniteQuery,useMutation,QueryClient,queryOptions,infiniteQueryOptions,useQueryClient,isServer}from'@tanstack/react-query';import {hexToBytes,bytesToHex}from'@noble/hashes/utils.js';import {ripemd160}from'@noble/hashes/legacy.js';import vn from'bs58';import {secp256k1}from'@noble/curves/secp256k1.js';import {sha256,sha512}from'@noble/hashes/sha2.js';import {cbc}from'@noble/ciphers/aes.js';import uo from'hivesigner';var $i=Object.defineProperty;var vt=(e,t)=>{for(var r in t)$i(e,r,{get:t[r],enumerable:true});};var Pt=new ArrayBuffer(0),At=null,Ot=null;function Wi(){return At||(typeof TextEncoder<"u"?At=new TextEncoder:At={encode(e){let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<128)t.push(n);else if(n<2048)t.push(192|n>>6,128|n&63);else if(n>=55296&&n<=56319&&r+1<e.length){let o=e.charCodeAt(++r);n=65536+((n&1023)<<10)+(o&1023),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63);}else t.push(224|n>>12,128|n>>6&63,128|n&63);}return new Uint8Array(t)}}),At}function mn(){return Ot||(typeof TextDecoder<"u"?Ot=new TextDecoder:Ot={decode(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r="";for(let n=0;n<t.length;){let o=t[n],i;o<128?(i=o,n+=1):(o&224)===192?(i=(o&31)<<6|t[n+1]&63,n+=2):(o&240)===224?(i=(o&15)<<12|(t[n+1]&63)<<6|t[n+2]&63,n+=3):(i=(o&7)<<18|(t[n+1]&63)<<12|(t[n+2]&63)<<6|t[n+3]&63,n+=4),i<=65535?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296+(i>>10),56320+(i&1023)));}return r}}),Ot}var D=class e{static LITTLE_ENDIAN=true;static BIG_ENDIAN=false;static DEFAULT_CAPACITY=16;static DEFAULT_ENDIAN=e.BIG_ENDIAN;buffer;view;offset;markedOffset;limit;littleEndian;constructor(t=e.DEFAULT_CAPACITY,r=e.DEFAULT_ENDIAN){this.buffer=t===0?Pt:new ArrayBuffer(t),this.view=t===0?new DataView(Pt):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=r;}static allocate(t,r){return new e(t,r)}static concat(t,r){let n=0;for(let a=0;a<t.length;++a){let c=t[a];if(c instanceof e)n+=c.limit-c.offset;else if(c instanceof Uint8Array)n+=c.length;else if(c instanceof ArrayBuffer)n+=c.byteLength;else if(Array.isArray(c))n+=c.length;else throw TypeError("Illegal buffer")}if(n===0)return new e(0,r);let o=new e(n,r),i=new Uint8Array(o.buffer),s=0;for(let a=0;a<t.length;++a){let c=t[a];c instanceof e?(i.set(new Uint8Array(c.buffer,c.offset,c.limit-c.offset),s),s+=c.limit-c.offset):c instanceof Uint8Array?(i.set(c,s),s+=c.length):c instanceof ArrayBuffer?(i.set(new Uint8Array(c),s),s+=c.byteLength):(i.set(c,s),s+=c.length);}return o.limit=o.offset=s,o.offset=0,o}static wrap(t,r){if(t instanceof e){let o=t.clone();return o.markedOffset=-1,o}let n;if(t instanceof Uint8Array)n=new e(0,r),t.length>0&&(n.buffer=t.buffer,n.offset=t.byteOffset,n.limit=t.byteOffset+t.byteLength,n.view=new DataView(t.buffer));else if(t instanceof ArrayBuffer)n=new e(0,r),t.byteLength>0&&(n.buffer=t,n.offset=0,n.limit=t.byteLength,n.view=t.byteLength>0?new DataView(t):new DataView(Pt));else if(Array.isArray(t))n=new e(t.length,r),n.limit=t.length,new Uint8Array(n.buffer).set(t);else throw TypeError("Illegal buffer");return n}writeBytes(t,r){return this.append(t,r)}writeInt8(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+1>this.buffer.byteLength&&this.resize(r+1),this.view.setInt8(r,t),n&&(this.offset+=1),this}writeByte(t,r){return this.writeInt8(t,r)}writeUint8(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+1>this.buffer.byteLength&&this.resize(r+1),this.view.setUint8(r,t),n&&(this.offset+=1),this}writeUInt8(t,r){return this.writeUint8(t,r)}readUint8(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getUint8(t);return r&&(this.offset+=1),n}readUInt8(t){return this.readUint8(t)}writeInt16(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+2>this.buffer.byteLength&&this.resize(r+2),this.view.setInt16(r,t,this.littleEndian),n&&(this.offset+=2),this}writeShort(t,r){return this.writeInt16(t,r)}writeUint16(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+2>this.buffer.byteLength&&this.resize(r+2),this.view.setUint16(r,t,this.littleEndian),n&&(this.offset+=2),this}writeUInt16(t,r){return this.writeUint16(t,r)}writeInt32(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+4>this.buffer.byteLength&&this.resize(r+4),this.view.setInt32(r,t,this.littleEndian),n&&(this.offset+=4),this}writeInt(t,r){return this.writeInt32(t,r)}writeUint32(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+4>this.buffer.byteLength&&this.resize(r+4),this.view.setUint32(r,t,this.littleEndian),n&&(this.offset+=4),this}writeUInt32(t,r){return this.writeUint32(t,r)}readUint32(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getUint32(t,this.littleEndian);return r&&(this.offset+=4),n}readUInt32=this.readUint32;append(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o;return t instanceof e?(o=new Uint8Array(t.buffer,t.offset,t.limit-t.offset),t.offset+=o.length):t instanceof Uint8Array?o=t:t instanceof ArrayBuffer?o=new Uint8Array(t):o=new Uint8Array(t),o.length<=0?this:(r+o.length>this.buffer.byteLength&&this.resize(r+o.length),new Uint8Array(this.buffer).set(o,r),n&&(this.offset+=o.length),this)}clone(t){let r=new e(0,this.littleEndian);return t?(r.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(r.buffer).set(new Uint8Array(this.buffer)),r.view=new DataView(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r}copy(t,r){if(t===void 0&&(t=this.offset),r===void 0&&(r=this.limit),t===r)return new e(0,this.littleEndian);let n=r-t,o=new e(n,this.littleEndian);return o.offset=0,o.limit=n,new Uint8Array(o.buffer).set(new Uint8Array(this.buffer).subarray(t,r),0),o}copyTo(t,r,n,o){let i=typeof r>"u",s=typeof n>"u";r=i?t.offset:r,n=s?this.offset:n,o=o===void 0?this.limit:o;let a=o-n;return a===0?t:(t.ensureCapacity(r+a),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer).subarray(n,o),r),s&&(this.offset+=a),i&&(t.offset+=a),this)}ensureCapacity(t){let r=this.buffer.byteLength;return r<t?this.resize((r*=2)>t?r:t):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(t){if(this.buffer.byteLength<t){let r=new ArrayBuffer(t);new Uint8Array(r).set(new Uint8Array(this.buffer)),this.buffer=r,this.view=new DataView(r);}return this}skip(t){return this.offset+=t,this}writeInt64(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,typeof t=="number"&&(t=BigInt(t)),r+8>this.buffer.byteLength&&this.resize(r+8),this.view.setBigInt64(r,t,this.littleEndian),n&&(this.offset+=8),this}writeLong(t,r){return this.writeInt64(t,r)}readInt64(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getBigInt64(t,this.littleEndian);return r&&(this.offset+=8),n}readLong(t){return this.readInt64(t)}writeUint64(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,typeof t=="number"&&(t=BigInt(t)),r+8>this.buffer.byteLength&&this.resize(r+8),this.view.setBigUint64(r,t,this.littleEndian),n&&(this.offset+=8),this}writeUInt64(t,r){return this.writeUint64(t,r)}readUint64(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getBigUint64(t,this.littleEndian);return r&&(this.offset+=8),n}readUInt64(t){return this.readUint64(t)}toBuffer(t){let r=this.offset,n=this.limit;return !t&&r===0&&n===this.buffer.byteLength?this.buffer:r===n?Pt:this.buffer.slice(r,n)}toArrayBuffer(t){return this.toBuffer(t)}writeVarint32(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o=this.calculateVarint32(t);for(r+o>this.buffer.byteLength&&this.resize(r+o),t>>>=0;t>=128;)this.view.setUint8(r++,t&127|128),t>>>=7;return this.view.setUint8(r++,t),n?(this.offset=r,this):o}readVarint32(t){let r=typeof t>"u";typeof t>"u"&&(t=this.offset);let n=0,o=0,i;do i=this.view.getUint8(t++),n<5&&(o|=(i&127)<<7*n),++n;while((i&128)!==0);return o|=0,r?(this.offset=t,o):{value:o,length:n}}calculateVarint32(t){return t=t>>>0,t<128?1:t<16384?2:t<1<<21?3:t<1<<28?4:5}writeVString(t,r){let n=typeof r>"u",o=n?this.offset:r,i=Wi().encode(t),s=i.length,a=this.calculateVarint32(s);return o+a+s>this.buffer.byteLength&&this.resize(o+a+s),this.writeVarint32(s,o),o+=a,new Uint8Array(this.buffer).set(i,o),o+=s,n?(this.offset=o,this):o-(r||0)}readVString(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=t,o=this.readVarint32(t),i=o.value,s=o.length;t+=s;let a=mn().decode(new Uint8Array(this.buffer,t,i));return t+=i,r?(this.offset=t,a):{string:a,length:t-n}}readUTF8String(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o=mn().decode(new Uint8Array(this.buffer,r,t));return n?(this.offset+=t,o):{string:o,length:t}}};var x={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://api.syncad.com","https://rpc.mahdiyari.info"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://api.syncad.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodesByApi:{hivesense:["https://api.hive.blog","https://api.syncad.com"]},userAgent:"ecency-sdk",chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:5e3,broadcastTimeout:15e3,retry:5,resilience:{adaptiveTimeout:true,adaptiveTimeoutFloorMs:2e3,adaptiveTimeoutFactor:4,hedge:false,hedgeDelayFloorMs:750,hedgeDelayFactor:2,hedgeBucketCapacity:10,hedgeRefillPerSuccess:.1,totalBudgetFactor:2}},gn=["bridge.get_ranked_posts","bridge.get_account_posts","bridge.get_post","bridge.get_discussion","bridge.get_profile","bridge.get_profiles","bridge.get_community","bridge.list_communities","condenser_api.get_accounts","condenser_api.get_content","condenser_api.get_dynamic_global_properties","condenser_api.get_trending_tags"],xt=null,rr=e=>{if(e===null){xt=null;return}if(!e||typeof e!="object")return;let t=typeof e.url=="string"?e.url.trim():"";if(!/^https?:\/\//i.test(t))return;let r={};if(e.headers&&typeof e.headers=="object")for(let[s,a]of Object.entries(e.headers))typeof a=="string"&&a&&!/[\u0000-\u001f\u007f]/.test(a)&&!/[\u0000-\u001f\u007f]/.test(s)&&(r[s]=a);let n=typeof e.timeoutMs=="number"&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0?e.timeoutMs:2e3,o=e.methods===void 0?[...gn]:Array.isArray(e.methods)?e.methods.filter(s=>typeof s=="string"&&s.includes(".")):[];if(o.length===0)return;let i=(s,a)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:a;xt={url:t,headers:r,timeoutMs:n,methods:o,failureThreshold:Math.floor(i(e.failureThreshold,3)),cooldownMs:i(e.cooldownMs,1e4),methodSet:new Set(o)};},nr=e=>Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string").map(t=>t.trim().replace(/\/+$/,"")).filter(t=>t.length>0&&/^https?:\/\/.+/.test(t)))]:[],or=e=>{let t=nr(e);t.length&&(x.nodes=t);},ir=e=>{let t=nr(e);t.length&&(x.restNodes=t);},sr=e=>{if(!e||typeof e!="object")return;let t={...x.restNodesByApi};for(let[r,n]of Object.entries(e)){let o=nr(n);o.length?t[r]=o:delete t[r];}x.restNodesByApi=t;},ar=e=>{if(typeof e!="string")return;let t=e.trim();!t||/[\u0000-\u001f\u007f]/.test(t)||(x.userAgent=t);},cr=e=>{if(!e||typeof e!="object")return;let t=x.resilience,r=o=>typeof o=="boolean",n=o=>typeof o=="number"&&Number.isFinite(o)&&o>0;r(e.adaptiveTimeout)&&(t.adaptiveTimeout=e.adaptiveTimeout),n(e.adaptiveTimeoutFloorMs)&&(t.adaptiveTimeoutFloorMs=Math.max(e.adaptiveTimeoutFloorMs,2e3)),n(e.adaptiveTimeoutFactor)&&(t.adaptiveTimeoutFactor=e.adaptiveTimeoutFactor),r(e.hedge)&&(t.hedge=e.hedge),n(e.hedgeDelayFloorMs)&&(t.hedgeDelayFloorMs=e.hedgeDelayFloorMs),n(e.hedgeDelayFactor)&&(t.hedgeDelayFactor=e.hedgeDelayFactor),n(e.hedgeBucketCapacity)&&(t.hedgeBucketCapacity=e.hedgeBucketCapacity),n(e.hedgeRefillPerSuccess)&&(t.hedgeRefillPerSuccess=Math.min(e.hedgeRefillPerSuccess,1)),n(e.totalBudgetFactor)&&(t.totalBudgetFactor=Math.max(e.totalBudgetFactor,1));};var Ee=class e{data;recovery;compressed;constructor(t,r,n){this.data=t,this.recovery=r,this.compressed=n??true;}static from(t){if(typeof t=="string"){let r=hexToBytes(t),n=parseInt(bytesToHex(r.subarray(0,1)),16)-31,o=true;n<0&&(o=false,n=n+4);let i=r.subarray(1);return new e(i,n,o)}else throw new Error("Expected string for data")}toBuffer(){let t=new Uint8Array(65).fill(0);return this.compressed?t[0]=this.recovery+31&255:t[0]=this.recovery+27&255,t.set(this.data,1),t}customToString(){return bytesToHex(this.toBuffer())}toString(){return this.customToString()}getPublicKey(t){if(t instanceof Uint8Array&&t.length!==32||typeof t=="string"&&t.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof t=="string"&&(t=hexToBytes(t));let r=secp256k1.Signature.fromBytes(this.data,"compact"),n=new secp256k1.Signature(r.r,r.s,this.recovery);return new Y(n.recoverPublicKey(t).toBytes())}};var Y=class e{key;prefix;constructor(t,r){this.key=t,this.prefix=r??x.address_prefix;}static fromString(t){let r=x.address_prefix;if(typeof t!="string"||t.length<=r.length)throw new Error("Invalid public key");let n=t.slice(0,r.length);if(n!==r)throw new Error(`Public key must start with ${r}`);let o;try{o=vn.decode(t.slice(r.length));}catch{throw new Error("Invalid public key encoding")}if(o.length!==37)throw new Error("Invalid public key length");let i=o.subarray(0,33),s=o.subarray(33,37),a=ripemd160(i).subarray(0,4);if(!zi(s,a))throw new Error("Public key checksum mismatch");try{secp256k1.Point.fromBytes(i);}catch{throw new Error("Invalid public key")}return new e(i,n)}static from(t){return t instanceof e?t:e.fromString(t)}verify(t,r){return typeof r=="string"&&(r=Ee.from(r)),secp256k1.verify(r.data,t,this.key,{prehash:false,format:"compact"})}toString(){return Gi(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return `PublicKey: ${this.toString()}`}},Gi=(e,t)=>{let r=ripemd160(e);return t+vn.encode(new Uint8Array([...e,...r.subarray(0,4)]))},zi=(e,t)=>{if(e.byteLength!==t.byteLength)return false;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return false;return true};var Et=class e{amount;symbol;constructor(t,r){this.amount=t,this.symbol=r==="HIVE"?"STEEM":r==="HBD"?"SBD":r;}static fromString(t,r=null){let[n,o]=t.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(o)===-1)throw new Error(`Invalid asset symbol: ${o}`);if(r&&o!==r)throw new Error(`Invalid asset, expected symbol: ${r} got: ${o}`);let i=Number.parseFloat(n);if(!Number.isFinite(i))throw new Error(`Invalid asset amount: ${n}`);return new e(i,o)}static from(t,r){if(t instanceof e){if(r&&t.symbol!==r)throw new Error(`Invalid asset, expected symbol: ${r} got: ${t.symbol}`);return t}else {if(typeof t=="number"&&Number.isFinite(t))return new e(t,r||"STEEM");if(typeof t=="string")return e.fromString(t,r);throw new Error(`Invalid asset '${String(t)}'`)}}getPrecision(){switch(this.symbol){case "TESTS":case "TBD":case "STEEM":case "SBD":case "HBD":case "HIVE":return 3;case "VESTS":return 6;default:return 3}}toString(){return `${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}};var St=class e{buffer;static from(t){return t instanceof e?t:t instanceof Uint8Array?new e(t):typeof t=="string"?new e(hexToBytes(t)):new e(new Uint8Array(t))}constructor(t){this.buffer=t;}toString(){return bytesToHex(this.buffer)}toJSON(){return this.toString()}};var C={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},ie=()=>{throw new Error("Void can not be serialized")},b=(e,t)=>{e.writeVString(t);},Xi=(e,t)=>{e.writeInt16(t);},An=(e,t)=>{e.writeInt64(t);},Pn=(e,t)=>{e.writeUint8(t);},pe=(e,t)=>{e.writeUint16(t);},X=(e,t)=>{e.writeUint32(t);},On=(e,t)=>{e.writeUint64(t);},be=(e,t)=>{e.writeByte(t?1:0);},xn=e=>(t,r)=>{let[n,o]=r;t.writeVarint32(n),e[n](t,o);},q=(e,t)=>{let r=Et.from(t),n=r.getPrecision();e.writeInt64(Math.round(r.amount*Math.pow(10,n))),e.writeUint8(n);for(let o=0;o<7;o++)e.writeUint8(r.symbol.charCodeAt(o)||0);},Se=(e,t)=>{e.writeUint32(Math.floor(new Date(t+"Z").getTime()/1e3));},ge=(e,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?e.append(new Uint8Array(33).fill(0)):e.append(Y.from(t).key);},En=(e=null)=>(t,r)=>{r=St.from(r);let n=r.buffer.length;if(e){if(n!==e)throw new Error(`Unable to serialize binary. Expected ${e} bytes, got ${n}`)}else t.writeVarint32(n);t.append(r.buffer);},Sn=En(),ur=(e,t)=>(r,n)=>{r.writeVarint32(n.length);for(let[o,i]of n)e(r,o),t(r,i);},V=e=>(t,r)=>{t.writeVarint32(r.length);for(let n of r)e(t,n);},le=e=>(t,r)=>{for(let[n,o]of e)try{o(t,r[n]);}catch(i){throw i.message=`${n}: ${i.message}`,i}},Ie=e=>(t,r)=>{r!==void 0?(t.writeByte(1),e(t,r)):t.writeByte(0);},W=le([["weight_threshold",X],["account_auths",ur(b,pe)],["key_auths",ur(ge,pe)]]),Zi=le([["account",b],["weight",pe]]),pr=le([["base",q],["quote",q]]),es=le([["account_creation_fee",q],["maximum_block_size",X],["hbd_interest_rate",pe]]),R=(e,t)=>{let r=le(t);return (n,o)=>{n.writeVarint32(e),r(n,o);}},S={};S.account_create=R(C.account_create,[["fee",q],["creator",b],["new_account_name",b],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",b]]);S.account_create_with_delegation=R(C.account_create_with_delegation,[["fee",q],["delegation",q],["creator",b],["new_account_name",b],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",b],["extensions",V(ie)]]);S.account_update=R(C.account_update,[["account",b],["owner",Ie(W)],["active",Ie(W)],["posting",Ie(W)],["memo_key",ge],["json_metadata",b]]);S.account_witness_proxy=R(C.account_witness_proxy,[["account",b],["proxy",b]]);S.account_witness_vote=R(C.account_witness_vote,[["account",b],["witness",b],["approve",be]]);S.cancel_transfer_from_savings=R(C.cancel_transfer_from_savings,[["from",b],["request_id",X]]);S.change_recovery_account=R(C.change_recovery_account,[["account_to_recover",b],["new_recovery_account",b],["extensions",V(ie)]]);S.claim_account=R(C.claim_account,[["creator",b],["fee",q],["extensions",V(ie)]]);S.claim_reward_balance=R(C.claim_reward_balance,[["account",b],["reward_hive",q],["reward_hbd",q],["reward_vests",q]]);S.comment=R(C.comment,[["parent_author",b],["parent_permlink",b],["author",b],["permlink",b],["title",b],["body",b],["json_metadata",b]]);S.comment_options=R(C.comment_options,[["author",b],["permlink",b],["max_accepted_payout",q],["percent_hbd",pe],["allow_votes",be],["allow_curation_rewards",be],["extensions",V(xn([le([["beneficiaries",V(Zi)]])]))]]);S.convert=R(C.convert,[["owner",b],["requestid",X],["amount",q]]);S.create_claimed_account=R(C.create_claimed_account,[["creator",b],["new_account_name",b],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",b],["extensions",V(ie)]]);S.custom=R(C.custom,[["required_auths",V(b)],["id",pe],["data",Sn]]);S.custom_json=R(C.custom_json,[["required_auths",V(b)],["required_posting_auths",V(b)],["id",b],["json",b]]);S.decline_voting_rights=R(C.decline_voting_rights,[["account",b],["decline",be]]);S.delegate_vesting_shares=R(C.delegate_vesting_shares,[["delegator",b],["delegatee",b],["vesting_shares",q]]);S.delete_comment=R(C.delete_comment,[["author",b],["permlink",b]]);S.escrow_approve=R(C.escrow_approve,[["from",b],["to",b],["agent",b],["who",b],["escrow_id",X],["approve",be]]);S.escrow_dispute=R(C.escrow_dispute,[["from",b],["to",b],["agent",b],["who",b],["escrow_id",X]]);S.escrow_release=R(C.escrow_release,[["from",b],["to",b],["agent",b],["who",b],["receiver",b],["escrow_id",X],["hbd_amount",q],["hive_amount",q]]);S.escrow_transfer=R(C.escrow_transfer,[["from",b],["to",b],["hbd_amount",q],["hive_amount",q],["escrow_id",X],["agent",b],["fee",q],["json_meta",b],["ratification_deadline",Se],["escrow_expiration",Se]]);S.feed_publish=R(C.feed_publish,[["publisher",b],["exchange_rate",pr]]);S.limit_order_cancel=R(C.limit_order_cancel,[["owner",b],["orderid",X]]);S.limit_order_create=R(C.limit_order_create,[["owner",b],["orderid",X],["amount_to_sell",q],["min_to_receive",q],["fill_or_kill",be],["expiration",Se]]);S.limit_order_create2=R(C.limit_order_create2,[["owner",b],["orderid",X],["amount_to_sell",q],["exchange_rate",pr],["fill_or_kill",be],["expiration",Se]]);S.recover_account=R(C.recover_account,[["account_to_recover",b],["new_owner_authority",W],["recent_owner_authority",W],["extensions",V(ie)]]);S.request_account_recovery=R(C.request_account_recovery,[["recovery_account",b],["account_to_recover",b],["new_owner_authority",W],["extensions",V(ie)]]);S.reset_account=R(C.reset_account,[["reset_account",b],["account_to_reset",b],["new_owner_authority",W]]);S.set_reset_account=R(C.set_reset_account,[["account",b],["current_reset_account",b],["reset_account",b]]);S.set_withdraw_vesting_route=R(C.set_withdraw_vesting_route,[["from_account",b],["to_account",b],["percent",pe],["auto_vest",be]]);S.transfer=R(C.transfer,[["from",b],["to",b],["amount",q],["memo",b]]);S.transfer_from_savings=R(C.transfer_from_savings,[["from",b],["request_id",X],["to",b],["amount",q],["memo",b]]);S.transfer_to_savings=R(C.transfer_to_savings,[["from",b],["to",b],["amount",q],["memo",b]]);S.transfer_to_vesting=R(C.transfer_to_vesting,[["from",b],["to",b],["amount",q]]);S.vote=R(C.vote,[["voter",b],["author",b],["permlink",b],["weight",Xi]]);S.withdraw_vesting=R(C.withdraw_vesting,[["account",b],["vesting_shares",q]]);S.witness_update=R(C.witness_update,[["owner",b],["url",b],["block_signing_key",ge],["props",es],["fee",q]]);S.witness_set_properties=R(C.witness_set_properties,[["owner",b],["props",ur(b,Sn)],["extensions",V(ie)]]);S.account_update2=R(C.account_update2,[["account",b],["owner",Ie(W)],["active",Ie(W)],["posting",Ie(W)],["memo_key",Ie(ge)],["json_metadata",b],["posting_json_metadata",b],["extensions",V(ie)]]);S.create_proposal=R(C.create_proposal,[["creator",b],["receiver",b],["start_date",Se],["end_date",Se],["daily_pay",q],["subject",b],["permlink",b],["extensions",V(ie)]]);S.update_proposal_votes=R(C.update_proposal_votes,[["voter",b],["proposal_ids",V(An)],["approve",be],["extensions",V(ie)]]);S.remove_proposal=R(C.remove_proposal,[["proposal_owner",b],["proposal_ids",V(An)],["extensions",V(ie)]]);var ts=le([["end_date",Se]]);S.update_proposal=R(C.update_proposal,[["proposal_id",On],["creator",b],["daily_pay",q],["subject",b],["permlink",b],["extensions",V(xn([ie,ts]))]]);S.collateralized_convert=R(C.collateralized_convert,[["owner",b],["requestid",X],["amount",q]]);S.recurrent_transfer=R(C.recurrent_transfer,[["from",b],["to",b],["amount",q],["memo",b],["recurrence",pe],["executions",pe],["extensions",V(le([["type",Pn],["value",le([["pair_id",Pn]])]]))]]);var rs=(e,t)=>{let r=S[t[0]];if(!r)throw new Error(`No serializer for operation: ${t[0]}`);try{r(e,t[1]);}catch(n){throw n.message=`${t[0]}: ${n.message}`,n}},ns=le([["ref_block_num",pe],["ref_block_prefix",X],["expiration",Se],["operations",V(rs)],["extensions",V(b)]]),os=le([["from",ge],["to",ge],["nonce",On],["check",X],["encrypted",En()]]),de={Asset:q,Memo:os,Price:pr,PublicKey:ge,String:b,Transaction:ns,UInt16:pe,UInt32:X};var ot=e=>new Promise(t=>setTimeout(t,e));var In=(()=>{try{return !(typeof navigator<"u"&&navigator.product==="ReactNative")&&typeof process<"u"&&process.versions!=null&&process.versions.node!=null}catch{return false}})();function gr(){return In?{"User-Agent":x.userAgent}:{}}var Ce={served:0,fallback:0,skipped:0,fallbackByReason:{status:0,rpcerror:0,timeout:0,transport:0,validate:0,parse:0}},Re=class extends Error{constructor(r,n){super(n);this.reason=r;}reason},kn=e=>e instanceof Error?e.message:typeof e=="string"?e:String(e),kt=0,Cn=0;async function is(e,t,r,n,o,i){let s=t.indexOf(".");if(s<=0||s===t.length-1)throw new Re("transport",`method without an api prefix: ${t}`);let{signal:a,cleanup:c}=hr(Math.min(e.timeoutMs,n)),{signal:p,cleanup:l}=Ft(a,o);try{let d;try{d=await fetch(e.url,{method:"POST",body:JSON.stringify({api:t.slice(0,s),method:t.slice(s+1),params:r}),headers:{"Content-Type":"application/json",...gr(),...e.headers},signal:p});}catch(g){throw o?.aborted?g:new Re(a.aborted?"timeout":"transport",kn(g))}if(d.status!==200){try{await d.body?.cancel();}catch{}let g=d.status===502&&(d.headers.get("x-ssr-cache")??"").toUpperCase()==="RPCERROR";throw new Re(g?"rpcerror":"status",g?"proxy relayed a node error":`proxy answered ${d.status}`)}let m;try{m=await d.json();}catch(g){throw o?.aborted?g:new Re(a.aborted?"timeout":"parse",kn(g))}if(i&&!i(m))throw new Re("validate","proxy result rejected by validator");return m}finally{c(),l();}}var Z=class extends Error{name="RPCError";data;code;stack=void 0;constructor(t){super(t.message),this.code=t.code,"data"in t&&(this.data=t.data);}},qe=class extends Error{node;rateLimitMs;isRateLimit;constructor(t,r,n={}){super(r),this.node=t,this.rateLimitMs=n.rateLimitMs??0,this.isRateLimit=n.isRateLimit??false;}};function qn(e){if(!e)return 0;let t=Number(e);if(Number.isFinite(t))return t>0?t*1e3:0;let r=Date.parse(e);if(Number.isFinite(r)){let n=r-Date.now();return n>0?n:0}return 0}var ss=["ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","EAI_AGAIN"],as=["Failed to fetch","NetworkError when attempting to fetch","Load failed","fetch failed"];function cs(e){if(!e)return "";let t=[String(e.name||""),String(e.message||""),String(e.code||"")],r=e.cause;for(let n=0;r&&n<5;n++)t.push(String(r.code||""),String(r.message||"")),r=r.cause;return t.join(" ")}function us(e){if(!e)return false;if(e instanceof qe)return true;if(e instanceof Z)return false;let t=cs(e);return !!(ss.some(r=>t.includes(r))||as.some(r=>t.includes(r))||e instanceof SyntaxError||/Unexpected token|JSON\.parse|Unexpected end of JSON/i.test(t))}function lr(e,t){return !!(e===-32603||e<=-32e3&&e>=-32099||e===-32601||e===-32602&&/unable to parse|endpoint data|internal/i.test(t))}function Dn(e){let t=e.indexOf(".");return t>0?e.slice(0,t):e}var ps=1e4,ls=6e4,ds=12e4,Rn=2,Tn=6e4,Fn=12e4,fs=30,it=.3,dr=3,st=5*6e4,Kn=6e4,Bn=1e3,Mn=2e3,Rt=class{health=new Map;getOrCreate(t){let r=this.health.get(t);return r||(r={consecutiveFailures:0,lastFailureTime:0,rateLimitedUntil:0,rateLimitStreak:0,lastRateLimitAt:0,apiFailures:new Map,headBlock:0,headBlockUpdatedAt:0,ewmaLatencyMs:void 0,latencySampleCount:0,latencyUpdatedAt:0,lastProbeAt:Date.now(),apiLatency:new Map},this.health.set(t,r)),r}recordSuccess(t,r,n,o){let i=this.getOrCreate(t);if(i.consecutiveFailures=0,i.rateLimitStreak=0,r){let s=i.apiFailures.get(r);(!s||!(s.defective&&s.cooldownUntil>Date.now()))&&i.apiFailures.delete(r);}typeof n=="number"&&Number.isFinite(n)&&n>=0&&this.recordLatency(i,n,o??r);}recordSlowFailure(t,r,n){!Number.isFinite(r)||r<Mn||this.recordLatency(this.getOrCreate(t),r,n);}getUsableLatencyMs(t,r){let n=this.health.get(t);if(!n)return;let o=Date.now();if(r!==void 0){let i=n.apiLatency.get(r);return i&&i.sampleCount>=dr&&o-i.updatedAt<=st?i.ewmaMs:void 0}return this.isLatencyUsable(n,o)?n.ewmaLatencyMs:void 0}recordCensoredLatency(t,r,n){!Number.isFinite(r)||r<50||this.recordLatency(this.getOrCreate(t),r,n);}recordLatency(t,r,n){let o=Date.now();if(t.latencyUpdatedAt>0&&o-t.latencyUpdatedAt>st&&(t.ewmaLatencyMs=void 0,t.latencySampleCount=0,t.apiLatency.clear()),t.ewmaLatencyMs=t.ewmaLatencyMs===void 0?r:it*r+(1-it)*t.ewmaLatencyMs,t.latencySampleCount++,t.latencyUpdatedAt=o,n!==void 0){let i=t.apiLatency.get(n);!i||o-i.updatedAt>st?t.apiLatency.set(n,{ewmaMs:r,sampleCount:1,updatedAt:o}):(i.ewmaMs=it*r+(1-it)*i.ewmaMs,i.sampleCount++,i.updatedAt=o);}}recordFailure(t,r){let n=this.getOrCreate(t);if(r){let o=Date.now(),i=n.apiFailures.get(r)??{count:0,cooldownUntil:0,lastFailureTime:0};(i.cooldownUntil>0&&i.cooldownUntil<=o||i.lastFailureTime>0&&o-i.lastFailureTime>3e4)&&(i.count=0,i.cooldownUntil=0),i.count++,i.lastFailureTime=o,i.count>=Rn&&(i.cooldownUntil=o+Tn),n.apiFailures.set(r,i);}else n.consecutiveFailures++,n.lastFailureTime=Date.now();}recordDefectiveResponse(t,r){let n=this.getOrCreate(t),o=Date.now(),i=n.apiFailures.get(r)??{count:0,cooldownUntil:0,lastFailureTime:0};i.count=Math.max(i.count+1,Rn),i.lastFailureTime=o,i.cooldownUntil=o+Tn,i.defective=true,n.apiFailures.set(r,i);}recordRateLimit(t,r){let n=this.getOrCreate(t),o=Date.now();n.rateLimitStreak>0&&o-n.lastRateLimitAt>ds&&(n.rateLimitStreak=0);let i=typeof r=="number"&&Number.isFinite(r)&&r>0,s=i?r:Math.min(ps*2**n.rateLimitStreak,ls);i||n.rateLimitStreak++,n.lastRateLimitAt=o,n.rateLimitedUntil=i?o+s:Math.max(n.rateLimitedUntil,o+s),n.consecutiveFailures++,n.lastFailureTime=o;}recordHeadBlock(t,r){if(!r||!Number.isFinite(r))return;let n=this.getOrCreate(t);n.headBlock=r,n.headBlockUpdatedAt=Date.now();}consensusHeadBlock(){let t=Date.now(),r=[];for(let n of this.health.values())n.headBlock>0&&t-n.headBlockUpdatedAt<=Fn&&r.push(n.headBlock);return r.length<2?0:(r.sort((n,o)=>n-o),r[Math.floor((r.length-1)/2)])}isNodeHealthy(t,r){let n=this.health.get(t);if(!n)return true;let o=Date.now();if(n.rateLimitedUntil>o||n.consecutiveFailures>=3&&o-n.lastFailureTime<3e4)return false;if(r){let s=n.apiFailures.get(r);if(s&&s.cooldownUntil>o)return false}let i=this.consensusHeadBlock();return !(i>0&&n.headBlock>0&&o-n.headBlockUpdatedAt<=Fn&&i-n.headBlock>fs)}getOrderedNodes(t,r){let n=[],o=[];for(let c of t)this.isNodeHealthy(c,r)?n.push(c):o.push(c);if(n.length<=1)return [...n,...o];let i=Date.now(),s=n.map((c,p)=>({node:c,i:p,score:this.scoreNode(c,i)})).sort((c,p)=>c.score-p.score||c.i-p.i).map(c=>c.node),a=this.pickReprobeCandidate(n,i);return a&&s[0]!==a?[a,...s.filter(c=>c!==a),...o]:[...s,...o]}isLatencyUsable(t,r){return !!t&&t.ewmaLatencyMs!==void 0&&t.latencySampleCount>=dr&&r-t.latencyUpdatedAt<=st}scoreNode(t,r){let n=this.health.get(t);return this.isLatencyUsable(n,r)?n.ewmaLatencyMs:Bn}pickReprobeCandidate(t,r){let n=r-Kn,o,i=1/0;for(let s of t){let a=this.getOrCreate(s),c=Math.max(a.latencyUpdatedAt,a.lastProbeAt);c<=n&&c<i&&(o=s,i=c);}return o&&(this.getOrCreate(o).lastProbeAt=r),o}},j=new Rt,ke=new Rt,fr=class{tokens=x.resilience.hedgeBucketCapacity;trySpend(){return this.clamp(),this.tokens>=1-1e-9?(this.tokens-=1,true):false}refill(){this.clamp(),this.tokens=Math.min(x.resilience.hedgeBucketCapacity,this.tokens+x.resilience.hedgeRefillPerSuccess);}clamp(){this.tokens>x.resilience.hedgeBucketCapacity&&(this.tokens=x.resilience.hedgeBucketCapacity);}get available(){return this.tokens}reset(t=x.resilience.hedgeBucketCapacity){this.tokens=t;}},mr=new fr;function Tt(e,t,r,n,o){let i=x.resilience;if(!i.adaptiveTimeout||o)return n;let s=e.getUsableLatencyMs(t,r);return s===void 0?n:Math.ceil(Math.min(n,Math.max(i.adaptiveTimeoutFloorMs,i.adaptiveTimeoutFactor*s)))}function yr(e,t,r,n){r instanceof qe?r.isRateLimit?e.recordRateLimit(t,r.rateLimitMs||void 0):e.recordFailure(t,n):r instanceof Z?e.recordFailure(t,n):e.recordFailure(t);}function Nn(e,t,r,n){if(!n||typeof n!="object"||!r.includes("get_dynamic_global_properties"))return;let o=n.head_block_number;typeof o=="number"&&e.recordHeadBlock(t,o);}function ms(){if(typeof DOMException<"u")return new DOMException("The operation was aborted due to timeout","TimeoutError");let e=new Error("The operation was aborted due to timeout");return e.name="TimeoutError",e}function hr(e){if(e=Math.ceil(e),typeof AbortSignal.timeout=="function")return {signal:AbortSignal.timeout(e),cleanup:()=>{}};let t=new AbortController,r=setTimeout(()=>t.abort(ms()),e);return {signal:t.signal,cleanup:()=>clearTimeout(r)}}function Ft(e,t){if(!t)return {signal:e,cleanup:()=>{}};if(typeof AbortSignal.any=="function")return {signal:AbortSignal.any([e,t]),cleanup:()=>{}};let r=new AbortController;if(e.aborted)return r.abort(e.reason),{signal:r.signal,cleanup:()=>{}};if(t.aborted)return r.abort(t.reason),{signal:r.signal,cleanup:()=>{}};let n=()=>r.abort(e.reason),o=()=>r.abort(t.reason);e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",o,{once:true});let i=()=>{e.removeEventListener("abort",n),t.removeEventListener("abort",o);};return {signal:r.signal,cleanup:i}}var at=async(e,t,r,n=x.timeout,o=false,i)=>{let s=Math.floor(Math.random()*1e8),a={jsonrpc:"2.0",method:t,params:r,id:s},{signal:c,cleanup:p}=hr(n),{signal:l,cleanup:d}=Ft(c,i),m=()=>{p(),d();};try{let g=await fetch(e,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json",...gr()},signal:l});if(g.status===429)throw new qe(e,"HTTP 429 Rate Limited",{rateLimitMs:qn(g.headers.get("Retry-After")),isRateLimit:!0});if(g.status>=500&&g.status<600)throw new qe(e,`HTTP ${g.status} from ${e}`);let h=await g.json();if(!h||typeof h.id>"u"||h.id!==s||h.jsonrpc!=="2.0")throw new Error("JSONRPC id mismatch");if("result"in h)return h.result;if("error"in h){let P=h.error;throw "message"in P&&"code"in P?new Z(P):h.error}throw h}catch(g){if(g instanceof Z||g instanceof qe||i?.aborted)throw g;if(o)return at(e,t,r,n,false,i);throw g}finally{m();}};function Ct(){return ot(50+Math.random()*50)}function gs(e){let{method:t,params:r,api:n,primary:o,hedgePool:i,callerTimeout:s,explicitTimeout:a,deadlineAt:c,externalSignal:p,onHedgeFired:l,validate:d}=e;return new Promise((m,g)=>{let h=false,P=0,O=false,T=false,F,ue,A=0,$=[],N=J=>{if(!h){h=true,ue!==void 0&&(clearTimeout(ue),ue=void 0);for(let I of $)I.signal.aborted||I.abort();J();}},H=(J,I)=>{P++;let me=new AbortController;$.push(me);let nt=Ft(me.signal,p),Li=Tt(j,J,t,s,a),tr=Date.now();I||(A=tr),at(J,t,r,Li,false,nt.signal).then(oe=>{if(nt.cleanup(),P--,I||(T=true),!h){if(d&&!d(oe)){if(j.recordDefectiveResponse(J,n),F=new Error(`[hive-tx] response validation failed for ${t} from ${J}`),!I&&!O){N(()=>g(F));return}P===0&&N(()=>g(F));return}j.recordSuccess(J,n,Date.now()-tr,t),Nn(j,J,t,oe),I?T||j.recordCensoredLatency(o,Date.now()-A,t):O||mr.refill(),N(()=>m(oe));}}).catch(oe=>{if(nt.cleanup(),P--,I||(T=true),!h){if(p?.aborted){N(()=>g(oe));return}if(oe instanceof Z&&!lr(oe.code,oe.message)){N(()=>g(oe));return}if(yr(j,J,oe,n),j.recordSlowFailure(J,Date.now()-tr,t),F=oe,!I&&!O){N(()=>g(oe));return}P===0&&N(()=>g(F));}});};H(o,false);let z=j.getUsableLatencyMs(o,t)??0,L=Tt(j,o,t,s,a),rt=Math.min(Math.max(x.resilience.hedgeDelayFloorMs,x.resilience.hedgeDelayFactor*z),.8*L);ue=setTimeout(()=>{if(ue=void 0,h||p?.aborted||Date.now()>=c)return;let J=i.filter(me=>j.isNodeHealthy(me,n));if(J.length===0)return;let I=J[Math.floor(Math.random()*J.length)];mr.trySpend()&&(O=true,l(I),H(I,true));},rt);})}var y=async(e,t=[],r,n=x.retry,o,i)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an array");if(x.nodes.length===0)throw new Error("config.nodes is empty");let s=r!==void 0,a=r??x.timeout,c=Dn(e),p=xt;if(p&&In&&p.methodSet.has(e))if(Date.now()<Cn)Ce.skipped++;else try{let g=await is(p,e,t,a,o,i);return Ce.served++,kt=0,g}catch(g){if(o?.aborted)throw g;Ce.fallback++;let h=g instanceof Re?g.reason:"transport";Ce.fallbackByReason[h]=(Ce.fallbackByReason[h]??0)+1,h==="rpcerror"?kt=0:++kt>=p.failureThreshold&&(Cn=Date.now()+p.cooldownMs,kt=0);}let l=Date.now()+x.resilience.totalBudgetFactor*a,d=new Set,m;for(let g=0;g<=n&&!(g>0&&Date.now()>=l);g++){let h=j.getOrderedNodes(x.nodes,c),P=h.find(F=>!d.has(F));P||(d.clear(),P=h[0]),d.add(P);let O=[];if(x.resilience.hedge&&j.getUsableLatencyMs(P,e)!==void 0&&(O=h.filter(F=>!d.has(F)&&j.isNodeHealthy(F,c)).slice(0,3)),O.length>0)try{return await gs({method:e,params:t,api:c,primary:P,hedgePool:O,callerTimeout:a,explicitTimeout:s,deadlineAt:l,externalSignal:o,onHedgeFired:F=>d.add(F),validate:i})}catch(F){if(F instanceof Z&&!lr(F.code,F.message)||o?.aborted)throw F;m=F,g<n&&await Ct();continue}let T=Date.now();try{let F=await at(P,e,t,Tt(j,P,e,a,s),!1,o);if(i&&!i(F)){j.recordDefectiveResponse(P,c),m=new Error(`[hive-tx] response validation failed for ${e} from ${P}`),g<n&&await Ct();continue}return j.recordSuccess(P,c,Date.now()-T,e),mr.refill(),Nn(j,P,e,F),F}catch(F){if(F instanceof Z&&!lr(F.code,F.message)||o?.aborted)throw F;yr(j,P,F,c),j.recordSlowFailure(P,Date.now()-T,e),m=F,g<n&&await Ct();}}throw m},Le=async(e,t=[],r=x.broadcastTimeout,n)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an array");if(x.nodes.length===0)throw new Error("config.nodes is empty");let o=Dn(e),i=new Set,s;for(let a=0;a<x.nodes.length;a++){let p=j.getOrderedNodes(x.nodes,o).find(l=>!i.has(l));if(!p)break;if(i.add(p),n?.aborted)throw new Error("Aborted");try{let l=await at(p,e,t,r,!1,n);return j.recordSuccess(p,o),l}catch(l){if(l instanceof Z||n?.aborted||(yr(j,p,l,o),s=l,!us(l)))throw l}}throw s},ys={balance:"/balance-api",hafah:"/hafah-api",hafbe:"/hafbe-api",hivemind:"/hivemind-api",hivesense:"/hivesense-api",reputation:"/reputation-api","nft-tracker":"/nft-tracker-api",hafsql:"/hafsql",status:"/status-api"};async function te(e,t,r,n,o=x.retry,i){if(!Array.isArray(x.restNodes))throw new Error("config.restNodes is not an array");if(x.restNodes.length===0)throw new Error("config.restNodes is empty");let s=n!==void 0,a=n??x.timeout,c=Date.now()+x.resilience.totalBudgetFactor*a,p=`${e}:${t}`,l=x.restNodesByApi?.[e]?.length?x.restNodesByApi[e]:x.restNodes,d=new Set,m,g=false;for(let h=0;h<=o&&!(h>0&&Date.now()>=c);h++){let P=ke.getOrderedNodes(l,e),O=P.find(I=>!d.has(I));O||(d.clear(),O=P[0]),d.add(O);let T=O+ys[e],F=t,ue=r||{},A=new Set;Object.entries(ue).forEach(([I,me])=>{F.includes(`{${I}}`)&&(F=F.replace(`{${I}}`,encodeURIComponent(String(me))),A.add(I));});let $=new URL(T+F);if(Object.entries(ue).forEach(([I,me])=>{A.has(I)||(Array.isArray(me)?me.forEach(nt=>$.searchParams.append(I,String(nt))):$.searchParams.set(I,String(me)));}),i?.aborted)throw new Error("Aborted");g=false;let{signal:N,cleanup:H}=hr(Tt(ke,O,p,a,s)),{signal:z,cleanup:L}=Ft(N,i),rt=()=>{H(),L();},J=Date.now();try{let I=await fetch($.toString(),{signal:z,headers:gr()});if(I.status===404)throw new Error("HTTP 404 - Hint: can happen on wrong params");if(I.status===429)throw ke.recordRateLimit(O,qn(I.headers.get("Retry-After"))||void 0),g=!0,new Error(`HTTP 429 Rate Limited by ${O}`);if(I.status===503)throw ke.recordFailure(O,e),g=!0,new Error(`HTTP 503 Service Unavailable from ${O}`);if(!I.ok)throw ke.recordFailure(O,e),g=!0,new Error(`HTTP ${I.status} from ${O}`);return ke.recordSuccess(O,e,Date.now()-J,p),I.json()}catch(I){if(I?.message?.includes("HTTP 404")||i?.aborted)throw I;g||ke.recordFailure(O,e),ke.recordSlowFailure(O,Date.now()-J,p),m=I,h<o&&await Ct();}finally{rt();}}throw m}var It=async(e,t=[],r=2,n)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an Array");if(r>x.nodes.length)throw new Error("quorum > config.nodes.length");let i=(c=>{let p=[...c];for(let l=p.length-1;l>0;l--){let d=Math.floor(Math.random()*(l+1));[p[l],p[d]]=[p[d],p[l]];}return p})(x.nodes),s=Math.min(r,i.length),a=[];for(;s>0&&i.length>0;){let c=i.splice(0,s),p=[],l=[];for(let m=0;m<c.length;m++)p.push(at(c[m],e,t,void 0,true,n).then(g=>l.push(g)).catch(()=>{}));await Promise.all(p),a.push(...l);let d=hs(a,r);if(d)return d;if(s=Math.min(r,i.length),s===0)throw new Error("No more nodes available.")}throw new Error("Couldn't reach quorum.")};function hs(e,t){let r=new Map;for(let o of e){let i=JSON.stringify(o);r.has(i)||r.set(i,[]),r.get(i).push(o);}let n=Array.from(r.values()).find(o=>o.length>=t);return n?n[0]:null}var bs=hexToBytes(x.chain_id),De=class e{transaction;expiration=6e4;txId;constructor(t){t?.transaction&&(t.transaction instanceof e?(this.transaction=t.transaction.transaction,this.expiration=t.transaction.expiration):this.transaction=t.transaction,this.transaction&&!Array.isArray(this.transaction.signatures)&&(this.transaction.signatures=[]),this.txId=this.digest().txId),t?.expiration&&(this.expiration=t.expiration);}async addOperation(t,r){this.transaction||await this.createTransaction(this.expiration),this.transaction.operations.push([t,r]);}sign(t){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");if(this.transaction){let{digest:r,txId:n}=this.digest();Array.isArray(t)||(t=[t]);for(let o of t){let i=o.sign(r);this.transaction.signatures.push(i.customToString());}return this.txId=n,this.transaction}else throw new Error("No transaction to sign")}async broadcast(t=false){if(!this.transaction)throw new Error("Attempted to broadcast an empty transaction. Add operations by .addOperation()");if(this.transaction.signatures.length===0)throw new Error("Attempted to broadcast a transaction with no signatures. Sign using .sign(keys)");try{await Le("condenser_api.broadcast_transaction",[this.transaction]);}catch(i){if(!(i instanceof Z&&i.message.includes("Duplicate transaction check failed")))throw i}if(this.txId||(this.txId=this.digest().txId),!t)return {tx_id:this.txId,status:"unknown"};let r=60;await ot(1e3);let n=await this.checkStatus(),o=1;for(;n?.status!=="within_irreversible_block"&&n?.status!=="expired_irreversible"&&n?.status!=="too_old"&&o<r;)await ot(1e3+o*300),n=await this.checkStatus(),o++;return {tx_id:this.txId,status:n?.status??"unknown"}}digest(){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");let t=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN),r={...this.transaction};try{de.Transaction(t,r);}catch(s){throw new Error("Unable to serialize transaction: "+s)}t.flip();let n=new Uint8Array(t.toBuffer()),o=bytesToHex(sha256(n)).slice(0,40);return {digest:sha256(new Uint8Array([...bs,...n])),txId:o}}addSignature(t){if(!this.transaction)throw new Error("First create a transaction by .create(operations)");if(typeof t!="string")throw new Error("Signature must be string");if(t.length!==130)throw new Error("Signature must be 130 characters long");return this.transaction.signatures.push(t),this.transaction}async checkStatus(){return this.txId||(this.txId=this.digest().txId),y("transaction_status_api.find_transaction",{transaction_id:this.txId,expiration:this.transaction?.expiration})}createTransaction=async t=>{let r=await y("condenser_api.get_dynamic_global_properties",[]),n=hexToBytes(r.head_block_id),o=Number(new Uint32Array(n.buffer,n.byteOffset+4,1)[0]),i=new Date(Date.now()+t).toISOString().slice(0,-5);this.transaction={expiration:i,extensions:[],operations:[],ref_block_num:r.head_block_number&65535,ref_block_prefix:o,signatures:[]};}};var Ln=new Uint8Array([128]),U=class e{key;constructor(t){this.key=t;try{secp256k1.getPublicKey(t);}catch{throw new Error("invalid private key")}}static from(t){return typeof t=="string"?e.fromString(t):new e(t)}static fromString(t){return new e(As(t).subarray(1))}static fromSeed(t){if(typeof t=="string")if(/^[0-9a-fA-F]+$/.test(t))t=hexToBytes(t);else {let n=[];for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);if(i<128)n.push(i);else if(i<2048)n.push(192|i>>6,128|i&63);else if(i>=55296&&i<=56319&&o+1<t.length){let s=t.charCodeAt(++o);i=65536+((i&1023)<<10)+(s&1023),n.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63);}else n.push(224|i>>12,128|i>>6&63,128|i&63);}t=new Uint8Array(n);}return new e(sha256(t))}static fromLogin(t,r,n="active"){let o=t+n+r;return e.fromSeed(o)}sign(t){let r=secp256k1.sign(t,this.key,{extraEntropy:true,format:"recovered",prehash:false}),n=parseInt(bytesToHex(r.subarray(0,1)),16);return Ee.from((n+31).toString(16)+bytesToHex(r.subarray(1)))}createPublic(t){return new Y(secp256k1.getPublicKey(this.key),t)}toString(){return Ps(new Uint8Array([...Ln,...this.key]))}inspect(){let t=this.toString();return `PrivateKey: ${t.slice(0,6)}...${t.slice(-6)}`}getSharedSecret(t){let r=secp256k1.getSharedSecret(this.key,t.key);return sha512(r.subarray(1))}static randomKey(){return new e(secp256k1.keygen().secretKey)}},$n=e=>sha256(sha256(e)),Ps=e=>{let t=$n(e);return vn.encode(new Uint8Array([...e,...t.slice(0,4)]))},As=e=>{let t=vn.decode(e);if(!Vn(t.slice(0,1),Ln))throw new Error("Private key network id mismatch");let r=t.slice(-4),n=t.slice(0,-4),o=$n(n).slice(0,4);if(!Vn(r,o))throw new Error("Private key checksum mismatch");return n},Vn=(e,t)=>{if(e===t)return true;if(e.byteLength!==t.byteLength)return false;let r=e.byteLength,n=0;for(;n<r&&e[n]===t[n];)n++;return n===r};var Gn=(e,t,r,n=Cs())=>Jn(e,t,n,r),zn=(e,t,r,n,o)=>Jn(e,t,r,n,o).message,Jn=(e,t,r,n,o)=>{let i=r,s=e.getSharedSecret(t),a=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);a.writeUint64(i),a.append(s),a.flip();let c=sha512(new Uint8Array(a.toBuffer())),p=c.subarray(32,48),l=c.subarray(0,32),d=sha256(c).subarray(0,4),m=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);m.append(d),m.flip();let g=m.readUint32();if(o!==void 0){if(g!==o)throw new Error("Invalid key");n=Ss(n,l,p);}else n=ks(n,l,p);return {nonce:i,message:n,checksum:g}},Ss=(e,t,r)=>{let n=e;return n=cbc(t,r).decrypt(n),n},ks=(e,t,r)=>{let n=e;return n=cbc(t,r).encrypt(n),n},br=null,Cs=()=>{if(br===null){let r=secp256k1.utils.randomSecretKey();br=r[0]<<8|r[1];}let e=BigInt(Date.now()),t=++br%65536;return e=e<<BigInt(16)|BigInt(t),e};var Yn=e=>{let t=Ds(e,33);return new Y(t)},Ts=e=>e.readUint64(),Fs=e=>e.readUint32(),Is=e=>{let t=e.readVarint32(),r=e.copy(e.offset,e.offset+t);return e.skip(t),new Uint8Array(r.toBuffer())},qs=e=>t=>{let r={},n=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);n.append(t),n.flip();for(let[o,i]of e)try{r[o]=i(n);}catch(s){throw s.message=`${o}: ${s.message}`,s}return r};function Ds(e,t){if(e){let r=e.copy(e.offset,e.offset+t);return e.skip(t),new Uint8Array(r.toBuffer())}else throw Error("No buffer found on first parameter")}var Ks=qs([["from",Yn],["to",Yn],["nonce",Ts],["check",Fs],["encrypted",Is]]),Xn={Memo:Ks};var eo=(e,t,r,n)=>{if(!r.startsWith("#"))return r;r=r.substring(1),ro(),e=no(e),t=Bs(t);let o=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);o.writeVString(r);let i=new Uint8Array(o.copy(0,o.offset).toBuffer()),{nonce:s,message:a,checksum:c}=Gn(e,t,i,n),p=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);de.Memo(p,{check:c,encrypted:a,from:e.createPublic(),nonce:s,to:t}),p.flip();let l=new Uint8Array(p.toBuffer());return "#"+vn.encode(l)},to=(e,t)=>{if(!t.startsWith("#"))return t;t=t.substring(1),ro(),e=no(e);let r=Xn.Memo(vn.decode(t)),{from:n,to:o,nonce:i,check:s,encrypted:a}=r,p=e.createPublic().toString()===new Y(n.key).toString()?new Y(o.key):new Y(n.key);r=zn(e,p,i,a,s);let l=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);return l.append(r),l.flip(),"#"+l.readVString()},qt,ro=()=>{if(qt===void 0){let e;qt=true;try{let t="5JdeC9P7Pbd1uGdFVEsJ41EkEnADbbHGq6p1BwFxm6txNBsQnsw",n=eo(t,"STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA","#memo\u7231");e=to(t,n);}finally{qt=e==="#memo\u7231";}}if(qt===false)throw new Error("This environment does not support encryption.")},no=e=>typeof e=="string"?U.fromString(e):e,Bs=e=>typeof e=="string"?Y.fromString(e):e,oo={decode:to,encode:eo};var ne={};vt(ne,{buildWitnessSetProperties:()=>Vs,makeBitMaskFilter:()=>Hs,operations:()=>Qs,validateUsername:()=>Ns});var Ns=e=>{let t="Account name should ";if(!e)return t+"not be empty.";let r=e.length;if(r<3)return t+"be longer.";if(r>16)return t+"be shorter.";/\./.test(e)&&(t="Each account segment should ");let n=e.split("."),o=n.length;for(let i=0;i<o;i++){let s=n[i];if(!/^[a-z]/.test(s))return t+"start with a lowercase letter.";if(!/^[a-z0-9-]*$/.test(s))return t+"have only lowercase letters, digits, or dashes.";if(!/[a-z0-9]$/.test(s))return t+"end with a lowercase letter or digit.";if(s.length<3)return t+"be longer."}return null},Qs={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,pow:14,custom:15,report_over_production:16,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,pow2:30,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,custom_binary:35,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49,fill_convert_request:50,author_reward:51,curation_reward:52,comment_reward:53,liquidity_reward:54,interest:55,fill_vesting_withdraw:56,fill_order:57,shutdown_witness:58,fill_transfer_from_savings:59,hardfork:60,comment_payout_update:61,return_vesting_delegation:62,comment_benefactor_reward:63,producer_reward:64,clear_null_account_balance:65,proposal_pay:66,sps_fund:67,hardfork_hive:68,hardfork_hive_restore:69,delayed_voting:70,consolidate_treasury_balance:71,effective_comment_vote:72,ineffective_delete_comment:73,sps_convert:74,expired_account_notification:75,changed_recovery_account:76,transfer_to_vesting_completed:77,pow_reward:78,vesting_shares_split:79,account_created:80,fill_collateralized_convert_request:81,system_warning:82,fill_recurrent_transfer:83,failed_recurrent_transfer:84,limit_order_cancelled:85,producer_missed:86,proposal_fee:87,collateralized_convert_immediate_conversion:88,escrow_approved:89,escrow_rejected:90,proxy_cleared:91,declined_voting_rights:92},Hs=e=>e.reduce(Us,[BigInt(0),BigInt(0)]).map(t=>t!==BigInt(0)?t.toString():null),Us=([e,t],r)=>r<64?[e|BigInt(1)<<BigInt(r),t]:[e,t|BigInt(1)<<BigInt(r-64)],Vs=(e,t)=>{let r={extensions:[],owner:e,props:[]};for(let n of Object.keys(t)){if(t[n]===void 0)continue;let o;switch(n){case "key":case "new_signing_key":o=de.PublicKey;break;case "account_subsidy_budget":case "account_subsidy_decay":case "maximum_block_size":o=de.UInt32;break;case "hbd_interest_rate":o=de.UInt16;break;case "url":o=de.String;break;case "hbd_exchange_rate":o=de.Price;break;case "account_creation_fee":o=de.Asset;break;default:throw new Error(`Unknown witness prop: ${n}`)}r.props.push([n,js(o,t[n])]);}return r.props.sort((n,o)=>n[0].localeCompare(o[0])),["witness_set_properties",r]},js=(e,t)=>{let r=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);return e(r,t),r.flip(),bytesToHex(new Uint8Array(r.toBuffer()))};function ug(e){let t;if(typeof e=="string"){let r=[];for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o<128)r.push(o);else if(o<2048)r.push(192|o>>6,128|o&63);else if(o>=55296&&o<=56319&&n+1<e.length){let i=e.charCodeAt(++n);o=65536+((o&1023)<<10)+(i&1023),r.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63);}else r.push(224|o>>12,128|o>>6&63,128|o&63);}t=new Uint8Array(r);}else t=e;return sha256(t)}function io(e){try{return U.fromString(e),!0}catch{return false}}async function ee(e,t){let r=new De;for(let n of e)await r.addOperation(n[0],n[1]);return r.sign(t),Le("condenser_api.broadcast_transaction_synchronous",[r.transaction])}async function so(e,t){let r=new De;for(let n of e)await r.addOperation(n[0],n[1]);return r.sign(t),r.broadcast(false)}var $s=432e3;function ao(e,t){let r=Date.now()/1e3-t.last_update_time,n=Number(t.current_mana)+r*e/$s,o=Math.round(n/e*1e4);return !isFinite(o)||o<0?o=0:o>1e4&&(o=1e4),{current_mana:n,max_mana:e,percentage:o}}function Ws(e){let t=parseFloat(e.vesting_shares),r=parseFloat(e.delegated_vesting_shares),n=parseFloat(e.received_vesting_shares),o=parseFloat(e.vesting_withdraw_rate),i=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,s=Math.min(o,i);return t-s-r+n}function wr(e){let t=Ws(e)*1e6;return ao(t,e.voting_manabar)}function Dt(e){return ao(Number(e.max_rc),e.rc_manabar)}var co=(c=>(c.COMMON="common",c.INFO="info",c.INSUFFICIENT_RESOURCE_CREDITS="insufficient_resource_credits",c.MISSING_AUTHORITY="missing_authority",c.TOKEN_EXPIRED="token_expired",c.NETWORK="network",c.TIMEOUT="timeout",c.VALIDATION="validation",c))(co||{});function $e(e){let t=e?.error_description?String(e.error_description):"",r=e?.message?String(e.message):"",n=e?.error?String(e.error):"",o=t||r||String(e||""),i=a=>!!(n&&a.test(n)||t&&a.test(t)||r&&a.test(r)||o&&a.test(o));if(i(/please wait to transact/i)||i(/insufficient rc/i)||i(/rc mana|rc account|resource credits/i))return {message:"Insufficient Resource Credits. Please wait or power up.",type:"insufficient_resource_credits",originalError:e};if(i(/you may only post once every/i))return {message:"Please wait before posting again (minimum 3 second interval between comments).",type:"common",originalError:e};if(i(/your current vote on this comment is identical/i))return {message:"You have already voted with the same weight.",type:"info",originalError:e};if(i(/must claim something/i))return {message:"You must claim rewards before performing this action.",type:"info",originalError:e};if(i(/cannot claim that much vests/i))return {message:"Cannot claim that amount. Please check your pending rewards.",type:"info",originalError:e};if(i(/cannot delete a comment with net positive/i))return {message:"Cannot delete a comment with positive votes.",type:"info",originalError:e};if(i(/children == 0/i))return {message:"Cannot delete a comment with replies.",type:"common",originalError:e};if(i(/comment_cashout/i))return {message:"Cannot modify a comment that has already been paid out.",type:"common",originalError:e};if(i(/votes evaluating for comment that is paid out is forbidden/i))return {message:"Cannot vote on posts that have already been paid out.",type:"common",originalError:e};if(i(/no (active|owner|posting|memo) key available/i))return {message:"Key not available. Please provide your key to sign this operation.",type:"missing_authority",originalError:e};if(i(/missing (required )?active authority/i))return {message:"Missing active authority. This operation requires your active key.",type:"missing_authority",originalError:e};if(i(/missing (required )?owner authority/i))return {message:"Missing owner authority. This operation requires your owner key.",type:"missing_authority",originalError:e};if(i(/missing (required )?posting authority/i))return {message:"Missing posting authority. Please check your login method.",type:"missing_authority",originalError:e};if(n==="invalid_grant"||n==="unauthorized_access"||i(/token expired/i)||i(/invalid token/i)||i(/\bunauthorized\b/i)||i(/\bforbidden\b/i))return {message:"Authentication token expired. Please log in again.",type:"token_expired",originalError:e};if(i(/has already reblogged/i)||i(/already reblogged this post/i))return {message:"You have already reblogged this post.",type:"info",originalError:e};if(i(/duplicate transaction/i))return {message:"This transaction has already been processed.",type:"info",originalError:e};if(i(/econnrefused/i)||i(/connection refused/i)||i(/failed to fetch/i)||i(/\bnetwork[-\s]?(request|error|timeout|unreachable|down|failed)\b/i))return {message:"Network error. Please check your connection and try again.",type:"network",originalError:e};if(i(/timeout/i)||i(/timed out/i))return {message:"Request timed out. Please try again.",type:"timeout",originalError:e};if(i(/account.*does not exist/i)||i(/account not found/i))return {message:"Account not found. Please check the username.",type:"validation",originalError:e};if(i(/invalid memo key/i))return {message:"Invalid memo key. Cannot encrypt message.",type:"validation",originalError:e};if(i(/(?:insufficient.*(?:funds|balance)|(?:funds|balance).*insufficient)/i))return {message:"Insufficient funds for this transaction.",type:"validation",originalError:e};if(i(/\b(invalid|validation)\b/i))return {message:(e?.message||o).substring(0,150)||"Validation error occurred",type:"validation",originalError:e};if(e?.error_description&&typeof e.error_description=="string")return {message:e.error_description.substring(0,150),type:"common",originalError:e};if(e?.message&&typeof e.message=="string")return {message:e.message.substring(0,150),type:"common",originalError:e};let s;return typeof e=="object"&&e!==null?e.error_description?s=String(e.error_description):e.code?s=`Error code: ${e.code}`:o&&o!=="[object Object]"?s=o.substring(0,150):s="Unknown error occurred":s=o.substring(0,150)||"Unknown error occurred",{message:s,type:"common",originalError:e}}function Gs(e){let t=$e(e);return [t.message,t.type]}function we(e){let{type:t}=$e(e);return t==="missing_authority"||t==="token_expired"}function zs(e){let{type:t}=$e(e);return t==="insufficient_resource_credits"}function Js(e){let{type:t}=$e(e);return t==="info"}function Ys(e){let{type:t}=$e(e);return t==="network"||t==="timeout"}async function ve(e,t,r,n,o="posting",i,s,a="async"){let c=n?.adapter;switch(e){case "key":{if(!c)throw new Error("No adapter provided for key-based auth");let p=i;if(p===void 0)switch(o){case "owner":if(c.getOwnerKey)p=await c.getOwnerKey(t);else throw new Error("Owner key not supported by adapter. Owner operations (like account recovery) require master password login or manual key entry.");break;case "active":c.getActiveKey&&(p=await c.getActiveKey(t));break;case "memo":if(c.getMemoKey)p=await c.getMemoKey(t);else throw new Error("Memo key not supported by adapter. Use memo encryption methods instead.");break;default:p=await c.getPostingKey(t);break}if(!p)throw new Error(`No ${o} key available for ${t}`);let l=U.fromString(p);return a==="async"?await so(r,l):await ee(r,l)}case "hiveauth":{if(!c?.broadcastWithHiveAuth)throw new Error("HiveAuth not supported by adapter");return await c.broadcastWithHiveAuth(t,r,o)}case "hivesigner":{if(!c)throw new Error("No adapter provided for HiveSigner auth");if(o!=="posting"){if(c.broadcastWithHiveSigner)return await c.broadcastWithHiveSigner(t,r,o);throw new Error(`HiveSigner access token cannot sign ${o} operations. No platform broadcast available.`)}let p=s!==void 0?s:await c.getAccessToken(t);if(p)try{return (await new uo.Client({accessToken:p}).broadcast(r)).result}catch(l){if(c.broadcastWithHiveSigner&&we(l))return await c.broadcastWithHiveSigner(t,r,o);throw l}if(c.broadcastWithHiveSigner)return await c.broadcastWithHiveSigner(t,r,o);throw new Error(`No access token available for ${t}`)}case "keychain":{if(!c?.broadcastWithKeychain)throw new Error("Keychain not supported by adapter");return await c.broadcastWithKeychain(t,r,o)}case "custom":{if(!n?.broadcast)throw new Error("No custom broadcast function provided");return await n.broadcast(r,o)}default:throw new Error(`Unknown auth method: ${e}`)}}async function Zs(e,t,r,n="posting",o="async"){let i=r?.adapter;if(i?.getLoginType){let l=await i.getLoginType(e,n);if(l){let d=i.hasPostingAuthorization?await i.hasPostingAuthorization(e):false;if(n==="posting"&&d&&l==="key")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!we(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to key:",m);}if(n==="posting"&&d&&l==="keychain")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!we(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to keychain/snap:",m);}if(n==="posting"&&d&&l==="hiveauth")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!we(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to HiveAuth:",m);}try{return await ve(l,e,t,r,n,void 0,void 0,o)}catch(m){if(we(m)&&i.showAuthUpgradeUI&&(n==="posting"||n==="active")){let g=t.length>0?t[0][0]:"unknown",h=await i.showAuthUpgradeUI(n,g);if(!h)throw new Error(`Operation requires ${n} authority. User declined alternate auth.`);return await ve(h,e,t,r,n,void 0,void 0,o)}throw m}}if(n==="posting")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(d){if(we(d)&&i.showAuthUpgradeUI){let m=t.length>0?t[0][0]:"unknown",g=await i.showAuthUpgradeUI(n,m);if(!g)throw new Error(`No login type available for ${e}. Please log in again.`);return await ve(g,e,t,r,n,void 0,void 0,o)}throw d}else if(n==="active"&&i.showAuthUpgradeUI){let d=t.length>0?t[0][0]:"unknown",m=await i.showAuthUpgradeUI(n,d);if(!m)throw new Error(`Operation requires ${n} authority. User declined alternate auth.`);return await ve(m,e,t,r,n,void 0,void 0,o)}}let s=r?.fallbackChain??["key","hiveauth","hivesigner","keychain","custom"],a=new Map;for(let l of s)try{let d=!1,m="",g,h;switch(l){case "key":if(!i)d=!0,m="No adapter provided";else {let P;switch(n){case "owner":i.getOwnerKey&&(P=await i.getOwnerKey(e));break;case "active":i.getActiveKey&&(P=await i.getActiveKey(e));break;case "memo":i.getMemoKey&&(P=await i.getMemoKey(e));break;default:P=await i.getPostingKey(e);break}P?g=P:(d=!0,m=`No ${n} key available`);}break;case "hiveauth":i?.broadcastWithHiveAuth||(d=!0,m="HiveAuth not supported by adapter");break;case "hivesigner":if(!i)d=!0,m="No adapter provided";else {let P=await i.getAccessToken(e);P&&(h=P);}break;case "keychain":i?.broadcastWithKeychain||(d=!0,m="Keychain not supported by adapter");break;case "custom":r?.broadcast||(d=!0,m="No custom broadcast function provided");break}if(d){a.set(l,new Error(`Skipped: ${m}`));continue}return await ve(l,e,t,r,n,g,h,o)}catch(d){if(a.set(l,d),!we(d))throw d}if(!Array.from(a.values()).some(l=>!l.message.startsWith("Skipped:"))){let l=Array.from(a.entries()).map(([d,m])=>`${d}: ${m.message}`).join(", ");throw new Error(`[SDK][Broadcast] No auth methods attempted for ${e}. ${l}`)}let p=Array.from(a.entries()).map(([l,d])=>`${l}: ${d.message}`).join(", ");throw new Error(`[SDK][Broadcast] All auth methods failed for ${e}. Errors: ${p}`)}function v(e=[],t,r,n=()=>{},o,i="posting",s){let a=s?.broadcastMode??"async";return useMutation({onSuccess:n,onMutate:s?.onMutate,onError:s?.onError,onSettled:s?.onSettled,mutationKey:[...e,t],mutationFn:async c=>{if(!t)throw new Error("[Core][Broadcast] Attempted to call broadcast API with anon user");let p=r(c);try{if(o?.enableFallback!==!1&&o?.adapter)return await Zs(t,p,o,i,a);if(o?.broadcast)return await o.broadcast(p,i);let l=o?.postingKey;if(l){if(i!=="posting")throw new Error(`[SDK][Broadcast] Legacy auth only supports posting authority, but '${i}' was requested. Use AuthContextV2 with an adapter for ${i} operations.`);let m=U.fromString(l);return await ee(p,m)}let d=o?.accessToken;if(d)return (await new uo.Client({accessToken:d}).broadcast(p)).result;throw new Error("[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token")}catch(l){throw l instanceof Z?new Error(l.message):l}}})}async function po(e,t,r,n){if(!e)throw new Error("[Core][Broadcast] Attempted to call broadcast API with anon user");let o={id:t,required_auths:[],required_posting_auths:[e],json:JSON.stringify(r)};if(n?.broadcast)return n.broadcast([["custom_json",o]],"posting");let i=n?.postingKey;if(i){let c=U.fromString(i);return ee([["custom_json",o]],c)}let s=n?.accessToken;if(s)return (await new uo.Client({accessToken:s}).customJson([],[e],t,JSON.stringify(r))).result;let a=n?.adapter;if(a){let c=[["custom_json",o]];if(n?.loginType==="keychain"&&a.broadcastWithKeychain)return a.broadcastWithKeychain(e,c,"posting");if(n?.loginType==="hiveauth"&&a.broadcastWithHiveAuth)return a.broadcastWithHiveAuth(e,c,"posting")}throw new Error("[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token")}var xg=4e3;function E(e,t,r){if(e?.invalidateQueries){if(t==="sync")return e.invalidateQueries(r);setTimeout(()=>e.invalidateQueries?.(r),4e3);}}function Pe(e,t){let r=AbortSignal.timeout(e);if(!t)return r;if(typeof AbortSignal.any=="function")return AbortSignal.any([t,r]);let n=new AbortController,o=()=>{let i=t.aborted?t.reason:r.reason;n.abort(i),t.removeEventListener("abort",o),r.removeEventListener("abort",o);};return t.aborted?n.abort(t.reason):r.aborted?n.abort(r.reason):(t.addEventListener("abort",o,{once:true}),r.addEventListener("abort",o,{once:true})),n.signal}var Ke=(()=>{try{return process.env?.NODE_ENV==="development"}catch{return false}})(),ra=()=>{try{return process.env?.VITE_HELIUS_API_KEY}catch{return}},Ae=1e4,lo=120*1e3,Kt,na;function oa(){return Kt?Kt():na??=new QueryClient}var f={privateApiHost:"https://ecency.com",defaultObserver:"ecency",clientId:"ecency-sdk",imageHost:"https://i.ecency.com",get hiveNodes(){return x.nodes},heliusApiKey:ra(),get queryClient(){return oa()},set queryClient(e){Kt=()=>e;},pollsApiHost:"https://poll.ecency.com",plausibleHost:"https://pl.ecency.com",dmcaAccounts:[],dmcaTags:[],dmcaPatterns:[],dmcaTagRegexes:[],dmcaPatternRegexes:[],_dmcaInitialized:false},Q;(ue=>{function e(A){f.queryClient=A;}ue.setQueryClient=e;function t(A){Kt=A;}ue.setQueryClientResolver=t;function r(A){f.privateApiHost=A;}ue.setPrivateApiHost=r;function n(A){f.clientId=A;}ue.setClientId=n;function o(A){if(typeof A!="string"||A.trim()==="")throw new Error("setDefaultObserver requires a non-empty Hive account. There is no empty-string opt-out; observer resolution would fall back to the post author while caching under an empty key.");f.defaultObserver=A;}ue.setDefaultObserver=o;function i(){return f.privateApiHost?f.privateApiHost:typeof window<"u"&&window.location?.origin?window.location.origin:"https://ecency.com"}ue.getValidatedBaseUrl=i;function s(A){f.pollsApiHost=A;}ue.setPollsApiHost=s;function a(A){f.imageHost=A;}ue.setImageHost=a;function c(A){or(A);}ue.setHiveNodes=c;function p(A){ir(A);}ue.setRestNodes=p;function l(A){sr(A);}ue.setRestNodesByApi=l;function d(A){ar(A);}ue.setUserAgent=d;function m(A){cr(A);}ue.setResilience=m;function g(A){rr(A);}ue.setServerRpcProxy=g;function h(){return Ce}ue.getServerRpcProxyStats=h;function P(A){if(/(\([^)]*[*+{][^)]*\))[*+{]/.test(A))return {safe:false,reason:"nested quantifiers detected"};if(/\([^|)]*\|[^)]*\)[*+{]/.test(A))return {safe:false,reason:"alternation with quantifier (potential overlap)"};if(/\([^)]*[*+][^)]*\)[*+]/.test(A))return {safe:false,reason:"repeated quantifiers (catastrophic backtracking risk)"};if(/\.\*\.\*/.test(A)||/\.\+\.\+/.test(A))return {safe:false,reason:"multiple greedy quantifiers on wildcards"};let $=/\.?\{(\d+),(\d+)\}/g,N;for(;(N=$.exec(A))!==null;){let[,H,z]=N;if(parseInt(z,10)-parseInt(H,10)>1e3)return {safe:false,reason:`excessive range: {${H},${z}}`}}return {safe:true}}function O(A){let $=["a".repeat(50)+"x","ab".repeat(50)+"x","x".repeat(100),"aaa".repeat(30)+"bbb".repeat(30)+"x"],N=5;for(let H of $){let z=Date.now();try{A.test(H);let L=Date.now()-z;if(L>N)return {safe:!1,reason:`runtime test exceeded ${N}ms (took ${L}ms on input length ${H.length})`}}catch(L){return {safe:false,reason:`runtime test threw error: ${L}`}}}return {safe:true}}function T(A,$=200){try{if(!A)return Ke&&console.warn("[SDK] DMCA pattern rejected: empty pattern"),null;if(A.length>$)return Ke&&console.warn(`[SDK] DMCA pattern rejected: length ${A.length} exceeds max ${$} - pattern: ${A.substring(0,50)}...`),null;let N=P(A);if(!N.safe)return Ke&&console.warn(`[SDK] DMCA pattern rejected: static analysis failed (${N.reason}) - pattern: ${A.substring(0,50)}...`),null;let H;try{H=new RegExp(A);}catch(L){return Ke&&console.warn(`[SDK] DMCA pattern rejected: compilation failed - pattern: ${A.substring(0,50)}...`,L),null}let z=O(H);return z.safe?H:(Ke&&console.warn(`[SDK] DMCA pattern rejected: runtime test failed (${z.reason}) - pattern: ${A.substring(0,50)}...`),null)}catch(N){return Ke&&console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${A.substring(0,50)}...`,N),null}}function F(A={}){let $=L=>Array.isArray(L)?L.filter(rt=>typeof rt=="string"):[],N=A||{},H={accounts:$(N.accounts),tags:$(N.tags),patterns:$(N.posts)};f.dmcaAccounts=H.accounts,f.dmcaTags=H.tags,f.dmcaPatterns=H.patterns,f.dmcaTagRegexes=H.tags.map(L=>T(L)).filter(L=>L!==null),f.dmcaPatternRegexes=[];let z=H.tags.length-f.dmcaTagRegexes.length;!f._dmcaInitialized&&Ke&&(console.log("[SDK] DMCA configuration loaded:"),console.log(` - Accounts: ${H.accounts.length}`),console.log(` - Tag patterns: ${f.dmcaTagRegexes.length}/${H.tags.length} compiled (${z} rejected)`),console.log(` - Post patterns: ${H.patterns.length} (using exact string matching)`),z>0&&console.warn(`[SDK] ${z} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`)),f._dmcaInitialized=true;}ue.setDmcaLists=F;})(Q||={});function Bg(){return new QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:false,refetchOnMount:false}}})}var w=()=>f.queryClient,ca;(s=>{function e(a){return w().getQueryData(a)}s.getQueryData=e;function t(a){return w().getQueryData(a)}s.getInfiniteQueryData=t;async function r(a){return await w().prefetchQuery(a),e(a.queryKey)}s.prefetchQuery=r;async function n(a){return await w().prefetchInfiniteQuery(a),t(a.queryKey)}s.prefetchInfiniteQuery=n;function o(a){return {prefetch:()=>r(a),getData:()=>e(a.queryKey),useClientQuery:()=>useQuery(a),fetchAndGet:()=>w().fetchQuery(a)}}s.generateClientServerQuery=o;function i(a){return {prefetch:()=>n(a),getData:()=>t(a.queryKey),useClientQuery:()=>useInfiniteQuery(a),fetchAndGet:()=>w().fetchInfiniteQuery(a)}}s.generateClientServerInfiniteQuery=i;})(ca||={});function Ng(e){return btoa(JSON.stringify(e))}function Qg(e){let t=atob(e);if(t[0]==="{")return JSON.parse(t)}var fo=(n=>(n.HIVE="HIVE",n.HBD="HBD",n.VESTS="VESTS",n))(fo||{}),Bt=(e=>(e["@@000000021"]="HIVE",e["@@000000013"]="HBD",e["@@000000037"]="VESTS",e))(Bt||{});function k(e){if(typeof e=="string"){let t=e.split(" ");return {amount:parseFloat(t[0]),symbol:fo[t[1]]}}else return {amount:parseFloat(e.amount.toString())/Math.pow(10,e.precision),symbol:Bt[e.nai]}}var vr;function _(){if(!vr){if(typeof globalThis.fetch!="function")throw new Error("[Ecency][SDK] - global fetch is not available");vr=globalThis.fetch.bind(globalThis);}return vr}function mo(e){return typeof e=="string"?/^hive-\d+$/.test(e):false}function ua(e){return e&&typeof e=="object"&&"data"in e&&"pagination"in e&&Array.isArray(e.data)}function se(e,t){return ua(e)?e:{data:Array.isArray(e)?e:[],pagination:{total:Array.isArray(e)?e.length:0,limit:t,offset:0,has_next:false}}}function We(e,t){return e/1e6*t}function go(e){return e===void 0?true:parseInt(e.split("-")[0],10)<1980}var yo=60*1e3;function Oe(){return queryOptions({queryKey:u.core.dynamicProps(),refetchInterval:yo,staleTime:yo,queryFn:async({signal:e})=>{let[t,r,n,o,i]=await Promise.all([y("condenser_api.get_dynamic_global_properties",[],void 0,void 0,e),y("condenser_api.get_feed_history",[],void 0,void 0,e),y("condenser_api.get_chain_properties",[],void 0,void 0,e),y("condenser_api.get_reward_fund",["post"],void 0,void 0,e),y("database_api.get_hardfork_properties",{},void 0,void 0,e).catch(()=>({current_hardfork_version:"1.28.0",last_hardfork:28}))]),s=k(t.total_vesting_shares).amount,a=k(t.total_vesting_fund_hive).amount,c=0;Number.isFinite(s)&&s!==0&&Number.isFinite(a)&&(c=a/s*1e6);let p=k(r.current_median_history.base).amount,l=k(r.current_median_history.quote).amount,d=parseFloat(o.recent_claims),m=k(o.reward_balance).amount,g=Number(t.vote_power_reserve_rate??0),h=o.author_reward_curve??"linear",P=Number(o.content_constant??0),O=String(i.current_hardfork_version??"0.0.0"),T=Number(i.last_hardfork??0),F=t.hbd_print_rate,ue=t.hbd_interest_rate,A=t.head_block_number,$=a,N=s,H=k(t.virtual_supply).amount,z=t.vesting_reward_percent||0,L=n.account_creation_fee;return {hivePerMVests:c,base:p,quote:l,fundRecentClaims:d,fundRewardBalance:m,votePowerReserveRate:g,authorRewardCurve:h,contentConstant:P,currentHardforkVersion:O,lastHardfork:T,hbdPrintRate:F,hbdInterestRate:ue,headBlock:A,totalVestingFund:$,totalVestingShares:N,virtualSupply:H,vestingRewardPercent:z,accountCreationFee:L,raw:{globalDynamic:t,feedHistory:r,chainProps:n,rewardFund:o,hardforkProps:i}}}})}function ry(e="post"){return queryOptions({queryKey:u.core.rewardFund(e),queryFn:()=>y("condenser_api.get_reward_fund",[e])})}function Be(...e){let t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return e.slice(0,t)}var u={posts:{entry:e=>["posts","entry",e],postHeader:(e,t)=>["posts","post-header",e,t],content:(e,t)=>["posts","content",e,t],contentReplies:(e,t)=>["posts","content-replies",e,t],accountPosts:(e,t,r,n)=>["posts","account-posts",e,t,r,n],accountPostsPage:(e,t,r,n,o,i)=>["posts","account-posts-page",e,t,r,n,o,i],userPostVote:(e,t,r)=>["posts","user-vote",e,t,r],reblogs:(e,t)=>["posts","reblogs",e,t],entryActiveVotes:(e,t)=>["posts","entry-active-votes",e,t],rebloggedBy:(e,t)=>["posts","reblogged-by",e,t],tips:(e,t)=>["posts","tips",e,t],normalize:(e,t)=>["posts","normalize",e,t],drafts:e=>["posts","drafts",e],draftsInfinite:(e,t)=>Be("posts","drafts","infinite",e,t),schedules:e=>["posts","schedules",e],schedulesInfinite:(e,t)=>Be("posts","schedules","infinite",e,t),fragments:e=>["posts","fragments",e],fragmentsInfinite:(e,t)=>Be("posts","fragments","infinite",e,t),images:e=>["posts","images",e],galleryImages:e=>["posts","gallery-images",e],imagesInfinite:(e,t)=>Be("posts","images","infinite",e,t),promoted:e=>["posts","promoted",e],_promotedPrefix:["posts","promoted"],accountPostsBlogPrefix:e=>["posts","account-posts",e,"blog"],postsRanked:(e,t,r,n)=>["posts","posts-ranked",e,t,r,n],postsRankedPage:(e,t,r,n,o,i)=>["posts","posts-ranked-page",e,t,r,n,o,i],discussions:(e,t,r,n)=>["posts","discussions",e,t,r,n],discussion:(e,t,r)=>["posts","discussion",e,t,r],deletedEntry:e=>["posts","deleted-entry",e],commentHistory:(e,t,r)=>["posts","comment-history",e,t,r],trendingTags:()=>["posts","trending-tags"],trendingTagsWithStats:e=>["posts","trending-tags","stats",e],wavesFeed:(e={})=>["posts","waves","feed",e.tag??"",e.following??"",e.author??"",e.observer??"",e.limit??0,[...e.containers??[]].sort().join(",")],shortsFeed:(e={})=>["posts","waves","shorts",e.tag??"",e.author??"",e.observer??"",e.limit??0,[...e.containers??[]].sort().join(",")],wavesByHost:e=>["posts","waves","by-host",e],wavesByTag:(e,t)=>["posts","waves","by-tag",e,t],wavesFollowing:(e,t)=>["posts","waves","following",e,t],wavesTrendingTags:(e,t)=>["posts","waves","trending-tags",e,t],wavesByAccount:(e,t)=>["posts","waves","by-account",e,t],wavesTrendingAuthors:e=>["posts","waves","trending-authors",e],_prefix:["posts"]},accounts:{full:e=>["get-account-full",e],list:(...e)=>["accounts","list",...e],friends:(e,t,r,n)=>["accounts","friends",e,t,r,n],searchFriends:(e,t,r)=>["accounts","friends","search",e,t,r],subscriptions:e=>["accounts","subscriptions",e],followCount:e=>["accounts","follow-count",e],recoveries:e=>["accounts","recoveries",e],pendingRecovery:e=>["accounts","recoveries",e,"pending-request"],checkWalletPending:(e,t)=>["accounts","check-wallet-pending",e,t],mutedUsers:e=>["accounts","muted-users",e],following:(e,t,r,n)=>["accounts","following",e,t,r,n],followers:(e,t,r,n)=>["accounts","followers",e,t,r,n],search:(e,t)=>["accounts","search",e,t],profiles:(e,t)=>["accounts","profiles",e,t],lookup:(e,t)=>["accounts","lookup",e,t],transactions:(e,t,r)=>["accounts","transactions",e,t,r],favorites:e=>["accounts","favorites",e],favoritesInfinite:(e,t)=>Be("accounts","favorites","infinite",e,t),checkFavorite:(e,t)=>["accounts","favorites","check",e,t],relations:(e,t)=>["accounts","relations",e,t],bots:()=>["accounts","bots"],voteHistory:(e,t)=>["accounts","vote-history",e,t],reputations:(e,t)=>["accounts","reputations",e,t],bookmarks:e=>["accounts","bookmarks",e],bookmarksInfinite:(e,t)=>Be("accounts","bookmarks","infinite",e,t),referrals:e=>["accounts","referrals",e],referralsStats:e=>["accounts","referrals-stats",e],proMembers:()=>["accounts","pro-members"],_prefix:["accounts"]},notifications:{announcements:()=>["notifications","announcements"],spotlights:()=>["notifications","spotlights"],list:(e,t)=>["notifications",e,t],unreadCount:e=>["notifications","unread",e],settings:e=>["notifications","settings",e],_prefix:["notifications"]},core:{rewardFund:e=>["core","reward-fund",e],dynamicProps:()=>["core","dynamic-props"],chainProperties:()=>["core","chain-properties"],_prefix:["core"]},communities:{single:(e,t)=>["community","single",e,t],singlePrefix:e=>["community","single",e],context:(e,t)=>["community","context",e,t],rewarded:()=>["communities","rewarded"],list:(e,t,r)=>["communities","list",e,t,r],subscribers:e=>["communities","subscribers",e],subscribersInfinite:e=>["communities","subscribers","infinite",e],accountNotifications:(e,t)=>["communities","account-notifications",e,t]},proposals:{list:()=>["proposals","list"],proposal:e=>["proposals","proposal",e],votes:(e,t,r)=>["proposals","votes",e,t,r],votesPrefix:e=>["proposals","votes",e],votesByUser:e=>["proposals","votes","by-user",e]},search:{topics:(e,t)=>["search","topics",e,t],path:e=>["search","path",e],account:(e,t)=>["search","account",e,t],results:(e,t,r,n,o,i)=>["search",e,t,typeof r=="string"?r==="1"||r==="true":r,n,o,i],controversialRising:(e,t)=>["search","controversial-rising",e,t],similarEntries:(e,t,r)=>r?["search","similar-entries",e,t,r]:["search","similar-entries",e,t],api:(e,t,r,n,o,i)=>Be("search","api",e,t,r,n,o,i)},witnesses:{list:e=>["witnesses","list",e],votes:e=>["witnesses","votes",e],proxy:()=>["witnesses","proxy"],voters:(e,t,r,n,o)=>["witnesses","voters",e,t,r,n,o],voterCount:e=>["witnesses","voter-count",e]},wallet:{outgoingRcDelegations:(e,t)=>["wallet","outgoing-rc-delegations",e,t],vestingDelegations:(e,t)=>["wallet","vesting-delegations",e,t],withdrawRoutes:e=>["wallet","withdraw-routes",e],incomingRc:e=>["wallet","incoming-rc",e],conversionRequests:e=>["wallet","conversion-requests",e],receivedVestingShares:e=>["wallet","received-vesting-shares",e],savingsWithdraw:e=>["wallet","savings-withdraw",e],openOrders:e=>["wallet","open-orders",e],collateralizedConversionRequests:e=>["wallet","collateralized-conversion-requests",e],recurrentTransfers:e=>["wallet","recurrent-transfers",e],balanceHistory:(e,t,r)=>["wallet","balance-history",e,t,r],aggregatedHistory:(e,t,r)=>r===void 0?["wallet","aggregated-history",e,t]:["wallet","aggregated-history",e,t,r],portfolio:(e,t,r)=>["wallet","portfolio","v2",e,t,r]},assets:{hiveGeneralInfo:e=>["assets","hive","general-info",e],hiveTransactions:(e,t,r)=>["assets","hive","transactions",e,t,r],hiveWithdrawalRoutes:e=>["assets","hive","withdrawal-routes",e],hiveMetrics:e=>["assets","hive","metrics",e],hbdGeneralInfo:e=>["assets","hbd","general-info",e],hbdTransactions:(e,t,r)=>["assets","hbd","transactions",e,t,r],hivePowerGeneralInfo:e=>["assets","hive-power","general-info",e],hivePowerDelegates:e=>["assets","hive-power","delegates",e],hivePowerDelegatings:e=>["assets","hive-power","delegatings",e],hivePowerTransactions:(e,t,r)=>["assets","hive-power","transactions",e,t,r],pointsGeneralInfo:e=>["assets","points","general-info",e],pointsTransactions:(e,t)=>["assets","points","transactions",e,t],ecencyAssetInfo:(e,t,r)=>["ecency-wallets","asset-info",e,t,r]},market:{statistics:()=>["market","statistics"],orderBook:e=>["market","order-book",e],history:(e,t,r)=>["market","history",e,t,r],feedHistory:()=>["market","feed-history"],hiveHbdStats:()=>["market","hive-hbd-stats"],data:(e,t,r,n)=>["market","data",e,t,r,n],tradeHistory:(e,t,r)=>["market","trade-history",e,t,r],currentMedianHistoryPrice:()=>["market","current-median-history-price"]},analytics:{discoverCuration:e=>["analytics","discover-curation",e],pageStats:(e,t,r,n)=>["analytics","page-stats",e,t,r,n],discoverLeaderboard:e=>["analytics","discover-leaderboard",e]},promotions:{promotePrice:()=>["promotions","promote-price"],boostPlusPrices:()=>["promotions","boost-plus-prices"],boostPlusAccounts:e=>["promotions","boost-plus-accounts",e]},resourceCredits:{account:e=>["resource-credits","account",e],stats:()=>["resource-credits","stats"],resourceParams:()=>["resource-credits","resource-params"]},points:{points:(e,t)=>["points",e,t],_prefix:e=>["points",e]},polls:{details:(e,t)=>["polls","details",e,t],vote:(e,t)=>e&&t?["polls","vote",e,t]:["polls","vote"],_prefix:["polls"]},operations:{chainProperties:()=>["operations","chain-properties"]},games:{statusCheck:(e,t)=>["games","status-check",e,t]},quests:{status:e=>["quests","status",e]},support:{settings:e=>["support","settings",e],_prefix:["support"]},badActors:{list:()=>["bad-actors","list"],_prefix:["bad-actors"]},ai:{prices:()=>["ai","prices"],assistPrices:e=>["ai","assist-prices",e],transcribePrice:e=>["ai","transcribe-price",e],_prefix:["ai"]}};function ut(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t+=1:n<2048?t+=2:n>=55296&&n<=56319&&r+1<e.length?(r++,t+=4):t+=3;}return t}function ye(e){let t=0,r=e;do t++,r>>>=7;while(r>0);return t}function cy(e){return queryOptions({queryKey:u.ai.prices(),queryFn:async()=>{let r=await _()(f.privateApiHost+"/private-api/ai-generate-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok)throw new Error(`Failed to fetch AI generation prices: ${r.status}`);return await r.json()},staleTime:3e5,enabled:!!e})}function dy(e,t){return queryOptions({queryKey:u.ai.assistPrices(e),queryFn:async()=>{let n=await _()(f.privateApiHost+"/private-api/ai-assist-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch AI assist prices: ${n.status}`);return await n.json()},staleTime:6e4,enabled:!!t})}function yy(e,t){return queryOptions({queryKey:u.ai.transcribePrice(e),queryFn:async()=>{let n=await _()(f.privateApiHost+"/private-api/ai-transcribe-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch AI transcribe price: ${n.status}`);return await n.json()},staleTime:6e4,enabled:!!t})}function ya(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function wy(e,t){return useMutation({mutationKey:["ai","generate-image"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][GenerateImage] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][AI][GenerateImage] \u2013 access token wasn't found");let o=await _()(f.privateApiHost+"/private-api/ai-generate-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,us:e,prompt:r.prompt,aspect_ratio:r.aspect_ratio??"1:1",power:r.power??1,idempotency_key:r.idempotency_key??ya()})});if(!o.ok){let s=await o.text(),a={};try{a=JSON.parse(s);}catch{}let c=new Error(`[SDK][AI][GenerateImage] \u2013 failed with status ${o.status}${s?`: ${s}`:""}`);throw c.status=o.status,c.data=a,c}if(o.status===202){let s={};try{s=await o.json();}catch{}let a=new Error("[SDK][AI][GenerateImage] \u2013 delivery pending");throw a.status=202,a.data=s,a}return await o.json()},onSuccess:()=>{e&&w().invalidateQueries({queryKey:u.points._prefix(e)});}})}function _a(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Oy(e,t){return useMutation({mutationKey:["ai","assist"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][Assist] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][AI][Assist] \u2013 access token wasn't found");let o=await _()(f.privateApiHost+"/private-api/ai-assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r.code??t,us:e,action:r.action,text:r.text,idempotency_key:_a()})});if(!o.ok){let i=await o.text(),s={};try{s=JSON.parse(i);}catch{}let a=new Error(`[SDK][AI][Assist] \u2013 failed with status ${o.status}${i?`: ${i}`:""}`);throw a.status=o.status,a.data=s,a}return await o.json()},onSuccess:r=>{e&&(r.cost>0&&w().invalidateQueries({queryKey:u.points._prefix(e)}),w().invalidateQueries({queryKey:u.ai.assistPrices(e)}));}})}function wa(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function ky(e,t){return useMutation({mutationKey:["ai","transcribe"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][Transcribe] \u2013 username wasn't provided");let n=r.code??t;if(!n)throw new Error("[SDK][AI][Transcribe] \u2013 access token wasn't found");let o=new FormData;o.append("code",n),o.append("duration_ms",String(Math.round(r.durationMs))),o.append("idempotency_key",r.idempotency_key??wa()),o.append("audio",r.audio,r.fileName??"clip.webm");let s=await _()(f.privateApiHost+"/private-api/ai-transcribe",{method:"POST",body:o});if(!s.ok){let a=await s.text(),c={};try{c=JSON.parse(a);}catch{}throw Object.assign(new Error(`[SDK][AI][Transcribe] \u2013 failed with status ${s.status}${a?`: ${a}`:""}`),{status:s.status,data:c})}return await s.json()},onSuccess:r=>{e&&(r.cost>0&&w().invalidateQueries({queryKey:u.points._prefix(e)}),w().invalidateQueries({queryKey:u.ai.transcribePrice(e)}));}})}function Pr(e){return !e.posting_json_metadata&&!e.json_metadata}function Pa(e){return e?Object.values(e).some(t=>typeof t=="string"?t.length>0:t!=null):false}function M(e){return queryOptions({queryKey:u.accounts.full(e),queryFn:async({signal:t})=>{if(!e)return null;let[r,n]=await Promise.all([y("condenser_api.get_accounts",[[e]],void 0,void 0,t,p=>Array.isArray(p)),y("bridge.get_profile",{account:e},void 0,void 0,t).catch(p=>{if(t?.aborted)throw p;return null})]);if(!r?.[0])return null;let o=r[0];if(Pr(o)&&Pa(n?.metadata?.profile)){let p=await y("condenser_api.get_accounts",[[e]],void 0,void 0,t,l=>Array.isArray(l)&&(!l[0]||!Pr(l[0])));if(p[0]&&!Pr(p[0]))o=p[0];else throw new Error(`[SDK][Accounts] \u2013 inconsistent account row for ${e}: empty json metadata while hivemind profile is populated`)}let i=Me(o.posting_json_metadata),s=n?.stats,a=s?{account:o.name,follower_count:s.followers??0,following_count:s.following??0}:void 0,c=n?.reputation??0;return {name:o.name,owner:o.owner,active:o.active,posting:o.posting,memo_key:o.memo_key,post_count:o.post_count,created:o.created,posting_json_metadata:o.posting_json_metadata,last_vote_time:o.last_vote_time,last_post:o.last_post,json_metadata:o.json_metadata,reward_hive_balance:o.reward_hive_balance,reward_hbd_balance:o.reward_hbd_balance,reward_vesting_hive:o.reward_vesting_hive,reward_vesting_balance:o.reward_vesting_balance,balance:o.balance,hbd_balance:o.hbd_balance,savings_balance:o.savings_balance,savings_hbd_balance:o.savings_hbd_balance,savings_hbd_last_interest_payment:o.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:o.savings_hbd_seconds_last_update,savings_hbd_seconds:o.savings_hbd_seconds,next_vesting_withdrawal:o.next_vesting_withdrawal,pending_claimed_accounts:o.pending_claimed_accounts,vesting_shares:o.vesting_shares,delegated_vesting_shares:o.delegated_vesting_shares,received_vesting_shares:o.received_vesting_shares,vesting_withdraw_rate:o.vesting_withdraw_rate,to_withdraw:o.to_withdraw,withdrawn:o.withdrawn,witness_votes:o.witness_votes,proxy:o.proxy,recovery_account:o.recovery_account,proxied_vsf_votes:o.proxied_vsf_votes,voting_manabar:o.voting_manabar,voting_power:o.voting_power,downvote_manabar:o.downvote_manabar,follow_stats:a,reputation:c,profile:i}},enabled:!!e,staleTime:6e4})}var Aa=new Set(["__proto__","constructor","prototype"]);function Mt(e){if(!e||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ho(e,t){let r={...e};for(let n of Object.keys(t)){if(Aa.has(n))continue;let o=t[n],i=r[n];Mt(o)&&Mt(i)?r[n]=ho(i,o):r[n]=o;}return r}function Oa(e){if(!(!e||!Array.isArray(e)))return e.map(({meta:t,...r})=>{if(!t||typeof t!="object")return {...r,meta:t};let{privateKey:n,username:o,...i}=t;return {...r,meta:i}})}function Me(e){if(!e)return {};try{let t=JSON.parse(e);if(t&&typeof t=="object"&&t.profile&&typeof t.profile=="object")return t.profile}catch(t){console.warn("[SDK] Failed to parse posting_json_metadata:",t,{length:e?.length??0});}return {}}function _o(e){return Me(e?.posting_json_metadata)}function bo(e,t){if(!e)return t;if(!t)return e;let r=Object.keys(Me(e.posting_json_metadata)).length;return Object.keys(Me(t.posting_json_metadata)).length>r?t:e}function xa(e){if(!e)return {};try{let t=JSON.parse(e);if(Mt(t))return t}catch(t){console.warn("[SDK] Failed to parse posting_json_metadata root:",t,{length:e?.length??0});}return {}}function wo({existingPostingJsonMetadata:e,profile:t,tokens:r}){let n=xa(e),o=Mt(n.profile)?n.profile:{},i=Ar({existingProfile:o,profile:t,tokens:r});return JSON.stringify({...n,profile:i})}function Ar({existingProfile:e,profile:t,tokens:r}){let{tokens:n,version:o,...i}=t??{},s=ho(e??{},i);return s.tokens&&!Array.isArray(s.tokens)&&(s.tokens=void 0),r!==void 0?s.tokens=r&&r.length>0?r:[]:n!==void 0&&(s.tokens=n),s.tokens=Oa(s.tokens),s.version=2,s}function Nt(e){return e.map(t=>{let r={name:t.name,owner:t.owner,active:t.active,posting:t.posting,memo_key:t.memo_key,post_count:t.post_count,created:t.created,reputation:t.reputation,posting_json_metadata:t.posting_json_metadata,last_vote_time:t.last_vote_time,last_post:t.last_post,json_metadata:t.json_metadata,reward_hive_balance:t.reward_hive_balance,reward_hbd_balance:t.reward_hbd_balance,reward_vesting_hive:t.reward_vesting_hive,reward_vesting_balance:t.reward_vesting_balance,balance:t.balance,hbd_balance:t.hbd_balance,savings_balance:t.savings_balance,savings_hbd_balance:t.savings_hbd_balance,savings_hbd_last_interest_payment:t.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:t.savings_hbd_seconds_last_update,savings_hbd_seconds:t.savings_hbd_seconds,next_vesting_withdrawal:t.next_vesting_withdrawal,pending_claimed_accounts:t.pending_claimed_accounts,vesting_shares:t.vesting_shares,delegated_vesting_shares:t.delegated_vesting_shares,received_vesting_shares:t.received_vesting_shares,vesting_withdraw_rate:t.vesting_withdraw_rate,to_withdraw:t.to_withdraw,withdrawn:t.withdrawn,witness_votes:t.witness_votes,proxy:t.proxy,recovery_account:t.recovery_account,proxied_vsf_votes:t.proxied_vsf_votes,voting_manabar:t.voting_manabar,voting_power:t.voting_power,downvote_manabar:t.downvote_manabar},n=Me(t.posting_json_metadata);if(!n||Object.keys(n).length===0)try{let o=JSON.parse(t.json_metadata||"{}");o.profile&&(n=o.profile);}catch{}return (!n||Object.keys(n).length===0)&&(n={about:"",cover_image:"",location:"",name:"",profile_image:"",website:""}),{...r,profile:n}})}function Ea(e){return new TextEncoder().encode(e).length}function Ge(e){return e?Ea(e)<=16:false}function jy(e){return queryOptions({queryKey:u.accounts.list(...e),enabled:e.length>0,queryFn:async()=>{let t=e.filter(Ge);if(t.length===0)return [];let r=await y("condenser_api.get_accounts",[t],void 0,void 0,void 0,n=>Array.isArray(n));return Nt(r??[])}})}function zy(e){return queryOptions({queryKey:u.accounts.followCount(e),queryFn:()=>y("condenser_api.get_follow_count",[e])})}function eh(e,t,r="blog",n=100){return queryOptions({queryKey:u.accounts.followers(e,t,r,n),queryFn:()=>y("condenser_api.get_followers",[e,t,r,n]),enabled:!!e})}function ih(e,t,r="blog",n=100){return queryOptions({queryKey:u.accounts.following(e,t,r,n),queryFn:()=>y("condenser_api.get_following",[e,t,r,n]),enabled:!!e})}var vo=1e3,Fa=20;function ph(e){return queryOptions({queryKey:u.accounts.mutedUsers(e),queryFn:async()=>{let t=[],r="";for(let n=0;n<Fa;n++){let o=await y("condenser_api.get_following",[e,r,"ignore",vo]);if(!o?.length)break;let i=o.map(s=>s.following);if(i[0]===r&&(i=i.slice(1)),!i.length||(t.push(...i),o.length<vo))break;r=i[i.length-1];}return t},enabled:!!e})}function yh(e,t=50){return queryOptions({queryKey:u.accounts.lookup(e,t),queryFn:async()=>Ge(e)?y("condenser_api.lookup_accounts",[e,t]):[],enabled:!!e,staleTime:1/0})}function vh(e,t=5,r=[]){return queryOptions({queryKey:u.accounts.search(e,r),enabled:!!e,queryFn:async()=>(await y("condenser_api.lookup_accounts",[e,t])).filter(o=>r.length>0?!r.includes(o):true)})}var Ka=new Set(["ownerPublicKey","activePublicKey","postingPublicKey","memoPublicKey"]);function xh(e,t){return queryOptions({queryKey:u.accounts.checkWalletPending(e,t??null),queryFn:async()=>{if(!e||!t)return {exist:false};let n=await _()(f.privateApiHost+"/private-api/wallets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,code:t})});if(!n.ok)return {exist:false};let o=await n.json(),i=Array.isArray(o)?o.flatMap(s=>{if(!s||typeof s!="object")return [];let a=s,c=typeof a.token=="string"?a.token:void 0;if(!c)return [];let p=a.meta&&typeof a.meta=="object"?{...a.meta}:{},l={},d=typeof a.address=="string"&&a.address?a.address:void 0,g=(typeof a.status=="number"?a.status===3:void 0)??false;d&&(l.address=d),l.show=g;let h={symbol:c,currency:c,address:d,show:g,type:"CHAIN",meta:l},P=[];for(let[O,T]of Object.entries(p))typeof O=="string"&&(Ka.has(O)||typeof T!="string"||!T||/^[A-Z0-9]{2,10}$/.test(O)&&P.push({symbol:O,currency:O,address:T,show:g,type:"CHAIN",meta:{address:T,show:g}}));return [h,...P]}):[];return {exist:i.length>0,tokens:i.length?i:void 0,wallets:i.length?i:void 0}},refetchOnMount:true})}function Po(e,t){return queryOptions({queryKey:u.accounts.relations(e,t),enabled:!!e&&!!t,refetchOnMount:false,refetchInterval:36e5,queryFn:async()=>{let r={follows:false,ignores:false,blacklists:false,follows_muted:false,follows_blacklists:false};return !e||!t?r:await y("bridge.get_relationship_between_accounts",[e,t])??r}})}function qh(e){return queryOptions({queryKey:u.accounts.subscriptions(e),enabled:!!e,queryFn:async({signal:t})=>await y("bridge.list_all_subscriptions",{account:e},void 0,void 0,t)??[]})}function Mh(e,t){return queryOptions({queryKey:u.accounts.bookmarks(e),enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Bookmarks] \u2013 missing auth");return await(await _()(f.privateApiHost+"/private-api/bookmarks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function Nh(e,t,r=10){return infiniteQueryOptions({queryKey:u.accounts.bookmarksInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/bookmarks?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch bookmarks: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function Vh(e,t){return queryOptions({queryKey:u.accounts.favorites(e),enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Favorites] \u2013 missing auth");return await(await _()(f.privateApiHost+"/private-api/favorites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function jh(e,t,r=10){return infiniteQueryOptions({queryKey:u.accounts.favoritesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/favorites?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch favorites: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function Gh(e,t,r){return queryOptions({queryKey:u.accounts.checkFavorite(e,r),enabled:!!e&&!!t&&!!r,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Favorites] \u2013 missing auth");if(!r)throw new Error("[SDK][Accounts][Favorites] \u2013 no target username");let o=await _()(f.privateApiHost+"/private-api/favorites-check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,account:r})});if(!o.ok)throw new Error(`[SDK][Accounts][Favorites] \u2013 favorites-check failed with status ${o.status}: ${o.statusText}`);let i=await o.json();if(typeof i!="boolean")throw new Error(`[SDK][Accounts][Favorites] \u2013 favorites-check returned invalid type: expected boolean, got ${typeof i}`);return i}})}function Xh(e,t){return queryOptions({enabled:!!e&&!!t,queryKey:u.accounts.recoveries(e),queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts] Missing username or access token");return (await _()(f.privateApiHost+"/private-api/recoveries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function n_(e){return queryOptions({enabled:!!e,queryKey:u.accounts.pendingRecovery(e),queryFn:()=>y("database_api.find_change_recovery_account_requests",{accounts:[e]})})}function u_(e,t=50){return queryOptions({queryKey:u.accounts.reputations(e,t),enabled:!!e,queryFn:async()=>!e||!Ge(e)?[]:y("condenser_api.get_account_reputations",[e,t])})}var K=ne.operations,Ao={transfers:[K.transfer,K.transfer_to_savings,K.transfer_from_savings,K.cancel_transfer_from_savings,K.fill_transfer_from_savings,K.recurrent_transfer,K.fill_recurrent_transfer,K.escrow_transfer],"market-orders":[K.fill_convert_request,K.fill_order,K.fill_collateralized_convert_request,K.limit_order_create2,K.limit_order_create,K.limit_order_cancel],interests:[K.interest],"stake-operations":[K.return_vesting_delegation,K.withdraw_vesting,K.transfer_to_vesting,K.set_withdraw_vesting_route,K.update_proposal_votes,K.fill_vesting_withdraw,K.account_witness_proxy,K.delegate_vesting_shares],rewards:[K.author_reward,K.curation_reward,K.producer_reward,K.claim_reward_balance,K.comment_benefactor_reward,K.liquidity_reward,K.proposal_pay]},Ga=Array.from(new Set(Object.values(Ao).flat()));function za(e){return e.block*1e7+e.trx_in_block*100+e.op_pos}function Ja(e){return e.replace(/_operation$/,"")}function Ya(e){return typeof e=="object"&&e!==null&&"nai"in e&&"amount"in e&&"precision"in e}function Xa(e){if(!Ya(e))return e;let t=k(e),r=Bt[e.nai]??"UNKNOWN";return `${t.amount.toFixed(e.precision)} ${r}`}function Za(e){let t={};for(let[r,n]of Object.entries(e))t[r]=Xa(n);return t}function h_(e,t=20,r=""){let n=r?Ao[r]:Ga;return infiniteQueryOptions({queryKey:u.accounts.transactions(e??"",r,t),initialPageParam:null,queryFn:async({pageParam:o,signal:i})=>{if(!e)return {entries:[],currentPage:0};let s=async d=>{let m={"account-name":e,"operation-types":n.join(","),"page-size":t};return d!==null&&(m.page=d),await te("hafah","/accounts/{account-name}/operations",m,void 0,void 0,i)},a=d=>d.operations_result.map(m=>{let g=Ja(m.op.type);return {...Za(m.op.value),num:za(m),type:g,timestamp:m.timestamp,trx_id:m.trx_id}}),c=await s(o),p=a(c),l=o??c.total_pages;if(o===null&&p.length<t&&c.total_pages>1)try{let d=await s(c.total_pages-1);p=[...p,...a(d)],l=c.total_pages-1;}catch(d){if(i?.aborted)throw d}return {entries:p,currentPage:l}},getNextPageParam:o=>{let i=o.currentPage-1;return i>=1?i:void 0}})}function v_(){return queryOptions({queryKey:u.accounts.bots(),queryFn:async()=>{let e=await fetch(f.privateApiHost+"/private-api/public/bots",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch bots: ${e.status}`);return e.json()},refetchOnMount:true,staleTime:1/0})}function x_(e){return infiniteQueryOptions({queryKey:u.accounts.referrals(e),initialPageParam:{maxId:void 0},queryFn:async({pageParam:t})=>{let{maxId:r}=t??{},n=Q.getValidatedBaseUrl(),o=new URL(`/private-api/referrals/${e}`,n);r!==void 0&&o.searchParams.set("max_id",r.toString());let i=await fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(`Failed to fetch referrals: ${i.status}`);return i.json()},getNextPageParam:t=>{let r=t?.[t.length-1]?.id;return typeof r=="number"?{maxId:r}:void 0}})}function C_(e){return queryOptions({queryKey:u.accounts.referralsStats(e),queryFn:async()=>{let t=await fetch(f.privateApiHost+`/private-api/referrals/${e}/stats`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to fetch referral stats: ${t.status}`);let r=await t.json();if(!r)throw new Error("No Referrals for this user!");return {total:r.total??0,rewarded:r.rewarded??0}}})}function D_(e,t,r){let{followType:n="blog",limit:o=100,enabled:i=true}=r??{};return infiniteQueryOptions({queryKey:u.accounts.friends(e,t,n,o),initialPageParam:{startFollowing:""},enabled:i,refetchOnMount:true,queryFn:async({pageParam:s})=>{let{startFollowing:a}=s,l=(await y(`condenser_api.${t==="following"?"get_following":"get_followers"}`,[e,a===""?null:a,n,o])).map(g=>t==="following"?g.following:g.follower);return (await y("bridge.get_profiles",{accounts:l,observer:void 0})??[]).map(g=>({name:g.name,reputation:g.reputation,active:g.active}))},getNextPageParam:s=>s&&s.length===o?{startFollowing:s[s.length-1].name}:void 0})}var ic=30;function Q_(e,t,r){return queryOptions({queryKey:u.accounts.searchFriends(e,t,r),refetchOnMount:false,enabled:false,queryFn:async()=>{if(!r)return [];let n=r.slice(0,-1),s=(await y(`condenser_api.${t==="following"?"get_following":"get_followers"}`,[e,n,"blog",1e3])).map(c=>t==="following"?c.following:c.follower).filter(c=>c.toLowerCase().includes(r.toLowerCase())).slice(0,ic);return (await y("bridge.get_profiles",{accounts:s,observer:void 0}))?.map(c=>({name:c.name,full_name:c.metadata.profile?.name||"",reputation:c.reputation,active:c.active}))??[]}})}function L_(e=20){return infiniteQueryOptions({queryKey:u.posts.trendingTags(),queryFn:async({pageParam:{afterTag:t}})=>y("condenser_api.get_trending_tags",[t,e]).then(r=>r.filter(n=>n.name!=="").filter(n=>!n.name.startsWith("hive-")).map(n=>n.name)),initialPageParam:{afterTag:""},getNextPageParam:t=>t?.length>0?{afterTag:t[t.length-1]}:void 0,staleTime:3600*1e3})}function Y_(e=250){return infiniteQueryOptions({queryKey:u.posts.trendingTagsWithStats(e),queryFn:async({pageParam:{afterTag:t}})=>y("condenser_api.get_trending_tags",[t,e]).then(r=>r.filter(n=>n.name!=="").filter(n=>!mo(n.name))),initialPageParam:{afterTag:""},getNextPageParam:t=>t?.length?{afterTag:t[t.length-1].name}:void 0,staleTime:1/0})}function ze(e,t){return queryOptions({queryKey:u.posts.fragments(e),queryFn:async()=>t?(await _()(f.privateApiHost+"/private-api/fragments",{method:"POST",body:JSON.stringify({code:t}),headers:{"Content-Type":"application/json"}})).json():[],enabled:!!e&&!!t})}function tb(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.fragmentsInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/fragments?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch fragments: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function ib(e="feed"){return queryOptions({queryKey:u.posts.promoted(e),queryFn:async()=>{let t=Q.getValidatedBaseUrl(),r=new URL("/private-api/promoted-entries",t);return e==="waves"&&r.searchParams.append("short_content","1"),await(await _()(r.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})).json()}})}function pb(e){return queryOptions({queryKey:u.posts.entryActiveVotes(e?.author,e?.permlink),queryFn:async()=>y("condenser_api.get_active_votes",[e?.author,e?.permlink]),enabled:!!e})}function gb(e,t,r){return queryOptions({queryKey:u.posts.userPostVote(e,t,r),queryFn:async()=>(await y("database_api.list_votes",{start:[e,t,r],limit:1,order:"by_voter_comment"}))?.votes?.[0]||null,enabled:!!e&&!!t&&!!r})}function wb(e,t){return queryOptions({queryKey:u.posts.content(e,t),enabled:!!e&&!!t,queryFn:async()=>y("condenser_api.get_content",[e,t])})}function xb(e,t){return queryOptions({queryKey:u.posts.contentReplies(e,t),enabled:!!e&&!!t,queryFn:async()=>y("condenser_api.get_content_replies",{author:e,permlink:t})})}function Rb(e,t){return queryOptions({queryKey:u.posts.postHeader(e,t),queryFn:async()=>y("bridge.get_post_header",{author:e,permlink:t}),initialData:null})}function re(e){return Array.isArray(e)?e.map(t=>Oo(t)):Oo(e)}function Oo(e){if(!e)return e;let t=`@${e.author}/${e.permlink}`;return f.dmcaPatterns.includes(t)||f.dmcaPatternRegexes.some(n=>n.test(t))?{...e,body:"This post is not available due to a copyright/fraudulent claim.",title:""}:e}async function xo(e,t,r){try{let n=await It("bridge.get_post",{author:e,permlink:t,observer:r},1);if(n&&typeof n=="object"&&n.author===e&&n.permlink===t)return n}catch{}return null}function Eo(e,t,r="",n){let o=t?.trim(),i=`/@${e}/${o??""}`;return queryOptions({queryKey:u.posts.entry(i),queryFn:async()=>{if(!o||o==="undefined")return null;let s=await y("bridge.get_post",{author:e,permlink:o,observer:r});if(!s){let c=await xo(e,o,r);if(!c)return null;let p=n!==void 0?{...c,num:n}:c;return re(p)}let a=n!==void 0?{...s,num:n}:s;return re(a)},enabled:!!e&&!!t&&t.trim()!==""&&t.trim()!=="undefined"})}function ae(e,t,r){return y(`bridge.${e}`,t,void 0,void 0,r)}async function So(e,t,r,n){let{json_metadata:o}=e;if(o?.original_author&&o?.original_permlink&&o.tags?.[0]==="cross-post")try{let i=await hc(o.original_author,o.original_permlink,t,r,n);return i?{...e,original_entry:i,num:r}:e}catch{return e}return {...e,num:r}}async function ko(e,t,r){let n=e.map(pt),o=await Promise.all(n.map(i=>So(i,t,void 0,r)));return re(o)}async function Co(e,t="",r="",n=20,o="",i="",s){let a=await ae("get_ranked_posts",{sort:e,start_author:t,start_permlink:r,limit:n,tag:o,observer:i},s);return Array.isArray(a)?ko(a,i,s):(a!=null&&console.warn(`[SDK] get_ranked_posts returned ${typeof a} instead of an array for sort=${e}; treating as no results.`),null)}async function Or(e,t,r="",n="",o=20,i="",s){if(f.dmcaAccounts.includes(t))return [];let a=await ae("get_account_posts",{sort:e,account:t,start_author:r,start_permlink:n,limit:o,observer:i},s);return Array.isArray(a)?ko(a,i,s):(a!=null&&console.warn(`[SDK] get_account_posts returned ${typeof a} instead of an array for account=${t}, sort=${e}; treating as no results.`),null)}function pt(e){let t={...e,active_votes:Array.isArray(e.active_votes)?[...e.active_votes]:[],beneficiaries:Array.isArray(e.beneficiaries)?[...e.beneficiaries]:[],blacklists:Array.isArray(e.blacklists)?[...e.blacklists]:[],replies:Array.isArray(e.replies)?[...e.replies]:[],stats:e.stats?{...e.stats}:null},r=["author","title","body","created","category","permlink","url","updated"];for(let n of r)t[n]==null&&(t[n]="");return t.author_reputation==null&&(t.author_reputation=0),t.children==null&&(t.children=0),t.depth==null&&(t.depth=0),t.net_rshares==null&&(t.net_rshares=0),t.payout==null&&(t.payout=0),t.percent_hbd==null&&(t.percent_hbd=0),t.stats||(t.stats={flag_weight:0,gray:false,hide:false,total_votes:0}),t.author_payout_value==null&&(t.author_payout_value="0.000 HBD"),t.curator_payout_value==null&&(t.curator_payout_value="0.000 HBD"),t.max_accepted_payout==null&&(t.max_accepted_payout="1000000.000 HBD"),t.payout_at==null&&(t.payout_at=""),t.pending_payout_value==null&&(t.pending_payout_value="0.000 HBD"),t.promoted==null&&(t.promoted="0.000 HBD"),t.is_paidout==null&&(t.is_paidout=false),t}async function hc(e="",t="",r="",n,o){let i=await ae("get_post",{author:e,permlink:t,observer:r},o);if(i){let s=pt(i),a=await So(s,r,n,o);return re(a)}}async function Lb(e="",t=""){let r=await ae("get_post_header",{author:e,permlink:t});return r&&pt(r)}async function Ro(e,t,r){let n=await ae("get_discussion",{author:e,permlink:t,observer:r||e});if(n){let o={};for(let[i,s]of Object.entries(n))o[i]=pt(s);return o}return n}async function To(e,t=""){return ae("get_community",{name:e,observer:t})}async function $b(e="",t=100,r,n="rank",o=""){return ae("list_communities",{last:e,limit:t,query:r,sort:n,observer:o})}async function Fo(e){let t=await ae("normalize_post",{post:e});return t&&pt(t)}async function Wb(e){return ae("list_all_subscriptions",{account:e})}async function Gb(e){return ae("list_subscribers",{community:e})}async function zb(e,t){return ae("get_relationship_between_accounts",[e,t])}async function Qt(e,t){return ae("get_profiles",{accounts:e,observer:t})}var qo=(o=>(o.trending="trending",o.author_reputation="author_reputation",o.votes="votes",o.created="created",o))(qo||{});function xr(e){let t=e.match(/^(\d+\.?\d*)\s*([A-Z]+)$/);return t?{amount:parseFloat(t[1]),symbol:t[2]}:{amount:0,symbol:""}}function _c(e,t,r){let n=l=>xr(l.pending_payout_value).amount+xr(l.author_payout_value).amount+xr(l.curator_payout_value).amount,o=l=>l.net_rshares<0,i=l=>e.json_metadata?.pinned_reply===`${l.author}/${l.permlink}`,s={trending:(l,d)=>{if(o(l))return 1;if(o(d))return -1;let m=n(l),g=n(d);return m!==g?g-m:0},author_reputation:(l,d)=>{let m=l.author_reputation,g=d.author_reputation;return m>g?-1:m<g?1:0},votes:(l,d)=>{let m=l.children,g=d.children;return m>g?-1:m<g?1:0},created:(l,d)=>{if(o(l))return 1;if(o(d))return -1;let m=Date.parse(l.created),g=Date.parse(d.created);return m>g?-1:m<g?1:0}},a=t.sort(s[r]),c=a.findIndex(l=>i(l)),p=a[c];return c>=0&&(a.splice(c,1),a.unshift(p)),a}function Do(e,t="created",r=true,n){let o=n||f.defaultObserver;return queryOptions({queryKey:u.posts.discussions(e?.author,e?.permlink,t,o),queryFn:async()=>{if(!e)return [];let i=await y("bridge.get_discussion",{author:e.author,permlink:e.permlink,observer:o}),s=i?Array.from(Object.values(i)):[];return re(s)},enabled:r&&!!e,select:i=>_c(e,i,t),structuralSharing:(i,s)=>{if(!i||!s)return s;let a=i.filter(l=>l.is_optimistic===true),c=new Set(s.map(l=>`${l.author}/${l.permlink}`)),p=a.filter(l=>!c.has(`${l.author}/${l.permlink}`));return p.length>0?[...s,...p]:s}})}function rw(e,t,r,n=true){let o=r||f.defaultObserver;return queryOptions({queryKey:u.posts.discussion(e,t,o),enabled:n&&!!e&&!!t,queryFn:async()=>Ro(e,t,o)})}function uw(e,t="posts",r=20,n="",o=true){return infiniteQueryOptions({queryKey:u.posts.accountPosts(e??"",t,r,n),enabled:!!e&&o,initialPageParam:{author:void 0,permlink:void 0,hasNextPage:true},queryFn:async({pageParam:i,signal:s})=>{if(!i?.hasNextPage||!e)return [];let a=await Or(t,e,i.author??"",i.permlink??"",r,n,s);return re(a??[])},getNextPageParam:i=>{let s=i?.[i.length-1],a=(i?.length??0)===r;if(a)return {author:s?.author,permlink:s?.permlink,hasNextPage:a}}})}function pw(e,t="posts",r="",n="",o=20,i="",s=true){return queryOptions({queryKey:u.posts.accountPostsPage(e??"",t,r,n,o,i),enabled:!!e&&s,queryFn:async({signal:a}={})=>{if(!e)return [];let c=await Or(t,e,r,n,o,i,a);return re(c??[])}})}var Ko=new Map;function Ac(e){let t=Ko.get(e);return t||(t=r=>({...r,pages:r.pages.map(n=>Oc(n,e))}),Ko.set(e,t)),t}function Oc(e,t){let r=e.filter(i=>i.stats?.is_pinned),n=e.filter(i=>!i.stats?.is_pinned);if(t==="hot")return [...r,...n];let o=[...n].sort((i,s)=>new Date(s.created).getTime()-new Date(i.created).getTime());return [...r,...o]}function _w(e,t,r=20,n="",o=true,i={}){return infiniteQueryOptions({queryKey:u.posts.postsRanked(e,t,r,n),queryFn:async({pageParam:s,signal:a})=>{let c=t;f.dmcaTagRegexes.some(l=>l.test(t))&&(c="");let p=await y("bridge.get_ranked_posts",{sort:e,start_author:s.author,start_permlink:s.permlink,limit:r,tag:c,observer:n},void 0,void 0,a);if(p==null)return [];if(!Array.isArray(p))throw new Error(`[SDK] get_ranked_posts returned ${typeof p} for sort=${e}`);return re(p)},select:Ac(e),enabled:o,initialPageParam:{author:void 0,permlink:void 0},getNextPageParam:s=>{let a=s?.[s.length-1];if(a)return {author:a.author,permlink:a.permlink}}})}function bw(e,t="",r="",n=20,o="",i="",s=true){return queryOptions({queryKey:u.posts.postsRankedPage(e,t,r,n,o,i),enabled:s,queryFn:async({signal:a}={})=>{let c=o;f.dmcaTagRegexes.some(l=>l.test(o))&&(c="");let p=await Co(e,t,r,n,c,i,a);return re(p??[])}})}function Ow(e,t,r=200){return queryOptions({queryKey:u.posts.reblogs(e??"",r),queryFn:async()=>(await y("condenser_api.get_blog_entries",[e??t,0,r])).filter(o=>o.author!==t&&!o.reblogged_on.startsWith("1970-")).map(o=>({author:o.author,permlink:o.permlink})),enabled:!!e})}function Cw(e,t){return queryOptions({queryKey:u.posts.rebloggedBy(e??"",t??""),queryFn:async()=>{if(!e||!t)return [];let r=await y("condenser_api.get_reblogged_by",[e,t]);return Array.isArray(r)?r:[]},enabled:!!e&&!!t})}function Iw(e,t){return queryOptions({queryKey:u.posts.schedules(e),queryFn:async()=>{if(!e||!t)return [];let n=await _()(f.privateApiHost+"/private-api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch schedules: ${n.status}`);return n.json()},enabled:!!e&&!!t})}function qw(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.schedulesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/schedules?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch schedules: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function Mw(e,t){return queryOptions({queryKey:u.posts.drafts(e),queryFn:async()=>{if(!e||!t)return [];let n=await _()(f.privateApiHost+"/private-api/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch drafts: ${n.status}`);return n.json()},enabled:!!e&&!!t})}function Nw(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.draftsInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/drafts?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch drafts: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}async function Mo(e){let r=await _()(f.privateApiHost+"/private-api/images",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok)throw new Error(`Failed to fetch images: ${r.status}`);return r.json()}function Vw(e,t){return queryOptions({queryKey:u.posts.images(e),queryFn:async()=>!e||!t?[]:Mo(t),enabled:!!e&&!!t})}function jw(e,t){return queryOptions({queryKey:u.posts.galleryImages(e),queryFn:async()=>!e||!t?[]:Mo(t),enabled:!!e&&!!t})}function Lw(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.imagesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await _()(`${f.privateApiHost}/private-api/images?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch images: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function zw(e,t,r=false){return queryOptions({queryKey:u.posts.commentHistory(e,t,r),queryFn:async({signal:n})=>{let o=await fetch(f.privateApiHost+"/private-api/comment-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:e,permlink:t,onlyMeta:r?"1":""}),signal:n});if(!o.ok)throw new Error(`Failed to fetch comment history: ${o.status}`);return o.json()},enabled:!!e&&!!t})}function qc(e,t){let r=e?.trim(),n=t?.trim();if(!r||!n)throw new Error("Invalid entry path: author and permlink are required");let o=r.replace(/^@+/,""),i=n.replace(/^\/+/,"");if(!o||!i)throw new Error("Invalid entry path: author and permlink cannot be empty after normalization");return `@${o}/${i}`}function Zw(e,t){let r=t?.trim(),n=e?.trim(),o=!!n&&!!r&&r!=="undefined",i=o?qc(n,r):"";return queryOptions({queryKey:u.posts.deletedEntry(i),queryFn:async({signal:s})=>{let a=await fetch(f.privateApiHost+"/private-api/comment-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:e,permlink:r||""}),signal:s});if(!a.ok)throw new Error(`Failed to fetch comment history: ${a.status}`);return a.json()},select:s=>{if(!s?.list?.[0])return null;let{body:a,title:c,tags:p}=s.list[0];return {body:a,title:c,tags:p}},enabled:o})}function nv(e,t,r=true){return queryOptions({queryKey:u.posts.tips(e,t),queryFn:async()=>{let n=`/private-api/post-tips/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,o=await fetch(f.privateApiHost+n,{method:"GET",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to fetch post tips: ${o.status}`);return o.json()},enabled:!!e&&!!t&&r,staleTime:60*1e3})}function Kc(e,t){return {...e,id:e.id??e.post_id,created:e.created??e.timestamp,host:t}}function Bc(e){return {...e,id:e.id??e.post_id}}function he(e,t){if(!e)return null;let r=e.container??e,n=Kc(r,t),o=e.parent?Bc(e.parent):void 0;return {...e,id:e.id??e.post_id,created:e.created??e.timestamp,max_accepted_payout:e.max_accepted_payout||"1000000.000 HBD",pending_payout_value:e.pending_payout_value||"0.000 HBD",author_payout_value:e.author_payout_value||"0.000 HBD",curator_payout_value:e.curator_payout_value||"0.000 HBD",host:t,container:n,parent:o}}function Mc(e){return Array.isArray(e)?e:[]}async function No(e){let t=Do(e,"created",true),r=await f.queryClient.fetchQuery(t),n=Mc(r);if(n.length<=1)return [];let o=n.filter(({parent_author:s,parent_permlink:a})=>s===e.author&&a===e.permlink);return o.length===0?[]:o.filter(s=>!s.stats?.gray)}function Qo(e,t,r){return e.length===0?[]:e.map(n=>{let o=e.find(i=>i.author===n.parent_author&&i.permlink===n.parent_permlink&&i.author!==r);return {...n,id:n.post_id,host:r,container:t,parent:o}}).filter(n=>n.container.post_id!==n.post_id).sort((n,o)=>new Date(o.created).getTime()-new Date(n.created).getTime())}var Hc=20;function Ho(e){return {containers:e.containers??[],tag:e.tag?.trim()||void 0,following:e.following?.trim().toLowerCase()||void 0,author:e.author?.trim().toLowerCase()||void 0,observer:e.observer?.trim().toLowerCase()||void 0,limit:e.limit??Hc}}async function Uo({containers:e,tag:t,following:r,author:n,observer:o,limit:i},s,a){let c=Q.getValidatedBaseUrl(),p=new URL("/private-api/waves/feed",c);p.searchParams.set("limit",String(i)),s&&p.searchParams.set("cursor",s),e.forEach(m=>p.searchParams.append("container",m)),t&&p.searchParams.set("tag",t),r&&p.searchParams.set("following",r),n&&p.searchParams.set("author",n),o&&p.searchParams.set("observer",o);let l=await fetch(p.toString(),{method:"GET",signal:a});if(!l.ok)throw new Error(`Failed to fetch waves feed: ${l.status}`);let d=await l.json();return !Array.isArray(d)||d.length===0?[]:d.map(m=>{let g=he(m,m.host??"");return g?{...g,_cursor:m._cursor}:null}).filter(m=>!!m)}function lv(e={}){let t=Ho(e),{containers:r,tag:n,following:o,author:i,observer:s,limit:a}=t;return infiniteQueryOptions({queryKey:u.posts.wavesFeed({containers:r,tag:n,following:o,author:i,observer:s,limit:a}),initialPageParam:void 0,queryFn:({pageParam:c,signal:p})=>Uo(t,c,p),getNextPageParam:c=>{if(!(c.length<a))return c[c.length-1]?._cursor}})}function dv(e={}){let t=Ho(e),{containers:r,tag:n,following:o,author:i,observer:s,limit:a}=t;return queryOptions({queryKey:[...u.posts.wavesFeed({containers:r,tag:n,following:o,author:i,observer:s,limit:a}),"latest"],staleTime:0,queryFn:({signal:c})=>Uo(t,void 0,c)})}var Vc=20;function jc(e){return {containers:e.containers??[],tag:e.tag?.trim()||void 0,author:e.author?.trim().toLowerCase()||void 0,observer:e.observer?.trim().toLowerCase()||void 0,limit:e.limit??Vc}}async function Lc({containers:e,tag:t,author:r,observer:n,limit:o},i,s){let a=Q.getValidatedBaseUrl(),c=new URL("/private-api/waves/shorts",a);c.searchParams.set("limit",String(o)),i&&c.searchParams.set("cursor",i),e.forEach(d=>c.searchParams.append("container",d)),t&&c.searchParams.set("tag",t),r&&c.searchParams.set("author",r),n&&c.searchParams.set("observer",n);let p=await fetch(c.toString(),{method:"GET",signal:s});if(!p.ok)throw new Error(`Failed to fetch shorts feed: ${p.status}`);let l=await p.json();return !Array.isArray(l)||l.length===0?[]:l.map(d=>{let m=he(d,d.host??"");return m?{...m,active_votes:m.active_votes??[],video:d.video,_cursor:d._cursor}:null}).filter(d=>!!d)}function hv(e={}){let t=jc(e),{containers:r,tag:n,author:o,observer:i,limit:s}=t;return infiniteQueryOptions({queryKey:u.posts.shortsFeed({containers:r,tag:n,author:o,observer:i,limit:s}),initialPageParam:void 0,queryFn:({pageParam:a,signal:c})=>Lc(t,a,c),getNextPageParam:a=>{if(!(a.length<s))return a[a.length-1]?._cursor}})}var Wc=5,Gc=50;async function zc(e,t){let r=t?.author,n=t?.permlink,o=0,i=t?.post_id;for(;o<Gc;){let s={sort:"posts",account:e,limit:Wc,...r?{start_author:r}:{},...n?{start_permlink:n}:{}},a;try{a=await y("bridge.get_account_posts",s);}catch(l){return console.error("[SDK] getThreads get_account_posts error:",l),null}if(!a||a.length===0)return null;let c=a.map(l=>(l.id=l.post_id,l.host=e,l));for(let l of c){if(i&&l.post_id===i){i=void 0;continue}if(o+=1,l.stats?.gray){r=l.author,n=l.permlink;continue}let d;try{d=await No(l);}catch(m){console.error("[SDK] getThreads get_discussion error:",m),r=l.author,n=l.permlink;continue}if(d.length===0){r=l.author,n=l.permlink;continue}return {entries:Qo(d,l,e)}}let p=c[c.length-1];if(!p)return null;r=p.author,n=p.permlink;}return null}function Ov(e){return infiniteQueryOptions({queryKey:u.posts.wavesByHost(e),initialPageParam:void 0,queryFn:async({pageParam:t})=>{let r=await zc(e,t);return r?r.entries:[]},getNextPageParam:t=>t?.[0]?.container})}var Yc=40;function Cv(e,t,r=Yc){return infiniteQueryOptions({queryKey:u.posts.wavesByTag(e,t),initialPageParam:void 0,queryFn:async({signal:n})=>{try{let o=Q.getValidatedBaseUrl(),i=new URL("/private-api/waves/tags",o);i.searchParams.set("container",e),i.searchParams.set("tag",t);let s=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json"},signal:n});if(!s.ok)throw new Error(`Failed to fetch waves by tag: ${s.status}`);return (await s.json()).slice(0,r).map(p=>he(p,e)).filter(p=>!!p).sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){return console.error("[SDK] Failed to fetch waves by tag",o),[]}},getNextPageParam:()=>{}})}function qv(e,t){let r=t?.trim().toLowerCase();return infiniteQueryOptions({queryKey:u.posts.wavesFollowing(e,r??""),enabled:!!r,initialPageParam:void 0,queryFn:async({signal:n})=>{if(!r)return [];try{let o=Q.getValidatedBaseUrl(),i=new URL("/private-api/waves/following",o);i.searchParams.set("container",e),i.searchParams.set("username",r);let s=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json"},signal:n});if(!s.ok)throw new Error(`Failed to fetch waves following feed: ${s.status}`);let a=await s.json();if(!Array.isArray(a)||a.length===0)return [];let c=a.map(p=>he(p,e)).filter(p=>!!p);return c.length===0?[]:c.sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){return console.error("[SDK] Failed to fetch waves following feed",o),[]}},getNextPageParam:()=>{}})}function Mv(e,t=24){let r=e?.trim()||void 0;return queryOptions({queryKey:u.posts.wavesTrendingTags(r??"",t),queryFn:async({signal:n})=>{try{let o=Q.getValidatedBaseUrl(),i=new URL("/private-api/waves/trending/tags",o);r&&i.searchParams.set("container",r),i.searchParams.set("hours",t.toString());let s=await fetch(i.toString(),{method:"GET",signal:n});if(!s.ok)throw new Error(`Failed to fetch waves trending tags: ${s.status}`);return (await s.json()).map(({tag:c,posts:p})=>({tag:c,posts:p}))}catch(o){return console.error("[SDK] Failed to fetch waves trending tags",o),[]}}})}function Vv(e,t){let r=t?.trim().toLowerCase();return infiniteQueryOptions({queryKey:u.posts.wavesByAccount(e,r??""),enabled:!!r,initialPageParam:void 0,queryFn:async({signal:n})=>{if(!r)return [];try{let o=Q.getValidatedBaseUrl(),i=new URL("/private-api/waves/account",o);i.searchParams.set("container",e),i.searchParams.set("username",r);let s=await fetch(i.toString(),{method:"GET",signal:n});if(!s.ok)throw new Error(`Failed to fetch waves for account: ${s.status}`);let a=await s.json();if(!Array.isArray(a)||a.length===0)return [];let c=a.map(p=>he(p,e)).filter(p=>!!p);return c.length===0?[]:c.sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){throw console.error("[SDK] Failed to fetch waves for account",o),o}},getNextPageParam:()=>{}})}function Wv(e){return queryOptions({queryKey:u.posts.wavesTrendingAuthors(e),queryFn:async({signal:t})=>{try{let r=Q.getValidatedBaseUrl(),n=new URL("/private-api/waves/trending/authors",r);n.searchParams.set("container",e);let o=await fetch(n.toString(),{method:"GET",signal:t});if(!o.ok)throw new Error(`Failed to fetch waves trending authors: ${o.status}`);return (await o.json()).map(({author:s,posts:a})=>({author:s,posts:a}))}catch(r){throw console.error("[SDK] Failed to fetch waves trending authors",r),r}}})}function Xv(e,t=true){return queryOptions({queryKey:u.posts.normalize(e?.author??"",e?.permlink??""),enabled:t&&!!e,queryFn:async()=>Fo(e)})}function ou(e){return !!e&&typeof e=="object"&&"author"in e&&"permlink"in e&&"active_votes"in e}function Vo(e){let t=new Date(e);return (new Date().getTime()-t.getTime())/(1e3*60*60*24)}function s0(e,t){let{limit:r=20,filters:n=[],dayLimit:o=7}=t??{};return infiniteQueryOptions({queryKey:u.accounts.voteHistory(e,r),initialPageParam:{start:-1},queryFn:async({pageParam:i})=>{let{start:s}=i,a=await y("condenser_api.get_account_history",[e,s,r,...n]),p=a.map(([m,g])=>({...g.op[1],num:m,timestamp:g.timestamp})).filter(m=>m.voter===e&&m.weight!==0&&Vo(m.timestamp)<=o),l=[];for(let m of p){let g=await f.queryClient.fetchQuery(Eo(m.author,m.permlink));ou(g)&&l.push(g);}let[d]=a;return {lastDate:d?Vo(d[1].timestamp):0,lastItemFetched:d?d[0]:s,entries:l}},getNextPageParam:i=>({start:i.lastItemFetched})})}function l0(e,t,r=true){return queryOptions({queryKey:u.accounts.profiles(e,t??""),enabled:r&&e.length>0,queryFn:async()=>Qt(e,t)})}function h0(e,t="HIVE",r=200){return infiniteQueryOptions({queryKey:u.wallet.balanceHistory(e??"",t,r),initialPageParam:null,queryFn:async({pageParam:n,signal:o})=>{if(!e)return {entries:[],currentPage:0};let i={"account-name":e,"coin-type":t,"page-size":r,direction:"desc"};n!==null&&(i.page=n);let s=await te("balance","/accounts/{account-name}/balance-history",i,void 0,void 0,o);return {entries:s.operations_result,currentPage:n??s.total_pages}},getNextPageParam:n=>{let o=n.currentPage-1;return o>=1?o:void 0},enabled:!!e})}function P0(e,t="HIVE",r="yearly"){return queryOptions({queryKey:u.wallet.aggregatedHistory(e??"",t,r),queryFn:async()=>e?await te("balance","/accounts/{account-name}/aggregated-history",{"account-name":e,"coin-type":t,granularity:r}):[],enabled:!!e,staleTime:6e4})}function E0(){return queryOptions({queryKey:u.accounts.proMembers(),queryFn:async()=>{let e=await fetch(f.privateApiHost+"/private-api/pro-members",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch pro members: ${e.status}`);return e.json()},staleTime:300*1e3})}function S0(e){return new Set((e??[]).map(t=>t.toLowerCase()))}function I0(e,t,r){let n=useQueryClient(),{data:o}=useQuery(M(e));return v(["accounts","update"],e,i=>{let s=bo(n.getQueryData(M(e).queryKey),o);if(!s)throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");return [["account_update2",{account:e,json_metadata:"",extensions:[],posting_json_metadata:wo({existingPostingJsonMetadata:s.posting_json_metadata,profile:i.profile,tokens:i.tokens})}]]},async(i,s)=>{n.setQueryData(M(e).queryKey,a=>{if(!a)return a;let c=JSON.parse(JSON.stringify(a));return c.profile=Ar({existingProfile:_o(a),profile:s.profile,tokens:s.tokens}),c}),await E(t?.adapter,r,[u.accounts.full(e)]);},t,void 0,{broadcastMode:r,onMutate:async()=>{if(e)try{await n.fetchQuery({...M(e),staleTime:0});}catch{}}})}function M0(e,t,r,n,o){return useMutation({mutationKey:["accounts","relation","update",e,t],mutationFn:async i=>{let s=Po(e,t);await w().prefetchQuery(s);let a=w().getQueryData(s.queryKey);return await po(e,"follow",["follow",{follower:e,following:t,what:[...i==="toggle-ignore"&&!a?.ignores?["ignore"]:[],...i==="toggle-follow"&&!a?.follows?["blog"]:[]]}],r),{...a,ignores:i==="toggle-ignore"?!a?.ignores:a?.ignores,follows:i==="toggle-follow"?!a?.follows:a?.follows}},onError:o,onSuccess(i){n(i),w().setQueryData(u.accounts.relations(e,t),i),t&&w().invalidateQueries(M(t));}})}function Er(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildVoteOp] Missing required parameters");if(n<-1e4||n>1e4)throw new Error("[SDK][buildVoteOp] Weight must be between -10000 and 10000");return ["vote",{voter:e,author:t,permlink:r,weight:n}]}function Ne(e,t,r,n,o,i,s){if(!e||!t||n===void 0||!i)throw new Error("[SDK][buildCommentOp] Missing required parameters");return ["comment",{parent_author:r,parent_permlink:n,author:e,permlink:t,title:o,body:i,json_metadata:JSON.stringify(s)}]}function Qe(e,t,r,n,o,i,s){if(!e||!t)throw new Error("[SDK][buildCommentOptionsOp] Missing required parameters");return ["comment_options",{author:e,permlink:t,max_accepted_payout:r,percent_hbd:n,allow_votes:o,allow_curation_rewards:i,extensions:s}]}function Sr(e,t){if(!e||!t)throw new Error("[SDK][buildDeleteCommentOp] Missing required parameters");return ["delete_comment",{author:e,permlink:t}]}function kr(e,t,r,n=false){if(!e||!t||!r)throw new Error("[SDK][buildReblogOp] Missing required parameters");let o={account:e,author:t,permlink:r};return n&&(o.delete="delete"),["custom_json",{id:"follow",json:JSON.stringify(["reblog",o]),required_auths:[],required_posting_auths:[e]}]}function He(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildTransferOp] Missing required parameters");return ["transfer",{from:e,to:t,amount:r,memo:n||""}]}function du(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildMultiTransferOps] Missing required parameters");return t.trim().split(/[\s,]+/).filter(Boolean).map(i=>He(e,i.trim(),r,n))}function fu(e,t,r,n,o,i){if(!e||!t||!r)throw new Error("[SDK][buildRecurrentTransferOp] Missing required parameters");if(o<24)throw new Error("[SDK][buildRecurrentTransferOp] Recurrence must be at least 24 hours");return ["recurrent_transfer",{from:e,to:t,amount:r,memo:n||"",recurrence:o,executions:i,extensions:[]}]}function Je(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildTransferToSavingsOp] Missing required parameters");return ["transfer_to_savings",{from:e,to:t,amount:r,memo:n||""}]}function Ue(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildTransferFromSavingsOp] Missing required parameters");return ["transfer_from_savings",{from:e,to:t,amount:r,memo:n||"",request_id:o}]}function jo(e,t){if(!e||t===void 0)throw new Error("[SDK][buildCancelTransferFromSavingsOp] Missing required parameters");return ["cancel_transfer_from_savings",{from:e,request_id:t}]}function lt(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildClaimInterestOps] Missing required parameters");return [Ue(e,t,r,n,o),jo(e,o)]}function dt(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildTransferToVestingOp] Missing required parameters");return ["transfer_to_vesting",{from:e,to:t,amount:r}]}function ft(e,t){if(!e||!t)throw new Error("[SDK][buildWithdrawVestingOp] Missing required parameters");return ["withdraw_vesting",{account:e,vesting_shares:t}]}function mt(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildDelegateVestingSharesOp] Missing required parameters");return ["delegate_vesting_shares",{delegator:e,delegatee:t,vesting_shares:r}]}function gt(e,t,r,n){if(!e||!t||r===void 0)throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Missing required parameters");if(r<0||r>1e4)throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");return ["set_withdraw_vesting_route",{from_account:e,to_account:t,percent:r,auto_vest:n}]}function yt(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildConvertOp] Missing required parameters");return ["convert",{owner:e,amount:t,requestid:r}]}function Cr(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildCollateralizedConvertOp] Missing required parameters");return ["collateralized_convert",{owner:e,amount:t,requestid:r}]}function Ve(e,t,r,n="tokens"){return ["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:JSON.stringify({contractName:n,contractAction:t,contractPayload:r})}]}function Rr(e,t){return ["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[e],json:JSON.stringify(t.map(r=>({symbol:r})))}]}function Tr(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildDelegateRcOp] Missing required parameters");let n=t.includes(",")?t.split(",").map(o=>o.trim()):[t];return ["custom_json",{id:"rc",json:JSON.stringify(["delegate_rc",{from:e,delegatees:n,max_rc:r}]),required_auths:[],required_posting_auths:[e]}]}function Fr(e,t){if(!e||!t)throw new Error("[SDK][buildFollowOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:["blog"]}]),required_auths:[],required_posting_auths:[e]}]}function Ht(e,t){if(!e||!t)throw new Error("[SDK][buildUnfollowOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:[]}]),required_auths:[],required_posting_auths:[e]}]}function mu(e,t){if(!e||!t)throw new Error("[SDK][buildIgnoreOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:["ignore"]}]),required_auths:[],required_posting_auths:[e]}]}function gu(e,t){if(!e||!t)throw new Error("[SDK][buildUnignoreOp] Missing required parameters");return Ht(e,t)}function Ir(e,t){if(!e)throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");let r=t||new Date().toISOString().split(".")[0],n=["custom_json",{id:"notify",json:JSON.stringify(["setLastRead",{date:r}]),required_auths:[],required_posting_auths:[e]}],o=["custom_json",{id:"ecency_notify",json:JSON.stringify(["setLastRead",{date:r}]),required_auths:[],required_posting_auths:[e]}];return [n,o]}function qr(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildWitnessVoteOp] Missing required parameters");return ["account_witness_vote",{account:e,witness:t,approve:r}]}function Dr(e,t){if(!e||t===void 0)throw new Error("[SDK][buildWitnessProxyOp] Missing required parameters");return ["account_witness_proxy",{account:e,proxy:t}]}function Kr(e,t){if(!e||!t.receiver||!t.subject||!t.permlink||!t.start||!t.end||!t.dailyPay)throw new Error("[SDK][buildProposalCreateOp] Missing required parameters");let r=new Date(t.start),n=new Date(t.end);if(r.toString()==="Invalid Date"||n.toString()==="Invalid Date")throw new Error("[SDK][buildProposalCreateOp] Invalid date format: start and end must be valid ISO date strings");return ["create_proposal",{creator:e,receiver:t.receiver,start_date:t.start,end_date:t.end,daily_pay:t.dailyPay,subject:t.subject,permlink:t.permlink,extensions:[]}]}function Br(e,t,r){if(!e||!t||t.length===0||r===void 0)throw new Error("[SDK][buildProposalVoteOp] Missing required parameters");return ["update_proposal_votes",{voter:e,proposal_ids:t,approve:r,extensions:[]}]}function yu(e,t){if(!e||!t||t.length===0)throw new Error("[SDK][buildRemoveProposalOp] Missing required parameters");return ["remove_proposal",{proposal_owner:e,proposal_ids:t,extensions:[]}]}function hu(e,t,r,n,o){if(e==null||typeof e!="number"||!t||!r||!n||!o)throw new Error("[SDK][buildUpdateProposalOp] Missing required parameters");return ["update_proposal",{proposal_id:e,creator:t,daily_pay:r,subject:n,permlink:o,extensions:[]}]}function Mr(e,t){if(!e||!t)throw new Error("[SDK][buildSubscribeOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["subscribe",{community:t}]),required_auths:[],required_posting_auths:[e]}]}function Nr(e,t){if(!e||!t)throw new Error("[SDK][buildUnsubscribeOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["unsubscribe",{community:t}]),required_auths:[],required_posting_auths:[e]}]}function Qr(e,t,r,n){if(!e||!t||!r||!n)throw new Error(`[SDK][buildSetRoleOp] Missing required parameters: username=${e}, community=${t}, account=${r}, role=${n}`);return ["custom_json",{id:"community",json:JSON.stringify(["setRole",{community:t,account:r,role:n}]),required_auths:[],required_posting_auths:[e]}]}function Hr(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildUpdateCommunityOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["updateProps",{community:t,props:r}]),required_auths:[],required_posting_auths:[e]}]}function Ur(e,t,r,n,o){if(!e||!t||!r||!n||o===void 0)throw new Error("[SDK][buildPinPostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([o?"pinPost":"unpinPost",{community:t,account:r,permlink:n}]),required_auths:[],required_posting_auths:[e]}]}function Vr(e,t,r,n,o,i){if(!e||!t||!r||!n||i===void 0)throw new Error("[SDK][buildMutePostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([i?"mutePost":"unmutePost",{community:t,account:r,permlink:n,notes:o}]),required_auths:[],required_posting_auths:[e]}]}function _u(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildMuteUserOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([o?"muteUser":"unmuteUser",{community:t,account:r,notes:n}]),required_auths:[],required_posting_auths:[e]}]}function bu(e,t,r,n,o){if(!e||!t||!r||!n)throw new Error("[SDK][buildFlagPostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["flagPost",{community:t,account:r,permlink:n,notes:o}]),required_auths:[],required_posting_auths:[e]}]}var Lo=(r=>(r.Buy="buy",r.Sell="sell",r))(Lo||{}),$o=(r=>(r.EMPTY="",r.SWAP="9",r))($o||{});function Vt(e,t,r,n,o,i){if(!e||!t||!r||!o||i===void 0)throw new Error("[SDK][buildLimitOrderCreateOp] Missing required parameters");return ["limit_order_create",{owner:e,orderid:i,amount_to_sell:t,min_to_receive:r,fill_or_kill:n,expiration:o}]}function Ut(e,t=3){return e.toFixed(t)}function wu(e,t,r,n,o=""){if(!e||n===void 0||!Number.isFinite(t)||t<=0||!Number.isFinite(r)||r<=0)throw new Error("[SDK][buildLimitOrderCreateOpWithType] Missing or invalid parameters");let i=new Date(Date.now());i.setDate(i.getDate()+27);let s=i.toISOString().split(".")[0],a=+`${o}${Math.floor(Date.now()/1e3).toString().slice(2)}`,c=n==="buy"?`${Ut(t,3)} HBD`:`${Ut(t,3)} HIVE`,p=n==="buy"?`${Ut(r,3)} HIVE`:`${Ut(r,3)} HBD`;return Vt(e,c,p,false,s,a)}function jr(e,t){if(!e||t===void 0)throw new Error("[SDK][buildLimitOrderCancelOp] Missing required parameters");return ["limit_order_cancel",{owner:e,orderid:t}]}function Lr(e,t,r,n){if(!e||!t||!r||!n)throw new Error("[SDK][buildClaimRewardBalanceOp] Missing required parameters");return ["claim_reward_balance",{account:e,reward_hive:t,reward_hbd:r,reward_vests:n}]}function vu(e,t,r,n,o,i){if(!e||!o)throw new Error("[SDK][buildAccountUpdateOp] Missing required parameters");return ["account_update",{account:e,owner:t,active:r,posting:n,memo_key:o,json_metadata:i}]}function Pu(e,t,r,n){if(!e||r===void 0)throw new Error("[SDK][buildAccountUpdate2Op] Missing required parameters");return ["account_update2",{account:e,json_metadata:t||"",posting_json_metadata:r,extensions:n||[]}]}function $r(e,t,r,n){if(!e||!t||!r||!n)throw new Error("[SDK][buildAccountCreateOp] Missing required parameters");let o={weight_threshold:1,account_auths:[],key_auths:[[r.ownerPublicKey,1]]},i={weight_threshold:1,account_auths:[],key_auths:[[r.activePublicKey,1]]},s={weight_threshold:1,account_auths:[["ecency.app",1]],key_auths:[[r.postingPublicKey,1]]};return ["account_create",{creator:e,new_account_name:t,owner:o,active:i,posting:s,memo_key:r.memoPublicKey,json_metadata:"",fee:n}]}function Wr(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildCreateClaimedAccountOp] Missing required parameters");let n={weight_threshold:1,account_auths:[],key_auths:[[r.ownerPublicKey,1]]},o={weight_threshold:1,account_auths:[],key_auths:[[r.activePublicKey,1]]},i={weight_threshold:1,account_auths:[["ecency.app",1]],key_auths:[[r.postingPublicKey,1]]};return ["create_claimed_account",{creator:e,new_account_name:t,owner:n,active:o,posting:i,memo_key:r.memoPublicKey,json_metadata:"",extensions:[]}]}function Gr(e,t){if(!e||!t)throw new Error("[SDK][buildClaimAccountOp] Missing required parameters");return ["claim_account",{creator:e,fee:t,extensions:[]}]}function zr(e,t,r,n,o,i){if(!e||!t||!r||!o)throw new Error("[SDK][buildGrantPostingPermissionOp] Missing required parameters");let s=t.account_auths.findIndex(([p])=>p===r),a=[...t.account_auths];s>=0?a[s]=[r,n]:a.push([r,n]);let c={...t,account_auths:a};return c.account_auths.sort((p,l)=>p[0]>l[0]?1:-1),["account_update",{account:e,posting:c,memo_key:o,json_metadata:i}]}function Au(e,t,r,n,o){if(!e||!t||!r||!n)throw new Error("[SDK][buildRevokePostingPermissionOp] Missing required parameters");let i={...t,account_auths:t.account_auths.filter(([s])=>s!==r)};return ["account_update",{account:e,posting:i,memo_key:n,json_metadata:o}]}function Ou(e,t,r=[]){if(!e||!t)throw new Error("[SDK][buildChangeRecoveryAccountOp] Missing required parameters");return ["change_recovery_account",{account_to_recover:e,new_recovery_account:t,extensions:r}]}function xu(e,t,r,n=[]){if(!e||!t||!r)throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");return ["request_account_recovery",{recovery_account:e,account_to_recover:t,new_owner_authority:r,extensions:n}]}function Eu(e,t,r,n=[]){if(!e||!t||!r)throw new Error("[SDK][buildRecoverAccountOp] Missing required parameters");return ["recover_account",{account_to_recover:e,new_owner_authority:t,recent_owner_authority:r,extensions:n}]}function Jr(e,t,r){if(!e||!t||!Number.isFinite(r))throw new Error("[SDK][buildBoostPlusOp] Missing required parameters");return ["custom_json",{id:"ecency_boost_plus",json:JSON.stringify({user:e,account:t,duration:r}),required_auths:[e],required_posting_auths:[]}]}function Yr(e,t){if(!e||!Number.isInteger(t)||t<=0)throw new Error("[SDK][buildRcDelegationOp] Missing or invalid parameters");return ["custom_json",{id:"ecency_rc_delegation",json:JSON.stringify({user:e,duration:t}),required_auths:[e],required_posting_auths:[]}]}function Xr(e,t,r,n){if(!e||!t||!r||!Number.isFinite(n))throw new Error("[SDK][buildPromoteOp] Missing required parameters");return ["custom_json",{id:"ecency_promote",json:JSON.stringify({user:e,author:t,permlink:r,duration:n}),required_auths:[e],required_posting_auths:[]}]}function Ye(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildPointTransferOp] Missing required parameters");let o=r.replace(/POINTS\b/,"POINT");return ["custom_json",{id:"ecency_point_transfer",json:JSON.stringify({sender:e,receiver:t,amount:o,memo:n||""}),required_auths:[e],required_posting_auths:[]}]}function Su(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildMultiPointTransferOps] Missing required parameters");let o=t.trim().split(/[\s,]+/).filter(Boolean);if(o.length===0)throw new Error("[SDK][buildMultiPointTransferOps] Missing valid destinations");return o.map(i=>Ye(e,i.trim(),r,n))}function Zr(e){if(!e)throw new Error("[SDK][buildCommunityRegistrationOp] Missing required parameters");return ["custom_json",{id:"ecency_registration",json:JSON.stringify({name:e}),required_auths:[e],required_posting_auths:[]}]}function ku(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildActiveCustomJsonOp] Missing required parameters");return ["custom_json",{id:t,json:JSON.stringify(r),required_auths:[e],required_posting_auths:[]}]}function Cu(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildPostingCustomJsonOp] Missing required parameters");return ["custom_json",{id:t,json:JSON.stringify(r),required_auths:[],required_posting_auths:[e]}]}function iP(e,t,r){return v(["accounts","follow"],e,({following:n})=>[Fr(e,n)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.relations(e,o.following),u.accounts.full(o.following),u.accounts.followCount(o.following),u.accounts.followCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function uP(e,t,r){return v(["accounts","unfollow"],e,({following:n})=>[Ht(e,n)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.relations(e,o.following),u.accounts.full(o.following),u.accounts.followCount(o.following),u.accounts.followCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function fP(e,t,r,n){return useMutation({mutationKey:["accounts","bookmarks","add",e],mutationFn:async({author:o,permlink:i})=>{if(!e||!t)throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");return (await _()(f.privateApiHost+"/private-api/bookmarks-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:o,permlink:i,code:t})})).json()},onSuccess:()=>{r(),w().invalidateQueries({queryKey:["accounts","bookmarks",e]});},onError:n})}function hP(e,t,r,n){return useMutation({mutationKey:["accounts","bookmarks","delete",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");return (await _()(f.privateApiHost+"/private-api/bookmarks-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:o,code:t})})).json()},onSuccess:()=>{r(),w().invalidateQueries({queryKey:["accounts","bookmarks",e]});},onError:n})}function vP(e,t,r,n){return useMutation({mutationKey:["accounts","favorites","add",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Favorites] \u2013 missing auth");return (await _()(f.privateApiHost+"/private-api/favorites-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:o,code:t})})).json()},onSuccess:(o,i)=>{r();let s=w();s.invalidateQueries({queryKey:u.accounts.favorites(e)}),s.invalidateQueries({queryKey:u.accounts.favoritesInfinite(e)}),s.invalidateQueries({queryKey:u.accounts.checkFavorite(e,i)});},onError:n})}function EP(e,t,r,n){return useMutation({mutationKey:["accounts","favorites","delete",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Favorites] \u2013 missing auth");let s=await _()(f.privateApiHost+"/private-api/favorites-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:o,code:t})});if(!s.ok)throw new Error(`Failed to delete favorite: ${s.status}`);return s.json()},onMutate:async o=>{if(!e)return;let i=w(),s=u.accounts.favorites(e),a=u.accounts.favoritesInfinite(e),c=u.accounts.checkFavorite(e,o);await Promise.all([i.cancelQueries({queryKey:s}),i.cancelQueries({queryKey:a}),i.cancelQueries({queryKey:c})]);let p=i.getQueryData(s);p&&i.setQueryData(s,p.filter(g=>g.account!==o));let l=i.getQueryData(c);i.setQueryData(c,false);let d=i.getQueriesData({queryKey:a}),m=new Map(d);for(let[g,h]of d)h&&i.setQueryData(g,{...h,pages:h.pages.map(P=>({...P,data:P.data.filter(O=>O.account!==o)}))});return {previousList:p,previousInfinite:m,previousCheck:l}},onSuccess:(o,i)=>{r();let s=w();s.invalidateQueries({queryKey:u.accounts.favorites(e)}),s.invalidateQueries({queryKey:u.accounts.favoritesInfinite(e)}),s.invalidateQueries({queryKey:u.accounts.checkFavorite(e,i)});},onError:(o,i,s)=>{let a=w();if(s?.previousList&&a.setQueryData(u.accounts.favorites(e),s.previousList),s?.previousInfinite)for(let[c,p]of s.previousInfinite)a.setQueryData(c,p);s?.previousCheck!==void 0&&a.setQueryData(u.accounts.checkFavorite(e,i),s.previousCheck),n(o);}})}function Ku(e,t){let r=new Map;return e.forEach(([n,o])=>{r.set(n.toString(),o);}),t.forEach(([n,o])=>{r.set(n.toString(),o);}),Array.from(r.entries()).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,o])}function Wo(e,t){let{data:r}=useQuery(M(e));return useMutation({mutationKey:["accounts","keys-update",e],mutationFn:async({keys:n,keepCurrent:o=false,currentKey:i,keysToRevoke:s=[],keysToRevokeByAuthority:a={}})=>{if(n.length===0)throw new Error("[SDK][Update password] \u2013 no new keys provided");if(!r)throw new Error("[SDK][Update password] \u2013 cannot update keys for anon user");let c=p=>{let l=JSON.parse(JSON.stringify(r[p])),m=[...a[p]||[],...a[p]===void 0?s:[]],g=o?l.key_auths.filter(([h])=>!m.includes(h.toString())):[];return l.key_auths=Ku(g,n.map((h,P)=>[h[p].createPublic().toString(),P+1])),l};return ee([["account_update",{account:e,json_metadata:r.json_metadata,owner:c("owner"),active:c("active"),posting:c("posting"),memo_key:n[0].memo_key.createPublic().toString()}]],i)},...t})}function KP(e,t){let{data:r}=useQuery(M(e)),{mutateAsync:n}=Wo(e);return useMutation({mutationKey:["accounts","password-update",e],mutationFn:async({newPassword:o,currentPassword:i,keepCurrent:s})=>{if(!r)throw new Error("[SDK][Update password] \u2013 cannot update password for anon user");let a=U.fromLogin(e,i,"owner");return n({currentKey:a,keepCurrent:s,keys:[{owner:U.fromLogin(e,o,"owner"),active:U.fromLogin(e,o,"active"),posting:U.fromLogin(e,o,"posting"),memo_key:U.fromLogin(e,o,"memo")}]})},...t})}function UP(e,t,r){let n=useQueryClient(),{data:o}=useQuery(M(e));return useMutation({mutationKey:["accounts","revoke-posting",o?.name],mutationFn:async({accountName:i,type:s,key:a})=>{if(!o)throw new Error("[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user");let c=JSON.parse(JSON.stringify(o.posting));c.account_auths=c.account_auths.filter(([l])=>l!==i);let p={account:o.name,posting:c,memo_key:o.memo_key,json_metadata:o.json_metadata};if(s==="key"&&a)return ee([["account_update",p]],a);if(s==="keychain"){if(!r?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return r.adapter.broadcastWithKeychain(o.name,[["account_update",p]],"active")}else return !t.hsCallbackUrl&&process.env.NODE_ENV==="development"&&console.warn("[SDK][Accounts] hsCallbackUrl not provided for HiveSigner revoke-posting; user will not be redirected after signing."),uo.sendOperation(["account_update",p],t.hsCallbackUrl?{callback:t.hsCallbackUrl}:{},()=>{})},onError:t.onError,onSuccess:(i,s,a)=>{t.onSuccess?.(i,s,a),n.setQueryData(M(e).queryKey,c=>({...c,posting:{...c?.posting,account_auths:c?.posting?.account_auths?.filter(([p])=>p!==s.accountName)??[]}}));}})}function zP(e,t,r,n){let{data:o}=useQuery(M(e));return useMutation({mutationKey:["accounts","recovery",o?.name],mutationFn:async({accountName:i,type:s,key:a,email:c})=>{if(!o)throw new Error("[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user");let p={account_to_recover:o.name,new_recovery_account:i,extensions:[]};if(s==="ecency"){if(!t)throw new Error("[SDK][Accounts] \u2013 missing access token");let d=await _()(f.privateApiHost+"/private-api/recoveries-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,email:c,publicKeys:[...o.owner.key_auths,...o.active.key_auths,...o.posting.key_auths,o.memo_key]})});if(!d.ok)throw new Error(`[SDK][Accounts] Failed to add recovery: ${d.status}`);return d}else {if(s==="key"&&a)return ee([["change_recovery_account",p]],a);if(s==="keychain"){if(!n?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return n.adapter.broadcastWithKeychain(o.name,[["change_recovery_account",p]],"owner")}else return !r.hsCallbackUrl&&process.env.NODE_ENV==="development"&&console.warn("[SDK][Accounts] hsCallbackUrl not provided for HiveSigner update-recovery; user will not be redirected after signing."),uo.sendOperation(["change_recovery_account",p],r.hsCallbackUrl?{callback:r.hsCallbackUrl}:{},()=>{})}},onError:r.onError,onSuccess:r.onSuccess})}function YP(e,t){let r=e.key_auths.filter(([o])=>!t.has(String(o))).reduce((o,[,i])=>o+i,0),n=(e.account_auths??[]).reduce((o,[,i])=>o+i,0);return r+n>=e.weight_threshold}function Go(e,t){let r=new Set(t.map(s=>s.toString())),n=s=>s.key_auths.some(([a])=>r.has(String(a))),o=s=>{let a=JSON.parse(JSON.stringify(s));return a.key_auths=a.key_auths.filter(([c])=>!r.has(c.toString())),a},i=n(e.owner);return {account:e.name,json_metadata:e.json_metadata,owner:i?o(e.owner):void 0,active:o(e.active),posting:o(e.posting),memo_key:e.memo_key}}function nA(e,t){let{data:r}=useQuery(M(e));return useMutation({mutationKey:["accounts","revoke-key",r?.name],mutationFn:async({currentKey:n,revokingKey:o})=>{if(!r)throw new Error("[SDK][Revoke key] \u2013 cannot update keys for anon user");let i=Array.isArray(o)?o:[o],s=Go(r,i);return ee([["account_update",s]],n)},...t})}function aA(e,t,r){return v(["accounts","claimAccount"],e,({creator:n,fee:o="0.000 HIVE"})=>[Gr(n,o)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(o.creator)]);},t,"active",{broadcastMode:r})}function lA(e,t,r){return v(["accounts","grant-posting-permission"],e,n=>[zr(e,n.currentPosting,n.grantedAccount,n.weightThreshold,n.memoKey,n.jsonMetadata)],async()=>{await E(t?.adapter,r,[u.accounts.full(e)]);},t,"active",{broadcastMode:r})}function gA(e,t,r){return v(["accounts","create"],e,n=>[n.useClaimed?Wr(e,n.newAccountName,n.keys):$r(e,n.newAccountName,n.keys,n.fee)],async()=>{await E(t?.adapter,r,[u.accounts.full(e)]);},t,"active",{broadcastMode:r})}var en=300*60*24,Gu=1e4,zu=5e7;function zo(e){let t=k(e.vesting_shares).amount,r=k(e.received_vesting_shares).amount,n=k(e.delegated_vesting_shares).amount,o=k(e.vesting_withdraw_rate).amount,i=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,s=Math.min(o,i);return t+r-n-s}function Ju(e,t,r){let n=e*1e6;return (t*r/1e4/50+1)*n/1e4}function Yu(e){if(Number.isFinite(e.lastHardfork))return e.lastHardfork>=28;let[t="0",r="0"]=(e.currentHardforkVersion??"0.0.0").split(".");return Number(t)>1||Number(t)===1&&Number(r)>=28}function Xu(e,t,r){let n=t.votePowerReserveRate||Number(t.raw?.globalDynamic?.vote_power_reserve_rate??0);if(!Number.isFinite(n)||n<=0)return 0;let o=zo(e);if(!Number.isFinite(o)||o<=0)return 0;let i=o*1e6,s=Math.ceil(i*r*60*60*24/Gu/(n*en)),a=wr(e),c=Math.min(a.current_mana,a.max_mana);return !Number.isFinite(c)||s>c?0:Math.max(s-zu,0)}function Zu(e,t,r,n=1e4){if(!Number.isFinite(r)||!Number.isFinite(n))return 0;if(Yu(t))return Xu(e,t,n);let o=0;try{if(o=zo(e),!Number.isFinite(o))return 0}catch{return 0}return Ju(o,r,n)}function bA(e){return wr(e).percentage/100}function wA(e){if(!Number.isFinite(e))throw new TypeError("Voting power must be a finite number");if(e<0||e>100)throw new RangeError("Voting power must be between 0 and 100");return (100-e)*100*en/1e4}function vA(e){let t=parseFloat(e.vesting_shares)+parseFloat(e.received_vesting_shares)-parseFloat(e.delegated_vesting_shares),r=Math.floor(Date.now()/1e3)-e.downvote_manabar.last_update_time,n=t*1e6/4;if(n<=0)return 0;let o=parseFloat(e.downvote_manabar.current_mana.toString())+r*n/en;o>n&&(o=n);let i=o*100/n;return isNaN(i)?0:i>100?100:i}function PA(e){return Dt(e).percentage/100}function AA(e,t,r,n=1e4){if(!Number.isFinite(r)||!Number.isFinite(n))return 0;let{fundRecentClaims:o,fundRewardBalance:i,base:s,quote:a}=t;if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(a)||o===0||a===0)return 0;let c=Zu(e,t,r,n);return Number.isFinite(c)?c/o*i*(s/a):0}var ep={vote:"posting",comment:"posting",delete_comment:"posting",comment_options:"posting",claim_reward_balance:"posting",cancel_transfer_from_savings:"active",collateralized_convert:"active",convert:"active",delegate_vesting_shares:"active",recurrent_transfer:"active",set_withdraw_vesting_route:"active",transfer:"active",transfer_from_savings:"active",transfer_to_savings:"active",transfer_to_vesting:"active",withdraw_vesting:"active",limit_order_create:"active",limit_order_cancel:"active",account_update:"active",account_update2:"active",claim_account:"active",create_claimed_account:"active",account_witness_proxy:"active",account_witness_vote:"active",remove_proposal:"active",update_proposal_votes:"active",change_recovery_account:"owner",request_account_recovery:"owner",recover_account:"owner",reset_account:"owner",set_reset_account:"owner"};function tp(e){let t=e[0],r=e[1];if(t!=="custom_json")throw new Error("Operation is not a custom_json operation");let n=r;return n.required_auths&&n.required_auths.length>0?"active":(n.required_posting_auths&&n.required_posting_auths.length>0,"posting")}function rp(e){let t=e[0];if(t!=="create_proposal"&&t!=="update_proposal")throw new Error("Operation is not a proposal operation");return "active"}function np(e){let t=e[0];return t==="custom_json"?tp(e):t==="create_proposal"||t==="update_proposal"?rp(e):ep[t]??"posting"}function xA(e){let t="posting";for(let r of e){let n=np(r);if(n==="owner")return "owner";n==="active"&&t==="posting"&&(t="active");}return t}function RA(e){return useMutation({mutationKey:["operations","sign",e],mutationFn:({operation:t,keyOrSeed:r})=>{if(!e)throw new Error("[Operations][Sign] \u2013 cannot sign op with anon user");let n;return r.split(" ").length===12?n=U.fromLogin(e,r,"active"):io(r)?n=U.fromString(r):n=U.from(r),ee([t],n)}})}function IA(e,t,r="active"){return useMutation({mutationKey:["operations","sign-keychain",e],mutationFn:({operation:n})=>{if(!e)throw new Error("[SDK][Keychain] \u2013\xA0cannot sign operation with anon user");if(!t?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");return t.adapter.broadcastWithKeychain(e,[n],r)}})}function BA(e="/"){return useMutation({mutationKey:["operations","sign-hivesigner",e],mutationFn:async({operation:t})=>uo.sendOperation(t,{callback:e},()=>{})})}function HA(){return queryOptions({queryKey:["operations","chain-properties"],queryFn:async()=>await y("condenser_api.get_chain_properties",[])})}function Jo(e,t,r){return {...e,...t??{},title:r.title,body:r.body}}function Yo(e,t){return {...e??{},title:t.title,body:t.body}}function zA(e,t){return useMutation({mutationKey:["posts","add-fragment",e],mutationFn:async({title:r,body:n})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let i=await _()(f.privateApiHost+"/private-api/fragments-add",{method:"POST",body:JSON.stringify({code:t,title:r,body:n}),headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(`[SDK][Posts] Failed to add fragment: ${i.status}`);return i.json()},onSuccess(r,n){let o=w(),i=Yo(r,n);o.setQueryData(ze(e,t).queryKey,s=>[i,...s??[]]),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},s=>s&&{...s,pages:s.pages.map((a,c)=>c===0?{...a,data:[i,...a.data]}:a)});}})}function rO(e,t){return useMutation({mutationKey:["posts","edit-fragment",e],mutationFn:async({fragmentId:r,title:n,body:o})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let s=await _()(f.privateApiHost+"/private-api/fragments-update",{method:"POST",body:JSON.stringify({code:t,id:r,title:n,body:o}),headers:{"Content-Type":"application/json"}});if(!s.ok)throw new Error(`[SDK][Posts] Failed to update fragment: ${s.status}`);return s.json()},onSuccess(r,n){let o=w(),i=s=>Jo(s,r,n);o.setQueryData(ze(e,t).queryKey,s=>s?.map(a=>a.id===n.fragmentId?i(a):a)??[]),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},s=>s&&{...s,pages:s.pages.map(a=>({...a,data:a.data.map(c=>c.id===n.fragmentId?i(c):c)}))});}})}function cO(e,t){return useMutation({mutationKey:["posts","remove-fragment",e],mutationFn:async({fragmentId:r})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let o=await _()(f.privateApiHost+"/private-api/fragments-delete",{method:"POST",body:JSON.stringify({code:t,id:r}),headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`[SDK][Posts] Failed to delete fragment: ${o.status}`);return o},onSuccess(r,n){let o=w();o.setQueryData(ze(e,t).queryKey,i=>[...i??[]].filter(({id:s})=>s!==n.fragmentId)),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},i=>i&&{...i,pages:i.pages.map(s=>({...s,data:s.data.filter(a=>a.id!==n.fragmentId)}))});}})}async function G(e){if(!e.ok){let r;try{r=await e.json();}catch{r=void 0;}let n=new Error(`Request failed with status ${e.status}`);throw n.status=e.status,n.data=r,n}let t=await e.text();if(!t||t.trim()==="")return "";try{return JSON.parse(t)}catch(r){return console.warn("[SDK] Failed to parse JSON response:",r,"Response:",t),""}}async function lO(e,t,r,n){let i=await _()(f.privateApiHost+"/private-api/account-create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,email:t,referral:r,captcha_token:n})}),s=await G(i);return {status:i.status,data:s}}async function dO(e){let r=await _()(f.privateApiHost+"/private-api/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),n=await G(r);return {status:r.status,data:n}}async function fO(e,t,r="",n=""){let o={code:e,ty:t};r&&(o.bl=r),n&&(o.tx=n);let s=await _()(f.privateApiHost+"/private-api/usr-activity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});await G(s);}async function mO(e,t,r=null,n=null){let o={code:e};t&&(o.filter=t),r&&(o.since=r),n&&(o.user=n);let s=await _()(f.privateApiHost+"/private-api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return G(s)}async function gO(e,t,r,n,o,i){let s={code:e,username:t,token:i,system:r,allows_notify:n,notify_types:o},c=await _()(f.privateApiHost+"/private-api/register-device",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return G(c)}async function yO(e,t,r){let n={code:e,username:t,token:r},i=await _()(f.privateApiHost+"/private-api/detail-device",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}async function Xo(e,t){let r={code:e};t&&(r.id=t);let o=await _()(f.privateApiHost+"/private-api/notifications/mark",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function Zo(e,t){let r={code:e,url:t},o=await _()(f.privateApiHost+"/private-api/images-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}var dp="https://i.ecency.com";async function ei(e,t,r){let n=_(),o=new FormData;o.append("file",e);let i=await n(`${dp}/hs/${t}`,{method:"POST",body:o,signal:r});return G(i)}async function hO(e,t,r,n){let o=_(),i=new FormData;i.append("file",e);let s=await o(`${f.imageHost}/${t}/${r}`,{method:"POST",body:i,signal:n});return G(s)}async function ti(e,t){let r={code:e,id:t},o=await _()(f.privateApiHost+"/private-api/images-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function ri(e,t,r,n,o){let i={code:e,title:t,body:r,tags:n,meta:o},a=await _()(f.privateApiHost+"/private-api/drafts-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return G(a)}async function ni(e,t,r,n,o,i){let s={code:e,id:t,title:r,body:n,tags:o,meta:i},c=await _()(f.privateApiHost+"/private-api/drafts-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return G(c)}async function oi(e,t){let r={code:e,id:t},o=await _()(f.privateApiHost+"/private-api/drafts-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function ii(e,t,r,n,o,i,s,a){let c={code:e,permlink:t,title:r,body:n,meta:o,schedule:s,reblog:a};i&&(c.options=i);let l=await _()(f.privateApiHost+"/private-api/schedules-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});return G(l)}async function si(e,t){let r={code:e,id:t},o=await _()(f.privateApiHost+"/private-api/schedules-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function ai(e,t){let r={code:e,id:t},o=await _()(f.privateApiHost+"/private-api/schedules-move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function _O(e,t,r){let n={code:e,author:t,permlink:r},i=await _()(f.privateApiHost+"/private-api/promoted-post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}async function bO(e,t,r){let n={username:e,email:t,friend:r},i=await _()(f.privateApiHost+"/private-api/account-create-friend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}function OO(e,t,r,n){return useMutation({mutationKey:["posts","drafts","add",e],mutationFn:async({title:o,body:i,tags:s,meta:a})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for addDraft");return ri(t,o,i,s,a)},onSuccess:o=>{r?.();let i=w();o?.drafts?i.setQueryData(u.posts.drafts(e),o.drafts):i.invalidateQueries({queryKey:u.posts.drafts(e)}),i.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:n})}function CO(e,t,r,n){return useMutation({mutationKey:["posts","drafts","update",e],mutationFn:async({draftId:o,title:i,body:s,tags:a,meta:c})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for updateDraft");return ni(t,o,i,s,a,c)},onSuccess:()=>{r?.();let o=w();o.invalidateQueries({queryKey:u.posts.drafts(e)}),o.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:n})}function DO(e,t,r,n){return useMutation({mutationKey:["posts","drafts","delete",e],mutationFn:async({draftId:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteDraft");return oi(t,o)},onMutate:async({draftId:o})=>{if(!e)return;let i=w(),s=u.posts.drafts(e),a=u.posts.draftsInfinite(e);await Promise.all([i.cancelQueries({queryKey:s}),i.cancelQueries({queryKey:a})]);let c=i.getQueryData(s);c&&i.setQueryData(s,c.filter(d=>d._id!==o));let p=i.getQueriesData({queryKey:a}),l=new Map(p);for(let[d,m]of p)m&&i.setQueryData(d,{...m,pages:m.pages.map(g=>({...g,data:g.data.filter(h=>h._id!==o)}))});return {previousList:c,previousInfinite:l}},onSuccess:()=>{r?.();let o=w();o.invalidateQueries({queryKey:u.posts.drafts(e)}),o.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:(o,i,s)=>{let a=w();if(s?.previousList&&a.setQueryData(u.posts.drafts(e),s.previousList),s?.previousInfinite)for(let[c,p]of s.previousInfinite)a.setQueryData(c,p);n?.(o);}})}function QO(e,t,r,n){return useMutation({mutationKey:["posts","schedules","add",e],mutationFn:async({permlink:o,title:i,body:s,meta:a,options:c,schedule:p,reblog:l})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for addSchedule");return ii(t,o,i,s,a,c,p,l)},onSuccess:()=>{r?.(),w().invalidateQueries({queryKey:u.posts.schedules(e)});},onError:n})}function LO(e,t,r,n){return useMutation({mutationKey:["posts","schedules","delete",e],mutationFn:async({id:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteSchedule");return si(t,o)},onSuccess:o=>{r?.();let i=w();o?i.setQueryData(u.posts.schedules(e),o):i.invalidateQueries({queryKey:u.posts.schedules(e)});},onError:n})}function JO(e,t,r,n){return useMutation({mutationKey:["posts","schedules","move",e],mutationFn:async({id:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for moveSchedule");return ai(t,o)},onSuccess:o=>{r?.();let i=w();o?i.setQueryData(u.posts.schedules(e),o):i.invalidateQueries({queryKey:u.posts.schedules(e)}),i.invalidateQueries({queryKey:u.posts.drafts(e)});},onError:n})}function tx(e,t,r,n){return useMutation({mutationKey:["posts","images","add",e],mutationFn:async({url:o,code:i})=>{let s=i??t;if(!e||!s)throw new Error("[SDK][Posts] \u2013 missing auth for addImage");return Zo(s,o)},onSuccess:()=>{r?.(),w().invalidateQueries({queryKey:u.posts.images(e)});},onError:n})}function sx(e,t,r,n){return useMutation({mutationKey:["posts","images","delete",e],mutationFn:async({imageId:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteImage");return ti(t,o)},onSuccess:(o,i)=>{r?.();let s=w(),{imageId:a}=i;s.setQueryData(["posts","images",e],c=>c?.filter(p=>p._id!==a)),s.setQueriesData({queryKey:["posts","images","infinite",e]},c=>c&&{...c,pages:c.pages.map(p=>({...p,data:p.data.filter(l=>l._id!==a)}))});},onError:n})}function px(e,t){return useMutation({mutationKey:["posts","images","upload"],mutationFn:async({file:r,token:n,signal:o})=>ei(r,n,o),onSuccess:e,onError:t})}function Lt(e,t){return `/@${e}/${t}`}function Pp(e,t,r){return (r??w()).getQueryData(u.posts.entry(Lt(e,t)))}function Ap(e,t){(t??w()).setQueryData(u.posts.entry(Lt(e.author,e.permlink)),e);}function jt(e,t,r,n){let o=n??w(),i=Lt(e,t),s=o.getQueryData(u.posts.entry(i));if(!s)return;let a=r(s);return o.setQueryData(u.posts.entry(i),a),s}var je;(a=>{function e(c,p,l,d,m){jt(c,p,g=>({...g,active_votes:l,stats:{...g.stats||{gray:false,hide:false,flag_weight:0,total_votes:0},total_votes:l.length,flag_weight:g.stats?.flag_weight||0},total_votes:l.length,payout:d,pending_payout_value:String(d)}),m);}a.updateVotes=e;function t(c,p,l,d){jt(c,p,m=>({...m,reblogs:l}),d);}a.updateReblogsCount=t;function r(c,p,l,d){jt(c,p,m=>({...m,children:l}),d);}a.updateRepliesCount=r;function n(c,p,l,d){jt(p,l,m=>({...m,children:m.children+1,replies:[c,...m.replies]}),d);}a.addReply=n;function o(c,p){c.forEach(l=>Ap(l,p));}a.updateEntries=o;function i(c,p,l){(l??w()).invalidateQueries({queryKey:u.posts.entry(Lt(c,p))});}a.invalidateEntry=i;function s(c,p,l){return Pp(c,p,l)}a.getEntry=s;})(je||={});function Op(e,t,r){let n=e.some(o=>o.voter===t);return r!==0?n:!n}function xp(e,t,r){let n=je.getEntry(t.author,t.permlink,r);if(!n?.active_votes||Op(n.active_votes,e,t.weight))return;let o=[...n.active_votes.filter(s=>s.voter!==e),...t.weight!==0?[{rshares:t.weight,voter:e}]:[]],i=n.payout+(t.estimated??0);je.updateVotes(t.author,t.permlink,o,i,r);}function hx(e,t,r){return v(["posts","vote"],e,({author:n,permlink:o,weight:i})=>[Er(e,n,o,i)],async(n,o)=>{xp(e,o);let i=n?.id??n?.tx_id;if(t?.adapter?.recordActivity&&i&&t.adapter.recordActivity(120,i,n?.block_num).catch(()=>{}),t?.adapter?.invalidateQueries){let s=()=>{t.adapter.invalidateQueries([u.posts.entry(`/@${o.author}/${o.permlink}`),u.accounts.full(e)]);};(r??"async")==="async"?setTimeout(s,4e3):s();}},t,"posting",{broadcastMode:r??"async"})}function Px(e,t,r){return v(["posts","reblog"],e,({author:n,permlink:o,deleteReblog:i})=>[kr(e,n,o,i??false)],async(n,o)=>{let i=je.getEntry(o.author,o.permlink);if(i){let p=Math.max(0,(i.reblogs??0)+(o.deleteReblog?-1:1));je.updateReblogsCount(o.author,o.permlink,p);}let s=n?.id??n?.tx_id;t?.adapter?.recordActivity&&s&&t.adapter.recordActivity(130,s,n?.block_num).catch(()=>{});let a=()=>{w().invalidateQueries({queryKey:u.posts.accountPostsBlogPrefix(e)}),t?.adapter?.invalidateQueries&&t.adapter.invalidateQueries([u.posts.entry(`/@${o.author}/${o.permlink}`),u.posts.rebloggedBy(o.author,o.permlink)]);};(r??"async")==="async"?setTimeout(a,4e3):a();},t,"posting",{broadcastMode:r??"async"})}function Ep(e){return e.isUpdate?null:e.parentAuthor?110:100}function Ex(e,t,r){return v(["posts","comment"],e,n=>{let o=[];if(o.push(Ne(n.author,n.permlink,n.parentAuthor,n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true,beneficiaries:p=[]}=n.options,l=[];if(p.length>0){let d=[...p].sort((m,g)=>m.account.localeCompare(g.account));l.push([0,{beneficiaries:d.map(m=>({account:m.account,weight:m.weight}))}]);}o.push(Qe(n.author,n.permlink,i,s,a,c,l));}return o},async(n,o)=>{let i=!o.parentAuthor,s=Ep(o),a=n?.id??n?.tx_id;if(s!==null&&t?.adapter?.recordActivity&&a&&t.adapter.recordActivity(s,a,n?.block_num).catch(()=>{}),t?.adapter?.invalidateQueries){let c=[u.accounts.full(e),u.resourceCredits.account(e)];if(!i){c.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let p=o.rootAuthor||o.parentAuthor,l=o.rootPermlink||o.parentPermlink;c.push({predicate:d=>{let m=d.queryKey;return Array.isArray(m)&&m[0]==="posts"&&m[1]==="discussions"&&m[2]===p&&m[3]===l}});}await t.adapter.invalidateQueries(c);}},t,"posting",{broadcastMode:r})}function Cx(e,t,r,n){let o=n??w(),i=o.getQueriesData({predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="discussions"&&a[2]===t&&a[3]===r}});for(let[s,a]of i)a&&o.setQueryData(s,[e,...a]);}function ci(e,t,r,n,o){let i=o??w(),s=new Map,a=i.getQueriesData({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===r&&p[3]===n}});for(let[c,p]of a)p&&(s.set(c,p),i.setQueryData(c,p.filter(l=>l.author!==e||l.permlink!==t)));return s}function ui(e,t){let r=t??w();for(let[n,o]of e)r.setQueryData(n,o);}function Rx(e,t,r,n){let o=n??w(),i=`/@${e}/${t}`,s=o.getQueryData(u.posts.entry(i));return s&&o.setQueryData(u.posts.entry(i),{...s,...r}),s}function Tx(e,t,r,n){let o=n??w(),i=`/@${e}/${t}`;o.setQueryData(u.posts.entry(i),r);}function Kx(e,t,r){return v(["posts","deleteComment"],e,({author:n,permlink:o})=>[Sr(n,o)],async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.accounts.full(e)];if(o.parentAuthor&&o.parentPermlink){i.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let s=o.rootAuthor||o.parentAuthor,a=o.rootPermlink||o.parentPermlink;i.push({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===s&&p[3]===a}});}await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r,onMutate:async n=>{let o=n.rootAuthor||n.parentAuthor,i=n.rootPermlink||n.parentPermlink;return o&&i?{snapshots:ci(n.author,n.permlink,o,i)}:{}},onError:(n,o,i)=>{let{snapshots:s}=i??{};s&&ui(s);}})}function Qx(e,t,r){return v(["posts","cross-post"],e,n=>{let o=[];if(o.push(Ne(n.author,n.permlink,"",n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true}=n.options;o.push(Qe(n.author,n.permlink,i,s,a,c,[]));}return o},async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.accounts.full(e),{predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="posts-ranked"&&a[3]===o.parentPermlink}}];await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r??"async"})}function jx(e,t,r){return v(["posts","update-reply"],e,n=>{let o=[];if(o.push(Ne(n.author,n.permlink,n.parentAuthor,n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true,beneficiaries:p=[]}=n.options,l=[];if(p.length>0){let d=[...p].sort((m,g)=>m.account.localeCompare(g.account));l.push([0,{beneficiaries:d.map(m=>({account:m.account,weight:m.weight}))}]);}o.push(Qe(n.author,n.permlink,i,s,a,c,l));}return o},async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.resourceCredits.account(e)];i.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let s=o.rootAuthor||o.parentAuthor,a=o.rootPermlink||o.parentPermlink;i.push({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===s&&p[3]===a}}),await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r})}function Gx(e,t,r){return v(["ecency","promote"],e,({author:n,permlink:o,duration:i})=>[Xr(e,n,o,i)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([[...u.posts._promotedPrefix],[...u.points._prefix(e)],u.posts.entry(`/@${o.author}/${o.permlink}`)]);},t,"active",{broadcastMode:r})}var Sp=[3e3,3e3,3e3],kp=e=>new Promise(t=>setTimeout(t,e));async function Cp(e,t){return y("condenser_api.get_content",[e,t])}async function Rp(e,t,r=0,n){let o=n?.delays??Sp,i;try{i=await Cp(e,t);}catch{i=void 0;}if(i||r>=o.length)return;let s=o[r];return s>0&&await kp(s),Rp(e,t,r+1,n)}var Xe={};vt(Xe,{useRecordActivity:()=>tn});function Fp(){return typeof window<"u"&&window.location?{url:window.location.href,domain:window.location.host}:{url:"",domain:""}}function tn(e,t,r){return useMutation({mutationKey:["analytics",t],mutationFn:async()=>{if(!t)throw new Error("[SDK][Analytics] \u2013 no activity type provided");let n=_(),o=Fp(),i=r?.url??o.url,s=r?.domain??o.domain;try{await n(f.plausibleHost+"/api/event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,url:i,domain:s,props:{username:e}})});}catch{}}})}function oE(e){return queryOptions({queryKey:["analytics","discover-leaderboard",e],queryFn:async({signal:t})=>{let r=await fetch(f.privateApiHost+`/private-api/leaderboard/${e}`,{signal:t});if(!r.ok)throw new Error(`Failed to fetch leaderboard: ${r.status}`);return r.json()}})}function uE(e){return queryOptions({queryKey:["analytics","discover-curation",e],queryFn:async({signal:t})=>{let r=await fetch(f.privateApiHost+`/private-api/curation/${e}`,{signal:t});if(!r.ok)throw new Error(`Failed to fetch curation data: ${r.status}`);let n=await r.json(),o=n.map(s=>s.account),i=await y("condenser_api.get_accounts",[o]);for(let s=0;s<i.length;s++){let a=i[s],c=n[s],p=typeof a.vesting_shares=="string"?a.vesting_shares:a.vesting_shares.toString(),l=typeof a.received_vesting_shares=="string"?a.received_vesting_shares:a.received_vesting_shares.toString(),d=typeof a.delegated_vesting_shares=="string"?a.delegated_vesting_shares:a.delegated_vesting_shares.toString(),m=typeof a.vesting_withdraw_rate=="string"?a.vesting_withdraw_rate:a.vesting_withdraw_rate.toString(),g=parseFloat(p)+parseFloat(l)-parseFloat(d)-parseFloat(m);c.efficiency=c.hp/g;}return n.sort((s,a)=>a.efficiency-s.efficiency),n}})}function fE(e,t=[],r=["visitors","pageviews","visit_duration"],n){let o=[...t].sort(),i=[...r].sort();return queryOptions({queryKey:["analytics","page-stats",e,o,i,n],queryFn:async({signal:s})=>{let a=await fetch(f.privateApiHost+"/api/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({metrics:r,url:encodeURIComponent(e),dimensions:t,date_range:n}),signal:s});if(!a.ok)throw new Error(`Failed to fetch page stats: ${a.status}`);return a.json()},enabled:!!e,staleTime:0})}var $t="threespeakfund",bE=1100;function Kp(e){return /https?:\/\/([a-z0-9-]+\.)*3speak\.tv\/embed[?/]/i.test(e)}function wE(e,t){if(!Kp(t))return e;let r=e.find(n=>n.account===$t);return r&&r.weight===1100?e:r?e.map(n=>n.account===$t?{...n,weight:1100}:n):[...e,{account:$t,weight:1100}]}function vE(e){return e===$t}var on={};vt(on,{getAccountTokenQueryOptions:()=>nn,getAccountVideosQueryOptions:()=>Up});var rn={};vt(rn,{getDecodeMemoQueryOptions:()=>Np});function Np(e,t,r){return queryOptions({queryKey:["integrations","hivesigner","decode-memo",e],queryFn:async()=>{if(r)return new uo.Client({accessToken:r}).decode(t)}})}var pi={queries:rn};function nn(e,t){return queryOptions({queryKey:["integrations","3speak","authenticate",e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");let n=await _()(`https://studio.3speak.tv/mobile/login?username=${e}&hivesigner=true`,{headers:{"Content-Type":"application/json"}}),o=pi.queries.getDecodeMemoQueryOptions(e,(await n.json()).memo,t);await w().prefetchQuery(o);let{memoDecoded:i}=w().getQueryData(o.queryKey);return i.replace("#","")}})}function Up(e,t){return queryOptions({queryKey:["integrations","3speak","videos",e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");let r=nn(e,t);await w().prefetchQuery(r);let n=w().getQueryData(r.queryKey);if(!n)throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");return await(await _()("https://studio.3speak.tv/mobile/api/my-videos",{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}})).json()}})}var ME={queries:on};function jE(e){return queryOptions({queryKey:["integrations","hiveposh","links",e],retry:false,queryFn:async()=>{try{let r=await _()(`https://hiveposh.com/api/v0/linked-accounts/${e}`,{headers:{"Content-Type":"application/json"}});if(r.status===400&&(await r.json().catch(()=>({})))?.message==="User Not Connected"||!r.ok)return null;let n=await r.json();return {twitter:{username:n.twitter_username,profile:n.twitter_profile},reddit:{username:n.reddit_username,profile:n.reddit_profile}}}catch{return null}}})}function GE({url:e,dimensions:t=[],metrics:r=["visitors","pageviews","visit_duration"],filterBy:n="event:page",dateRange:o,enabled:i=true}){return queryOptions({queryKey:["integrations","plausible",e,t,r,n,o],queryFn:async()=>{let a=await _()(`${f.privateApiHost}/api/stats`,{method:"POST",body:JSON.stringify({metrics:r,url:encodeURIComponent(e),dimensions:t,filterBy:n,...o?{date_range:o}:{}}),headers:{"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Failed to fetch Plausible stats: ${a.status}`);return await a.json()},enabled:!!e&&i,retry:1})}function XE(){return queryOptions({queryKey:["resource-credits","stats"],queryFn:async()=>(await y("rc_api.get_rc_stats",{})).rc_stats})}function rS(e){return queryOptions({queryKey:["resource-credits","account",e],queryFn:async()=>(await y("rc_api.find_rc_accounts",{accounts:[e]})).rc_accounts,enabled:!!e})}function aS(){return queryOptions({queryKey:u.resourceCredits.resourceParams(),staleTime:1440*60*1e3,gcTime:1/0,queryFn:async()=>await y("rc_api.get_resource_params",{})})}var Wt=["resource_history_bytes","resource_new_accounts","resource_market_bytes","resource_state_bytes","resource_execution_time"];var Gp=11,zp=65,Jp=16,Ze=e=>BigInt(typeof e=="string"?e:Math.trunc(e));function sn(e,t,r,n){if(r<=0||n<=0)return 0;let o=Ze(e.coeff_a),i=Ze(e.coeff_b),s=Ze(e.shift),a=Ze(n)*o>>s;a+=1n,a*=Ze(r);let c=i+(t>0?Ze(t):0n);return c===0n?0:Number(a/c+1n)}function an({transactionBytes:e,permlinkLength:t,signatures:r=1,beneficiaries:n=0,hasCommentOptions:o=false},i){let s=i.resource_state_bytes,a=i.resource_execution_time;return {resource_history_bytes:e,resource_new_accounts:0,resource_market_bytes:0,resource_state_bytes:s.comment_base_size+s.comment_permlink_char_size*t+s.transaction_base_size+s.comment_beneficiaries_member_size*n,resource_execution_time:a.comment_time+a.transaction_time+a.verify_authority_time*r+(o?a.comment_options_time:0)}}var _e=e=>{let t=ut(e);return ye(t)+t},Yp=e=>1+_e(e.parent_author)+_e(e.parent_permlink)+_e(e.author)+_e(e.permlink)+_e(e.title)+_e(e.body)+_e(e.json_metadata),Xp=(e,t)=>{let r=t.beneficiaries??[],n=1+_e(e.author)+_e(e.permlink)+Jp+2+2;return n+=ye(r.length>0?1:0),r.length>0&&(n+=1+ye(r.length),r.forEach(o=>{n+=_e(o.account)+2;})),n};function cn({op:e,options:t,signatures:r=1}){let n=[Yp(e)];return t&&n.push(Xp(e,t)),Gp+ye(n.length)+n.reduce((o,i)=>o+i,0)+ye(r)+zp*r}var Zp={ready:false,cost:0,transactionBytes:0,breakdown:[]};function dS({op:e,options:t,rcParams:r,rcStats:n,signatures:o=1}){if(!r?.resource_params||!r.size_info||!n?.pool||!n.share)return Zp;let i=cn({op:e,options:t,signatures:o}),s=an({transactionBytes:i,permlinkLength:ut(e.permlink),signatures:o,beneficiaries:t?.beneficiaries?.length??0,hasCommentOptions:!!t},r.size_info),a=Number(n.regen),c=0,p=[];return Wt.forEach((l,d)=>{let m=r.resource_params[l],g=Number(n.pool[d]??0),h=Number(n.share[d]??0);if(!m||h<=0)return;let P=s[l]*Number(m.resource_dynamics_params.resource_unit??1),O=Number(BigInt(a)*BigInt(h)/10000n),T=sn(m.price_curve_params,g,P,O);c+=T,p.push({resource:l,usage:P,cost:T});}),{ready:true,cost:c,transactionBytes:i,breakdown:p}}function un(e,t,r){let n=Number(r.regen),o=0,i=[];return Wt.forEach((s,a)=>{let c=t.resource_params[s],p=Number(r.pool[a]??0),l=Number(r.share[a]??0);if(!c||l<=0)return;let d=e[s]*Number(c.resource_dynamics_params.resource_unit??1),m=Number(BigInt(n)*BigInt(l)/10000n),g=sn(c.price_curve_params,p,d,m);o+=g,i.push({resource:s,usage:d,cost:g});}),{cost:o,breakdown:i}}var el=11,tl=65,pn=e=>{let t=ut(e);return ye(t)+t},rl=()=>({resource_history_bytes:0,resource_new_accounts:0,resource_market_bytes:0,resource_state_bytes:0,resource_execution_time:0});function li(e,t=1){let r=1+pn(e.voter)+pn(e.author)+pn(e.permlink)+2;return el+ye(1)+r+ye(t)+tl*t}function di({transactionBytes:e,signatures:t=1},r){let n=r.resource_state_bytes,o=r.resource_execution_time;return {...rl(),resource_history_bytes:e,resource_state_bytes:n.vote_size+n.transaction_base_size,resource_execution_time:o.vote_time+o.transaction_time+o.verify_authority_time*t}}var fi={ready:false,currentMana:0,maxMana:0,avgCost:0,cost:0,transactionBytes:0,estimatedCost:0,willLikelyFail:false,deficit:0,remaining:0};function AS({rcAccount:e,rcStats:t,rcParams:r,operation:n,payload:o,fallback:i="minimal",buffer:s=1.2}){if(!e||!t?.ops)return fi;let{current_mana:a,max_mana:c}=Dt(e),p=nl(n,o,i,r,t);if(!p)return {...fi,currentMana:a,maxMana:c};let{cost:l,transactionBytes:d}=p,m=Number.isFinite(s)&&s>0?s:1.2,g=l*m,h=a<g;return {ready:true,currentMana:a,maxMana:c,avgCost:l,cost:l,transactionBytes:d,estimatedCost:g,willLikelyFail:h,deficit:h?Math.ceil(g-a):0,remaining:Math.floor(a/l)}}function nl(e,t,r,n,o){let i=ol(o,e);if(!(e==="comment_operation"||e==="vote_operation")||!t&&r==="average")return i;if(!n?.resource_params||!n.size_info||!o.pool||!o.share)return null;let a={pool:o.pool,regen:o.regen,share:o.share};if(e==="vote_operation"){let m=t?.kind==="vote"?t.op:sl,g=li(m),h=di({transactionBytes:g},n.size_info);return {cost:un(h,n,a).cost,transactionBytes:g}}let c=t?.kind==="comment"?t.op:il,p=t?.kind==="comment"?t.options:void 0,l=cn({op:c,options:p}),d=an({transactionBytes:l,permlinkLength:c.permlink.length,beneficiaries:p?.beneficiaries?.length??0,hasCommentOptions:!!p},n.size_info);return {cost:un(d,n,a).cost,transactionBytes:l}}function ol(e,t){let r=e.ops[t]?.avg_cost;return typeof r=="number"&&r>0?{cost:r,transactionBytes:0}:null}var il={author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa",parent_author:"",parent_permlink:"hive-100000",title:"",body:"",json_metadata:"{}"},sl={voter:"aaaaaaaaaa",author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa"};function SS(e,t,r){return queryOptions({queryKey:["games","status-check",r,e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Games] \u2013 missing auth");return await(await _()(f.privateApiHost+"/private-api/get-game",{method:"POST",body:JSON.stringify({game_type:r,code:t}),headers:{"Content-Type":"application/json"}})).json()}})}async function ul(e,t,r){let o=await _()(f.privateApiHost+"/private-api/post-game",{method:"POST",body:JSON.stringify({game_type:t,code:e,key:r}),headers:{"Content-Type":"application/json"}}),i=(o.headers.get("content-type")??"").split(";")[0].trim().toLowerCase(),s=await o.text();if(!o.ok){let a=s&&i.includes("json")?`: ${s.slice(0,200)}`:"";throw new Error(`[SDK][Games] \u2013 failed with status ${o.status}${a}`)}if(!i.includes("json"))throw new Error(`[SDK][Games] \u2013 expected JSON but received "${i||"empty"}" response (status ${o.status})`);try{return JSON.parse(s)}catch{throw new Error(`[SDK][Games] \u2013 malformed JSON response (status ${o.status})`)}}function FS(e,t,r,n){let{mutateAsync:o}=tn(e,"spin-rolled");return useMutation({mutationKey:["games","post",r,e],mutationFn:async()=>{if(!e||!t)throw new Error("[SDK][Games] \u2013 missing auth");return ul(t,r,n)},onSuccess(){o();}})}function KS(e){let t=e?.replace("@","");return queryOptions({queryKey:u.quests.status(t),enabled:!!t,queryFn:async()=>{if(!t)throw new Error("[SDK][Quests] \u2013 username wasn't provided");let n=await _()(f.privateApiHost+"/private-api/quests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t})});if(!n.ok)throw new Error(`Failed to fetch quests: ${n.status}`);return await n.json()},staleTime:3e4,refetchOnMount:true})}var ll=[{id:"checkin",tier:"daily",goal:1,i18nKey:"checkin",icon:"check-circle"},{id:"post",tier:"daily",goal:1,i18nKey:"post",icon:"pencil"},{id:"comment",tier:"daily",goal:3,i18nKey:"comment",icon:"comment"},{id:"vote",tier:"daily",goal:10,i18nKey:"vote",icon:"chevron-up-circle"},{id:"reblog",tier:"daily",goal:1,i18nKey:"reblog",icon:"repeat"},{id:"spin",tier:"daily",goal:1,i18nKey:"spin",icon:"gift"},{id:"post",tier:"weekly",goal:5,i18nKey:"post",icon:"pencil"},{id:"comment",tier:"weekly",goal:15,i18nKey:"comment",icon:"comment"},{id:"vote",tier:"weekly",goal:50,i18nKey:"vote",icon:"chevron-up-circle"},{id:"reblog",tier:"weekly",goal:5,i18nKey:"reblog",icon:"repeat"},{id:"post",tier:"monthly",goal:20,i18nKey:"post",icon:"pencil"}];function MS(e,t){return ll.find(r=>r.tier===e&&r.id===t)}var dl=25;function fl(e){return Array.from((e??"").replace(/https?:\/\/\S+/g,"")).length}function NS(e){return fl(e)>dl}var QS=300,HS=2;function yl(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}async function hl(e){let r=await _()(f.privateApiHost+"/private-api/streak-freeze/buy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,idempotency_key:yl()})});if(!r.ok){let n;try{n=await r.json();}catch{}let o=n?.message??`Failed to buy streak freeze: ${r.status}`,i=new Error(o);throw i.status=r.status,i.data=n,i}return await r.json()}function LS(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["streak-freeze","buy",n],mutationFn:async()=>{if(!n||!t)throw new Error("[SDK][StreakFreeze] \u2013 missing auth");return hl(t)},onSuccess(){n&&r.invalidateQueries({queryKey:u.points._prefix(n)});},onSettled(){n&&r.invalidateQueries({queryKey:u.quests.status(n)});}})}function zS(e,t,r){return v(["communities","subscribe"],e,({community:n})=>[Mr(e,n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.subscriptions(e),[...u.communities.singlePrefix(o.community)],u.communities.context(e,o.community)]);},t,"posting",{broadcastMode:r??"async"})}function ZS(e,t,r){return v(["communities","unsubscribe"],e,({community:n})=>[Nr(e,n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.subscriptions(e),[...u.communities.singlePrefix(o.community)],u.communities.context(e,o.community)]);},t,"posting",{broadcastMode:r??"sync"})}function nk(e,t,r){return v(["communities","mutePost"],e,({community:n,author:o,permlink:i,notes:s,mute:a})=>[Vr(e,n,o,i,s,a)],async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.posts.entry(`/@${o.author}/${o.permlink}`),["community","single",o.community],{predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="posts-ranked"&&a[3]===o.community}}];await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r??"sync"})}function ak(e,t,r,n){return v(["communities","set-role",e],t,({account:o,role:i})=>[Qr(t,e,o,i)],async(o,i)=>{w().setQueriesData({queryKey:u.communities.singlePrefix(e)},a=>{if(!a)return a;let c=[...a.team??[]],p=c.findIndex(([l])=>l===i.account);return p>=0?c[p]=[c[p][0],i.role,c[p][2]??""]:c.push([i.account,i.role,""]),{...a,team:c}}),r?.adapter?.invalidateQueries&&await r.adapter.invalidateQueries([[...u.communities.singlePrefix(e)],u.communities.context(i.account,e)]);},r,"posting",{broadcastMode:n??"async"})}function lk(e,t,r,n){return v(["communities","update",e],t,o=>[Hr(t,e,o)],async(o,i)=>{w().setQueriesData({queryKey:u.communities.singlePrefix(e)},a=>a&&{...a,...i}),r?.adapter?.invalidateQueries&&await r.adapter.invalidateQueries([[...u.communities.singlePrefix(e)]]);},r,"posting",{broadcastMode:n??"async"})}function gk(e,t,r){return v(["communities","registerRewards"],e,({name:n})=>[Zr(n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([[...u.communities.singlePrefix(o.name)],[...u.points._prefix(e)]]);},t,"active",{broadcastMode:r})}function bk(e,t,r){return v(["communities","pin-post"],e,({community:n,account:o,permlink:i,pin:s})=>[Ur(e,n,o,i,s)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.posts.entry(`/@${o.account}/${o.permlink}`),[...u.communities.singlePrefix(o.community)]]);},t,"posting",{broadcastMode:r??"async"})}function Ok(e,t,r=100,n=void 0,o=true){return queryOptions({queryKey:u.communities.list(e,t??"",r),enabled:o,queryFn:async()=>{let i=await y("bridge.list_communities",{last:"",limit:r,sort:e==="hot"?"rank":e,query:t||null,observer:n});return i?e==="hot"?i.sort(()=>Math.random()-.5):i:[]}})}function Ck(e,t){return queryOptions({queryKey:u.communities.context(e,t),enabled:!!e&&!!t,queryFn:async()=>{let r=await y("bridge.get_community_context",{account:e,name:t});return {role:r?.role??"guest",subscribed:r?.subscribed??false}}})}function qk(e,t="",r=true){return queryOptions({queryKey:u.communities.single(e,t),enabled:r&&!!e,queryFn:async()=>To(e??"",t)})}var mi=100;async function gi(e,t){return await y("bridge.list_subscribers",{community:e,limit:mi,...t?{last:t}:{}})??[]}function Qk(e){return queryOptions({queryKey:u.communities.subscribers(e),queryFn:async()=>gi(e,null),staleTime:6e4})}function Hk(e){return infiniteQueryOptions({queryKey:u.communities.subscribersInfinite(e),initialPageParam:null,queryFn:async({pageParam:t})=>gi(e,t),getNextPageParam:t=>t?.length>=mi?t[t.length-1]?.[0]??null:null,staleTime:6e4})}function Wk(e,t){return infiniteQueryOptions({queryKey:u.communities.accountNotifications(e,t),initialPageParam:null,queryFn:async({pageParam:r})=>await y("bridge.account_notifications",{account:e,limit:t,last_id:r??void 0})??[],getNextPageParam:r=>r?.length>=t?r[r.length-1].id:null})}function Yk(){return queryOptions({queryKey:u.communities.rewarded(),queryFn:async()=>{let e=await fetch(f.privateApiHost+"/private-api/rewarded-communities",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch rewarded communities: ${e.status}`);return e.json()}})}var xl=(s=>(s.OWNER="owner",s.ADMIN="admin",s.MOD="mod",s.MEMBER="member",s.GUEST="guest",s.MUTED="muted",s))(xl||{}),Zk={owner:["admin","mod","member","guest","muted"],admin:["mod","member","guest","muted"],mod:["member","guest","muted"]};function tC(e,t){return e.startsWith("hive-3")||t===3?"Council":e.startsWith("hive-2")||t===2?"Journal":"Topic"}function rC({communityType:e,userRole:t,subscribed:r}){let n=t==="muted"?false:e==="Topic"?true:["owner","admin","mod","member"].includes(t),o=(()=>{if(t==="muted")return false;switch(e){case "Topic":return true;case "Journal":return t!=="guest"||r;case "Council":return n}})(),i=["owner","admin","mod"].includes(t);return {canPost:n,canComment:o,isModerator:i}}function sC(e,t){return queryOptions({queryKey:u.notifications.unreadCount(e),queryFn:async()=>t?(await(await fetch(`${f.privateApiHost}/private-api/notifications/unread`,{method:"POST",body:JSON.stringify({code:t}),headers:{"Content-Type":"application/json"}})).json()).count:0,enabled:!!e&&!!t,initialData:0,refetchInterval:6e4})}function pC(e,t,r=void 0){return infiniteQueryOptions({queryKey:u.notifications.list(e,r),queryFn:async({pageParam:n})=>{if(!t)return [];let o={code:t,filter:r,since:n,user:void 0},i=await fetch(f.privateApiHost+"/private-api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)return [];try{return await i.json()}catch{return []}},enabled:!!e&&!!t,initialPageParam:"",getNextPageParam:n=>n?.[n.length-1]?.id??"",refetchOnMount:true})}var kl=(g=>(g.VOTES="rvotes",g.MENTIONS="mentions",g.FAVORITES="nfavorites",g.BOOKMARKS="nbookmarks",g.FOLLOWS="follows",g.REPLIES="replies",g.REBLOGS="reblogs",g.TRANSFERS="transfers",g.DELEGATIONS="delegations",g.PAYOUTS="payouts",g.SCHEDULED_PUBLISHED="scheduled_published",g.ACCOUNT_UPDATES="account_updates",g.WEEKLY_EARNINGS="weekly_earnings",g))(kl||{});var Cl=(h=>(h[h.VOTE=1]="VOTE",h[h.MENTION=2]="MENTION",h[h.FOLLOW=3]="FOLLOW",h[h.COMMENT=4]="COMMENT",h[h.RE_BLOG=5]="RE_BLOG",h[h.TRANSFERS=6]="TRANSFERS",h[h.DELEGATIONS=10]="DELEGATIONS",h[h.FAVORITES=13]="FAVORITES",h[h.BOOKMARKS=15]="BOOKMARKS",h[h.PAYOUTS=19]="PAYOUTS",h[h.ACCOUNT_UPDATE=20]="ACCOUNT_UPDATE",h[h.WEEKLY_EARNINGS=21]="WEEKLY_EARNINGS",h[h.SCHEDULED_PUBLISHED=22]="SCHEDULED_PUBLISHED",h.ALLOW_NOTIFY="ALLOW_NOTIFY",h))(Cl||{}),yi=[1,2,3,4,5,6,10,13,15,19,20,21,22],Rl=(n=>(n.ALL="All",n.UNREAD="Unread",n.READ="Read",n))(Rl||{});function hC(e,t,r){return queryOptions({queryKey:u.notifications.settings(e),queryFn:async()=>{let n=e+"-web";if(!t)throw new Error("Missing access token");let o=await fetch(f.privateApiHost+"/private-api/detail-device",{body:JSON.stringify({code:t,username:e,token:n}),method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to fetch notification settings: ${o.status}`);return o.json()},enabled:!!e&&!!t,refetchOnMount:false,initialData:()=>({status:0,system:"web",allows_notify:0,notify_types:r?[]:[...yi]})})}function vC(){return queryOptions({queryKey:u.notifications.announcements(),queryFn:async()=>{let e=await fetch(f.privateApiHost+"/private-api/announcements",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch announcements: ${e.status}`);return await e.json()||[]},staleTime:36e5})}function xC(e){return queryOptions({queryKey:u.notifications.spotlights(),queryFn:async()=>{let t=await fetch(f.privateApiHost+"/private-api/spotlights",{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to fetch spotlights: ${t.status}`);return await t.json()||[]},staleTime:36e5})}function Dl(e,t){return {...e,read:!t||t===e.id?1:e.read}}function hi(e){return typeof e=="object"&&e!==null&&"pages"in e&&"pageParams"in e&&Array.isArray(e.pages)}function FC(e,t,r,n){let o=w();return useMutation({mutationKey:["notifications","mark-read",e],mutationFn:async({id:i})=>{if(!e||!t){process.env.NODE_ENV!=="production"&&console.warn("[SDK][Notifications] \u2013 missing auth for markNotifications");return}return Xo(t,i)},onMutate:async({id:i})=>{if(!e||!t)return {previousData:[]};await o.cancelQueries({queryKey:u.notifications._prefix});let s=[],a=o.getQueriesData({queryKey:u.notifications._prefix,predicate:l=>{let d=l.state.data;return hi(d)}});a.forEach(([l,d])=>{if(d&&hi(d)){s.push([l,d]);let m={...d,pages:d.pages.map(g=>g.map(h=>Dl(h,i)))};o.setQueryData(l,m);}});let c=u.notifications.unreadCount(e),p=o.getQueryData(c);return typeof p=="number"&&p>0&&(s.push([c,p]),i?a.some(([,d])=>d?.pages.some(m=>m.some(g=>g.id===i&&g.read===0)))&&o.setQueryData(c,p-1):o.setQueryData(c,0)),{previousData:s}},onSuccess:i=>{let s=typeof i=="object"&&i!==null?i.unread:void 0;typeof s=="number"&&o.setQueryData(u.notifications.unreadCount(e),s),r?.(s);},onError:(i,s,a)=>{a?.previousData&&a.previousData.forEach(([c,p])=>{o.setQueryData(c,p);}),n?.(i);},onSettled:()=>{o.invalidateQueries({queryKey:u.notifications._prefix});}})}function KC(e,t,r){return v(["notifications","set-last-read"],e,({date:n})=>Ir(e,n),async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.notifications.unreadCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function QC(e){return queryOptions({queryKey:["proposals","proposal",e],queryFn:async()=>{let r=(await y("condenser_api.find_proposals",[[e]]))[0];return new Date(r.start_date)<new Date&&new Date(r.end_date)>=new Date?r.status="active":new Date(r.end_date)<new Date?r.status="expired":r.status="inactive",r}})}function jC(){return queryOptions({queryKey:["proposals","list"],queryFn:async()=>{let t=(await y("database_api.list_proposals",{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"all"})).proposals,r=t.filter(o=>o.status==="expired");return [...t.filter(o=>o.status!=="expired"),...r]}})}function JC(e,t,r){return infiniteQueryOptions({queryKey:["proposals","votes",e,t,r],initialPageParam:t,refetchOnMount:true,staleTime:0,queryFn:async({pageParam:n})=>{let s=(await y("condenser_api.list_proposal_votes",[[e,n??t],r,"by_proposal_voter"])).filter(l=>l.proposal?.proposal_id===e).map(l=>({id:l.id,voter:l.voter})),a=await y("condenser_api.get_accounts",[s.map(l=>l.voter)]),c=Nt(a);return s.map(l=>({...l,voterAccount:c.find(d=>l.voter===d.name)}))},getNextPageParam:n=>n?.[n.length-1]?.voter??void 0})}function eR(e){return queryOptions({queryKey:["proposals","votes","by-user",e],enabled:!!e&&e!=="",staleTime:60*1e3,queryFn:async()=>!e||e===""?[]:((await y("database_api.list_proposal_votes",{start:[e],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"votable"})).proposal_votes||[]).filter(n=>n.voter===e)})}function oR(e,t,r){return v(["proposals","vote"],e,({proposalIds:n,approve:o})=>[Br(e,n,o)],async n=>{try{let o=n?.id??n?.tx_id;t?.adapter?.recordActivity&&o&&t.adapter.recordActivity(150,o,n?.block_num).catch(i=>{console.debug("[SDK][Proposals][useProposalVote] recordActivity failed",{activityType:150,blockNum:n?.block_num,transactionId:o,error:i});}),t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.proposals.list(),u.proposals.votesByUser(e)]);}catch(o){console.warn("[useProposalVote] Post-broadcast side-effect failed:",o);}},t,"active",{broadcastMode:r})}function cR(e,t,r){return v(["proposals","create"],e,n=>[Kr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.proposals.list()]);},t,"active",{broadcastMode:r})}function dR(e,t=50){return infiniteQueryOptions({queryKey:["wallet","vesting-delegations",e,t],initialPageParam:"",queryFn:async({pageParam:r})=>{let n=r?t+1:t,o=await y("condenser_api.get_vesting_delegations",[e,r||"",n]);return r&&o.length>0&&o[0]?.delegatee===r?o.slice(1,t+1):o},getNextPageParam:r=>!r||r.length<t?void 0:r[r.length-1]?.delegatee,enabled:!!e})}function yR(e){return queryOptions({queryKey:["assets","account-delegations",e],enabled:!!e,queryFn:({signal:t})=>te("balance","/accounts/{account-name}/delegations",{"account-name":e},void 0,void 0,t)})}function wR(e){return queryOptions({queryKey:["wallet","vesting-delegation-expirations",e],queryFn:async()=>e?(await y("database_api.find_vesting_delegation_expirations",{account:e})).delegations:[],enabled:!!e})}function OR(e){return queryOptions({queryKey:["wallet","conversion-requests",e],queryFn:()=>y("condenser_api.get_conversion_requests",[e]),select:t=>t.sort((r,n)=>r.requestid-n.requestid)})}function kR(e){return queryOptions({queryKey:["wallet","collateralized-conversion-requests",e],queryFn:()=>y("condenser_api.get_collateralized_conversion_requests",[e]),select:t=>t.sort((r,n)=>r.requestid-n.requestid)})}function FR(e){return queryOptions({queryKey:["wallet","savings-withdraw",e],queryFn:()=>y("condenser_api.get_savings_withdraw_from",[e]),select:t=>t.sort((r,n)=>r.request_id-n.request_id)})}function KR(e){return queryOptions({queryKey:["wallet","withdraw-routes",e],queryFn:()=>y("condenser_api.get_withdraw_routes",[e,"outgoing"])})}function QR(e){return queryOptions({queryKey:["wallet","open-orders",e],queryFn:()=>y("condenser_api.get_open_orders",[e]),select:t=>t.sort((r,n)=>r.orderid-n.orderid),enabled:!!e})}function LR(e,t=100){return infiniteQueryOptions({queryKey:["wallet","outgoing-rc-delegations",e,t],initialPageParam:null,queryFn:async({pageParam:r})=>{let o=(await y("rc_api.list_rc_direct_delegations",{start:[e,r??""],limit:t}).then(i=>i)).rc_direct_delegations||[];return r&&(o=o.filter(i=>i.to!==r)),o},getNextPageParam:r=>r.length===t?r[r.length-1].to:null})}function zR(e){return queryOptions({queryKey:["wallet","incoming-rc",e],enabled:!!e,queryFn:async()=>{if(!e)throw new Error("[SDK][Wallet] - Missing username for incoming RC");let r=await _()(`${f.privateApiHost}/private-api/received-rc/${e}`);if(!r.ok)throw new Error(`Failed to fetch incoming RC: ${r.status}`);return r.json()}})}function ZR(e){return queryOptions({queryKey:["wallet","received-vesting-shares",e],queryFn:async()=>{let t=await fetch(f.privateApiHost+`/private-api/received-vesting/${e}`);if(!t.ok)throw new Error(`Failed to fetch received vesting shares: ${t.status}`);return (await t.json()).list}})}function nT(e){return queryOptions({queryKey:["wallet","recurrent-transfers",e],queryFn:()=>y("condenser_api.find_recurrent_transfers",[e]),enabled:!!e})}function fe(e){if(typeof e=="string"){let t=e.trim();return t.length>0?t:void 0}}function ce(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t=e.trim();if(!t)return;let r=Number.parseFloat(t);if(Number.isFinite(r))return r;let o=t.replace(/,/g,"").match(/[-+]?\d+(?:\.\d+)?/);if(o){let i=Number.parseFloat(o[0]);if(Number.isFinite(i))return i}}}function Zl(e){if(!e||typeof e!="object")return;let t=e;return {name:fe(t.name)??"",symbol:fe(t.symbol)??"",layer:fe(t.layer)??"hive",balance:ce(t.balance)??0,fiatRate:ce(t.fiatRate)??0,currency:fe(t.currency)??"usd",precision:ce(t.precision)??3,address:fe(t.address),error:fe(t.error),pendingRewards:ce(t.pendingRewards),pendingRewardsFiat:ce(t.pendingRewardsFiat),liquid:ce(t.liquid),liquidFiat:ce(t.liquidFiat),savings:ce(t.savings),savingsFiat:ce(t.savingsFiat),staked:ce(t.staked),stakedFiat:ce(t.stakedFiat),iconUrl:fe(t.iconUrl),actions:t.actions??[],extraData:t.extraData??[],apr:ce(t.apr)}}function ed(e){if(!e||typeof e!="object")return [];let t=[e],r=e;r.data&&typeof r.data=="object"&&t.push(r.data),r.result&&typeof r.result=="object"&&t.push(r.result),r.portfolio&&typeof r.portfolio=="object"&&t.push(r.portfolio);for(let n of t){if(Array.isArray(n))return n;if(n&&typeof n=="object")for(let o of ["wallets","tokens","assets","items","portfolio","balances"]){let i=n[o];if(Array.isArray(i))return i}}return []}function td(e){if(!e||typeof e!="object")return;let t=e;return fe(t.username)??fe(t.name)??fe(t.account)}function _i(e,t="usd",r=true){return queryOptions({queryKey:["wallet","portfolio","v2",e,r?"only-enabled":"all",t],enabled:!!e,staleTime:6e4,refetchInterval:12e4,queryFn:async()=>{if(!e)throw new Error("[SDK][Wallet] \u2013 username is required");let n=`${Q.getValidatedBaseUrl()}/wallet-api/portfolio-v2`,o=await fetch(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({username:e,onlyEnabled:r,currency:t})});if(!o.ok)throw new Error(`[SDK][Wallet] \u2013 Portfolio request failed (${o.status})`);let i=await o.json(),s=ed(i).map(a=>Zl(a)).filter(a=>!!a).filter(a=>a.layer!=="spk");if(!s.length)throw new Error("[SDK][Wallet] \u2013 Portfolio payload contained no tokens");return {username:td(i)??e,currency:fe(i?.fiatCurrency??i?.currency)?.toUpperCase(),wallets:s}}})}function Gt(e){return queryOptions({queryKey:["assets","hive","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await w().prefetchQuery(Oe()),await w().prefetchQuery(M(e));let t=w().getQueryData(Oe().queryKey),r=w().getQueryData(M(e).queryKey),n=await y("condenser_api.get_ticker",[]).catch(()=>{}),o=Number.parseFloat(n?.latest??"");if(!r)return {name:"HIVE",title:"Hive",price:Number.isFinite(o)?o:t?t.base/t.quote:0,accountBalance:0};let i=k(r.balance).amount,s=k(r.savings_balance).amount;return {name:"HIVE",title:"Hive",price:Number.isFinite(o)?o:t?t.base/t.quote:0,accountBalance:i+s,parts:[{name:"current",balance:i},{name:"savings",balance:s}]}}})}function bi(e){return queryOptions({queryKey:["assets","hbd","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await w().prefetchQuery(Oe()),await w().prefetchQuery(M(e));let t=w().getQueryData(M(e).queryKey),r=w().getQueryData(Oe().queryKey),n=1;return t?{name:"HBD",title:"Hive Dollar",price:n,accountBalance:k(t.hbd_balance).amount+k(t?.savings_hbd_balance).amount,apr:((r?.hbdInterestRate??0)/100).toFixed(3),parts:[{name:"current",balance:k(t.hbd_balance).amount},{name:"savings",balance:k(t.savings_hbd_balance).amount}]}:{name:"HBD",title:"Hive Dollar",price:n,accountBalance:0}}})}function id(e){let c=9.5-(e.headBlock-7e6)/25e4*.01;c<.95&&(c=.95);let p=e.vestingRewardPercent/1e4,l=e.virtualSupply,d=e.totalVestingFund;return (l*c*p/d).toFixed(3)}function wi(e){return queryOptions({queryKey:["assets","hive-power","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await w().prefetchQuery(Oe()),await w().prefetchQuery(M(e));let t=w().getQueryData(Oe().queryKey),r=w().getQueryData(M(e).queryKey);if(!t||!r)return {name:"HP",title:"Hive Power",price:0,accountBalance:0};let n=await y("condenser_api.get_ticker",[]).catch(()=>{}),o=Number.parseFloat(n?.latest??""),i=Number.isFinite(o)?o:t.base/t.quote,s=k(r.vesting_shares).amount,a=k(r.delegated_vesting_shares).amount,c=k(r.received_vesting_shares).amount,p=k(r.vesting_withdraw_rate).amount,l=Math.max((Number(r.to_withdraw)-Number(r.withdrawn))/1e6,0),d=go(r.next_vesting_withdrawal)?0:Math.min(p,l),m=+We(s,t.hivePerMVests).toFixed(3),g=+We(a,t.hivePerMVests).toFixed(3),h=+We(c,t.hivePerMVests).toFixed(3),P=+We(l,t.hivePerMVests).toFixed(3),O=+We(d,t.hivePerMVests).toFixed(3),T=Math.max(m-P,0),F=Math.max(m-g,0);return {name:"HP",title:"Hive Power",price:i,accountBalance:+T.toFixed(3),apr:id(t),parts:[{name:"hp_balance",balance:m},{name:"available",balance:+F.toFixed(3)},{name:"outgoing_delegations",balance:g},{name:"incoming_delegations",balance:h},...P>0?[{name:"pending_power_down",balance:+P.toFixed(3)}]:[],...O>0&&O!==P?[{name:"next_power_down",balance:+O.toFixed(3)}]:[]]}}})}var B=ne.operations,ln={transfers:[B.transfer,B.transfer_to_savings,B.transfer_from_savings,B.cancel_transfer_from_savings,B.recurrent_transfer,B.fill_recurrent_transfer,B.escrow_transfer,B.fill_recurrent_transfer],"market-orders":[B.fill_convert_request,B.fill_order,B.fill_collateralized_convert_request,B.limit_order_create2,B.limit_order_create,B.limit_order_cancel],interests:[B.interest],"stake-operations":[B.return_vesting_delegation,B.withdraw_vesting,B.transfer_to_vesting,B.set_withdraw_vesting_route,B.update_proposal_votes,B.fill_vesting_withdraw,B.account_witness_proxy,B.delegate_vesting_shares],rewards:[B.author_reward,B.curation_reward,B.producer_reward,B.claim_reward_balance,B.comment_benefactor_reward,B.liquidity_reward,B.proposal_pay],"":[]};var kT=Object.keys(ne.operations);var vi=ne.operations,TT=vi,FT=Object.entries(vi).reduce((e,[t,r])=>(e[r]=t,e),{});var Pi=ne.operations;function ad(e){return Object.prototype.hasOwnProperty.call(Pi,e)}function ht(e){let t=Array.isArray(e)?e:[e],r=t.includes(""),n=Array.from(new Set(t.filter(a=>a!=null&&a!==""))),o=r||n.length===0?"all":n.map(a=>a.toString()).sort().join("|"),i=new Set;r||n.forEach(a=>{if(a in ln){ln[a].forEach(c=>i.add(c));return}ad(a)&&i.add(Pi[a]);});let s=pd(Array.from(i));return {filterKey:o,filterArgs:s}}function dn(e){let t=Array.isArray(e)?e:[e];return new Set(t.filter(r=>r!=null&&r!==""))}function cd(e){if(!e?.length)return;let t=Number(e[0]?.num??0);return Number.isFinite(t)&&t>0?t-1:void 0}function ud(e,t){return !Number.isFinite(e)||e<0?t:Math.min(t,e+1)}function pd(e){let t=0n,r=0n;return e.forEach(n=>{n<64?t|=1n<<BigInt(n):r|=1n<<BigInt(n-64);}),[t!==0n?t.toString():null,r!==0n?r.toString():null]}function zt(e,t=20,r=[]){let{filterArgs:n,filterKey:o}=ht(r),i=dn(r);return infiniteQueryOptions({queryKey:["assets","hive","transactions",e,t,o],initialPageParam:-1,getNextPageParam:cd,queryFn:async({pageParam:s})=>(await y("condenser_api.get_account_history",[e,s,ud(Number(s),t),...n])).map(c=>({num:c[0],type:c[1].op[0],timestamp:c[1].timestamp,trx_id:c[1].trx_id,...c[1].op[1]})),select:({pages:s,pageParams:a})=>({pageParams:a,pages:s.map(c=>c.filter(p=>{switch(p.type){case "author_reward":case "comment_benefactor_reward":return k(p.hive_payout).amount>0;case "transfer":case "transfer_to_savings":case "transfer_to_vesting":case "recurrent_transfer":return k(p.amount).symbol==="HIVE";case "transfer_from_savings":case "fill_transfer_from_savings":return k(p.amount).symbol==="HIVE";case "fill_recurrent_transfer":let d=k(p.amount);return ["HIVE"].includes(d.symbol);case "claim_reward_balance":return k(p.reward_hive).amount>0;case "curation_reward":case "cancel_transfer_from_savings":case "fill_order":case "limit_order_create":case "limit_order_cancel":case "fill_convert_request":case "fill_collateralized_convert_request":return true;case "limit_order_create2":return true;default:return i.has(p.type)}}))})})}function VT(e,t=20,r=[]){let{filterKey:n}=ht(r),o=dn(r);return infiniteQueryOptions({...zt(e,t,r),queryKey:["assets","hbd","transactions",e,t,n],select:({pages:i,pageParams:s})=>({pageParams:s,pages:i.map(a=>a.filter(c=>{switch(c.type){case "author_reward":case "comment_benefactor_reward":return k(c.hbd_payout).amount>0;case "claim_reward_balance":return k(c.reward_hbd).amount>0;case "transfer":case "transfer_to_savings":case "transfer_to_vesting":case "recurrent_transfer":return k(c.amount).symbol==="HBD";case "transfer_from_savings":case "fill_transfer_from_savings":return k(c.amount).symbol==="HBD";case "fill_recurrent_transfer":let d=k(c.amount);return ["HBD"].includes(d.symbol);case "cancel_transfer_from_savings":case "fill_order":case "limit_order_create":case "limit_order_cancel":case "fill_convert_request":case "fill_collateralized_convert_request":case "proposal_pay":case "interest":return true;case "limit_order_create2":return true;default:return o.has(c.type)}}))})})}function GT(e,t=20,r=[]){let{filterKey:n}=ht(r),o=new Set(Array.isArray(r)?r:[r]),i=o.has("")||o.size===0;return infiniteQueryOptions({...zt(e,t,r),queryKey:["assets","hive-power","transactions",e,t,n],select:({pages:s,pageParams:a})=>({pageParams:a,pages:s.map(c=>c.filter(p=>{switch(p.type){case "author_reward":case "comment_benefactor_reward":return k(p.vesting_payout).amount>0;case "claim_reward_balance":return k(p.reward_vests).amount>0;case "transfer_to_vesting":return true;case "transfer":case "transfer_to_savings":case "recurrent_transfer":return ["VESTS","HP"].includes(k(p.amount).symbol);case "fill_recurrent_transfer":let m=k(p.amount);return ["VESTS","HP"].includes(m.symbol);case "curation_reward":case "withdraw_vesting":case "delegate_vesting_shares":case "fill_vesting_withdraw":case "return_vesting_delegation":case "producer_reward":case "set_withdraw_vesting_route":return true;default:return i||o.has(p.type)}}))})})}function Ai(e){let t=r=>r.toString().padStart(2,"0");return `${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function fn(e,t){return new Date(e.getTime()-t*1e3)}function XT(e=86400){return infiniteQueryOptions({queryKey:["assets","hive","metrics",e],queryFn:async({pageParam:[t,r]})=>(await y("condenser_api.get_market_history",[e,Ai(t),Ai(r)])).map(({hive:o,non_hive:i,open:s})=>({close:i.close/o.close,open:i.open/o.open,low:i.low/o.low,high:i.high/o.high,volume:o.volume,time:new Date(s)})),initialPageParam:[fn(new Date,Math.max(100*e,28800)),new Date],getNextPageParam:(t,r,[n])=>[fn(n,Math.max(100*e,28800)),fn(n,e)]})}function rF(e){return queryOptions({queryKey:["assets","hive","withdrawal-routes",e],queryFn:()=>y("condenser_api.get_withdraw_routes",[e,"outgoing"]),enabled:!!e})}function sF(e,t=50){return queryOptions({queryKey:["assets","hive-power","delegates",e],enabled:!!e,queryFn:()=>y("condenser_api.get_vesting_delegations",[e,"",t])})}function lF(e){return queryOptions({queryKey:["assets","hive-power","delegatings",e],queryFn:async()=>(await(await fetch(f.privateApiHost+`/private-api/received-vesting/${e}`,{headers:{"Content-Type":"application/json"}})).json()).list,select:t=>t.sort((r,n)=>k(n.vesting_shares).amount-k(r.vesting_shares).amount)})}function gF(e=500){return queryOptions({queryKey:["market","order-book",e],queryFn:()=>y("condenser_api.get_order_book",[e])})}function bF(){return queryOptions({queryKey:["market","statistics"],queryFn:()=>y("condenser_api.get_ticker",[])})}function AF(e,t,r){let n=o=>o.toISOString().replace(/\.\d{3}Z$/,"");return queryOptions({queryKey:["market","history",e,t.getTime(),r.getTime()],queryFn:()=>y("condenser_api.get_market_history",[e,n(t),n(r)])})}function SF(){return queryOptions({queryKey:["market","hive-hbd-stats"],queryFn:async()=>{let e=await y("condenser_api.get_ticker",[]),t=new Date,r=new Date(t.getTime()-864e5),n=s=>s.toISOString().replace(/\.\d{3}Z$/,""),o=await y("condenser_api.get_market_history",[86400,n(r),n(t)]);return {price:+e.latest,close:o[0]?o[0].non_hive.open/o[0].hive.open:0,high:o[0]?o[0].non_hive.high/o[0].hive.high:0,low:o[0]?o[0].non_hive.low/o[0].hive.low:0,percent:o[0]?100-o[0].non_hive.open/o[0].hive.open*100/+e.latest:0,totalFromAsset:e.hive_volume.split(" ")[0],totalToAsset:e.hbd_volume.split(" ")[0]}}})}function TF(e,t,r,n){return queryOptions({queryKey:["market","data",e,t,r,n],queryFn:async({signal:o})=>{let i=_(),s=`https://api.coingecko.com/api/v3/coins/${e}/market_chart/range?vs_currency=${t}&from=${r}&to=${n}`,a=await i(s,{signal:o});if(!a.ok)throw new Error(`Failed to fetch market data: ${a.status}`);return a.json()}})}function Oi(e){return e.toISOString().replace(/\.\d{3}Z$/,"")}function DF(e=1e3,t,r){let n=r??new Date,o=t??new Date(n.getTime()-600*60*1e3);return queryOptions({queryKey:["market","trade-history",e,o.getTime(),n.getTime()],queryFn:()=>y("condenser_api.get_trade_history",[Oi(o),Oi(n),e])})}function NF(){return queryOptions({queryKey:["market","feed-history"],queryFn:async()=>{try{return await y("condenser_api.get_feed_history",[])}catch(e){throw e}}})}function VF(){return queryOptions({queryKey:["market","current-median-history-price"],queryFn:async()=>{try{return await y("condenser_api.get_current_median_history_price",[])}catch(e){throw e}}})}function WF(e,t,r){return v(["market","limit-order-create"],e,n=>[Vt(e,n.amountToSell,n.minToReceive,n.fillOrKill,n.expiration,n.orderId)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.wallet.openOrders(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function YF(e,t,r){return v(["market","limit-order-cancel"],e,({orderId:n})=>[jr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.wallet.openOrders(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}async function _t(e){let t=await e.json();if(!e.ok){let r=new Error(`Request failed with status ${e.status}`);throw r.status=e.status,r.data=t,r}return t}async function eI(e,t,r,n){let o=_(),i=`https://api.coingecko.com/api/v3/coins/${e}/market_chart/range?vs_currency=${t}&from=${r}&to=${n}`,s=await o(i);return _t(s)}async function xi(e){if(e==="hbd")return 1;let t=_(),r=`https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${e}`,n=await t(r);return (await _t(n)).hive_dollar[e]}async function tI(e,t){let n=await _()(f.privateApiHost+`/private-api/market-data/${e==="hbd"?"usd":e}/${t}`);return _t(n)}async function rI(){let t=await _()(f.privateApiHost+"/private-api/market-data/latest");return _t(t)}async function nI(){let t=await _()("https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd");return _t(t)}var xd={"Content-type":"application/json"};async function Ed(e){let t=_(),r=Q.getValidatedBaseUrl(),n=await t(`${r}/private-api/engine-api`,{method:"POST",body:JSON.stringify(e),headers:xd});if(!n.ok)throw new Error(`[SDK][HiveEngine] \u2013 request failed with ${n.status}`);return (await n.json()).result}async function Te(e,t){try{return await Ed(e)}catch{return t}}async function sI(e,t=50){let r={jsonrpc:"2.0",method:"find",params:{contract:"market",query:{symbol:e},limit:t,offset:0},id:1},[n,o]=await Promise.all([Te({...r,params:{...r.params,table:"buyBook",indexes:[{index:"price",descending:true}]}},[]),Te({...r,params:{...r.params,table:"sellBook",indexes:[{index:"price",descending:false}]}},[])]),i=a=>a.sort((c,p)=>{let l=Number(c.price??0);return Number(p.price??0)-l}),s=a=>a.sort((c,p)=>{let l=Number(c.price??0),d=Number(p.price??0);return l-d});return {buy:i(n),sell:s(o)}}async function aI(e,t=50){return Te({jsonrpc:"2.0",method:"find",params:{contract:"market",table:"tradesHistory",query:{symbol:e},limit:t,offset:0,indexes:[{index:"timestamp",descending:true}]},id:1},[])}async function cI(e,t,r=100){let n={jsonrpc:"2.0",method:"find",params:{contract:"market",query:{symbol:t,account:e},limit:r,offset:0},id:1},[o,i]=await Promise.all([Te({...n,params:{...n.params,table:"buyBook",indexes:[{index:"timestamp",descending:true}]}},[]),Te({...n,params:{...n.params,table:"sellBook",indexes:[{index:"timestamp",descending:true}]}},[])]),s=(p,l)=>(Number(p||0)*Number(l||0)).toFixed(8),a=o.map(p=>({id:p.txId,type:"buy",account:p.account,symbol:p.symbol,quantity:p.quantity,price:p.price,total:p.tokensLocked??s(p.quantity,p.price),timestamp:Number(p.timestamp??0)})),c=i.map(p=>({id:p.txId,type:"sell",account:p.account,symbol:p.symbol,quantity:p.quantity,price:p.price,total:s(p.quantity,p.price),timestamp:Number(p.timestamp??0)}));return [...a,...c].sort((p,l)=>l.timestamp-p.timestamp)}async function Sd(e,t){if(Array.isArray(e)&&e.length===0)return [];let r=Array.isArray(e)?{symbol:{$in:e}}:e?{symbol:e}:{};return Te({jsonrpc:"2.0",method:"find",params:{contract:"market",table:"metrics",query:{...r,...t?{account:t}:{}}},id:1},[])}async function et(e,t){return Sd(t,e)}async function Jt(e){return Te({jsonrpc:"2.0",method:"find",params:{contract:"tokens",table:"balances",query:{account:e}},id:1},[])}async function Yt(e){return Te({jsonrpc:"2.0",method:"find",params:{contract:"tokens",table:"tokens",query:{symbol:{$in:e}}},id:2},[])}async function Ei(e,t,r,n){let o=_(),i=Q.getValidatedBaseUrl(),s=new URL("/private-api/engine-account-history",i);s.searchParams.set("account",e),s.searchParams.set("symbol",t),s.searchParams.set("limit",r.toString()),s.searchParams.set("offset",n.toString());let a=await o(s.toString(),{method:"GET",headers:{"Content-type":"application/json"}});if(!a.ok)throw new Error(`[SDK][HiveEngine] \u2013 account history failed with ${a.status}`);return await a.json()}async function Si(e,t="daily"){let r=_(),n=Q.getValidatedBaseUrl(),o=new URL("/private-api/engine-chart-api",n);o.searchParams.set("symbol",e),o.searchParams.set("interval",t);let i=await r(o.toString(),{headers:{"Content-type":"application/json"}});if(!i.ok)throw new Error(`[SDK][HiveEngine] \u2013 chart failed with ${i.status}`);return await i.json()}async function ki(e){let t=_(),r=Q.getValidatedBaseUrl(),n=await t(`${r}/private-api/engine-reward-api/${e}?hive=1`);if(!n.ok)throw new Error(`[SDK][HiveEngine] \u2013 rewards failed with ${n.status}`);return await n.json()}function Xt(e){return queryOptions({queryKey:["assets","hive-engine","balances",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>Jt(e)})}function gI(){return queryOptions({queryKey:["assets","hive-engine","markets"],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>et()})}function Ci(e){return queryOptions({queryKey:["assets","hive-engine","metadata-list",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>Yt(e)})}function PI(e,t,r=20){return infiniteQueryOptions({queryKey:["assets","hive-engine",t,"transactions",e],enabled:!!t&&!!e,initialPageParam:0,queryFn:async({pageParam:n})=>{if(!t||!e)throw new Error("[SDK][HiveEngine] \u2013 token or username missed");return Ei(e,t,r,n)},getNextPageParam:(n,o,i)=>(n?.length??0)===r?i+r:void 0,getPreviousPageParam:(n,o,i)=>i>0?i-r:void 0})}function EI(e,t="daily"){return queryOptions({queryKey:["assets","hive-engine",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>Si(e,t)})}function RI(e){return queryOptions({queryKey:["assets","hive-engine","unclaimed",e],staleTime:6e4,refetchInterval:9e4,enabled:!!e,queryFn:async()=>{try{let t=await ki(e);return Object.values(t).filter(({pending_token:r})=>r>0)}catch{return []}}})}function Ri(e,t){return queryOptions({queryKey:["assets","hive-engine","all-tokens",e,t],queryFn:async()=>et(e,t)})}function tt(e,t=void 0){let r={fractionDigits:3,prefix:"",suffix:""};t&&(r={...r,...t});let{fractionDigits:n,prefix:o,suffix:i}=r,s="";o&&(s+=o+" ");let a=Math.abs(parseFloat(e.toString()))<1e-4?0:e,c=typeof a=="string"?parseFloat(a):a;return s+=c.toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:true}),i&&(s+=" "+i),s}var Zt=class{symbol;name;icon;precision;stakingEnabled;delegationEnabled;balance;stake;stakedBalance;delegationsIn;delegationsOut;usdValue;constructor(t){this.symbol=t.symbol,this.name=t.name||"",this.icon=t.icon||"",this.precision=t.precision||0,this.stakingEnabled=t.stakingEnabled||false,this.delegationEnabled=t.delegationEnabled||false,this.balance=parseFloat(t.balance)||0,this.stake=parseFloat(t.stake)||0,this.delegationsIn=parseFloat(t.delegationsIn)||0,this.delegationsOut=parseFloat(t.delegationsOut)||0,this.stakedBalance=this.stake+this.delegationsIn-this.delegationsOut,this.usdValue=t.usdValue;}hasDelegations=()=>this.delegationEnabled?this.delegationsIn>0&&this.delegationsOut>0:false;delegations=()=>this.hasDelegations()?`(${tt(this.stake,{fractionDigits:this.precision})} + ${tt(this.delegationsIn,{fractionDigits:this.precision})} - ${tt(this.delegationsOut,{fractionDigits:this.precision})})`:"";staked=()=>this.stakingEnabled?this.stakedBalance<1e-4?this.stakedBalance.toString():tt(this.stakedBalance,{fractionDigits:this.precision}):"-";balanced=()=>this.balance<1e-4?this.balance.toString():tt(this.balance,{fractionDigits:this.precision})};function HI(e,t,r){return queryOptions({queryKey:["assets","hive-engine","balances-with-usd",e,t,r],queryFn:async()=>{if(!e)throw new Error("[HiveEngine] No account in a balances query");let n=await Jt(e),o=await Yt(n.map(p=>p.symbol)),i=t?t.base/t.quote:0,s=Array.isArray(r)?r:[],a=n.map(p=>p.symbol).filter(p=>p!=="SWAP.HIVE"&&!s.some(l=>l.symbol===p)),c=[...s,...a.length?await et(void 0,a):[]];return n.map(p=>{let l=o.find(O=>O.symbol===p.symbol),d;if(l?.metadata)try{d=JSON.parse(l.metadata);}catch{d=void 0;}let m=c.find(O=>O.symbol===p.symbol),g=Number(m?.lastPrice??"0"),h=Number(p.balance),P=p.symbol==="SWAP.HIVE"?i*h:g===0?0:Number((g*i*h).toFixed(10));return new Zt({symbol:p.symbol,name:l?.name??p.symbol,icon:d?.icon??"",precision:l?.precision??0,stakingEnabled:l?.stakingEnabled??false,delegationEnabled:l?.delegationEnabled??false,balance:p.balance,stake:p.stake,delegationsIn:p.delegationsIn,delegationsOut:p.delegationsOut,usdValue:P})})},enabled:!!e})}function Ti(e,t){return queryOptions({queryKey:["assets","hive-engine",t,"general-info",e],enabled:!!t&&!!e,staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{if(!t||!e)throw new Error("[SDK][HiveEngine] \u2013 token or username missed");let r=w(),n=Gt(e);await r.prefetchQuery(n);let o=r.getQueryData(n.queryKey),i=await r.ensureQueryData(Ci([t])),s=await r.ensureQueryData(Xt(e)),a=await r.ensureQueryData(Ri(void 0,t)),c=i?.find(O=>O.symbol===t),p=s?.find(O=>O.symbol===t),d=+(a?.find(O=>O.symbol===t)?.lastPrice??"0"),m=parseFloat(p?.balance??"0"),g=parseFloat(p?.stake??"0"),h=parseFloat(p?.pendingUnstake??"0"),P=[{name:"liquid",balance:m},{name:"staked",balance:g}];return h>0&&P.push({name:"unstaking",balance:h}),{name:t,title:c?.name??"",price:d===0?0:Number(d*(o?.price??0)),accountBalance:m+g,layer:"ENGINE",parts:P}}})}function bt(e,t=0){return queryOptions({queryKey:["points",e,t],queryFn:async()=>{if(!e)throw new Error("Get points query \u2013 username wasn't provided");let r=e.replace("@",""),n=await fetch(f.privateApiHost+"/private-api/points",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r})});if(!n.ok)throw new Error(`Failed to fetch points: ${n.status}`);let o=await n.json(),i=await fetch(f.privateApiHost+"/private-api/point-list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,type:t})});if(!i.ok)throw new Error(`Failed to fetch point transactions: ${i.status}`);let s=await i.json();return {points:o.points,uPoints:o.unclaimed_points,transactions:s}},staleTime:3e4,refetchOnMount:true,enabled:!!e})}function Fi(e){return queryOptions({queryKey:["assets","points","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>(await w().prefetchQuery(bt(e)),{name:"POINTS",title:"Ecency Points",price:.002,accountBalance:+(w().getQueryData(bt(e).queryKey)?.points??0)})})}function iq(e,t){return queryOptions({queryKey:["assets","points","transactions",e,t],queryFn:async()=>(await(await fetch(`${f.privateApiHost}/private-api/point-list`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,type:t??0})})).json()).map(({created:o,type:i,amount:s,id:a,sender:c,receiver:p,memo:l})=>({created:new Date(o),type:i,results:[{amount:parseFloat(s),asset:"POINTS"}],id:a,from:c??void 0,to:p??void 0,memo:l??void 0}))})}function hq(e,t,r={refetch:false}){let n=w(),o=r.currency??"usd",i=async p=>(r.refetch?await n.fetchQuery(p):await n.prefetchQuery(p),n.getQueryData(p.queryKey)),s=async p=>{if(!p||o==="usd")return p;try{let l=await xi(o);return {...p,price:p.price*l}}catch(l){return console.warn(`Failed to convert price from USD to ${o}:`,l),p}},a=_i(e,o,true),c=async()=>{try{let l=(await n.fetchQuery(a)).wallets.find(m=>m.symbol.toUpperCase()===t.toUpperCase());if(!l)return;let d=[];if(l.liquid!==void 0&&l.liquid!==null&&d.push({name:"liquid",balance:l.liquid}),l.staked!==void 0&&l.staked!==null&&l.staked>0&&d.push({name:"staked",balance:l.staked}),l.savings!==void 0&&l.savings!==null&&l.savings>0&&d.push({name:"savings",balance:l.savings}),l.extraData&&Array.isArray(l.extraData))for(let m of l.extraData){if(!m||typeof m!="object")continue;let g=m.dataKey,h=m.value;if(typeof h=="string"){let O=h.replace(/,/g,"").match(/[+-]?\s*(\d+(?:\.\d+)?)/);if(O){let T=Math.abs(Number.parseFloat(O[1]));g==="delegated_hive_power"?d.push({name:"outgoing_delegations",balance:T}):g==="received_hive_power"?d.push({name:"incoming_delegations",balance:T}):g==="powering_down_hive_power"&&d.push({name:"pending_power_down",balance:T});}}}return {name:l.symbol,title:l.name,price:l.fiatRate,accountBalance:l.balance,apr:l.apr?.toString(),layer:l.layer,pendingRewards:l.pendingRewards,parts:d}}catch{return}};return queryOptions({queryKey:["ecency-wallets","asset-info",e,t,o],queryFn:async()=>{let p=await c();if(p&&p.price>0)return p;let l;if(t==="HIVE")l=await i(Gt(e));else if(t==="HP")l=await i(wi(e));else if(t==="HBD")l=await i(bi(e));else if(t==="POINTS")l=await i(Fi(e));else if((await n.ensureQueryData(Xt(e))).some(m=>m.symbol===t))l=await i(Ti(e,t));else {if(p)return p;throw new Error(`[SDK][Wallet] \u2013 unrecognized asset "${t}"`)}if(p&&l&&l.price>0){let d=await s(l);return {...p,price:d.price}}return await s(l)}})}var Hd=(T=>(T.Transfer="transfer",T.TransferToSavings="transfer-saving",T.WithdrawFromSavings="withdraw-saving",T.Delegate="delegate",T.PowerUp="power-up",T.PowerDown="power-down",T.WithdrawRoutes="withdraw-routes",T.ClaimInterest="claim-interest",T.Swap="swap",T.Convert="convert",T.Gift="gift",T.Promote="promote",T.Claim="claim",T.Buy="buy",T.Stake="stake",T.Unstake="unstake",T.Undelegate="undelegate",T))(Hd||{});function Aq(e,t,r){return v(["wallet","transfer"],e,n=>[He(e,n.to,n.amount,n.memo)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function kq(e,t,r){return v(["wallet","transfer-point"],e,n=>[Ye(e,n.to,n.amount,n.memo)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function Iq(e,t,r){return v(["wallet","delegate-vesting-shares"],e,n=>[mt(e,n.delegatee,n.vestingShares)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.delegatee),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function Mq(e,t,r){return v(["wallet","set-withdraw-vesting-route"],e,n=>[gt(e,n.toAccount,n.percent,n.autoVest)],async(n,o)=>{await E(t?.adapter,r,[u.wallet.withdrawRoutes(e),u.accounts.full(e),u.accounts.full(o.toAccount)]);},t,"active",{broadcastMode:r})}function Uq(e,t,r){return v(["wallet","transfer-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"transfer",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity,memo:n.memo}});return [["custom_json",{required_auths:[e],required_posting_auths:[],id:"ssc-mainnet-hive",json:o}]]},async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function Wq(e,t,r){return v(["wallet","transfer-to-savings"],e,n=>[Je(e,n.to,n.amount,n.memo)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function Xq(e,t,r){return v(["wallet","transfer-from-savings"],e,n=>[Ue(e,n.to,n.amount,n.memo,n.requestId)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function nD(e,t,r){return v(["wallet","transfer-to-vesting"],e,n=>[dt(e,n.to,n.amount)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function cD(e,t,r){return v(["wallet","withdraw-vesting"],e,n=>[ft(e,n.vestingShares)],async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function fD(e,t,r){return v(["wallet","convert"],e,n=>[n.collateralized?Cr(e,n.amount,n.requestId):yt(e,n.amount,n.requestId)],async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function _D(e,t,r){return v(["wallet","claim-interest"],e,n=>lt(e,n.to,n.amount,n.memo,n.requestId),async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}var Ud=5e3,er=new Map;function AD(e,t,r){return v(["wallet","claim-rewards"],e,n=>[Lr(e,n.rewardHive,n.rewardHbd,n.rewardVests)],()=>{let n=e??"__anonymous__",o=[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e],u.assets.hiveGeneralInfo(e),u.assets.hbdGeneralInfo(e),u.assets.hivePowerGeneralInfo(e)],i=er.get(n);i&&(clearTimeout(i),er.delete(n));let s=setTimeout(async()=>{try{let a=w(),p=(await Promise.allSettled(o.map(l=>a.invalidateQueries({queryKey:l})))).filter(l=>l.status==="rejected");p.length>0&&console.error("[SDK][Wallet][useClaimRewards] delayed invalidation rejected",{username:e,rejectedCount:p.length,rejected:p});}catch(a){console.error("[SDK][Wallet][useClaimRewards] delayed invalidation failed",{username:e,error:a});}finally{er.delete(n);}},Ud);er.set(n,s);},t,"posting",{broadcastMode:r})}function SD(e,t,r){return v(["wallet","delegate-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"delegate",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function TD(e,t,r){return v(["wallet","undelegate-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"undelegate",contractPayload:{symbol:n.symbol,from:n.from,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function DD(e,t,r){return v(["wallet","stake-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"stake",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function ND(e,t,r){return v(["wallet","unstake-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"unstake",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function VD(e,t,r){return v(["wallet","claim-engine-rewards"],e,n=>{let o=JSON.stringify(n.tokens.map(i=>({symbol:i})));return [["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[e],json:o}]]},async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"posting",{broadcastMode:r})}function WD(e,t,r){return v(["wallet","engine-market-order"],e,n=>{let o,i;n.action==="cancel"?(i="cancel",o={type:n.orderType,id:n.orderId}):(i=n.action,o={symbol:n.symbol,quantity:n.quantity,price:n.price});let s=JSON.stringify({contractName:"market",contractAction:i,contractPayload:o});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:s}]]},async()=>{await E(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function Vd(e,t,r){let{from:n,to:o="",amount:i="",memo:s=""}=r,a=r.request_id??Date.now()>>>0;switch(e){case "HIVE":switch(t){case "transfer":return [He(n,o,i,s)];case "transfer-saving":return [Je(n,o,i,s)];case "withdraw-saving":return [Ue(n,o,i,s,a)];case "power-up":return [dt(n,o,i)]}break;case "HBD":switch(t){case "transfer":return [He(n,o,i,s)];case "transfer-saving":return [Je(n,o,i,s)];case "withdraw-saving":return [Ue(n,o,i,s,a)];case "claim-interest":return lt(n,o,i,s,a);case "convert":return [yt(n,i,Math.floor(Date.now()/1e3))]}break;case "HP":switch(t){case "power-down":return [ft(n,i)];case "delegate":return [mt(n,o,i)];case "withdraw-routes":return [gt(r.from_account??n,r.to_account??o,r.percent??0,r.auto_vest??false)]}break;case "POINTS":if(t==="transfer"||t==="gift")return [Ye(n,o,i,s)];break}return null}function jd(e,t,r){let{from:n,to:o="",amount:i=""}=r,s=typeof i=="string"&&i.includes(" ")?i.split(" ")[0]:String(i);switch(t){case "transfer":return [Ve(n,"transfer",{symbol:e,to:o,quantity:s,memo:r.memo??""})];case "stake":return [Ve(n,"stake",{symbol:e,to:o,quantity:s})];case "unstake":return [Ve(n,"unstake",{symbol:e,to:o,quantity:s})];case "delegate":return [Ve(n,"delegate",{symbol:e,to:o,quantity:s})];case "undelegate":return [Ve(n,"undelegate",{symbol:e,from:o,quantity:s})];case "claim":return [Rr(n,[e])]}return null}function Ld(e){return e==="claim"?"posting":"active"}function ZD(e,t,r,n,o){let{mutateAsync:i}=Xe.useRecordActivity(e,r);return v(["ecency-wallets",t,r],e,s=>{let a=Vd(t,r,s);if(a)return a;let c=jd(t,r,s);if(c)return c;throw new Error(`[SDK][Wallet] \u2013 no operation builder for asset="${t}" operation="${r}"`)},()=>{i();let s=[];s.push(["ecency-wallets","asset-info",e,t]),t==="HIVE"&&s.push(["ecency-wallets","asset-info",e,"HP"]),s.push(["wallet","portfolio","v2",e]),setTimeout(()=>{s.forEach(a=>{w().invalidateQueries({queryKey:a});});},5e3);},n,Ld(r),{broadcastMode:o})}function nK(e,t,r){return v(["wallet","delegate-rc"],e,({to:n,maxRc:o})=>[Tr(e,n,o)],async(n,o)=>{await E(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),u.resourceCredits.account(e),u.resourceCredits.account(o.to)]);},t,"active",{broadcastMode:r})}function aK(e,t,r){return v(["witnesses","vote"],e,({witness:n,approve:o})=>[qr(e,n,o)],async()=>{try{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.witnesses.votes(e)]);}catch(n){console.warn("[useWitnessVote] Post-broadcast side-effect failed:",n);}},t,"active",{broadcastMode:r})}function lK(e,t,r){return v(["witnesses","proxy"],e,({proxy:n})=>[Dr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.witnesses.proxy()]);},t,"active",{broadcastMode:r})}function Wd(e){return {owner:e.witness_name,total_missed:e.missed_blocks,url:e.url,props:{account_creation_fee:`${(e.account_creation_fee/1e3).toFixed(3)} HIVE`,account_subsidy_budget:0,maximum_block_size:e.block_size},hbd_exchange_rate:{base:`${e.price_feed.toFixed(3)} HBD`},available_witness_account_subsidies:0,running_version:e.version,signing_key:e.signing_key,last_hbd_exchange_update:e.feed_updated_at,rank:e.rank,vests:e.vests,voters_num:e.voters_num,voters_num_daily_change:e.voters_num_daily_change,price_feed:e.price_feed,hbd_interest_rate:e.hbd_interest_rate,last_confirmed_block_num:e.last_confirmed_block_num}}function hK(e){return infiniteQueryOptions({queryKey:u.witnesses.list(e),initialPageParam:1,queryFn:async({pageParam:t})=>(await te("hafbe","/witnesses",{"page-size":e,page:t})).witnesses.map(Wd),getNextPageParam:(t,r,n)=>t.length===e?n+1:void 0})}function _K(e,t,r,n="vests",o="desc"){return queryOptions({queryKey:u.witnesses.voters(e,t,r,n,o),queryFn:async({signal:i})=>await te("hafbe","/witnesses/{witness-name}/voters",{"witness-name":e,"page-size":r,page:t,sort:n,direction:o},void 0,void 0,i),enabled:!!e,staleTime:6e4})}function bK(e){return queryOptions({queryKey:u.witnesses.voterCount(e),queryFn:async()=>await te("hafbe","/witnesses/{witness-name}/voters/count",{"witness-name":e}),enabled:!!e,staleTime:6e4})}var Gd=(h=>(h[h.CHECKIN=10]="CHECKIN",h[h.LOGIN=20]="LOGIN",h[h.CHECKIN_EXTRA=30]="CHECKIN_EXTRA",h[h.POST=100]="POST",h[h.COMMENT=110]="COMMENT",h[h.VOTE=120]="VOTE",h[h.REBLOG=130]="REBLOG",h[h.DELEGATION=150]="DELEGATION",h[h.REFERRAL=160]="REFERRAL",h[h.COMMUNITY=170]="COMMUNITY",h[h.TRANSFER_SENT=998]="TRANSFER_SENT",h[h.TRANSFER_INCOMING=999]="TRANSFER_INCOMING",h[h.MINTED=991]="MINTED",h[h.BURNED=997]="BURNED",h))(Gd||{});async function Jd(e,t){if(!e)throw new Error("[SDK][Points][Claim] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][Points][Claim] \u2013 access token wasn't found");let n=await _()(f.privateApiHost+"/private-api/points-claim",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})}),o=(n.headers.get("content-type")??"").split(";")[0].trim().toLowerCase(),i=await n.text();if(!n.ok){if(n.status===406)try{return JSON.parse(i)}catch{return {message:i,code:n.status}}let s=i&&o.includes("json")?`: ${i.slice(0,200)}`:"";throw new Error(`[SDK][Points][Claim] \u2013 failed with status ${n.status}${s}`)}if(!o.includes("json"))throw new Error(`[SDK][Points][Claim] \u2013 expected JSON but received "${o||"empty"}" response (status ${n.status})`);try{return JSON.parse(i)}catch{throw new Error(`[SDK][Points][Claim] \u2013 malformed JSON response (status ${n.status})`)}}function EK(e,t,r,n){let{mutateAsync:o}=Xe.useRecordActivity(e,"points-claimed");return useMutation({mutationFn:()=>Jd(e,t),onError:n,onSuccess:()=>{o(),w().setQueryData(bt(e).queryKey,i=>i&&{...i,points:(parseFloat(i.points)+parseFloat(i.uPoints)).toFixed(3),uPoints:"0"}),r?.();}})}var qi=/(^|\s)author:([^\s]+)/g,Di=/(^|\s)type:([^\s]+)/g,Ki=/(^|\s)category:([^\s]+)/g,Bi=/(^|\s)tag:([^\s]+)/g;var Ni=(n=>(n.ALL="",n.POST="post",n.COMMENT="comment",n))(Ni||{}),kK=5,CK=100;function Qi(e){return e.trim().split(/\s+/)[0]??""}function Yd(e){return Qi(e).replace(/^@+/,"").toLowerCase()}function Xd(e){return Qi(e).replace(/^#+/,"").toLowerCase()}function Zd(e){let t=new Set;return e.split(/[\s,]+/).map(r=>r.replace(/^#+/,"").toLowerCase()).filter(r=>r===""||t.has(r)?false:(t.add(r),true))}function RK({search:e="",author:t="",type:r="",category:n="",tags:o=[]}){let i=e.trim().replace(/\s+/g," "),s=Yd(t),a=Xd(n),c=Zd(Array.isArray(o)?o.join(","):o),p=[i];return s&&p.push(`author:${s}`),r&&p.push(`type:${r}`),a&&p.push(`category:${a}`),c.length>0&&p.push(`tag:${c.join(",")}`),{q:p.filter(l=>l!=="").join(" "),search:i,author:s,type:r,category:a,tags:c}}var Mi=class{query="";search="";author="";type="";category="";tags=[];constructor(t){this.query=t,this.search=t,this.grabAuthor(),this.grabType(),this.grabCategory(),this.grabTags(),this.grabSearch();}grab=t=>{let r=[...this.query.matchAll(t)];return r.length>0?r[0][2].trim():""};grabAuthor=()=>{this.author=this.grab(qi);};grabType=()=>{let t=this.grab(Di);Object.values(Ni).includes(t)&&(this.type=t);};grabCategory=()=>{this.category=this.grab(Ki);};grabTags=()=>{let t=new Set;this.tags=[...this.query.matchAll(Bi)].flatMap(r=>r[2].split(",")).map(r=>r.trim()).filter(r=>r===""||t.has(r)?false:(t.add(r),true));};grabSearch=()=>{for([qi,Di,Ki,Bi].forEach(t=>{this.search=this.search.replace(t,"$1");});this.search.indexOf(" ")!==-1;)this.search=this.search.replace(" "," ");this.search=this.search.trim();}};async function xe(e,t){let n=await(async()=>{let o;try{o=await e.text();}catch{return}if(o!=="")try{return JSON.parse(o)}catch{return e.ok?void 0:o}})();if(!e.ok){let o=new Error(`Request failed with status ${e.status}`);throw o.status=e.status,o.data=n,o}if(n===void 0||t!==void 0&&!t(n))throw new Error("Response body was empty, invalid JSON, or not the expected shape");return n}function Fe(e){return typeof e=="object"&&e!==null&&Array.isArray(e.results)}var tf=isServer?0:3;function wt(e,t){let{status:r}=t,n=r===408||r===429;return r!==void 0&&r>=400&&r<500&&!n?false:e<tf}function QK(e,t,r,n,o,i){return queryOptions({queryKey:u.search.results(e,t,r,n,o,i),queryFn:async({signal:s})=>{let a={q:e,sort:t,hide_low:r};n&&(a.since=n),o&&(a.scroll_id=o),i&&(a.votes=i);let c=await fetch(f.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify(a),signal:Pe(Ae,s)});return xe(c,Fe)},retry:wt})}function HK(e,t,r=true){return infiniteQueryOptions({queryKey:u.search.controversialRising(e,t),initialPageParam:{sid:void 0,hasNextPage:true},queryFn:async({pageParam:n,signal:o})=>{if(!n.hasNextPage)return {hits:0,took:0,results:[]};let i,s=new Date;switch(t){case "today":i=new Date(s.getTime()-1440*60*1e3);break;case "week":i=new Date(s.getTime()-10080*60*1e3);break;case "month":i=new Date(s.getTime()-720*60*60*1e3);break;case "year":i=new Date(s.getTime()-365*24*60*60*1e3);break;default:i=void 0;}let a="* type:post",c=e==="rising"?"children":e,p=i?i.toISOString().split(".")[0]:void 0,l="0",d=t==="today"?50:200,m={q:a,sort:c,hide_low:l};p&&(m.since=p),n.sid&&(m.scroll_id=n.sid),(m.votes=d);let g=await fetch(f.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify(m),signal:Pe(Ae,o)});return xe(g,Fe)},getNextPageParam:n=>({sid:n?.scroll_id,hasNextPage:n.results.length>0}),enabled:r,retry:wt})}async function LK(e,t,r,n,o,i,s){let a={q:e,sort:t,hide_low:r};n&&(a.since=n),o&&(a.scroll_id=o),i&&(a.votes=i);let p=await _()(f.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify(a),signal:Pe(Ae,s)});return xe(p,Fe)}async function Hi(e,t,r=Ae){let o=await _()(f.privateApiHost+"/search-api/similar",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify(e),signal:Pe(r,t)});return xe(o,Fe)}async function $K(e,t){let n=await _()(f.privateApiHost+"/search-api/search-path",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify({q:e}),signal:Pe(Ae,t)}),o=await xe(n,Array.isArray);return o?.length>0?o:[e]}var sf=4368*60*60*1e3,af=4,cf=3e3,uf=2e3,pf=4e3,YK=2;function lf(e,t){return e.replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/https?:\/\/\S+/g," ").replace(/\s+/g," ").trim().slice(0,t)}function df(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return (t>>>0).toString(36)}function XK(e){let t=e.title??"",r=e.json_metadata?.tags,n=(Array.isArray(r)?r:[]).filter(s=>typeof s=="string"&&s!==""),o=lf(e.body??"",cf),i=df(`${t}|${n.join(",")}|${o}`);return queryOptions({queryKey:u.search.similarEntries(e.author,e.permlink,i),queryFn:async({signal:s})=>{let a=new Date(Date.now()-sf).toISOString().slice(0,19),c=await Hi({author:e.author,permlink:e.permlink,title:t,body:o,tags:n,since:a},s,typeof window>"u"?uf:pf),p=[],l=new Set;for(let d of c.results){if(p.length>=af)break;d.permlink!==e.permlink&&(d.tags??[]).indexOf("nsfw")===-1&&(l.has(d.author)||(l.add(d.author),p.push(d)));}return p},staleTime:300*1e3,retry:false})}function oB(e,t=5){let r=e.trim();return queryOptions({queryKey:u.search.account(r,t),queryFn:async()=>{let n=await y("condenser_api.lookup_accounts",[r,t]);return n.length===0?[]:Qt(n)},enabled:!!r})}function uB(e,t=10){let r=e.trim();return queryOptions({queryKey:u.search.topics(r,t),queryFn:async()=>(await y("condenser_api.get_trending_tags",[r,t+1])).map(o=>o.name).filter(o=>o!==""&&!o.startsWith("hive-")).slice(0,t),enabled:!!r})}function gB(e,t,r,n,o,i){return infiniteQueryOptions({queryKey:u.search.api(e,t,r,n,o,i),queryFn:async({pageParam:s,signal:a})=>{let c={q:e,sort:t,hide_low:r};n&&(c.since=n),s&&(c.scroll_id=s),o!==void 0&&(c.votes=o),i&&(c.include_nsfw=1);let p=await fetch(f.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify(c),signal:Pe(Ae,a)});return xe(p,Fe)},initialPageParam:void 0,getNextPageParam:s=>s?.scroll_id,enabled:!!e,retry:wt})}function bB(e){return queryOptions({queryKey:["search","path",e],queryFn:async()=>{let t=await fetch(f.privateApiHost+"/search-api/search-path",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":f.clientId},body:JSON.stringify({q:e})});if(!t.ok)throw new Error(`Search path failed: ${t.status}`);let r=await t.json();return r?.length>0?r:[e]}})}async function _f(e){let r=await _()(f.privateApiHost+"/private-api/support-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok){let n;try{n=await r.json();}catch{}let o=n?.message??`Failed to fetch support settings: ${r.status}`,i=new Error(o);throw i.status=r.status,i.data=n,i}return await r.json()}function AB(e,t){let r=e?.replace("@","");return queryOptions({queryKey:u.support.settings(r),queryFn:()=>{if(!t)throw new Error("[SDK][Support] missing auth");return _f(t)},enabled:!!r&&!!t})}async function vf(e,t){let n=await _()(f.privateApiHost+"/private-api/support-settings-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,beneficiary_percent:t.beneficiary_percent,curation_percent:t.curation_percent})});if(!n.ok){let o;try{o=await n.json();}catch{}let i=o?.message??`Failed to update support settings: ${n.status}`,s=new Error(i);throw s.status=n.status,s.data=o,s}return await n.json()}function Pf(e,t,r){return e.setQueryData(u.support.settings(t),r),e.invalidateQueries({queryKey:u.support.settings(t)})}function kB(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["support","settings-update",n],mutationFn:async o=>{if(!n||!t)throw new Error("[SDK][Support] missing auth");return vf(t,o)},onSuccess(o){n&&Pf(r,n,o);}})}function FB(e){return queryOptions({queryKey:["promotions","boost-plus-prices"],queryFn:async()=>{if(!e)return [];let t=await fetch(f.privateApiHost+"/private-api/boost-plus-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch boost plus prices: ${t.status}`);return await t.json()},staleTime:1/0,enabled:!!e})}function KB(e){return queryOptions({queryKey:["promotions","rc-delegation-prices"],queryFn:async()=>{if(!e)return [];let t=await fetch(f.privateApiHost+"/private-api/rc-delegation-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch RC delegation prices: ${t.status}`);return await t.json()},staleTime:1/0,enabled:!!e})}function QB(e,t){return queryOptions({queryKey:["promotions","rc-delegation-active",e],queryFn:async()=>{if(!t||!e)return null;let r=await fetch(f.privateApiHost+"/private-api/rc-delegation-active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,username:e})});if(!r.ok)throw new Error(`Failed to fetch RC delegation active: ${r.status}`);let n=await r.json();return n&&n.expires&&n.user?{user:n.user,expires:new Date(n.expires)}:null},enabled:!!e&&!!t})}function jB(e){return queryOptions({queryKey:["promotions","promote-price"],queryFn:async()=>{let t=await fetch(f.privateApiHost+"/private-api/promote-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch promote prices: ${t.status}`);return await t.json()},enabled:!!e})}function GB(e,t){return queryOptions({queryKey:["promotions","boost-plus-accounts",e],queryFn:async()=>{if(!t||!e)return null;let r=await fetch(f.privateApiHost+"/private-api/boosted-plus-account",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,account:e})});if(!r.ok)throw new Error(`Failed to fetch boost plus account prices: ${r.status}`);let n=await r.json();return n?{account:n.account,expires:new Date(n.expires)}:null},enabled:!!e&&!!t})}function XB(e,t,r){return v(["promotions","boost-plus"],e,({account:n,duration:o})=>[Jr(e,n,o)],async(n,{account:o})=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.promotions.boostPlusAccounts(o)]);},t,"active",{broadcastMode:r})}function rM(e,t,r){return v(["promotions","rc-delegation"],e,({duration:n})=>[Yr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.resourceCredits.account(e),["promotions","rc-delegation-active",e]]);},t,"active",{broadcastMode:r})}async function iM(e){let r=await _()(f.privateApiHost+"/auth-api/hs-token-refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok){let o;try{o=await r.json();}catch{o=void 0;}let i=new Error(`Failed to refresh token: ${r.status}`);throw i.status=r.status,i.data=o,i}return await r.json()}var Cf="https://raw.githubusercontent.com/openhive-network/watchmen/main/output/flat/badactors.txt";function uM(){return queryOptions({queryKey:u.badActors.list(),queryFn:async({signal:e})=>{let t=await fetch(Cf,{signal:e});if(!t.ok)throw new Error(`Failed to fetch bad actors list: ${t.status}`);let r=await t.text();return new Set(r.split(`
2
- `).filter(Boolean))},staleTime:1440*60*1e3,gcTime:1/0})}var lM=1.1,Rf=(r=>(r.NUMBER_OF_VOTES="number_of_votes",r.TOKENS="tokens",r))(Rf||{});function dM(e){return e?e.map((t,r)=>({choice_num:r+1,choice_text:t,votes:{total_votes:0,hive_hp:0,hive_proxied_hp:0,hive_hp_incl_proxied:0}})):[]}function If(e){let t=e.poll_choices??[],r=e.poll_voters??[],n=e.poll_stats,o=t.map(a=>{let c=a.votes;return {choice_num:a.choice_num??0,choice_text:a.choice_text??"",votes:c?{total_votes:c.total_votes??0,hive_hp:c.hive_hp,hive_proxied_hp:c.hive_proxied_hp,hive_hp_incl_proxied:c.hive_hp_incl_proxied??null}:void 0}}),i=r.map(a=>({name:a.name??"",choices:a.choices??[],hive_hp:a.hive_hp,hive_proxied_hp:a.hive_proxied_hp,hive_hp_incl_proxied:a.hive_hp_incl_proxied})),s=n?{total_voting_accounts_num:n.total_voting_accounts_num??0,total_hive_hp:n.total_hive_hp,total_hive_proxied_hp:n.total_hive_proxied_hp,total_hive_hp_incl_proxied:n.total_hive_hp_incl_proxied??null}:void 0;return {author:e.author??"",permlink:e.permlink??"",question:e.question??"",poll_choices:o,poll_voters:i,poll_stats:s,poll_trx_id:e.poll_trx_id??"",status:e.status??"",end_time:e.end_time??"",preferred_interpretation:e.preferred_interpretation??"number_of_votes",max_choices_voted:e.max_choices_voted??1,filter_account_age_days:e.filter_account_age_days??0,protocol_version:e.protocol_version??0,created:e.created??"",post_title:e.post_title??"",post_body:e.post_body??"",parent_permlink:e.parent_permlink??"",tags:e.tags??[],image:e.image??[],token:e.token,community_membership:e.community_membership,allow_vote_changes:e.allow_vote_changes,ui_hide_res_until_voted:e.ui_hide_res_until_voted??false,platform:e.platform}}function hM(e,t){return queryOptions({queryKey:u.polls.details(e??"",t??""),enabled:!!e&&!!t,gcTime:isServer?lo:1800*1e3,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Polls] \u2013 missing author or permlink");let r=_(),n=`${f.pollsApiHost}/rpc/poll?author=eq.${encodeURIComponent(e)}&permlink=eq.${encodeURIComponent(t)}`,o=await r(n);if(!o.ok)throw new Error(`[SDK][Polls] \u2013 fetch failed: ${o.status}`);let i=await o.json();if(!Array.isArray(i)||!i[0])throw new Error("[SDK][Polls] \u2013 no poll data found");return If(i[0])}})}function wM(e,t,r){return v(u.polls.vote(),e??"",({pollTrxId:n,choices:o})=>{if(!e)throw new Error("[SDK][Polls] Cannot vote without an authenticated username");return [["custom_json",{id:"polls",required_auths:[],required_posting_auths:[e],json:JSON.stringify({poll:n,action:"vote",choices:o})}]]},void 0,t,"posting",{broadcastMode:r??"async"})}var qf=-1e10,Df=5,Kf=30;var Ui=e=>Math.abs(e)>0&&Math.abs(e)<=100;function Vi(e){if(typeof e=="number"&&Ui(e)||typeof e=="string"&&(e=Number(e),Ui(e)))return Math.floor(e);if(e===0)return 25;let t=false;e<0&&(t=true);let r=Math.log10(Math.abs(e));return r=Math.max(r-9,0),r<0&&(r=0),t&&(r*=-1),r=r*9+25,Math.floor(r)}var Bf=["ecency.com","ecency.app","hive.blog","hive.io","hiveblocks.com","peakd.com","snapie.io","hivesuite.app","leofinance.io","inleo.io","3speak.tv","d.buzz","waivio.com"],Mf=["imgur.com","images.hive.blog","files.peakd.com","i.ecency.com","images.ecency.com","steemitimages.com","cdn.steemitimages.com","media.giphy.com"],Nf=/\.(jpe?g|png|gif|webp|svg|bmp|avif)(\?|#|$)/i,Qf=/(?:https?:)?\/\/[^\s)<>"'\]]+/gi,Hf=/[.,;:!?'"]+$/;function Uf(e){let t=/^(?:https?:)?\/\/([^/?#]+)/i.exec(e);return t?t[1].toLowerCase().replace(/^www\./,""):""}function Vf(e){let t=e.replace(Hf,"");if(Nf.test(t))return false;let r=Uf(t);if(!r.includes("."))return false;let n=o=>r===o||r.endsWith("."+o);return !(Bf.some(n)||Mf.some(n))}function ji(e){if(!e)return false;let t=e.match(Qf);return t?t.some(Vf):false}var jf=(n=>(n.MOD_MUTED="mod_muted",n.DOWNVOTED="downvoted",n.LOW_TRUST="low_trust",n))(jf||{});function Lf(e){return e?.stats?.total_votes??e?.active_votes?.length??0}function $f(e,t){return (e??0)<-1e10&&t>=5}function Wf(e){let t=e?.author_reputation;return t==null?false:Vi(t)<30&&ji(e?.body)}function SM(e,t){return !!e&&!!t?.includes(e)}function kM(e){return e?e.stats?.gray||e.stats?.hide?"mod_muted":$f(e.net_rshares,Lf(e))?"downvoted":Wf(e)?"low_trust":null:null}/**
1
+ import {useQuery,useInfiniteQuery,useMutation,QueryClient,queryOptions,infiniteQueryOptions,useQueryClient,isServer}from'@tanstack/react-query';import {hexToBytes,bytesToHex}from'@noble/hashes/utils.js';import {ripemd160}from'@noble/hashes/legacy.js';import xn from'bs58';import {secp256k1}from'@noble/curves/secp256k1.js';import {sha256,sha512}from'@noble/hashes/sha2.js';import {cbc}from'@noble/ciphers/aes.js';import mo from'hivesigner';var as=Object.defineProperty;var xt=(e,t)=>{for(var r in t)as(e,r,{get:t[r],enumerable:true});};var St=new ArrayBuffer(0),Et=null,kt=null;function us(){return Et||(typeof TextEncoder<"u"?Et=new TextEncoder:Et={encode(e){let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<128)t.push(n);else if(n<2048)t.push(192|n>>6,128|n&63);else if(n>=55296&&n<=56319&&r+1<e.length){let o=e.charCodeAt(++r);n=65536+((n&1023)<<10)+(o&1023),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63);}else t.push(224|n>>12,128|n>>6&63,128|n&63);}return new Uint8Array(t)}}),Et}function _n(){return kt||(typeof TextDecoder<"u"?kt=new TextDecoder:kt={decode(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r="";for(let n=0;n<t.length;){let o=t[n],i;o<128?(i=o,n+=1):(o&224)===192?(i=(o&31)<<6|t[n+1]&63,n+=2):(o&240)===224?(i=(o&15)<<12|(t[n+1]&63)<<6|t[n+2]&63,n+=3):(i=(o&7)<<18|(t[n+1]&63)<<12|(t[n+2]&63)<<6|t[n+3]&63,n+=4),i<=65535?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296+(i>>10),56320+(i&1023)));}return r}}),kt}var D=class e{static LITTLE_ENDIAN=true;static BIG_ENDIAN=false;static DEFAULT_CAPACITY=16;static DEFAULT_ENDIAN=e.BIG_ENDIAN;buffer;view;offset;markedOffset;limit;littleEndian;constructor(t=e.DEFAULT_CAPACITY,r=e.DEFAULT_ENDIAN){this.buffer=t===0?St:new ArrayBuffer(t),this.view=t===0?new DataView(St):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=r;}static allocate(t,r){return new e(t,r)}static concat(t,r){let n=0;for(let a=0;a<t.length;++a){let c=t[a];if(c instanceof e)n+=c.limit-c.offset;else if(c instanceof Uint8Array)n+=c.length;else if(c instanceof ArrayBuffer)n+=c.byteLength;else if(Array.isArray(c))n+=c.length;else throw TypeError("Illegal buffer")}if(n===0)return new e(0,r);let o=new e(n,r),i=new Uint8Array(o.buffer),s=0;for(let a=0;a<t.length;++a){let c=t[a];c instanceof e?(i.set(new Uint8Array(c.buffer,c.offset,c.limit-c.offset),s),s+=c.limit-c.offset):c instanceof Uint8Array?(i.set(c,s),s+=c.length):c instanceof ArrayBuffer?(i.set(new Uint8Array(c),s),s+=c.byteLength):(i.set(c,s),s+=c.length);}return o.limit=o.offset=s,o.offset=0,o}static wrap(t,r){if(t instanceof e){let o=t.clone();return o.markedOffset=-1,o}let n;if(t instanceof Uint8Array)n=new e(0,r),t.length>0&&(n.buffer=t.buffer,n.offset=t.byteOffset,n.limit=t.byteOffset+t.byteLength,n.view=new DataView(t.buffer));else if(t instanceof ArrayBuffer)n=new e(0,r),t.byteLength>0&&(n.buffer=t,n.offset=0,n.limit=t.byteLength,n.view=t.byteLength>0?new DataView(t):new DataView(St));else if(Array.isArray(t))n=new e(t.length,r),n.limit=t.length,new Uint8Array(n.buffer).set(t);else throw TypeError("Illegal buffer");return n}writeBytes(t,r){return this.append(t,r)}writeInt8(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+1>this.buffer.byteLength&&this.resize(r+1),this.view.setInt8(r,t),n&&(this.offset+=1),this}writeByte(t,r){return this.writeInt8(t,r)}writeUint8(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+1>this.buffer.byteLength&&this.resize(r+1),this.view.setUint8(r,t),n&&(this.offset+=1),this}writeUInt8(t,r){return this.writeUint8(t,r)}readUint8(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getUint8(t);return r&&(this.offset+=1),n}readUInt8(t){return this.readUint8(t)}writeInt16(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+2>this.buffer.byteLength&&this.resize(r+2),this.view.setInt16(r,t,this.littleEndian),n&&(this.offset+=2),this}writeShort(t,r){return this.writeInt16(t,r)}writeUint16(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+2>this.buffer.byteLength&&this.resize(r+2),this.view.setUint16(r,t,this.littleEndian),n&&(this.offset+=2),this}writeUInt16(t,r){return this.writeUint16(t,r)}writeInt32(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+4>this.buffer.byteLength&&this.resize(r+4),this.view.setInt32(r,t,this.littleEndian),n&&(this.offset+=4),this}writeInt(t,r){return this.writeInt32(t,r)}writeUint32(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,r+4>this.buffer.byteLength&&this.resize(r+4),this.view.setUint32(r,t,this.littleEndian),n&&(this.offset+=4),this}writeUInt32(t,r){return this.writeUint32(t,r)}readUint32(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getUint32(t,this.littleEndian);return r&&(this.offset+=4),n}readUInt32=this.readUint32;append(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o;return t instanceof e?(o=new Uint8Array(t.buffer,t.offset,t.limit-t.offset),t.offset+=o.length):t instanceof Uint8Array?o=t:t instanceof ArrayBuffer?o=new Uint8Array(t):o=new Uint8Array(t),o.length<=0?this:(r+o.length>this.buffer.byteLength&&this.resize(r+o.length),new Uint8Array(this.buffer).set(o,r),n&&(this.offset+=o.length),this)}clone(t){let r=new e(0,this.littleEndian);return t?(r.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(r.buffer).set(new Uint8Array(this.buffer)),r.view=new DataView(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r}copy(t,r){if(t===void 0&&(t=this.offset),r===void 0&&(r=this.limit),t===r)return new e(0,this.littleEndian);let n=r-t,o=new e(n,this.littleEndian);return o.offset=0,o.limit=n,new Uint8Array(o.buffer).set(new Uint8Array(this.buffer).subarray(t,r),0),o}copyTo(t,r,n,o){let i=typeof r>"u",s=typeof n>"u";r=i?t.offset:r,n=s?this.offset:n,o=o===void 0?this.limit:o;let a=o-n;return a===0?t:(t.ensureCapacity(r+a),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer).subarray(n,o),r),s&&(this.offset+=a),i&&(t.offset+=a),this)}ensureCapacity(t){let r=this.buffer.byteLength;return r<t?this.resize((r*=2)>t?r:t):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(t){if(this.buffer.byteLength<t){let r=new ArrayBuffer(t);new Uint8Array(r).set(new Uint8Array(this.buffer)),this.buffer=r,this.view=new DataView(r);}return this}skip(t){return this.offset+=t,this}writeInt64(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,typeof t=="number"&&(t=BigInt(t)),r+8>this.buffer.byteLength&&this.resize(r+8),this.view.setBigInt64(r,t,this.littleEndian),n&&(this.offset+=8),this}writeLong(t,r){return this.writeInt64(t,r)}readInt64(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getBigInt64(t,this.littleEndian);return r&&(this.offset+=8),n}readLong(t){return this.readInt64(t)}writeUint64(t,r){let n=typeof r>"u";return n?r=this.offset:r=r,typeof t=="number"&&(t=BigInt(t)),r+8>this.buffer.byteLength&&this.resize(r+8),this.view.setBigUint64(r,t,this.littleEndian),n&&(this.offset+=8),this}writeUInt64(t,r){return this.writeUint64(t,r)}readUint64(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=this.view.getBigUint64(t,this.littleEndian);return r&&(this.offset+=8),n}readUInt64(t){return this.readUint64(t)}toBuffer(t){let r=this.offset,n=this.limit;return !t&&r===0&&n===this.buffer.byteLength?this.buffer:r===n?St:this.buffer.slice(r,n)}toArrayBuffer(t){return this.toBuffer(t)}writeVarint32(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o=this.calculateVarint32(t);for(r+o>this.buffer.byteLength&&this.resize(r+o),t>>>=0;t>=128;)this.view.setUint8(r++,t&127|128),t>>>=7;return this.view.setUint8(r++,t),n?(this.offset=r,this):o}readVarint32(t){let r=typeof t>"u";typeof t>"u"&&(t=this.offset);let n=0,o=0,i;do i=this.view.getUint8(t++),n<5&&(o|=(i&127)<<7*n),++n;while((i&128)!==0);return o|=0,r?(this.offset=t,o):{value:o,length:n}}calculateVarint32(t){return t=t>>>0,t<128?1:t<16384?2:t<1<<21?3:t<1<<28?4:5}writeVString(t,r){let n=typeof r>"u",o=n?this.offset:r,i=us().encode(t),s=i.length,a=this.calculateVarint32(s);return o+a+s>this.buffer.byteLength&&this.resize(o+a+s),this.writeVarint32(s,o),o+=a,new Uint8Array(this.buffer).set(i,o),o+=s,n?(this.offset=o,this):o-(r||0)}readVString(t){let r=typeof t>"u";r?t=this.offset:t=t;let n=t,o=this.readVarint32(t),i=o.value,s=o.length;t+=s;let a=_n().decode(new Uint8Array(this.buffer,t,i));return t+=i,r?(this.offset=t,a):{string:a,length:t-n}}readUTF8String(t,r){let n=typeof r>"u";n?r=this.offset:r=r;let o=_n().decode(new Uint8Array(this.buffer,r,t));return n?(this.offset+=t,o):{string:o,length:t}}};var x={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://api.syncad.com","https://rpc.mahdiyari.info"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://api.syncad.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodesByApi:{hivesense:["https://api.hive.blog","https://api.syncad.com"]},userAgent:"ecency-sdk",chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:5e3,broadcastTimeout:15e3,retry:5,resilience:{adaptiveTimeout:true,adaptiveTimeoutFloorMs:2e3,adaptiveTimeoutFactor:4,hedge:false,hedgeDelayFloorMs:750,hedgeDelayFactor:2,hedgeBucketCapacity:10,hedgeRefillPerSuccess:.1,totalBudgetFactor:2}},wn=["bridge.get_ranked_posts","bridge.get_account_posts","bridge.get_post","bridge.get_discussion","bridge.get_profile","bridge.get_profiles","bridge.get_community","bridge.list_communities","condenser_api.get_accounts","condenser_api.get_content","condenser_api.get_dynamic_global_properties","condenser_api.get_trending_tags"],Ct=null,sr=e=>{if(e===null){Ct=null;return}if(!e||typeof e!="object")return;let t=typeof e.url=="string"?e.url.trim():"";if(!/^https?:\/\//i.test(t))return;let r={};if(e.headers&&typeof e.headers=="object")for(let[s,a]of Object.entries(e.headers))typeof a=="string"&&a&&!/[\u0000-\u001f\u007f]/.test(a)&&!/[\u0000-\u001f\u007f]/.test(s)&&(r[s]=a);let n=typeof e.timeoutMs=="number"&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0?e.timeoutMs:2e3,o=e.methods===void 0?[...wn]:Array.isArray(e.methods)?e.methods.filter(s=>typeof s=="string"&&s.includes(".")):[];if(o.length===0)return;let i=(s,a)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:a;Ct={url:t,headers:r,timeoutMs:n,methods:o,failureThreshold:Math.floor(i(e.failureThreshold,3)),cooldownMs:i(e.cooldownMs,1e4),methodSet:new Set(o)};},ar=e=>Array.isArray(e)?[...new Set(e.filter(t=>typeof t=="string").map(t=>t.trim().replace(/\/+$/,"")).filter(t=>t.length>0&&/^https?:\/\/.+/.test(t)))]:[],ur=e=>{let t=ar(e);t.length&&(x.nodes=t);},cr=e=>{let t=ar(e);t.length&&(x.restNodes=t);},pr=e=>{if(!e||typeof e!="object")return;let t={...x.restNodesByApi};for(let[r,n]of Object.entries(e)){let o=ar(n);o.length?t[r]=o:delete t[r];}x.restNodesByApi=t;},lr=e=>{if(typeof e!="string")return;let t=e.trim();!t||/[\u0000-\u001f\u007f]/.test(t)||(x.userAgent=t);},dr=e=>{if(!e||typeof e!="object")return;let t=x.resilience,r=o=>typeof o=="boolean",n=o=>typeof o=="number"&&Number.isFinite(o)&&o>0;r(e.adaptiveTimeout)&&(t.adaptiveTimeout=e.adaptiveTimeout),n(e.adaptiveTimeoutFloorMs)&&(t.adaptiveTimeoutFloorMs=Math.max(e.adaptiveTimeoutFloorMs,2e3)),n(e.adaptiveTimeoutFactor)&&(t.adaptiveTimeoutFactor=e.adaptiveTimeoutFactor),r(e.hedge)&&(t.hedge=e.hedge),n(e.hedgeDelayFloorMs)&&(t.hedgeDelayFloorMs=e.hedgeDelayFloorMs),n(e.hedgeDelayFactor)&&(t.hedgeDelayFactor=e.hedgeDelayFactor),n(e.hedgeBucketCapacity)&&(t.hedgeBucketCapacity=e.hedgeBucketCapacity),n(e.hedgeRefillPerSuccess)&&(t.hedgeRefillPerSuccess=Math.min(e.hedgeRefillPerSuccess,1)),n(e.totalBudgetFactor)&&(t.totalBudgetFactor=Math.max(e.totalBudgetFactor,1));};var Ee=class e{data;recovery;compressed;constructor(t,r,n){this.data=t,this.recovery=r,this.compressed=n??true;}static from(t){if(typeof t=="string"){let r=hexToBytes(t),n=parseInt(bytesToHex(r.subarray(0,1)),16)-31,o=true;n<0&&(o=false,n=n+4);let i=r.subarray(1);return new e(i,n,o)}else throw new Error("Expected string for data")}toBuffer(){let t=new Uint8Array(65).fill(0);return this.compressed?t[0]=this.recovery+31&255:t[0]=this.recovery+27&255,t.set(this.data,1),t}customToString(){return bytesToHex(this.toBuffer())}toString(){return this.customToString()}getPublicKey(t){if(t instanceof Uint8Array&&t.length!==32||typeof t=="string"&&t.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof t=="string"&&(t=hexToBytes(t));let r=secp256k1.Signature.fromBytes(this.data,"compact"),n=new secp256k1.Signature(r.r,r.s,this.recovery);return new Y(n.recoverPublicKey(t).toBytes())}};var Y=class e{key;prefix;constructor(t,r){this.key=t,this.prefix=r??x.address_prefix;}static fromString(t){let r=x.address_prefix;if(typeof t!="string"||t.length<=r.length)throw new Error("Invalid public key");let n=t.slice(0,r.length);if(n!==r)throw new Error(`Public key must start with ${r}`);let o;try{o=xn.decode(t.slice(r.length));}catch{throw new Error("Invalid public key encoding")}if(o.length!==37)throw new Error("Invalid public key length");let i=o.subarray(0,33),s=o.subarray(33,37),a=ripemd160(i).subarray(0,4);if(!ps(s,a))throw new Error("Public key checksum mismatch");try{secp256k1.Point.fromBytes(i);}catch{throw new Error("Invalid public key")}return new e(i,n)}static from(t){return t instanceof e?t:e.fromString(t)}verify(t,r){return typeof r=="string"&&(r=Ee.from(r)),secp256k1.verify(r.data,t,this.key,{prehash:false,format:"compact"})}toString(){return cs(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return `PublicKey: ${this.toString()}`}},cs=(e,t)=>{let r=ripemd160(e);return t+xn.encode(new Uint8Array([...e,...r.subarray(0,4)]))},ps=(e,t)=>{if(e.byteLength!==t.byteLength)return false;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return false;return true};var Rt=class e{amount;symbol;constructor(t,r){this.amount=t,this.symbol=r==="HIVE"?"STEEM":r==="HBD"?"SBD":r;}static fromString(t,r=null){let[n,o]=t.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(o)===-1)throw new Error(`Invalid asset symbol: ${o}`);if(r&&o!==r)throw new Error(`Invalid asset, expected symbol: ${r} got: ${o}`);let i=Number.parseFloat(n);if(!Number.isFinite(i))throw new Error(`Invalid asset amount: ${n}`);return new e(i,o)}static from(t,r){if(t instanceof e){if(r&&t.symbol!==r)throw new Error(`Invalid asset, expected symbol: ${r} got: ${t.symbol}`);return t}else {if(typeof t=="number"&&Number.isFinite(t))return new e(t,r||"STEEM");if(typeof t=="string")return e.fromString(t,r);throw new Error(`Invalid asset '${String(t)}'`)}}getPrecision(){switch(this.symbol){case "TESTS":case "TBD":case "STEEM":case "SBD":case "HBD":case "HIVE":return 3;case "VESTS":return 6;default:return 3}}toString(){return `${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}};var Tt=class e{buffer;static from(t){return t instanceof e?t:t instanceof Uint8Array?new e(t):typeof t=="string"?new e(hexToBytes(t)):new e(new Uint8Array(t))}constructor(t){this.buffer=t;}toString(){return bytesToHex(this.buffer)}toJSON(){return this.toString()}};var C={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},ie=()=>{throw new Error("Void can not be serialized")},w=(e,t)=>{e.writeVString(t);},fs=(e,t)=>{e.writeInt16(t);},En=(e,t)=>{e.writeInt64(t);},Sn=(e,t)=>{e.writeUint8(t);},pe=(e,t)=>{e.writeUint16(t);},X=(e,t)=>{e.writeUint32(t);},kn=(e,t)=>{e.writeUint64(t);},we=(e,t)=>{e.writeByte(t?1:0);},Cn=e=>(t,r)=>{let[n,o]=r;t.writeVarint32(n),e[n](t,o);},I=(e,t)=>{let r=Rt.from(t),n=r.getPrecision();e.writeInt64(Math.round(r.amount*Math.pow(10,n))),e.writeUint8(n);for(let o=0;o<7;o++)e.writeUint8(r.symbol.charCodeAt(o)||0);},ke=(e,t)=>{e.writeUint32(Math.floor(new Date(t+"Z").getTime()/1e3));},ge=(e,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?e.append(new Uint8Array(33).fill(0)):e.append(Y.from(t).key);},Rn=(e=null)=>(t,r)=>{r=Tt.from(r);let n=r.buffer.length;if(e){if(n!==e)throw new Error(`Unable to serialize binary. Expected ${e} bytes, got ${n}`)}else t.writeVarint32(n);t.append(r.buffer);},Tn=Rn(),fr=(e,t)=>(r,n)=>{r.writeVarint32(n.length);for(let[o,i]of n)e(r,o),t(r,i);},V=e=>(t,r)=>{t.writeVarint32(r.length);for(let n of r)e(t,n);},le=e=>(t,r)=>{for(let[n,o]of e)try{o(t,r[n]);}catch(i){throw i.message=`${n}: ${i.message}`,i}},De=e=>(t,r)=>{r!==void 0?(t.writeByte(1),e(t,r)):t.writeByte(0);},W=le([["weight_threshold",X],["account_auths",fr(w,pe)],["key_auths",fr(ge,pe)]]),ms=le([["account",w],["weight",pe]]),mr=le([["base",I],["quote",I]]),gs=le([["account_creation_fee",I],["maximum_block_size",X],["hbd_interest_rate",pe]]),R=(e,t)=>{let r=le(t);return (n,o)=>{n.writeVarint32(e),r(n,o);}},E={};E.account_create=R(C.account_create,[["fee",I],["creator",w],["new_account_name",w],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",w]]);E.account_create_with_delegation=R(C.account_create_with_delegation,[["fee",I],["delegation",I],["creator",w],["new_account_name",w],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",w],["extensions",V(ie)]]);E.account_update=R(C.account_update,[["account",w],["owner",De(W)],["active",De(W)],["posting",De(W)],["memo_key",ge],["json_metadata",w]]);E.account_witness_proxy=R(C.account_witness_proxy,[["account",w],["proxy",w]]);E.account_witness_vote=R(C.account_witness_vote,[["account",w],["witness",w],["approve",we]]);E.cancel_transfer_from_savings=R(C.cancel_transfer_from_savings,[["from",w],["request_id",X]]);E.change_recovery_account=R(C.change_recovery_account,[["account_to_recover",w],["new_recovery_account",w],["extensions",V(ie)]]);E.claim_account=R(C.claim_account,[["creator",w],["fee",I],["extensions",V(ie)]]);E.claim_reward_balance=R(C.claim_reward_balance,[["account",w],["reward_hive",I],["reward_hbd",I],["reward_vests",I]]);E.comment=R(C.comment,[["parent_author",w],["parent_permlink",w],["author",w],["permlink",w],["title",w],["body",w],["json_metadata",w]]);E.comment_options=R(C.comment_options,[["author",w],["permlink",w],["max_accepted_payout",I],["percent_hbd",pe],["allow_votes",we],["allow_curation_rewards",we],["extensions",V(Cn([le([["beneficiaries",V(ms)]])]))]]);E.convert=R(C.convert,[["owner",w],["requestid",X],["amount",I]]);E.create_claimed_account=R(C.create_claimed_account,[["creator",w],["new_account_name",w],["owner",W],["active",W],["posting",W],["memo_key",ge],["json_metadata",w],["extensions",V(ie)]]);E.custom=R(C.custom,[["required_auths",V(w)],["id",pe],["data",Tn]]);E.custom_json=R(C.custom_json,[["required_auths",V(w)],["required_posting_auths",V(w)],["id",w],["json",w]]);E.decline_voting_rights=R(C.decline_voting_rights,[["account",w],["decline",we]]);E.delegate_vesting_shares=R(C.delegate_vesting_shares,[["delegator",w],["delegatee",w],["vesting_shares",I]]);E.delete_comment=R(C.delete_comment,[["author",w],["permlink",w]]);E.escrow_approve=R(C.escrow_approve,[["from",w],["to",w],["agent",w],["who",w],["escrow_id",X],["approve",we]]);E.escrow_dispute=R(C.escrow_dispute,[["from",w],["to",w],["agent",w],["who",w],["escrow_id",X]]);E.escrow_release=R(C.escrow_release,[["from",w],["to",w],["agent",w],["who",w],["receiver",w],["escrow_id",X],["hbd_amount",I],["hive_amount",I]]);E.escrow_transfer=R(C.escrow_transfer,[["from",w],["to",w],["hbd_amount",I],["hive_amount",I],["escrow_id",X],["agent",w],["fee",I],["json_meta",w],["ratification_deadline",ke],["escrow_expiration",ke]]);E.feed_publish=R(C.feed_publish,[["publisher",w],["exchange_rate",mr]]);E.limit_order_cancel=R(C.limit_order_cancel,[["owner",w],["orderid",X]]);E.limit_order_create=R(C.limit_order_create,[["owner",w],["orderid",X],["amount_to_sell",I],["min_to_receive",I],["fill_or_kill",we],["expiration",ke]]);E.limit_order_create2=R(C.limit_order_create2,[["owner",w],["orderid",X],["amount_to_sell",I],["exchange_rate",mr],["fill_or_kill",we],["expiration",ke]]);E.recover_account=R(C.recover_account,[["account_to_recover",w],["new_owner_authority",W],["recent_owner_authority",W],["extensions",V(ie)]]);E.request_account_recovery=R(C.request_account_recovery,[["recovery_account",w],["account_to_recover",w],["new_owner_authority",W],["extensions",V(ie)]]);E.reset_account=R(C.reset_account,[["reset_account",w],["account_to_reset",w],["new_owner_authority",W]]);E.set_reset_account=R(C.set_reset_account,[["account",w],["current_reset_account",w],["reset_account",w]]);E.set_withdraw_vesting_route=R(C.set_withdraw_vesting_route,[["from_account",w],["to_account",w],["percent",pe],["auto_vest",we]]);E.transfer=R(C.transfer,[["from",w],["to",w],["amount",I],["memo",w]]);E.transfer_from_savings=R(C.transfer_from_savings,[["from",w],["request_id",X],["to",w],["amount",I],["memo",w]]);E.transfer_to_savings=R(C.transfer_to_savings,[["from",w],["to",w],["amount",I],["memo",w]]);E.transfer_to_vesting=R(C.transfer_to_vesting,[["from",w],["to",w],["amount",I]]);E.vote=R(C.vote,[["voter",w],["author",w],["permlink",w],["weight",fs]]);E.withdraw_vesting=R(C.withdraw_vesting,[["account",w],["vesting_shares",I]]);E.witness_update=R(C.witness_update,[["owner",w],["url",w],["block_signing_key",ge],["props",gs],["fee",I]]);E.witness_set_properties=R(C.witness_set_properties,[["owner",w],["props",fr(w,Tn)],["extensions",V(ie)]]);E.account_update2=R(C.account_update2,[["account",w],["owner",De(W)],["active",De(W)],["posting",De(W)],["memo_key",De(ge)],["json_metadata",w],["posting_json_metadata",w],["extensions",V(ie)]]);E.create_proposal=R(C.create_proposal,[["creator",w],["receiver",w],["start_date",ke],["end_date",ke],["daily_pay",I],["subject",w],["permlink",w],["extensions",V(ie)]]);E.update_proposal_votes=R(C.update_proposal_votes,[["voter",w],["proposal_ids",V(En)],["approve",we],["extensions",V(ie)]]);E.remove_proposal=R(C.remove_proposal,[["proposal_owner",w],["proposal_ids",V(En)],["extensions",V(ie)]]);var ys=le([["end_date",ke]]);E.update_proposal=R(C.update_proposal,[["proposal_id",kn],["creator",w],["daily_pay",I],["subject",w],["permlink",w],["extensions",V(Cn([ie,ys]))]]);E.collateralized_convert=R(C.collateralized_convert,[["owner",w],["requestid",X],["amount",I]]);E.recurrent_transfer=R(C.recurrent_transfer,[["from",w],["to",w],["amount",I],["memo",w],["recurrence",pe],["executions",pe],["extensions",V(le([["type",Sn],["value",le([["pair_id",Sn]])]]))]]);var hs=(e,t)=>{let r=E[t[0]];if(!r)throw new Error(`No serializer for operation: ${t[0]}`);try{r(e,t[1]);}catch(n){throw n.message=`${t[0]}: ${n.message}`,n}},_s=le([["ref_block_num",pe],["ref_block_prefix",X],["expiration",ke],["operations",V(hs)],["extensions",V(w)]]),ws=le([["from",ge],["to",ge],["nonce",kn],["check",X],["encrypted",Rn()]]),de={Asset:I,Memo:ws,Price:mr,PublicKey:ge,String:w,Transaction:_s,UInt16:pe,UInt32:X};var at=e=>new Promise(t=>setTimeout(t,e));var Nn=(()=>{try{return !(typeof navigator<"u"&&navigator.product==="ReactNative")&&typeof process<"u"&&process.versions!=null&&process.versions.node!=null}catch{return false}})();function wr(){return Nn?{"User-Agent":x.userAgent}:{}}var Re={served:0,fallback:0,skipped:0,fallbackByReason:{status:0,rpcerror:0,timeout:0,transport:0,validate:0,parse:0}},Te=class extends Error{constructor(r,n){super(n);this.reason=r;}reason},qn=e=>e instanceof Error?e.message:typeof e=="string"?e:String(e),qt=0,Fn=0;async function bs(e,t,r,n,o,i){let s=t.indexOf(".");if(s<=0||s===t.length-1)throw new Te("transport",`method without an api prefix: ${t}`);let{signal:a,cleanup:c}=vr(Math.min(e.timeoutMs,n)),{signal:p,cleanup:l}=Kt(a,o);try{let f;try{f=await fetch(e.url,{method:"POST",body:JSON.stringify({api:t.slice(0,s),method:t.slice(s+1),params:r}),headers:{"Content-Type":"application/json",...wr(),...e.headers},signal:p});}catch(g){throw o?.aborted?g:new Te(a.aborted?"timeout":"transport",qn(g))}if(f.status!==200){try{await f.body?.cancel();}catch{}let g=f.status===502&&(f.headers.get("x-ssr-cache")??"").toUpperCase()==="RPCERROR";throw new Te(g?"rpcerror":"status",g?"proxy relayed a node error":`proxy answered ${f.status}`)}let m;try{m=await f.json();}catch(g){throw o?.aborted?g:new Te(a.aborted?"timeout":"parse",qn(g))}if(i&&!i(m))throw new Te("validate","proxy result rejected by validator");return m}finally{c(),l();}}var Z=class extends Error{name="RPCError";data;code;stack=void 0;constructor(t){super(t.message),this.code=t.code,"data"in t&&(this.data=t.data);}},Ke=class extends Error{node;rateLimitMs;isRateLimit;constructor(t,r,n={}){super(r),this.node=t,this.rateLimitMs=n.rateLimitMs??0,this.isRateLimit=n.isRateLimit??false;}};function Bn(e){if(!e)return 0;let t=Number(e);if(Number.isFinite(t))return t>0?t*1e3:0;let r=Date.parse(e);if(Number.isFinite(r)){let n=r-Date.now();return n>0?n:0}return 0}var vs=["ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","EAI_AGAIN"],Ps=["Failed to fetch","NetworkError when attempting to fetch","Load failed","fetch failed"];function As(e){if(!e)return "";let t=[String(e.name||""),String(e.message||""),String(e.code||"")],r=e.cause;for(let n=0;r&&n<5;n++)t.push(String(r.code||""),String(r.message||"")),r=r.cause;return t.join(" ")}function Os(e){if(!e)return false;if(e instanceof Ke)return true;if(e instanceof Z)return false;let t=As(e);return !!(vs.some(r=>t.includes(r))||Ps.some(r=>t.includes(r))||e instanceof SyntaxError||/Unexpected token|JSON\.parse|Unexpected end of JSON/i.test(t))}function gr(e,t){return !!(e===-32603||e<=-32e3&&e>=-32099||e===-32601||e===-32602&&/unable to parse|endpoint data|internal/i.test(t))}function Mn(e){let t=e.indexOf(".");return t>0?e.slice(0,t):e}var xs=1e4,Ss=6e4,Es=12e4,In=2,Dn=6e4,Kn=12e4,ks=30,ut=.3,yr=3,ct=5*6e4,Qn=6e4,Hn=1e3,Un=2e3,It=class{health=new Map;getOrCreate(t){let r=this.health.get(t);return r||(r={consecutiveFailures:0,lastFailureTime:0,rateLimitedUntil:0,rateLimitStreak:0,lastRateLimitAt:0,apiFailures:new Map,headBlock:0,headBlockUpdatedAt:0,ewmaLatencyMs:void 0,latencySampleCount:0,latencyUpdatedAt:0,lastProbeAt:Date.now(),apiLatency:new Map},this.health.set(t,r)),r}recordSuccess(t,r,n,o){let i=this.getOrCreate(t);if(i.consecutiveFailures=0,i.rateLimitStreak=0,r){let s=i.apiFailures.get(r);(!s||!(s.defective&&s.cooldownUntil>Date.now()))&&i.apiFailures.delete(r);}typeof n=="number"&&Number.isFinite(n)&&n>=0&&this.recordLatency(i,n,o??r);}recordSlowFailure(t,r,n){!Number.isFinite(r)||r<Un||this.recordLatency(this.getOrCreate(t),r,n);}getUsableLatencyMs(t,r){let n=this.health.get(t);if(!n)return;let o=Date.now();if(r!==void 0){let i=n.apiLatency.get(r);return i&&i.sampleCount>=yr&&o-i.updatedAt<=ct?i.ewmaMs:void 0}return this.isLatencyUsable(n,o)?n.ewmaLatencyMs:void 0}recordCensoredLatency(t,r,n){!Number.isFinite(r)||r<50||this.recordLatency(this.getOrCreate(t),r,n);}recordLatency(t,r,n){let o=Date.now();if(t.latencyUpdatedAt>0&&o-t.latencyUpdatedAt>ct&&(t.ewmaLatencyMs=void 0,t.latencySampleCount=0,t.apiLatency.clear()),t.ewmaLatencyMs=t.ewmaLatencyMs===void 0?r:ut*r+(1-ut)*t.ewmaLatencyMs,t.latencySampleCount++,t.latencyUpdatedAt=o,n!==void 0){let i=t.apiLatency.get(n);!i||o-i.updatedAt>ct?t.apiLatency.set(n,{ewmaMs:r,sampleCount:1,updatedAt:o}):(i.ewmaMs=ut*r+(1-ut)*i.ewmaMs,i.sampleCount++,i.updatedAt=o);}}recordFailure(t,r){let n=this.getOrCreate(t);if(r){let o=Date.now(),i=n.apiFailures.get(r)??{count:0,cooldownUntil:0,lastFailureTime:0};(i.cooldownUntil>0&&i.cooldownUntil<=o||i.lastFailureTime>0&&o-i.lastFailureTime>3e4)&&(i.count=0,i.cooldownUntil=0),i.count++,i.lastFailureTime=o,i.count>=In&&(i.cooldownUntil=o+Dn),n.apiFailures.set(r,i);}else n.consecutiveFailures++,n.lastFailureTime=Date.now();}recordDefectiveResponse(t,r){let n=this.getOrCreate(t),o=Date.now(),i=n.apiFailures.get(r)??{count:0,cooldownUntil:0,lastFailureTime:0};i.count=Math.max(i.count+1,In),i.lastFailureTime=o,i.cooldownUntil=o+Dn,i.defective=true,n.apiFailures.set(r,i);}recordRateLimit(t,r){let n=this.getOrCreate(t),o=Date.now();n.rateLimitStreak>0&&o-n.lastRateLimitAt>Es&&(n.rateLimitStreak=0);let i=typeof r=="number"&&Number.isFinite(r)&&r>0,s=i?r:Math.min(xs*2**n.rateLimitStreak,Ss);i||n.rateLimitStreak++,n.lastRateLimitAt=o,n.rateLimitedUntil=i?o+s:Math.max(n.rateLimitedUntil,o+s),n.consecutiveFailures++,n.lastFailureTime=o;}recordHeadBlock(t,r){if(!r||!Number.isFinite(r))return;let n=this.getOrCreate(t);n.headBlock=r,n.headBlockUpdatedAt=Date.now();}consensusHeadBlock(){let t=Date.now(),r=[];for(let n of this.health.values())n.headBlock>0&&t-n.headBlockUpdatedAt<=Kn&&r.push(n.headBlock);return r.length<2?0:(r.sort((n,o)=>n-o),r[Math.floor((r.length-1)/2)])}isNodeHealthy(t,r){let n=this.health.get(t);if(!n)return true;let o=Date.now();if(n.rateLimitedUntil>o||n.consecutiveFailures>=3&&o-n.lastFailureTime<3e4)return false;if(r){let s=n.apiFailures.get(r);if(s&&s.cooldownUntil>o)return false}let i=this.consensusHeadBlock();return !(i>0&&n.headBlock>0&&o-n.headBlockUpdatedAt<=Kn&&i-n.headBlock>ks)}getOrderedNodes(t,r){let n=[],o=[];for(let c of t)this.isNodeHealthy(c,r)?n.push(c):o.push(c);if(n.length<=1)return [...n,...o];let i=Date.now(),s=n.map((c,p)=>({node:c,i:p,score:this.scoreNode(c,i)})).sort((c,p)=>c.score-p.score||c.i-p.i).map(c=>c.node),a=this.pickReprobeCandidate(n,i);return a&&s[0]!==a?[a,...s.filter(c=>c!==a),...o]:[...s,...o]}isLatencyUsable(t,r){return !!t&&t.ewmaLatencyMs!==void 0&&t.latencySampleCount>=yr&&r-t.latencyUpdatedAt<=ct}scoreNode(t,r){let n=this.health.get(t);return this.isLatencyUsable(n,r)?n.ewmaLatencyMs:Hn}pickReprobeCandidate(t,r){let n=r-Qn,o,i=1/0;for(let s of t){let a=this.getOrCreate(s),c=Math.max(a.latencyUpdatedAt,a.lastProbeAt);c<=n&&c<i&&(o=s,i=c);}return o&&(this.getOrCreate(o).lastProbeAt=r),o}},j=new It,Ce=new It,hr=class{tokens=x.resilience.hedgeBucketCapacity;trySpend(){return this.clamp(),this.tokens>=1-1e-9?(this.tokens-=1,true):false}refill(){this.clamp(),this.tokens=Math.min(x.resilience.hedgeBucketCapacity,this.tokens+x.resilience.hedgeRefillPerSuccess);}clamp(){this.tokens>x.resilience.hedgeBucketCapacity&&(this.tokens=x.resilience.hedgeBucketCapacity);}get available(){return this.tokens}reset(t=x.resilience.hedgeBucketCapacity){this.tokens=t;}},_r=new hr;function Dt(e,t,r,n,o){let i=x.resilience;if(!i.adaptiveTimeout||o)return n;let s=e.getUsableLatencyMs(t,r);return s===void 0?n:Math.ceil(Math.min(n,Math.max(i.adaptiveTimeoutFloorMs,i.adaptiveTimeoutFactor*s)))}function br(e,t,r,n){r instanceof Ke?r.isRateLimit?e.recordRateLimit(t,r.rateLimitMs||void 0):e.recordFailure(t,n):r instanceof Z?e.recordFailure(t,n):e.recordFailure(t);}function Vn(e,t,r,n){if(!n||typeof n!="object"||!r.includes("get_dynamic_global_properties"))return;let o=n.head_block_number;typeof o=="number"&&e.recordHeadBlock(t,o);}function Cs(){if(typeof DOMException<"u")return new DOMException("The operation was aborted due to timeout","TimeoutError");let e=new Error("The operation was aborted due to timeout");return e.name="TimeoutError",e}function vr(e){if(e=Math.ceil(e),typeof AbortSignal.timeout=="function")return {signal:AbortSignal.timeout(e),cleanup:()=>{}};let t=new AbortController,r=setTimeout(()=>t.abort(Cs()),e);return {signal:t.signal,cleanup:()=>clearTimeout(r)}}function Kt(e,t){if(!t)return {signal:e,cleanup:()=>{}};if(typeof AbortSignal.any=="function")return {signal:AbortSignal.any([e,t]),cleanup:()=>{}};let r=new AbortController;if(e.aborted)return r.abort(e.reason),{signal:r.signal,cleanup:()=>{}};if(t.aborted)return r.abort(t.reason),{signal:r.signal,cleanup:()=>{}};let n=()=>r.abort(e.reason),o=()=>r.abort(t.reason);e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",o,{once:true});let i=()=>{e.removeEventListener("abort",n),t.removeEventListener("abort",o);};return {signal:r.signal,cleanup:i}}var pt=async(e,t,r,n=x.timeout,o=false,i)=>{let s=Math.floor(Math.random()*1e8),a={jsonrpc:"2.0",method:t,params:r,id:s},{signal:c,cleanup:p}=vr(n),{signal:l,cleanup:f}=Kt(c,i),m=()=>{p(),f();};try{let g=await fetch(e,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json",...wr()},signal:l});if(g.status===429)throw new Ke(e,"HTTP 429 Rate Limited",{rateLimitMs:Bn(g.headers.get("Retry-After")),isRateLimit:!0});if(g.status>=500&&g.status<600)throw new Ke(e,`HTTP ${g.status} from ${e}`);let _=await g.json();if(!_||typeof _.id>"u"||_.id!==s||_.jsonrpc!=="2.0")throw new Error("JSONRPC id mismatch");if("result"in _)return _.result;if("error"in _){let P=_.error;throw "message"in P&&"code"in P?new Z(P):_.error}throw _}catch(g){if(g instanceof Z||g instanceof Ke||i?.aborted)throw g;if(o)return pt(e,t,r,n,false,i);throw g}finally{m();}};function Ft(){return at(50+Math.random()*50)}function Rs(e){let{method:t,params:r,api:n,primary:o,hedgePool:i,callerTimeout:s,explicitTimeout:a,deadlineAt:c,externalSignal:p,onHedgeFired:l,validate:f}=e;return new Promise((m,g)=>{let _=false,P=0,O=false,T=false,q,ce,Se=0,A=[],U=$=>{if(!_){_=true,ce!==void 0&&(clearTimeout(ce),ce=void 0);for(let F of A)F.signal.aborted||F.abort();$();}},L=($,F)=>{P++;let me=new AbortController;A.push(me);let st=Kt(me.signal,p),ss=Dt(j,$,t,s,a),ir=Date.now();F||(Se=ir),pt($,t,r,ss,false,st.signal).then(oe=>{if(st.cleanup(),P--,F||(T=true),!_){if(f&&!f(oe)){if(j.recordDefectiveResponse($,n),q=new Error(`[hive-tx] response validation failed for ${t} from ${$}`),!F&&!O){U(()=>g(q));return}P===0&&U(()=>g(q));return}j.recordSuccess($,n,Date.now()-ir,t),Vn(j,$,t,oe),F?T||j.recordCensoredLatency(o,Date.now()-Se,t):O||_r.refill(),U(()=>m(oe));}}).catch(oe=>{if(st.cleanup(),P--,F||(T=true),!_){if(p?.aborted){U(()=>g(oe));return}if(oe instanceof Z&&!gr(oe.code,oe.message)){U(()=>g(oe));return}if(br(j,$,oe,n),j.recordSlowFailure($,Date.now()-ir,t),q=oe,!F&&!O){U(()=>g(oe));return}P===0&&U(()=>g(q));}});};L(o,false);let Q=j.getUsableLatencyMs(o,t)??0,J=Dt(j,o,t,s,a),z=Math.min(Math.max(x.resilience.hedgeDelayFloorMs,x.resilience.hedgeDelayFactor*Q),.8*J);ce=setTimeout(()=>{if(ce=void 0,_||p?.aborted||Date.now()>=c)return;let $=i.filter(me=>j.isNodeHealthy(me,n));if($.length===0)return;let F=$[Math.floor(Math.random()*$.length)];_r.trySpend()&&(O=true,l(F),L(F,true));},z);})}var y=async(e,t=[],r,n=x.retry,o,i)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an array");if(x.nodes.length===0)throw new Error("config.nodes is empty");let s=r!==void 0,a=r??x.timeout,c=Mn(e),p=Ct;if(p&&Nn&&p.methodSet.has(e))if(Date.now()<Fn)Re.skipped++;else try{let g=await bs(p,e,t,a,o,i);return Re.served++,qt=0,g}catch(g){if(o?.aborted)throw g;Re.fallback++;let _=g instanceof Te?g.reason:"transport";Re.fallbackByReason[_]=(Re.fallbackByReason[_]??0)+1,_==="rpcerror"?qt=0:++qt>=p.failureThreshold&&(Fn=Date.now()+p.cooldownMs,qt=0);}let l=Date.now()+x.resilience.totalBudgetFactor*a,f=new Set,m;for(let g=0;g<=n&&!(g>0&&Date.now()>=l);g++){let _=j.getOrderedNodes(x.nodes,c),P=_.find(q=>!f.has(q));P||(f.clear(),P=_[0]),f.add(P);let O=[];if(x.resilience.hedge&&j.getUsableLatencyMs(P,e)!==void 0&&(O=_.filter(q=>!f.has(q)&&j.isNodeHealthy(q,c)).slice(0,3)),O.length>0)try{return await Rs({method:e,params:t,api:c,primary:P,hedgePool:O,callerTimeout:a,explicitTimeout:s,deadlineAt:l,externalSignal:o,onHedgeFired:q=>f.add(q),validate:i})}catch(q){if(q instanceof Z&&!gr(q.code,q.message)||o?.aborted)throw q;m=q,g<n&&await Ft();continue}let T=Date.now();try{let q=await pt(P,e,t,Dt(j,P,e,a,s),!1,o);if(i&&!i(q)){j.recordDefectiveResponse(P,c),m=new Error(`[hive-tx] response validation failed for ${e} from ${P}`),g<n&&await Ft();continue}return j.recordSuccess(P,c,Date.now()-T,e),_r.refill(),Vn(j,P,e,q),q}catch(q){if(q instanceof Z&&!gr(q.code,q.message)||o?.aborted)throw q;br(j,P,q,c),j.recordSlowFailure(P,Date.now()-T,e),m=q,g<n&&await Ft();}}throw m},Ge=async(e,t=[],r=x.broadcastTimeout,n)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an array");if(x.nodes.length===0)throw new Error("config.nodes is empty");let o=Mn(e),i=new Set,s;for(let a=0;a<x.nodes.length;a++){let p=j.getOrderedNodes(x.nodes,o).find(l=>!i.has(l));if(!p)break;if(i.add(p),n?.aborted)throw new Error("Aborted");try{let l=await pt(p,e,t,r,!1,n);return j.recordSuccess(p,o),l}catch(l){if(l instanceof Z||n?.aborted||(br(j,p,l,o),s=l,!Os(l)))throw l}}throw s},Ts={balance:"/balance-api",hafah:"/hafah-api",hafbe:"/hafbe-api",hivemind:"/hivemind-api",hivesense:"/hivesense-api",reputation:"/reputation-api","nft-tracker":"/nft-tracker-api",hafsql:"/hafsql",status:"/status-api"};async function te(e,t,r,n,o=x.retry,i){if(!Array.isArray(x.restNodes))throw new Error("config.restNodes is not an array");if(x.restNodes.length===0)throw new Error("config.restNodes is empty");let s=n!==void 0,a=n??x.timeout,c=Date.now()+x.resilience.totalBudgetFactor*a,p=`${e}:${t}`,l=x.restNodesByApi?.[e]?.length?x.restNodesByApi[e]:x.restNodes,f=new Set,m,g=false;for(let _=0;_<=o&&!(_>0&&Date.now()>=c);_++){let P=Ce.getOrderedNodes(l,e),O=P.find(F=>!f.has(F));O||(f.clear(),O=P[0]),f.add(O);let T=O+Ts[e],q=t,ce=r||{},Se=new Set;Object.entries(ce).forEach(([F,me])=>{q.includes(`{${F}}`)&&(q=q.replace(`{${F}}`,encodeURIComponent(String(me))),Se.add(F));});let A=new URL(T+q);if(Object.entries(ce).forEach(([F,me])=>{Se.has(F)||(Array.isArray(me)?me.forEach(st=>A.searchParams.append(F,String(st))):A.searchParams.set(F,String(me)));}),i?.aborted)throw new Error("Aborted");g=false;let{signal:U,cleanup:L}=vr(Dt(Ce,O,p,a,s)),{signal:Q,cleanup:J}=Kt(U,i),z=()=>{L(),J();},$=Date.now();try{let F=await fetch(A.toString(),{signal:Q,headers:wr()});if(F.status===404)throw new Error("HTTP 404 - Hint: can happen on wrong params");if(F.status===429)throw Ce.recordRateLimit(O,Bn(F.headers.get("Retry-After"))||void 0),g=!0,new Error(`HTTP 429 Rate Limited by ${O}`);if(F.status===503)throw Ce.recordFailure(O,e),g=!0,new Error(`HTTP 503 Service Unavailable from ${O}`);if(!F.ok)throw Ce.recordFailure(O,e),g=!0,new Error(`HTTP ${F.status} from ${O}`);return Ce.recordSuccess(O,e,Date.now()-$,p),F.json()}catch(F){if(F?.message?.includes("HTTP 404")||i?.aborted)throw F;g||Ce.recordFailure(O,e),Ce.recordSlowFailure(O,Date.now()-$,p),m=F,_<o&&await Ft();}finally{z();}}throw m}var Nt=async(e,t=[],r=2,n)=>{if(!Array.isArray(x.nodes))throw new Error("config.nodes is not an Array");if(r>x.nodes.length)throw new Error("quorum > config.nodes.length");let i=(c=>{let p=[...c];for(let l=p.length-1;l>0;l--){let f=Math.floor(Math.random()*(l+1));[p[l],p[f]]=[p[f],p[l]];}return p})(x.nodes),s=Math.min(r,i.length),a=[];for(;s>0&&i.length>0;){let c=i.splice(0,s),p=[],l=[];for(let m=0;m<c.length;m++)p.push(pt(c[m],e,t,void 0,true,n).then(g=>l.push(g)).catch(()=>{}));await Promise.all(p),a.push(...l);let f=qs(a,r);if(f)return f;if(s=Math.min(r,i.length),s===0)throw new Error("No more nodes available.")}throw new Error("Couldn't reach quorum.")};function qs(e,t){let r=new Map;for(let o of e){let i=JSON.stringify(o);r.has(i)||r.set(i,[]),r.get(i).push(o);}let n=Array.from(r.values()).find(o=>o.length>=t);return n?n[0]:null}var Is=hexToBytes(x.chain_id),Ne=class e{transaction;expiration=6e4;txId;constructor(t){t?.transaction&&(t.transaction instanceof e?(this.transaction=t.transaction.transaction,this.expiration=t.transaction.expiration):this.transaction=t.transaction,this.transaction&&!Array.isArray(this.transaction.signatures)&&(this.transaction.signatures=[]),this.txId=this.digest().txId),t?.expiration&&(this.expiration=t.expiration);}async addOperation(t,r){this.transaction||await this.createTransaction(this.expiration),this.transaction.operations.push([t,r]);}sign(t){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");if(this.transaction){let{digest:r,txId:n}=this.digest();Array.isArray(t)||(t=[t]);for(let o of t){let i=o.sign(r);this.transaction.signatures.push(i.customToString());}return this.txId=n,this.transaction}else throw new Error("No transaction to sign")}async broadcast(t=false){if(!this.transaction)throw new Error("Attempted to broadcast an empty transaction. Add operations by .addOperation()");if(this.transaction.signatures.length===0)throw new Error("Attempted to broadcast a transaction with no signatures. Sign using .sign(keys)");try{await Ge("condenser_api.broadcast_transaction",[this.transaction]);}catch(i){if(!(i instanceof Z&&i.message.includes("Duplicate transaction check failed")))throw i}if(this.txId||(this.txId=this.digest().txId),!t)return {tx_id:this.txId,status:"unknown"};let r=60;await at(1e3);let n=await this.checkStatus(),o=1;for(;n?.status!=="within_irreversible_block"&&n?.status!=="expired_irreversible"&&n?.status!=="too_old"&&o<r;)await at(1e3+o*300),n=await this.checkStatus(),o++;return {tx_id:this.txId,status:n?.status??"unknown"}}digest(){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");let t=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN),r={...this.transaction};try{de.Transaction(t,r);}catch(s){throw new Error("Unable to serialize transaction: "+s)}t.flip();let n=new Uint8Array(t.toBuffer()),o=bytesToHex(sha256(n)).slice(0,40);return {digest:sha256(new Uint8Array([...Is,...n])),txId:o}}addSignature(t){if(!this.transaction)throw new Error("First create a transaction by .create(operations)");if(typeof t!="string")throw new Error("Signature must be string");if(t.length!==130)throw new Error("Signature must be 130 characters long");return this.transaction.signatures.push(t),this.transaction}async checkStatus(){return this.txId||(this.txId=this.digest().txId),y("transaction_status_api.find_transaction",{transaction_id:this.txId,expiration:this.transaction?.expiration})}createTransaction=async t=>{let r=await y("condenser_api.get_dynamic_global_properties",[]),n=hexToBytes(r.head_block_id),o=Number(new Uint32Array(n.buffer,n.byteOffset+4,1)[0]),i=new Date(Date.now()+t).toISOString().slice(0,-5);this.transaction={expiration:i,extensions:[],operations:[],ref_block_num:r.head_block_number&65535,ref_block_prefix:o,signatures:[]};}};var zn=new Uint8Array([128]),H=class e{key;constructor(t){this.key=t;try{secp256k1.getPublicKey(t);}catch{throw new Error("invalid private key")}}static from(t){return typeof t=="string"?e.fromString(t):new e(t)}static fromString(t){return new e(Bs(t).subarray(1))}static fromSeed(t){if(typeof t=="string")if(/^[0-9a-fA-F]+$/.test(t))t=hexToBytes(t);else {let n=[];for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);if(i<128)n.push(i);else if(i<2048)n.push(192|i>>6,128|i&63);else if(i>=55296&&i<=56319&&o+1<t.length){let s=t.charCodeAt(++o);i=65536+((i&1023)<<10)+(s&1023),n.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63);}else n.push(224|i>>12,128|i>>6&63,128|i&63);}t=new Uint8Array(n);}return new e(sha256(t))}static fromLogin(t,r,n="active"){let o=t+n+r;return e.fromSeed(o)}sign(t){let r=secp256k1.sign(t,this.key,{extraEntropy:true,format:"recovered",prehash:false}),n=parseInt(bytesToHex(r.subarray(0,1)),16);return Ee.from((n+31).toString(16)+bytesToHex(r.subarray(1)))}createPublic(t){return new Y(secp256k1.getPublicKey(this.key),t)}toString(){return Ns(new Uint8Array([...zn,...this.key]))}inspect(){let t=this.toString();return `PrivateKey: ${t.slice(0,6)}...${t.slice(-6)}`}getSharedSecret(t){let r=secp256k1.getSharedSecret(this.key,t.key);return sha512(r.subarray(1))}static randomKey(){return new e(secp256k1.keygen().secretKey)}},Jn=e=>sha256(sha256(e)),Ns=e=>{let t=Jn(e);return xn.encode(new Uint8Array([...e,...t.slice(0,4)]))},Bs=e=>{let t=xn.decode(e);if(!Wn(t.slice(0,1),zn))throw new Error("Private key network id mismatch");let r=t.slice(-4),n=t.slice(0,-4),o=Jn(n).slice(0,4);if(!Wn(r,o))throw new Error("Private key checksum mismatch");return n},Wn=(e,t)=>{if(e===t)return true;if(e.byteLength!==t.byteLength)return false;let r=e.byteLength,n=0;for(;n<r&&e[n]===t[n];)n++;return n===r};var Xn=(e,t,r,n=js())=>eo(e,t,n,r),Zn=(e,t,r,n,o)=>eo(e,t,r,n,o).message,eo=(e,t,r,n,o)=>{let i=r,s=e.getSharedSecret(t),a=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);a.writeUint64(i),a.append(s),a.flip();let c=sha512(new Uint8Array(a.toBuffer())),p=c.subarray(32,48),l=c.subarray(0,32),f=sha256(c).subarray(0,4),m=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);m.append(f),m.flip();let g=m.readUint32();if(o!==void 0){if(g!==o)throw new Error("Invalid key");n=Us(n,l,p);}else n=Vs(n,l,p);return {nonce:i,message:n,checksum:g}},Us=(e,t,r)=>{let n=e;return n=cbc(t,r).decrypt(n),n},Vs=(e,t,r)=>{let n=e;return n=cbc(t,r).encrypt(n),n},Ar=null,js=()=>{if(Ar===null){let r=secp256k1.utils.randomSecretKey();Ar=r[0]<<8|r[1];}let e=BigInt(Date.now()),t=++Ar%65536;return e=e<<BigInt(16)|BigInt(t),e};var to=e=>{let t=Js(e,33);return new Y(t)},$s=e=>e.readUint64(),Ws=e=>e.readUint32(),Gs=e=>{let t=e.readVarint32(),r=e.copy(e.offset,e.offset+t);return e.skip(t),new Uint8Array(r.toBuffer())},zs=e=>t=>{let r={},n=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);n.append(t),n.flip();for(let[o,i]of e)try{r[o]=i(n);}catch(s){throw s.message=`${o}: ${s.message}`,s}return r};function Js(e,t){if(e){let r=e.copy(e.offset,e.offset+t);return e.skip(t),new Uint8Array(r.toBuffer())}else throw Error("No buffer found on first parameter")}var Ys=zs([["from",to],["to",to],["nonce",$s],["check",Ws],["encrypted",Gs]]),ro={Memo:Ys};var oo=(e,t,r,n)=>{if(!r.startsWith("#"))return r;r=r.substring(1),so(),e=ao(e),t=Xs(t);let o=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);o.writeVString(r);let i=new Uint8Array(o.copy(0,o.offset).toBuffer()),{nonce:s,message:a,checksum:c}=Xn(e,t,i,n),p=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);de.Memo(p,{check:c,encrypted:a,from:e.createPublic(),nonce:s,to:t}),p.flip();let l=new Uint8Array(p.toBuffer());return "#"+xn.encode(l)},io=(e,t)=>{if(!t.startsWith("#"))return t;t=t.substring(1),so(),e=ao(e);let r=ro.Memo(xn.decode(t)),{from:n,to:o,nonce:i,check:s,encrypted:a}=r,p=e.createPublic().toString()===new Y(n.key).toString()?new Y(o.key):new Y(n.key);r=Zn(e,p,i,a,s);let l=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);return l.append(r),l.flip(),"#"+l.readVString()},Bt,so=()=>{if(Bt===void 0){let e;Bt=true;try{let t="5JdeC9P7Pbd1uGdFVEsJ41EkEnADbbHGq6p1BwFxm6txNBsQnsw",n=oo(t,"STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA","#memo\u7231");e=io(t,n);}finally{Bt=e==="#memo\u7231";}}if(Bt===false)throw new Error("This environment does not support encryption.")},ao=e=>typeof e=="string"?H.fromString(e):e,Xs=e=>typeof e=="string"?Y.fromString(e):e,uo={decode:io,encode:oo};var ne={};xt(ne,{buildWitnessSetProperties:()=>oa,makeBitMaskFilter:()=>ra,operations:()=>ta,validateUsername:()=>ea});var ea=e=>{let t="Account name should ";if(!e)return t+"not be empty.";let r=e.length;if(r<3)return t+"be longer.";if(r>16)return t+"be shorter.";/\./.test(e)&&(t="Each account segment should ");let n=e.split("."),o=n.length;for(let i=0;i<o;i++){let s=n[i];if(!/^[a-z]/.test(s))return t+"start with a lowercase letter.";if(!/^[a-z0-9-]*$/.test(s))return t+"have only lowercase letters, digits, or dashes.";if(!/[a-z0-9]$/.test(s))return t+"end with a lowercase letter or digit.";if(s.length<3)return t+"be longer."}return null},ta={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,pow:14,custom:15,report_over_production:16,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,pow2:30,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,custom_binary:35,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49,fill_convert_request:50,author_reward:51,curation_reward:52,comment_reward:53,liquidity_reward:54,interest:55,fill_vesting_withdraw:56,fill_order:57,shutdown_witness:58,fill_transfer_from_savings:59,hardfork:60,comment_payout_update:61,return_vesting_delegation:62,comment_benefactor_reward:63,producer_reward:64,clear_null_account_balance:65,proposal_pay:66,sps_fund:67,hardfork_hive:68,hardfork_hive_restore:69,delayed_voting:70,consolidate_treasury_balance:71,effective_comment_vote:72,ineffective_delete_comment:73,sps_convert:74,expired_account_notification:75,changed_recovery_account:76,transfer_to_vesting_completed:77,pow_reward:78,vesting_shares_split:79,account_created:80,fill_collateralized_convert_request:81,system_warning:82,fill_recurrent_transfer:83,failed_recurrent_transfer:84,limit_order_cancelled:85,producer_missed:86,proposal_fee:87,collateralized_convert_immediate_conversion:88,escrow_approved:89,escrow_rejected:90,proxy_cleared:91,declined_voting_rights:92},ra=e=>e.reduce(na,[BigInt(0),BigInt(0)]).map(t=>t!==BigInt(0)?t.toString():null),na=([e,t],r)=>r<64?[e|BigInt(1)<<BigInt(r),t]:[e,t|BigInt(1)<<BigInt(r-64)],oa=(e,t)=>{let r={extensions:[],owner:e,props:[]};for(let n of Object.keys(t)){if(t[n]===void 0)continue;let o;switch(n){case "key":case "new_signing_key":o=de.PublicKey;break;case "account_subsidy_budget":case "account_subsidy_decay":case "maximum_block_size":o=de.UInt32;break;case "hbd_interest_rate":o=de.UInt16;break;case "url":o=de.String;break;case "hbd_exchange_rate":o=de.Price;break;case "account_creation_fee":o=de.Asset;break;default:throw new Error(`Unknown witness prop: ${n}`)}r.props.push([n,ia(o,t[n])]);}return r.props.sort((n,o)=>n[0].localeCompare(o[0])),["witness_set_properties",r]},ia=(e,t)=>{let r=new D(D.DEFAULT_CAPACITY,D.LITTLE_ENDIAN);return e(r,t),r.flip(),bytesToHex(new Uint8Array(r.toBuffer()))};function Dg(e){let t;if(typeof e=="string"){let r=[];for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o<128)r.push(o);else if(o<2048)r.push(192|o>>6,128|o&63);else if(o>=55296&&o<=56319&&n+1<e.length){let i=e.charCodeAt(++n);o=65536+((o&1023)<<10)+(i&1023),r.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63);}else r.push(224|o>>12,128|o>>6&63,128|o&63);}t=new Uint8Array(r);}else t=e;return sha256(t)}function co(e){try{return H.fromString(e),!0}catch{return false}}async function ee(e,t){let r=new Ne;for(let n of e)await r.addOperation(n[0],n[1]);return r.sign(t),Ge("condenser_api.broadcast_transaction_synchronous",[r.transaction])}async function po(e,t){let r=new Ne;for(let n of e)await r.addOperation(n[0],n[1]);return r.sign(t),r.broadcast(false)}var aa=432e3;function lo(e,t){let r=Date.now()/1e3-t.last_update_time,n=Number(t.current_mana)+r*e/aa,o=Math.round(n/e*1e4);return !isFinite(o)||o<0?o=0:o>1e4&&(o=1e4),{current_mana:n,max_mana:e,percentage:o}}function ua(e){let t=parseFloat(e.vesting_shares),r=parseFloat(e.delegated_vesting_shares),n=parseFloat(e.received_vesting_shares),o=parseFloat(e.vesting_withdraw_rate),i=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,s=Math.min(o,i);return t-s-r+n}function Or(e){let t=ua(e)*1e6;return lo(t,e.voting_manabar)}function Mt(e){return lo(Number(e.max_rc),e.rc_manabar)}var fo=(c=>(c.COMMON="common",c.INFO="info",c.INSUFFICIENT_RESOURCE_CREDITS="insufficient_resource_credits",c.MISSING_AUTHORITY="missing_authority",c.TOKEN_EXPIRED="token_expired",c.NETWORK="network",c.TIMEOUT="timeout",c.VALIDATION="validation",c))(fo||{});function ze(e){let t=e?.error_description?String(e.error_description):"",r=e?.message?String(e.message):"",n=e?.error?String(e.error):"",o=t||r||String(e||""),i=a=>!!(n&&a.test(n)||t&&a.test(t)||r&&a.test(r)||o&&a.test(o));if(i(/please wait to transact/i)||i(/insufficient rc/i)||i(/rc mana|rc account|resource credits/i))return {message:"Insufficient Resource Credits. Please wait or power up.",type:"insufficient_resource_credits",originalError:e};if(i(/you may only post once every/i))return {message:"Please wait before posting again (minimum 3 second interval between comments).",type:"common",originalError:e};if(i(/your current vote on this comment is identical/i))return {message:"You have already voted with the same weight.",type:"info",originalError:e};if(i(/must claim something/i))return {message:"You must claim rewards before performing this action.",type:"info",originalError:e};if(i(/cannot claim that much vests/i))return {message:"Cannot claim that amount. Please check your pending rewards.",type:"info",originalError:e};if(i(/cannot delete a comment with net positive/i))return {message:"Cannot delete a comment with positive votes.",type:"info",originalError:e};if(i(/children == 0/i))return {message:"Cannot delete a comment with replies.",type:"common",originalError:e};if(i(/comment_cashout/i))return {message:"Cannot modify a comment that has already been paid out.",type:"common",originalError:e};if(i(/votes evaluating for comment that is paid out is forbidden/i))return {message:"Cannot vote on posts that have already been paid out.",type:"common",originalError:e};if(i(/no (active|owner|posting|memo) key available/i))return {message:"Key not available. Please provide your key to sign this operation.",type:"missing_authority",originalError:e};if(i(/missing (required )?active authority/i))return {message:"Missing active authority. This operation requires your active key.",type:"missing_authority",originalError:e};if(i(/missing (required )?owner authority/i))return {message:"Missing owner authority. This operation requires your owner key.",type:"missing_authority",originalError:e};if(i(/missing (required )?posting authority/i))return {message:"Missing posting authority. Please check your login method.",type:"missing_authority",originalError:e};if(n==="invalid_grant"||n==="unauthorized_access"||i(/token expired/i)||i(/invalid token/i)||i(/\bunauthorized\b/i)||i(/\bforbidden\b/i))return {message:"Authentication token expired. Please log in again.",type:"token_expired",originalError:e};if(i(/has already reblogged/i)||i(/already reblogged this post/i))return {message:"You have already reblogged this post.",type:"info",originalError:e};if(i(/duplicate transaction/i))return {message:"This transaction has already been processed.",type:"info",originalError:e};if(i(/econnrefused/i)||i(/connection refused/i)||i(/failed to fetch/i)||i(/\bnetwork[-\s]?(request|error|timeout|unreachable|down|failed)\b/i))return {message:"Network error. Please check your connection and try again.",type:"network",originalError:e};if(i(/timeout/i)||i(/timed out/i))return {message:"Request timed out. Please try again.",type:"timeout",originalError:e};if(i(/account.*does not exist/i)||i(/account not found/i))return {message:"Account not found. Please check the username.",type:"validation",originalError:e};if(i(/invalid memo key/i))return {message:"Invalid memo key. Cannot encrypt message.",type:"validation",originalError:e};if(i(/(?:insufficient.*(?:funds|balance)|(?:funds|balance).*insufficient)/i))return {message:"Insufficient funds for this transaction.",type:"validation",originalError:e};if(i(/\b(invalid|validation)\b/i))return {message:(e?.message||o).substring(0,150)||"Validation error occurred",type:"validation",originalError:e};if(e?.error_description&&typeof e.error_description=="string")return {message:e.error_description.substring(0,150),type:"common",originalError:e};if(e?.message&&typeof e.message=="string")return {message:e.message.substring(0,150),type:"common",originalError:e};let s;return typeof e=="object"&&e!==null?e.error_description?s=String(e.error_description):e.code?s=`Error code: ${e.code}`:o&&o!=="[object Object]"?s=o.substring(0,150):s="Unknown error occurred":s=o.substring(0,150)||"Unknown error occurred",{message:s,type:"common",originalError:e}}function ca(e){let t=ze(e);return [t.message,t.type]}function be(e){let{type:t}=ze(e);return t==="missing_authority"||t==="token_expired"}function pa(e){let{type:t}=ze(e);return t==="insufficient_resource_credits"}function la(e){let{type:t}=ze(e);return t==="info"}function da(e){let{type:t}=ze(e);return t==="network"||t==="timeout"}async function ve(e,t,r,n,o="posting",i,s,a="async"){let c=n?.adapter;switch(e){case "key":{if(!c)throw new Error("No adapter provided for key-based auth");let p=i;if(p===void 0)switch(o){case "owner":if(c.getOwnerKey)p=await c.getOwnerKey(t);else throw new Error("Owner key not supported by adapter. Owner operations (like account recovery) require master password login or manual key entry.");break;case "active":c.getActiveKey&&(p=await c.getActiveKey(t));break;case "memo":if(c.getMemoKey)p=await c.getMemoKey(t);else throw new Error("Memo key not supported by adapter. Use memo encryption methods instead.");break;default:p=await c.getPostingKey(t);break}if(!p)throw new Error(`No ${o} key available for ${t}`);let l=H.fromString(p);return a==="async"?await po(r,l):await ee(r,l)}case "hiveauth":{if(!c?.broadcastWithHiveAuth)throw new Error("HiveAuth not supported by adapter");return await c.broadcastWithHiveAuth(t,r,o)}case "hivesigner":{if(!c)throw new Error("No adapter provided for HiveSigner auth");if(o!=="posting"){if(c.broadcastWithHiveSigner)return await c.broadcastWithHiveSigner(t,r,o);throw new Error(`HiveSigner access token cannot sign ${o} operations. No platform broadcast available.`)}let p=s!==void 0?s:await c.getAccessToken(t);if(p)try{return (await new mo.Client({accessToken:p}).broadcast(r)).result}catch(l){if(c.broadcastWithHiveSigner&&be(l))return await c.broadcastWithHiveSigner(t,r,o);throw l}if(c.broadcastWithHiveSigner)return await c.broadcastWithHiveSigner(t,r,o);throw new Error(`No access token available for ${t}`)}case "keychain":{if(!c?.broadcastWithKeychain)throw new Error("Keychain not supported by adapter");return await c.broadcastWithKeychain(t,r,o)}case "custom":{if(!n?.broadcast)throw new Error("No custom broadcast function provided");return await n.broadcast(r,o)}default:throw new Error(`Unknown auth method: ${e}`)}}async function ma(e,t,r,n="posting",o="async"){let i=r?.adapter;if(i?.getLoginType){let l=await i.getLoginType(e,n);if(l){let f=i.hasPostingAuthorization?await i.hasPostingAuthorization(e):false;if(n==="posting"&&f&&l==="key")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!be(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to key:",m);}if(n==="posting"&&f&&l==="keychain")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!be(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to keychain/snap:",m);}if(n==="posting"&&f&&l==="hiveauth")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(m){if(!be(m))throw m;console.warn("[SDK] HiveSigner token auth failed, falling back to HiveAuth:",m);}try{return await ve(l,e,t,r,n,void 0,void 0,o)}catch(m){if(be(m)&&i.showAuthUpgradeUI&&(n==="posting"||n==="active")){let g=t.length>0?t[0][0]:"unknown",_=await i.showAuthUpgradeUI(n,g);if(!_)throw new Error(`Operation requires ${n} authority. User declined alternate auth.`);return await ve(_,e,t,r,n,void 0,void 0,o)}throw m}}if(n==="posting")try{return await ve("hivesigner",e,t,r,n,void 0,void 0,o)}catch(f){if(be(f)&&i.showAuthUpgradeUI){let m=t.length>0?t[0][0]:"unknown",g=await i.showAuthUpgradeUI(n,m);if(!g)throw new Error(`No login type available for ${e}. Please log in again.`);return await ve(g,e,t,r,n,void 0,void 0,o)}throw f}else if(n==="active"&&i.showAuthUpgradeUI){let f=t.length>0?t[0][0]:"unknown",m=await i.showAuthUpgradeUI(n,f);if(!m)throw new Error(`Operation requires ${n} authority. User declined alternate auth.`);return await ve(m,e,t,r,n,void 0,void 0,o)}}let s=r?.fallbackChain??["key","hiveauth","hivesigner","keychain","custom"],a=new Map;for(let l of s)try{let f=!1,m="",g,_;switch(l){case "key":if(!i)f=!0,m="No adapter provided";else {let P;switch(n){case "owner":i.getOwnerKey&&(P=await i.getOwnerKey(e));break;case "active":i.getActiveKey&&(P=await i.getActiveKey(e));break;case "memo":i.getMemoKey&&(P=await i.getMemoKey(e));break;default:P=await i.getPostingKey(e);break}P?g=P:(f=!0,m=`No ${n} key available`);}break;case "hiveauth":i?.broadcastWithHiveAuth||(f=!0,m="HiveAuth not supported by adapter");break;case "hivesigner":if(!i)f=!0,m="No adapter provided";else {let P=await i.getAccessToken(e);P&&(_=P);}break;case "keychain":i?.broadcastWithKeychain||(f=!0,m="Keychain not supported by adapter");break;case "custom":r?.broadcast||(f=!0,m="No custom broadcast function provided");break}if(f){a.set(l,new Error(`Skipped: ${m}`));continue}return await ve(l,e,t,r,n,g,_,o)}catch(f){if(a.set(l,f),!be(f))throw f}if(!Array.from(a.values()).some(l=>!l.message.startsWith("Skipped:"))){let l=Array.from(a.entries()).map(([f,m])=>`${f}: ${m.message}`).join(", ");throw new Error(`[SDK][Broadcast] No auth methods attempted for ${e}. ${l}`)}let p=Array.from(a.entries()).map(([l,f])=>`${l}: ${f.message}`).join(", ");throw new Error(`[SDK][Broadcast] All auth methods failed for ${e}. Errors: ${p}`)}function v(e=[],t,r,n=()=>{},o,i="posting",s){let a=s?.broadcastMode??"async";return useMutation({onSuccess:n,onMutate:s?.onMutate,onError:s?.onError,onSettled:s?.onSettled,mutationKey:[...e,t],mutationFn:async c=>{if(!t)throw new Error("[Core][Broadcast] Attempted to call broadcast API with anon user");let p=r(c);try{if(o?.enableFallback!==!1&&o?.adapter)return await ma(t,p,o,i,a);if(o?.broadcast)return await o.broadcast(p,i);let l=o?.postingKey;if(l){if(i!=="posting")throw new Error(`[SDK][Broadcast] Legacy auth only supports posting authority, but '${i}' was requested. Use AuthContextV2 with an adapter for ${i} operations.`);let m=H.fromString(l);return await ee(p,m)}let f=o?.accessToken;if(f)return (await new mo.Client({accessToken:f}).broadcast(p)).result;throw new Error("[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token")}catch(l){throw l instanceof Z?new Error(l.message):l}}})}async function go(e,t,r,n){if(!e)throw new Error("[Core][Broadcast] Attempted to call broadcast API with anon user");let o={id:t,required_auths:[],required_posting_auths:[e],json:JSON.stringify(r)};if(n?.broadcast)return n.broadcast([["custom_json",o]],"posting");let i=n?.postingKey;if(i){let c=H.fromString(i);return ee([["custom_json",o]],c)}let s=n?.accessToken;if(s)return (await new mo.Client({accessToken:s}).customJson([],[e],t,JSON.stringify(r))).result;let a=n?.adapter;if(a){let c=[["custom_json",o]];if(n?.loginType==="keychain"&&a.broadcastWithKeychain)return a.broadcastWithKeychain(e,c,"posting");if(n?.loginType==="hiveauth"&&a.broadcastWithHiveAuth)return a.broadcastWithHiveAuth(e,c,"posting")}throw new Error("[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token")}var Yg=4e3;function S(e,t,r){if(e?.invalidateQueries){if(t==="sync")return e.invalidateQueries(r);setTimeout(()=>e.invalidateQueries?.(r),4e3);}}function Pe(e,t){let r=AbortSignal.timeout(e);if(!t)return r;if(typeof AbortSignal.any=="function")return AbortSignal.any([t,r]);let n=new AbortController,o=()=>{let i=t.aborted?t.reason:r.reason;n.abort(i),t.removeEventListener("abort",o),r.removeEventListener("abort",o);};return t.aborted?n.abort(t.reason):r.aborted?n.abort(r.reason):(t.addEventListener("abort",o,{once:true}),r.addEventListener("abort",o,{once:true})),n.signal}var Be=(()=>{try{return process.env?.NODE_ENV==="development"}catch{return false}})(),ha=()=>{try{return process.env?.VITE_HELIUS_API_KEY}catch{return}},Ae=1e4,yo=120*1e3,Qt,_a;function wa(){return Qt?Qt():_a??=new QueryClient}var d={privateApiHost:"https://ecency.com",newsletterHost:void 0,defaultObserver:"ecency",clientId:"ecency-sdk",imageHost:"https://i.ecency.com",get hiveNodes(){return x.nodes},heliusApiKey:ha(),get queryClient(){return wa()},set queryClient(e){Qt=()=>e;},pollsApiHost:"https://poll.ecency.com",plausibleHost:"https://pl.ecency.com",dmcaAccounts:[],dmcaTags:[],dmcaPatterns:[],dmcaTagRegexes:[],dmcaPatternRegexes:[],_dmcaInitialized:false},M;(Se=>{function e(A){d.queryClient=A;}Se.setQueryClient=e;function t(A){Qt=A;}Se.setQueryClientResolver=t;function r(A){d.privateApiHost=A;}Se.setPrivateApiHost=r;function n(A){d.newsletterHost=A;}Se.setNewsletterHost=n;function o(A){d.clientId=A;}Se.setClientId=o;function i(A){if(typeof A!="string"||A.trim()==="")throw new Error("setDefaultObserver requires a non-empty Hive account. There is no empty-string opt-out; observer resolution would fall back to the post author while caching under an empty key.");d.defaultObserver=A;}Se.setDefaultObserver=i;function s(){return d.privateApiHost?d.privateApiHost:typeof window<"u"&&window.location?.origin?window.location.origin:"https://ecency.com"}Se.getValidatedBaseUrl=s;function a(A){d.pollsApiHost=A;}Se.setPollsApiHost=a;function c(A){d.imageHost=A;}Se.setImageHost=c;function p(A){ur(A);}Se.setHiveNodes=p;function l(A){cr(A);}Se.setRestNodes=l;function f(A){pr(A);}Se.setRestNodesByApi=f;function m(A){lr(A);}Se.setUserAgent=m;function g(A){dr(A);}Se.setResilience=g;function _(A){sr(A);}Se.setServerRpcProxy=_;function P(){return Re}Se.getServerRpcProxyStats=P;function O(A){if(/(\([^)]*[*+{][^)]*\))[*+{]/.test(A))return {safe:false,reason:"nested quantifiers detected"};if(/\([^|)]*\|[^)]*\)[*+{]/.test(A))return {safe:false,reason:"alternation with quantifier (potential overlap)"};if(/\([^)]*[*+][^)]*\)[*+]/.test(A))return {safe:false,reason:"repeated quantifiers (catastrophic backtracking risk)"};if(/\.\*\.\*/.test(A)||/\.\+\.\+/.test(A))return {safe:false,reason:"multiple greedy quantifiers on wildcards"};let U=/\.?\{(\d+),(\d+)\}/g,L;for(;(L=U.exec(A))!==null;){let[,Q,J]=L;if(parseInt(J,10)-parseInt(Q,10)>1e3)return {safe:false,reason:`excessive range: {${Q},${J}}`}}return {safe:true}}function T(A){let U=["a".repeat(50)+"x","ab".repeat(50)+"x","x".repeat(100),"aaa".repeat(30)+"bbb".repeat(30)+"x"],L=5;for(let Q of U){let J=Date.now();try{A.test(Q);let z=Date.now()-J;if(z>L)return {safe:!1,reason:`runtime test exceeded ${L}ms (took ${z}ms on input length ${Q.length})`}}catch(z){return {safe:false,reason:`runtime test threw error: ${z}`}}}return {safe:true}}function q(A,U=200){try{if(!A)return Be&&console.warn("[SDK] DMCA pattern rejected: empty pattern"),null;if(A.length>U)return Be&&console.warn(`[SDK] DMCA pattern rejected: length ${A.length} exceeds max ${U} - pattern: ${A.substring(0,50)}...`),null;let L=O(A);if(!L.safe)return Be&&console.warn(`[SDK] DMCA pattern rejected: static analysis failed (${L.reason}) - pattern: ${A.substring(0,50)}...`),null;let Q;try{Q=new RegExp(A);}catch(z){return Be&&console.warn(`[SDK] DMCA pattern rejected: compilation failed - pattern: ${A.substring(0,50)}...`,z),null}let J=T(Q);return J.safe?Q:(Be&&console.warn(`[SDK] DMCA pattern rejected: runtime test failed (${J.reason}) - pattern: ${A.substring(0,50)}...`),null)}catch(L){return Be&&console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${A.substring(0,50)}...`,L),null}}function ce(A={}){let U=z=>Array.isArray(z)?z.filter($=>typeof $=="string"):[],L=A||{},Q={accounts:U(L.accounts),tags:U(L.tags),patterns:U(L.posts)};d.dmcaAccounts=Q.accounts,d.dmcaTags=Q.tags,d.dmcaPatterns=Q.patterns,d.dmcaTagRegexes=Q.tags.map(z=>q(z)).filter(z=>z!==null),d.dmcaPatternRegexes=[];let J=Q.tags.length-d.dmcaTagRegexes.length;!d._dmcaInitialized&&Be&&(console.log("[SDK] DMCA configuration loaded:"),console.log(` - Accounts: ${Q.accounts.length}`),console.log(` - Tag patterns: ${d.dmcaTagRegexes.length}/${Q.tags.length} compiled (${J} rejected)`),console.log(` - Post patterns: ${Q.patterns.length} (using exact string matching)`),J>0&&console.warn(`[SDK] ${J} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`)),d._dmcaInitialized=true;}Se.setDmcaLists=ce;})(M||={});function cy(){return new QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:false,refetchOnMount:false}}})}var b=()=>d.queryClient,Aa;(s=>{function e(a){return b().getQueryData(a)}s.getQueryData=e;function t(a){return b().getQueryData(a)}s.getInfiniteQueryData=t;async function r(a){return await b().prefetchQuery(a),e(a.queryKey)}s.prefetchQuery=r;async function n(a){return await b().prefetchInfiniteQuery(a),t(a.queryKey)}s.prefetchInfiniteQuery=n;function o(a){return {prefetch:()=>r(a),getData:()=>e(a.queryKey),useClientQuery:()=>useQuery(a),fetchAndGet:()=>b().fetchQuery(a)}}s.generateClientServerQuery=o;function i(a){return {prefetch:()=>n(a),getData:()=>t(a.queryKey),useClientQuery:()=>useInfiniteQuery(a),fetchAndGet:()=>b().fetchInfiniteQuery(a)}}s.generateClientServerInfiniteQuery=i;})(Aa||={});function ly(e){return btoa(JSON.stringify(e))}function dy(e){let t=atob(e);if(t[0]==="{")return JSON.parse(t)}var ho=(n=>(n.HIVE="HIVE",n.HBD="HBD",n.VESTS="VESTS",n))(ho||{}),Ht=(e=>(e["@@000000021"]="HIVE",e["@@000000013"]="HBD",e["@@000000037"]="VESTS",e))(Ht||{});function k(e){if(typeof e=="string"){let t=e.split(" ");return {amount:parseFloat(t[0]),symbol:ho[t[1]]}}else return {amount:parseFloat(e.amount.toString())/Math.pow(10,e.precision),symbol:Ht[e.nai]}}var xr;function h(){if(!xr){if(typeof globalThis.fetch!="function")throw new Error("[Ecency][SDK] - global fetch is not available");xr=globalThis.fetch.bind(globalThis);}return xr}function _o(e){return typeof e=="string"?/^hive-\d+$/.test(e):false}function Oa(e){return e&&typeof e=="object"&&"data"in e&&"pagination"in e&&Array.isArray(e.data)}function se(e,t){return Oa(e)?e:{data:Array.isArray(e)?e:[],pagination:{total:Array.isArray(e)?e.length:0,limit:t,offset:0,has_next:false}}}function Je(e,t){return e/1e6*t}function wo(e){return e===void 0?true:parseInt(e.split("-")[0],10)<1980}var bo=60*1e3;function Oe(){return queryOptions({queryKey:u.core.dynamicProps(),refetchInterval:bo,staleTime:bo,queryFn:async({signal:e})=>{let[t,r,n,o,i]=await Promise.all([y("condenser_api.get_dynamic_global_properties",[],void 0,void 0,e),y("condenser_api.get_feed_history",[],void 0,void 0,e),y("condenser_api.get_chain_properties",[],void 0,void 0,e),y("condenser_api.get_reward_fund",["post"],void 0,void 0,e),y("database_api.get_hardfork_properties",{},void 0,void 0,e).catch(()=>({current_hardfork_version:"1.28.0",last_hardfork:28}))]),s=k(t.total_vesting_shares).amount,a=k(t.total_vesting_fund_hive).amount,c=0;Number.isFinite(s)&&s!==0&&Number.isFinite(a)&&(c=a/s*1e6);let p=k(r.current_median_history.base).amount,l=k(r.current_median_history.quote).amount,f=parseFloat(o.recent_claims),m=k(o.reward_balance).amount,g=Number(t.vote_power_reserve_rate??0),_=o.author_reward_curve??"linear",P=Number(o.content_constant??0),O=String(i.current_hardfork_version??"0.0.0"),T=Number(i.last_hardfork??0),q=t.hbd_print_rate,ce=t.hbd_interest_rate,Se=t.head_block_number,A=a,U=s,L=k(t.virtual_supply).amount,Q=t.vesting_reward_percent||0,J=n.account_creation_fee;return {hivePerMVests:c,base:p,quote:l,fundRecentClaims:f,fundRewardBalance:m,votePowerReserveRate:g,authorRewardCurve:_,contentConstant:P,currentHardforkVersion:O,lastHardfork:T,hbdPrintRate:q,hbdInterestRate:ce,headBlock:Se,totalVestingFund:A,totalVestingShares:U,virtualSupply:L,vestingRewardPercent:Q,accountCreationFee:J,raw:{globalDynamic:t,feedHistory:r,chainProps:n,rewardFund:o,hardforkProps:i}}}})}function ky(e="post"){return queryOptions({queryKey:u.core.rewardFund(e),queryFn:()=>y("condenser_api.get_reward_fund",[e])})}function Me(...e){let t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return e.slice(0,t)}var u={posts:{entry:e=>["posts","entry",e],postHeader:(e,t)=>["posts","post-header",e,t],content:(e,t)=>["posts","content",e,t],contentReplies:(e,t)=>["posts","content-replies",e,t],accountPosts:(e,t,r,n)=>["posts","account-posts",e,t,r,n],accountPostsPage:(e,t,r,n,o,i)=>["posts","account-posts-page",e,t,r,n,o,i],userPostVote:(e,t,r)=>["posts","user-vote",e,t,r],reblogs:(e,t)=>["posts","reblogs",e,t],entryActiveVotes:(e,t)=>["posts","entry-active-votes",e,t],rebloggedBy:(e,t)=>["posts","reblogged-by",e,t],tips:(e,t)=>["posts","tips",e,t],normalize:(e,t)=>["posts","normalize",e,t],drafts:e=>["posts","drafts",e],draftsInfinite:(e,t)=>Me("posts","drafts","infinite",e,t),schedules:e=>["posts","schedules",e],schedulesInfinite:(e,t)=>Me("posts","schedules","infinite",e,t),fragments:e=>["posts","fragments",e],fragmentsInfinite:(e,t)=>Me("posts","fragments","infinite",e,t),images:e=>["posts","images",e],galleryImages:e=>["posts","gallery-images",e],imagesInfinite:(e,t)=>Me("posts","images","infinite",e,t),promoted:e=>["posts","promoted",e],_promotedPrefix:["posts","promoted"],accountPostsBlogPrefix:e=>["posts","account-posts",e,"blog"],postsRanked:(e,t,r,n)=>["posts","posts-ranked",e,t,r,n],postsRankedPage:(e,t,r,n,o,i)=>["posts","posts-ranked-page",e,t,r,n,o,i],discussions:(e,t,r,n)=>["posts","discussions",e,t,r,n],discussion:(e,t,r)=>["posts","discussion",e,t,r],deletedEntry:e=>["posts","deleted-entry",e],commentHistory:(e,t,r)=>["posts","comment-history",e,t,r],trendingTags:()=>["posts","trending-tags"],trendingTagsWithStats:e=>["posts","trending-tags","stats",e],wavesFeed:(e={})=>["posts","waves","feed",e.tag??"",e.following??"",e.author??"",e.observer??"",e.limit??0,[...e.containers??[]].sort().join(",")],shortsFeed:(e={})=>["posts","waves","shorts",e.tag??"",e.author??"",e.observer??"",e.limit??0,[...e.containers??[]].sort().join(",")],wavesByHost:e=>["posts","waves","by-host",e],wavesByTag:(e,t)=>["posts","waves","by-tag",e,t],wavesFollowing:(e,t)=>["posts","waves","following",e,t],wavesTrendingTags:(e,t)=>["posts","waves","trending-tags",e,t],wavesByAccount:(e,t)=>["posts","waves","by-account",e,t],wavesTrendingAuthors:e=>["posts","waves","trending-authors",e],_prefix:["posts"]},accounts:{full:e=>["get-account-full",e],list:(...e)=>["accounts","list",...e],friends:(e,t,r,n)=>["accounts","friends",e,t,r,n],searchFriends:(e,t,r)=>["accounts","friends","search",e,t,r],subscriptions:e=>["accounts","subscriptions",e],followCount:e=>["accounts","follow-count",e],recoveries:e=>["accounts","recoveries",e],pendingRecovery:e=>["accounts","recoveries",e,"pending-request"],checkWalletPending:(e,t)=>["accounts","check-wallet-pending",e,t],mutedUsers:e=>["accounts","muted-users",e],following:(e,t,r,n)=>["accounts","following",e,t,r,n],followers:(e,t,r,n)=>["accounts","followers",e,t,r,n],search:(e,t)=>["accounts","search",e,t],profiles:(e,t)=>["accounts","profiles",e,t],lookup:(e,t)=>["accounts","lookup",e,t],transactions:(e,t,r)=>["accounts","transactions",e,t,r],favorites:e=>["accounts","favorites",e],favoritesInfinite:(e,t)=>Me("accounts","favorites","infinite",e,t),checkFavorite:(e,t)=>["accounts","favorites","check",e,t],relations:(e,t)=>["accounts","relations",e,t],bots:()=>["accounts","bots"],voteHistory:(e,t)=>["accounts","vote-history",e,t],reputations:(e,t)=>["accounts","reputations",e,t],bookmarks:e=>["accounts","bookmarks",e],bookmarksInfinite:(e,t)=>Me("accounts","bookmarks","infinite",e,t),referrals:e=>["accounts","referrals",e],referralsStats:e=>["accounts","referrals-stats",e],proMembers:()=>["accounts","pro-members"],_prefix:["accounts"]},notifications:{announcements:()=>["notifications","announcements"],spotlights:()=>["notifications","spotlights"],list:(e,t)=>["notifications",e,t],unreadCount:e=>["notifications","unread",e],settings:e=>["notifications","settings",e],_prefix:["notifications"]},core:{rewardFund:e=>["core","reward-fund",e],dynamicProps:()=>["core","dynamic-props"],chainProperties:()=>["core","chain-properties"],_prefix:["core"]},communities:{single:(e,t)=>["community","single",e,t],singlePrefix:e=>["community","single",e],context:(e,t)=>["community","context",e,t],rewarded:()=>["communities","rewarded"],list:(e,t,r)=>["communities","list",e,t,r],subscribers:e=>["communities","subscribers",e],subscribersInfinite:e=>["communities","subscribers","infinite",e],accountNotifications:(e,t)=>["communities","account-notifications",e,t]},proposals:{list:()=>["proposals","list"],proposal:e=>["proposals","proposal",e],votes:(e,t,r)=>["proposals","votes",e,t,r],votesPrefix:e=>["proposals","votes",e],votesByUser:e=>["proposals","votes","by-user",e]},search:{topics:(e,t)=>["search","topics",e,t],path:e=>["search","path",e],account:(e,t)=>["search","account",e,t],results:(e,t,r,n,o,i)=>["search",e,t,typeof r=="string"?r==="1"||r==="true":r,n,o,i],controversialRising:(e,t)=>["search","controversial-rising",e,t],similarEntries:(e,t,r)=>r?["search","similar-entries",e,t,r]:["search","similar-entries",e,t],api:(e,t,r,n,o,i)=>Me("search","api",e,t,r,n,o,i)},witnesses:{list:e=>["witnesses","list",e],votes:e=>["witnesses","votes",e],proxy:()=>["witnesses","proxy"],voters:(e,t,r,n,o)=>["witnesses","voters",e,t,r,n,o],voterCount:e=>["witnesses","voter-count",e]},wallet:{outgoingRcDelegations:(e,t)=>["wallet","outgoing-rc-delegations",e,t],vestingDelegations:(e,t)=>["wallet","vesting-delegations",e,t],withdrawRoutes:e=>["wallet","withdraw-routes",e],incomingRc:e=>["wallet","incoming-rc",e],conversionRequests:e=>["wallet","conversion-requests",e],receivedVestingShares:e=>["wallet","received-vesting-shares",e],savingsWithdraw:e=>["wallet","savings-withdraw",e],openOrders:e=>["wallet","open-orders",e],collateralizedConversionRequests:e=>["wallet","collateralized-conversion-requests",e],recurrentTransfers:e=>["wallet","recurrent-transfers",e],balanceHistory:(e,t,r)=>["wallet","balance-history",e,t,r],aggregatedHistory:(e,t,r)=>r===void 0?["wallet","aggregated-history",e,t]:["wallet","aggregated-history",e,t,r],portfolio:(e,t,r)=>["wallet","portfolio","v2",e,t,r]},assets:{hiveGeneralInfo:e=>["assets","hive","general-info",e],hiveTransactions:(e,t,r)=>["assets","hive","transactions",e,t,r],hiveWithdrawalRoutes:e=>["assets","hive","withdrawal-routes",e],hiveMetrics:e=>["assets","hive","metrics",e],hbdGeneralInfo:e=>["assets","hbd","general-info",e],hbdTransactions:(e,t,r)=>["assets","hbd","transactions",e,t,r],hivePowerGeneralInfo:e=>["assets","hive-power","general-info",e],hivePowerDelegates:e=>["assets","hive-power","delegates",e],hivePowerDelegatings:e=>["assets","hive-power","delegatings",e],hivePowerTransactions:(e,t,r)=>["assets","hive-power","transactions",e,t,r],pointsGeneralInfo:e=>["assets","points","general-info",e],pointsTransactions:(e,t)=>["assets","points","transactions",e,t],ecencyAssetInfo:(e,t,r)=>["ecency-wallets","asset-info",e,t,r]},market:{statistics:()=>["market","statistics"],orderBook:e=>["market","order-book",e],history:(e,t,r)=>["market","history",e,t,r],feedHistory:()=>["market","feed-history"],hiveHbdStats:()=>["market","hive-hbd-stats"],data:(e,t,r,n)=>["market","data",e,t,r,n],tradeHistory:(e,t,r)=>["market","trade-history",e,t,r],currentMedianHistoryPrice:()=>["market","current-median-history-price"]},analytics:{discoverCuration:e=>["analytics","discover-curation",e],pageStats:(e,t,r,n)=>["analytics","page-stats",e,t,r,n],discoverLeaderboard:e=>["analytics","discover-leaderboard",e]},promotions:{promotePrice:()=>["promotions","promote-price"],boostPlusPrices:()=>["promotions","boost-plus-prices"],boostPlusAccounts:e=>["promotions","boost-plus-accounts",e]},resourceCredits:{account:e=>["resource-credits","account",e],stats:()=>["resource-credits","stats"],resourceParams:()=>["resource-credits","resource-params"]},points:{points:(e,t)=>["points",e,t],_prefix:e=>["points",e]},polls:{details:(e,t)=>["polls","details",e,t],vote:(e,t)=>e&&t?["polls","vote",e,t]:["polls","vote"],_prefix:["polls"]},operations:{chainProperties:()=>["operations","chain-properties"]},games:{statusCheck:(e,t)=>["games","status-check",e,t]},quests:{status:e=>["quests","status",e]},newsletter:{subscriptions:e=>["newsletter","subscriptions",e],sender:(e,t,r)=>["newsletter","sender",e,t,r],issues:(e,t,r)=>["newsletter","issues",e,t,r],posts:(e,t,r,n)=>["newsletter","posts",e,t,r,n],_prefix:["newsletter"]},support:{settings:e=>["support","settings",e],_prefix:["support"]},badActors:{list:()=>["bad-actors","list"],_prefix:["bad-actors"]},ai:{prices:()=>["ai","prices"],assistPrices:e=>["ai","assist-prices",e],transcribePrice:e=>["ai","transcribe-price",e],_prefix:["ai"]}};function dt(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t+=1:n<2048?t+=2:n>=55296&&n<=56319&&r+1<e.length?(r++,t+=4):t+=3;}return t}function ye(e){let t=0,r=e;do t++,r>>>=7;while(r>0);return t}function Iy(e){return queryOptions({queryKey:u.ai.prices(),queryFn:async()=>{let r=await h()(d.privateApiHost+"/private-api/ai-generate-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok)throw new Error(`Failed to fetch AI generation prices: ${r.status}`);return await r.json()},staleTime:3e5,enabled:!!e})}function By(e,t){return queryOptions({queryKey:u.ai.assistPrices(e),queryFn:async()=>{let n=await h()(d.privateApiHost+"/private-api/ai-assist-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch AI assist prices: ${n.status}`);return await n.json()},staleTime:6e4,enabled:!!t})}function Uy(e,t){return queryOptions({queryKey:u.ai.transcribePrice(e),queryFn:async()=>{let n=await h()(d.privateApiHost+"/private-api/ai-transcribe-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch AI transcribe price: ${n.status}`);return await n.json()},staleTime:6e4,enabled:!!t})}function Ta(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function $y(e,t){return useMutation({mutationKey:["ai","generate-image"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][GenerateImage] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][AI][GenerateImage] \u2013 access token wasn't found");let o=await h()(d.privateApiHost+"/private-api/ai-generate-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,us:e,prompt:r.prompt,aspect_ratio:r.aspect_ratio??"1:1",power:r.power??1,idempotency_key:r.idempotency_key??Ta()})});if(!o.ok){let s=await o.text(),a={};try{a=JSON.parse(s);}catch{}let c=new Error(`[SDK][AI][GenerateImage] \u2013 failed with status ${o.status}${s?`: ${s}`:""}`);throw c.status=o.status,c.data=a,c}if(o.status===202){let s={};try{s=await o.json();}catch{}let a=new Error("[SDK][AI][GenerateImage] \u2013 delivery pending");throw a.status=202,a.data=s,a}return await o.json()},onSuccess:()=>{e&&b().invalidateQueries({queryKey:u.points._prefix(e)});}})}function Fa(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Jy(e,t){return useMutation({mutationKey:["ai","assist"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][Assist] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][AI][Assist] \u2013 access token wasn't found");let o=await h()(d.privateApiHost+"/private-api/ai-assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r.code??t,us:e,action:r.action,text:r.text,idempotency_key:Fa()})});if(!o.ok){let i=await o.text(),s={};try{s=JSON.parse(i);}catch{}let a=new Error(`[SDK][AI][Assist] \u2013 failed with status ${o.status}${i?`: ${i}`:""}`);throw a.status=o.status,a.data=s,a}return await o.json()},onSuccess:r=>{e&&(r.cost>0&&b().invalidateQueries({queryKey:u.points._prefix(e)}),b().invalidateQueries({queryKey:u.ai.assistPrices(e)}));}})}function Da(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function eh(e,t){return useMutation({mutationKey:["ai","transcribe"],mutationFn:async r=>{if(!e)throw new Error("[SDK][AI][Transcribe] \u2013 username wasn't provided");let n=r.code??t;if(!n)throw new Error("[SDK][AI][Transcribe] \u2013 access token wasn't found");let o=new FormData;o.append("code",n),o.append("duration_ms",String(Math.round(r.durationMs))),o.append("idempotency_key",r.idempotency_key??Da()),o.append("audio",r.audio,r.fileName??"clip.webm");let s=await h()(d.privateApiHost+"/private-api/ai-transcribe",{method:"POST",body:o});if(!s.ok){let a=await s.text(),c={};try{c=JSON.parse(a);}catch{}throw Object.assign(new Error(`[SDK][AI][Transcribe] \u2013 failed with status ${s.status}${a?`: ${a}`:""}`),{status:s.status,data:c})}return await s.json()},onSuccess:r=>{e&&(r.cost>0&&b().invalidateQueries({queryKey:u.points._prefix(e)}),b().invalidateQueries({queryKey:u.ai.transcribePrice(e)}));}})}function Sr(e){return !e.posting_json_metadata&&!e.json_metadata}function Na(e){return e?Object.values(e).some(t=>typeof t=="string"?t.length>0:t!=null):false}function B(e){return queryOptions({queryKey:u.accounts.full(e),queryFn:async({signal:t})=>{if(!e)return null;let[r,n]=await Promise.all([y("condenser_api.get_accounts",[[e]],void 0,void 0,t,p=>Array.isArray(p)),y("bridge.get_profile",{account:e},void 0,void 0,t).catch(p=>{if(t?.aborted)throw p;return null})]);if(!r?.[0])return null;let o=r[0];if(Sr(o)&&Na(n?.metadata?.profile)){let p=await y("condenser_api.get_accounts",[[e]],void 0,void 0,t,l=>Array.isArray(l)&&(!l[0]||!Sr(l[0])));if(p[0]&&!Sr(p[0]))o=p[0];else throw new Error(`[SDK][Accounts] \u2013 inconsistent account row for ${e}: empty json metadata while hivemind profile is populated`)}let i=Qe(o.posting_json_metadata),s=n?.stats,a=s?{account:o.name,follower_count:s.followers??0,following_count:s.following??0}:void 0,c=n?.reputation??0;return {name:o.name,owner:o.owner,active:o.active,posting:o.posting,memo_key:o.memo_key,post_count:o.post_count,created:o.created,posting_json_metadata:o.posting_json_metadata,last_vote_time:o.last_vote_time,last_post:o.last_post,json_metadata:o.json_metadata,reward_hive_balance:o.reward_hive_balance,reward_hbd_balance:o.reward_hbd_balance,reward_vesting_hive:o.reward_vesting_hive,reward_vesting_balance:o.reward_vesting_balance,balance:o.balance,hbd_balance:o.hbd_balance,savings_balance:o.savings_balance,savings_hbd_balance:o.savings_hbd_balance,savings_hbd_last_interest_payment:o.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:o.savings_hbd_seconds_last_update,savings_hbd_seconds:o.savings_hbd_seconds,next_vesting_withdrawal:o.next_vesting_withdrawal,pending_claimed_accounts:o.pending_claimed_accounts,vesting_shares:o.vesting_shares,delegated_vesting_shares:o.delegated_vesting_shares,received_vesting_shares:o.received_vesting_shares,vesting_withdraw_rate:o.vesting_withdraw_rate,to_withdraw:o.to_withdraw,withdrawn:o.withdrawn,witness_votes:o.witness_votes,proxy:o.proxy,recovery_account:o.recovery_account,proxied_vsf_votes:o.proxied_vsf_votes,voting_manabar:o.voting_manabar,voting_power:o.voting_power,downvote_manabar:o.downvote_manabar,follow_stats:a,reputation:c,profile:i}},enabled:!!e,staleTime:6e4})}var Ba=new Set(["__proto__","constructor","prototype"]);function Ut(e){if(!e||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function vo(e,t){let r={...e};for(let n of Object.keys(t)){if(Ba.has(n))continue;let o=t[n],i=r[n];Ut(o)&&Ut(i)?r[n]=vo(i,o):r[n]=o;}return r}function Ma(e){if(!(!e||!Array.isArray(e)))return e.map(({meta:t,...r})=>{if(!t||typeof t!="object")return {...r,meta:t};let{privateKey:n,username:o,...i}=t;return {...r,meta:i}})}function Qe(e){if(!e)return {};try{let t=JSON.parse(e);if(t&&typeof t=="object"&&t.profile&&typeof t.profile=="object")return t.profile}catch(t){console.warn("[SDK] Failed to parse posting_json_metadata:",t,{length:e?.length??0});}return {}}function Po(e){return Qe(e?.posting_json_metadata)}function Ao(e,t){if(!e)return t;if(!t)return e;let r=Object.keys(Qe(e.posting_json_metadata)).length;return Object.keys(Qe(t.posting_json_metadata)).length>r?t:e}function Qa(e){if(!e)return {};try{let t=JSON.parse(e);if(Ut(t))return t}catch(t){console.warn("[SDK] Failed to parse posting_json_metadata root:",t,{length:e?.length??0});}return {}}function Oo({existingPostingJsonMetadata:e,profile:t,tokens:r}){let n=Qa(e),o=Ut(n.profile)?n.profile:{},i=Er({existingProfile:o,profile:t,tokens:r});return JSON.stringify({...n,profile:i})}function Er({existingProfile:e,profile:t,tokens:r}){let{tokens:n,version:o,...i}=t??{},s=vo(e??{},i);return s.tokens&&!Array.isArray(s.tokens)&&(s.tokens=void 0),r!==void 0?s.tokens=r&&r.length>0?r:[]:n!==void 0&&(s.tokens=n),s.tokens=Ma(s.tokens),s.version=2,s}function Vt(e){return e.map(t=>{let r={name:t.name,owner:t.owner,active:t.active,posting:t.posting,memo_key:t.memo_key,post_count:t.post_count,created:t.created,reputation:t.reputation,posting_json_metadata:t.posting_json_metadata,last_vote_time:t.last_vote_time,last_post:t.last_post,json_metadata:t.json_metadata,reward_hive_balance:t.reward_hive_balance,reward_hbd_balance:t.reward_hbd_balance,reward_vesting_hive:t.reward_vesting_hive,reward_vesting_balance:t.reward_vesting_balance,balance:t.balance,hbd_balance:t.hbd_balance,savings_balance:t.savings_balance,savings_hbd_balance:t.savings_hbd_balance,savings_hbd_last_interest_payment:t.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:t.savings_hbd_seconds_last_update,savings_hbd_seconds:t.savings_hbd_seconds,next_vesting_withdrawal:t.next_vesting_withdrawal,pending_claimed_accounts:t.pending_claimed_accounts,vesting_shares:t.vesting_shares,delegated_vesting_shares:t.delegated_vesting_shares,received_vesting_shares:t.received_vesting_shares,vesting_withdraw_rate:t.vesting_withdraw_rate,to_withdraw:t.to_withdraw,withdrawn:t.withdrawn,witness_votes:t.witness_votes,proxy:t.proxy,recovery_account:t.recovery_account,proxied_vsf_votes:t.proxied_vsf_votes,voting_manabar:t.voting_manabar,voting_power:t.voting_power,downvote_manabar:t.downvote_manabar},n=Qe(t.posting_json_metadata);if(!n||Object.keys(n).length===0)try{let o=JSON.parse(t.json_metadata||"{}");o.profile&&(n=o.profile);}catch{}return (!n||Object.keys(n).length===0)&&(n={about:"",cover_image:"",location:"",name:"",profile_image:"",website:""}),{...r,profile:n}})}function Ha(e){return new TextEncoder().encode(e).length}function Ye(e){return e?Ha(e)<=16:false}function yh(e){return queryOptions({queryKey:u.accounts.list(...e),enabled:e.length>0,queryFn:async()=>{let t=e.filter(Ye);if(t.length===0)return [];let r=await y("condenser_api.get_accounts",[t],void 0,void 0,void 0,n=>Array.isArray(n));return Vt(r??[])}})}function vh(e){return queryOptions({queryKey:u.accounts.followCount(e),queryFn:()=>y("condenser_api.get_follow_count",[e])})}function Sh(e,t,r="blog",n=100){return queryOptions({queryKey:u.accounts.followers(e,t,r,n),queryFn:()=>y("condenser_api.get_followers",[e,t,r,n]),enabled:!!e})}function Th(e,t,r="blog",n=100){return queryOptions({queryKey:u.accounts.following(e,t,r,n),queryFn:()=>y("condenser_api.get_following",[e,t,r,n]),enabled:!!e})}var xo=1e3,Wa=20;function Kh(e){return queryOptions({queryKey:u.accounts.mutedUsers(e),queryFn:async()=>{let t=[],r="";for(let n=0;n<Wa;n++){let o=await y("condenser_api.get_following",[e,r,"ignore",xo]);if(!o?.length)break;let i=o.map(s=>s.following);if(i[0]===r&&(i=i.slice(1)),!i.length||(t.push(...i),o.length<xo))break;r=i[i.length-1];}return t},enabled:!!e})}function Uh(e,t=50){return queryOptions({queryKey:u.accounts.lookup(e,t),queryFn:async()=>Ye(e)?y("condenser_api.lookup_accounts",[e,t]):[],enabled:!!e,staleTime:1/0})}function Wh(e,t=5,r=[]){return queryOptions({queryKey:u.accounts.search(e,r),enabled:!!e,queryFn:async()=>(await y("condenser_api.lookup_accounts",[e,t])).filter(o=>r.length>0?!r.includes(o):true)})}var Ya=new Set(["ownerPublicKey","activePublicKey","postingPublicKey","memoPublicKey"]);function Yh(e,t){return queryOptions({queryKey:u.accounts.checkWalletPending(e,t??null),queryFn:async()=>{if(!e||!t)return {exist:false};let n=await h()(d.privateApiHost+"/private-api/wallets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,code:t})});if(!n.ok)return {exist:false};let o=await n.json(),i=Array.isArray(o)?o.flatMap(s=>{if(!s||typeof s!="object")return [];let a=s,c=typeof a.token=="string"?a.token:void 0;if(!c)return [];let p=a.meta&&typeof a.meta=="object"?{...a.meta}:{},l={},f=typeof a.address=="string"&&a.address?a.address:void 0,g=(typeof a.status=="number"?a.status===3:void 0)??false;f&&(l.address=f),l.show=g;let _={symbol:c,currency:c,address:f,show:g,type:"CHAIN",meta:l},P=[];for(let[O,T]of Object.entries(p))typeof O=="string"&&(Ya.has(O)||typeof T!="string"||!T||/^[A-Z0-9]{2,10}$/.test(O)&&P.push({symbol:O,currency:O,address:T,show:g,type:"CHAIN",meta:{address:T,show:g}}));return [_,...P]}):[];return {exist:i.length>0,tokens:i.length?i:void 0,wallets:i.length?i:void 0}},refetchOnMount:true})}function So(e,t){return queryOptions({queryKey:u.accounts.relations(e,t),enabled:!!e&&!!t,refetchOnMount:false,refetchInterval:36e5,queryFn:async()=>{let r={follows:false,ignores:false,blacklists:false,follows_muted:false,follows_blacklists:false};return !e||!t?r:await y("bridge.get_relationship_between_accounts",[e,t])??r}})}function s_(e){return queryOptions({queryKey:u.accounts.subscriptions(e),enabled:!!e,queryFn:async({signal:t})=>await y("bridge.list_all_subscriptions",{account:e},void 0,void 0,t)??[]})}function p_(e,t){return queryOptions({queryKey:u.accounts.bookmarks(e),enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Bookmarks] \u2013 missing auth");return await(await h()(d.privateApiHost+"/private-api/bookmarks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function l_(e,t,r=10){return infiniteQueryOptions({queryKey:u.accounts.bookmarksInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/bookmarks?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch bookmarks: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function g_(e,t){return queryOptions({queryKey:u.accounts.favorites(e),enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Favorites] \u2013 missing auth");return await(await h()(d.privateApiHost+"/private-api/favorites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function y_(e,t,r=10){return infiniteQueryOptions({queryKey:u.accounts.favoritesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/favorites?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch favorites: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function b_(e,t,r){return queryOptions({queryKey:u.accounts.checkFavorite(e,r),enabled:!!e&&!!t&&!!r,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts][Favorites] \u2013 missing auth");if(!r)throw new Error("[SDK][Accounts][Favorites] \u2013 no target username");let o=await h()(d.privateApiHost+"/private-api/favorites-check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,account:r})});if(!o.ok)throw new Error(`[SDK][Accounts][Favorites] \u2013 favorites-check failed with status ${o.status}: ${o.statusText}`);let i=await o.json();if(typeof i!="boolean")throw new Error(`[SDK][Accounts][Favorites] \u2013 favorites-check returned invalid type: expected boolean, got ${typeof i}`);return i}})}function O_(e,t){return queryOptions({enabled:!!e&&!!t,queryKey:u.accounts.recoveries(e),queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Accounts] Missing username or access token");return (await h()(d.privateApiHost+"/private-api/recoveries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})})).json()}})}function C_(e){return queryOptions({enabled:!!e,queryKey:u.accounts.pendingRecovery(e),queryFn:()=>y("database_api.find_change_recovery_account_requests",{accounts:[e]})})}function D_(e,t=50){return queryOptions({queryKey:u.accounts.reputations(e,t),enabled:!!e,queryFn:async()=>!e||!Ye(e)?[]:y("condenser_api.get_account_reputations",[e,t])})}var K=ne.operations,Eo={transfers:[K.transfer,K.transfer_to_savings,K.transfer_from_savings,K.cancel_transfer_from_savings,K.fill_transfer_from_savings,K.recurrent_transfer,K.fill_recurrent_transfer,K.escrow_transfer],"market-orders":[K.fill_convert_request,K.fill_order,K.fill_collateralized_convert_request,K.limit_order_create2,K.limit_order_create,K.limit_order_cancel],interests:[K.interest],"stake-operations":[K.return_vesting_delegation,K.withdraw_vesting,K.transfer_to_vesting,K.set_withdraw_vesting_route,K.update_proposal_votes,K.fill_vesting_withdraw,K.account_witness_proxy,K.delegate_vesting_shares],rewards:[K.author_reward,K.curation_reward,K.producer_reward,K.claim_reward_balance,K.comment_benefactor_reward,K.liquidity_reward,K.proposal_pay]},cu=Array.from(new Set(Object.values(Eo).flat()));function pu(e){return e.block*1e7+e.trx_in_block*100+e.op_pos}function lu(e){return e.replace(/_operation$/,"")}function du(e){return typeof e=="object"&&e!==null&&"nai"in e&&"amount"in e&&"precision"in e}function fu(e){if(!du(e))return e;let t=k(e),r=Ht[e.nai]??"UNKNOWN";return `${t.amount.toFixed(e.precision)} ${r}`}function mu(e){let t={};for(let[r,n]of Object.entries(e))t[r]=fu(n);return t}function V_(e,t=20,r=""){let n=r?Eo[r]:cu;return infiniteQueryOptions({queryKey:u.accounts.transactions(e??"",r,t),initialPageParam:null,queryFn:async({pageParam:o,signal:i})=>{if(!e)return {entries:[],currentPage:0};let s=async f=>{let m={"account-name":e,"operation-types":n.join(","),"page-size":t};return f!==null&&(m.page=f),await te("hafah","/accounts/{account-name}/operations",m,void 0,void 0,i)},a=f=>f.operations_result.map(m=>{let g=lu(m.op.type);return {...mu(m.op.value),num:pu(m),type:g,timestamp:m.timestamp,trx_id:m.trx_id}}),c=await s(o),p=a(c),l=o??c.total_pages;if(o===null&&p.length<t&&c.total_pages>1)try{let f=await s(c.total_pages-1);p=[...p,...a(f)],l=c.total_pages-1;}catch(f){if(i?.aborted)throw f}return {entries:p,currentPage:l}},getNextPageParam:o=>{let i=o.currentPage-1;return i>=1?i:void 0}})}function W_(){return queryOptions({queryKey:u.accounts.bots(),queryFn:async()=>{let e=await fetch(d.privateApiHost+"/private-api/public/bots",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch bots: ${e.status}`);return e.json()},refetchOnMount:true,staleTime:1/0})}function Y_(e){return infiniteQueryOptions({queryKey:u.accounts.referrals(e),initialPageParam:{maxId:void 0},queryFn:async({pageParam:t})=>{let{maxId:r}=t??{},n=M.getValidatedBaseUrl(),o=new URL(`/private-api/referrals/${e}`,n);r!==void 0&&o.searchParams.set("max_id",r.toString());let i=await fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(`Failed to fetch referrals: ${i.status}`);return i.json()},getNextPageParam:t=>{let r=t?.[t.length-1]?.id;return typeof r=="number"?{maxId:r}:void 0}})}function tw(e){return queryOptions({queryKey:u.accounts.referralsStats(e),queryFn:async()=>{let t=await fetch(d.privateApiHost+`/private-api/referrals/${e}/stats`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to fetch referral stats: ${t.status}`);let r=await t.json();if(!r)throw new Error("No Referrals for this user!");return {total:r.total??0,rewarded:r.rewarded??0}}})}function aw(e,t,r){let{followType:n="blog",limit:o=100,enabled:i=true}=r??{};return infiniteQueryOptions({queryKey:u.accounts.friends(e,t,n,o),initialPageParam:{startFollowing:""},enabled:i,refetchOnMount:true,queryFn:async({pageParam:s})=>{let{startFollowing:a}=s,l=(await y(`condenser_api.${t==="following"?"get_following":"get_followers"}`,[e,a===""?null:a,n,o])).map(g=>t==="following"?g.following:g.follower);return (await y("bridge.get_profiles",{accounts:l,observer:void 0})??[]).map(g=>({name:g.name,reputation:g.reputation,active:g.active}))},getNextPageParam:s=>s&&s.length===o?{startFollowing:s[s.length-1].name}:void 0})}var bu=30;function dw(e,t,r){return queryOptions({queryKey:u.accounts.searchFriends(e,t,r),refetchOnMount:false,enabled:false,queryFn:async()=>{if(!r)return [];let n=r.slice(0,-1),s=(await y(`condenser_api.${t==="following"?"get_following":"get_followers"}`,[e,n,"blog",1e3])).map(c=>t==="following"?c.following:c.follower).filter(c=>c.toLowerCase().includes(r.toLowerCase())).slice(0,bu);return (await y("bridge.get_profiles",{accounts:s,observer:void 0}))?.map(c=>({name:c.name,full_name:c.metadata.profile?.name||"",reputation:c.reputation,active:c.active}))??[]}})}function hw(e=20){return infiniteQueryOptions({queryKey:u.posts.trendingTags(),queryFn:async({pageParam:{afterTag:t}})=>y("condenser_api.get_trending_tags",[t,e]).then(r=>r.filter(n=>n.name!=="").filter(n=>!n.name.startsWith("hive-")).map(n=>n.name)),initialPageParam:{afterTag:""},getNextPageParam:t=>t?.length>0?{afterTag:t[t.length-1]}:void 0,staleTime:3600*1e3})}function Aw(e=250){return infiniteQueryOptions({queryKey:u.posts.trendingTagsWithStats(e),queryFn:async({pageParam:{afterTag:t}})=>y("condenser_api.get_trending_tags",[t,e]).then(r=>r.filter(n=>n.name!=="").filter(n=>!_o(n.name))),initialPageParam:{afterTag:""},getNextPageParam:t=>t?.length?{afterTag:t[t.length-1].name}:void 0,staleTime:1/0})}function Xe(e,t){return queryOptions({queryKey:u.posts.fragments(e),queryFn:async()=>t?(await h()(d.privateApiHost+"/private-api/fragments",{method:"POST",body:JSON.stringify({code:t}),headers:{"Content-Type":"application/json"}})).json():[],enabled:!!e&&!!t})}function Ew(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.fragmentsInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/fragments?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch fragments: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function Tw(e="feed"){return queryOptions({queryKey:u.posts.promoted(e),queryFn:async()=>{let t=M.getValidatedBaseUrl(),r=new URL("/private-api/promoted-entries",t);return e==="waves"&&r.searchParams.append("short_content","1"),await(await h()(r.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})).json()}})}function Kw(e){return queryOptions({queryKey:u.posts.entryActiveVotes(e?.author,e?.permlink),queryFn:async()=>y("condenser_api.get_active_votes",[e?.author,e?.permlink]),enabled:!!e})}function Hw(e,t,r){return queryOptions({queryKey:u.posts.userPostVote(e,t,r),queryFn:async()=>(await y("database_api.list_votes",{start:[e,t,r],limit:1,order:"by_voter_comment"}))?.votes?.[0]||null,enabled:!!e&&!!t&&!!r})}function $w(e,t){return queryOptions({queryKey:u.posts.content(e,t),enabled:!!e&&!!t,queryFn:async()=>y("condenser_api.get_content",[e,t])})}function Yw(e,t){return queryOptions({queryKey:u.posts.contentReplies(e,t),enabled:!!e&&!!t,queryFn:async()=>y("condenser_api.get_content_replies",{author:e,permlink:t})})}function rb(e,t){return queryOptions({queryKey:u.posts.postHeader(e,t),queryFn:async()=>y("bridge.get_post_header",{author:e,permlink:t}),initialData:null})}function re(e){return Array.isArray(e)?e.map(t=>ko(t)):ko(e)}function ko(e){if(!e)return e;let t=`@${e.author}/${e.permlink}`;return d.dmcaPatterns.includes(t)||d.dmcaPatternRegexes.some(n=>n.test(t))?{...e,body:"This post is not available due to a copyright/fraudulent claim.",title:""}:e}async function Co(e,t,r){try{let n=await Nt("bridge.get_post",{author:e,permlink:t,observer:r},1);if(n&&typeof n=="object"&&n.author===e&&n.permlink===t)return n}catch{}return null}function Ro(e,t,r="",n){let o=t?.trim(),i=`/@${e}/${o??""}`;return queryOptions({queryKey:u.posts.entry(i),queryFn:async()=>{if(!o||o==="undefined")return null;let s=await y("bridge.get_post",{author:e,permlink:o,observer:r});if(!s){let c=await Co(e,o,r);if(!c)return null;let p=n!==void 0?{...c,num:n}:c;return re(p)}let a=n!==void 0?{...s,num:n}:s;return re(a)},enabled:!!e&&!!t&&t.trim()!==""&&t.trim()!=="undefined"})}function ae(e,t,r){return y(`bridge.${e}`,t,void 0,void 0,r)}async function To(e,t,r,n){let{json_metadata:o}=e;if(o?.original_author&&o?.original_permlink&&o.tags?.[0]==="cross-post")try{let i=await qu(o.original_author,o.original_permlink,t,r,n);return i?{...e,original_entry:i,num:r}:e}catch{return e}return {...e,num:r}}async function qo(e,t,r){let n=e.map(ft),o=await Promise.all(n.map(i=>To(i,t,void 0,r)));return re(o)}async function Fo(e,t="",r="",n=20,o="",i="",s){let a=await ae("get_ranked_posts",{sort:e,start_author:t,start_permlink:r,limit:n,tag:o,observer:i},s);return Array.isArray(a)?qo(a,i,s):(a!=null&&console.warn(`[SDK] get_ranked_posts returned ${typeof a} instead of an array for sort=${e}; treating as no results.`),null)}async function kr(e,t,r="",n="",o=20,i="",s){if(d.dmcaAccounts.includes(t))return [];let a=await ae("get_account_posts",{sort:e,account:t,start_author:r,start_permlink:n,limit:o,observer:i},s);return Array.isArray(a)?qo(a,i,s):(a!=null&&console.warn(`[SDK] get_account_posts returned ${typeof a} instead of an array for account=${t}, sort=${e}; treating as no results.`),null)}function ft(e){let t={...e,active_votes:Array.isArray(e.active_votes)?[...e.active_votes]:[],beneficiaries:Array.isArray(e.beneficiaries)?[...e.beneficiaries]:[],blacklists:Array.isArray(e.blacklists)?[...e.blacklists]:[],replies:Array.isArray(e.replies)?[...e.replies]:[],stats:e.stats?{...e.stats}:null},r=["author","title","body","created","category","permlink","url","updated"];for(let n of r)t[n]==null&&(t[n]="");return t.author_reputation==null&&(t.author_reputation=0),t.children==null&&(t.children=0),t.depth==null&&(t.depth=0),t.net_rshares==null&&(t.net_rshares=0),t.payout==null&&(t.payout=0),t.percent_hbd==null&&(t.percent_hbd=0),t.stats||(t.stats={flag_weight:0,gray:false,hide:false,total_votes:0}),t.author_payout_value==null&&(t.author_payout_value="0.000 HBD"),t.curator_payout_value==null&&(t.curator_payout_value="0.000 HBD"),t.max_accepted_payout==null&&(t.max_accepted_payout="1000000.000 HBD"),t.payout_at==null&&(t.payout_at=""),t.pending_payout_value==null&&(t.pending_payout_value="0.000 HBD"),t.promoted==null&&(t.promoted="0.000 HBD"),t.is_paidout==null&&(t.is_paidout=false),t}async function qu(e="",t="",r="",n,o){let i=await ae("get_post",{author:e,permlink:t,observer:r},o);if(i){let s=ft(i),a=await To(s,r,n,o);return re(a)}}async function hb(e="",t=""){let r=await ae("get_post_header",{author:e,permlink:t});return r&&ft(r)}async function Io(e,t,r){let n=await ae("get_discussion",{author:e,permlink:t,observer:r||e});if(n){let o={};for(let[i,s]of Object.entries(n))o[i]=ft(s);return o}return n}async function Do(e,t=""){return ae("get_community",{name:e,observer:t})}async function _b(e="",t=100,r,n="rank",o=""){return ae("list_communities",{last:e,limit:t,query:r,sort:n,observer:o})}async function Ko(e){let t=await ae("normalize_post",{post:e});return t&&ft(t)}async function wb(e){return ae("list_all_subscriptions",{account:e})}async function bb(e){return ae("list_subscribers",{community:e})}async function vb(e,t){return ae("get_relationship_between_accounts",[e,t])}async function jt(e,t){return ae("get_profiles",{accounts:e,observer:t})}var Bo=(o=>(o.trending="trending",o.author_reputation="author_reputation",o.votes="votes",o.created="created",o))(Bo||{});function Cr(e){let t=e.match(/^(\d+\.?\d*)\s*([A-Z]+)$/);return t?{amount:parseFloat(t[1]),symbol:t[2]}:{amount:0,symbol:""}}function Fu(e,t,r){let n=l=>Cr(l.pending_payout_value).amount+Cr(l.author_payout_value).amount+Cr(l.curator_payout_value).amount,o=l=>l.net_rshares<0,i=l=>e.json_metadata?.pinned_reply===`${l.author}/${l.permlink}`,s={trending:(l,f)=>{if(o(l))return 1;if(o(f))return -1;let m=n(l),g=n(f);return m!==g?g-m:0},author_reputation:(l,f)=>{let m=l.author_reputation,g=f.author_reputation;return m>g?-1:m<g?1:0},votes:(l,f)=>{let m=l.children,g=f.children;return m>g?-1:m<g?1:0},created:(l,f)=>{if(o(l))return 1;if(o(f))return -1;let m=Date.parse(l.created),g=Date.parse(f.created);return m>g?-1:m<g?1:0}},a=t.sort(s[r]),c=a.findIndex(l=>i(l)),p=a[c];return c>=0&&(a.splice(c,1),a.unshift(p)),a}function Mo(e,t="created",r=true,n){let o=n||d.defaultObserver;return queryOptions({queryKey:u.posts.discussions(e?.author,e?.permlink,t,o),queryFn:async()=>{if(!e)return [];let i=await y("bridge.get_discussion",{author:e.author,permlink:e.permlink,observer:o}),s=i?Array.from(Object.values(i)):[];return re(s)},enabled:r&&!!e,select:i=>Fu(e,i,t),structuralSharing:(i,s)=>{if(!i||!s)return s;let a=i.filter(l=>l.is_optimistic===true),c=new Set(s.map(l=>`${l.author}/${l.permlink}`)),p=a.filter(l=>!c.has(`${l.author}/${l.permlink}`));return p.length>0?[...s,...p]:s}})}function kb(e,t,r,n=true){let o=r||d.defaultObserver;return queryOptions({queryKey:u.posts.discussion(e,t,o),enabled:n&&!!e&&!!t,queryFn:async()=>Io(e,t,o)})}function Db(e,t="posts",r=20,n="",o=true){return infiniteQueryOptions({queryKey:u.posts.accountPosts(e??"",t,r,n),enabled:!!e&&o,initialPageParam:{author:void 0,permlink:void 0,hasNextPage:true},queryFn:async({pageParam:i,signal:s})=>{if(!i?.hasNextPage||!e)return [];let a=await kr(t,e,i.author??"",i.permlink??"",r,n,s);return re(a??[])},getNextPageParam:i=>{let s=i?.[i.length-1],a=(i?.length??0)===r;if(a)return {author:s?.author,permlink:s?.permlink,hasNextPage:a}}})}function Kb(e,t="posts",r="",n="",o=20,i="",s=true){return queryOptions({queryKey:u.posts.accountPostsPage(e??"",t,r,n,o,i),enabled:!!e&&s,queryFn:async({signal:a}={})=>{if(!e)return [];let c=await kr(t,e,r,n,o,i,a);return re(c??[])}})}var Qo=new Map;function Bu(e){let t=Qo.get(e);return t||(t=r=>({...r,pages:r.pages.map(n=>Mu(n,e))}),Qo.set(e,t)),t}function Mu(e,t){let r=e.filter(i=>i.stats?.is_pinned),n=e.filter(i=>!i.stats?.is_pinned);if(t==="hot")return [...r,...n];let o=[...n].sort((i,s)=>new Date(s.created).getTime()-new Date(i.created).getTime());return [...r,...o]}function jb(e,t,r=20,n="",o=true,i={}){return infiniteQueryOptions({queryKey:u.posts.postsRanked(e,t,r,n),queryFn:async({pageParam:s,signal:a})=>{let c=t;d.dmcaTagRegexes.some(l=>l.test(t))&&(c="");let p=await y("bridge.get_ranked_posts",{sort:e,start_author:s.author,start_permlink:s.permlink,limit:r,tag:c,observer:n},void 0,void 0,a);if(p==null)return [];if(!Array.isArray(p))throw new Error(`[SDK] get_ranked_posts returned ${typeof p} for sort=${e}`);return re(p)},select:Bu(e),enabled:o,initialPageParam:{author:void 0,permlink:void 0},getNextPageParam:s=>{let a=s?.[s.length-1];if(a)return {author:a.author,permlink:a.permlink}}})}function Lb(e,t="",r="",n=20,o="",i="",s=true){return queryOptions({queryKey:u.posts.postsRankedPage(e,t,r,n,o,i),enabled:s,queryFn:async({signal:a}={})=>{let c=o;d.dmcaTagRegexes.some(l=>l.test(o))&&(c="");let p=await Fo(e,t,r,n,c,i,a);return re(p??[])}})}function Jb(e,t,r=200){return queryOptions({queryKey:u.posts.reblogs(e??"",r),queryFn:async()=>(await y("condenser_api.get_blog_entries",[e??t,0,r])).filter(o=>o.author!==t&&!o.reblogged_on.startsWith("1970-")).map(o=>({author:o.author,permlink:o.permlink})),enabled:!!e})}function tv(e,t){return queryOptions({queryKey:u.posts.rebloggedBy(e??"",t??""),queryFn:async()=>{if(!e||!t)return [];let r=await y("condenser_api.get_reblogged_by",[e,t]);return Array.isArray(r)?r:[]},enabled:!!e&&!!t})}function iv(e,t){return queryOptions({queryKey:u.posts.schedules(e),queryFn:async()=>{if(!e||!t)return [];let n=await h()(d.privateApiHost+"/private-api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch schedules: ${n.status}`);return n.json()},enabled:!!e&&!!t})}function sv(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.schedulesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/schedules?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch schedules: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function pv(e,t){return queryOptions({queryKey:u.posts.drafts(e),queryFn:async()=>{if(!e||!t)return [];let n=await h()(d.privateApiHost+"/private-api/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!n.ok)throw new Error(`Failed to fetch drafts: ${n.status}`);return n.json()},enabled:!!e&&!!t})}function lv(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.draftsInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/drafts?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch drafts: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}async function Uo(e){let r=await h()(d.privateApiHost+"/private-api/images",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok)throw new Error(`Failed to fetch images: ${r.status}`);return r.json()}function gv(e,t){return queryOptions({queryKey:u.posts.images(e),queryFn:async()=>!e||!t?[]:Uo(t),enabled:!!e&&!!t})}function yv(e,t){return queryOptions({queryKey:u.posts.galleryImages(e),queryFn:async()=>!e||!t?[]:Uo(t),enabled:!!e&&!!t})}function hv(e,t,r=10){return infiniteQueryOptions({queryKey:u.posts.imagesInfinite(e,r),queryFn:async({pageParam:n=0})=>{if(!e||!t)return {data:[],pagination:{total:0,limit:r,offset:0,has_next:false}};let i=await h()(`${d.privateApiHost}/private-api/images?format=wrapped&offset=${n}&limit=${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(`Failed to fetch images: ${i.status}`);let s=await i.json();return se(s,r)},initialPageParam:0,getNextPageParam:n=>{if(n.pagination.has_next)return n.pagination.offset+n.pagination.limit},enabled:!!e&&!!t})}function vv(e,t,r=false){return queryOptions({queryKey:u.posts.commentHistory(e,t,r),queryFn:async({signal:n})=>{let o=await fetch(d.privateApiHost+"/private-api/comment-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:e,permlink:t,onlyMeta:r?"1":""}),signal:n});if(!o.ok)throw new Error(`Failed to fetch comment history: ${o.status}`);return o.json()},enabled:!!e&&!!t})}function zu(e,t){let r=e?.trim(),n=t?.trim();if(!r||!n)throw new Error("Invalid entry path: author and permlink are required");let o=r.replace(/^@+/,""),i=n.replace(/^\/+/,"");if(!o||!i)throw new Error("Invalid entry path: author and permlink cannot be empty after normalization");return `@${o}/${i}`}function xv(e,t){let r=t?.trim(),n=e?.trim(),o=!!n&&!!r&&r!=="undefined",i=o?zu(n,r):"";return queryOptions({queryKey:u.posts.deletedEntry(i),queryFn:async({signal:s})=>{let a=await fetch(d.privateApiHost+"/private-api/comment-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:e,permlink:r||""}),signal:s});if(!a.ok)throw new Error(`Failed to fetch comment history: ${a.status}`);return a.json()},select:s=>{if(!s?.list?.[0])return null;let{body:a,title:c,tags:p}=s.list[0];return {body:a,title:c,tags:p}},enabled:o})}function Cv(e,t,r=true){return queryOptions({queryKey:u.posts.tips(e,t),queryFn:async()=>{let n=`/private-api/post-tips/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,o=await fetch(d.privateApiHost+n,{method:"GET",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to fetch post tips: ${o.status}`);return o.json()},enabled:!!e&&!!t&&r,staleTime:60*1e3})}function Yu(e,t){return {...e,id:e.id??e.post_id,created:e.created??e.timestamp,host:t}}function Xu(e){return {...e,id:e.id??e.post_id}}function he(e,t){if(!e)return null;let r=e.container??e,n=Yu(r,t),o=e.parent?Xu(e.parent):void 0;return {...e,id:e.id??e.post_id,created:e.created??e.timestamp,max_accepted_payout:e.max_accepted_payout||"1000000.000 HBD",pending_payout_value:e.pending_payout_value||"0.000 HBD",author_payout_value:e.author_payout_value||"0.000 HBD",curator_payout_value:e.curator_payout_value||"0.000 HBD",host:t,container:n,parent:o}}function Zu(e){return Array.isArray(e)?e:[]}async function Vo(e){let t=Mo(e,"created",true),r=await d.queryClient.fetchQuery(t),n=Zu(r);if(n.length<=1)return [];let o=n.filter(({parent_author:s,parent_permlink:a})=>s===e.author&&a===e.permlink);return o.length===0?[]:o.filter(s=>!s.stats?.gray)}function jo(e,t,r){return e.length===0?[]:e.map(n=>{let o=e.find(i=>i.author===n.parent_author&&i.permlink===n.parent_permlink&&i.author!==r);return {...n,id:n.post_id,host:r,container:t,parent:o}}).filter(n=>n.container.post_id!==n.post_id).sort((n,o)=>new Date(o.created).getTime()-new Date(n.created).getTime())}var rc=20;function Lo(e){return {containers:e.containers??[],tag:e.tag?.trim()||void 0,following:e.following?.trim().toLowerCase()||void 0,author:e.author?.trim().toLowerCase()||void 0,observer:e.observer?.trim().toLowerCase()||void 0,limit:e.limit??rc}}async function $o({containers:e,tag:t,following:r,author:n,observer:o,limit:i},s,a){let c=M.getValidatedBaseUrl(),p=new URL("/private-api/waves/feed",c);p.searchParams.set("limit",String(i)),s&&p.searchParams.set("cursor",s),e.forEach(m=>p.searchParams.append("container",m)),t&&p.searchParams.set("tag",t),r&&p.searchParams.set("following",r),n&&p.searchParams.set("author",n),o&&p.searchParams.set("observer",o);let l=await fetch(p.toString(),{method:"GET",signal:a});if(!l.ok)throw new Error(`Failed to fetch waves feed: ${l.status}`);let f=await l.json();return !Array.isArray(f)||f.length===0?[]:f.map(m=>{let g=he(m,m.host??"");return g?{...g,_cursor:m._cursor}:null}).filter(m=>!!m)}function Nv(e={}){let t=Lo(e),{containers:r,tag:n,following:o,author:i,observer:s,limit:a}=t;return infiniteQueryOptions({queryKey:u.posts.wavesFeed({containers:r,tag:n,following:o,author:i,observer:s,limit:a}),initialPageParam:void 0,queryFn:({pageParam:c,signal:p})=>$o(t,c,p),getNextPageParam:c=>{if(!(c.length<a))return c[c.length-1]?._cursor}})}function Bv(e={}){let t=Lo(e),{containers:r,tag:n,following:o,author:i,observer:s,limit:a}=t;return queryOptions({queryKey:[...u.posts.wavesFeed({containers:r,tag:n,following:o,author:i,observer:s,limit:a}),"latest"],staleTime:0,queryFn:({signal:c})=>$o(t,void 0,c)})}var oc=20;function ic(e){return {containers:e.containers??[],tag:e.tag?.trim()||void 0,author:e.author?.trim().toLowerCase()||void 0,observer:e.observer?.trim().toLowerCase()||void 0,limit:e.limit??oc}}async function sc({containers:e,tag:t,author:r,observer:n,limit:o},i,s){let a=M.getValidatedBaseUrl(),c=new URL("/private-api/waves/shorts",a);c.searchParams.set("limit",String(o)),i&&c.searchParams.set("cursor",i),e.forEach(f=>c.searchParams.append("container",f)),t&&c.searchParams.set("tag",t),r&&c.searchParams.set("author",r),n&&c.searchParams.set("observer",n);let p=await fetch(c.toString(),{method:"GET",signal:s});if(!p.ok)throw new Error(`Failed to fetch shorts feed: ${p.status}`);let l=await p.json();return !Array.isArray(l)||l.length===0?[]:l.map(f=>{let m=he(f,f.host??"");return m?{...m,active_votes:m.active_votes??[],video:f.video,_cursor:f._cursor}:null}).filter(f=>!!f)}function Vv(e={}){let t=ic(e),{containers:r,tag:n,author:o,observer:i,limit:s}=t;return infiniteQueryOptions({queryKey:u.posts.shortsFeed({containers:r,tag:n,author:o,observer:i,limit:s}),initialPageParam:void 0,queryFn:({pageParam:a,signal:c})=>sc(t,a,c),getNextPageParam:a=>{if(!(a.length<s))return a[a.length-1]?._cursor}})}var uc=5,cc=50;async function pc(e,t){let r=t?.author,n=t?.permlink,o=0,i=t?.post_id;for(;o<cc;){let s={sort:"posts",account:e,limit:uc,...r?{start_author:r}:{},...n?{start_permlink:n}:{}},a;try{a=await y("bridge.get_account_posts",s);}catch(l){return console.error("[SDK] getThreads get_account_posts error:",l),null}if(!a||a.length===0)return null;let c=a.map(l=>(l.id=l.post_id,l.host=e,l));for(let l of c){if(i&&l.post_id===i){i=void 0;continue}if(o+=1,l.stats?.gray){r=l.author,n=l.permlink;continue}let f;try{f=await Vo(l);}catch(m){console.error("[SDK] getThreads get_discussion error:",m),r=l.author,n=l.permlink;continue}if(f.length===0){r=l.author,n=l.permlink;continue}return {entries:jo(f,l,e)}}let p=c[c.length-1];if(!p)return null;r=p.author,n=p.permlink;}return null}function Jv(e){return infiniteQueryOptions({queryKey:u.posts.wavesByHost(e),initialPageParam:void 0,queryFn:async({pageParam:t})=>{let r=await pc(e,t);return r?r.entries:[]},getNextPageParam:t=>t?.[0]?.container})}var dc=40;function t0(e,t,r=dc){return infiniteQueryOptions({queryKey:u.posts.wavesByTag(e,t),initialPageParam:void 0,queryFn:async({signal:n})=>{try{let o=M.getValidatedBaseUrl(),i=new URL("/private-api/waves/tags",o);i.searchParams.set("container",e),i.searchParams.set("tag",t);let s=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json"},signal:n});if(!s.ok)throw new Error(`Failed to fetch waves by tag: ${s.status}`);return (await s.json()).slice(0,r).map(p=>he(p,e)).filter(p=>!!p).sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){return console.error("[SDK] Failed to fetch waves by tag",o),[]}},getNextPageParam:()=>{}})}function s0(e,t){let r=t?.trim().toLowerCase();return infiniteQueryOptions({queryKey:u.posts.wavesFollowing(e,r??""),enabled:!!r,initialPageParam:void 0,queryFn:async({signal:n})=>{if(!r)return [];try{let o=M.getValidatedBaseUrl(),i=new URL("/private-api/waves/following",o);i.searchParams.set("container",e),i.searchParams.set("username",r);let s=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json"},signal:n});if(!s.ok)throw new Error(`Failed to fetch waves following feed: ${s.status}`);let a=await s.json();if(!Array.isArray(a)||a.length===0)return [];let c=a.map(p=>he(p,e)).filter(p=>!!p);return c.length===0?[]:c.sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){return console.error("[SDK] Failed to fetch waves following feed",o),[]}},getNextPageParam:()=>{}})}function p0(e,t=24){let r=e?.trim()||void 0;return queryOptions({queryKey:u.posts.wavesTrendingTags(r??"",t),queryFn:async({signal:n})=>{try{let o=M.getValidatedBaseUrl(),i=new URL("/private-api/waves/trending/tags",o);r&&i.searchParams.set("container",r),i.searchParams.set("hours",t.toString());let s=await fetch(i.toString(),{method:"GET",signal:n});if(!s.ok)throw new Error(`Failed to fetch waves trending tags: ${s.status}`);return (await s.json()).map(({tag:c,posts:p})=>({tag:c,posts:p}))}catch(o){return console.error("[SDK] Failed to fetch waves trending tags",o),[]}}})}function g0(e,t){let r=t?.trim().toLowerCase();return infiniteQueryOptions({queryKey:u.posts.wavesByAccount(e,r??""),enabled:!!r,initialPageParam:void 0,queryFn:async({signal:n})=>{if(!r)return [];try{let o=M.getValidatedBaseUrl(),i=new URL("/private-api/waves/account",o);i.searchParams.set("container",e),i.searchParams.set("username",r);let s=await fetch(i.toString(),{method:"GET",signal:n});if(!s.ok)throw new Error(`Failed to fetch waves for account: ${s.status}`);let a=await s.json();if(!Array.isArray(a)||a.length===0)return [];let c=a.map(p=>he(p,e)).filter(p=>!!p);return c.length===0?[]:c.sort((p,l)=>new Date(l.created).getTime()-new Date(p.created).getTime())}catch(o){throw console.error("[SDK] Failed to fetch waves for account",o),o}},getNextPageParam:()=>{}})}function w0(e){return queryOptions({queryKey:u.posts.wavesTrendingAuthors(e),queryFn:async({signal:t})=>{try{let r=M.getValidatedBaseUrl(),n=new URL("/private-api/waves/trending/authors",r);n.searchParams.set("container",e);let o=await fetch(n.toString(),{method:"GET",signal:t});if(!o.ok)throw new Error(`Failed to fetch waves trending authors: ${o.status}`);return (await o.json()).map(({author:s,posts:a})=>({author:s,posts:a}))}catch(r){throw console.error("[SDK] Failed to fetch waves trending authors",r),r}}})}function O0(e,t=true){return queryOptions({queryKey:u.posts.normalize(e?.author??"",e?.permlink??""),enabled:t&&!!e,queryFn:async()=>Ko(e)})}function wc(e){return !!e&&typeof e=="object"&&"author"in e&&"permlink"in e&&"active_votes"in e}function Wo(e){let t=new Date(e);return (new Date().getTime()-t.getTime())/(1e3*60*60*24)}function q0(e,t){let{limit:r=20,filters:n=[],dayLimit:o=7}=t??{};return infiniteQueryOptions({queryKey:u.accounts.voteHistory(e,r),initialPageParam:{start:-1},queryFn:async({pageParam:i})=>{let{start:s}=i,a=await y("condenser_api.get_account_history",[e,s,r,...n]),p=a.map(([m,g])=>({...g.op[1],num:m,timestamp:g.timestamp})).filter(m=>m.voter===e&&m.weight!==0&&Wo(m.timestamp)<=o),l=[];for(let m of p){let g=await d.queryClient.fetchQuery(Ro(m.author,m.permlink));wc(g)&&l.push(g);}let[f]=a;return {lastDate:f?Wo(f[1].timestamp):0,lastItemFetched:f?f[0]:s,entries:l}},getNextPageParam:i=>({start:i.lastItemFetched})})}function N0(e,t,r=true){return queryOptions({queryKey:u.accounts.profiles(e,t??""),enabled:r&&e.length>0,queryFn:async()=>jt(e,t)})}function V0(e,t="HIVE",r=200){return infiniteQueryOptions({queryKey:u.wallet.balanceHistory(e??"",t,r),initialPageParam:null,queryFn:async({pageParam:n,signal:o})=>{if(!e)return {entries:[],currentPage:0};let i={"account-name":e,"coin-type":t,"page-size":r,direction:"desc"};n!==null&&(i.page=n);let s=await te("balance","/accounts/{account-name}/balance-history",i,void 0,void 0,o);return {entries:s.operations_result,currentPage:n??s.total_pages}},getNextPageParam:n=>{let o=n.currentPage-1;return o>=1?o:void 0},enabled:!!e})}function G0(e,t="HIVE",r="yearly"){return queryOptions({queryKey:u.wallet.aggregatedHistory(e??"",t,r),queryFn:async()=>e?await te("balance","/accounts/{account-name}/aggregated-history",{"account-name":e,"coin-type":t,granularity:r}):[],enabled:!!e,staleTime:6e4})}function X0(){return queryOptions({queryKey:u.accounts.proMembers(),queryFn:async()=>{let e=await fetch(d.privateApiHost+"/private-api/pro-members",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch pro members: ${e.status}`);return e.json()},staleTime:300*1e3})}function Z0(e){return new Set((e??[]).map(t=>t.toLowerCase()))}function iP(e,t,r){let n=useQueryClient(),{data:o}=useQuery(B(e));return v(["accounts","update"],e,i=>{let s=Ao(n.getQueryData(B(e).queryKey),o);if(!s)throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");return [["account_update2",{account:e,json_metadata:"",extensions:[],posting_json_metadata:Oo({existingPostingJsonMetadata:s.posting_json_metadata,profile:i.profile,tokens:i.tokens})}]]},async(i,s)=>{n.setQueryData(B(e).queryKey,a=>{if(!a)return a;let c=JSON.parse(JSON.stringify(a));return c.profile=Er({existingProfile:Po(a),profile:s.profile,tokens:s.tokens}),c}),await S(t?.adapter,r,[u.accounts.full(e)]);},t,void 0,{broadcastMode:r,onMutate:async()=>{if(e)try{await n.fetchQuery({...B(e),staleTime:0});}catch{}}})}function pP(e,t,r,n,o){return useMutation({mutationKey:["accounts","relation","update",e,t],mutationFn:async i=>{let s=So(e,t);await b().prefetchQuery(s);let a=b().getQueryData(s.queryKey);return await go(e,"follow",["follow",{follower:e,following:t,what:[...i==="toggle-ignore"&&!a?.ignores?["ignore"]:[],...i==="toggle-follow"&&!a?.follows?["blog"]:[]]}],r),{...a,ignores:i==="toggle-ignore"?!a?.ignores:a?.ignores,follows:i==="toggle-follow"?!a?.follows:a?.follows}},onError:o,onSuccess(i){n(i),b().setQueryData(u.accounts.relations(e,t),i),t&&b().invalidateQueries(B(t));}})}function Rr(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildVoteOp] Missing required parameters");if(n<-1e4||n>1e4)throw new Error("[SDK][buildVoteOp] Weight must be between -10000 and 10000");return ["vote",{voter:e,author:t,permlink:r,weight:n}]}function He(e,t,r,n,o,i,s){if(!e||!t||n===void 0||!i)throw new Error("[SDK][buildCommentOp] Missing required parameters");return ["comment",{parent_author:r,parent_permlink:n,author:e,permlink:t,title:o,body:i,json_metadata:JSON.stringify(s)}]}function Ue(e,t,r,n,o,i,s){if(!e||!t)throw new Error("[SDK][buildCommentOptionsOp] Missing required parameters");return ["comment_options",{author:e,permlink:t,max_accepted_payout:r,percent_hbd:n,allow_votes:o,allow_curation_rewards:i,extensions:s}]}function Tr(e,t){if(!e||!t)throw new Error("[SDK][buildDeleteCommentOp] Missing required parameters");return ["delete_comment",{author:e,permlink:t}]}function qr(e,t,r,n=false){if(!e||!t||!r)throw new Error("[SDK][buildReblogOp] Missing required parameters");let o={account:e,author:t,permlink:r};return n&&(o.delete="delete"),["custom_json",{id:"follow",json:JSON.stringify(["reblog",o]),required_auths:[],required_posting_auths:[e]}]}function Ve(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildTransferOp] Missing required parameters");return ["transfer",{from:e,to:t,amount:r,memo:n||""}]}function Ec(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildMultiTransferOps] Missing required parameters");return t.trim().split(/[\s,]+/).filter(Boolean).map(i=>Ve(e,i.trim(),r,n))}function kc(e,t,r,n,o,i){if(!e||!t||!r)throw new Error("[SDK][buildRecurrentTransferOp] Missing required parameters");if(o<24)throw new Error("[SDK][buildRecurrentTransferOp] Recurrence must be at least 24 hours");return ["recurrent_transfer",{from:e,to:t,amount:r,memo:n||"",recurrence:o,executions:i,extensions:[]}]}function Ze(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildTransferToSavingsOp] Missing required parameters");return ["transfer_to_savings",{from:e,to:t,amount:r,memo:n||""}]}function je(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildTransferFromSavingsOp] Missing required parameters");return ["transfer_from_savings",{from:e,to:t,amount:r,memo:n||"",request_id:o}]}function Go(e,t){if(!e||t===void 0)throw new Error("[SDK][buildCancelTransferFromSavingsOp] Missing required parameters");return ["cancel_transfer_from_savings",{from:e,request_id:t}]}function mt(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildClaimInterestOps] Missing required parameters");return [je(e,t,r,n,o),Go(e,o)]}function gt(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildTransferToVestingOp] Missing required parameters");return ["transfer_to_vesting",{from:e,to:t,amount:r}]}function yt(e,t){if(!e||!t)throw new Error("[SDK][buildWithdrawVestingOp] Missing required parameters");return ["withdraw_vesting",{account:e,vesting_shares:t}]}function ht(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildDelegateVestingSharesOp] Missing required parameters");return ["delegate_vesting_shares",{delegator:e,delegatee:t,vesting_shares:r}]}function _t(e,t,r,n){if(!e||!t||r===void 0)throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Missing required parameters");if(r<0||r>1e4)throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");return ["set_withdraw_vesting_route",{from_account:e,to_account:t,percent:r,auto_vest:n}]}function wt(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildConvertOp] Missing required parameters");return ["convert",{owner:e,amount:t,requestid:r}]}function Fr(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildCollateralizedConvertOp] Missing required parameters");return ["collateralized_convert",{owner:e,amount:t,requestid:r}]}function Le(e,t,r,n="tokens"){return ["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:JSON.stringify({contractName:n,contractAction:t,contractPayload:r})}]}function Ir(e,t){return ["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[e],json:JSON.stringify(t.map(r=>({symbol:r})))}]}function Dr(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildDelegateRcOp] Missing required parameters");let n=t.includes(",")?t.split(",").map(o=>o.trim()):[t];return ["custom_json",{id:"rc",json:JSON.stringify(["delegate_rc",{from:e,delegatees:n,max_rc:r}]),required_auths:[],required_posting_auths:[e]}]}function Kr(e,t){if(!e||!t)throw new Error("[SDK][buildFollowOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:["blog"]}]),required_auths:[],required_posting_auths:[e]}]}function Lt(e,t){if(!e||!t)throw new Error("[SDK][buildUnfollowOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:[]}]),required_auths:[],required_posting_auths:[e]}]}function Cc(e,t){if(!e||!t)throw new Error("[SDK][buildIgnoreOp] Missing required parameters");return ["custom_json",{id:"follow",json:JSON.stringify(["follow",{follower:e,following:t,what:["ignore"]}]),required_auths:[],required_posting_auths:[e]}]}function Rc(e,t){if(!e||!t)throw new Error("[SDK][buildUnignoreOp] Missing required parameters");return Lt(e,t)}function Nr(e,t){if(!e)throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");let r=t||new Date().toISOString().split(".")[0],n=["custom_json",{id:"notify",json:JSON.stringify(["setLastRead",{date:r}]),required_auths:[],required_posting_auths:[e]}],o=["custom_json",{id:"ecency_notify",json:JSON.stringify(["setLastRead",{date:r}]),required_auths:[],required_posting_auths:[e]}];return [n,o]}function Br(e,t,r){if(!e||!t||r===void 0)throw new Error("[SDK][buildWitnessVoteOp] Missing required parameters");return ["account_witness_vote",{account:e,witness:t,approve:r}]}function Mr(e,t){if(!e||t===void 0)throw new Error("[SDK][buildWitnessProxyOp] Missing required parameters");return ["account_witness_proxy",{account:e,proxy:t}]}function Qr(e,t){if(!e||!t.receiver||!t.subject||!t.permlink||!t.start||!t.end||!t.dailyPay)throw new Error("[SDK][buildProposalCreateOp] Missing required parameters");let r=new Date(t.start),n=new Date(t.end);if(r.toString()==="Invalid Date"||n.toString()==="Invalid Date")throw new Error("[SDK][buildProposalCreateOp] Invalid date format: start and end must be valid ISO date strings");return ["create_proposal",{creator:e,receiver:t.receiver,start_date:t.start,end_date:t.end,daily_pay:t.dailyPay,subject:t.subject,permlink:t.permlink,extensions:[]}]}function Hr(e,t,r){if(!e||!t||t.length===0||r===void 0)throw new Error("[SDK][buildProposalVoteOp] Missing required parameters");return ["update_proposal_votes",{voter:e,proposal_ids:t,approve:r,extensions:[]}]}function Tc(e,t){if(!e||!t||t.length===0)throw new Error("[SDK][buildRemoveProposalOp] Missing required parameters");return ["remove_proposal",{proposal_owner:e,proposal_ids:t,extensions:[]}]}function qc(e,t,r,n,o){if(e==null||typeof e!="number"||!t||!r||!n||!o)throw new Error("[SDK][buildUpdateProposalOp] Missing required parameters");return ["update_proposal",{proposal_id:e,creator:t,daily_pay:r,subject:n,permlink:o,extensions:[]}]}function Ur(e,t){if(!e||!t)throw new Error("[SDK][buildSubscribeOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["subscribe",{community:t}]),required_auths:[],required_posting_auths:[e]}]}function Vr(e,t){if(!e||!t)throw new Error("[SDK][buildUnsubscribeOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["unsubscribe",{community:t}]),required_auths:[],required_posting_auths:[e]}]}function jr(e,t,r,n){if(!e||!t||!r||!n)throw new Error(`[SDK][buildSetRoleOp] Missing required parameters: username=${e}, community=${t}, account=${r}, role=${n}`);return ["custom_json",{id:"community",json:JSON.stringify(["setRole",{community:t,account:r,role:n}]),required_auths:[],required_posting_auths:[e]}]}function Lr(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildUpdateCommunityOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["updateProps",{community:t,props:r}]),required_auths:[],required_posting_auths:[e]}]}function $r(e,t,r,n,o){if(!e||!t||!r||!n||o===void 0)throw new Error("[SDK][buildPinPostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([o?"pinPost":"unpinPost",{community:t,account:r,permlink:n}]),required_auths:[],required_posting_auths:[e]}]}function Wr(e,t,r,n,o,i){if(!e||!t||!r||!n||i===void 0)throw new Error("[SDK][buildMutePostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([i?"mutePost":"unmutePost",{community:t,account:r,permlink:n,notes:o}]),required_auths:[],required_posting_auths:[e]}]}function Fc(e,t,r,n,o){if(!e||!t||!r||o===void 0)throw new Error("[SDK][buildMuteUserOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify([o?"muteUser":"unmuteUser",{community:t,account:r,notes:n}]),required_auths:[],required_posting_auths:[e]}]}function Ic(e,t,r,n,o){if(!e||!t||!r||!n)throw new Error("[SDK][buildFlagPostOp] Missing required parameters");return ["custom_json",{id:"community",json:JSON.stringify(["flagPost",{community:t,account:r,permlink:n,notes:o}]),required_auths:[],required_posting_auths:[e]}]}var zo=(r=>(r.Buy="buy",r.Sell="sell",r))(zo||{}),Jo=(r=>(r.EMPTY="",r.SWAP="9",r))(Jo||{});function Wt(e,t,r,n,o,i){if(!e||!t||!r||!o||i===void 0)throw new Error("[SDK][buildLimitOrderCreateOp] Missing required parameters");return ["limit_order_create",{owner:e,orderid:i,amount_to_sell:t,min_to_receive:r,fill_or_kill:n,expiration:o}]}function $t(e,t=3){return e.toFixed(t)}function Dc(e,t,r,n,o=""){if(!e||n===void 0||!Number.isFinite(t)||t<=0||!Number.isFinite(r)||r<=0)throw new Error("[SDK][buildLimitOrderCreateOpWithType] Missing or invalid parameters");let i=new Date(Date.now());i.setDate(i.getDate()+27);let s=i.toISOString().split(".")[0],a=+`${o}${Math.floor(Date.now()/1e3).toString().slice(2)}`,c=n==="buy"?`${$t(t,3)} HBD`:`${$t(t,3)} HIVE`,p=n==="buy"?`${$t(r,3)} HIVE`:`${$t(r,3)} HBD`;return Wt(e,c,p,false,s,a)}function Gr(e,t){if(!e||t===void 0)throw new Error("[SDK][buildLimitOrderCancelOp] Missing required parameters");return ["limit_order_cancel",{owner:e,orderid:t}]}function zr(e,t,r,n){if(!e||!t||!r||!n)throw new Error("[SDK][buildClaimRewardBalanceOp] Missing required parameters");return ["claim_reward_balance",{account:e,reward_hive:t,reward_hbd:r,reward_vests:n}]}function Kc(e,t,r,n,o,i){if(!e||!o)throw new Error("[SDK][buildAccountUpdateOp] Missing required parameters");return ["account_update",{account:e,owner:t,active:r,posting:n,memo_key:o,json_metadata:i}]}function Nc(e,t,r,n){if(!e||r===void 0)throw new Error("[SDK][buildAccountUpdate2Op] Missing required parameters");return ["account_update2",{account:e,json_metadata:t||"",posting_json_metadata:r,extensions:n||[]}]}function Jr(e,t,r,n){if(!e||!t||!r||!n)throw new Error("[SDK][buildAccountCreateOp] Missing required parameters");let o={weight_threshold:1,account_auths:[],key_auths:[[r.ownerPublicKey,1]]},i={weight_threshold:1,account_auths:[],key_auths:[[r.activePublicKey,1]]},s={weight_threshold:1,account_auths:[["ecency.app",1]],key_auths:[[r.postingPublicKey,1]]};return ["account_create",{creator:e,new_account_name:t,owner:o,active:i,posting:s,memo_key:r.memoPublicKey,json_metadata:"",fee:n}]}function Yr(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildCreateClaimedAccountOp] Missing required parameters");let n={weight_threshold:1,account_auths:[],key_auths:[[r.ownerPublicKey,1]]},o={weight_threshold:1,account_auths:[],key_auths:[[r.activePublicKey,1]]},i={weight_threshold:1,account_auths:[["ecency.app",1]],key_auths:[[r.postingPublicKey,1]]};return ["create_claimed_account",{creator:e,new_account_name:t,owner:n,active:o,posting:i,memo_key:r.memoPublicKey,json_metadata:"",extensions:[]}]}function Xr(e,t){if(!e||!t)throw new Error("[SDK][buildClaimAccountOp] Missing required parameters");return ["claim_account",{creator:e,fee:t,extensions:[]}]}function Zr(e,t,r,n,o,i){if(!e||!t||!r||!o)throw new Error("[SDK][buildGrantPostingPermissionOp] Missing required parameters");let s=t.account_auths.findIndex(([p])=>p===r),a=[...t.account_auths];s>=0?a[s]=[r,n]:a.push([r,n]);let c={...t,account_auths:a};return c.account_auths.sort((p,l)=>p[0]>l[0]?1:-1),["account_update",{account:e,posting:c,memo_key:o,json_metadata:i}]}function Bc(e,t,r,n,o){if(!e||!t||!r||!n)throw new Error("[SDK][buildRevokePostingPermissionOp] Missing required parameters");let i={...t,account_auths:t.account_auths.filter(([s])=>s!==r)};return ["account_update",{account:e,posting:i,memo_key:n,json_metadata:o}]}function Mc(e,t,r=[]){if(!e||!t)throw new Error("[SDK][buildChangeRecoveryAccountOp] Missing required parameters");return ["change_recovery_account",{account_to_recover:e,new_recovery_account:t,extensions:r}]}function Qc(e,t,r,n=[]){if(!e||!t||!r)throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");return ["request_account_recovery",{recovery_account:e,account_to_recover:t,new_owner_authority:r,extensions:n}]}function Hc(e,t,r,n=[]){if(!e||!t||!r)throw new Error("[SDK][buildRecoverAccountOp] Missing required parameters");return ["recover_account",{account_to_recover:e,new_owner_authority:t,recent_owner_authority:r,extensions:n}]}function en(e,t,r){if(!e||!t||!Number.isFinite(r))throw new Error("[SDK][buildBoostPlusOp] Missing required parameters");return ["custom_json",{id:"ecency_boost_plus",json:JSON.stringify({user:e,account:t,duration:r}),required_auths:[e],required_posting_auths:[]}]}function tn(e,t){if(!e||!Number.isInteger(t)||t<=0)throw new Error("[SDK][buildRcDelegationOp] Missing or invalid parameters");return ["custom_json",{id:"ecency_rc_delegation",json:JSON.stringify({user:e,duration:t}),required_auths:[e],required_posting_auths:[]}]}function rn(e,t,r,n){if(!e||!t||!r||!Number.isFinite(n))throw new Error("[SDK][buildPromoteOp] Missing required parameters");return ["custom_json",{id:"ecency_promote",json:JSON.stringify({user:e,author:t,permlink:r,duration:n}),required_auths:[e],required_posting_auths:[]}]}function et(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildPointTransferOp] Missing required parameters");let o=r.replace(/POINTS\b/,"POINT");return ["custom_json",{id:"ecency_point_transfer",json:JSON.stringify({sender:e,receiver:t,amount:o,memo:n||""}),required_auths:[e],required_posting_auths:[]}]}function Uc(e,t,r,n){if(!e||!t||!r)throw new Error("[SDK][buildMultiPointTransferOps] Missing required parameters");let o=t.trim().split(/[\s,]+/).filter(Boolean);if(o.length===0)throw new Error("[SDK][buildMultiPointTransferOps] Missing valid destinations");return o.map(i=>et(e,i.trim(),r,n))}function nn(e){if(!e)throw new Error("[SDK][buildCommunityRegistrationOp] Missing required parameters");return ["custom_json",{id:"ecency_registration",json:JSON.stringify({name:e}),required_auths:[e],required_posting_auths:[]}]}function Vc(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildActiveCustomJsonOp] Missing required parameters");return ["custom_json",{id:t,json:JSON.stringify(r),required_auths:[e],required_posting_auths:[]}]}function jc(e,t,r){if(!e||!t||!r)throw new Error("[SDK][buildPostingCustomJsonOp] Missing required parameters");return ["custom_json",{id:t,json:JSON.stringify(r),required_auths:[],required_posting_auths:[e]}]}function TP(e,t,r){return v(["accounts","follow"],e,({following:n})=>[Kr(e,n)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.relations(e,o.following),u.accounts.full(o.following),u.accounts.followCount(o.following),u.accounts.followCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function DP(e,t,r){return v(["accounts","unfollow"],e,({following:n})=>[Lt(e,n)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.relations(e,o.following),u.accounts.full(o.following),u.accounts.followCount(o.following),u.accounts.followCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function MP(e,t,r,n){return useMutation({mutationKey:["accounts","bookmarks","add",e],mutationFn:async({author:o,permlink:i})=>{if(!e||!t)throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");return (await h()(d.privateApiHost+"/private-api/bookmarks-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:o,permlink:i,code:t})})).json()},onSuccess:()=>{r(),b().invalidateQueries({queryKey:["accounts","bookmarks",e]});},onError:n})}function VP(e,t,r,n){return useMutation({mutationKey:["accounts","bookmarks","delete",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");return (await h()(d.privateApiHost+"/private-api/bookmarks-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:o,code:t})})).json()},onSuccess:()=>{r(),b().invalidateQueries({queryKey:["accounts","bookmarks",e]});},onError:n})}function WP(e,t,r,n){return useMutation({mutationKey:["accounts","favorites","add",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Favorites] \u2013 missing auth");return (await h()(d.privateApiHost+"/private-api/favorites-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:o,code:t})})).json()},onSuccess:(o,i)=>{r();let s=b();s.invalidateQueries({queryKey:u.accounts.favorites(e)}),s.invalidateQueries({queryKey:u.accounts.favoritesInfinite(e)}),s.invalidateQueries({queryKey:u.accounts.checkFavorite(e,i)});},onError:n})}function XP(e,t,r,n){return useMutation({mutationKey:["accounts","favorites","delete",e],mutationFn:async o=>{if(!e||!t)throw new Error("[SDK][Account][Favorites] \u2013 missing auth");let s=await h()(d.privateApiHost+"/private-api/favorites-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:o,code:t})});if(!s.ok)throw new Error(`Failed to delete favorite: ${s.status}`);return s.json()},onMutate:async o=>{if(!e)return;let i=b(),s=u.accounts.favorites(e),a=u.accounts.favoritesInfinite(e),c=u.accounts.checkFavorite(e,o);await Promise.all([i.cancelQueries({queryKey:s}),i.cancelQueries({queryKey:a}),i.cancelQueries({queryKey:c})]);let p=i.getQueryData(s);p&&i.setQueryData(s,p.filter(g=>g.account!==o));let l=i.getQueryData(c);i.setQueryData(c,false);let f=i.getQueriesData({queryKey:a}),m=new Map(f);for(let[g,_]of f)_&&i.setQueryData(g,{..._,pages:_.pages.map(P=>({...P,data:P.data.filter(O=>O.account!==o)}))});return {previousList:p,previousInfinite:m,previousCheck:l}},onSuccess:(o,i)=>{r();let s=b();s.invalidateQueries({queryKey:u.accounts.favorites(e)}),s.invalidateQueries({queryKey:u.accounts.favoritesInfinite(e)}),s.invalidateQueries({queryKey:u.accounts.checkFavorite(e,i)});},onError:(o,i,s)=>{let a=b();if(s?.previousList&&a.setQueryData(u.accounts.favorites(e),s.previousList),s?.previousInfinite)for(let[c,p]of s.previousInfinite)a.setQueryData(c,p);s?.previousCheck!==void 0&&a.setQueryData(u.accounts.checkFavorite(e,i),s.previousCheck),n(o);}})}function Yc(e,t){let r=new Map;return e.forEach(([n,o])=>{r.set(n.toString(),o);}),t.forEach(([n,o])=>{r.set(n.toString(),o);}),Array.from(r.entries()).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,o])}function Yo(e,t){let{data:r}=useQuery(B(e));return useMutation({mutationKey:["accounts","keys-update",e],mutationFn:async({keys:n,keepCurrent:o=false,currentKey:i,keysToRevoke:s=[],keysToRevokeByAuthority:a={}})=>{if(n.length===0)throw new Error("[SDK][Update password] \u2013 no new keys provided");if(!r)throw new Error("[SDK][Update password] \u2013 cannot update keys for anon user");let c=p=>{let l=JSON.parse(JSON.stringify(r[p])),m=[...a[p]||[],...a[p]===void 0?s:[]],g=o?l.key_auths.filter(([_])=>!m.includes(_.toString())):[];return l.key_auths=Yc(g,n.map((_,P)=>[_[p].createPublic().toString(),P+1])),l};return ee([["account_update",{account:e,json_metadata:r.json_metadata,owner:c("owner"),active:c("active"),posting:c("posting"),memo_key:n[0].memo_key.createPublic().toString()}]],i)},...t})}function uA(e,t){let{data:r}=useQuery(B(e)),{mutateAsync:n}=Yo(e);return useMutation({mutationKey:["accounts","password-update",e],mutationFn:async({newPassword:o,currentPassword:i,keepCurrent:s})=>{if(!r)throw new Error("[SDK][Update password] \u2013 cannot update password for anon user");let a=H.fromLogin(e,i,"owner");return n({currentKey:a,keepCurrent:s,keys:[{owner:H.fromLogin(e,o,"owner"),active:H.fromLogin(e,o,"active"),posting:H.fromLogin(e,o,"posting"),memo_key:H.fromLogin(e,o,"memo")}]})},...t})}function mA(e,t,r){let n=useQueryClient(),{data:o}=useQuery(B(e));return useMutation({mutationKey:["accounts","revoke-posting",o?.name],mutationFn:async({accountName:i,type:s,key:a})=>{if(!o)throw new Error("[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user");let c=JSON.parse(JSON.stringify(o.posting));c.account_auths=c.account_auths.filter(([l])=>l!==i);let p={account:o.name,posting:c,memo_key:o.memo_key,json_metadata:o.json_metadata};if(s==="key"&&a)return ee([["account_update",p]],a);if(s==="keychain"){if(!r?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return r.adapter.broadcastWithKeychain(o.name,[["account_update",p]],"active")}else return !t.hsCallbackUrl&&process.env.NODE_ENV==="development"&&console.warn("[SDK][Accounts] hsCallbackUrl not provided for HiveSigner revoke-posting; user will not be redirected after signing."),mo.sendOperation(["account_update",p],t.hsCallbackUrl?{callback:t.hsCallbackUrl}:{},()=>{})},onError:t.onError,onSuccess:(i,s,a)=>{t.onSuccess?.(i,s,a),n.setQueryData(B(e).queryKey,c=>({...c,posting:{...c?.posting,account_auths:c?.posting?.account_auths?.filter(([p])=>p!==s.accountName)??[]}}));}})}function vA(e,t,r,n){let{data:o}=useQuery(B(e));return useMutation({mutationKey:["accounts","recovery",o?.name],mutationFn:async({accountName:i,type:s,key:a,email:c})=>{if(!o)throw new Error("[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user");let p={account_to_recover:o.name,new_recovery_account:i,extensions:[]};if(s==="ecency"){if(!t)throw new Error("[SDK][Accounts] \u2013 missing access token");let f=await h()(d.privateApiHost+"/private-api/recoveries-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,email:c,publicKeys:[...o.owner.key_auths,...o.active.key_auths,...o.posting.key_auths,o.memo_key]})});if(!f.ok)throw new Error(`[SDK][Accounts] Failed to add recovery: ${f.status}`);return f}else {if(s==="key"&&a)return ee([["change_recovery_account",p]],a);if(s==="keychain"){if(!n?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return n.adapter.broadcastWithKeychain(o.name,[["change_recovery_account",p]],"owner")}else return !r.hsCallbackUrl&&process.env.NODE_ENV==="development"&&console.warn("[SDK][Accounts] hsCallbackUrl not provided for HiveSigner update-recovery; user will not be redirected after signing."),mo.sendOperation(["change_recovery_account",p],r.hsCallbackUrl?{callback:r.hsCallbackUrl}:{},()=>{})}},onError:r.onError,onSuccess:r.onSuccess})}function AA(e,t){let r=e.key_auths.filter(([o])=>!t.has(String(o))).reduce((o,[,i])=>o+i,0),n=(e.account_auths??[]).reduce((o,[,i])=>o+i,0);return r+n>=e.weight_threshold}function Xo(e,t){let r=new Set(t.map(s=>s.toString())),n=s=>s.key_auths.some(([a])=>r.has(String(a))),o=s=>{let a=JSON.parse(JSON.stringify(s));return a.key_auths=a.key_auths.filter(([c])=>!r.has(c.toString())),a},i=n(e.owner);return {account:e.name,json_metadata:e.json_metadata,owner:i?o(e.owner):void 0,active:o(e.active),posting:o(e.posting),memo_key:e.memo_key}}function CA(e,t){let{data:r}=useQuery(B(e));return useMutation({mutationKey:["accounts","revoke-key",r?.name],mutationFn:async({currentKey:n,revokingKey:o})=>{if(!r)throw new Error("[SDK][Revoke key] \u2013 cannot update keys for anon user");let i=Array.isArray(o)?o:[o],s=Xo(r,i);return ee([["account_update",s]],n)},...t})}function FA(e,t,r){return v(["accounts","claimAccount"],e,({creator:n,fee:o="0.000 HIVE"})=>[Xr(n,o)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(o.creator)]);},t,"active",{broadcastMode:r})}function NA(e,t,r){return v(["accounts","grant-posting-permission"],e,n=>[Zr(e,n.currentPosting,n.grantedAccount,n.weightThreshold,n.memoKey,n.jsonMetadata)],async()=>{await S(t?.adapter,r,[u.accounts.full(e)]);},t,"active",{broadcastMode:r})}function HA(e,t,r){return v(["accounts","create"],e,n=>[n.useClaimed?Yr(e,n.newAccountName,n.keys):Jr(e,n.newAccountName,n.keys,n.fee)],async()=>{await S(t?.adapter,r,[u.accounts.full(e)]);},t,"active",{broadcastMode:r})}var on=300*60*24,cp=1e4,pp=5e7;function Zo(e){let t=k(e.vesting_shares).amount,r=k(e.received_vesting_shares).amount,n=k(e.delegated_vesting_shares).amount,o=k(e.vesting_withdraw_rate).amount,i=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,s=Math.min(o,i);return t+r-n-s}function lp(e,t,r){let n=e*1e6;return (t*r/1e4/50+1)*n/1e4}function dp(e){if(Number.isFinite(e.lastHardfork))return e.lastHardfork>=28;let[t="0",r="0"]=(e.currentHardforkVersion??"0.0.0").split(".");return Number(t)>1||Number(t)===1&&Number(r)>=28}function fp(e,t,r){let n=t.votePowerReserveRate||Number(t.raw?.globalDynamic?.vote_power_reserve_rate??0);if(!Number.isFinite(n)||n<=0)return 0;let o=Zo(e);if(!Number.isFinite(o)||o<=0)return 0;let i=o*1e6,s=Math.ceil(i*r*60*60*24/cp/(n*on)),a=Or(e),c=Math.min(a.current_mana,a.max_mana);return !Number.isFinite(c)||s>c?0:Math.max(s-pp,0)}function mp(e,t,r,n=1e4){if(!Number.isFinite(r)||!Number.isFinite(n))return 0;if(dp(t))return fp(e,t,n);let o=0;try{if(o=Zo(e),!Number.isFinite(o))return 0}catch{return 0}return lp(o,r,n)}function LA(e){return Or(e).percentage/100}function $A(e){if(!Number.isFinite(e))throw new TypeError("Voting power must be a finite number");if(e<0||e>100)throw new RangeError("Voting power must be between 0 and 100");return (100-e)*100*on/1e4}function WA(e){let t=parseFloat(e.vesting_shares)+parseFloat(e.received_vesting_shares)-parseFloat(e.delegated_vesting_shares),r=Math.floor(Date.now()/1e3)-e.downvote_manabar.last_update_time,n=t*1e6/4;if(n<=0)return 0;let o=parseFloat(e.downvote_manabar.current_mana.toString())+r*n/on;o>n&&(o=n);let i=o*100/n;return isNaN(i)?0:i>100?100:i}function GA(e){return Mt(e).percentage/100}function zA(e,t,r,n=1e4){if(!Number.isFinite(r)||!Number.isFinite(n))return 0;let{fundRecentClaims:o,fundRewardBalance:i,base:s,quote:a}=t;if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(a)||o===0||a===0)return 0;let c=mp(e,t,r,n);return Number.isFinite(c)?c/o*i*(s/a):0}var gp={vote:"posting",comment:"posting",delete_comment:"posting",comment_options:"posting",claim_reward_balance:"posting",cancel_transfer_from_savings:"active",collateralized_convert:"active",convert:"active",delegate_vesting_shares:"active",recurrent_transfer:"active",set_withdraw_vesting_route:"active",transfer:"active",transfer_from_savings:"active",transfer_to_savings:"active",transfer_to_vesting:"active",withdraw_vesting:"active",limit_order_create:"active",limit_order_cancel:"active",account_update:"active",account_update2:"active",claim_account:"active",create_claimed_account:"active",account_witness_proxy:"active",account_witness_vote:"active",remove_proposal:"active",update_proposal_votes:"active",change_recovery_account:"owner",request_account_recovery:"owner",recover_account:"owner",reset_account:"owner",set_reset_account:"owner"};function yp(e){let t=e[0],r=e[1];if(t!=="custom_json")throw new Error("Operation is not a custom_json operation");let n=r;return n.required_auths&&n.required_auths.length>0?"active":(n.required_posting_auths&&n.required_posting_auths.length>0,"posting")}function hp(e){let t=e[0];if(t!=="create_proposal"&&t!=="update_proposal")throw new Error("Operation is not a proposal operation");return "active"}function _p(e){let t=e[0];return t==="custom_json"?yp(e):t==="create_proposal"||t==="update_proposal"?hp(e):gp[t]??"posting"}function YA(e){let t="posting";for(let r of e){let n=_p(r);if(n==="owner")return "owner";n==="active"&&t==="posting"&&(t="active");}return t}function rO(e){return useMutation({mutationKey:["operations","sign",e],mutationFn:({operation:t,keyOrSeed:r})=>{if(!e)throw new Error("[Operations][Sign] \u2013 cannot sign op with anon user");let n;return r.split(" ").length===12?n=H.fromLogin(e,r,"active"):co(r)?n=H.fromString(r):n=H.from(r),ee([t],n)}})}function iO(e,t,r="active"){return useMutation({mutationKey:["operations","sign-keychain",e],mutationFn:({operation:n})=>{if(!e)throw new Error("[SDK][Keychain] \u2013\xA0cannot sign operation with anon user");if(!t?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");return t.adapter.broadcastWithKeychain(e,[n],r)}})}function cO(e="/"){return useMutation({mutationKey:["operations","sign-hivesigner",e],mutationFn:async({operation:t})=>mo.sendOperation(t,{callback:e},()=>{})})}function fO(){return queryOptions({queryKey:["operations","chain-properties"],queryFn:async()=>await y("condenser_api.get_chain_properties",[])})}function ei(e,t,r){return {...e,...t??{},title:r.title,body:r.body}}function ti(e,t){return {...e??{},title:t.title,body:t.body}}function vO(e,t){return useMutation({mutationKey:["posts","add-fragment",e],mutationFn:async({title:r,body:n})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let i=await h()(d.privateApiHost+"/private-api/fragments-add",{method:"POST",body:JSON.stringify({code:t,title:r,body:n}),headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(`[SDK][Posts] Failed to add fragment: ${i.status}`);return i.json()},onSuccess(r,n){let o=b(),i=ti(r,n);o.setQueryData(Xe(e,t).queryKey,s=>[i,...s??[]]),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},s=>s&&{...s,pages:s.pages.map((a,c)=>c===0?{...a,data:[i,...a.data]}:a)});}})}function kO(e,t){return useMutation({mutationKey:["posts","edit-fragment",e],mutationFn:async({fragmentId:r,title:n,body:o})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let s=await h()(d.privateApiHost+"/private-api/fragments-update",{method:"POST",body:JSON.stringify({code:t,id:r,title:n,body:o}),headers:{"Content-Type":"application/json"}});if(!s.ok)throw new Error(`[SDK][Posts] Failed to update fragment: ${s.status}`);return s.json()},onSuccess(r,n){let o=b(),i=s=>ei(s,r,n);o.setQueryData(Xe(e,t).queryKey,s=>s?.map(a=>a.id===n.fragmentId?i(a):a)??[]),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},s=>s&&{...s,pages:s.pages.map(a=>({...a,data:a.data.map(c=>c.id===n.fragmentId?i(c):c)}))});}})}function IO(e,t){return useMutation({mutationKey:["posts","remove-fragment",e],mutationFn:async({fragmentId:r})=>{if(!t)throw new Error("[SDK][Posts] Missing access token");let o=await h()(d.privateApiHost+"/private-api/fragments-delete",{method:"POST",body:JSON.stringify({code:t,id:r}),headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`[SDK][Posts] Failed to delete fragment: ${o.status}`);return o},onSuccess(r,n){let o=b();o.setQueryData(Xe(e,t).queryKey,i=>[...i??[]].filter(({id:s})=>s!==n.fragmentId)),o.setQueriesData({queryKey:["posts","fragments","infinite",e]},i=>i&&{...i,pages:i.pages.map(s=>({...s,data:s.data.filter(a=>a.id!==n.fragmentId)}))});}})}async function G(e){if(!e.ok){let r;try{r=await e.json();}catch{r=void 0;}let n=new Error(`Request failed with status ${e.status}`);throw n.status=e.status,n.data=r,n}let t=await e.text();if(!t||t.trim()==="")return "";try{return JSON.parse(t)}catch(r){return console.warn("[SDK] Failed to parse JSON response:",r,"Response:",t),""}}async function NO(e,t,r,n){let i=await h()(d.privateApiHost+"/private-api/account-create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,email:t,referral:r,captcha_token:n})}),s=await G(i);return {status:i.status,data:s}}async function BO(e){let r=await h()(d.privateApiHost+"/private-api/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),n=await G(r);return {status:r.status,data:n}}async function MO(e,t,r="",n=""){let o={code:e,ty:t};r&&(o.bl=r),n&&(o.tx=n);let s=await h()(d.privateApiHost+"/private-api/usr-activity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});await G(s);}async function QO(e,t,r=null,n=null){let o={code:e};t&&(o.filter=t),r&&(o.since=r),n&&(o.user=n);let s=await h()(d.privateApiHost+"/private-api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return G(s)}async function HO(e,t,r,n,o,i){let s={code:e,username:t,token:i,system:r,allows_notify:n,notify_types:o},c=await h()(d.privateApiHost+"/private-api/register-device",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return G(c)}async function UO(e,t,r){let n={code:e,username:t,token:r},i=await h()(d.privateApiHost+"/private-api/detail-device",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}async function ri(e,t){let r={code:e};t&&(r.id=t);let o=await h()(d.privateApiHost+"/private-api/notifications/mark",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function ni(e,t){let r={code:e,url:t},o=await h()(d.privateApiHost+"/private-api/images-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}var Ep="https://i.ecency.com";async function oi(e,t,r){let n=h(),o=new FormData;o.append("file",e);let i=await n(`${Ep}/hs/${t}`,{method:"POST",body:o,signal:r});return G(i)}async function VO(e,t,r,n){let o=h(),i=new FormData;i.append("file",e);let s=await o(`${d.imageHost}/${t}/${r}`,{method:"POST",body:i,signal:n});return G(s)}async function ii(e,t){let r={code:e,id:t},o=await h()(d.privateApiHost+"/private-api/images-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function si(e,t,r,n,o){let i={code:e,title:t,body:r,tags:n,meta:o},a=await h()(d.privateApiHost+"/private-api/drafts-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return G(a)}async function ai(e,t,r,n,o,i){let s={code:e,id:t,title:r,body:n,tags:o,meta:i},c=await h()(d.privateApiHost+"/private-api/drafts-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return G(c)}async function ui(e,t){let r={code:e,id:t},o=await h()(d.privateApiHost+"/private-api/drafts-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function ci(e,t,r,n,o,i,s,a){let c={code:e,permlink:t,title:r,body:n,meta:o,schedule:s,reblog:a};i&&(c.options=i);let l=await h()(d.privateApiHost+"/private-api/schedules-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});return G(l)}async function pi(e,t){let r={code:e,id:t},o=await h()(d.privateApiHost+"/private-api/schedules-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function li(e,t){let r={code:e,id:t},o=await h()(d.privateApiHost+"/private-api/schedules-move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return G(o)}async function jO(e,t,r){let n={code:e,author:t,permlink:r},i=await h()(d.privateApiHost+"/private-api/promoted-post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}async function LO(e,t,r){let n={username:e,email:t,friend:r},i=await h()(d.privateApiHost+"/private-api/account-create-friend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return G(i)}function JO(e,t,r,n){return useMutation({mutationKey:["posts","drafts","add",e],mutationFn:async({title:o,body:i,tags:s,meta:a})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for addDraft");return si(t,o,i,s,a)},onSuccess:o=>{r?.();let i=b();o?.drafts?i.setQueryData(u.posts.drafts(e),o.drafts):i.invalidateQueries({queryKey:u.posts.drafts(e)}),i.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:n})}function tx(e,t,r,n){return useMutation({mutationKey:["posts","drafts","update",e],mutationFn:async({draftId:o,title:i,body:s,tags:a,meta:c})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for updateDraft");return ai(t,o,i,s,a,c)},onSuccess:()=>{r?.();let o=b();o.invalidateQueries({queryKey:u.posts.drafts(e)}),o.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:n})}function ax(e,t,r,n){return useMutation({mutationKey:["posts","drafts","delete",e],mutationFn:async({draftId:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteDraft");return ui(t,o)},onMutate:async({draftId:o})=>{if(!e)return;let i=b(),s=u.posts.drafts(e),a=u.posts.draftsInfinite(e);await Promise.all([i.cancelQueries({queryKey:s}),i.cancelQueries({queryKey:a})]);let c=i.getQueryData(s);c&&i.setQueryData(s,c.filter(f=>f._id!==o));let p=i.getQueriesData({queryKey:a}),l=new Map(p);for(let[f,m]of p)m&&i.setQueryData(f,{...m,pages:m.pages.map(g=>({...g,data:g.data.filter(_=>_._id!==o)}))});return {previousList:c,previousInfinite:l}},onSuccess:()=>{r?.();let o=b();o.invalidateQueries({queryKey:u.posts.drafts(e)}),o.invalidateQueries({queryKey:u.posts.draftsInfinite(e)});},onError:(o,i,s)=>{let a=b();if(s?.previousList&&a.setQueryData(u.posts.drafts(e),s.previousList),s?.previousInfinite)for(let[c,p]of s.previousInfinite)a.setQueryData(c,p);n?.(o);}})}function dx(e,t,r,n){return useMutation({mutationKey:["posts","schedules","add",e],mutationFn:async({permlink:o,title:i,body:s,meta:a,options:c,schedule:p,reblog:l})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for addSchedule");return ci(t,o,i,s,a,c,p,l)},onSuccess:()=>{r?.(),b().invalidateQueries({queryKey:u.posts.schedules(e)});},onError:n})}function hx(e,t,r,n){return useMutation({mutationKey:["posts","schedules","delete",e],mutationFn:async({id:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteSchedule");return pi(t,o)},onSuccess:o=>{r?.();let i=b();o?i.setQueryData(u.posts.schedules(e),o):i.invalidateQueries({queryKey:u.posts.schedules(e)});},onError:n})}function Px(e,t,r,n){return useMutation({mutationKey:["posts","schedules","move",e],mutationFn:async({id:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for moveSchedule");return li(t,o)},onSuccess:o=>{r?.();let i=b();o?i.setQueryData(u.posts.schedules(e),o):i.invalidateQueries({queryKey:u.posts.schedules(e)}),i.invalidateQueries({queryKey:u.posts.drafts(e)});},onError:n})}function Ex(e,t,r,n){return useMutation({mutationKey:["posts","images","add",e],mutationFn:async({url:o,code:i})=>{let s=i??t;if(!e||!s)throw new Error("[SDK][Posts] \u2013 missing auth for addImage");return ni(s,o)},onSuccess:()=>{r?.(),b().invalidateQueries({queryKey:u.posts.images(e)});},onError:n})}function qx(e,t,r,n){return useMutation({mutationKey:["posts","images","delete",e],mutationFn:async({imageId:o})=>{if(!e||!t)throw new Error("[SDK][Posts] \u2013 missing auth for deleteImage");return ii(t,o)},onSuccess:(o,i)=>{r?.();let s=b(),{imageId:a}=i;s.setQueryData(["posts","images",e],c=>c?.filter(p=>p._id!==a)),s.setQueriesData({queryKey:["posts","images","infinite",e]},c=>c&&{...c,pages:c.pages.map(p=>({...p,data:p.data.filter(l=>l._id!==a)}))});},onError:n})}function Kx(e,t){return useMutation({mutationKey:["posts","images","upload"],mutationFn:async({file:r,token:n,signal:o})=>oi(r,n,o),onSuccess:e,onError:t})}function zt(e,t){return `/@${e}/${t}`}function Np(e,t,r){return (r??b()).getQueryData(u.posts.entry(zt(e,t)))}function Bp(e,t){(t??b()).setQueryData(u.posts.entry(zt(e.author,e.permlink)),e);}function Gt(e,t,r,n){let o=n??b(),i=zt(e,t),s=o.getQueryData(u.posts.entry(i));if(!s)return;let a=r(s);return o.setQueryData(u.posts.entry(i),a),s}var $e;(a=>{function e(c,p,l,f,m){Gt(c,p,g=>({...g,active_votes:l,stats:{...g.stats||{gray:false,hide:false,flag_weight:0,total_votes:0},total_votes:l.length,flag_weight:g.stats?.flag_weight||0},total_votes:l.length,payout:f,pending_payout_value:String(f)}),m);}a.updateVotes=e;function t(c,p,l,f){Gt(c,p,m=>({...m,reblogs:l}),f);}a.updateReblogsCount=t;function r(c,p,l,f){Gt(c,p,m=>({...m,children:l}),f);}a.updateRepliesCount=r;function n(c,p,l,f){Gt(p,l,m=>({...m,children:m.children+1,replies:[c,...m.replies]}),f);}a.addReply=n;function o(c,p){c.forEach(l=>Bp(l,p));}a.updateEntries=o;function i(c,p,l){(l??b()).invalidateQueries({queryKey:u.posts.entry(zt(c,p))});}a.invalidateEntry=i;function s(c,p,l){return Np(c,p,l)}a.getEntry=s;})($e||={});function Mp(e,t,r){let n=e.some(o=>o.voter===t);return r!==0?n:!n}function Qp(e,t,r){let n=$e.getEntry(t.author,t.permlink,r);if(!n?.active_votes||Mp(n.active_votes,e,t.weight))return;let o=[...n.active_votes.filter(s=>s.voter!==e),...t.weight!==0?[{rshares:t.weight,voter:e}]:[]],i=n.payout+(t.estimated??0);$e.updateVotes(t.author,t.permlink,o,i,r);}function Vx(e,t,r){return v(["posts","vote"],e,({author:n,permlink:o,weight:i})=>[Rr(e,n,o,i)],async(n,o)=>{Qp(e,o);let i=n?.id??n?.tx_id;if(t?.adapter?.recordActivity&&i&&t.adapter.recordActivity(120,i,n?.block_num).catch(()=>{}),t?.adapter?.invalidateQueries){let s=()=>{t.adapter.invalidateQueries([u.posts.entry(`/@${o.author}/${o.permlink}`),u.accounts.full(e)]);};(r??"async")==="async"?setTimeout(s,4e3):s();}},t,"posting",{broadcastMode:r??"async"})}function Gx(e,t,r){return v(["posts","reblog"],e,({author:n,permlink:o,deleteReblog:i})=>[qr(e,n,o,i??false)],async(n,o)=>{let i=$e.getEntry(o.author,o.permlink);if(i){let p=Math.max(0,(i.reblogs??0)+(o.deleteReblog?-1:1));$e.updateReblogsCount(o.author,o.permlink,p);}let s=n?.id??n?.tx_id;t?.adapter?.recordActivity&&s&&t.adapter.recordActivity(130,s,n?.block_num).catch(()=>{});let a=()=>{b().invalidateQueries({queryKey:u.posts.accountPostsBlogPrefix(e)}),t?.adapter?.invalidateQueries&&t.adapter.invalidateQueries([u.posts.entry(`/@${o.author}/${o.permlink}`),u.posts.rebloggedBy(o.author,o.permlink)]);};(r??"async")==="async"?setTimeout(a,4e3):a();},t,"posting",{broadcastMode:r??"async"})}function Hp(e){return e.isUpdate?null:e.parentAuthor?110:100}function Xx(e,t,r){return v(["posts","comment"],e,n=>{let o=[];if(o.push(He(n.author,n.permlink,n.parentAuthor,n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true,beneficiaries:p=[]}=n.options,l=[];if(p.length>0){let f=[...p].sort((m,g)=>m.account.localeCompare(g.account));l.push([0,{beneficiaries:f.map(m=>({account:m.account,weight:m.weight}))}]);}o.push(Ue(n.author,n.permlink,i,s,a,c,l));}return o},async(n,o)=>{let i=!o.parentAuthor,s=Hp(o),a=n?.id??n?.tx_id;if(s!==null&&t?.adapter?.recordActivity&&a&&t.adapter.recordActivity(s,a,n?.block_num).catch(()=>{}),t?.adapter?.invalidateQueries){let c=[u.accounts.full(e),u.resourceCredits.account(e)];if(!i){c.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let p=o.rootAuthor||o.parentAuthor,l=o.rootPermlink||o.parentPermlink;c.push({predicate:f=>{let m=f.queryKey;return Array.isArray(m)&&m[0]==="posts"&&m[1]==="discussions"&&m[2]===p&&m[3]===l}});}await t.adapter.invalidateQueries(c);}},t,"posting",{broadcastMode:r})}function tS(e,t,r,n){let o=n??b(),i=o.getQueriesData({predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="discussions"&&a[2]===t&&a[3]===r}});for(let[s,a]of i)a&&o.setQueryData(s,[e,...a]);}function di(e,t,r,n,o){let i=o??b(),s=new Map,a=i.getQueriesData({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===r&&p[3]===n}});for(let[c,p]of a)p&&(s.set(c,p),i.setQueryData(c,p.filter(l=>l.author!==e||l.permlink!==t)));return s}function fi(e,t){let r=t??b();for(let[n,o]of e)r.setQueryData(n,o);}function rS(e,t,r,n){let o=n??b(),i=`/@${e}/${t}`,s=o.getQueryData(u.posts.entry(i));return s&&o.setQueryData(u.posts.entry(i),{...s,...r}),s}function nS(e,t,r,n){let o=n??b(),i=`/@${e}/${t}`;o.setQueryData(u.posts.entry(i),r);}function uS(e,t,r){return v(["posts","deleteComment"],e,({author:n,permlink:o})=>[Tr(n,o)],async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.accounts.full(e)];if(o.parentAuthor&&o.parentPermlink){i.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let s=o.rootAuthor||o.parentAuthor,a=o.rootPermlink||o.parentPermlink;i.push({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===s&&p[3]===a}});}await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r,onMutate:async n=>{let o=n.rootAuthor||n.parentAuthor,i=n.rootPermlink||n.parentPermlink;return o&&i?{snapshots:di(n.author,n.permlink,o,i)}:{}},onError:(n,o,i)=>{let{snapshots:s}=i??{};s&&fi(s);}})}function dS(e,t,r){return v(["posts","cross-post"],e,n=>{let o=[];if(o.push(He(n.author,n.permlink,"",n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true}=n.options;o.push(Ue(n.author,n.permlink,i,s,a,c,[]));}return o},async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.accounts.full(e),{predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="posts-ranked"&&a[3]===o.parentPermlink}}];await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r??"async"})}function yS(e,t,r){return v(["posts","update-reply"],e,n=>{let o=[];if(o.push(He(n.author,n.permlink,n.parentAuthor,n.parentPermlink,n.title,n.body,n.jsonMetadata)),n.options){let{maxAcceptedPayout:i="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:c=true,beneficiaries:p=[]}=n.options,l=[];if(p.length>0){let f=[...p].sort((m,g)=>m.account.localeCompare(g.account));l.push([0,{beneficiaries:f.map(m=>({account:m.account,weight:m.weight}))}]);}o.push(Ue(n.author,n.permlink,i,s,a,c,l));}return o},async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.resourceCredits.account(e)];i.push(u.posts.entry(`/@${o.parentAuthor}/${o.parentPermlink}`));let s=o.rootAuthor||o.parentAuthor,a=o.rootPermlink||o.parentPermlink;i.push({predicate:c=>{let p=c.queryKey;return Array.isArray(p)&&p[0]==="posts"&&p[1]==="discussions"&&p[2]===s&&p[3]===a}}),await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r})}function bS(e,t,r){return v(["ecency","promote"],e,({author:n,permlink:o,duration:i})=>[rn(e,n,o,i)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([[...u.posts._promotedPrefix],[...u.points._prefix(e)],u.posts.entry(`/@${o.author}/${o.permlink}`)]);},t,"active",{broadcastMode:r})}var Up=[3e3,3e3,3e3],Vp=e=>new Promise(t=>setTimeout(t,e));async function jp(e,t){return y("condenser_api.get_content",[e,t])}async function Lp(e,t,r=0,n){let o=n?.delays??Up,i;try{i=await jp(e,t);}catch{i=void 0;}if(i||r>=o.length)return;let s=o[r];return s>0&&await Vp(s),Lp(e,t,r+1,n)}var tt={};xt(tt,{useRecordActivity:()=>sn});function Wp(){return typeof window<"u"&&window.location?{url:window.location.href,domain:window.location.host}:{url:"",domain:""}}function sn(e,t,r){return useMutation({mutationKey:["analytics",t],mutationFn:async()=>{if(!t)throw new Error("[SDK][Analytics] \u2013 no activity type provided");let n=h(),o=Wp(),i=r?.url??o.url,s=r?.domain??o.domain;try{await n(d.plausibleHost+"/api/event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,url:i,domain:s,props:{username:e}})});}catch{}}})}function RS(e){return queryOptions({queryKey:["analytics","discover-leaderboard",e],queryFn:async({signal:t})=>{let r=await fetch(d.privateApiHost+`/private-api/leaderboard/${e}`,{signal:t});if(!r.ok)throw new Error(`Failed to fetch leaderboard: ${r.status}`);return r.json()}})}function DS(e){return queryOptions({queryKey:["analytics","discover-curation",e],queryFn:async({signal:t})=>{let r=await fetch(d.privateApiHost+`/private-api/curation/${e}`,{signal:t});if(!r.ok)throw new Error(`Failed to fetch curation data: ${r.status}`);let n=await r.json(),o=n.map(s=>s.account),i=await y("condenser_api.get_accounts",[o]);for(let s=0;s<i.length;s++){let a=i[s],c=n[s],p=typeof a.vesting_shares=="string"?a.vesting_shares:a.vesting_shares.toString(),l=typeof a.received_vesting_shares=="string"?a.received_vesting_shares:a.received_vesting_shares.toString(),f=typeof a.delegated_vesting_shares=="string"?a.delegated_vesting_shares:a.delegated_vesting_shares.toString(),m=typeof a.vesting_withdraw_rate=="string"?a.vesting_withdraw_rate:a.vesting_withdraw_rate.toString(),g=parseFloat(p)+parseFloat(l)-parseFloat(f)-parseFloat(m);c.efficiency=c.hp/g;}return n.sort((s,a)=>a.efficiency-s.efficiency),n}})}function MS(e,t=[],r=["visitors","pageviews","visit_duration"],n){let o=[...t].sort(),i=[...r].sort();return queryOptions({queryKey:["analytics","page-stats",e,o,i,n],queryFn:async({signal:s})=>{let a=await fetch(d.privateApiHost+"/api/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({metrics:r,url:encodeURIComponent(e),dimensions:t,date_range:n}),signal:s});if(!a.ok)throw new Error(`Failed to fetch page stats: ${a.status}`);return a.json()},enabled:!!e,staleTime:0})}var Jt="threespeakfund",LS=1100;function Yp(e){return /https?:\/\/([a-z0-9-]+\.)*3speak\.tv\/embed[?/]/i.test(e)}function $S(e,t){if(!Yp(t))return e;let r=e.find(n=>n.account===Jt);return r&&r.weight===1100?e:r?e.map(n=>n.account===Jt?{...n,weight:1100}:n):[...e,{account:Jt,weight:1100}]}function WS(e){return e===Jt}var cn={};xt(cn,{getAccountTokenQueryOptions:()=>un,getAccountVideosQueryOptions:()=>nl});var an={};xt(an,{getDecodeMemoQueryOptions:()=>el});function el(e,t,r){return queryOptions({queryKey:["integrations","hivesigner","decode-memo",e],queryFn:async()=>{if(r)return new mo.Client({accessToken:r}).decode(t)}})}var mi={queries:an};function un(e,t){return queryOptions({queryKey:["integrations","3speak","authenticate",e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");let n=await h()(`https://studio.3speak.tv/mobile/login?username=${e}&hivesigner=true`,{headers:{"Content-Type":"application/json"}}),o=mi.queries.getDecodeMemoQueryOptions(e,(await n.json()).memo,t);await b().prefetchQuery(o);let{memoDecoded:i}=b().getQueryData(o.queryKey);return i.replace("#","")}})}function nl(e,t){return queryOptions({queryKey:["integrations","3speak","videos",e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");let r=un(e,t);await b().prefetchQuery(r);let n=b().getQueryData(r.queryKey);if(!n)throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");return await(await h()("https://studio.3speak.tv/mobile/api/my-videos",{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}})).json()}})}var pE={queries:cn};function yE(e){return queryOptions({queryKey:["integrations","hiveposh","links",e],retry:false,queryFn:async()=>{try{let r=await h()(`https://hiveposh.com/api/v0/linked-accounts/${e}`,{headers:{"Content-Type":"application/json"}});if(r.status===400&&(await r.json().catch(()=>({})))?.message==="User Not Connected"||!r.ok)return null;let n=await r.json();return {twitter:{username:n.twitter_username,profile:n.twitter_profile},reddit:{username:n.reddit_username,profile:n.reddit_profile}}}catch{return null}}})}function bE({url:e,dimensions:t=[],metrics:r=["visitors","pageviews","visit_duration"],filterBy:n="event:page",dateRange:o,enabled:i=true}){return queryOptions({queryKey:["integrations","plausible",e,t,r,n,o],queryFn:async()=>{let a=await h()(`${d.privateApiHost}/api/stats`,{method:"POST",body:JSON.stringify({metrics:r,url:encodeURIComponent(e),dimensions:t,filterBy:n,...o?{date_range:o}:{}}),headers:{"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Failed to fetch Plausible stats: ${a.status}`);return await a.json()},enabled:!!e&&i,retry:1})}function OE(){return queryOptions({queryKey:["resource-credits","stats"],queryFn:async()=>(await y("rc_api.get_rc_stats",{})).rc_stats})}function kE(e){return queryOptions({queryKey:["resource-credits","account",e],queryFn:async()=>(await y("rc_api.find_rc_accounts",{accounts:[e]})).rc_accounts,enabled:!!e})}function FE(){return queryOptions({queryKey:u.resourceCredits.resourceParams(),staleTime:1440*60*1e3,gcTime:1/0,queryFn:async()=>await y("rc_api.get_resource_params",{})})}var Yt=["resource_history_bytes","resource_new_accounts","resource_market_bytes","resource_state_bytes","resource_execution_time"];var cl=11,pl=65,ll=16,rt=e=>BigInt(typeof e=="string"?e:Math.trunc(e));function pn(e,t,r,n){if(r<=0||n<=0)return 0;let o=rt(e.coeff_a),i=rt(e.coeff_b),s=rt(e.shift),a=rt(n)*o>>s;a+=1n,a*=rt(r);let c=i+(t>0?rt(t):0n);return c===0n?0:Number(a/c+1n)}function ln({transactionBytes:e,permlinkLength:t,signatures:r=1,beneficiaries:n=0,hasCommentOptions:o=false},i){let s=i.resource_state_bytes,a=i.resource_execution_time;return {resource_history_bytes:e,resource_new_accounts:0,resource_market_bytes:0,resource_state_bytes:s.comment_base_size+s.comment_permlink_char_size*t+s.transaction_base_size+s.comment_beneficiaries_member_size*n,resource_execution_time:a.comment_time+a.transaction_time+a.verify_authority_time*r+(o?a.comment_options_time:0)}}var _e=e=>{let t=dt(e);return ye(t)+t},dl=e=>1+_e(e.parent_author)+_e(e.parent_permlink)+_e(e.author)+_e(e.permlink)+_e(e.title)+_e(e.body)+_e(e.json_metadata),fl=(e,t)=>{let r=t.beneficiaries??[],n=1+_e(e.author)+_e(e.permlink)+ll+2+2;return n+=ye(r.length>0?1:0),r.length>0&&(n+=1+ye(r.length),r.forEach(o=>{n+=_e(o.account)+2;})),n};function dn({op:e,options:t,signatures:r=1}){let n=[dl(e)];return t&&n.push(fl(e,t)),cl+ye(n.length)+n.reduce((o,i)=>o+i,0)+ye(r)+pl*r}var ml={ready:false,cost:0,transactionBytes:0,breakdown:[]};function BE({op:e,options:t,rcParams:r,rcStats:n,signatures:o=1}){if(!r?.resource_params||!r.size_info||!n?.pool||!n.share)return ml;let i=dn({op:e,options:t,signatures:o}),s=ln({transactionBytes:i,permlinkLength:dt(e.permlink),signatures:o,beneficiaries:t?.beneficiaries?.length??0,hasCommentOptions:!!t},r.size_info),a=Number(n.regen),c=0,p=[];return Yt.forEach((l,f)=>{let m=r.resource_params[l],g=Number(n.pool[f]??0),_=Number(n.share[f]??0);if(!m||_<=0)return;let P=s[l]*Number(m.resource_dynamics_params.resource_unit??1),O=Number(BigInt(a)*BigInt(_)/10000n),T=pn(m.price_curve_params,g,P,O);c+=T,p.push({resource:l,usage:P,cost:T});}),{ready:true,cost:c,transactionBytes:i,breakdown:p}}function fn(e,t,r){let n=Number(r.regen),o=0,i=[];return Yt.forEach((s,a)=>{let c=t.resource_params[s],p=Number(r.pool[a]??0),l=Number(r.share[a]??0);if(!c||l<=0)return;let f=e[s]*Number(c.resource_dynamics_params.resource_unit??1),m=Number(BigInt(n)*BigInt(l)/10000n),g=pn(c.price_curve_params,p,f,m);o+=g,i.push({resource:s,usage:f,cost:g});}),{cost:o,breakdown:i}}var gl=11,yl=65,mn=e=>{let t=dt(e);return ye(t)+t},hl=()=>({resource_history_bytes:0,resource_new_accounts:0,resource_market_bytes:0,resource_state_bytes:0,resource_execution_time:0});function gi(e,t=1){let r=1+mn(e.voter)+mn(e.author)+mn(e.permlink)+2;return gl+ye(1)+r+ye(t)+yl*t}function yi({transactionBytes:e,signatures:t=1},r){let n=r.resource_state_bytes,o=r.resource_execution_time;return {...hl(),resource_history_bytes:e,resource_state_bytes:n.vote_size+n.transaction_base_size,resource_execution_time:o.vote_time+o.transaction_time+o.verify_authority_time*t}}var hi={ready:false,currentMana:0,maxMana:0,avgCost:0,cost:0,transactionBytes:0,estimatedCost:0,willLikelyFail:false,deficit:0,remaining:0};function zE({rcAccount:e,rcStats:t,rcParams:r,operation:n,payload:o,fallback:i="minimal",buffer:s=1.2}){if(!e||!t?.ops)return hi;let{current_mana:a,max_mana:c}=Mt(e),p=_l(n,o,i,r,t);if(!p)return {...hi,currentMana:a,maxMana:c};let{cost:l,transactionBytes:f}=p,m=Number.isFinite(s)&&s>0?s:1.2,g=l*m,_=a<g;return {ready:true,currentMana:a,maxMana:c,avgCost:l,cost:l,transactionBytes:f,estimatedCost:g,willLikelyFail:_,deficit:_?Math.ceil(g-a):0,remaining:Math.floor(a/l)}}function _l(e,t,r,n,o){let i=wl(o,e);if(!(e==="comment_operation"||e==="vote_operation")||!t&&r==="average")return i;if(!n?.resource_params||!n.size_info||!o.pool||!o.share)return null;let a={pool:o.pool,regen:o.regen,share:o.share};if(e==="vote_operation"){let m=t?.kind==="vote"?t.op:vl,g=gi(m),_=yi({transactionBytes:g},n.size_info);return {cost:fn(_,n,a).cost,transactionBytes:g}}let c=t?.kind==="comment"?t.op:bl,p=t?.kind==="comment"?t.options:void 0,l=dn({op:c,options:p}),f=ln({transactionBytes:l,permlinkLength:c.permlink.length,beneficiaries:p?.beneficiaries?.length??0,hasCommentOptions:!!p},n.size_info);return {cost:fn(f,n,a).cost,transactionBytes:l}}function wl(e,t){let r=e.ops[t]?.avg_cost;return typeof r=="number"&&r>0?{cost:r,transactionBytes:0}:null}var bl={author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa",parent_author:"",parent_permlink:"hive-100000",title:"",body:"",json_metadata:"{}"},vl={voter:"aaaaaaaaaa",author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa"};function ZE(e,t,r){return queryOptions({queryKey:["games","status-check",r,e],enabled:!!e&&!!t,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Games] \u2013 missing auth");return await(await h()(d.privateApiHost+"/private-api/get-game",{method:"POST",body:JSON.stringify({game_type:r,code:t}),headers:{"Content-Type":"application/json"}})).json()}})}async function Ol(e,t,r){let o=await h()(d.privateApiHost+"/private-api/post-game",{method:"POST",body:JSON.stringify({game_type:t,code:e,key:r}),headers:{"Content-Type":"application/json"}}),i=(o.headers.get("content-type")??"").split(";")[0].trim().toLowerCase(),s=await o.text();if(!o.ok){let a=s&&i.includes("json")?`: ${s.slice(0,200)}`:"";throw new Error(`[SDK][Games] \u2013 failed with status ${o.status}${a}`)}if(!i.includes("json"))throw new Error(`[SDK][Games] \u2013 expected JSON but received "${i||"empty"}" response (status ${o.status})`);try{return JSON.parse(s)}catch{throw new Error(`[SDK][Games] \u2013 malformed JSON response (status ${o.status})`)}}function ok(e,t,r,n){let{mutateAsync:o}=sn(e,"spin-rolled");return useMutation({mutationKey:["games","post",r,e],mutationFn:async()=>{if(!e||!t)throw new Error("[SDK][Games] \u2013 missing auth");return Ol(t,r,n)},onSuccess(){o();}})}function uk(e){let t=e?.replace("@","");return queryOptions({queryKey:u.quests.status(t),enabled:!!t,queryFn:async()=>{if(!t)throw new Error("[SDK][Quests] \u2013 username wasn't provided");let n=await h()(d.privateApiHost+"/private-api/quests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t})});if(!n.ok)throw new Error(`Failed to fetch quests: ${n.status}`);return await n.json()},staleTime:3e4,refetchOnMount:true})}var Sl=[{id:"checkin",tier:"daily",goal:1,i18nKey:"checkin",icon:"check-circle"},{id:"post",tier:"daily",goal:1,i18nKey:"post",icon:"pencil"},{id:"comment",tier:"daily",goal:3,i18nKey:"comment",icon:"comment"},{id:"vote",tier:"daily",goal:10,i18nKey:"vote",icon:"chevron-up-circle"},{id:"reblog",tier:"daily",goal:1,i18nKey:"reblog",icon:"repeat"},{id:"spin",tier:"daily",goal:1,i18nKey:"spin",icon:"gift"},{id:"post",tier:"weekly",goal:5,i18nKey:"post",icon:"pencil"},{id:"comment",tier:"weekly",goal:15,i18nKey:"comment",icon:"comment"},{id:"vote",tier:"weekly",goal:50,i18nKey:"vote",icon:"chevron-up-circle"},{id:"reblog",tier:"weekly",goal:5,i18nKey:"reblog",icon:"repeat"},{id:"post",tier:"monthly",goal:20,i18nKey:"post",icon:"pencil"}];function pk(e,t){return Sl.find(r=>r.tier===e&&r.id===t)}var El=25;function kl(e){return Array.from((e??"").replace(/https?:\/\/\S+/g,"")).length}function lk(e){return kl(e)>El}var dk=300,fk=2;function Tl(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}async function ql(e){let r=await h()(d.privateApiHost+"/private-api/streak-freeze/buy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,idempotency_key:Tl()})});if(!r.ok){let n;try{n=await r.json();}catch{}let o=n?.message??`Failed to buy streak freeze: ${r.status}`,i=new Error(o);throw i.status=r.status,i.data=n,i}return await r.json()}function hk(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["streak-freeze","buy",n],mutationFn:async()=>{if(!n||!t)throw new Error("[SDK][StreakFreeze] \u2013 missing auth");return ql(t)},onSuccess(){n&&r.invalidateQueries({queryKey:u.points._prefix(n)});},onSettled(){n&&r.invalidateQueries({queryKey:u.quests.status(n)});}})}function vk(e,t,r){return v(["communities","subscribe"],e,({community:n})=>[Ur(e,n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.subscriptions(e),[...u.communities.singlePrefix(o.community)],u.communities.context(e,o.community)]);},t,"posting",{broadcastMode:r??"async"})}function xk(e,t,r){return v(["communities","unsubscribe"],e,({community:n})=>[Vr(e,n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.subscriptions(e),[...u.communities.singlePrefix(o.community)],u.communities.context(e,o.community)]);},t,"posting",{broadcastMode:r??"sync"})}function Ck(e,t,r){return v(["communities","mutePost"],e,({community:n,author:o,permlink:i,notes:s,mute:a})=>[Wr(e,n,o,i,s,a)],async(n,o)=>{if(t?.adapter?.invalidateQueries){let i=[u.posts.entry(`/@${o.author}/${o.permlink}`),["community","single",o.community],{predicate:s=>{let a=s.queryKey;return Array.isArray(a)&&a[0]==="posts"&&a[1]==="posts-ranked"&&a[3]===o.community}}];await t.adapter.invalidateQueries(i);}},t,"posting",{broadcastMode:r??"sync"})}function Fk(e,t,r,n){return v(["communities","set-role",e],t,({account:o,role:i})=>[jr(t,e,o,i)],async(o,i)=>{b().setQueriesData({queryKey:u.communities.singlePrefix(e)},a=>{if(!a)return a;let c=[...a.team??[]],p=c.findIndex(([l])=>l===i.account);return p>=0?c[p]=[c[p][0],i.role,c[p][2]??""]:c.push([i.account,i.role,""]),{...a,team:c}}),r?.adapter?.invalidateQueries&&await r.adapter.invalidateQueries([[...u.communities.singlePrefix(e)],u.communities.context(i.account,e)]);},r,"posting",{broadcastMode:n??"async"})}function Nk(e,t,r,n){return v(["communities","update",e],t,o=>[Lr(t,e,o)],async(o,i)=>{b().setQueriesData({queryKey:u.communities.singlePrefix(e)},a=>a&&{...a,...i}),r?.adapter?.invalidateQueries&&await r.adapter.invalidateQueries([[...u.communities.singlePrefix(e)]]);},r,"posting",{broadcastMode:n??"async"})}function Hk(e,t,r){return v(["communities","registerRewards"],e,({name:n})=>[nn(n)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([[...u.communities.singlePrefix(o.name)],[...u.points._prefix(e)]]);},t,"active",{broadcastMode:r})}function Lk(e,t,r){return v(["communities","pin-post"],e,({community:n,account:o,permlink:i,pin:s})=>[$r(e,n,o,i,s)],async(n,o)=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.posts.entry(`/@${o.account}/${o.permlink}`),[...u.communities.singlePrefix(o.community)]]);},t,"posting",{broadcastMode:r??"async"})}function Jk(e,t,r=100,n=void 0,o=true){return queryOptions({queryKey:u.communities.list(e,t??"",r),enabled:o,queryFn:async()=>{let i=await y("bridge.list_communities",{last:"",limit:r,sort:e==="hot"?"rank":e,query:t||null,observer:n});return i?e==="hot"?i.sort(()=>Math.random()-.5):i:[]}})}function tC(e,t){return queryOptions({queryKey:u.communities.context(e,t),enabled:!!e&&!!t,queryFn:async()=>{let r=await y("bridge.get_community_context",{account:e,name:t});return {role:r?.role??"guest",subscribed:r?.subscribed??false}}})}function sC(e,t="",r=true){return queryOptions({queryKey:u.communities.single(e,t),enabled:r&&!!e,queryFn:async()=>Do(e??"",t)})}var _i=100;async function wi(e,t){return await y("bridge.list_subscribers",{community:e,limit:_i,...t?{last:t}:{}})??[]}function dC(e){return queryOptions({queryKey:u.communities.subscribers(e),queryFn:async()=>wi(e,null),staleTime:6e4})}function fC(e){return infiniteQueryOptions({queryKey:u.communities.subscribersInfinite(e),initialPageParam:null,queryFn:async({pageParam:t})=>wi(e,t),getNextPageParam:t=>t?.length>=_i?t[t.length-1]?.[0]??null:null,staleTime:6e4})}function wC(e,t){return infiniteQueryOptions({queryKey:u.communities.accountNotifications(e,t),initialPageParam:null,queryFn:async({pageParam:r})=>await y("bridge.account_notifications",{account:e,limit:t,last_id:r??void 0})??[],getNextPageParam:r=>r?.length>=t?r[r.length-1].id:null})}function AC(){return queryOptions({queryKey:u.communities.rewarded(),queryFn:async()=>{let e=await fetch(d.privateApiHost+"/private-api/rewarded-communities",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch rewarded communities: ${e.status}`);return e.json()}})}var Ql=(s=>(s.OWNER="owner",s.ADMIN="admin",s.MOD="mod",s.MEMBER="member",s.GUEST="guest",s.MUTED="muted",s))(Ql||{}),xC={owner:["admin","mod","member","guest","muted"],admin:["mod","member","guest","muted"],mod:["member","guest","muted"]};function EC(e,t){return e.startsWith("hive-3")||t===3?"Council":e.startsWith("hive-2")||t===2?"Journal":"Topic"}function kC({communityType:e,userRole:t,subscribed:r}){let n=t==="muted"?false:e==="Topic"?true:["owner","admin","mod","member"].includes(t),o=(()=>{if(t==="muted")return false;switch(e){case "Topic":return true;case "Journal":return t!=="guest"||r;case "Council":return n}})(),i=["owner","admin","mod"].includes(t);return {canPost:n,canComment:o,isModerator:i}}function qC(e,t){return queryOptions({queryKey:u.notifications.unreadCount(e),queryFn:async()=>t?(await(await fetch(`${d.privateApiHost}/private-api/notifications/unread`,{method:"POST",body:JSON.stringify({code:t}),headers:{"Content-Type":"application/json"}})).json()).count:0,enabled:!!e&&!!t,initialData:0,refetchInterval:6e4})}function KC(e,t,r=void 0){return infiniteQueryOptions({queryKey:u.notifications.list(e,r),queryFn:async({pageParam:n})=>{if(!t)return [];let o={code:t,filter:r,since:n,user:void 0},i=await fetch(d.privateApiHost+"/private-api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)return [];try{return await i.json()}catch{return []}},enabled:!!e&&!!t,initialPageParam:"",getNextPageParam:n=>n?.[n.length-1]?.id??"",refetchOnMount:true})}var Vl=(g=>(g.VOTES="rvotes",g.MENTIONS="mentions",g.FAVORITES="nfavorites",g.BOOKMARKS="nbookmarks",g.FOLLOWS="follows",g.REPLIES="replies",g.REBLOGS="reblogs",g.TRANSFERS="transfers",g.DELEGATIONS="delegations",g.PAYOUTS="payouts",g.SCHEDULED_PUBLISHED="scheduled_published",g.ACCOUNT_UPDATES="account_updates",g.WEEKLY_EARNINGS="weekly_earnings",g))(Vl||{});var jl=(_=>(_[_.VOTE=1]="VOTE",_[_.MENTION=2]="MENTION",_[_.FOLLOW=3]="FOLLOW",_[_.COMMENT=4]="COMMENT",_[_.RE_BLOG=5]="RE_BLOG",_[_.TRANSFERS=6]="TRANSFERS",_[_.DELEGATIONS=10]="DELEGATIONS",_[_.FAVORITES=13]="FAVORITES",_[_.BOOKMARKS=15]="BOOKMARKS",_[_.PAYOUTS=19]="PAYOUTS",_[_.ACCOUNT_UPDATE=20]="ACCOUNT_UPDATE",_[_.WEEKLY_EARNINGS=21]="WEEKLY_EARNINGS",_[_.SCHEDULED_PUBLISHED=22]="SCHEDULED_PUBLISHED",_.ALLOW_NOTIFY="ALLOW_NOTIFY",_))(jl||{}),bi=[1,2,3,4,5,6,10,13,15,19,20,21,22],Ll=(n=>(n.ALL="All",n.UNREAD="Unread",n.READ="Read",n))(Ll||{});function VC(e,t,r){return queryOptions({queryKey:u.notifications.settings(e),queryFn:async()=>{let n=e+"-web";if(!t)throw new Error("Missing access token");let o=await fetch(d.privateApiHost+"/private-api/detail-device",{body:JSON.stringify({code:t,username:e,token:n}),method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to fetch notification settings: ${o.status}`);return o.json()},enabled:!!e&&!!t,refetchOnMount:false,initialData:()=>({status:0,system:"web",allows_notify:0,notify_types:r?[]:[...bi]})})}function WC(){return queryOptions({queryKey:u.notifications.announcements(),queryFn:async()=>{let e=await fetch(d.privateApiHost+"/private-api/announcements",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch announcements: ${e.status}`);return await e.json()||[]},staleTime:36e5})}function YC(e){return queryOptions({queryKey:u.notifications.spotlights(),queryFn:async()=>{let t=await fetch(d.privateApiHost+"/private-api/spotlights",{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to fetch spotlights: ${t.status}`);return await t.json()||[]},staleTime:36e5})}function Jl(e,t){return {...e,read:!t||t===e.id?1:e.read}}function vi(e){return typeof e=="object"&&e!==null&&"pages"in e&&"pageParams"in e&&Array.isArray(e.pages)}function oR(e,t,r,n){let o=b();return useMutation({mutationKey:["notifications","mark-read",e],mutationFn:async({id:i})=>{if(!e||!t){process.env.NODE_ENV!=="production"&&console.warn("[SDK][Notifications] \u2013 missing auth for markNotifications");return}return ri(t,i)},onMutate:async({id:i})=>{if(!e||!t)return {previousData:[]};await o.cancelQueries({queryKey:u.notifications._prefix});let s=[],a=o.getQueriesData({queryKey:u.notifications._prefix,predicate:l=>{let f=l.state.data;return vi(f)}});a.forEach(([l,f])=>{if(f&&vi(f)){s.push([l,f]);let m={...f,pages:f.pages.map(g=>g.map(_=>Jl(_,i)))};o.setQueryData(l,m);}});let c=u.notifications.unreadCount(e),p=o.getQueryData(c);return typeof p=="number"&&p>0&&(s.push([c,p]),i?a.some(([,f])=>f?.pages.some(m=>m.some(g=>g.id===i&&g.read===0)))&&o.setQueryData(c,p-1):o.setQueryData(c,0)),{previousData:s}},onSuccess:i=>{let s=typeof i=="object"&&i!==null?i.unread:void 0;typeof s=="number"&&o.setQueryData(u.notifications.unreadCount(e),s),r?.(s);},onError:(i,s,a)=>{a?.previousData&&a.previousData.forEach(([c,p])=>{o.setQueryData(c,p);}),n?.(i);},onSettled:()=>{o.invalidateQueries({queryKey:u.notifications._prefix});}})}function uR(e,t,r){return v(["notifications","set-last-read"],e,({date:n})=>Nr(e,n),async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.notifications.unreadCount(e)]);},t,"posting",{broadcastMode:r??"async"})}function dR(e){return queryOptions({queryKey:["proposals","proposal",e],queryFn:async()=>{let r=(await y("condenser_api.find_proposals",[[e]]))[0];return new Date(r.start_date)<new Date&&new Date(r.end_date)>=new Date?r.status="active":new Date(r.end_date)<new Date?r.status="expired":r.status="inactive",r}})}function yR(){return queryOptions({queryKey:["proposals","list"],queryFn:async()=>{let t=(await y("database_api.list_proposals",{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"all"})).proposals,r=t.filter(o=>o.status==="expired");return [...t.filter(o=>o.status!=="expired"),...r]}})}function PR(e,t,r){return infiniteQueryOptions({queryKey:["proposals","votes",e,t,r],initialPageParam:t,refetchOnMount:true,staleTime:0,queryFn:async({pageParam:n})=>{let s=(await y("condenser_api.list_proposal_votes",[[e,n??t],r,"by_proposal_voter"])).filter(l=>l.proposal?.proposal_id===e).map(l=>({id:l.id,voter:l.voter})),a=await y("condenser_api.get_accounts",[s.map(l=>l.voter)]),c=Vt(a);return s.map(l=>({...l,voterAccount:c.find(f=>l.voter===f.name)}))},getNextPageParam:n=>n?.[n.length-1]?.voter??void 0})}function SR(e){return queryOptions({queryKey:["proposals","votes","by-user",e],enabled:!!e&&e!=="",staleTime:60*1e3,queryFn:async()=>!e||e===""?[]:((await y("database_api.list_proposal_votes",{start:[e],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"votable"})).proposal_votes||[]).filter(n=>n.voter===e)})}function RR(e,t,r){return v(["proposals","vote"],e,({proposalIds:n,approve:o})=>[Hr(e,n,o)],async n=>{try{let o=n?.id??n?.tx_id;t?.adapter?.recordActivity&&o&&t.adapter.recordActivity(150,o,n?.block_num).catch(i=>{console.debug("[SDK][Proposals][useProposalVote] recordActivity failed",{activityType:150,blockNum:n?.block_num,transactionId:o,error:i});}),t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.proposals.list(),u.proposals.votesByUser(e)]);}catch(o){console.warn("[useProposalVote] Post-broadcast side-effect failed:",o);}},t,"active",{broadcastMode:r})}function IR(e,t,r){return v(["proposals","create"],e,n=>[Qr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.proposals.list()]);},t,"active",{broadcastMode:r})}function BR(e,t=50){return infiniteQueryOptions({queryKey:["wallet","vesting-delegations",e,t],initialPageParam:"",queryFn:async({pageParam:r})=>{let n=r?t+1:t,o=await y("condenser_api.get_vesting_delegations",[e,r||"",n]);return r&&o.length>0&&o[0]?.delegatee===r?o.slice(1,t+1):o},getNextPageParam:r=>!r||r.length<t?void 0:r[r.length-1]?.delegatee,enabled:!!e})}function UR(e){return queryOptions({queryKey:["assets","account-delegations",e],enabled:!!e,queryFn:({signal:t})=>te("balance","/accounts/{account-name}/delegations",{"account-name":e},void 0,void 0,t)})}function $R(e){return queryOptions({queryKey:["wallet","vesting-delegation-expirations",e],queryFn:async()=>e?(await y("database_api.find_vesting_delegation_expirations",{account:e})).delegations:[],enabled:!!e})}function JR(e){return queryOptions({queryKey:["wallet","conversion-requests",e],queryFn:()=>y("condenser_api.get_conversion_requests",[e]),select:t=>t.sort((r,n)=>r.requestid-n.requestid)})}function eT(e){return queryOptions({queryKey:["wallet","collateralized-conversion-requests",e],queryFn:()=>y("condenser_api.get_collateralized_conversion_requests",[e]),select:t=>t.sort((r,n)=>r.requestid-n.requestid)})}function oT(e){return queryOptions({queryKey:["wallet","savings-withdraw",e],queryFn:()=>y("condenser_api.get_savings_withdraw_from",[e]),select:t=>t.sort((r,n)=>r.request_id-n.request_id)})}function uT(e){return queryOptions({queryKey:["wallet","withdraw-routes",e],queryFn:()=>y("condenser_api.get_withdraw_routes",[e,"outgoing"])})}function dT(e){return queryOptions({queryKey:["wallet","open-orders",e],queryFn:()=>y("condenser_api.get_open_orders",[e]),select:t=>t.sort((r,n)=>r.orderid-n.orderid),enabled:!!e})}function hT(e,t=100){return infiniteQueryOptions({queryKey:["wallet","outgoing-rc-delegations",e,t],initialPageParam:null,queryFn:async({pageParam:r})=>{let o=(await y("rc_api.list_rc_direct_delegations",{start:[e,r??""],limit:t}).then(i=>i)).rc_direct_delegations||[];return r&&(o=o.filter(i=>i.to!==r)),o},getNextPageParam:r=>r.length===t?r[r.length-1].to:null})}function vT(e){return queryOptions({queryKey:["wallet","incoming-rc",e],enabled:!!e,queryFn:async()=>{if(!e)throw new Error("[SDK][Wallet] - Missing username for incoming RC");let r=await h()(`${d.privateApiHost}/private-api/received-rc/${e}`);if(!r.ok)throw new Error(`Failed to fetch incoming RC: ${r.status}`);return r.json()}})}function xT(e){return queryOptions({queryKey:["wallet","received-vesting-shares",e],queryFn:async()=>{let t=await fetch(d.privateApiHost+`/private-api/received-vesting/${e}`);if(!t.ok)throw new Error(`Failed to fetch received vesting shares: ${t.status}`);return (await t.json()).list}})}function CT(e){return queryOptions({queryKey:["wallet","recurrent-transfers",e],queryFn:()=>y("condenser_api.find_recurrent_transfers",[e]),enabled:!!e})}function fe(e){if(typeof e=="string"){let t=e.trim();return t.length>0?t:void 0}}function ue(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t=e.trim();if(!t)return;let r=Number.parseFloat(t);if(Number.isFinite(r))return r;let o=t.replace(/,/g,"").match(/[-+]?\d+(?:\.\d+)?/);if(o){let i=Number.parseFloat(o[0]);if(Number.isFinite(i))return i}}}function md(e){if(!e||typeof e!="object")return;let t=e;return {name:fe(t.name)??"",symbol:fe(t.symbol)??"",layer:fe(t.layer)??"hive",balance:ue(t.balance)??0,fiatRate:ue(t.fiatRate)??0,currency:fe(t.currency)??"usd",precision:ue(t.precision)??3,address:fe(t.address),error:fe(t.error),pendingRewards:ue(t.pendingRewards),pendingRewardsFiat:ue(t.pendingRewardsFiat),liquid:ue(t.liquid),liquidFiat:ue(t.liquidFiat),savings:ue(t.savings),savingsFiat:ue(t.savingsFiat),staked:ue(t.staked),stakedFiat:ue(t.stakedFiat),iconUrl:fe(t.iconUrl),actions:t.actions??[],extraData:t.extraData??[],apr:ue(t.apr)}}function gd(e){if(!e||typeof e!="object")return [];let t=[e],r=e;r.data&&typeof r.data=="object"&&t.push(r.data),r.result&&typeof r.result=="object"&&t.push(r.result),r.portfolio&&typeof r.portfolio=="object"&&t.push(r.portfolio);for(let n of t){if(Array.isArray(n))return n;if(n&&typeof n=="object")for(let o of ["wallets","tokens","assets","items","portfolio","balances"]){let i=n[o];if(Array.isArray(i))return i}}return []}function yd(e){if(!e||typeof e!="object")return;let t=e;return fe(t.username)??fe(t.name)??fe(t.account)}function Pi(e,t="usd",r=true){return queryOptions({queryKey:["wallet","portfolio","v2",e,r?"only-enabled":"all",t],enabled:!!e,staleTime:6e4,refetchInterval:12e4,queryFn:async()=>{if(!e)throw new Error("[SDK][Wallet] \u2013 username is required");let n=`${M.getValidatedBaseUrl()}/wallet-api/portfolio-v2`,o=await fetch(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({username:e,onlyEnabled:r,currency:t})});if(!o.ok)throw new Error(`[SDK][Wallet] \u2013 Portfolio request failed (${o.status})`);let i=await o.json(),s=gd(i).map(a=>md(a)).filter(a=>!!a).filter(a=>a.layer!=="spk");if(!s.length)throw new Error("[SDK][Wallet] \u2013 Portfolio payload contained no tokens");return {username:yd(i)??e,currency:fe(i?.fiatCurrency??i?.currency)?.toUpperCase(),wallets:s}}})}function Xt(e){return queryOptions({queryKey:["assets","hive","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await b().prefetchQuery(Oe()),await b().prefetchQuery(B(e));let t=b().getQueryData(Oe().queryKey),r=b().getQueryData(B(e).queryKey),n=await y("condenser_api.get_ticker",[]).catch(()=>{}),o=Number.parseFloat(n?.latest??"");if(!r)return {name:"HIVE",title:"Hive",price:Number.isFinite(o)?o:t?t.base/t.quote:0,accountBalance:0};let i=k(r.balance).amount,s=k(r.savings_balance).amount;return {name:"HIVE",title:"Hive",price:Number.isFinite(o)?o:t?t.base/t.quote:0,accountBalance:i+s,parts:[{name:"current",balance:i},{name:"savings",balance:s}]}}})}function Ai(e){return queryOptions({queryKey:["assets","hbd","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await b().prefetchQuery(Oe()),await b().prefetchQuery(B(e));let t=b().getQueryData(B(e).queryKey),r=b().getQueryData(Oe().queryKey),n=1;return t?{name:"HBD",title:"Hive Dollar",price:n,accountBalance:k(t.hbd_balance).amount+k(t?.savings_hbd_balance).amount,apr:((r?.hbdInterestRate??0)/100).toFixed(3),parts:[{name:"current",balance:k(t.hbd_balance).amount},{name:"savings",balance:k(t.savings_hbd_balance).amount}]}:{name:"HBD",title:"Hive Dollar",price:n,accountBalance:0}}})}function bd(e){let c=9.5-(e.headBlock-7e6)/25e4*.01;c<.95&&(c=.95);let p=e.vestingRewardPercent/1e4,l=e.virtualSupply,f=e.totalVestingFund;return (l*c*p/f).toFixed(3)}function Oi(e){return queryOptions({queryKey:["assets","hive-power","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{await b().prefetchQuery(Oe()),await b().prefetchQuery(B(e));let t=b().getQueryData(Oe().queryKey),r=b().getQueryData(B(e).queryKey);if(!t||!r)return {name:"HP",title:"Hive Power",price:0,accountBalance:0};let n=await y("condenser_api.get_ticker",[]).catch(()=>{}),o=Number.parseFloat(n?.latest??""),i=Number.isFinite(o)?o:t.base/t.quote,s=k(r.vesting_shares).amount,a=k(r.delegated_vesting_shares).amount,c=k(r.received_vesting_shares).amount,p=k(r.vesting_withdraw_rate).amount,l=Math.max((Number(r.to_withdraw)-Number(r.withdrawn))/1e6,0),f=wo(r.next_vesting_withdrawal)?0:Math.min(p,l),m=+Je(s,t.hivePerMVests).toFixed(3),g=+Je(a,t.hivePerMVests).toFixed(3),_=+Je(c,t.hivePerMVests).toFixed(3),P=+Je(l,t.hivePerMVests).toFixed(3),O=+Je(f,t.hivePerMVests).toFixed(3),T=Math.max(m-P,0),q=Math.max(m-g,0);return {name:"HP",title:"Hive Power",price:i,accountBalance:+T.toFixed(3),apr:bd(t),parts:[{name:"hp_balance",balance:m},{name:"available",balance:+q.toFixed(3)},{name:"outgoing_delegations",balance:g},{name:"incoming_delegations",balance:_},...P>0?[{name:"pending_power_down",balance:+P.toFixed(3)}]:[],...O>0&&O!==P?[{name:"next_power_down",balance:+O.toFixed(3)}]:[]]}}})}var N=ne.operations,gn={transfers:[N.transfer,N.transfer_to_savings,N.transfer_from_savings,N.cancel_transfer_from_savings,N.recurrent_transfer,N.fill_recurrent_transfer,N.escrow_transfer,N.fill_recurrent_transfer],"market-orders":[N.fill_convert_request,N.fill_order,N.fill_collateralized_convert_request,N.limit_order_create2,N.limit_order_create,N.limit_order_cancel],interests:[N.interest],"stake-operations":[N.return_vesting_delegation,N.withdraw_vesting,N.transfer_to_vesting,N.set_withdraw_vesting_route,N.update_proposal_votes,N.fill_vesting_withdraw,N.account_witness_proxy,N.delegate_vesting_shares],rewards:[N.author_reward,N.curation_reward,N.producer_reward,N.claim_reward_balance,N.comment_benefactor_reward,N.liquidity_reward,N.proposal_pay],"":[]};var eq=Object.keys(ne.operations);var xi=ne.operations,nq=xi,oq=Object.entries(xi).reduce((e,[t,r])=>(e[r]=t,e),{});var Si=ne.operations;function Pd(e){return Object.prototype.hasOwnProperty.call(Si,e)}function bt(e){let t=Array.isArray(e)?e:[e],r=t.includes(""),n=Array.from(new Set(t.filter(a=>a!=null&&a!==""))),o=r||n.length===0?"all":n.map(a=>a.toString()).sort().join("|"),i=new Set;r||n.forEach(a=>{if(a in gn){gn[a].forEach(c=>i.add(c));return}Pd(a)&&i.add(Si[a]);});let s=xd(Array.from(i));return {filterKey:o,filterArgs:s}}function yn(e){let t=Array.isArray(e)?e:[e];return new Set(t.filter(r=>r!=null&&r!==""))}function Ad(e){if(!e?.length)return;let t=Number(e[0]?.num??0);return Number.isFinite(t)&&t>0?t-1:void 0}function Od(e,t){return !Number.isFinite(e)||e<0?t:Math.min(t,e+1)}function xd(e){let t=0n,r=0n;return e.forEach(n=>{n<64?t|=1n<<BigInt(n):r|=1n<<BigInt(n-64);}),[t!==0n?t.toString():null,r!==0n?r.toString():null]}function Zt(e,t=20,r=[]){let{filterArgs:n,filterKey:o}=bt(r),i=yn(r);return infiniteQueryOptions({queryKey:["assets","hive","transactions",e,t,o],initialPageParam:-1,getNextPageParam:Ad,queryFn:async({pageParam:s})=>(await y("condenser_api.get_account_history",[e,s,Od(Number(s),t),...n])).map(c=>({num:c[0],type:c[1].op[0],timestamp:c[1].timestamp,trx_id:c[1].trx_id,...c[1].op[1]})),select:({pages:s,pageParams:a})=>({pageParams:a,pages:s.map(c=>c.filter(p=>{switch(p.type){case "author_reward":case "comment_benefactor_reward":return k(p.hive_payout).amount>0;case "transfer":case "transfer_to_savings":case "transfer_to_vesting":case "recurrent_transfer":return k(p.amount).symbol==="HIVE";case "transfer_from_savings":case "fill_transfer_from_savings":return k(p.amount).symbol==="HIVE";case "fill_recurrent_transfer":let f=k(p.amount);return ["HIVE"].includes(f.symbol);case "claim_reward_balance":return k(p.reward_hive).amount>0;case "curation_reward":case "cancel_transfer_from_savings":case "fill_order":case "limit_order_create":case "limit_order_cancel":case "fill_convert_request":case "fill_collateralized_convert_request":return true;case "limit_order_create2":return true;default:return i.has(p.type)}}))})})}function gq(e,t=20,r=[]){let{filterKey:n}=bt(r),o=yn(r);return infiniteQueryOptions({...Zt(e,t,r),queryKey:["assets","hbd","transactions",e,t,n],select:({pages:i,pageParams:s})=>({pageParams:s,pages:i.map(a=>a.filter(c=>{switch(c.type){case "author_reward":case "comment_benefactor_reward":return k(c.hbd_payout).amount>0;case "claim_reward_balance":return k(c.reward_hbd).amount>0;case "transfer":case "transfer_to_savings":case "transfer_to_vesting":case "recurrent_transfer":return k(c.amount).symbol==="HBD";case "transfer_from_savings":case "fill_transfer_from_savings":return k(c.amount).symbol==="HBD";case "fill_recurrent_transfer":let f=k(c.amount);return ["HBD"].includes(f.symbol);case "cancel_transfer_from_savings":case "fill_order":case "limit_order_create":case "limit_order_cancel":case "fill_convert_request":case "fill_collateralized_convert_request":case "proposal_pay":case "interest":return true;case "limit_order_create2":return true;default:return o.has(c.type)}}))})})}function bq(e,t=20,r=[]){let{filterKey:n}=bt(r),o=new Set(Array.isArray(r)?r:[r]),i=o.has("")||o.size===0;return infiniteQueryOptions({...Zt(e,t,r),queryKey:["assets","hive-power","transactions",e,t,n],select:({pages:s,pageParams:a})=>({pageParams:a,pages:s.map(c=>c.filter(p=>{switch(p.type){case "author_reward":case "comment_benefactor_reward":return k(p.vesting_payout).amount>0;case "claim_reward_balance":return k(p.reward_vests).amount>0;case "transfer_to_vesting":return true;case "transfer":case "transfer_to_savings":case "recurrent_transfer":return ["VESTS","HP"].includes(k(p.amount).symbol);case "fill_recurrent_transfer":let m=k(p.amount);return ["VESTS","HP"].includes(m.symbol);case "curation_reward":case "withdraw_vesting":case "delegate_vesting_shares":case "fill_vesting_withdraw":case "return_vesting_delegation":case "producer_reward":case "set_withdraw_vesting_route":return true;default:return i||o.has(p.type)}}))})})}function Ei(e){let t=r=>r.toString().padStart(2,"0");return `${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function hn(e,t){return new Date(e.getTime()-t*1e3)}function Oq(e=86400){return infiniteQueryOptions({queryKey:["assets","hive","metrics",e],queryFn:async({pageParam:[t,r]})=>(await y("condenser_api.get_market_history",[e,Ei(t),Ei(r)])).map(({hive:o,non_hive:i,open:s})=>({close:i.close/o.close,open:i.open/o.open,low:i.low/o.low,high:i.high/o.high,volume:o.volume,time:new Date(s)})),initialPageParam:[hn(new Date,Math.max(100*e,28800)),new Date],getNextPageParam:(t,r,[n])=>[hn(n,Math.max(100*e,28800)),hn(n,e)]})}function kq(e){return queryOptions({queryKey:["assets","hive","withdrawal-routes",e],queryFn:()=>y("condenser_api.get_withdraw_routes",[e,"outgoing"]),enabled:!!e})}function qq(e,t=50){return queryOptions({queryKey:["assets","hive-power","delegates",e],enabled:!!e,queryFn:()=>y("condenser_api.get_vesting_delegations",[e,"",t])})}function Nq(e){return queryOptions({queryKey:["assets","hive-power","delegatings",e],queryFn:async()=>(await(await fetch(d.privateApiHost+`/private-api/received-vesting/${e}`,{headers:{"Content-Type":"application/json"}})).json()).list,select:t=>t.sort((r,n)=>k(n.vesting_shares).amount-k(r.vesting_shares).amount)})}function Hq(e=500){return queryOptions({queryKey:["market","order-book",e],queryFn:()=>y("condenser_api.get_order_book",[e])})}function Lq(){return queryOptions({queryKey:["market","statistics"],queryFn:()=>y("condenser_api.get_ticker",[])})}function zq(e,t,r){let n=o=>o.toISOString().replace(/\.\d{3}Z$/,"");return queryOptions({queryKey:["market","history",e,t.getTime(),r.getTime()],queryFn:()=>y("condenser_api.get_market_history",[e,n(t),n(r)])})}function Zq(){return queryOptions({queryKey:["market","hive-hbd-stats"],queryFn:async()=>{let e=await y("condenser_api.get_ticker",[]),t=new Date,r=new Date(t.getTime()-864e5),n=s=>s.toISOString().replace(/\.\d{3}Z$/,""),o=await y("condenser_api.get_market_history",[86400,n(r),n(t)]);return {price:+e.latest,close:o[0]?o[0].non_hive.open/o[0].hive.open:0,high:o[0]?o[0].non_hive.high/o[0].hive.high:0,low:o[0]?o[0].non_hive.low/o[0].hive.low:0,percent:o[0]?100-o[0].non_hive.open/o[0].hive.open*100/+e.latest:0,totalFromAsset:e.hive_volume.split(" ")[0],totalToAsset:e.hbd_volume.split(" ")[0]}}})}function nF(e,t,r,n){return queryOptions({queryKey:["market","data",e,t,r,n],queryFn:async({signal:o})=>{let i=h(),s=`https://api.coingecko.com/api/v3/coins/${e}/market_chart/range?vs_currency=${t}&from=${r}&to=${n}`,a=await i(s,{signal:o});if(!a.ok)throw new Error(`Failed to fetch market data: ${a.status}`);return a.json()}})}function ki(e){return e.toISOString().replace(/\.\d{3}Z$/,"")}function aF(e=1e3,t,r){let n=r??new Date,o=t??new Date(n.getTime()-600*60*1e3);return queryOptions({queryKey:["market","trade-history",e,o.getTime(),n.getTime()],queryFn:()=>y("condenser_api.get_trade_history",[ki(o),ki(n),e])})}function lF(){return queryOptions({queryKey:["market","feed-history"],queryFn:async()=>{try{return await y("condenser_api.get_feed_history",[])}catch(e){throw e}}})}function gF(){return queryOptions({queryKey:["market","current-median-history-price"],queryFn:async()=>{try{return await y("condenser_api.get_current_median_history_price",[])}catch(e){throw e}}})}function wF(e,t,r){return v(["market","limit-order-create"],e,n=>[Wt(e,n.amountToSell,n.minToReceive,n.fillOrKill,n.expiration,n.orderId)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.wallet.openOrders(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function AF(e,t,r){return v(["market","limit-order-cancel"],e,({orderId:n})=>[Gr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.wallet.openOrders(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}async function vt(e){let t=await e.json();if(!e.ok){let r=new Error(`Request failed with status ${e.status}`);throw r.status=e.status,r.data=t,r}return t}async function SF(e,t,r,n){let o=h(),i=`https://api.coingecko.com/api/v3/coins/${e}/market_chart/range?vs_currency=${t}&from=${r}&to=${n}`,s=await o(i);return vt(s)}async function Ci(e){if(e==="hbd")return 1;let t=h(),r=`https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${e}`,n=await t(r);return (await vt(n)).hive_dollar[e]}async function EF(e,t){let n=await h()(d.privateApiHost+`/private-api/market-data/${e==="hbd"?"usd":e}/${t}`);return vt(n)}async function kF(){let t=await h()(d.privateApiHost+"/private-api/market-data/latest");return vt(t)}async function CF(){let t=await h()("https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd");return vt(t)}var Qd={"Content-type":"application/json"};async function Hd(e){let t=h(),r=M.getValidatedBaseUrl(),n=await t(`${r}/private-api/engine-api`,{method:"POST",body:JSON.stringify(e),headers:Qd});if(!n.ok)throw new Error(`[SDK][HiveEngine] \u2013 request failed with ${n.status}`);return (await n.json()).result}async function qe(e,t){try{return await Hd(e)}catch{return t}}async function qF(e,t=50){let r={jsonrpc:"2.0",method:"find",params:{contract:"market",query:{symbol:e},limit:t,offset:0},id:1},[n,o]=await Promise.all([qe({...r,params:{...r.params,table:"buyBook",indexes:[{index:"price",descending:true}]}},[]),qe({...r,params:{...r.params,table:"sellBook",indexes:[{index:"price",descending:false}]}},[])]),i=a=>a.sort((c,p)=>{let l=Number(c.price??0);return Number(p.price??0)-l}),s=a=>a.sort((c,p)=>{let l=Number(c.price??0),f=Number(p.price??0);return l-f});return {buy:i(n),sell:s(o)}}async function FF(e,t=50){return qe({jsonrpc:"2.0",method:"find",params:{contract:"market",table:"tradesHistory",query:{symbol:e},limit:t,offset:0,indexes:[{index:"timestamp",descending:true}]},id:1},[])}async function IF(e,t,r=100){let n={jsonrpc:"2.0",method:"find",params:{contract:"market",query:{symbol:t,account:e},limit:r,offset:0},id:1},[o,i]=await Promise.all([qe({...n,params:{...n.params,table:"buyBook",indexes:[{index:"timestamp",descending:true}]}},[]),qe({...n,params:{...n.params,table:"sellBook",indexes:[{index:"timestamp",descending:true}]}},[])]),s=(p,l)=>(Number(p||0)*Number(l||0)).toFixed(8),a=o.map(p=>({id:p.txId,type:"buy",account:p.account,symbol:p.symbol,quantity:p.quantity,price:p.price,total:p.tokensLocked??s(p.quantity,p.price),timestamp:Number(p.timestamp??0)})),c=i.map(p=>({id:p.txId,type:"sell",account:p.account,symbol:p.symbol,quantity:p.quantity,price:p.price,total:s(p.quantity,p.price),timestamp:Number(p.timestamp??0)}));return [...a,...c].sort((p,l)=>l.timestamp-p.timestamp)}async function Ud(e,t){if(Array.isArray(e)&&e.length===0)return [];let r=Array.isArray(e)?{symbol:{$in:e}}:e?{symbol:e}:{};return qe({jsonrpc:"2.0",method:"find",params:{contract:"market",table:"metrics",query:{...r,...t?{account:t}:{}}},id:1},[])}async function nt(e,t){return Ud(t,e)}async function er(e){return qe({jsonrpc:"2.0",method:"find",params:{contract:"tokens",table:"balances",query:{account:e}},id:1},[])}async function tr(e){return qe({jsonrpc:"2.0",method:"find",params:{contract:"tokens",table:"tokens",query:{symbol:{$in:e}}},id:2},[])}async function Ri(e,t,r,n){let o=h(),i=M.getValidatedBaseUrl(),s=new URL("/private-api/engine-account-history",i);s.searchParams.set("account",e),s.searchParams.set("symbol",t),s.searchParams.set("limit",r.toString()),s.searchParams.set("offset",n.toString());let a=await o(s.toString(),{method:"GET",headers:{"Content-type":"application/json"}});if(!a.ok)throw new Error(`[SDK][HiveEngine] \u2013 account history failed with ${a.status}`);return await a.json()}async function Ti(e,t="daily"){let r=h(),n=M.getValidatedBaseUrl(),o=new URL("/private-api/engine-chart-api",n);o.searchParams.set("symbol",e),o.searchParams.set("interval",t);let i=await r(o.toString(),{headers:{"Content-type":"application/json"}});if(!i.ok)throw new Error(`[SDK][HiveEngine] \u2013 chart failed with ${i.status}`);return await i.json()}async function qi(e){let t=h(),r=M.getValidatedBaseUrl(),n=await t(`${r}/private-api/engine-reward-api/${e}?hive=1`);if(!n.ok)throw new Error(`[SDK][HiveEngine] \u2013 rewards failed with ${n.status}`);return await n.json()}function rr(e){return queryOptions({queryKey:["assets","hive-engine","balances",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>er(e)})}function HF(){return queryOptions({queryKey:["assets","hive-engine","markets"],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>nt()})}function Fi(e){return queryOptions({queryKey:["assets","hive-engine","metadata-list",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>tr(e)})}function GF(e,t,r=20){return infiniteQueryOptions({queryKey:["assets","hive-engine",t,"transactions",e],enabled:!!t&&!!e,initialPageParam:0,queryFn:async({pageParam:n})=>{if(!t||!e)throw new Error("[SDK][HiveEngine] \u2013 token or username missed");return Ri(e,t,r,n)},getNextPageParam:(n,o,i)=>(n?.length??0)===r?i+r:void 0,getPreviousPageParam:(n,o,i)=>i>0?i-r:void 0})}function XF(e,t="daily"){return queryOptions({queryKey:["assets","hive-engine",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>Ti(e,t)})}function rI(e){return queryOptions({queryKey:["assets","hive-engine","unclaimed",e],staleTime:6e4,refetchInterval:9e4,enabled:!!e,queryFn:async()=>{try{let t=await qi(e);return Object.values(t).filter(({pending_token:r})=>r>0)}catch{return []}}})}function Ii(e,t){return queryOptions({queryKey:["assets","hive-engine","all-tokens",e,t],queryFn:async()=>nt(e,t)})}function ot(e,t=void 0){let r={fractionDigits:3,prefix:"",suffix:""};t&&(r={...r,...t});let{fractionDigits:n,prefix:o,suffix:i}=r,s="";o&&(s+=o+" ");let a=Math.abs(parseFloat(e.toString()))<1e-4?0:e,c=typeof a=="string"?parseFloat(a):a;return s+=c.toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:true}),i&&(s+=" "+i),s}var nr=class{symbol;name;icon;precision;stakingEnabled;delegationEnabled;balance;stake;stakedBalance;delegationsIn;delegationsOut;usdValue;constructor(t){this.symbol=t.symbol,this.name=t.name||"",this.icon=t.icon||"",this.precision=t.precision||0,this.stakingEnabled=t.stakingEnabled||false,this.delegationEnabled=t.delegationEnabled||false,this.balance=parseFloat(t.balance)||0,this.stake=parseFloat(t.stake)||0,this.delegationsIn=parseFloat(t.delegationsIn)||0,this.delegationsOut=parseFloat(t.delegationsOut)||0,this.stakedBalance=this.stake+this.delegationsIn-this.delegationsOut,this.usdValue=t.usdValue;}hasDelegations=()=>this.delegationEnabled?this.delegationsIn>0&&this.delegationsOut>0:false;delegations=()=>this.hasDelegations()?`(${ot(this.stake,{fractionDigits:this.precision})} + ${ot(this.delegationsIn,{fractionDigits:this.precision})} - ${ot(this.delegationsOut,{fractionDigits:this.precision})})`:"";staked=()=>this.stakingEnabled?this.stakedBalance<1e-4?this.stakedBalance.toString():ot(this.stakedBalance,{fractionDigits:this.precision}):"-";balanced=()=>this.balance<1e-4?this.balance.toString():ot(this.balance,{fractionDigits:this.precision})};function fI(e,t,r){return queryOptions({queryKey:["assets","hive-engine","balances-with-usd",e,t,r],queryFn:async()=>{if(!e)throw new Error("[HiveEngine] No account in a balances query");let n=await er(e),o=await tr(n.map(p=>p.symbol)),i=t?t.base/t.quote:0,s=Array.isArray(r)?r:[],a=n.map(p=>p.symbol).filter(p=>p!=="SWAP.HIVE"&&!s.some(l=>l.symbol===p)),c=[...s,...a.length?await nt(void 0,a):[]];return n.map(p=>{let l=o.find(O=>O.symbol===p.symbol),f;if(l?.metadata)try{f=JSON.parse(l.metadata);}catch{f=void 0;}let m=c.find(O=>O.symbol===p.symbol),g=Number(m?.lastPrice??"0"),_=Number(p.balance),P=p.symbol==="SWAP.HIVE"?i*_:g===0?0:Number((g*i*_).toFixed(10));return new nr({symbol:p.symbol,name:l?.name??p.symbol,icon:f?.icon??"",precision:l?.precision??0,stakingEnabled:l?.stakingEnabled??false,delegationEnabled:l?.delegationEnabled??false,balance:p.balance,stake:p.stake,delegationsIn:p.delegationsIn,delegationsOut:p.delegationsOut,usdValue:P})})},enabled:!!e})}function Di(e,t){return queryOptions({queryKey:["assets","hive-engine",t,"general-info",e],enabled:!!t&&!!e,staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{if(!t||!e)throw new Error("[SDK][HiveEngine] \u2013 token or username missed");let r=b(),n=Xt(e);await r.prefetchQuery(n);let o=r.getQueryData(n.queryKey),i=await r.ensureQueryData(Fi([t])),s=await r.ensureQueryData(rr(e)),a=await r.ensureQueryData(Ii(void 0,t)),c=i?.find(O=>O.symbol===t),p=s?.find(O=>O.symbol===t),f=+(a?.find(O=>O.symbol===t)?.lastPrice??"0"),m=parseFloat(p?.balance??"0"),g=parseFloat(p?.stake??"0"),_=parseFloat(p?.pendingUnstake??"0"),P=[{name:"liquid",balance:m},{name:"staked",balance:g}];return _>0&&P.push({name:"unstaking",balance:_}),{name:t,title:c?.name??"",price:f===0?0:Number(f*(o?.price??0)),accountBalance:m+g,layer:"ENGINE",parts:P}}})}function Pt(e,t=0){return queryOptions({queryKey:["points",e,t],queryFn:async()=>{if(!e)throw new Error("Get points query \u2013 username wasn't provided");let r=e.replace("@",""),n=await fetch(d.privateApiHost+"/private-api/points",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r})});if(!n.ok)throw new Error(`Failed to fetch points: ${n.status}`);let o=await n.json(),i=await fetch(d.privateApiHost+"/private-api/point-list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,type:t})});if(!i.ok)throw new Error(`Failed to fetch point transactions: ${i.status}`);let s=await i.json();return {points:o.points,uPoints:o.unclaimed_points,transactions:s}},staleTime:3e4,refetchOnMount:true,enabled:!!e})}function Ki(e){return queryOptions({queryKey:["assets","points","general-info",e],staleTime:6e4,refetchInterval:9e4,queryFn:async()=>(await b().prefetchQuery(Pt(e)),{name:"POINTS",title:"Ecency Points",price:.002,accountBalance:+(b().getQueryData(Pt(e).queryKey)?.points??0)})})}function TI(e,t){return queryOptions({queryKey:["assets","points","transactions",e,t],queryFn:async()=>(await(await fetch(`${d.privateApiHost}/private-api/point-list`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,type:t??0})})).json()).map(({created:o,type:i,amount:s,id:a,sender:c,receiver:p,memo:l})=>({created:new Date(o),type:i,results:[{amount:parseFloat(s),asset:"POINTS"}],id:a,from:c??void 0,to:p??void 0,memo:l??void 0}))})}function VI(e,t,r={refetch:false}){let n=b(),o=r.currency??"usd",i=async p=>(r.refetch?await n.fetchQuery(p):await n.prefetchQuery(p),n.getQueryData(p.queryKey)),s=async p=>{if(!p||o==="usd")return p;try{let l=await Ci(o);return {...p,price:p.price*l}}catch(l){return console.warn(`Failed to convert price from USD to ${o}:`,l),p}},a=Pi(e,o,true),c=async()=>{try{let l=(await n.fetchQuery(a)).wallets.find(m=>m.symbol.toUpperCase()===t.toUpperCase());if(!l)return;let f=[];if(l.liquid!==void 0&&l.liquid!==null&&f.push({name:"liquid",balance:l.liquid}),l.staked!==void 0&&l.staked!==null&&l.staked>0&&f.push({name:"staked",balance:l.staked}),l.savings!==void 0&&l.savings!==null&&l.savings>0&&f.push({name:"savings",balance:l.savings}),l.extraData&&Array.isArray(l.extraData))for(let m of l.extraData){if(!m||typeof m!="object")continue;let g=m.dataKey,_=m.value;if(typeof _=="string"){let O=_.replace(/,/g,"").match(/[+-]?\s*(\d+(?:\.\d+)?)/);if(O){let T=Math.abs(Number.parseFloat(O[1]));g==="delegated_hive_power"?f.push({name:"outgoing_delegations",balance:T}):g==="received_hive_power"?f.push({name:"incoming_delegations",balance:T}):g==="powering_down_hive_power"&&f.push({name:"pending_power_down",balance:T});}}}return {name:l.symbol,title:l.name,price:l.fiatRate,accountBalance:l.balance,apr:l.apr?.toString(),layer:l.layer,pendingRewards:l.pendingRewards,parts:f}}catch{return}};return queryOptions({queryKey:["ecency-wallets","asset-info",e,t,o],queryFn:async()=>{let p=await c();if(p&&p.price>0)return p;let l;if(t==="HIVE")l=await i(Xt(e));else if(t==="HP")l=await i(Oi(e));else if(t==="HBD")l=await i(Ai(e));else if(t==="POINTS")l=await i(Ki(e));else if((await n.ensureQueryData(rr(e))).some(m=>m.symbol===t))l=await i(Di(e,t));else {if(p)return p;throw new Error(`[SDK][Wallet] \u2013 unrecognized asset "${t}"`)}if(p&&l&&l.price>0){let f=await s(l);return {...p,price:f.price}}return await s(l)}})}var rf=(T=>(T.Transfer="transfer",T.TransferToSavings="transfer-saving",T.WithdrawFromSavings="withdraw-saving",T.Delegate="delegate",T.PowerUp="power-up",T.PowerDown="power-down",T.WithdrawRoutes="withdraw-routes",T.ClaimInterest="claim-interest",T.Swap="swap",T.Convert="convert",T.Gift="gift",T.Promote="promote",T.Claim="claim",T.Buy="buy",T.Stake="stake",T.Unstake="unstake",T.Undelegate="undelegate",T))(rf||{});function zI(e,t,r){return v(["wallet","transfer"],e,n=>[Ve(e,n.to,n.amount,n.memo)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function eD(e,t,r){return v(["wallet","transfer-point"],e,n=>[et(e,n.to,n.amount,n.memo)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function iD(e,t,r){return v(["wallet","delegate-vesting-shares"],e,n=>[ht(e,n.delegatee,n.vestingShares)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.delegatee),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function pD(e,t,r){return v(["wallet","set-withdraw-vesting-route"],e,n=>[_t(e,n.toAccount,n.percent,n.autoVest)],async(n,o)=>{await S(t?.adapter,r,[u.wallet.withdrawRoutes(e),u.accounts.full(e),u.accounts.full(o.toAccount)]);},t,"active",{broadcastMode:r})}function mD(e,t,r){return v(["wallet","transfer-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"transfer",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity,memo:n.memo}});return [["custom_json",{required_auths:[e],required_posting_auths:[],id:"ssc-mainnet-hive",json:o}]]},async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function wD(e,t,r){return v(["wallet","transfer-to-savings"],e,n=>[Ze(e,n.to,n.amount,n.memo)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function OD(e,t,r){return v(["wallet","transfer-from-savings"],e,n=>[je(e,n.to,n.amount,n.memo,n.requestId)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function CD(e,t,r){return v(["wallet","transfer-to-vesting"],e,n=>[gt(e,n.to,n.amount)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function ID(e,t,r){return v(["wallet","withdraw-vesting"],e,n=>[yt(e,n.vestingShares)],async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function MD(e,t,r){return v(["wallet","convert"],e,n=>[n.collateralized?Fr(e,n.amount,n.requestId):wt(e,n.amount,n.requestId)],async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function jD(e,t,r){return v(["wallet","claim-interest"],e,n=>mt(e,n.to,n.amount,n.memo,n.requestId),async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}var nf=5e3,or=new Map;function zD(e,t,r){return v(["wallet","claim-rewards"],e,n=>[zr(e,n.rewardHive,n.rewardHbd,n.rewardVests)],()=>{let n=e??"__anonymous__",o=[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e],u.assets.hiveGeneralInfo(e),u.assets.hbdGeneralInfo(e),u.assets.hivePowerGeneralInfo(e)],i=or.get(n);i&&(clearTimeout(i),or.delete(n));let s=setTimeout(async()=>{try{let a=b(),p=(await Promise.allSettled(o.map(l=>a.invalidateQueries({queryKey:l})))).filter(l=>l.status==="rejected");p.length>0&&console.error("[SDK][Wallet][useClaimRewards] delayed invalidation rejected",{username:e,rejectedCount:p.length,rejected:p});}catch(a){console.error("[SDK][Wallet][useClaimRewards] delayed invalidation failed",{username:e,error:a});}finally{or.delete(n);}},nf);or.set(n,s);},t,"posting",{broadcastMode:r})}function ZD(e,t,r){return v(["wallet","delegate-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"delegate",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function nK(e,t,r){return v(["wallet","undelegate-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"undelegate",contractPayload:{symbol:n.symbol,from:n.from,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function aK(e,t,r){return v(["wallet","stake-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"stake",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function lK(e,t,r){return v(["wallet","unstake-engine-token"],e,n=>{let o=JSON.stringify({contractName:"tokens",contractAction:"unstake",contractPayload:{symbol:n.symbol,to:n.to,quantity:n.quantity}});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:o}]]},async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function gK(e,t,r){return v(["wallet","claim-engine-rewards"],e,n=>{let o=JSON.stringify(n.tokens.map(i=>({symbol:i})));return [["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[e],json:o}]]},async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"posting",{broadcastMode:r})}function wK(e,t,r){return v(["wallet","engine-market-order"],e,n=>{let o,i;n.action==="cancel"?(i="cancel",o={type:n.orderType,id:n.orderId}):(i=n.action,o={symbol:n.symbol,quantity:n.quantity,price:n.price});let s=JSON.stringify({contractName:"market",contractAction:i,contractPayload:o});return [["custom_json",{id:"ssc-mainnet-hive",required_auths:[e],required_posting_auths:[],json:s}]]},async()=>{await S(t?.adapter,r,[u.accounts.full(e),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},t,"active",{broadcastMode:r})}function of(e,t,r){let{from:n,to:o="",amount:i="",memo:s=""}=r,a=r.request_id??Date.now()>>>0;switch(e){case "HIVE":switch(t){case "transfer":return [Ve(n,o,i,s)];case "transfer-saving":return [Ze(n,o,i,s)];case "withdraw-saving":return [je(n,o,i,s,a)];case "power-up":return [gt(n,o,i)]}break;case "HBD":switch(t){case "transfer":return [Ve(n,o,i,s)];case "transfer-saving":return [Ze(n,o,i,s)];case "withdraw-saving":return [je(n,o,i,s,a)];case "claim-interest":return mt(n,o,i,s,a);case "convert":return [wt(n,i,Math.floor(Date.now()/1e3))]}break;case "HP":switch(t){case "power-down":return [yt(n,i)];case "delegate":return [ht(n,o,i)];case "withdraw-routes":return [_t(r.from_account??n,r.to_account??o,r.percent??0,r.auto_vest??false)]}break;case "POINTS":if(t==="transfer"||t==="gift")return [et(n,o,i,s)];break}return null}function sf(e,t,r){let{from:n,to:o="",amount:i=""}=r,s=typeof i=="string"&&i.includes(" ")?i.split(" ")[0]:String(i);switch(t){case "transfer":return [Le(n,"transfer",{symbol:e,to:o,quantity:s,memo:r.memo??""})];case "stake":return [Le(n,"stake",{symbol:e,to:o,quantity:s})];case "unstake":return [Le(n,"unstake",{symbol:e,to:o,quantity:s})];case "delegate":return [Le(n,"delegate",{symbol:e,to:o,quantity:s})];case "undelegate":return [Le(n,"undelegate",{symbol:e,from:o,quantity:s})];case "claim":return [Ir(n,[e])]}return null}function af(e){return e==="claim"?"posting":"active"}function xK(e,t,r,n,o){let{mutateAsync:i}=tt.useRecordActivity(e,r);return v(["ecency-wallets",t,r],e,s=>{let a=of(t,r,s);if(a)return a;let c=sf(t,r,s);if(c)return c;throw new Error(`[SDK][Wallet] \u2013 no operation builder for asset="${t}" operation="${r}"`)},()=>{i();let s=[];s.push(["ecency-wallets","asset-info",e,t]),t==="HIVE"&&s.push(["ecency-wallets","asset-info",e,"HP"]),s.push(["wallet","portfolio","v2",e]),setTimeout(()=>{s.forEach(a=>{b().invalidateQueries({queryKey:a});});},5e3);},n,af(r),{broadcastMode:o})}function CK(e,t,r){return v(["wallet","delegate-rc"],e,({to:n,maxRc:o})=>[Dr(e,n,o)],async(n,o)=>{await S(t?.adapter,r,[u.accounts.full(e),u.accounts.full(o.to),u.resourceCredits.account(e),u.resourceCredits.account(o.to)]);},t,"active",{broadcastMode:r})}function FK(e,t,r){return v(["witnesses","vote"],e,({witness:n,approve:o})=>[Br(e,n,o)],async()=>{try{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.witnesses.votes(e)]);}catch(n){console.warn("[useWitnessVote] Post-broadcast side-effect failed:",n);}},t,"active",{broadcastMode:r})}function NK(e,t,r){return v(["witnesses","proxy"],e,({proxy:n})=>[Mr(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.witnesses.proxy()]);},t,"active",{broadcastMode:r})}function cf(e){return {owner:e.witness_name,total_missed:e.missed_blocks,url:e.url,props:{account_creation_fee:`${(e.account_creation_fee/1e3).toFixed(3)} HIVE`,account_subsidy_budget:0,maximum_block_size:e.block_size},hbd_exchange_rate:{base:`${e.price_feed.toFixed(3)} HBD`},available_witness_account_subsidies:0,running_version:e.version,signing_key:e.signing_key,last_hbd_exchange_update:e.feed_updated_at,rank:e.rank,vests:e.vests,voters_num:e.voters_num,voters_num_daily_change:e.voters_num_daily_change,price_feed:e.price_feed,hbd_interest_rate:e.hbd_interest_rate,last_confirmed_block_num:e.last_confirmed_block_num}}function VK(e){return infiniteQueryOptions({queryKey:u.witnesses.list(e),initialPageParam:1,queryFn:async({pageParam:t})=>(await te("hafbe","/witnesses",{"page-size":e,page:t})).witnesses.map(cf),getNextPageParam:(t,r,n)=>t.length===e?n+1:void 0})}function jK(e,t,r,n="vests",o="desc"){return queryOptions({queryKey:u.witnesses.voters(e,t,r,n,o),queryFn:async({signal:i})=>await te("hafbe","/witnesses/{witness-name}/voters",{"witness-name":e,"page-size":r,page:t,sort:n,direction:o},void 0,void 0,i),enabled:!!e,staleTime:6e4})}function LK(e){return queryOptions({queryKey:u.witnesses.voterCount(e),queryFn:async()=>await te("hafbe","/witnesses/{witness-name}/voters/count",{"witness-name":e}),enabled:!!e,staleTime:6e4})}var pf=(_=>(_[_.CHECKIN=10]="CHECKIN",_[_.LOGIN=20]="LOGIN",_[_.CHECKIN_EXTRA=30]="CHECKIN_EXTRA",_[_.POST=100]="POST",_[_.COMMENT=110]="COMMENT",_[_.VOTE=120]="VOTE",_[_.REBLOG=130]="REBLOG",_[_.DELEGATION=150]="DELEGATION",_[_.REFERRAL=160]="REFERRAL",_[_.COMMUNITY=170]="COMMUNITY",_[_.TRANSFER_SENT=998]="TRANSFER_SENT",_[_.TRANSFER_INCOMING=999]="TRANSFER_INCOMING",_[_.MINTED=991]="MINTED",_[_.BURNED=997]="BURNED",_))(pf||{});async function df(e,t){if(!e)throw new Error("[SDK][Points][Claim] \u2013 username wasn't provided");if(!t)throw new Error("[SDK][Points][Claim] \u2013 access token wasn't found");let n=await h()(d.privateApiHost+"/private-api/points-claim",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t})}),o=(n.headers.get("content-type")??"").split(";")[0].trim().toLowerCase(),i=await n.text();if(!n.ok){if(n.status===406)try{return JSON.parse(i)}catch{return {message:i,code:n.status}}let s=i&&o.includes("json")?`: ${i.slice(0,200)}`:"";throw new Error(`[SDK][Points][Claim] \u2013 failed with status ${n.status}${s}`)}if(!o.includes("json"))throw new Error(`[SDK][Points][Claim] \u2013 expected JSON but received "${o||"empty"}" response (status ${n.status})`);try{return JSON.parse(i)}catch{throw new Error(`[SDK][Points][Claim] \u2013 malformed JSON response (status ${n.status})`)}}function XK(e,t,r,n){let{mutateAsync:o}=tt.useRecordActivity(e,"points-claimed");return useMutation({mutationFn:()=>df(e,t),onError:n,onSuccess:()=>{o(),b().setQueryData(Pt(e).queryKey,i=>i&&{...i,points:(parseFloat(i.points)+parseFloat(i.uPoints)).toFixed(3),uPoints:"0"}),r?.();}})}var Bi=/(^|\s)author:([^\s]+)/g,Mi=/(^|\s)type:([^\s]+)/g,Qi=/(^|\s)category:([^\s]+)/g,Hi=/(^|\s)tag:([^\s]+)/g;var Vi=(n=>(n.ALL="",n.POST="post",n.COMMENT="comment",n))(Vi||{}),eN=5,tN=100;function ji(e){return e.trim().split(/\s+/)[0]??""}function ff(e){return ji(e).replace(/^@+/,"").toLowerCase()}function mf(e){return ji(e).replace(/^#+/,"").toLowerCase()}function gf(e){let t=new Set;return e.split(/[\s,]+/).map(r=>r.replace(/^#+/,"").toLowerCase()).filter(r=>r===""||t.has(r)?false:(t.add(r),true))}function rN({search:e="",author:t="",type:r="",category:n="",tags:o=[]}){let i=e.trim().replace(/\s+/g," "),s=ff(t),a=mf(n),c=gf(Array.isArray(o)?o.join(","):o),p=[i];return s&&p.push(`author:${s}`),r&&p.push(`type:${r}`),a&&p.push(`category:${a}`),c.length>0&&p.push(`tag:${c.join(",")}`),{q:p.filter(l=>l!=="").join(" "),search:i,author:s,type:r,category:a,tags:c}}var Ui=class{query="";search="";author="";type="";category="";tags=[];constructor(t){this.query=t,this.search=t,this.grabAuthor(),this.grabType(),this.grabCategory(),this.grabTags(),this.grabSearch();}grab=t=>{let r=[...this.query.matchAll(t)];return r.length>0?r[0][2].trim():""};grabAuthor=()=>{this.author=this.grab(Bi);};grabType=()=>{let t=this.grab(Mi);Object.values(Vi).includes(t)&&(this.type=t);};grabCategory=()=>{this.category=this.grab(Qi);};grabTags=()=>{let t=new Set;this.tags=[...this.query.matchAll(Hi)].flatMap(r=>r[2].split(",")).map(r=>r.trim()).filter(r=>r===""||t.has(r)?false:(t.add(r),true));};grabSearch=()=>{for([Bi,Mi,Qi,Hi].forEach(t=>{this.search=this.search.replace(t,"$1");});this.search.indexOf(" ")!==-1;)this.search=this.search.replace(" "," ");this.search=this.search.trim();}};async function xe(e,t){let n=await(async()=>{let o;try{o=await e.text();}catch{return}if(o!=="")try{return JSON.parse(o)}catch{return e.ok?void 0:o}})();if(!e.ok){let o=new Error(`Request failed with status ${e.status}`);throw o.status=e.status,o.data=n,o}if(n===void 0||t!==void 0&&!t(n))throw new Error("Response body was empty, invalid JSON, or not the expected shape");return n}function Fe(e){return typeof e=="object"&&e!==null&&Array.isArray(e.results)}var hf=isServer?0:3;function At(e,t){let{status:r}=t,n=r===408||r===429;return r!==void 0&&r>=400&&r<500&&!n?false:e<hf}function dN(e,t,r,n,o,i){return queryOptions({queryKey:u.search.results(e,t,r,n,o,i),queryFn:async({signal:s})=>{let a={q:e,sort:t,hide_low:r};n&&(a.since=n),o&&(a.scroll_id=o),i&&(a.votes=i);let c=await fetch(d.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify(a),signal:Pe(Ae,s)});return xe(c,Fe)},retry:At})}function fN(e,t,r=true){return infiniteQueryOptions({queryKey:u.search.controversialRising(e,t),initialPageParam:{sid:void 0,hasNextPage:true},queryFn:async({pageParam:n,signal:o})=>{if(!n.hasNextPage)return {hits:0,took:0,results:[]};let i,s=new Date;switch(t){case "today":i=new Date(s.getTime()-1440*60*1e3);break;case "week":i=new Date(s.getTime()-10080*60*1e3);break;case "month":i=new Date(s.getTime()-720*60*60*1e3);break;case "year":i=new Date(s.getTime()-365*24*60*60*1e3);break;default:i=void 0;}let a="* type:post",c=e==="rising"?"children":e,p=i?i.toISOString().split(".")[0]:void 0,l="0",f=t==="today"?50:200,m={q:a,sort:c,hide_low:l};p&&(m.since=p),n.sid&&(m.scroll_id=n.sid),(m.votes=f);let g=await fetch(d.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify(m),signal:Pe(Ae,o)});return xe(g,Fe)},getNextPageParam:n=>({sid:n?.scroll_id,hasNextPage:n.results.length>0}),enabled:r,retry:At})}async function hN(e,t,r,n,o,i,s){let a={q:e,sort:t,hide_low:r};n&&(a.since=n),o&&(a.scroll_id=o),i&&(a.votes=i);let p=await h()(d.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify(a),signal:Pe(Ae,s)});return xe(p,Fe)}async function Li(e,t,r=Ae){let o=await h()(d.privateApiHost+"/search-api/similar",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify(e),signal:Pe(r,t)});return xe(o,Fe)}async function _N(e,t){let n=await h()(d.privateApiHost+"/search-api/search-path",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify({q:e}),signal:Pe(Ae,t)}),o=await xe(n,Array.isArray);return o?.length>0?o:[e]}var vf=4368*60*60*1e3,Pf=4,Af=3e3,Of=2e3,xf=4e3,AN=2;function Sf(e,t){return e.replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/https?:\/\/\S+/g," ").replace(/\s+/g," ").trim().slice(0,t)}function Ef(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return (t>>>0).toString(36)}function ON(e){let t=e.title??"",r=e.json_metadata?.tags,n=(Array.isArray(r)?r:[]).filter(s=>typeof s=="string"&&s!==""),o=Sf(e.body??"",Af),i=Ef(`${t}|${n.join(",")}|${o}`);return queryOptions({queryKey:u.search.similarEntries(e.author,e.permlink,i),queryFn:async({signal:s})=>{let a=new Date(Date.now()-vf).toISOString().slice(0,19),c=await Li({author:e.author,permlink:e.permlink,title:t,body:o,tags:n,since:a},s,typeof window>"u"?Of:xf),p=[],l=new Set;for(let f of c.results){if(p.length>=Pf)break;f.permlink!==e.permlink&&(f.tags??[]).indexOf("nsfw")===-1&&(l.has(f.author)||(l.add(f.author),p.push(f)));}return p},staleTime:300*1e3,retry:false})}function RN(e,t=5){let r=e.trim();return queryOptions({queryKey:u.search.account(r,t),queryFn:async()=>{let n=await y("condenser_api.lookup_accounts",[r,t]);return n.length===0?[]:jt(n)},enabled:!!r})}function DN(e,t=10){let r=e.trim();return queryOptions({queryKey:u.search.topics(r,t),queryFn:async()=>(await y("condenser_api.get_trending_tags",[r,t+1])).map(o=>o.name).filter(o=>o!==""&&!o.startsWith("hive-")).slice(0,t),enabled:!!r})}function HN(e,t,r,n,o,i){return infiniteQueryOptions({queryKey:u.search.api(e,t,r,n,o,i),queryFn:async({pageParam:s,signal:a})=>{let c={q:e,sort:t,hide_low:r};n&&(c.since=n),s&&(c.scroll_id=s),o!==void 0&&(c.votes=o),i&&(c.include_nsfw=1);let p=await fetch(d.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify(c),signal:Pe(Ae,a)});return xe(p,Fe)},initialPageParam:void 0,getNextPageParam:s=>s?.scroll_id,enabled:!!e,retry:At})}function LN(e){return queryOptions({queryKey:["search","path",e],queryFn:async()=>{let t=await fetch(d.privateApiHost+"/search-api/search-path",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":d.clientId},body:JSON.stringify({q:e})});if(!t.ok)throw new Error(`Search path failed: ${t.status}`);let r=await t.json();return r?.length>0?r:[e]}})}async function Ff(e){let r=await h()(d.privateApiHost+"/private-api/support-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok){let n;try{n=await r.json();}catch{}let o=n?.message??`Failed to fetch support settings: ${r.status}`,i=new Error(o);throw i.status=r.status,i.data=n,i}return await r.json()}function zN(e,t){let r=e?.replace("@","");return queryOptions({queryKey:u.support.settings(r),queryFn:()=>{if(!t)throw new Error("[SDK][Support] missing auth");return Ff(t)},enabled:!!r&&!!t})}async function Kf(e,t){let n=await h()(d.privateApiHost+"/private-api/support-settings-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,beneficiary_percent:t.beneficiary_percent,curation_percent:t.curation_percent})});if(!n.ok){let o;try{o=await n.json();}catch{}let i=o?.message??`Failed to update support settings: ${n.status}`,s=new Error(i);throw s.status=n.status,s.data=o,s}return await n.json()}function Nf(e,t,r){return e.setQueryData(u.support.settings(t),r),e.invalidateQueries({queryKey:u.support.settings(t)})}function eB(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["support","settings-update",n],mutationFn:async o=>{if(!n||!t)throw new Error("[SDK][Support] missing auth");return Kf(t,o)},onSuccess(o){n&&Nf(r,n,o);}})}function oB(e){return queryOptions({queryKey:["promotions","boost-plus-prices"],queryFn:async()=>{if(!e)return [];let t=await fetch(d.privateApiHost+"/private-api/boost-plus-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch boost plus prices: ${t.status}`);return await t.json()},staleTime:1/0,enabled:!!e})}function uB(e){return queryOptions({queryKey:["promotions","rc-delegation-prices"],queryFn:async()=>{if(!e)return [];let t=await fetch(d.privateApiHost+"/private-api/rc-delegation-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch RC delegation prices: ${t.status}`);return await t.json()},staleTime:1/0,enabled:!!e})}function dB(e,t){return queryOptions({queryKey:["promotions","rc-delegation-active",e],queryFn:async()=>{if(!t||!e)return null;let r=await fetch(d.privateApiHost+"/private-api/rc-delegation-active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,username:e})});if(!r.ok)throw new Error(`Failed to fetch RC delegation active: ${r.status}`);let n=await r.json();return n&&n.expires&&n.user?{user:n.user,expires:new Date(n.expires)}:null},enabled:!!e&&!!t})}function yB(e){return queryOptions({queryKey:["promotions","promote-price"],queryFn:async()=>{let t=await fetch(d.privateApiHost+"/private-api/promote-price",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!t.ok)throw new Error(`Failed to fetch promote prices: ${t.status}`);return await t.json()},enabled:!!e})}function bB(e,t){return queryOptions({queryKey:["promotions","boost-plus-accounts",e],queryFn:async()=>{if(!t||!e)return null;let r=await fetch(d.privateApiHost+"/private-api/boosted-plus-account",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,account:e})});if(!r.ok)throw new Error(`Failed to fetch boost plus account prices: ${r.status}`);let n=await r.json();return n?{account:n.account,expires:new Date(n.expires)}:null},enabled:!!e&&!!t})}function OB(e,t,r){return v(["promotions","boost-plus"],e,({account:n,duration:o})=>[en(e,n,o)],async(n,{account:o})=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.promotions.boostPlusAccounts(o)]);},t,"active",{broadcastMode:r})}function kB(e,t,r){return v(["promotions","rc-delegation"],e,({duration:n})=>[tn(e,n)],async()=>{t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([u.accounts.full(e),u.resourceCredits.account(e),["promotions","rc-delegation-active",e]]);},t,"active",{broadcastMode:r})}async function TB(e){let r=await h()(d.privateApiHost+"/auth-api/hs-token-refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(!r.ok){let o;try{o=await r.json();}catch{o=void 0;}let i=new Error(`Failed to refresh token: ${r.status}`);throw i.status=r.status,i.data=o,i}return await r.json()}var jf="https://raw.githubusercontent.com/openhive-network/watchmen/main/output/flat/badactors.txt";function DB(){return queryOptions({queryKey:u.badActors.list(),queryFn:async({signal:e})=>{let t=await fetch(jf,{signal:e});if(!t.ok)throw new Error(`Failed to fetch bad actors list: ${t.status}`);let r=await t.text();return new Set(r.split(`
2
+ `).filter(Boolean))},staleTime:1440*60*1e3,gcTime:1/0})}var NB=1.1,Lf=(r=>(r.NUMBER_OF_VOTES="number_of_votes",r.TOKENS="tokens",r))(Lf||{});function BB(e){return e?e.map((t,r)=>({choice_num:r+1,choice_text:t,votes:{total_votes:0,hive_hp:0,hive_proxied_hp:0,hive_hp_incl_proxied:0}})):[]}function Gf(e){let t=e.poll_choices??[],r=e.poll_voters??[],n=e.poll_stats,o=t.map(a=>{let c=a.votes;return {choice_num:a.choice_num??0,choice_text:a.choice_text??"",votes:c?{total_votes:c.total_votes??0,hive_hp:c.hive_hp,hive_proxied_hp:c.hive_proxied_hp,hive_hp_incl_proxied:c.hive_hp_incl_proxied??null}:void 0}}),i=r.map(a=>({name:a.name??"",choices:a.choices??[],hive_hp:a.hive_hp,hive_proxied_hp:a.hive_proxied_hp,hive_hp_incl_proxied:a.hive_hp_incl_proxied})),s=n?{total_voting_accounts_num:n.total_voting_accounts_num??0,total_hive_hp:n.total_hive_hp,total_hive_proxied_hp:n.total_hive_proxied_hp,total_hive_hp_incl_proxied:n.total_hive_hp_incl_proxied??null}:void 0;return {author:e.author??"",permlink:e.permlink??"",question:e.question??"",poll_choices:o,poll_voters:i,poll_stats:s,poll_trx_id:e.poll_trx_id??"",status:e.status??"",end_time:e.end_time??"",preferred_interpretation:e.preferred_interpretation??"number_of_votes",max_choices_voted:e.max_choices_voted??1,filter_account_age_days:e.filter_account_age_days??0,protocol_version:e.protocol_version??0,created:e.created??"",post_title:e.post_title??"",post_body:e.post_body??"",parent_permlink:e.parent_permlink??"",tags:e.tags??[],image:e.image??[],token:e.token,community_membership:e.community_membership,allow_vote_changes:e.allow_vote_changes,ui_hide_res_until_voted:e.ui_hide_res_until_voted??false,platform:e.platform}}function VB(e,t){return queryOptions({queryKey:u.polls.details(e??"",t??""),enabled:!!e&&!!t,gcTime:isServer?yo:1800*1e3,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][Polls] \u2013 missing author or permlink");let r=h(),n=`${d.pollsApiHost}/rpc/poll?author=eq.${encodeURIComponent(e)}&permlink=eq.${encodeURIComponent(t)}`,o=await r(n);if(!o.ok)throw new Error(`[SDK][Polls] \u2013 fetch failed: ${o.status}`);let i=await o.json();if(!Array.isArray(i)||!i[0])throw new Error("[SDK][Polls] \u2013 no poll data found");return Gf(i[0])}})}function $B(e,t,r){return v(u.polls.vote(),e??"",({pollTrxId:n,choices:o})=>{if(!e)throw new Error("[SDK][Polls] Cannot vote without an authenticated username");return [["custom_json",{id:"polls",required_auths:[],required_posting_auths:[e],json:JSON.stringify({poll:n,action:"vote",choices:o})}]]},void 0,t,"posting",{broadcastMode:r??"async"})}var zf=-1e10,Jf=5,Yf=30;var $i=e=>Math.abs(e)>0&&Math.abs(e)<=100;function Wi(e){if(typeof e=="number"&&$i(e)||typeof e=="string"&&(e=Number(e),$i(e)))return Math.floor(e);if(e===0)return 25;let t=false;e<0&&(t=true);let r=Math.log10(Math.abs(e));return r=Math.max(r-9,0),r<0&&(r=0),t&&(r*=-1),r=r*9+25,Math.floor(r)}var Xf=["ecency.com","ecency.app","hive.blog","hive.io","hiveblocks.com","peakd.com","snapie.io","hivesuite.app","leofinance.io","inleo.io","3speak.tv","d.buzz","waivio.com"],Zf=["imgur.com","images.hive.blog","files.peakd.com","i.ecency.com","images.ecency.com","steemitimages.com","cdn.steemitimages.com","media.giphy.com"],em=/\.(jpe?g|png|gif|webp|svg|bmp|avif)(\?|#|$)/i,tm=/(?:https?:)?\/\/[^\s)<>"'\]]+/gi,rm=/[.,;:!?'"]+$/;function nm(e){let t=/^(?:https?:)?\/\/([^/?#]+)/i.exec(e);return t?t[1].toLowerCase().replace(/^www\./,""):""}function om(e){let t=e.replace(rm,"");if(em.test(t))return false;let r=nm(t);if(!r.includes("."))return false;let n=o=>r===o||r.endsWith("."+o);return !(Xf.some(n)||Zf.some(n))}function Gi(e){if(!e)return false;let t=e.match(tm);return t?t.some(om):false}var im=(n=>(n.MOD_MUTED="mod_muted",n.DOWNVOTED="downvoted",n.LOW_TRUST="low_trust",n))(im||{});function sm(e){return e?.stats?.total_votes??e?.active_votes?.length??0}function am(e,t){return (e??0)<-1e10&&t>=5}function um(e){let t=e?.author_reputation;return t==null?false:Wi(t)<30&&Gi(e?.body)}function ZB(e,t){return !!e&&!!t?.includes(e)}function eM(e){return e?e.stats?.gray||e.stats?.hide?"mod_muted":am(e.net_rshares,sm(e))?"downvoted":um(e)?"low_trust":null:null}var it=class extends Error{constructor(r,n,o){super(r);this.status=n;this.data=o;}status;data},Ot=class extends it{constructor(r,n,o,i,s){super(r,n,s);this.code=o;this.taken=i;}code;taken};function Ie(e){return `${d.newsletterHost??d.privateApiHost}/api/newsletter${e}`}async function We(e){let t=await e.json().catch(()=>{});if(!e.ok)throw new it(t?.error||`Request failed (${e.status})`,e.status,t);if(!t||typeof t!="object")throw new it(`Unexpected response (${e.status})`,e.status);return t}async function zi(e,t){let n=await h()(Ie("/subscribe"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,...t?{code:t}:{}})});return We(n)}async function Ji(e){let r=await h()(Ie("/subscriptions"),{headers:{"X-HS-Token":e}});return (await We(r)).subscriptions??[]}async function Yi(e,t){let n=await h()(Ie(`/subscriptions/${encodeURIComponent(e)}`),{method:"DELETE",headers:{"X-HS-Token":t}});await We(n);}async function Xi(e,t){let n=await h()(Ie("/unsubscribe-all"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,code:t})});await We(n);}async function Zi(e,t,r){let o=await h()(Ie(`/sender?type=${e}&target=${encodeURIComponent(t)}`),{headers:{"X-HS-Token":r}});return We(o)}async function es(e,t,r){let o=await h()(Ie(`/issues?type=${e}&target=${encodeURIComponent(t)}`),{headers:{"X-HS-Token":r}});return (await We(o)).issues??[]}async function ts(e,t,r,n=20){let i=await h()(Ie(`/posts?type=${e}&target=${encodeURIComponent(t)}&limit=${n}`),{headers:{"X-HS-Token":r}});return (await We(i)).posts??[]}async function rs(e,t,r){let o=await h()(Ie(e),{method:"POST",headers:{"Content-Type":"application/json","X-HS-Token":r},body:JSON.stringify(t)}),i=await o.json().catch(()=>{});if(!o.ok)throw new Ot(i?.error||`Request failed (${o.status})`,o.status,i?.code,i?.taken,i);if(!i||typeof i!="object")throw new Ot(`Unexpected response (${o.status})`,o.status);return i}function ns(e,t){return rs("/send/preview",e,t)}function os(e,t){return rs("/send",e,t)}function cM(e,t){let r=e?.replace("@","");return queryOptions({queryKey:u.newsletter.subscriptions(r),enabled:!!r&&!!t,queryFn:async()=>{if(!t)throw new Error("[SDK][Newsletter] \u2013 missing auth");return Ji(t)},staleTime:6e4,retry:false})}function mM(e,t,r,n){let o=r?.replace("@","");return queryOptions({queryKey:u.newsletter.sender(e,t,o),enabled:!!o&&!!n&&!!t,queryFn:async()=>{if(!n)throw new Error("[SDK][Newsletter] \u2013 missing auth");return Zi(e,t,n)},staleTime:5*6e4})}function wM(e,t,r,n){let o=r?.replace("@","");return queryOptions({queryKey:u.newsletter.issues(e,t,o),enabled:!!o&&!!n&&!!t,queryFn:async()=>{if(!n)throw new Error("[SDK][Newsletter] \u2013 missing auth");return es(e,t,n)},staleTime:6e4})}function OM(e,t,r,n,o=20){let i=r?.replace("@","");return queryOptions({queryKey:u.newsletter.posts(e,t,i,o),enabled:!!i&&!!n&&!!t,queryFn:async()=>{if(!n)throw new Error("[SDK][Newsletter] \u2013 missing auth");return ts(e,t,n,o)},staleTime:6e4})}function CM(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["newsletter","subscribe",n],mutationFn:o=>zi(o,t),onSuccess(){n&&r.invalidateQueries({queryKey:u.newsletter.subscriptions(n)});}})}function IM(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["newsletter","leave",n],mutationFn:async o=>{if(!n||!t)throw new Error("[SDK][Newsletter] \u2013 missing auth");return Yi(o,t)},onSuccess(o,i){r.setQueryData(u.newsletter.subscriptions(n),s=>(s??[]).filter(a=>a.id!==i));}})}function MM(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["newsletter","unsubscribe-all",n],mutationFn:async o=>{if(!n||!t)throw new Error("[SDK][Newsletter] \u2013 missing auth");return Xi(o,t)},onSuccess(o,i){r.setQueryData(u.newsletter.subscriptions(n),s=>(s??[]).filter(a=>a.email.toLowerCase()!==i.toLowerCase()));}})}function jM(e,t){let r=e?.replace("@","");return useMutation({mutationKey:["newsletter","send-preview",r],mutationFn:async n=>{if(!r||!t)throw new Error("[SDK][Newsletter] \u2013 missing auth");return ns(n,t)}})}function LM(e,t){let r=useQueryClient(),n=e?.replace("@","");return useMutation({mutationKey:["newsletter","send",n],mutationFn:async o=>{if(!n||!t)throw new Error("[SDK][Newsletter] \u2013 missing auth");return os(o,t)},onSuccess(o,i){r.invalidateQueries({queryKey:u.newsletter.issues(i.type,i.target,n)}),r.invalidateQueries({queryKey:u.newsletter.sender(i.type,i.target,n)});}})}/**
3
3
  * @license bytebuffer.ts (c) 2015 Daniel Wirtz <dcode@dcode.io>
4
4
  * Backing buffer: ArrayBuffer, Accessor: DataView
5
5
  * Released under the Apache License, Version 2.0
6
6
  * see: https://github.com/dcodeIO/bytebuffer.ts for details
7
7
  * modified by @xmcl/bytebuffer
8
8
  * And customized for hive-tx
9
- */export{Ao as ACCOUNT_OPERATION_GROUPS,Ga as ALL_ACCOUNT_OPERATIONS,yi as ALL_NOTIFY_TYPES,Hd as AssetOperation,xg as BROADCAST_INCLUSION_DELAY_MS,Lo as BuySellTransactionType,f as CONFIG,Q as ConfigManager,jf as ContentModerationReason,Xe as EcencyAnalytics,ca as EcencyQueriesManager,je as EntriesCacheManagement,co as ErrorType,Df as HIDDEN_POST_MIN_VOTES,qf as HIDDEN_POST_RSHARES_THRESHOLD,ln as HIVE_ACCOUNT_OPERATION_GROUPS,kT as HIVE_OPERATION_LIST,FT as HIVE_OPERATION_NAME_BY_ID,TT as HIVE_OPERATION_ORDERS,Zt as HiveEngineToken,pi as HiveSignerIntegration,De as HiveTxTransaction,Ae as INTERNAL_API_TIMEOUT_MS,Kf as LOW_TRUST_REPUTATION_THRESHOLD,CK as MAX_SEARCH_QUERY_LENGTH,kK as MAX_SEARCH_TAGS,oo as Memo,Bt as NaiMap,kl as NotificationFilter,Rl as NotificationViewType,Cl as NotifyTypes,ep as OPERATION_AUTHORITY_MAP,$o as OrderIdPrefix,lM as POLLS_PROTOCOL_VERSION,Gd as PointTransactionType,Rf as PollPreferredInterpretation,U as PrivateKey,Y as PublicKey,ll as QUEST_CATALOG,dl as QUEST_MIN_CONTENT_LENGTH,u as QueryKeys,Wt as RC_RESOURCE_NAMES,xl as ROLES,lo as SERVER_GC_TIME_MS,tl as SIGNATURE_BYTES,YK as SIMILAR_ENTRIES_MIN_RENDER,HS as STREAK_FREEZE_MAX_OWNED,QS as STREAK_FREEZE_PRICE,mi as SUBSCRIBERS_PAGE_SIZE,Mi as SearchQuery,Ni as SearchType,Ee as Signature,qo as SortOrder,fo as Symbol,$t as THREESPEAK_BENEFICIARY_ACCOUNT,bE as THREESPEAK_BENEFICIARY_WEIGHT,el as TRANSACTION_HEADER_BYTES,ME as ThreeSpeakIntegration,Ea as accountNameByteLength,ri as addDraft,Zo as addImage,Cx as addOptimisticDiscussionEntry,ii as addSchedule,Pf as applySupportSettingsUpdate,xp as applyVoteCacheUpdate,ae as bridgeApiCall,po as broadcastJson,ee as broadcastOperations,so as broadcastOperationsAsync,$r as buildAccountCreateOp,Pu as buildAccountUpdate2Op,vu as buildAccountUpdateOp,ku as buildActiveCustomJsonOp,Jr as buildBoostPlusOp,jo as buildCancelTransferFromSavingsOp,Ou as buildChangeRecoveryAccountOp,Gr as buildClaimAccountOp,lt as buildClaimInterestOps,Lr as buildClaimRewardBalanceOp,Cr as buildCollateralizedConvertOp,Ne as buildCommentOp,Qe as buildCommentOptionsOp,Zr as buildCommunityRegistrationOp,yt as buildConvertOp,Wr as buildCreateClaimedAccountOp,Tr as buildDelegateRcOp,mt as buildDelegateVestingSharesOp,Sr as buildDeleteCommentOp,Rr as buildEngineClaimOp,Ve as buildEngineOp,bu as buildFlagPostOp,Fr as buildFollowOp,zr as buildGrantPostingPermissionOp,mu as buildIgnoreOp,jr as buildLimitOrderCancelOp,Vt as buildLimitOrderCreateOp,wu as buildLimitOrderCreateOpWithType,Su as buildMultiPointTransferOps,du as buildMultiTransferOps,Vr as buildMutePostOp,_u as buildMuteUserOp,Ur as buildPinPostOp,Ye as buildPointTransferOp,Cu as buildPostingCustomJsonOp,wo as buildPostingJsonMetadata,Ar as buildProfileMetadata,Xr as buildPromoteOp,Kr as buildProposalCreateOp,Br as buildProposalVoteOp,Yr as buildRcDelegationOp,kr as buildReblogOp,Eu as buildRecoverAccountOp,fu as buildRecurrentTransferOp,yu as buildRemoveProposalOp,xu as buildRequestAccountRecoveryOp,Go as buildRevokeKeysOp,Au as buildRevokePostingPermissionOp,RK as buildSearchQuery,Ir as buildSetLastReadOps,Qr as buildSetRoleOp,gt as buildSetWithdrawVestingRouteOp,Mr as buildSubscribeOp,Ue as buildTransferFromSavingsOp,He as buildTransferOp,Je as buildTransferToSavingsOp,dt as buildTransferToVestingOp,Ht as buildUnfollowOp,gu as buildUnignoreOp,Nr as buildUnsubscribeOp,Hr as buildUpdateCommunityOp,hu as buildUpdateProposalOp,Er as buildVoteOp,ft as buildWithdrawVestingOp,Dr as buildWitnessProxyOp,qr as buildWitnessVoteOp,hl as buyStreakFreezeRequest,Dt as calculateRCMana,wr as calculateVPMana,te as callREST,y as callRPC,Le as callRPCBroadcast,It as callWithQuorum,YP as canRevokeFromAuthority,Gh as checkFavoriteQueryOptions,xh as checkUsernameWalletsPendingQueryOptions,Jd as claimPointsRequest,dn as collectRequestedOperations,sn as computeResourceCost,an as countCommentResourceUsage,di as countVoteResourceUsage,Qg as decodeObj,Ku as dedupeAndSortKeyAuths,oi as deleteDraft,ti as deleteImage,si as deleteSchedule,vA as downVotingPower,NS as earnsQuestContentCredit,Ng as encodeObj,wE as enforceThreeSpeakBeneficiary,dS as estimateCommentRcCost,cn as estimateCommentTransactionBytes,AS as estimateRcPrecheck,li as estimateVoteTransactionBytes,_o as extractAccountProfile,Gs as formatError,tt as formattedNumber,ul as gameClaimRequest,yR as getAccountDelegationsQueryOptions,M as getAccountFullQueryOptions,Wk as getAccountNotificationsInfiniteQueryOptions,n_ as getAccountPendingRecoveryQueryOptions,Or as getAccountPosts,uw as getAccountPostsInfiniteQueryOptions,pw as getAccountPostsQueryOptions,rS as getAccountRcQueryOptions,Xh as getAccountRecoveriesQueryOptions,u_ as getAccountReputationsQueryOptions,qh as getAccountSubscriptionsQueryOptions,s0 as getAccountVoteHistoryInfiniteQueryOptions,hq as getAccountWalletAssetInfoQueryOptions,jy as getAccountsQueryOptions,P0 as getAggregatedBalanceQueryOptions,dy as getAiAssistPriceQueryOptions,cy as getAiGeneratePriceQueryOptions,yy as getAiTranscribePriceQueryOptions,Ri as getAllHiveEngineTokensQueryOptions,vC as getAnnouncementsQueryOptions,uM as getBadActorsQueryOptions,h0 as getBalanceHistoryInfiniteQueryOptions,Nh as getBookmarksInfiniteQueryOptions,Mh as getBookmarksQueryOptions,GB as getBoostPlusAccountPricesQueryOptions,FB as getBoostPlusPricesQueryOptions,v_ as getBotsQueryOptions,_ as getBoundFetch,HA as getChainPropertiesQueryOptions,kR as getCollateralizedConversionRequestsQueryOptions,zw as getCommentHistoryQueryOptions,$b as getCommunities,Ok as getCommunitiesQueryOptions,To as getCommunity,Ck as getCommunityContextQueryOptions,rC as getCommunityPermissions,qk as getCommunityQueryOptions,Hk as getCommunitySubscribersInfiniteQueryOptions,Qk as getCommunitySubscribersQueryOptions,tC as getCommunityType,kM as getContentModerationReason,wb as getContentQueryOptions,xb as getContentRepliesQueryOptions,HK as getControversialRisingInfiniteQueryOptions,OR as getConversionRequestsQueryOptions,xi as getCurrencyRate,rI as getCurrencyRates,tI as getCurrencyTokenRate,VF as getCurrentMedianHistoryPriceQueryOptions,tp as getCustomJsonAuthority,Zw as getDeletedEntryQueryOptions,uE as getDiscoverCurationQueryOptions,oE as getDiscoverLeaderboardQueryOptions,Ro as getDiscussion,rw as getDiscussionQueryOptions,Do as getDiscussionsQueryOptions,Nw as getDraftsInfiniteQueryOptions,Mw as getDraftsQueryOptions,Oe as getDynamicPropsQueryOptions,pb as getEntryActiveVotesQueryOptions,jh as getFavoritesInfiniteQueryOptions,Vh as getFavoritesQueryOptions,NF as getFeedHistoryQueryOptions,zy as getFollowCountQueryOptions,eh as getFollowersQueryOptions,ih as getFollowingQueryOptions,tb as getFragmentsInfiniteQueryOptions,ze as getFragmentsQueryOptions,D_ as getFriendsInfiniteQueryOptions,jw as getGalleryImagesQueryOptions,SS as getGameStatusCheckQueryOptions,bi as getHbdAssetGeneralInfoQueryOptions,VT as getHbdAssetTransactionsQueryOptions,Gt as getHiveAssetGeneralInfoQueryOptions,XT as getHiveAssetMetricQueryOptions,zt as getHiveAssetTransactionsQueryOptions,rF as getHiveAssetWithdrawalRoutesQueryOptions,HI as getHiveEngineBalancesWithUsdQueryOptions,Sd as getHiveEngineMetrics,cI as getHiveEngineOpenOrders,sI as getHiveEngineOrderBook,Ti as getHiveEngineTokenGeneralInfoQueryOptions,Si as getHiveEngineTokenMetrics,Ei as getHiveEngineTokenTransactions,PI as getHiveEngineTokenTransactionsQueryOptions,Jt as getHiveEngineTokensBalances,Xt as getHiveEngineTokensBalancesQueryOptions,et as getHiveEngineTokensMarket,gI as getHiveEngineTokensMarketQueryOptions,Yt as getHiveEngineTokensMetadata,Ci as getHiveEngineTokensMetadataQueryOptions,EI as getHiveEngineTokensMetricsQueryOptions,aI as getHiveEngineTradeHistory,ki as getHiveEngineUnclaimedRewards,RI as getHiveEngineUnclaimedRewardsQueryOptions,SF as getHiveHbdStatsQueryOptions,jE as getHivePoshLinksQueryOptions,wi as getHivePowerAssetGeneralInfoQueryOptions,GT as getHivePowerAssetTransactionsQueryOptions,sF as getHivePowerDelegatesInfiniteQueryOptions,lF as getHivePowerDelegatingsQueryOptions,nI as getHivePrice,Lw as getImagesInfiniteQueryOptions,Vw as getImagesQueryOptions,zR as getIncomingRcQueryOptions,eI as getMarketData,TF as getMarketDataQueryOptions,AF as getMarketHistoryQueryOptions,bF as getMarketStatisticsQueryOptions,ph as getMutedUsersQueryOptions,cd as getNextAccountHistoryPageParam,Xv as getNormalizePostQueryOptions,yO as getNotificationSetting,mO as getNotifications,pC as getNotificationsInfiniteQueryOptions,hC as getNotificationsSettingsQueryOptions,sC as getNotificationsUnreadCountQueryOptions,QR as getOpenOrdersQueryOptions,np as getOperationAuthority,gF as getOrderBookQueryOptions,LR as getOutgoingRcDelegationsInfiniteQueryOptions,fE as getPageStatsQueryOptions,Fi as getPointsAssetGeneralInfoQueryOptions,iq as getPointsAssetTransactionsQueryOptions,bt as getPointsQueryOptions,hM as getPollQueryOptions,_i as getPortfolioQueryOptions,hc as getPost,Lb as getPostHeader,Rb as getPostHeaderQueryOptions,Eo as getPostQueryOptions,nv as getPostTipsQueryOptions,Co as getPostsRanked,_w as getPostsRankedInfiniteQueryOptions,bw as getPostsRankedQueryOptions,E0 as getProMembersQueryOptions,Qt as getProfiles,l0 as getProfilesQueryOptions,jB as getPromotePriceQueryOptions,_O as getPromotedPost,ib as getPromotedPostsQuery,rp as getProposalAuthority,QC as getProposalQueryOptions,JC as getProposalVotesInfiniteQueryOptions,jC as getProposalsQueryOptions,w as getQueryClient,MS as getQuestCatalogEntry,KS as getQuestsQueryOptions,QB as getRcDelegationActiveQueryOptions,KB as getRcDelegationPricesQueryOptions,aS as getRcResourceParamsQueryOptions,XE as getRcStatsQueryOptions,Cw as getRebloggedByQueryOptions,Ow as getReblogsQueryOptions,ZR as getReceivedVestingSharesQueryOptions,nT as getRecurrentTransfersQueryOptions,x_ as getReferralsInfiniteQueryOptions,C_ as getReferralsStatsQueryOptions,zb as getRelationshipBetweenAccounts,Po as getRelationshipBetweenAccountsQueryOptions,xA as getRequiredAuthority,ry as getRewardFundQueryOptions,Yk as getRewardedCommunitiesQueryOptions,FR as getSavingsWithdrawFromQueryOptions,qw as getSchedulesInfiniteQueryOptions,Iw as getSchedulesQueryOptions,oB as getSearchAccountQueryOptions,vh as getSearchAccountsByUsernameQueryOptions,gB as getSearchApiInfiniteQueryOptions,Q_ as getSearchFriendsQueryOptions,bB as getSearchPathQueryOptions,uB as getSearchTopicsQueryOptions,hv as getShortsFeedQueryOptions,XK as getSimilarEntriesQueryOptions,xC as getSpotlightsQueryOptions,GE as getStatsQueryOptions,Gb as getSubscribers,Wb as getSubscriptions,AB as getSupportSettingsQueryOptions,_f as getSupportSettingsRequest,DF as getTradeHistoryQueryOptions,h_ as getTransactionsInfiniteQueryOptions,L_ as getTrendingTagsQueryOptions,Y_ as getTrendingTagsWithStatsQueryOptions,gb as getUserPostVoteQueryOptions,eR as getUserProposalVotesQueryOptions,wR as getVestingDelegationExpirationsQueryOptions,dR as getVestingDelegationsQueryOptions,No as getVisibleFirstLevelThreadItems,Vv as getWavesByAccountQueryOptions,Ov as getWavesByHostQueryOptions,Cv as getWavesByTagQueryOptions,lv as getWavesFeedQueryOptions,qv as getWavesFollowingQueryOptions,dv as getWavesLatestFeedQueryOptions,Wv as getWavesTrendingAuthorsQueryOptions,Mv as getWavesTrendingTagsQueryOptions,KR as getWithdrawRoutesQueryOptions,bK as getWitnessVoterCountQueryOptions,_K as getWitnessVotersPageQueryOptions,hK as getWitnessesInfiniteQueryOptions,ji as hasExternalLink,Kp as hasThreeSpeakEmbed,x as hiveTxConfig,ne as hiveTxUtils,iM as hsTokenRenew,E as invalidateAfterBroadcast,SM as isAuthorMuted,mo as isCommunity,go as isEmptyDate,$f as isHiddenPost,Js as isInfoError,Wf as isLowTrustSeoPost,Ys as isNetworkError,Ge as isQueryableAccountName,zs as isResourceCreditsError,vE as isThreeSpeakBeneficiary,Op as isVoteAlreadyReflected,io as isWif,ua as isWrappedResponse,yh as lookupAccountsQueryOptions,Bg as makeQueryClient,dM as mapMetaChoicesToPollChoices,Qo as mapThreadItemsToWaveEntries,Xo as markNotifications,fl as measureQuestContentLength,ai as moveSchedule,Fo as normalizePost,Yd as normalizeSearchAuthor,Xd as normalizeSearchCategory,Zd as normalizeSearchTags,se as normalizeToWrappedResponse,he as normalizeWaveEntryFromApi,bO as onboardEmail,Nt as parseAccounts,k as parseAsset,$e as parseChainError,xa as parsePostingMetadataRoot,Me as parseProfileMetadata,bo as pickRicherMetadataSnapshot,wA as powerRechargeTime,un as priceRcUsage,S0 as proMembersSet,PA as rcPower,ci as removeOptimisticDiscussionEntry,ud as resolveAccountHistoryLimit,Ep as resolveContentActivityType,ht as resolveHiveOperationFilters,So as resolvePost,ui as restoreDiscussionSnapshots,Tx as restoreEntryInCache,Zk as roleMap,gO as saveNotificationSetting,LK as search,$K as searchPath,QK as searchQueryOptions,ug as sha256,we as shouldTriggerAuthFallback,lO as signUp,Hi as similar,_c as sortDiscussions,pn as stringFieldBytes,dO as subscribeEmail,Mc as toEntryArray,ni as updateDraft,Rx as updateEntryInCache,vf as updateSupportSettingsRequest,ei as uploadImage,hO as uploadImageWithSignature,vP as useAccountFavoriteAdd,EP as useAccountFavoriteDelete,M0 as useAccountRelationsUpdate,nA as useAccountRevokeKey,UP as useAccountRevokePosting,I0 as useAccountUpdate,Wo as useAccountUpdateKeyAuths,KP as useAccountUpdatePassword,zP as useAccountUpdateRecovery,OO as useAddDraft,zA as useAddFragment,tx as useAddImage,QO as useAddSchedule,Oy as useAiAssist,ky as useAiTranscribe,fP as useBookmarkAdd,hP as useBookmarkDelete,XB as useBoostPlus,v as useBroadcastMutation,LS as useBuyStreakFreeze,aA as useClaimAccount,VD as useClaimEngineRewards,_D as useClaimInterest,EK as useClaimPoints,AD as useClaimRewards,Ex as useComment,fD as useConvert,gA as useCreateAccount,Qx as useCrossPost,SD as useDelegateEngineToken,nK as useDelegateRc,Iq as useDelegateVestingShares,Kx as useDeleteComment,DO as useDeleteDraft,sx as useDeleteImage,LO as useDeleteSchedule,rO as useEditFragment,WD as useEngineMarketOrder,iP as useFollow,FS as useGameClaim,wy as useGenerateImage,lA as useGrantPostingPermission,YF as useLimitOrderCancel,WF as useLimitOrderCreate,FC as useMarkNotificationsRead,JO as useMoveSchedule,nk as useMutePost,bk as usePinPost,wM as usePollVote,Gx as usePromote,cR as useProposalCreate,oR as useProposalVote,rM as useRcDelegation,Px as useReblog,tn as useRecordActivity,gk as useRegisterCommunityRewards,cO as useRemoveFragment,ak as useSetCommunityRole,KC as useSetLastRead,Mq as useSetWithdrawVestingRoute,BA as useSignOperationByHivesigner,RA as useSignOperationByKey,IA as useSignOperationByKeychain,DD as useStakeEngineToken,zS as useSubscribeCommunity,Aq as useTransfer,Uq as useTransferEngineToken,Xq as useTransferFromSavings,kq as useTransferPoint,Wq as useTransferToSavings,nD as useTransferToVesting,TD as useUndelegateEngineToken,uP as useUnfollow,ND as useUnstakeEngineToken,ZS as useUnsubscribeCommunity,lk as useUpdateCommunity,CO as useUpdateDraft,jx as useUpdateReply,kB as useUpdateSupportSettings,px as useUploadImage,hx as useVote,ZD as useWalletOperation,cD as useWithdrawVesting,lK as useWitnessProxy,aK as useWitnessVote,fO as usrActivity,ut as utf8ByteLength,Rp as validatePostCreating,ye as varintByteLength,xo as verifyPostOnAlternateNode,We as vestsToHp,bA as votingPower,Zu as votingRshares,AA as votingValue,Pe as withTimeoutSignal};//# sourceMappingURL=index.mjs.map
9
+ */export{Eo as ACCOUNT_OPERATION_GROUPS,cu as ALL_ACCOUNT_OPERATIONS,bi as ALL_NOTIFY_TYPES,rf as AssetOperation,Yg as BROADCAST_INCLUSION_DELAY_MS,zo as BuySellTransactionType,d as CONFIG,M as ConfigManager,im as ContentModerationReason,tt as EcencyAnalytics,Aa as EcencyQueriesManager,$e as EntriesCacheManagement,fo as ErrorType,Jf as HIDDEN_POST_MIN_VOTES,zf as HIDDEN_POST_RSHARES_THRESHOLD,gn as HIVE_ACCOUNT_OPERATION_GROUPS,eq as HIVE_OPERATION_LIST,oq as HIVE_OPERATION_NAME_BY_ID,nq as HIVE_OPERATION_ORDERS,nr as HiveEngineToken,mi as HiveSignerIntegration,Ne as HiveTxTransaction,Ae as INTERNAL_API_TIMEOUT_MS,Yf as LOW_TRUST_REPUTATION_THRESHOLD,tN as MAX_SEARCH_QUERY_LENGTH,eN as MAX_SEARCH_TAGS,uo as Memo,Ht as NaiMap,it as NewsletterApiError,Ot as NewsletterSendRefusedError,Vl as NotificationFilter,Ll as NotificationViewType,jl as NotifyTypes,gp as OPERATION_AUTHORITY_MAP,Jo as OrderIdPrefix,NB as POLLS_PROTOCOL_VERSION,pf as PointTransactionType,Lf as PollPreferredInterpretation,H as PrivateKey,Y as PublicKey,Sl as QUEST_CATALOG,El as QUEST_MIN_CONTENT_LENGTH,u as QueryKeys,Yt as RC_RESOURCE_NAMES,Ql as ROLES,yo as SERVER_GC_TIME_MS,yl as SIGNATURE_BYTES,AN as SIMILAR_ENTRIES_MIN_RENDER,fk as STREAK_FREEZE_MAX_OWNED,dk as STREAK_FREEZE_PRICE,_i as SUBSCRIBERS_PAGE_SIZE,Ui as SearchQuery,Vi as SearchType,Ee as Signature,Bo as SortOrder,ho as Symbol,Jt as THREESPEAK_BENEFICIARY_ACCOUNT,LS as THREESPEAK_BENEFICIARY_WEIGHT,gl as TRANSACTION_HEADER_BYTES,pE as ThreeSpeakIntegration,Ha as accountNameByteLength,si as addDraft,ni as addImage,tS as addOptimisticDiscussionEntry,ci as addSchedule,Nf as applySupportSettingsUpdate,Qp as applyVoteCacheUpdate,ae as bridgeApiCall,go as broadcastJson,ee as broadcastOperations,po as broadcastOperationsAsync,Jr as buildAccountCreateOp,Nc as buildAccountUpdate2Op,Kc as buildAccountUpdateOp,Vc as buildActiveCustomJsonOp,en as buildBoostPlusOp,Go as buildCancelTransferFromSavingsOp,Mc as buildChangeRecoveryAccountOp,Xr as buildClaimAccountOp,mt as buildClaimInterestOps,zr as buildClaimRewardBalanceOp,Fr as buildCollateralizedConvertOp,He as buildCommentOp,Ue as buildCommentOptionsOp,nn as buildCommunityRegistrationOp,wt as buildConvertOp,Yr as buildCreateClaimedAccountOp,Dr as buildDelegateRcOp,ht as buildDelegateVestingSharesOp,Tr as buildDeleteCommentOp,Ir as buildEngineClaimOp,Le as buildEngineOp,Ic as buildFlagPostOp,Kr as buildFollowOp,Zr as buildGrantPostingPermissionOp,Cc as buildIgnoreOp,Gr as buildLimitOrderCancelOp,Wt as buildLimitOrderCreateOp,Dc as buildLimitOrderCreateOpWithType,Uc as buildMultiPointTransferOps,Ec as buildMultiTransferOps,Wr as buildMutePostOp,Fc as buildMuteUserOp,$r as buildPinPostOp,et as buildPointTransferOp,jc as buildPostingCustomJsonOp,Oo as buildPostingJsonMetadata,Er as buildProfileMetadata,rn as buildPromoteOp,Qr as buildProposalCreateOp,Hr as buildProposalVoteOp,tn as buildRcDelegationOp,qr as buildReblogOp,Hc as buildRecoverAccountOp,kc as buildRecurrentTransferOp,Tc as buildRemoveProposalOp,Qc as buildRequestAccountRecoveryOp,Xo as buildRevokeKeysOp,Bc as buildRevokePostingPermissionOp,rN as buildSearchQuery,Nr as buildSetLastReadOps,jr as buildSetRoleOp,_t as buildSetWithdrawVestingRouteOp,Ur as buildSubscribeOp,je as buildTransferFromSavingsOp,Ve as buildTransferOp,Ze as buildTransferToSavingsOp,gt as buildTransferToVestingOp,Lt as buildUnfollowOp,Rc as buildUnignoreOp,Vr as buildUnsubscribeOp,Lr as buildUpdateCommunityOp,qc as buildUpdateProposalOp,Rr as buildVoteOp,yt as buildWithdrawVestingOp,Mr as buildWitnessProxyOp,Br as buildWitnessVoteOp,ql as buyStreakFreezeRequest,Mt as calculateRCMana,Or as calculateVPMana,te as callREST,y as callRPC,Ge as callRPCBroadcast,Nt as callWithQuorum,AA as canRevokeFromAuthority,b_ as checkFavoriteQueryOptions,Yh as checkUsernameWalletsPendingQueryOptions,df as claimPointsRequest,yn as collectRequestedOperations,pn as computeResourceCost,ln as countCommentResourceUsage,yi as countVoteResourceUsage,dy as decodeObj,Yc as dedupeAndSortKeyAuths,ui as deleteDraft,ii as deleteImage,pi as deleteSchedule,WA as downVotingPower,lk as earnsQuestContentCredit,ly as encodeObj,$S as enforceThreeSpeakBeneficiary,BE as estimateCommentRcCost,dn as estimateCommentTransactionBytes,zE as estimateRcPrecheck,gi as estimateVoteTransactionBytes,Po as extractAccountProfile,ca as formatError,ot as formattedNumber,Ol as gameClaimRequest,UR as getAccountDelegationsQueryOptions,B as getAccountFullQueryOptions,wC as getAccountNotificationsInfiniteQueryOptions,C_ as getAccountPendingRecoveryQueryOptions,kr as getAccountPosts,Db as getAccountPostsInfiniteQueryOptions,Kb as getAccountPostsQueryOptions,kE as getAccountRcQueryOptions,O_ as getAccountRecoveriesQueryOptions,D_ as getAccountReputationsQueryOptions,s_ as getAccountSubscriptionsQueryOptions,q0 as getAccountVoteHistoryInfiniteQueryOptions,VI as getAccountWalletAssetInfoQueryOptions,yh as getAccountsQueryOptions,G0 as getAggregatedBalanceQueryOptions,By as getAiAssistPriceQueryOptions,Iy as getAiGeneratePriceQueryOptions,Uy as getAiTranscribePriceQueryOptions,Ii as getAllHiveEngineTokensQueryOptions,WC as getAnnouncementsQueryOptions,DB as getBadActorsQueryOptions,V0 as getBalanceHistoryInfiniteQueryOptions,l_ as getBookmarksInfiniteQueryOptions,p_ as getBookmarksQueryOptions,bB as getBoostPlusAccountPricesQueryOptions,oB as getBoostPlusPricesQueryOptions,W_ as getBotsQueryOptions,h as getBoundFetch,fO as getChainPropertiesQueryOptions,eT as getCollateralizedConversionRequestsQueryOptions,vv as getCommentHistoryQueryOptions,_b as getCommunities,Jk as getCommunitiesQueryOptions,Do as getCommunity,tC as getCommunityContextQueryOptions,kC as getCommunityPermissions,sC as getCommunityQueryOptions,fC as getCommunitySubscribersInfiniteQueryOptions,dC as getCommunitySubscribersQueryOptions,EC as getCommunityType,eM as getContentModerationReason,$w as getContentQueryOptions,Yw as getContentRepliesQueryOptions,fN as getControversialRisingInfiniteQueryOptions,JR as getConversionRequestsQueryOptions,Ci as getCurrencyRate,kF as getCurrencyRates,EF as getCurrencyTokenRate,gF as getCurrentMedianHistoryPriceQueryOptions,yp as getCustomJsonAuthority,xv as getDeletedEntryQueryOptions,cM as getDigestSubscriptionsQueryOptions,Ji as getDigestSubscriptionsRequest,DS as getDiscoverCurationQueryOptions,RS as getDiscoverLeaderboardQueryOptions,Io as getDiscussion,kb as getDiscussionQueryOptions,Mo as getDiscussionsQueryOptions,lv as getDraftsInfiniteQueryOptions,pv as getDraftsQueryOptions,Oe as getDynamicPropsQueryOptions,Kw as getEntryActiveVotesQueryOptions,y_ as getFavoritesInfiniteQueryOptions,g_ as getFavoritesQueryOptions,lF as getFeedHistoryQueryOptions,vh as getFollowCountQueryOptions,Sh as getFollowersQueryOptions,Th as getFollowingQueryOptions,Ew as getFragmentsInfiniteQueryOptions,Xe as getFragmentsQueryOptions,aw as getFriendsInfiniteQueryOptions,yv as getGalleryImagesQueryOptions,ZE as getGameStatusCheckQueryOptions,Ai as getHbdAssetGeneralInfoQueryOptions,gq as getHbdAssetTransactionsQueryOptions,Xt as getHiveAssetGeneralInfoQueryOptions,Oq as getHiveAssetMetricQueryOptions,Zt as getHiveAssetTransactionsQueryOptions,kq as getHiveAssetWithdrawalRoutesQueryOptions,fI as getHiveEngineBalancesWithUsdQueryOptions,Ud as getHiveEngineMetrics,IF as getHiveEngineOpenOrders,qF as getHiveEngineOrderBook,Di as getHiveEngineTokenGeneralInfoQueryOptions,Ti as getHiveEngineTokenMetrics,Ri as getHiveEngineTokenTransactions,GF as getHiveEngineTokenTransactionsQueryOptions,er as getHiveEngineTokensBalances,rr as getHiveEngineTokensBalancesQueryOptions,nt as getHiveEngineTokensMarket,HF as getHiveEngineTokensMarketQueryOptions,tr as getHiveEngineTokensMetadata,Fi as getHiveEngineTokensMetadataQueryOptions,XF as getHiveEngineTokensMetricsQueryOptions,FF as getHiveEngineTradeHistory,qi as getHiveEngineUnclaimedRewards,rI as getHiveEngineUnclaimedRewardsQueryOptions,Zq as getHiveHbdStatsQueryOptions,yE as getHivePoshLinksQueryOptions,Oi as getHivePowerAssetGeneralInfoQueryOptions,bq as getHivePowerAssetTransactionsQueryOptions,qq as getHivePowerDelegatesInfiniteQueryOptions,Nq as getHivePowerDelegatingsQueryOptions,CF as getHivePrice,hv as getImagesInfiniteQueryOptions,gv as getImagesQueryOptions,vT as getIncomingRcQueryOptions,SF as getMarketData,nF as getMarketDataQueryOptions,zq as getMarketHistoryQueryOptions,Lq as getMarketStatisticsQueryOptions,Kh as getMutedUsersQueryOptions,wM as getNewsletterIssuesQueryOptions,es as getNewsletterIssuesRequest,OM as getNewsletterPostsQueryOptions,ts as getNewsletterPostsRequest,mM as getNewsletterSenderQueryOptions,Zi as getNewsletterSenderRequest,Ad as getNextAccountHistoryPageParam,O0 as getNormalizePostQueryOptions,UO as getNotificationSetting,QO as getNotifications,KC as getNotificationsInfiniteQueryOptions,VC as getNotificationsSettingsQueryOptions,qC as getNotificationsUnreadCountQueryOptions,dT as getOpenOrdersQueryOptions,_p as getOperationAuthority,Hq as getOrderBookQueryOptions,hT as getOutgoingRcDelegationsInfiniteQueryOptions,MS as getPageStatsQueryOptions,Ki as getPointsAssetGeneralInfoQueryOptions,TI as getPointsAssetTransactionsQueryOptions,Pt as getPointsQueryOptions,VB as getPollQueryOptions,Pi as getPortfolioQueryOptions,qu as getPost,hb as getPostHeader,rb as getPostHeaderQueryOptions,Ro as getPostQueryOptions,Cv as getPostTipsQueryOptions,Fo as getPostsRanked,jb as getPostsRankedInfiniteQueryOptions,Lb as getPostsRankedQueryOptions,X0 as getProMembersQueryOptions,jt as getProfiles,N0 as getProfilesQueryOptions,yB as getPromotePriceQueryOptions,jO as getPromotedPost,Tw as getPromotedPostsQuery,hp as getProposalAuthority,dR as getProposalQueryOptions,PR as getProposalVotesInfiniteQueryOptions,yR as getProposalsQueryOptions,b as getQueryClient,pk as getQuestCatalogEntry,uk as getQuestsQueryOptions,dB as getRcDelegationActiveQueryOptions,uB as getRcDelegationPricesQueryOptions,FE as getRcResourceParamsQueryOptions,OE as getRcStatsQueryOptions,tv as getRebloggedByQueryOptions,Jb as getReblogsQueryOptions,xT as getReceivedVestingSharesQueryOptions,CT as getRecurrentTransfersQueryOptions,Y_ as getReferralsInfiniteQueryOptions,tw as getReferralsStatsQueryOptions,vb as getRelationshipBetweenAccounts,So as getRelationshipBetweenAccountsQueryOptions,YA as getRequiredAuthority,ky as getRewardFundQueryOptions,AC as getRewardedCommunitiesQueryOptions,oT as getSavingsWithdrawFromQueryOptions,sv as getSchedulesInfiniteQueryOptions,iv as getSchedulesQueryOptions,RN as getSearchAccountQueryOptions,Wh as getSearchAccountsByUsernameQueryOptions,HN as getSearchApiInfiniteQueryOptions,dw as getSearchFriendsQueryOptions,LN as getSearchPathQueryOptions,DN as getSearchTopicsQueryOptions,Vv as getShortsFeedQueryOptions,ON as getSimilarEntriesQueryOptions,YC as getSpotlightsQueryOptions,bE as getStatsQueryOptions,bb as getSubscribers,wb as getSubscriptions,zN as getSupportSettingsQueryOptions,Ff as getSupportSettingsRequest,aF as getTradeHistoryQueryOptions,V_ as getTransactionsInfiniteQueryOptions,hw as getTrendingTagsQueryOptions,Aw as getTrendingTagsWithStatsQueryOptions,Hw as getUserPostVoteQueryOptions,SR as getUserProposalVotesQueryOptions,$R as getVestingDelegationExpirationsQueryOptions,BR as getVestingDelegationsQueryOptions,Vo as getVisibleFirstLevelThreadItems,g0 as getWavesByAccountQueryOptions,Jv as getWavesByHostQueryOptions,t0 as getWavesByTagQueryOptions,Nv as getWavesFeedQueryOptions,s0 as getWavesFollowingQueryOptions,Bv as getWavesLatestFeedQueryOptions,w0 as getWavesTrendingAuthorsQueryOptions,p0 as getWavesTrendingTagsQueryOptions,uT as getWithdrawRoutesQueryOptions,LK as getWitnessVoterCountQueryOptions,jK as getWitnessVotersPageQueryOptions,VK as getWitnessesInfiniteQueryOptions,Gi as hasExternalLink,Yp as hasThreeSpeakEmbed,x as hiveTxConfig,ne as hiveTxUtils,TB as hsTokenRenew,S as invalidateAfterBroadcast,ZB as isAuthorMuted,_o as isCommunity,wo as isEmptyDate,am as isHiddenPost,la as isInfoError,um as isLowTrustSeoPost,da as isNetworkError,Ye as isQueryableAccountName,pa as isResourceCreditsError,WS as isThreeSpeakBeneficiary,Mp as isVoteAlreadyReflected,co as isWif,Oa as isWrappedResponse,Yi as leaveDigestRequest,Uh as lookupAccountsQueryOptions,cy as makeQueryClient,BB as mapMetaChoicesToPollChoices,jo as mapThreadItemsToWaveEntries,ri as markNotifications,kl as measureQuestContentLength,li as moveSchedule,Ko as normalizePost,ff as normalizeSearchAuthor,mf as normalizeSearchCategory,gf as normalizeSearchTags,se as normalizeToWrappedResponse,he as normalizeWaveEntryFromApi,LO as onboardEmail,Vt as parseAccounts,k as parseAsset,ze as parseChainError,Qa as parsePostingMetadataRoot,Qe as parseProfileMetadata,Ao as pickRicherMetadataSnapshot,$A as powerRechargeTime,ns as previewNewsletterSendRequest,fn as priceRcUsage,Z0 as proMembersSet,GA as rcPower,di as removeOptimisticDiscussionEntry,Od as resolveAccountHistoryLimit,Hp as resolveContentActivityType,bt as resolveHiveOperationFilters,To as resolvePost,fi as restoreDiscussionSnapshots,nS as restoreEntryInCache,xC as roleMap,HO as saveNotificationSetting,hN as search,_N as searchPath,dN as searchQueryOptions,os as sendNewsletterIssueRequest,Dg as sha256,be as shouldTriggerAuthFallback,NO as signUp,Li as similar,Fu as sortDiscussions,mn as stringFieldBytes,zi as subscribeDigestRequest,BO as subscribeEmail,Zu as toEntryArray,Xi as unsubscribeAllDigestsRequest,ai as updateDraft,rS as updateEntryInCache,Kf as updateSupportSettingsRequest,oi as uploadImage,VO as uploadImageWithSignature,WP as useAccountFavoriteAdd,XP as useAccountFavoriteDelete,pP as useAccountRelationsUpdate,CA as useAccountRevokeKey,mA as useAccountRevokePosting,iP as useAccountUpdate,Yo as useAccountUpdateKeyAuths,uA as useAccountUpdatePassword,vA as useAccountUpdateRecovery,JO as useAddDraft,vO as useAddFragment,Ex as useAddImage,dx as useAddSchedule,Jy as useAiAssist,eh as useAiTranscribe,MP as useBookmarkAdd,VP as useBookmarkDelete,OB as useBoostPlus,v as useBroadcastMutation,hk as useBuyStreakFreeze,FA as useClaimAccount,gK as useClaimEngineRewards,jD as useClaimInterest,XK as useClaimPoints,zD as useClaimRewards,Xx as useComment,MD as useConvert,HA as useCreateAccount,dS as useCrossPost,ZD as useDelegateEngineToken,CK as useDelegateRc,iD as useDelegateVestingShares,uS as useDeleteComment,ax as useDeleteDraft,qx as useDeleteImage,hx as useDeleteSchedule,kO as useEditFragment,wK as useEngineMarketOrder,TP as useFollow,ok as useGameClaim,$y as useGenerateImage,NA as useGrantPostingPermission,IM as useLeaveDigest,AF as useLimitOrderCancel,wF as useLimitOrderCreate,oR as useMarkNotificationsRead,Px as useMoveSchedule,Ck as useMutePost,Lk as usePinPost,$B as usePollVote,jM as usePreviewNewsletterIssue,bS as usePromote,IR as useProposalCreate,RR as useProposalVote,kB as useRcDelegation,Gx as useReblog,sn as useRecordActivity,Hk as useRegisterCommunityRewards,IO as useRemoveFragment,LM as useSendNewsletterIssue,Fk as useSetCommunityRole,uR as useSetLastRead,pD as useSetWithdrawVestingRoute,cO as useSignOperationByHivesigner,rO as useSignOperationByKey,iO as useSignOperationByKeychain,aK as useStakeEngineToken,vk as useSubscribeCommunity,CM as useSubscribeDigest,zI as useTransfer,mD as useTransferEngineToken,OD as useTransferFromSavings,eD as useTransferPoint,wD as useTransferToSavings,CD as useTransferToVesting,nK as useUndelegateEngineToken,DP as useUnfollow,lK as useUnstakeEngineToken,MM as useUnsubscribeAllDigests,xk as useUnsubscribeCommunity,Nk as useUpdateCommunity,tx as useUpdateDraft,yS as useUpdateReply,eB as useUpdateSupportSettings,Kx as useUploadImage,Vx as useVote,xK as useWalletOperation,ID as useWithdrawVesting,NK as useWitnessProxy,FK as useWitnessVote,MO as usrActivity,dt as utf8ByteLength,Lp as validatePostCreating,ye as varintByteLength,Co as verifyPostOnAlternateNode,Je as vestsToHp,LA as votingPower,mp as votingRshares,zA as votingValue,Pe as withTimeoutSignal};//# sourceMappingURL=index.mjs.map
10
10
  //# sourceMappingURL=index.mjs.map