1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DZAoxsWU.js","assets/gunKTr2l.js","assets/DGa90K1v.js","assets/DLJxLZQA.js","assets/Du-DjYEF.js","assets/BQWTm55p.js","assets/BGZKU4Fq.js","assets/BYTFuITp.js","assets/fHa0IVTC.js","assets/5c_tYSQe.js","assets/DtHguYvj.js","assets/BLBk0n_O.js","assets/N9GT256q.js","assets/DSWGgoSa.js","assets/PaAtxa10.js","assets/BZLwyJ1H.js","assets/CUtZKy9Q.js","assets/CJnOj61d.js","assets/BRAxK6-H.js","assets/BhCxTHm4.js","assets/CXN_3OtP.js","assets/CxXS7KxG.js","assets/xAW-ZoJl.js","assets/BqTcUC6A.js","assets/D3gC3-_Y.js","assets/C7MpXGd8.js","assets/CEbLJ8id.js","assets/BTVo64SE.css","assets/zIXjkD90.js","assets/DL29eZzt.js","assets/BQh3J5Xe.css","assets/gwNUfnPb.js","assets/CmyOao70.js","assets/Db2_v3Fn.js","assets/CYLL8ej3.js","assets/D_aMFPsQ.js","assets/BBOGjLIy.js","assets/B93k7I6L.js","assets/CilBNMv5.js","assets/CWlyhySx.js","assets/C_MUvUkh.css","assets/CfYS30Vs.js","assets/BCvna6UV.js","assets/ByglmlH2.js","assets/DdFA2lE0.js","assets/SnoNHI7B.js","assets/BXCfW_It.js","assets/C1OpzkNb.js","assets/w7SLEmYX.js","assets/DkM2ggG2.js","assets/DvUMg0N5.js","assets/CcMLhNij.css","assets/C9GU9yEq.js","assets/DuaVU2oW.js","assets/BPMS6bQG.js","assets/D0fDxo6s.js","assets/C5MY0BRS.js","assets/060AigT-.css","assets/CkwyuNYo.js","assets/DMkasUlH.js","assets/BTAPxjyv.js","assets/losQ_JUq.js","assets/BKJqRbS_.js","assets/DENk7zaU.js","assets/COZhFkLV.js","assets/BgQDOppw.js","assets/8oZSu9hu.js","assets/84GeW2HW.css","assets/D-MLrwVt.js","assets/BgAbzXHa.js","assets/Bnki6hQn.js","assets/6nRMVDUL.js","assets/C4MqgHCX.js","assets/BQWvIFJR.js","assets/DLCSQT95.css","assets/MBsSonHP.css","assets/DsDi0opP.js","assets/9My97_3A.css","assets/SM8sScM3.js","assets/B80a1IzW.js","assets/B7Tws4g9.js","assets/DFkPvBEm.js","assets/BhwEU3IG.css","assets/qcbTwwbQ.js","assets/WARtMpjt.js","assets/DrNNhYtl.js","assets/BbLqnI-s.js","assets/ZiNg-pew.css","assets/DNiDb_NN.js","assets/BHRUgokD.css","assets/D6SZqLp9.js","assets/zS0-0J7f.js","assets/DxRZQ9uG.js","assets/xI5Yqauy.js","assets/C1R9nU0-.css","assets/CZs74hLb.js","assets/Bi9H5AcD.js","assets/BJ8pnspE.js","assets/C-Hfn8rm.js","assets/CBhVkFLF.css","assets/BOeiqa5T.css","assets/BuenI6Oz.css","assets/BNz9vWqK.js","assets/8cC3y97d.js","assets/BTpH4lF0.css","assets/BNNALZyI.css","assets/BzeB-qPB.js","assets/B55KmIYx.css","assets/BKoDskQV.js","assets/B1ro2j9I.js","assets/DSABUo8C.js","assets/BEu010Y8.js","assets/D2FCpCWT.js","assets/Dwr5oZEd.js","assets/ykZTjj7_.js","assets/CJMcwoX1.js","assets/xdKAjfXS.js","assets/DgpVCOR3.js","assets/DyKFFc-8.js","assets/C42McmiX.js","assets/BTDeGexP.js","assets/ij3NBMpk.css","assets/BWMCf18O.js","assets/C3aUn8c5.js","assets/DUebDi6X.js","assets/BjRGCTWB.js","assets/D00EDRii.js","assets/TYGE57l9.js","assets/CxN_KSb4.css","assets/mMf60xOV.js","assets/TABFgx0X.css","assets/BfJnw-pn.js","assets/AxFR1lLt.js","assets/C5kG8ccB.js","assets/TaQbV1Hu.js","assets/D9bscKhZ.js","assets/CxQoU3QK.css","assets/o34hWSnY.js","assets/5AqMuiGJ.css","assets/BlhlMdra.js","assets/F6kwbrFM.js","assets/DAaHs7Hd.js","assets/CIPWNpOv.js","assets/DNdkiWaN.js","assets/DQWYzlet.js","assets/BOKr08t9.js","assets/CenY63cF.css","assets/D86-qGjt.js","assets/CsgZTgWV.css","assets/BjbGcmyB.js","assets/D__j0mvS.css","assets/B7X20XLn.js","assets/CR61yq3T.css","assets/DWI8jDBV.js","assets/DKi5d9nw.js","assets/CE3Lm9Gs.css","assets/CJY-ZI4I.js","assets/COGWHuVH.css","assets/C6i5R1My.js","assets/R5iMa_5C.css","assets/C9tnWdE_.js","assets/D4JdgRpd.js","assets/DfZJVdDr.js","assets/CLmZIGv8.js","assets/CfXgHTKx.css","assets/CitECtOd.js","assets/CfDSef7g.js","assets/P2xASnkF.css","assets/34C4xYx6.js","assets/BJIMNbo4.js","assets/BfnnmgGC.js","assets/D09l68Oa.js","assets/SvtD3Az0.css","assets/Cq8n2GbB.js","assets/COZptHT_.js","assets/Bg4ZmLGr.css","assets/CdpMkf8y.js","assets/BbHBRlW-.css"])))=>i.map(i=>d[i]); 2var e,t,n,i,s,r,o,a,l,c,u,d,h,p,v,g,f,m,_,y,w,b,S,E,T,x,C,A,P,k,L,I,D,O,N,M,$,R,F,U,B,q=Object.defineProperty,j=e=>{throw TypeError(e)},W=(e,t,n)=>((e,t,n)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),H=(e,t,n)=>t.has(e)||j("Cannot "+n),V=(e,t,n)=>(H(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>t.has(e)?j("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,i)=>(H(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Y=(e,t,n
2)=>(H(e,t,"access private method"),n),K=(e,t,n,i)=>({set _(i){G(e,t,i,n)},get _(){return V(e,t,i)}});import{k as J,u as Q,r as X,n as Z,l as ee,m as te,p as ne,q as ie,d as se,j as re,v as oe,o as ae,a as le,F as ce,h as ue,x as de,y as he,z as pe,A as ve,w as ge,e as fe,B as me,C as _e,D as ye,E as we,G as be,H as Se,I as Ee,J as Te,K as xe,L as Ce,M as Ae,N as Pe,O as ke,P as Le,Q as Ie,T as De,R as Oe,S as Ne,U as Me,b as $e,V as Re,W as Fe,X as Ue,Y as Be,Z as qe,_ as je,$ as We,a0 as He}from"./DGa90K1v.js";import{g as Ve,S as ze,n as Ge,U as Ye,w as Ke,a as Je,R as Qe,c as Xe,d as Ze,b as et,e as tt,h as nt,f as it,s as st,t as rt,i as ot,j as at,k as lt,I as ct,l as ut,_ as dt,m as ht,o as pt}from"./BYTFuITp.js";import{g as vt,j as gt,u as ft}from"./gunKTr2l.js";import{a as mt}from"./fHa0IVTC.js";import{I as _t}from"./5c_tYSQe.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const yt=new class{constructor(e="claw-mirror-v1"){W(this,"channel"),W(this,"sessionId"),W(this,"_isLeader",!1),W(this,"mode","ALL"),W(this,"listeners",[]),this.channel=new BroadcastChannel(e);const t=localStorage.getItem("claw_mirror_session_id");this.sessionId=t||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),t||localStorage.setItem("claw_mirror_session_id",this.sessionId)}get isLeader(){return this._isLeader}setLeader(e){this._isLeader=!!e,localStorage.setItem("claw_mirror_is_leader",String(this._isLeader))}setMode(e){this.mode=e,localStorage.setItem("claw_mirror_mode",e)}restorePrefs(){const e=localStorage.getItem("claw_mirror_is_leader"),t=localStorage.getItem("claw_mirror_mode");null!=e&&(this._isLeader="true"===e),t&&(this.mode=t)}publish(e,t){if(!this._isLeader)return;const n={sessionId:this.sessionId,ts:Date.now(),fragment:e,payload:t};this.channel.postMessage(n)}publishAny(e,t){const n={sessionId:this.sessionId,ts:Date.now(),fragment:e,payload:t};this.channel.postMessage(n)}subscribe(e){this.listeners.push(e)}start(){this.channel.onmessage=e=>{const t=e.data;if(t&&t.sessionId!==this.sessionId)for(const n of this.listeners)n(t)}}};async function wt(e=document.documentElement){const t=e,n=t.requestFullscreen||t.webkitRequestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen;n&&await n.call(t)}async function bt(){const e=document,t=document.exitFullscreen||e.webkitExitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen;t&&await t.call(document)}function St(e){const t=()=>e(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)}yt.restorePrefs(),yt.start();const Et="2.14.6";var Tt,xt,Ct=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)};let At=class e extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return`@wagmi/core@${Et}`}constructor(t,n={}){var i;super(),Tt.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const s=n.cause instanceof e?n.cause.details:(null==(i=n.cause)?void 0:i.message)?n.cause.message:n.details,r=n.cause instanceof e&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${this.docsBaseUrl}${r}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join("\n"),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(e){return Ct(this,Tt,"m",xt).call(this,this,e)}};Tt=new WeakSet,xt=function e(t,n){return(null==n?void 0:n(t))?t:t.cause?Ct(this,Tt,"m",e).call(this,t.cause,n):t};class Pt extends At{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class kt extends At{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class Lt extends At{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class It extends At{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class Dt extends At{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Ot extends At{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}let Nt=!1;class Mt extends At{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}const $t=/(rabby|trustwallet)/;function Rt(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function i(){const t=e.target;if("function"==typeof t){const e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...Ft[t]??{id:t,name:`${t[0].toUpperCase()}${t.slice(1)}`,provider:`is${t[0].toUpperCase()}${t.slice(1)}`}}:{id:"injected",name:"Injected",provider:e=>null==e?void 0:e.ethereum}}let s,r,o,a;return l=>({get icon(){return i().icon},get id(){return i().id},get name(){return i().name},get supportsSimulation(){return $t.test(this.id.toLowerCase())},type:Rt.type,async setup(){const t=await this.getProvider();(null==t?void 0:t.on)&&e.target&&(o||(o=this.onConnect.bind(this),t.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),t.on("accountsChanged",s)))},async connect({chainId:n,isReconnecting:i}={}){var c,u,d,h,p,v;const g=await this.getProvider();if(!g)throw new Mt;let f=[];if(i)f=await this.getAccounts().catch(()=>[]);else if(t)try{f=null==(h=null==(d=null==(u=null==(c=(await g.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])?void 0:c.caveats)?void 0:u[0])?void 0:d.value)?void 0:h.map(e=>Ve(e)),f.length>0&&(f=await this.getAccounts())}catch(m){const e=m;if(e.code===Ye.code)throw new Ye(e);if(e.code===Qe.code)throw e}try{(null==f?void 0:f.length)||i||(f=(await g.request({method:"eth_requestAccounts"})).map(e=>Ve(e))),o&&(g.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),g.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),g.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),g.on("disconnect",a));let c=await this.getChainId();if(n&&c!==n){const e=await this.switchChain({chainId:n}).catch(e=>{if(e.code===Ye.code)throw e;return{id:c}});c=(null==e?void 0:e.id)??c}return t&&await(null==(p=l.storage)?void 0:p.removeItem(`${this.id}.disconnected`)),e.target||await(null==(v=l.storage)?void 0:v.setItem("injected.connected",!0)),{accounts:f,chainId:c}}catch(m){const e=m;if(e.code===Ye.code)throw new Ye(e);if(e.code===Qe.code)throw new Qe(e);throw e}},async disconnect(){var n,i;const s=await this.getProvider();if(!s)throw new Mt;r&&(s.removeListener("chainChanged",r),r=void 0),a&&(s.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),s.on("connect",o));try{await Je(()=>s.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await(null==(n=l.storage)?void 0:n.setItem(`${this.id}.disconnected`,!0)),e.target||await(null==(i=l.storage)?void 0:i.removeItem("injected.connected"))},async getAccounts(){const e=await this.getProvider();if(!e)throw new Mt;return(await e.request({method:"eth_accounts"})).map(e=>Ve(e))},async getChainId(){const e=await this.getProvider();if(!e)throw new Mt;const t=await e.request({method:"eth_chainId"});return Number(t)}
2,async getProvider(){if("undefined"==typeof window)return;let e;const t=i();return e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?Ut(window,t.provider):t.provider,e&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e},async isAuthorized(){var i,s;try{if(t&&await(null==(i=l.storage)?void 0:i.getItem(`${this.id}.disconnected`)))return!1;if(!e.target&&!(await(null==(s=l.storage)?void 0:s.getItem("injected.connected"))))return!1;if(!(await this.getProvider())){if(void 0!==n&&!1!==n){const e=async()=>("undefined"!=typeof window&&window.removeEventListener("ethereum#initialized",e),!!(await this.getProvider())),t="number"==typeof n?n:1e3;if(await Promise.race([..."undefined"!=typeof window?[new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0}))]:[],new Promise(n=>setTimeout(()=>n(e()),t))]))return!0}throw new Mt}return!!(await Ke(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){var n,i,s,r;const o=await this.getProvider();if(!o)throw new Mt;const a=l.chains.find(e=>e.id===t);if(!a)throw new ze(new Pt);const c=new Promise(e=>{const n=i=>{"chainId"in i&&i.chainId===t&&(l.emitter.off("change",n),e())};l.emitter.on("change",n)});try{return await Promise.all([o.request({method:"wallet_switchEthereumChain",params:[{chainId:Ge(t)}]}).then(async()=>{await this.getChainId()===t&&l.emitter.emit("change",{chainId:t})}),c]),a}catch(u){const h=u;if(4902===h.code||4902===(null==(i=null==(n=null==h?void 0:h.data)?void 0:n.originalError)?void 0:i.code))try{const{default:n,...i}=a.blockExplorers??{};let u,d;(null==e?void 0:e.blockExplorerUrls)?u=e.blockExplorerUrls:n&&(u=[n.url,...Object.values(i).map(e=>e.url)]),d=(null==(s=null==e?void 0:e.rpcUrls)?void 0:s.length)?e.rpcUrls:[(null==(r=a.rpcUrls.default)?void 0:r.http[0])??""];const h={blockExplorerUrls:u,chainId:Ge(t),chainName:(null==e?void 0:e.chainName)??a.name,iconUrls:null==e?void 0:e.iconUrls,nativeCurrency:(null==e?void 0:e.nativeCurrency)??a.nativeCurrency,rpcUrls:d};return await Promise.all([o.request({method:"wallet_addEthereumChain",params:[h]}).then(async()=>{if(await this.getChainId()!==t)throw new Ye(new Error("User rejected switch after adding network."));l.emitter.emit("change",{chainId:t})}),c]),a}catch(d){throw new Ye(d)}if(h.code===Ye.code)throw new Ye(h);throw new ze(h)}},async onAccountsChanged(e){var n;if(0===e.length)this.onDisconnect();else if(l.emitter.listenerCount("connect")){const e=(await this.getChainId()).toString();this.onConnect({chainId:e}),t&&await(null==(n=l.storage)?void 0:n.removeItem(`${this.id}.disconnected`))}else l.emitter.emit("change",{accounts:e.map(e=>Ve(e))})},onChainChanged(e){const t=Number(e);l.emitter.emit("change",{chainId:t})},async onConnect(e){const t=await this.getAccounts();if(0===t.length)return;const n=Number(e.chainId);l.emitter.emit("connect",{accounts:t,chainId:n});const i=await this.getProvider();i&&(o&&(i.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),i.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),i.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),i.on("disconnect",a)))},async onDisconnect(e){const t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(l.emitter.emit("disconnect"),t&&(r&&(t.removeListener("chainChanged",r),r=void 0),a&&(t.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),t.on("connect",o))))}})}Rt.type="injected";const Ft={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>(null==e?void 0:e.coinbaseWalletExtension)?e.coinbaseWalletExtension:Ut(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>Ut(e,e=>{if(!e.isMetaMask)return!1;if(e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0})}
2,phantom:{id:"phantom",name:"Phantom",provider(e){var t,n;return(null==(t=null==e?void 0:e.phantom)?void 0:t.ethereum)?null==(n=e.phantom)?void 0:n.ethereum:Ut(e,"isPhantom")}}};function Ut(e,t){function n(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}const i=e.ethereum;return(null==i?void 0:i.providers)?i.providers.find(e=>n(e)):i&&n(i)?i:void 0}function Bt(){const e=new Set;let t=[];const n=()=>function(){if("undefined"==typeof window)return;const n=n=>{return i=n.detail,void(t.some(({info:e})=>e.uuid===i.info.uuid)||(t=[...t,i],e.forEach(e=>e(t,{added:[i]}))));var i};return window.addEventListener("eip6963:announceProvider",n),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",n)}();let i=n();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),null==i||i()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),null==i||i(),i=n()},subscribe:(n,{emitImmediately:i}={})=>(e.add(n),i&&n(t,{added:t}),()=>e.delete(n))}}function qt(e,t){let n;try{n=e()}catch(i){return}return{getItem:e=>{var t;const i=e=>null===e?null:JSON.parse(e,void 0),s=null!=(t=n.getItem(e))?t:null;return s instanceof Promise?s.then(i):i(s)},setItem:(e,t)=>n.setItem(e,JSON.stringify(t,void 0)),removeItem:e=>n.removeItem(e)}}const jt=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>jt(e)(n),catch(e){return this}}}catch(n){return{then(e){return this},catch:e=>jt(e)(n)}}},Wt=e=>{let t;const n=new Set,i=(e,i)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=i?i:"object"!=typeof s||null===s)?s:Object.assign({},t,s),n.forEach(n=>n(t,e))}},s=()=>t,r={setState:i,getState:s,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(i,s,r);return r},Ht=e=>e?Wt(e):Wt;var Vt={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new s(i,r||e,o),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,i,s=[];if(0===this._eventsCount)return s;for(i in e=this._events)t.call(e,i)&&s.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,r=i.length,o=new Array(r);s<r;s++)o[s]=i[s].fn;return o},a.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,s,r,o){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,s),!0;case 5:return u.fn.call(u.context,t,i,s,r),!0;case 6:return u.fn.call(u.context,t,i,s,r,o),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,s);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,s){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return o(this,r),this;var a=this._events[r];if(a.fn)a.fn!==t||s&&!a.once||i&&a.context!==i||o(this,r);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||s&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[r]=1===c.length?c[0]:c:o(this,r)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(Vt);var zt=Vt.exports;const Gt=vt(zt);
2class Yt{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Gt})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){const n=t[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function Kt(e,t){return JSON.parse(e,(e,n)=>{let i=n;return"bigint"===(null==i?void 0:i.__type)&&(i=BigInt(i.value)),"Map"===(null==i?void 0:i.__type)&&(i=new Map(i.value)),(null==t?void 0:t(e,i))??i})}function Jt(e,t){return e.slice(0,t).join(".")||"."}function Qt(e,t){const{length:n}=e;for(let i=0;i<n;++i)if(e[i]===t)return i+1;return 0}function Xt(e,t,n,i){return JSON.stringify(e,function(e,t){const n="function"==typeof t,i=[],s=[];return function(r,o){if("object"==typeof o)if(i.length){const e=Qt(i,this);0===e?i[i.length]=this:(i.splice(e),s.splice(e)),s[s.length]=r;const a=Qt(i,o);if(0!==a)return n?t.call(this,r,o,Jt(s,a)):`[ref=${Jt(s,a)}]`}else i[0]=o,s[0]=r;return e.call(this,r,o)}}((e,n)=>{let i=n;return"bigint"==typeof i&&(i={__type:"bigint",value:n.toString()}),i instanceof Map&&(i={__type:"Map",value:Array.from(n.entries())}),(null==t?void 0:t(e,i))??i},i),n??void 0)}function Zt(e){const{deserialize:t=Kt,key:n="wagmi",serialize:i=Xt,storage:s=en}=e;function r(e){return e instanceof Promise?e.then(e=>e).catch(()=>null):e}return{...s,key:n,async getItem(e,i){const o=s.getItem(`${n}.${e}`),a=await r(o);return a?t(a)??null:i??null},async setItem(e,t){const o=`${n}.${e}`;null===t?await r(s.removeItem(o)):await r(s.setItem(o,i(t)))},async removeItem(e){await r(s.removeItem(`${n}.${e}`))}}}const en={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};let tn,nn=256;function sn(e){var t,n,i;const{chain:s}=e,r=s.rpcUrls.default.http[0];if(!e.transports)return[r];const o=null==(n=null==(t=e.transports)?void 0:t[s.id])?void 0:n.call(t,{chain:s});return((null==(i=null==o?void 0:o.value)?void 0:i.transports)||[o]).map(({value:e})=>(null==e?void 0:e.url)||r)}const rn=Symbol(),on={install(e,t){const{config:n,reconnectOnMount:i=!0}=t;e.provide(rn,n);const{onMount:s}=function(e,t){const{initialState:n,reconnectOnMount:i}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(e=>e.id===n.chainId)?n.chainId:e.chains[0].id,connections:i?n.connections:new Map,status:i?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(t=>{var n;const i=new Set;for(const e of t??[])if(e.rdns){const t=Array.isArray(e.rdns)?e.rdns:[e.rdns];for(const e of t)i.add(e)}const s=[],r=(null==(n=e._internal.mipd)?void 0:n.getProviders())??[];for(const o of r){if(i.has(o.info.rdns))continue;const t=e._internal.connectors.providerDetailToConnector(o),n=e._internal.connectors.setup(t);s.push(n)}return[...t,...s]})),i?async function(e,t={}){var n,i;if(Nt)return[];Nt=!0,e.setState(e=>({...e,status:e.current?"reconnecting":"connecting"}));const s=[];if(null==(n=t.connectors)?void 0:n.length)for(const d of t.connectors){let t;t="function"==typeof d?e._internal.connectors.setup(d):d,s.push(t)}else s.push(...e.connectors);let r;try{r=await(null==(i=e.storage)?void 0:i.getItem("recentConnectorId"))}catch{}const o={};for(const[,d]of e.state.connections)o[d.connector.id]=1;r&&(o[r]=0);const a=Object.keys(o).length>0?[...s].sort((e,t)=>(o[e.id]??10)-(o[t.id]??10)):s;let l=!1;const c=[],u=[];for(const d of a){const t=await d.getProvider().catch(()=>{});if(!t)continue;if(u.some(e=>e===t))continue;if(!(await d.isAuthorized()))continue;const n=await d.connect({isReconnecting:!0}).catch(()=>null);n&&(d.emitter.off("connect",e._internal.events.connect),d.emitter.on("change",e._internal.events.change),d.emitter.on("disconnect",e._internal.events.disconnect),e.setState(e=>{const t=new Map(l?e.connections:new Map).set(d.uid,{accounts:n.accounts,chainId:n.chainId,connector:d});return{...e,current:l?e.current:d.uid,connections:t}}),c.push({accounts:n.accounts,chainId:n.chainId,connector:d}),u.push(t),l=!0)}"reconnecting"!==e.state.status&&"connecting"!==e.state.status||(l?e.setState(e=>({...e,status:"connected"})):e.setState(e=>({...e,connections:new Map,current:null,status:"disconnected"}))),Nt=!1}(e):e.storage&&e.setState(e=>({...e,connections:new Map}))}}}(n,{...t,reconnectOnMount:i});s()}};var an=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ln="undefined"==typeof window||"Deno"in globalThis;function cn(){}function un(e){return"number"==typeof e&&e>=0&&e!==1/0}function dn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hn(e,t){return"function"==typeof e?e(t):e}function pn(e,t){return"function"==typeof e?e(t):e}function vn(e,t){const{type:n="all",exact:i,fetchStatus:s,predicate:r,queryKey:o,stale:a}=e;if(o)if(i){if(t.queryHash!==fn(o,t.options))return!1}else if(!_n(t.queryKey,o))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||s&&s!==t.state.fetchStatus||r&&!r(t))}function gn(e,t){const{exact:n,status:i,predicate:s,mutationKey:r}=e;if(r){if(!t.options.mutationKey)return!1;if(n){if(mn(t.options.mutationKey)!==mn(r))return!1}else if(!_n(t.options.mutationKey,r))return!1}return!(i&&t.state.status!==i||s&&!s(t))}function fn(e,t){return((null==t?void 0:t.queryKeyHashFn)||mn)(e)}function mn(e){return JSON.stringify(e,(e,t)=>Sn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function _n(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>_n(e[n],t[n]))}function yn(e,t){if(e===t)return e;const n=bn(e)&&bn(t);if(n||Sn(e)&&Sn(t)){const i=n?e:Object.keys(e),s=i.length,r=n?t:Object.keys(t),o=r.length,a=n?[]:{},l=new Set(i);let c=0;for(let u=0;u<o;u++){const i=n?u:r[u];(!n&&l.has(i)||n)&&void 0===e[i]&&void 0===t[i]?(a[i]=void 0,c++):(a[i]=yn(e[i],t[i]),a[i]===e[i]&&void 0!==e[i]&&c++)}return s===o&&c===s?e:a}return t}function wn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sn(e){if(!En(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!En(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function En(e){return"[object Object]"===Object.prototype.toString.call(e)}
2function Tn(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?yn(e,t):t}function xn(e,t,n=0){const i=[...e,t];return n&&i.length>n?i.slice(1):i}function Cn(e,t,n=0){const i=[t,...e];return n&&i.length>n?i.slice(0,-1):i}var An=Symbol();function Pn(e,t){return!e.queryFn&&(null==t?void 0:t.initialPromise)?()=>t.initialPromise:e.queryFn&&e.queryFn!==An?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function kn(e,t){return"function"==typeof e?e(...t):!!e}var Ln=new(i=class extends an{constructor(){super(),z(this,e),z(this,t),z(this,n),G(this,n,e=>{if(!ln&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){V(this,t)||this.setEventListener(V(this,n))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=V(this,t))||e.call(this),G(this,t,void 0))}setEventListener(e){var i;G(this,n,e),null==(i=V(this,t))||i.call(this),G(this,t,e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(t){V(this,e)!==t&&(G(this,e,t),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var t;return"boolean"==typeof V(this,e)?V(this,e):"hidden"!==(null==(t=globalThis.document)?void 0:t.visibilityState)}},e=new WeakMap,t=new WeakMap,n=new WeakMap,i),In=new(a=class extends an{constructor(){super(),z(this,s,!0),z(this,r),z(this,o),G(this,o,e=>{if(!ln&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}})}onSubscribe(){V(this,r)||this.setEventListener(V(this,o))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=V(this,r))||e.call(this),G(this,r,void 0))}setEventListener(e){var t;G(this,o,e),null==(t=V(this,r))||t.call(this),G(this,r,e(this.setOnline.bind(this)))}setOnline(e){V(this,s)!==e&&(G(this,s,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return V(this,s)}},s=new WeakMap,r=new WeakMap,o=new WeakMap,a);function Dn(){let e,t;const n=new Promise((n,i)=>{e=n,t=i});function i(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},n.reject=e=>{i({status:"rejected",reason:e}),t(e)},n}function On(e){return Math.min(1e3*2**e,3e4)}function Nn(e){return"online"!==(e??"online")||In.isOnline()}var Mn=class extends Error{constructor(e){super("CancelledError"),this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent}};function $n(e){return e instanceof Mn}function Rn(e){let t,n=!1,i=0,s=!1;const r=Dn(),o=()=>Ln.isFocused()&&("always"===e.networkMode||In.isOnline())&&e.canRun(),a=()=>Nn(e.networkMode)&&e.canRun(),l=n=>{var i;s||(s=!0,null==(i=e.onSuccess)||i.call(e,n),null==t||t(),r.resolve(n))},c=n=>{var i;s||(s=!0,null==(i=e.onError)||i.call(e,n),null==t||t(),r.reject(n))},u=()=>new Promise(n=>{var i;t=e=>{(s||o())&&n(e)},null==(i=e.onPause)||i.call(e)}).then(()=>{var n;t=void 0,s||null==(n=e.onContinue)||n.call(e)}),d=()=>{if(s)return;let t;const r=0===i?e.initialPromise:void 0;try{t=r??e.fn()}catch(a){t=Promise.reject(a)}Promise.resolve(t).then(l).catch(t=>{var r;if(s)return;const a=e.retry??(ln?0:3),l=e.retryDelay??On,h="function"==typeof l?l(i,t):l,p=!0===a||"number"==typeof a&&i<a||"function"==typeof a&&a(i,t);var v;!n&&p?(i++,null==(r=e.onFail)||r.call(e,i,t),(v=h,new Promise(e=>{setTimeout(e,v)})).then(()=>o()?void 0:u()).then(()=>{n?c(t):d()})):c(t)})};return{promise:r,cancel:t=>{var n;s||(c(new Mn(t)),null==(n=e.abort)||n.call(e))},continue:()=>(null==t||t(),r),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:a,start:()=>(a()?d():u().then(d),r)}}var Fn=e=>setTimeout(e,0),Un=function(){let e=[],t=0,n=e=>{e()},i=e=>{e()},s=Fn;const r=i=>{t?e.push(i):s(()=>{n(i)})};return{batch:r=>{let o;t++;try{o=r()}finally{t--,t||(()=>{const t=e;e=[],t.length&&s(()=>{i(()=>{t.forEach(e=>{n(e)})})})})()}return o},batchCalls:e=>(...t)=>{r(()=>{e(...t)})},schedule:r,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{s=e}}}(),Bn=(c=class{constructor(){z(this,l)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),un(this.gcTime)&&G(this,l,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ln?1/0:3e5))}clearGcTimeout(){V(this,l)&&(clearTimeout(V(this,l)),G(this,l,void 0))}},l=new WeakMap,c),qn=(y=class extends Bn{constructor(e){super(),z(this,m),z(this,u),z(this,d),z(this,h),z(this,p),z(this,v),z(this,g),z(this,f),G(this,f,!1),G(this,g,e.defaultOptions),this.setOptions(e.options),this.observers=[],G(this,p,e.client),G(this,h,V(this,p).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,G(this,u,function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,i=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdate
2Count:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options)),this.state=e.state??V(this,u),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return null==(e=V(this,v))?void 0:e.promise}setOptions(e){this.options={...V(this,g),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||V(this,h).remove(this)}setData(e,t){const n=Tn(this.state.data,e,this.options);return Y(this,m,_).call(this,{data:n,type:"success",dataUpdatedAt:null==t?void 0:t.updatedAt,manual:null==t?void 0:t.manual}),n}setState(e,t){Y(this,m,_).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var t,n;const i=null==(t=V(this,v))?void 0:t.promise;return null==(n=V(this,v))||n.cancel(e),i?i.then(cn).catch(cn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(V(this,u))}isActive(){return this.observers.some(e=>!1!==pn(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===An||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===hn(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!dn(this.state.dataUpdatedAt,e))}onFocus(){var e;const t=this.observers.find(e=>e.shouldFetchOnWindowFocus());null==t||t.refetch({cancelRefetch:!1}),null==(e=V(this,v))||e.continue()}onOnline(){var e;const t=this.observers.find(e=>e.shouldFetchOnReconnect());null==t||t.refetch({cancelRefetch:!1}),null==(e=V(this,v))||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),V(this,h).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(V(this,v)&&(V(this,f)?V(this,v).cancel({revert:!0}):V(this,v).cancelRetry()),this.scheduleGc()),V(this,h).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Y(this,m,_).call(this,{type:"invalidate"})}fetch(e,t){var n,i,s;if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&(null==t?void 0:t.cancelRefetch))this.cancel({silent:!0});else if(V(this,v))return V(this,v).continueRetry(),V(this,v).promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,o=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(G(this,f,!0),r.signal)})},a=()=>{const e=Pn(this.options,t),n=(()=>{const e={client:V(this,p),queryKey:this.queryKey,meta:this.meta};return o(e),e})();return G(this,f,!1),this.options.persister?this.options.persister(e,n,this):e(n)},l=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:V(this,p),state:this.state,fetchFn:a};return o(e),e})();null==(n=this.options.behavior)||n.onFetch(l,this),G(this,d,this.state),"idle"!==this.state.fetchStatus&&this.state.fetchMeta===(null==(i=l.fetchOptions)?void 0:i.meta)||Y(this,m,_).call(this,{type:"fetch",meta:null==(s=l.fetchOptions)?void 0:s.meta});const c=e=>{var t,n,i,s;$n(e)&&e.silent||Y(this,m,_).call(this,{type:"error",error:e}),$n(e)||(null==(n=(t=V(this,h).config).onError)||n.call(t,e,this),null==(s=(i=V(this,h).config).onSettled)||s.call(i,this.state.data,e,this)),this.scheduleGc()};return G(this,v,Rn({initialPromise:null==t?void 0:t.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{var t,n,i,s;if(void 0!==e){try{this.setData(e)}catch(r){return void c(r)}null==(n=(t=V(this,h).config).onSuccess)||n.call(t,e,this),null==(s=(i=V(this,h).config).onSettled)||s.call(i,e,this.state.error,this),this.scheduleGc()}else c(new Error(`${this.queryHash} data is undefined`))},onError:c,onFail:(e,t)=>{Y(this,m,_).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{Y(this,m,_).call(this,{type:"pause"})},onContinue:()=>{Y(this,m,_).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),V(this,v).start()}},u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,f=new WeakMap,m=new WeakSet,_=function(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...jn(t.data,this.options),fetchMeta:e.meta??null};case"success":return G(this,d,void 0),{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return $n(n)&&n.revert&&V(this,d)?{...V(this,d),fetchStatus:"idle"}
2:{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Un.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),V(this,h).notify({query:this,type:"updated",action:e})})},y);function jn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Nn(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var Wn=(b=class extends an{constructor(e={}){super(),z(this,w),this.config=e,G(this,w,new Map)}build(e,t,n){const i=t.queryKey,s=t.queryHash??fn(i,t);let r=this.get(s);return r||(r=new qn({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(r)),r}add(e){V(this,w).has(e.queryHash)||(V(this,w).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=V(this,w).get(e.queryHash);t&&(e.destroy(),t===e&&V(this,w).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Un.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return V(this,w).get(e)}getAll(){return[...V(this,w).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>vn(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>vn(e,t)):t}notify(e){Un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},w=new WeakMap,b),Hn=(A=class extends Bn{constructor(e){super(),z(this,x),z(this,S),z(this,E),z(this,T),this.mutationId=e.mutationId,G(this,E,e.mutationCache),G(this,S,[]),this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){V(this,S).includes(e)||(V(this,S).push(e),this.clearGcTimeout(),V(this,E).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){G(this,S,V(this,S).filter(t=>t!==e)),this.scheduleGc(),V(this,E).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){V(this,S).length||("pending"===this.state.status?this.scheduleGc():V(this,E).remove(this))}continue(){var e;return(null==(e=V(this,T))?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var t,n,i,s,r,o,a,l,c,u,d,h,p,v,g,f,m,_,y,w;const b=()=>{Y(this,x,C).call(this,{type:"continue"})};G(this,T,Rn({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{Y(this,x,C).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{Y(this,x,C).call(this,{type:"pause"})},onContinue:b,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>V(this,E).canRun(this)}));const S="pending"===this.state.status,A=!V(this,T).canStart();try{if(S)b();else{Y(this,x,C).call(this,{type:"pending",variables:e,isPaused:A}),await(null==(n=(t=V(this,E).config).onMutate)?void 0:n.call(t,e,this));const r=await(null==(s=(i=this.options).onMutate)?void 0:s.call(i,e));r!==this.state.context&&Y(this,x,C).call(this,{type:"pending",context:r,variables:e,isPaused:A})}const p=await V(this,T).start();return await(null==(o=(r=V(this,E).config).onSuccess)?void 0:o.call(r,p,e,this.state.context,this)),await(null==(l=(a=this.options).onSuccess)?void 0:l.call(a,p,e,this.state.context)),await(null==(u=(c=V(this,E).config).onSettled)?void 0:u.call(c,p,null,this.state.variables,this.state.context,this)),await(null==(h=(d=this.options).onSettled)?void 0:h.call(d,p,null,e,this.state.context)),Y(this,x,C).call(this,{type:"success",data:p}),p}catch(P){try{throw await(null==(v=(p=V(this,E).config).onError)?void 0:v.call(p,P,e,this.state.context,this)),await(null==(f=(g=this.options).onError)?void 0:f.call(g,P,e,this.state.context)),await(null==(_=(m=V(this,E).config).onSettled)?void 0:_.call(m,void 0,P,this.state.variables,this.state.context,this)),await(null==(w=(y=this.options).onSettled)?void 0:w.call(y,void 0,P,e,this.state.context)),P}finally{Y(this,x,C).call(this,{type:"error",error:P})}}finally{V(this,E).runNext(this)}}},S=new WeakMap,E=new WeakMap,T=new WeakMap,x=new WeakSet,C=function(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};
2case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Un.batch(()=>{V(this,S).forEach(t=>{t.onMutationUpdate(e)}),V(this,E).notify({mutation:this,type:"updated",action:e})})},A);function Vn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zn=(I=class extends an{constructor(e={}){super(),z(this,P),z(this,k),z(this,L),this.config=e,G(this,P,new Set),G(this,k,new Map),G(this,L,0)}build(e,t,n){const i=new Hn({mutationCache:this,mutationId:++K(this,L)._,options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){V(this,P).add(e);const t=Gn(e);if("string"==typeof t){const n=V(this,k).get(t);n?n.push(e):V(this,k).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(V(this,P).delete(e)){const t=Gn(e);if("string"==typeof t){const n=V(this,k).get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&V(this,k).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Gn(e);if("string"==typeof t){const n=V(this,k).get(t),i=null==n?void 0:n.find(e=>"pending"===e.state.status);return!i||i===e}return!0}runNext(e){var t;const n=Gn(e);if("string"==typeof n){const i=null==(t=V(this,k).get(n))?void 0:t.find(t=>
2t!==e&&t.state.isPaused);return(null==i?void 0:i.continue())??Promise.resolve()}return Promise.resolve()}clear(){Un.batch(()=>{V(this,P).forEach(e=>{this.notify({type:"removed",mutation:e})}),V(this,P).clear(),V(this,k).clear()})}getAll(){return Array.from(V(this,P))}find(e){const t={exact:!0,...e};return this.getAll().find(e=>gn(t,e))}findAll(e={}){return this.getAll().filter(t=>gn(e,t))}notify(e){Un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Un.batch(()=>Promise.all(e.map(e=>e.continue().catch(cn))))}},P=new WeakMap,k=new WeakMap,L=new WeakMap,I);function Gn(e){var t;return null==(t=e.options.scope)?void 0:t.id}function Yn(e){return{onFetch:(t,n)=>{var i,s,r,o,a;const l=t.options,c=null==(r=null==(s=null==(i=t.fetchOptions)?void 0:i.meta)?void 0:s.fetchMore)?void 0:r.direction,u=(null==(o=t.state.data)?void 0:o.pages)||[],d=(null==(a=t.state.data)?void 0:a.pageParams)||[];let h={pages:[],pageParams:[]},p=0;const v=async()=>{let n=!1;const i=Pn(t.options,t.fetchOptions),s=async(e,s,r)=>{if(n)return Promise.reject();if(null==s&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:s,direction:r?"backward":"forward",meta:t.options.meta};var i;return i=e,Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)}),e})(),a=await i(o),{maxPages:l}=t.options,c=r?Cn:xn;return{pages:c(e.pages,a,l),pageParams:c(e.pageParams,s,l)}};if(c&&u.length){const e="backward"===c,t={pages:u,pageParams:d},n=(e?Jn:Kn)(l,t);h=await s(t,n,e)}else{const t=e??u.length;do{const e=0===p?d[0]??l.initialPageParam:Kn(l,h);if(p>0&&null==e)break;h=await s(h,e),p++}while(p<t)}return h};t.options.persister?t.fetchFn=()=>{var e,i;return null==(i=(e=t.options).persister)?void 0:i.call(e,v,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=v}}}function Kn(e,{pages:t,pageParams:n}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,n[i],n):void 0}function Jn(e,{pages:t,pageParams:n}){var i;return t.length>0?null==(i=e.getPreviousPageParam)?void 0:i.call(e,t[0],t,n[0],n):void 0}var Qn=(B=class{constructor(e={}){z(this,D),z(this,O),z(this,N),z(this,M),z(this,$),z(this,R),z(this,F),z(this,U),G(this,D,e.queryCache||new Wn),G(this,O,e.mutationCache||new zn),G(this,N,e.defaultOptions||{}),G(this,M,new Map),G(this,$,new Map),G(this,R,0)}mount(){K(this,R)._++,1===V(this,R)&&(G(this,F,Ln.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,D).onFocus())})),G(this,U,In.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,D).onOnline())})))}unmount(){var e,t;K(this,R)._--,0===V(this,R)&&(null==(e=V(this,F))||e.call(this),G(this,F,void 0),null==(t=V(this,U))||t.call(this),G(this,U,void 0))}isFetching(e){return V(this,D).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return V(this,O).findAll({...e,status:"pending"}).length}getQueryData(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null==(t=V(this,D).get(n.queryHash))?void 0:t.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=V(this,D).build(this,t),i=n.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return V(this,D).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const i=this.defaultQueryOptions({queryKey:e}),s=V(this,D).get(i.queryHash),r=function(e,t){return"function"==typeof e?e(t):e}(t,null==s?void 0:s.state.data);if(void 0!==r)return V(this,D).build(this,i).setData(r,{...n,manual:!0})}setQueriesData(e,t,n){return Un.batch(()=>V(this,D).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null==(t=V(this,D).get(n.queryHash))?void 0:t.state}removeQueries(e){const t=V(this,D);Un.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=V(this,D);return Un.batch(()=>
2(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},i=Un.batch(()=>V(this,D).findAll(e).map(e=>e.cancel(n)));return Promise.all(i).then(cn).catch(cn)}invalidateQueries(e,t={}){return Un.batch(()=>(V(this,D).findAll(e).forEach(e=>{e.invalidate()}),"none"===(null==e?void 0:e.refetchType)?Promise.resolve():this.refetchQueries({...e,type:(null==e?void 0:e.refetchType)??(null==e?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},i=Un.batch(()=>V(this,D).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(cn)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(i).then(cn)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=V(this,D).build(this,t);return n.isStaleByTime(hn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(cn).catch(cn)}fetchInfiniteQuery(e){return e.behavior=Yn(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(cn).catch(cn)}ensureInfiniteQueryData(e){return e.behavior=Yn(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return In.isOnline()?V(this,O).resumePausedMutations():Promise.resolve()}getQueryCache(){return V(this,D)}getMutationCache(){return V(this,O)}getDefaultOptions(){return V(this,N)}setDefaultOptions(e){G(this,N,e)}setQueryDefaults(e,t){V(this,M).set(mn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...V(this,M).values()],n={};return t.forEach(t=>{_n(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){V(this,$).set(mn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...V(this,$).values()],n={};return t.forEach(t=>{_n(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...V(this,N).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fn(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===An&&(t.enabled=!1),t}defaultMutationOptions(e){return(null==e?void 0:e._defaulted)?e:{...V(this,N).mutations,...(null==e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){V(this,D).clear(),V(this,O).clear()}},D=new WeakMap,O=new WeakMap,N=new WeakMap,M=new WeakMap,$=new WeakMap,R=new WeakMap,F=new WeakMap,U=new WeakMap,B);function Xn(e){return"VUE_QUERY_CLIENT"+(e?`:${e}`:"")}function Zn(e,t){Object.keys(e).forEach(n=>{e[n]=t[n]})}function ei(e,t,n="",i=0){if(t){const s=t(e,n,i);if(void 0===s&&J(e))return s;if(void 0!==s)return s}if(Array.isArray(e))return e.map((e,n)=>ei(e,t,String(n),i+1));if("object"==typeof e&&function(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e)){const n=Object.entries(e).map(([e,n])=>[e,ei(n,t,e,i+1)]);return Object.fromEntries(n)}return e}function ti(e,t=!1){return ei(e,(e,n,i)=>1===i&&"queryKey"===n?ti(e,!0):t&&"function"==typeof e?ti(e(),t):J(e)?ti(Q(e),t):void 0)}var ni=class extends Wn{find(e){return super.find(ti(e))}findAll(e={}){return super.findAll(ti(e))}},ii=class extends zn{find(e){return super.find(ti(e))}findAll(e={}){return super.findAll(ti(e))}},si=class extends Qn{constructor(e={}){super({defaultOptions:e.defaultOptions,queryCache:e.queryCache||new ni,mutationCache:e.mutationCache||new ii}),this.isRestoring=X(!1)}isFetching(e={}){return super.isFetching(ti(e))}isMutating(e={}){return super.isMutating(ti(e))}getQueryData(e){return super.getQueryData(ti(e))}ensureQueryData(e){return super.ensureQueryData(ti(e))}getQueriesData(e){return super.getQueriesData(ti(e))}setQueryData(e,t,n={}){return super.setQueryData(ti(e),t,ti(n))}setQueriesData(e,t,n={}){return super.setQueriesData(ti(e),t,ti(n))}getQueryState(e){return super.getQueryState(ti(e))}removeQueries(e={}){return super.removeQueries(ti(e))}resetQueries(e={},t={}){return super.resetQueries(ti(e),ti(t))}cancelQueries(e={},t={}){return super.cancelQueries(ti(e),ti(t))}invalidateQueries(e={},t={}){const n=ti(e),i=ti(t);if(super.invalidateQueries({...n,refetchType:"none"},i),"none"===n.refetchType)return Promise.resolve();const s={...n,type:n.refetchType??n.type??"active"};return Z().then(()=>super.refetchQueries(s,i))}refetchQueries(e={},t={}){return super.refetchQueries(ti(e),ti(t))}fetchQuery(e){return super.fetchQuery(ti(e))}prefetchQuery(e){return super.prefetchQuery(ti(e))}fetchInfiniteQuery(e){return super.fetchInfiniteQuery(ti(e))}prefetchInfiniteQuery(e){return super.prefetchInfiniteQuery(ti(e))}setDefaultOptions(e){super.setDefaultOptions(ti(e))}setQueryDefaults(e,t){super.setQueryDefaults(ti(e),ti(t))}getQueryDefaults(e){return super.getQueryDefaults(ti(e))}setMutationDefaults(e,t){super.setMutationDefaults(ti(e),ti(t))}getMutationDefaults(e){return super.getMutationDefaults(ti(e))}},ri={install:(e,t={})=>{const n=Xn(t.queryClientKey);let i;if("queryClient"in t&&t.queryClient)i=t.queryClient;else{const e="queryClientConfig"in t?t.queryClientConfig:void 0;i=new si(e)}ln||i.mount();let s=()=>{};if(t.clientPersister){i.isRestoring&&(i.isRestoring.value=!0);const[e,n]=t.clientPersister(i);s=e,n.then(()=>{var e;i.isRestoring&&(i.isRestoring.value=!1),null==(e=t.clientPersisterOnSuccess)||e.call(t,i)})}const r=()=>{i.unmount(),s()};if(e.onUnmount)e.onUnmount(r);else{const t=e.unmount;e.unmount=function(){r(),t()}}e.provide(n,i)}};const oi={blockTime:2e3,contracts:{gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"}
2,l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters:{block:tt({format(e){var t;return{transactions:null==(t=e.transactions)?void 0:t.map(e=>{if("string"==typeof e)return e;const t=it(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?nt(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}),stateRoot:e.stateRoot}}}),transaction:et({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?nt(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:Ze({format:e=>({l1GasPrice:e.l1GasPrice?nt(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?nt(e.l1GasUsed):null,l1Fee:e.l1Fee?nt(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})},serializers:{transaction:function(e,t){return function(e){return"deposit"===e.type||void 0!==e.sourceHash}(e)?function(e){!function(e){const{from:t,to:n}=e;if(t&&!lt(t))throw new ct({address:t});if(n&&!lt(n))throw new ct({address:n})}(e);const{sourceHash:t,data:n,from:i,gas:s,isSystemTx:r,mint:o,to:a,value:l}=e,c=[t,i,a??"0x",o?rt(o):"0x",l?rt(l):"0x",s?rt(s):"0x",r?"0x1":"0x",n??"0x"];return ot(["0x7e",at(c)])}(e):st(e,t)}}},ai=1,li=ut({...oi,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...oi.contracts,disputeGameFactory:{[ai]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[ai]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[ai]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[ai]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:1});function ci(e={}){return"3"===e.version||e.headlessMode?function(e){let t,n,i,s,r;return o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:ci.type,async connect({chainId:e}={}){try{const t=await this.getProvider(),n=(await t.request({method:"eth_requestAccounts"})).map(e=>Ve(e));i||(i=this.onAccountsChanged.bind(this),t.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),t.on("chainChanged",s)),r||(r=this.onDisconnect.bind(this),t.on("disconnect",r));let o=await this.getChainId();if(e&&o!==e){const t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===Ye.code)throw e;return{id:o}});o=(null==t?void 0:t.id)??o}return{accounts:n,chainId:o}}catch(t){if(/(user closed modal|accounts received is empty|user denied account)/i.test(t.message))throw new Ye(t);throw t}},async disconnect(){const e=await this.getProvider();i&&(e.removeListener("accountsChanged",i),i=void 0),s&&(e.removeListener("chainChanged",s),s=void 0),r&&(e.removeListener("disconnect",r),r=void 0),e.disconnect(),e.close()},async getAccounts(){const e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>Ve(e))},async getChainId(){const e=await this.getProvider(),t=await e.request({method:"eth_chainId"});return Number(t)},async getProvider(){var i;if(!n){const s=await(async()=>{const{default:e}=await dt(async()=>{const{default:e}=await import("./DZAoxsWU.js").then(e=>e.i);return{default:e}},__vite__mapDeps([0,1,2,3,4,5]));return"function"!=typeof e&&"function"==typeof e.default?e.default:e})();t=new s({...e,reloadOnDisconnect:false});const r=null==(i=t.walletExtension)?void 0:i.getChainId(),a=o.chains.find(t=>e.chainId?t.id===e.chainId:t.id===r)||o.chains[0],l=e.chainId||(null==a?void 0:a.id),c=e.jsonRpcUrl||(null==a?void 0:a.rpcUrls.default.http[0]);n=t.makeWeb3Provider(c,l)}return n},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){var n,i,s,r;const a=o.chains.find(e=>e.id===t);if(!a)throw new ze(new Pt);const l=await this.getProvider();try{return await l.request({method:"wallet_switchEthereumChain",params:[{chainId:Ge(a.id)}]}),a}catch(c){if(4902===c.code)try{let o,c;o=(null==e?void 0:e.blockExplorerUrls)?e.blockExplorerUrls:(null==(n=a.blockExplorers)?void 0:n.default.url)?[null==(i=a.blockExplorers)?void 0:i.default.url]:[],c=(null==(s=null==e?void 0:e.rpcUrls)?void 0:s.length)?e.rpcUrls:[(null==(r=a.rpcUrls.default)?void 0:r.http[0])??""];const u={blockExplorerUrls:o,chainId:Ge(t),chainName:(null==e?void 0:e.chainName)??a.name,iconUrls:null==e?void 0:e.iconUrls,nativeCurrency:(null==e?void 0:e.nativeCurrency)??a.nativeCurrency,rpcUrls:c};return await l.request({method:"wallet_addEthereumChain",params:[u]}),a}catch(u){throw new Ye(u)}throw new ze(c)}},onAccountsChanged(e){0===e.length?this.onDisconnect():o.emitter.emit("change",{accounts:e.map(e=>Ve(e))})},onChainChanged(e){const t=Number(e);o.emitter.emit("change",{chainId:t})},async onDisconnect(e){o.emitter.emit("disconnect");const t=await this.getProvider();i&&(t.removeListener("accountsChanged",i),i=void 0),s&&(t.removeListener("chainChanged",s),s=void 0),r&&(t.removeListener("disconnect",r),r=void 0)}})}(e):function(e){let t,n,i,s;return r=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",supportsSimulation:!0,type:ci.type,async connect({chainId:e}={}){try{const t=await this.getProvider(),r=(await t.request({method:"eth_requestAccounts"})).map(e=>Ve(e));n||(n=this.onAccountsChanged.bind(this),t.on("accountsChanged",n)),i||(i=this.onChainChanged.bind(this),t.on("chainChanged",i)),s||(s=this.onDisconnect.bind(this),t.on("disconnect",s));let o=await this.getChainId();if(e&&o!==e){const t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===Ye.code)throw e;return{id:o}});o=(null==t?void 0:t.id)??o}
2return{accounts:r,chainId:o}}catch(t){if(/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(t.message))throw new Ye(t);throw t}},async disconnect(){var e;const t=await this.getProvider();n&&(t.removeListener("accountsChanged",n),n=void 0),i&&(t.removeListener("chainChanged",i),i=void 0),s&&(t.removeListener("disconnect",s),s=void 0),t.disconnect(),null==(e=t.close)||e.call(t)},async getAccounts(){const e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>Ve(e))},async getChainId(){const e=await this.getProvider(),t=await e.request({method:"eth_chainId"});return Number(t)},async getProvider(){if(!t){const i="string"==typeof e.preference?{options:e.preference}:{...e.preference,options:(null==(n=e.preference)?void 0:n.options)??"all"},{createCoinbaseWalletSDK:s}=await dt(async()=>{const{createCoinbaseWalletSDK:e}=await import("./BGZKU4Fq.js");return{createCoinbaseWalletSDK:e}},__vite__mapDeps([6,1,2,7,4,8,9])),o=s({...e,appChainIds:r.chains.map(e=>e.id),preference:i});t=o.getProvider()}var n;return t},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){var n,i,s,o;const a=r.chains.find(e=>e.id===t);if(!a)throw new ze(new Pt);const l=await this.getProvider();try{return await l.request({method:"wallet_switchEthereumChain",params:[{chainId:Ge(a.id)}]}),a}catch(c){if(4902===c.code)try{let r,c;r=(null==e?void 0:e.blockExplorerUrls)?e.blockExplorerUrls:(null==(n=a.blockExplorers)?void 0:n.default.url)?[null==(i=a.blockExplorers)?void 0:i.default.url]:[],c=(null==(s=null==e?void 0:e.rpcUrls)?void 0:s.length)?e.rpcUrls:[(null==(o=a.rpcUrls.default)?void 0:o.http[0])??""];const u={blockExplorerUrls:r,chainId:Ge(t),chainName:(null==e?void 0:e.chainName)??a.name,iconUrls:null==e?void 0:e.iconUrls,nativeCurrency:(null==e?void 0:e.nativeCurrency)??a.nativeCurrency,rpcUrls:c};return await l.request({method:"wallet_addEthereumChain",params:[u]}),a}catch(u){throw new Ye(u)}throw new ze(c)}},onAccountsChanged(e){0===e.length?this.onDisconnect():r.emitter.emit("change",{accounts:e.map(e=>Ve(e))})},onChainChanged(e){const t=Number(e);r.emitter.emit("change",{chainId:t})},async onDisconnect(e){r.emitter.emit("disconnect");const t=await this.getProvider();n&&(t.removeListener("accountsChanged",n),n=void 0),i&&(t.removeListener("chainChanged",i),i=void 0),s&&(t.removeListener("disconnect",s),s=void 0)}})}(e)}function ui(e={}){let t,n,i,s,r,o,a,l;return c=>({id:"metaMaskSDK",name:"MetaMask",rdns:["io.metamask","io.metamask.mobile"],type:ui.type,async setup(){const e=await this.getProvider();(null==e?void 0:e.on)&&(o||(o=this.onConnect.bind(this),e.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),e.on("accountsChanged",s)))},async connect({chainId:n,isReconnecting:i}={}){const c=await this.getProvider();a||(a=this.onDisplayUri,c.on("display_uri",a));let u=[];i&&(u=await this.getAccounts().catch(()=>[]));try{let i,d;(null==u?void 0:u.length)||(e.connectAndSign||e.connectWith?(e.connectAndSign?i=await t.connectAndSign({msg:e.connectAndSign}):e.connectWith&&(d=await t.connectWith({method:e.connectWith.method,params:e.connectWith.params})),u=await this.getAccounts()):u=(await t.connect()).map(e=>Ve(e)));let h=await this.getChainId();if(n&&h!==n){const e=await this.switchChain({chainId:n}).catch(e=>{if(e.code===Ye.code)throw e;return{id:h}});h=(null==e?void 0:e.id)??h}return a&&(c.removeListener("display_uri",a),a=void 0),i?c.emit("connectAndSign",{accounts:u,chainId:h,signResponse:i}):d&&c.emit("connectWith",{accounts:u,chainId:h,connectWithResponse:d}),o&&(c.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),c.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),c.on("chainChanged",r)),l||(l=this.onDisconnect.bind(this),c.on("disconnect",l)),{accounts:u,chainId:h}}catch(d){const e=d;if(e.code===Ye.code)throw new Ye(e);if(e.code===Qe.code)throw new Qe(e);throw e}},async disconnect(){const e=await this.getProvider();r&&(e.removeListener("chainChanged",r),r=void 0),l&&(e.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),e.on("connect",o)),await t.terminate()},async getAccounts(){const e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>Ve(e))},async getChainId(){const e=await this.getProvider(),t=e.getChainId()||await(null==e?void 0:e.request({method:"eth_chainId"}));return Number(t)},getProvider:async()=>(n||(i||(i=async function(){var n;const i=await(async()=>{const{default:e}=await dt(async()=>{const{default:e}=await import("./DtHguYvj.js").then(e=>e.m);return{default:e}},__vite__mapDeps([10,1,2]));return"function"!=typeof e&&"function"==typeof e.default?e.default:e})(),s={};for(const e of c.chains)s[Ge(e.id)]=null==(n=sn({chain:e,transports:c.transports}))?void 0:n[0];t=new i({_source:"wagmi",forceDeleteProvider:!1,forceInjectProvider:!1,injectProvider:!1,...e,readonlyRPCMap:s,dappMetadata:e.dappMetadata??("undefined"!=typeof window?{url:window.location.origin}:{name:"wagmi",url:"https://wagmi.sh"}),useDeeplink:e.useDeeplink??!0});const r=await t.init(),o=(null==r?void 0:r.activeProvider)?r.activeProvider:t.getProvider();if(!o)throw new Mt;return o}()),n=await i),n),async isAuthorized(){try{const e=200;return!!(await Ke(()=>Je(()=>this.getAccounts(),{timeout:e}),{delay:e+1,retryCount:3})).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){var n,i,s,r;const o=await this.getProvider(),a=c.chains.find(e=>e.id===t);if(!a)throw new ze(new Pt);try{return await Promise.all([o.request({method:"wallet_switchEthereumChain",params:[{chainId:Ge(t)}]}).then(async()=>{await this.getChainId()===t&&c.emitter.emit("change",{chainId:t})}),new Promise(e=>{const n=i=>{"chainId"in i&&i.chainId===t&&(c.emitter.off("change",n),e())};c.emitter.on("change",n)})]),a}catch(l){const c=l;if(4902===c.code||4902===(null==(i=null==(n=null==c?void 0:c.data)?void 0:n.originalError)?void 0:i.code))try{const{default:n,...i}=a.blockExplorers??{};let l,c;(null==e?void 0:e.blockExplorerUrls)?l=e.blockExplorerUrls:n&&(l=[n.url,...Object.values(i).map(e=>e.url)]),c=(null==(s=null==e?void 0:e.rpcUrls)?void 0:s.length)?e.rpcUrls:[(null==(r=a.rpcUrls.default)?void 0:r.http[0])??""];const u={blockExplorerUrls:l,chainId:Ge(t),chainName:(null==e?void 0:e.chainName)??a.name,iconUrls:null==e?void 0:e.iconUrls,nativeCurrency:(null==e?void 0:e.nativeCurrency)??a.nativeCurrency,rpcUrls:c};if(await o.request({method:"wallet_addEthereumChain",params:[u]}),ht(await o.request({method:"eth_chainId"}))!==t)throw new Ye(new Error("User rejected switch after adding network."));return a}catch(u){throw new Ye(u)}if(c.code===Ye.code)throw new Ye(c);throw new ze(c)}},async onAccountsChanged(e){if(0===e.length){if(!t.isExtensionActive())return;this.onDisconnect()}else if(c.emitter.listenerCount("connect")){const e=(await this.getChainId()).toString();this.onConnect({chainId:e})}else c.emitter.emit("change",{accounts:e.map(e=>Ve(e))})},onChainChanged(e){const t=Number(e);c.emitter.emit("change",{chainId:t})},async onConnect(e){const t=await this.getAccounts();if(0===t.length)return;const n=Number(e.chainId);c.emitter.emit("connect",{accounts:t,chainId:n});const i=await this.getProvider();o&&(i.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),i.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),i.on("chainChanged",r)),l||(l=this.onDisconnect.bind(this),i.on("disconnect",l))},async onDisconnect(e){const t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),r&&(t.removeListener("chainChanged",r),r=void 0),l&&(t.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),t.on("connect",o)))},onDisplayUri(e){c.emitter.emit("message",{type:"display_uri",data:e})}})}function di(e={}){const{shimDisconnect:t=!1}=e;let n,i;return s=>({id:"safe",name:"Safe",type:di.type,async connect(){var e;const n=await this.getProvider();if(!n)throw new Mt;const r=await this.getAccounts(),o=await this.getChainId();
2return i||(i=this.onDisconnect.bind(this),n.on("disconnect",i)),t&&await(null==(e=s.storage)?void 0:e.removeItem("safe.disconnected")),{accounts:r,chainId:o}},async disconnect(){var e;const n=await this.getProvider();if(!n)throw new Mt;i&&(n.removeListener("disconnect",i),i=void 0),t&&await(null==(e=s.storage)?void 0:e.setItem("safe.disconnected",!0))},async getAccounts(){const e=await this.getProvider();if(!e)throw new Mt;return(await e.request({method:"eth_accounts"})).map(Ve)},async getProvider(){if("undefined"!=typeof window&&(null==window?void 0:window.parent)!==window){if(!n){const{default:t}=await dt(async()=>{const{default:e}=await import("./BLBk0n_O.js");return{default:e}},__vite__mapDeps([11,12,1,2,7])),i=new t(e),s=await Je(()=>i.safe.getInfo(),{timeout:e.unstable_getInfoTimeout??10});if(!s)throw new Error("Could not load Safe information");const r=await(async()=>{const e=await dt(()=>import("./DSWGgoSa.js").then(e=>e.i),__vite__mapDeps([13,1,2,12,7,5]));return"function"!=typeof e.SafeAppProvider&&"function"==typeof e.default.SafeAppProvider?e.default.SafeAppProvider:e.SafeAppProvider})();n=new r(s,i)}return n}},async getChainId(){const e=await this.getProvider();if(!e)throw new Mt;return Number(e.chainId)},async isAuthorized(){var e;try{return(!t||!(await(null==(e=s.storage)?void 0:e.getItem("safe.disconnected"))))&&!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){s.emitter.emit("disconnect")}})}function hi(e){const t=e.isNewChainsStale??!0;let n,i,s,r,o,a,l,c;return u=>({id:"walletConnect",name:"WalletConnect",type:hi.type,async setup(){const e=await this.getProvider().catch(()=>null);e&&(o||(o=this.onConnect.bind(this),e.on("connect",o)),l||(l=this.onSessionDelete.bind(this),e.on("session_delete",l)))},async connect({chainId:e,...t}={}){var n,i;try{const d=await this.getProvider();if(!d)throw new Mt;a||(a=this.onDisplayUri,d.on("display_uri",a));let h=e;if(!h){const e=await(null==(n=u.storage)?void 0:n.getItem("state"))??{},t=u.chains.some(t=>t.id===e.chainId);h=t?e.chainId:null==(i=u.chains[0])?void 0:i.id}if(!h)throw new Error("No chains found on connector.");const p=await this.isChainsStale();if(d.session&&p&&await d.disconnect(),!d.session||p){const e=u.chains.filter(e=>e.id!==h).map(e=>e.id);await d.connect({optionalChains:[h,...e],..."pairingTopic"in t?{pairingTopic:t.pairingTopic}:{}}),this.setRequestedChainsIds(u.chains.map(e=>e.id))}const v=(await d.enable()).map(e=>Ve(e)),g=await this.getChainId();return a&&(d.removeListener("display_uri",a),a=void 0),o&&(d.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),d.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),d.on("chainChanged",r)),c||(c=this.onDisconnect.bind(this),d.on("disconnect",c)),l||(l=this.onSessionDelete.bind(this),d.on("session_delete",l)),{accounts:v,chainId:g}}catch(d){if(/(user rejected|connection request reset)/i.test(null==d?void 0:d.message))throw new Ye(d);throw d}},async disconnect(){const e=await this.getProvider();try{await(null==e?void 0:e.disconnect())}catch(t){if(!/No matching key/i.test(t.message))throw t}finally{r&&(null==e||e.removeListener("chainChanged",r),r=void 0),c&&(null==e||e.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),null==e||e.on("connect",o)),s&&(null==e||e.removeListener("accountsChanged",s),s=void 0),l&&(null==e||e.removeListener("session_delete",l),l=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(e=>Ve(e))},async getProvider({chainId:t}={}){var s;return n||(i||(i=async function(){const t=u.chains.map(e=>e.id);if(!t.length)return;const{EthereumProvider:n}=await dt(async()=>{const{EthereumProvider:e}=await import("./PaAtxa10.js");return{EthereumProvider:e}},__vite__mapDeps([14,7,5,1,2,3]));return await n.init({...e,disableProviderPing:!0,optionalChains:t,projectId:e.projectId,rpcMap:Object.fromEntries(u.chains.map(e=>{const[t]=sn({chain:e,transports:u.transports});return[e.id,t]})),showQrModal:e.showQrModal??!0})}()),n=await i,null==n||n.events.setMaxListeners(Number.POSITIVE_INFINITY)),t&&await(null==(s=this.switchChain)?void 0:s.call(this,{chainId:t})),n},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[e,t]=await Promise.all([this.getAccounts(),this.getProvider()]);return!!e.length&&(!(await this.isChainsStale())||!t.session||(await t.disconnect().catch(()=>{}),!1))}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){var n,i,s;const r=await this.getProvider();if(!r)throw new Mt;const o=u.chains.find(e=>e.id===t);if(!o)throw new ze(new Pt);try{await Promise.all([new Promise(e=>{const n=({chainId:i})=>{i===t&&(u.emitter.off("change",n),e())};u.emitter.on("change",n)}),r.request({method:"wallet_switchEthereumChain",params:[{chainId:Ge(t)}]})]);const e=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...e,t]),o}catch(a){const c=a;if(/(user rejected)/i.test(c.message))throw new Ye(c);try{let a,l;a=(null==e?void 0:e.blockExplorerUrls)?e.blockExplorerUrls:(null==(n=o.blockExplorers)?void 0:n.default.url)?[null==(i=o.blockExplorers)?void 0:i.default.url]:[],l=(null==(s=null==e?void 0:e.rpcUrls)?void 0:s.length)?e.rpcUrls:[...o.rpcUrls.default.http];const c={blockExplorerUrls:a,chainId:Ge(t),chainName:(null==e?void 0:e.chainName)??o.name,iconUrls:null==e?void 0:e.iconUrls,nativeCurrency:(null==e?void 0:e.nativeCurrency)??o.nativeCurrency,rpcUrls:l};await r.request({method:"wallet_addEthereumChain",params:[c]});const u=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...u,t]),o}catch(l){throw new Ye(l)}}},onAccountsChanged(e){0===e.length?this.onDisconnect():u.emitter.emit("change",{accounts:e.map(e=>Ve(e))})},onChainChanged(e){const t=Number(e);u.emitter.emit("change",{chainId:t})},async onConnect(e){const t=Number(e.chainId),n=await this.getAccounts();u.emitter.emit("connect",{accounts:n,chainId:t})},async onDisconnect(e){this.setRequestedChainsIds([]),u.emitter.emit("disconnect");const t=await this.getProvider();s&&(t.removeListener("accountsChanged",s),s=void 0),r&&(t.removeListener("chainChanged",r),r=void 0),c&&(t.removeListener("disconnect",c),c=void 0),l&&(t.removeListener("session_delete",l),l=void 0),o||(o=this.onConnect.bind(this),t.on("connect",o))},onDisplayUri(e){u.emitter.emit("message",{type:"display_uri",data:e})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var e,t,i;return n?(null==(i=null==(t=null==(e=n.session)?void 0:e.namespaces.eip155)?void 0:t.accounts)?void 0:i.map(e=>Number.parseInt(e.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var e;return await(null==(e=u.storage)?void 0:e.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!t)return!1;const e=u.chains.map(e=>e.id),n=this.getNamespaceChainsIds();if(n.length&&!n.some(t=>e.includes(t)))return!1;const i=await this.getRequestedChainsIds();return!e.every(e=>i.includes(e))},async setRequestedChainsIds(e){var t;await(null==(t=u.storage)?void 0:t.setItem(this.requestedChainsStorageKey,e))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}ci.type="coinbaseWallet",ui.type="metaMask",di.type="safe",hi.type="walletConnect";
2const pi=function(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=Zt({storage:"undefined"!=typeof window&&window.localStorage?window.localStorage:en}),syncConnectedChain:i=!0,ssr:s=!1,...r}=e,o="undefined"!=typeof window&&t?Bt():void 0,a=Ht(()=>r.chains),l=Ht(()=>{const e=[],t=new Set;for(const n of r.connectors??[]){const i=c(n);if(e.push(i),!s&&i.rdns){const e="string"==typeof i.rdns?[i.rdns]:i.rdns;for(const n of e)t.add(n)}}if(!s&&o){const n=o.getProviders();for(const i of n)t.has(i.info.rdns)||e.push(c(u(i)))}return e});function c(e){var t;const i=(s=function(e=11){if(!tn||nn+e>512){tn="",nn=0;for(let e=0;e<256;e++)tn+=(256+256*Math.random()|0).toString(16).substring(1)}return tn.substring(nn,nn+++e)}(),new Yt(s));var s;const o={...e({emitter:i,chains:a.getState(),storage:n,transports:r.transports}),emitter:i,uid:i.uid};return i.on("connect",b),null==(t=o.setup)||t.call(o),o}function u(e){const{info:t}=e,n=e.provider;return Rt({target:{...t,id:t.rdns,provider:n}})}const d=new Map;function h(){return{chainId:a.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let p;const v="0.0.0-canary-";p=Et.startsWith(v)?Number.parseInt(Et.replace(v,"")):Number.parseInt(Et.split(".")[0]??"0");const g=Ht((f=n?(m=h,_={migrate(e,t){if(t===p)return e;const n=h(),i=y(e,n.chainId);return{...n,chainId:i}},name:"store",partialize:e=>({connections:{__type:"Map",value:Array.from(e.connections.entries()).map(([e,t])=>{const{id:n,name:i,type:s,uid:r}=t.connector,o={id:n,name:i,type:s,uid:r};return[e,{...t,connector:o}]})},chainId:e.chainId,current:e.current}),merge(e,t){"object"==typeof e&&e&&"status"in e&&delete e.status;const n=y(e,t.chainId);return{...t,...e,chainId:n}},skipHydration:s,storage:n,version:p},(e,t,n)=>{let i={storage:qt(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),..._},s=!1;const r=new Set,o=new Set;let a=i.storage;if(!a)return m((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),e(...t)},t,n);const l=()=>{const e=i.partialize({...t()});return a.setItem(i.name,{state:e,version:i.version})},c=n.setState;n.setState=(e,t)=>{c(e,t),l()};const u=m((...t)=>{e(...t),l()},t,n);let d;n.getInitialState=()=>u;const h=()=>{var n,c;if(!a)return;s=!1,r.forEach(e=>{var n;return e(null!=(n=t())?n:u)});const h=(null==(c=i.onRehydrateStorage)?void 0:c.call(i,null!=(n=t())?n:u))||void 0;return jt(a.getItem.bind(a))(i.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===i.version)return[!1,e.state];if(i.migrate)return[!0,i.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(n=>{var s;const[r,o]=n;if(d=i.merge(o,null!=(s=t())?s:u),e(d,!0),r)return l()}).then(()=>{null==h||h(d,void 0),d=t(),s=!0,o.forEach(e=>e(d))}).catch(e=>{null==h||h(void 0,e)})};return n.persist={setOptions:e=>{i={...i,...e},e.storage&&(a=e.storage)},clearStorage:()=>{null==a||a.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>h(),hasHydrated:()=>s,onHydrate:e=>(r.add(e),()=>{r.delete(e)}),onFinishHydration:e=>(o.add(e),()=>{o.delete(e)})},i.skipHydration||h(),d||u}):h,(e,t,n)=>{const i=n.subscribe;return n.subscribe=(e,t,s)=>{let r=e;if(t){const i=(null==s?void 0:s.equalityFn)||Object.is;let o=e(n.getState());r=n=>{const s=e(n);if(!i(o,s)){const e=o;t(o=s,e)}},(null==s?void 0:s.fireImmediately)&&t(o,o)}return i(r)},f(e,t,n)}));var f,m,_;function y(e,t){return e&&"object"==typeof e&&"chainId"in e&&"number"==typeof e.chainId&&a.getState().some(t=>t.id===e.chainId)?e.chainId:t}function w(e){g.setState(t=>{const n=t.connections.get(e.uid);return n?{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts??n.accounts,chainId:e.chainId??n.chainId,connector:n.connector})}:t})}function b(e){"connecting"!==g.getState().status&&"reconnecting"!==g.getState().status&&g.setState(t=>{const n=l.getState().find(t=>t.uid===e.uid);return n?(n.emitter.listenerCount("connect")&&n.emitter.off("connect",w),n.emitter.listenerCount("change")||n.emitter.on("change",w),n.emitter.listenerCount("disconnect")||n.emitter.on("disconnect",S),{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts,chainId:e.chainId,connector:n}),current:e.uid,status:"connected"}):t})}function S(e){g.setState(t=>{const n=t.connections.get(e.uid);if(n){const e=n.connector;e.emitter.listenerCount("change")&&n.connector.emitter.off("change",w),e.emitter.listenerCount("disconnect")&&n.connector.emitter.off("disconnect",S),e.emitter.listenerCount("connect")||n.connector.emitter.on("connect",b)}if(t.connections.delete(e.uid),0===t.connections.size)return{...t,connections:new Map,current:null,status:"disconnected"};const i=t.connections.values().next().value;return{...t,connections:new Map(t.connections),current:i.connector.uid}})}return g.setState(h()),i&&g.subscribe(({connections:e,current:t})=>{var n;return t?null==(n=e.get(t))?void 0:n.chainId:void 0},e=>{if(a.getState().some(t=>t.id===e))return g.setState(t=>({...t,chainId:e??t.chainId}))}),null==o||o.subscribe(e=>{const t=new Set,i=new Set;for(const n of l.getState())if(t.add(n.id),n.rdns){const e="string"==typeof n.rdns?[n.rdns]:n.rdns;for(const t of e)i.add(t)}const s=[];for(const n of e){if(i.has(n.info.rdns))continue;const e=c(u(n));t.has(e.id)||s.push(e)}n&&!g.persist.hasHydrated()||l.setState(e=>[...e,...s],!0)}),{get chains(){return a.getState()},get connectors(){return l.getState()},storage:n,getClient:function(e={}){const t=e.chainId??g.getState().chainId,n=a.getState().find(e=>e.id===t);if(e.chainId&&!n)throw new Pt;{const e=d.get(g.getState().chainId);if(e&&!n)return e;if(!n)throw new Pt}{const e=d.get(t);if(e)return e}let i;if(r.client)i=r.client({chain:n});
2else{const e=n.id,t=a.getState().map(e=>e.id),s={},o=Object.entries(r);for(const[n,i]of o)if("chains"!==n&&"client"!==n&&"connectors"!==n&&"transports"!==n)if("object"==typeof i)if(e in i)s[n]=i[e];else{if(t.some(e=>e in i))continue;s[n]=i}else s[n]=i;i=Xe({...s,chain:n,batch:s.batch??{multicall:!0},transport:t=>r.transports[e]({...t,connectors:l})})}return d.set(t,i),i},get state(){return g.getState()},setState(e){let t;t="function"==typeof e?e(g.getState()):e;const n=h();"object"!=typeof t&&(t=n),Object.keys(n).some(e=>!(e in t))&&(t=n),g.setState(t,!0)},subscribe:(e,t,n)=>g.subscribe(e,t,n?{...n,fireImmediately:n.emitImmediately}:void 0),_internal:{mipd:o,store:g,ssr:Boolean(s),syncConnectedChain:i,transports:r.transports,chains:{setState(e){const t="function"==typeof e?e(a.getState()):e;if(0!==t.length)return a.setState(t,!0)},subscribe:e=>a.subscribe(e)},connectors:{providerDetailToConnector:u,setup:c,setState:e=>l.setState("function"==typeof e?e(l.getState()):e,!0),subscribe:e=>l.subscribe(e)},events:{change:w,connect:b,disconnect:S}}}}({chains:[li],connectors:[Rt(),ui(),di(),ci(),hi({projectId:"739114e020c64c6adf74905c5b4471ea"})],transports:{[li.id]:pt()}}),vi="no-select",gi=e=>{e.preventDefault()},fi=e=>{0===e.button&&e.preventDefault()},mi=e=>{e.preventDefault()},_i=Symbol("no-select:listeners"),yi={mounted(e,t){if(!1===t.value)return;e.classList.add(vi);const n={onSelectStart:gi,onMouseDown:fi,onDragStart:mi,onSelectionChange:()=>{var t;const n=null==(t=window.getSelection)?void 0:t.call(window);if(!n||n.isCollapsed)return;const i=n.anchorNode,s=n.focusNode;if(!i||!s)return;const r=i.nodeType===Node.ELEMENT_NODE?i:i.parentElement,o=s.nodeType===Node.ELEMENT_NODE?s:s.parentElement;r&&o&&(e.contains(r)||e.contains(o))&&n.removeAllRanges()},onCopy:t=>{var n;const i=null==(n=window.getSelection)?void 0:n.call(window);if(!i||i.isCollapsed)return;const s=i.anchorNode,r=i.focusNode,o=(null==s?void 0:s.nodeType)===Node.ELEMENT_NODE?s:null==s?void 0:s.parentElement,a=(null==r?void 0:r.nodeType)===Node.ELEMENT_NODE?r:null==r?void 0:r.parentElement;(o&&e.contains(o)||a&&e.contains(a))&&t.preventDefault()},onCut:t=>{var n;const i=null==(n=window.getSelection)?void 0:n.call(window);if(!i||i.isCollapsed)return;const s=i.anchorNode,r=i.focusNode,o=(null==s?void 0:s.nodeType)===Node.ELEMENT_NODE?s:null==s?void 0:s.parentElement,a=(null==r?void 0:r.nodeType)===Node.ELEMENT_NODE?r:null==r?void 0:r.parentElement;(o&&e.contains(o)||a&&e.contains(a))&&t.preventDefault()}};e[_i]=n,e.addEventListener("selectstart",n.onSelectStart),e.addEventListener("mousedown",n.onMouseDown),e.addEventListener("dragstart",n.onDragStart),document.addEventListener("selectionchange",n.onSelectionChange),document.addEventListener("copy",n.onCopy),document.addEventListener("cut",n.onCut)},updated(e,t){if(!1!==t.value){if(e.classList.contains(vi)||e.classList.add(vi),!e[_i]){const t={onSelectStart:gi,onMouseDown:fi,onDragStart:mi,onSelectionChange:()=>{var t;const n=null==(t=window.getSelection)?void 0:t.call(window);if(!n||n.isCollapsed)return;const i=n.anchorNode,s=n.focusNode;if(!i||!s)return;const r=i.nodeType===Node.ELEMENT_NODE?i:i.parentElement,o=s.nodeType===Node.ELEMENT_NODE?s:s.parentElement;r&&o&&(e.contains(r)||e.contains(o))&&n.removeAllRanges()},onCopy:t=>{var n;const i=null==(n=window.getSelection)?void 0:n.call(window);if(!i||i.isCollapsed)return;const s=i.anchorNode,r=i.focusNode,o=(null==s?void 0:s.nodeType)===Node.ELEMENT_NODE?s:null==s?void 0:s.parentElement,a=(null==r?void 0:r.nodeType)===Node.ELEMENT_NODE?r:null==r?void 0:r.parentElement;(o&&e.contains(o)||a&&e.contains(a))&&t.preventDefault()},onCut:t=>{var n;const i=null==(n=window.getSelection)?void 0:n.call(window);if(!i||i.isCollapsed)return;const s=i.anchorNode,r=i.focusNode,o=(null==s?void 0:s.nodeType)===Node.ELEMENT_NODE?s:null==s?void 0:s.parentElement,a=(null==r?void 0:r.nodeType)===Node.ELEMENT_NODE?r:null==r?void 0:r.parentElement;(o&&e.contains(o)||a&&e.contains(a))&&t.preventDefault()}};e[_i]=t,e.addEventListener("selectstart",t.onSelectStart),e.addEventListener("mousedown",t.onMouseDown),e.addEventListener("dragstart",t.onDragStart),document.addEventListener("selectionchange",t.onSelectionChange),document.addEventListener("copy",t.onCopy),document.addEventListener("cut",t.onCut)}}else{e.classList.remove(vi);const t=e[_i];t&&(e.removeEventListener("selectstart",t.onSelectStart),e.removeEventListener("mousedown",t.onMouseDown),e.removeEventListener("dragstart",t.onDragStart),document.removeEventListener("selectionchange",t.onSelectionChange),document.removeEventListener("copy",t.onCopy),document.removeEventListener("cut",t.onCut),delete e[_i])}},unmounted(e){e.classList.remove(vi);const t=e[_i];t&&(e.removeEventListener("selectstart",t.onSelectStart),e.removeEventListener("mousedown",t.onMouseDown),e.removeEventListener("dragstart",t.onDragStart),document.removeEventListener("selectionchange",t.onSelectionChange),document.removeEventListener("copy",t.onCopy),document.removeEventListener("cut",t.onCut),delete e[_i])}},wi={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},bi={LIGHT:"light",DARK:"dark",COLORED:"colored",AUTO:"auto"},Si={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Ei={dangerouslyHTMLString:!1,multiple:!0,position:wi.TOP_RIGHT,autoClose:5e3,transition:"bounce",hideProgressBar:!1,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,className:"",bodyClassName:"",style:{},progressClassName:"",progressStyle:{},role:"alert",theme:"light",rtl:!1,newestOnTop:!1,toastClassName:""};var Ti=(e=>(e[e.COLLAPSE_DURATION=300]="COLLAPSE_DURATION",e[e.DEBOUNCE_DURATION=50]="DEBOUNCE_DURATION",e.CSS_NAMESPACE="Toastify",e))(Ti||{}),xi=(e=>(e.ENTRANCE_ANIMATION_END="d",e))(xi||{});const Ci={enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0},Ai={enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0},Pi={enter:"Toastify--animate Toastify__zoom-enter",exit:"Toastify--animate Toastify__zoom-exit"},ki={enter:"Toastify--animate Toastify__flip-enter",exit:"Toastify--animate Toastify__flip-exit"},Li="Toastify--animate Toastify__none-enter";function Ii(e,t=!1){var n;let i=Ci;if(e&&"string"!=typeof e)i=e;else switch(e){case"flip":i=ki;break;case"zoom":i=Pi;break;case"slide":i=Ai}if(t)i.enter=Li;else if(i.enter===Li){const e=null==(n=i.exit.split("__")[1])?void 0:n.split("-")[0];i.enter=`Toastify--animate Toastify__${e}-enter`}return i}const Di="will-unmount";function Oi(e){var t,n,i;const s="string"==typeof e?e:(null==(t=e.currentTarget)?void 0:t.id)||(null==(n=e.target)?void 0:n.id),r=document.getElementById(s);r&&r.removeEventListener("animationend",Oi,!1);try{Ni[s].unmount(),null==(i=document.getElementById(s))||i.remove(),delete Ni[s],delete Ui[s]}catch{}}const Ni=ee({});function Mi(e,t=!0){const n=String(e);if(!Ni[n])return;const i=document.getElementById(n);i&&i.classList.add(Di),t?(function(e){for(const t in Ui)if(t===e)for(const e of Ui[t]||[])$i(e)}(e),i&&i.addEventListener("animationend",Oi,!1)):Oi(n),Bi.items=Bi.items.filter(t=>t.containerId!==e)}function $i(e,t){const n=document.getElementById(e.toastId);if(n){let i=e;i={...i,...Ii(i.transition)};const s=i.appendPosition?`${i.exit}--${i.position}`:i.exit;n.className+=` ${s}`,t&&t(n)}}function Ri(e){return document.getElementById(e)}function Fi(e){var t;const n=de(e.content)?ne(e.content.props):null;return null!=n?n:ne(null!=(t=e.data)?t:{})}const Ui=ee({}),Bi=ee({items:[]});function qi(){const e=ne(Ui);return Object.values(e).reduce((e,t)=>
2[...e,...t],[])}function ji(e,t={}){if(function(e){const t=Ri(e.containerId);return t&&t.classList.contains(Di)}(t)){const n=Ri(t.containerId);n&&n.addEventListener("animationend",Wi.bind(null,e,t),!1)}else Wi(e,t)}function Wi(e,t={}){const n=Ri(t.containerId);n&&n.removeEventListener("animationend",Wi.bind(null,e,t),!1);const i=Ui[t.containerId]||[],s=i.length>0;if(!s&&!function(e=wi.TOP_RIGHT){return!!document.querySelector(`.${Ti.CSS_NAMESPACE}__toast-container--${e}`)}(t.position)){const e=function(e){var t;const{position:n,containerClassName:i,rtl:s=!1,style:r={}}=e,o=Ti.CSS_NAMESPACE,a=function(e=wi.TOP_RIGHT){return`${Ti.CSS_NAMESPACE}__toast-container--${e}`}(n),l=document.querySelector(`.${o}`),c=document.querySelector(`.${a}`),u=!(!c||null!=(t=c.className)&&t.includes(Di)),d=l||document.createElement("div"),h=document.createElement("div");h.className=function(e,t,n=!1){const i=[`${Ti.CSS_NAMESPACE}__toast-container`,`${Ti.CSS_NAMESPACE}__toast-container--${e}`,n?`${Ti.CSS_NAMESPACE}__toast-container--rtl`:null].filter(Boolean).join(" ");return Ji(t)?t({position:e,rtl:n,defaultClassName:i}):`${i} ${t||""}`}(n,i,s),h.dataset.testid=`${Ti.CSS_NAMESPACE}__toast-container--${n}`,h.id=function(e){return e.containerId||String(e.position)}(e);for(const p in r)if(Object.prototype.hasOwnProperty.call(r,p)){const e=r[p];h.style[p]=e}return l||(d.className=Ti.CSS_NAMESPACE,document.body.appendChild(d)),u||d.appendChild(h),h}(t),n=ie(cs,t);t.useHandler&&t.useHandler(n),n.mount(e),function(e,t){const n=document.getElementById(String(t));n&&(Ni[n.id]=e)}(n,e.id)}s&&!t.updateId&&(t.position=i[0].position),Z(()=>{t.updateId?Hi.update(t):Hi.add(e,t)})}const Hi={add(e,t){const{containerId:n=""}=t;n&&(Ui[n]=Ui[n]||[],Ui[n].find(e=>e.toastId===t.toastId)||setTimeout(()=>{var e,i;t.newestOnTop?null==(e=Ui[n])||e.unshift(t):null==(i=Ui[n])||i.push(t),t.onOpen&&t.onOpen(Fi(t))},t.delay||0))},remove(e){if(e){const t=function(e){const t=qi().find(t=>t.toastId===e);return null==t?void 0:t.containerId}(e);if(t){const n=Ui[t];let i=n.find(t=>t.toastId===e);Ui[t]=n.filter(t=>t.toastId!==e),!Ui[t].length&&!function(e){return e?Bi.items.filter(t=>t.containerId===e).length>0:Bi.items.length>0}(t)&&Mi(t,!1),function(){if(Bi.items.length>0){const e=Bi.items.shift();ji(null==e?void 0:e.toastContent,null==e?void 0:e.toastProps)}}(),Z(()=>{null!=i&&i.onClose&&(i.onClose(Fi(i)),i=void 0)})}}},update(e={}){const{containerId:t=""}=e;if(t&&e.updateId){Ui[t]=Ui[t]||[];const n=Ui[t].find(t=>t.toastId===e.toastId),i=(null==n?void 0:n.position)!==e.position||(null==n?void 0:n.transition)!==e.transition,s={...e,disabledEnterTransition:!i,updateId:void 0};Hi.dismissForce(null==e?void 0:e.toastId),setTimeout(()=>{vs(s.content,s)},e.delay||0)}},clear(e,t=!0){e?Mi(e,t):function(e){for(const t in Ni)Mi(t,e);Bi.items=[]}(t)},dismissCallback(e){var t;const n=null==(t=e.currentTarget)?void 0:t.id,i=document.getElementById(n);i&&(i.removeEventListener("animationend",Hi.dismissCallback,!1),setTimeout(()=>{Hi.remove(n)}))},dismiss(e){if(e){const t=qi();for(const n of t)if(n.toastId===e){$i(n,e=>{e.addEventListener("animationend",Hi.dismissCallback,!1)});break}}},dismissForce(e){if(e){const t=qi();for(const n of t)if(n.toastId===e){const t=document.getElementById(e);t&&(t.remove(),t.removeEventListener("animationend",Hi.dismissCallback,!1),Hi.remove(e));break}}}},Vi=ee({useHandler:void 0}),zi=ee({}),Gi=ee({});function Yi(){return Math.random().toString(36).substring(2,9)}function Ki(e){return"string"==typeof e}function Ji(e){return"function"==typeof e}function Qi(...e){return te(...e)}function Xi(e){return!("object"!=typeof e||!(null!=e&&e.render||null!=e&&e.setup||"object"==typeof(null==e?void 0:e.type)))}var Zi=(e=>(e[e.Enter=0]="Enter",e[e.Exit=1]="Exit",e))(Zi||{});const es={containerId:{type:[String,Number],required:!1,default:""},clearOnUrlChange:{type:Boolean,required:!1,default:!0},disabledEnterTransition:{type:Boolean,required:!1,default:!1},dangerouslyHTMLString:{type:Boolean,required:!1,default:!1},multiple:{type:Boolean,required:!1,default:!0},limit:{type:Number,required:!1,default:void 0},position:{type:String,required:!1,default:wi.TOP_LEFT},bodyClassName:{type:String,required:!1,default:""},autoClose:{type:[Number,Boolean],required:!1,default:!1},closeButton:{type:[Boolean,Function,Object],required:!1,default:void 0},transition:{type:[String,Object],required:!1,default:"bounce"},hideProgressBar:{type:Boolean,required:!1,default:!1},pauseOnHover:{type:Boolean,required:!1,default:!0},pauseOnFocusLoss:{type:Boolean,required:!1,default:!0},closeOnClick:{type:Boolean,required:!1,default:!0},progress:{type:Number,required:!1,default:void 0},progressClassName:{type:String,required:!1,default:""},toastStyle:{type:Object,required:!1,default:()=>({})},progressStyle:{type:Object,required:!1,default:()=>({})},role:{type:String,required:!1,default:"alert"},theme:{type:String,required:!1,default:bi.AUTO},content:{type:[String,Object,Function],required:!1,default:""},toastId:{type:[String,Number],required:!1,default:""},data:{type:[Object,String],required:!1,default:()=>({})},type:{type:String,required:!1,default:Si.DEFAULT},icon:{type:[Boolean,String,Number,Object,Function],required:!1,default:void 0},delay:{type:Number,required:!1,default:void 0},onOpen:{type:Function,required:!1,default:void 0},onClose:{type:Function,required:!1,default:void 0},onClick:{type:Function,required:!1,default:void 0},isLoading:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},toastClassName:{type:String,required:!1,default:""},updateId:{type:[String,Number],required:!1,default:""},contentProps:{type:Object,required:!1,default:null},expandCustomProps:{type:Boolean,required:!1,default:!1}},ts=se({name:"ProgressBar",props:{autoClose:{type:[Number,Boolean],required:!0},isRunning:{type:Boolean,required:!1,default:void 0},type:{type:String,required:!1,default:Si.DEFAULT},theme:{type:String,required:!1,default:bi.AUTO},hide:{type:Boolean,required:!1,default:void 0},className:{type:[String,Function],required:!1,default:""},controlledProgress:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:void 0},isIn:{type:Boolean,required:!1,default:void 0},progress:{type:Number,required:!1,default:void 0},closeToast:{type:Function,required:!1,default:void 0}},setup(e,{attrs:t}){const n=X(),i=re(()=>e.hide?"true":"false"),s=re(()=>({...t.style||{},animationDuration:`${!0===e.autoClose?5e3:e.autoClose}ms`,animationPlayState:e.isRunning?"running":"paused",opacity:e.hide||!1===e.autoClose?0:1,transform:e.controlledProgress?`scaleX(${e.progress})`:"none"})),r=re(()=>[`${Ti.CSS_NAMESPACE}__progress-bar`,e.controlledProgress?`${Ti.CSS_NAMESPACE}__progress-bar--controlled`:`${Ti.CSS_NAMESPACE}__progress-bar--animated`,`${Ti.CSS_NAMESPACE}__progress-bar-theme--${e.theme}`,`${Ti.CSS_NAMESPACE}__progress-bar--${e.type}
2`,e.rtl?`${Ti.CSS_NAMESPACE}__progress-bar--rtl`:null].filter(Boolean).join(" ")),o=re(()=>`${r.value} ${(null==t?void 0:t.class)||""}`),a=()=>{n.value&&(n.value.onanimationend=null,n.value.ontransitionend=null)},l=()=>{e.isIn&&e.closeToast&&!1!==e.autoClose&&(e.closeToast(),a())},c=re(()=>e.controlledProgress?null:l),u=re(()=>e.controlledProgress?l:null);return pe(()=>{n.value&&(a(),n.value.onanimationend=c.value,n.value.ontransitionend=u.value)}),()=>oe("div",{ref:n,role:"progressbar","aria-hidden":i.value,"aria-label":"notification timer",class:o.value,style:s.value},null)}}),ns=se({name:"CloseButton",inheritAttrs:!1,props:{theme:{type:String,required:!1,default:bi.AUTO},type:{type:String,required:!1,default:bi.LIGHT},ariaLabel:{type:String,required:!1,default:"close"},closeToast:{type:Function,required:!1,default:void 0}},setup:e=>()=>oe("button",{class:`${Ti.CSS_NAMESPACE}__close-button ${Ti.CSS_NAMESPACE}__close-button--${e.theme}`,type:"button",onClick:t=>{t.stopPropagation(),e.closeToast&&e.closeToast(t)},"aria-label":e.ariaLabel},[oe("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},[oe("path",{"fill-rule":"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"},null)])])}),is=({theme:e,type:t,path:n,...i})=>oe("svg",te({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===e?"currentColor":`var(--toastify-icon-color-${t})`},i),[oe("path",{d:n},null)]),ss={info:function(e){return oe(is,te(e,{path:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}),null)},warning:function(e){return oe(is,te(e,{path:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}),null)},success:function(e){return oe(is,te(e,{path:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}),null)},error:function(e){return oe(is,te(e,{path:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}),null)},spinner:function(){return oe("div",{class:`${Ti.CSS_NAMESPACE}__spinner`},null)}};const rs=()=>{};const os=se({name:"ToastItem",inheritAttrs:!1,props:es,setup(e){const t=X(),n=re(()=>!!e.isLoading),i=re(()=>void 0!==e.progress&&null!==e.progress),s=re(()=>function({theme:e,type:t,isLoading:n,icon:i}){let s;const r=!!n||"loading"===t,o={theme:e,type:t};if(r&&(void 0===i||"boolean"==typeof i))return ss.spinner();if(!1!==i){if(Xi(i))s=ne(i);else if(Ji(i)){const e=i;o.type=r?"loading":t,s=e(o),s=!s&&r?ss.spinner():s}else de(i)?s=he(i,o):Ki(i)||function(e){return"number"==typeof e&&!isNaN(e)}(i)?s=i:(e=>e in ss)(t)&&(s=ss[t](o));return s}}(e)),r=re(()=>[`${Ti.CSS_NAMESPACE}__toast`,`${Ti.CSS_NAMESPACE}__toast-theme--${e.theme}`,`${Ti.CSS_NAMESPACE}__toast--${e.type}`,e.rtl?`${Ti.CSS_NAMESPACE}__toast--rtl`:void 0,e.toastClassName||""].filter(Boolean).join(" ")),{isRunning:o,isIn:a,hideToast:l,eventHandlers:c}=function(e){const t=X(!1),n=X(!1),i=X(!1),s=X(Zi.Enter),r=ee({...e,appendPosition:e.appendPosition||!1,collapse:typeof e.collapse>"u"||e.collapse,collapseDuration:e.collapseDuration||Ti.COLLAPSE_DURATION}),o=r.done||rs,a=re(()=>r.appendPosition?`${r.enter}--${r.position}`:r.enter),l=re(()=>r.appendPosition?`${r.exit}--${r.position}`:r.exit),c=re(()=>e.pauseOnHover?{onMouseenter:h,onMouseleave:d}:{});function u(){return e.toastRef.value}function d(){(!e.loading.value||void 0===e.isLoading)&&(t.value=!0)}function h(){t.value=!1}return pe(function(){if(!u())return;const e=()=>{const t=u();t.removeEventListener("animationend",e),r.collapse?function(e,t,n=Ti.COLLAPSE_DURATION){const{scrollHeight:i,style:s}=e,r=n;requestAnimationFrame(()=>{s.minHeight="initial",s.height=i+"px",s.transition=`all ${r}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(t,r)})})}(t,o,r.collapseDuration):o()};n.value||(i.value?e():setTimeout(()=>{const t=u();s.value=Zi.Exit,t&&(t.className+=` ${l.value}`,t.addEventListener("animationend",e))}))}),pe(()=>{const e=qi();n.value=e.findIndex(e=>e.toastId===r.toastId)>-1}),pe(()=>{void 0!==e.isLoading&&(e.loading.value?h():d())}),ae(function(){const t=a.value.split(" ");u().addEventListener(xi.ENTRANCE_ANIMATION_END,d,{once:!0});const n=e=>{const i=u();e.target===i&&(i.dispatchEvent(new Event(xi.ENTRANCE_ANIMATION_END)),i.removeEventListener("animationend",n),i.removeEventListener("animationcancel",n),s.value===Zi.Enter&&"animationcancel"!==e.type&&i.classList.remove(...t))};e.pauseOnFocusLoss&&(document.hasFocus()||h(),window.addEventListener("focus",d),window.addEventListener("blur",h)),(()=>{const e=u();e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)})()}),le(()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",d),window.removeEventListener("blur",h))}),{isIn:n,isRunning:t,hideToast:function(e){e&&(e.stopPropagation(),e.preventDefault()),n.value=!1},eventHandlers:c}}({toastRef:t,loading:n,done:()=>{Hi.remove(e.toastId)},...Ii(e.transition,e.disabledEnterTransition),...e});return()=>oe("div",te({id:e.toastId,class:r.value,style:e.toastStyle||{},ref:t,"data-testid":`toast-item-${e.toastId}`,onClick:t=>
2{e.closeOnClick&&l(),e.onClick&&e.onClick(t)}},c.value),[oe("div",{role:e.role,"data-testid":"toast-body",class:`${Ti.CSS_NAMESPACE}__toast-body ${e.bodyClassName||""}`},[null!=s.value&&oe("div",{"data-testid":`toast-icon-${e.type}`,class:[`${Ti.CSS_NAMESPACE}__toast-icon`,e.isLoading?"":`${Ti.CSS_NAMESPACE}--animate-icon ${Ti.CSS_NAMESPACE}__zoom-enter`].join(" ")},[Xi(s.value)?ue(ne(s.value),{theme:e.theme,type:e.type}):Ji(s.value)?s.value({theme:e.theme,type:e.type}):s.value]),oe("div",{"data-testid":"toast-content"},[Xi(e.content)?ue(ne(e.content),{toastProps:ne(e),closeToast:l,data:e.data,...e.expandCustomProps?e.contentProps:{contentProps:e.contentProps||{}}}):Ji(e.content)?e.content({toastProps:ne(e),closeToast:l,data:e.data}):e.dangerouslyHTMLString?ue("div",{innerHTML:e.content}):e.content])]),(void 0===e.closeButton||!0===e.closeButton)&&oe(ns,{theme:e.theme,closeToast:e=>{e.stopPropagation(),e.preventDefault(),l()}},null),Xi(e.closeButton)?ue(ne(e.closeButton),{closeToast:l,type:e.type,theme:e.theme}):Ji(e.closeButton)?e.closeButton({closeToast:l,type:e.type,theme:e.theme}):null,oe(ts,{className:e.progressClassName,style:e.progressStyle,rtl:e.rtl,theme:e.theme,isIn:a.value,type:e.type,hide:e.hideProgressBar,isRunning:o.value,autoClose:e.autoClose,controlledProgress:i.value,progress:e.progress,closeToast:e.isLoading?void 0:l},null)])}});let as=0;function ls(){typeof window>"u"||(as&&window.cancelAnimationFrame(as),as=window.requestAnimationFrame(ls),Gi.lastUrl!==window.location.href&&(Gi.lastUrl=window.location.href,Hi.clear()))}const cs=se({name:"ToastifyContainer",inheritAttrs:!1,props:es,setup(e){const t=re(()=>e.containerId),n=re(()=>Ui[t.value]||[]),i=re(()=>n.value.filter(t=>t.position===e.position));return ae(()=>{typeof window<"u"&&e.clearOnUrlChange&&window.requestAnimationFrame(ls)}),le(()=>{typeof window<"u"&&as&&(window.cancelAnimationFrame(as),Gi.lastUrl="")}),()=>oe(ce,null,[i.value.map(e=>{const{toastId:t=""}=e;return oe(os,te({key:t},e),null)})])}});let us=!1;const ds={isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1};function hs(){const e=[];
2return qi().forEach(t=>{const n=document.getElementById(t.containerId);n&&!n.classList.contains(Di)&&e.push(t)}),e}function ps(e,t,n={}){if(us)return;(!(n=Qi(zi[`${Ti.CSS_NAMESPACE}-default-options`]||Ei,{type:t},ne(n))).toastId||"string"!=typeof n.toastId&&"number"!=typeof n.toastId)&&(n.toastId=Yi()),n={...n,..."loading"===n.type?ds:{},content:e,containerId:n.containerId||String(n.position)};const i=Number(null==n?void 0:n.progress);return!isNaN(i)&&i<0&&(n.progress=0),i>1&&(n.progress=1),"auto"===n.theme&&(n.theme=function(){const e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return document.documentElement.classList.contains("dark")||e?"dark":"light"}()),function(e){(function(e){const t=hs().length,n=null!=e?e:0;return n>0&&t+Bi.items.length>=n})(e.limit)&&!e.updateId&&Bi.items.push({toastId:e.toastId,containerId:e.containerId,toastContent:e.content,toastProps:e})}(n),Gi.lastUrl=window.location.href,n.multiple?Bi.items.length?n.updateId&&ji(e,n):ji(e,n):(us=!0,vs.clearAll(void 0,!1),setTimeout(()=>{ji(e,n)},0),setTimeout(()=>{us=!1},390)),n.toastId}const vs=(e,t)=>ps(e,Si.DEFAULT,t);vs.info=(e,t)=>ps(e,Si.DEFAULT,{...t,type:Si.INFO}),vs.error=(e,t)=>ps(e,Si.DEFAULT,{...t,type:Si.ERROR}),vs.warning=(e,t)=>ps(e,Si.DEFAULT,{...t,type:Si.WARNING}),vs.warn=vs.warning,vs.success=(e,t)=>ps(e,Si.DEFAULT,{...t,type:Si.SUCCESS}),vs.loading=(e,t)=>
2ps(e,Si.DEFAULT,Qi(t,ds)),vs.dark=(e,t)=>ps(e,Si.DEFAULT,Qi(t,{theme:bi.DARK})),vs.remove=e=>{e?Hi.dismiss(e):Hi.clear()},vs.clearAll=(e,t)=>{Z(()=>{Hi.clear(e,t)})},vs.isActive=e=>{let t=!1;return t=hs().findIndex(t=>t.toastId===e)>-1,t},vs.update=(e,t={})=>{setTimeout(()=>{const n=function(e){return qi().find(t=>t.toastId===e)}(e);if(n){const i=ne(n),{content:s}=i,r={...i,...t,toastId:t.toastId||e,updateId:Yi()},o=r.render||s;delete r.render,ps(o,r.type,r)}},0)},vs.done=e=>{vs.update(e,{isLoading:!1,progress:1})},vs.promise=function(e,{pending:t,error:n,success:i},s){var r,o,a;let l;const c={...s||{},autoClose:!1};t&&(l=Ki(t)?vs.loading(t,c):vs.loading(t.render,{...c,...t}));const u={autoClose:null==(r=null==s?void 0:s.autoClose)||r,closeOnClick:null==(o=null==s?void 0:s.closeOnClick)||o,closeButton:null!=(a=null==s?void 0:s.autoClose)?a:null,isLoading:void 0,draggable:null,delay:100},d=(e,t,n)=>{if(null==t)return void vs.remove(l);const i={type:e,...u,...s,data:n},r=Ki(t)?{render:t}:t;return l?vs.update(l,{...i,...r,isLoading:!1}):vs(r.render,{...i,...r,isLoading:!1}),n},h=Ji(e)?e():e;return h.then(e=>{d("success",i,e)}).catch(e=>{d("error",n,e)}),h},vs.POSITION=wi,vs.THEME=bi,vs.TYPE=Si,vs.TRANSITIONS={BOUNCE:"bounce",SLIDE:"slide",FLIP:"flip",ZOOM:"zoom",NONE:"none"};const gs={install(e,t={}){Vi.useHandler=t.useHandler||(()=>{}),fs(t)}};function fs(e={}){!function(e={}){zi[`${Ti.CSS_NAMESPACE}-default-options`]=e}(Qi(Ei,e))}typeof window<"u"&&(window.Vue3Toastify=gs);const ms=e=>localStorage.getItem(e)||"",_s=ve("account",()=>{const e=X(),t=X(!1);return ge(()=>t.value,async()=>{try{const t=ms("token");if(!t)return;const{data:n}=await mt.get("https://stream.eagleailabs.com/api/v1/users/account",{headers:{Authorization:"Bearer "+t}});e.value=n.data}catch(t){console.error("[Account] Failed to fetch account data:",t)}},{immediate:!0}),{account:e,triggerRefresh:()=>t.value=!t.value}}),ys=ve("chartPersistence",()=>{const e=X(null),t=X(null),n=X(null);let i=null;const s=X(!1),r=X(null),o=X(""),a=X(""),l=X(localStorage.getItem("tradeview:exchange")??"Apex"),c=X(!1),u=X(!1),d=X(!1),h=["PreTrade","Trade","MirrorPretrade","MirrorTrade"],p=re(()=>!!r.value&&h.includes(r.value)),v=re(()=>p.value&&s.value&&null!==t.value),g=re(()=>{if(!t.value)return{display:"none"};const e=t.value;return{position:"fixed",top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`,zIndex:u.value?70:20,display:"block"}});return{activePlaceholderId:e,activePlaceholderRect:t,activeSlotId:n,chartVisible:s,currentRoute:r,compareSymbol:o,dominanceOf:a,exchange:l,isBlurred:c,isRaisedZIndex:u,isChartRoute:p,shouldShowChart:v,chartStyle:g,registerPlaceholder:function(r,o,a){e.value=r,n.value=o,t.value=a,s.value=!0,i=document.querySelector(`[data-chart-placeholder="${r}"]`)},updatePlaceholderRect:function(n,i){e.value===n&&(t.value=i)},recalculatePosition:function(){if(i){const e=i.getBoundingClientRect();e.width>0&&e.height>0&&(t.value=e)}},unregisterPlaceholder:function(r){e.value===r&&(e.value=null,t.value=null,n.value=null,i=null,s.value=!1)},setRoute:function(e){r.value=e,e&&h.includes(e)||(s.value=!1)},hideChart:function(){s.value=!1},showChart:function(){p.value&&t.value&&(s.value=!0)},setCompareSymbol:function(e){o.value=e},setDominanceOf:function(e){a.value=e},setExchange:function(e){l.value=e,localStorage.setItem("tradeview:exchange",e)},blurChart:function(){c.value=!0},unblurChart:function(){c.value=!1},raiseZIndex:function(){u.value=!0},lowerZIndex:function(){u.value=!1},setMenuOpen:function(e){d.value=e}}}),ws=ve("chartRegistryStore",()=>{const e=X({}),t=X(null),n=X(new Set);function i(){try{localStorage.setItem("claw_chart_registry",JSON.stringify({bySlotId:e.value,primarySlotId:t.value}))}catch{}}return function(){try{if(!sessionStorage.getItem("claw_session_id"))return sessionStorage.setItem("claw_session_id",String(Date.now())),e.value={},t.value=null,void localStorage.removeItem("claw_chart_registry");const n=localStorage.getItem("claw_chart_registry");if(n){const i=JSON.parse(n);e.value=i.bySlotId||{},t.value=i.primarySlotId||null}}catch{}}(),{bySlotId:e,primarySlotId:t,mountedSlots:n,get:function(t){return e.value[t]},setLocal:function(n,s){if(t.value!==n){if(e.value[n]={assetMode:"local",selectedSymbol:s},t.value===n){const i=Object.keys(e.value).find(t=>{var i;return t!==n&&"global"===(null==(i=e.value[t])?void 0:i.assetMode)}
2)||null;t.value=i}i()}},setGlobal:function(n,s){t.value&&t.value!==n&&(e.value[t.value]={assetMode:"local",selectedSymbol:s}),e.value[n]={assetMode:"global",selectedSymbol:""},t.value=n,i()},remove:function(n){e.value[n]&&delete e.value[n],t.value===n&&(t.value=null),i()},ensureDefaultFor:function(n,s){e.value[n]||(t.value?e.value[n]={assetMode:"global",selectedSymbol:""}:(e.value[n]={assetMode:"global",selectedSymbol:""},t.value=n),i())},registerMount:function(e){n.value.add(e)},unregisterMount:function(e){n.value.delete(e)},resetToSingleGlobal:function(n,s){e.value={[n]:{assetMode:"global",selectedSymbol:""}},t.value=n,i()}}}),bs=[{icon:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M13.3456 7.93281C13.5173 6.78656 12.644 6.17023 11.4507 5.75898L11.8379 4.20586L10.8929 3.9707L10.5155 5.48281C10.2673 5.42047 10.0124 5.3625 9.75813 5.30453L10.1382 3.78258L9.1932 3.54688L8.80602 5.09945C8.60039 5.05242 8.39805 5.00648 8.20227 4.95727L8.20336 4.95234L6.89961 4.62695L6.64805 5.63648C6.64805 5.63648 7.34969 5.79727 7.33492 5.80711C7.71773 5.90281 7.78664 6.15602 7.77516 6.35727L7.33437 8.12641C7.36063 8.13297 7.39453 8.14281 7.43281 8.15758L7.33273 8.13297L6.71477 10.6114C6.66773 10.7273 6.54906 10.9018 6.28109 10.8356C6.29094 10.8493 5.59422 10.6645 5.59422 10.6645L5.125 11.7462L6.35547 12.053C6.58406 12.1104 6.80828 12.1705 7.02867 12.2269L6.63766 13.7975L7.58211 14.0327L7.9693 12.4795C8.22742 12.549 8.47789 12.6135 8.72289 12.6748L8.3368 14.2213L9.2818 14.4565L9.67281 12.8891C11.285 13.1943 12.4969 13.0712 13.0071 11.6133C13.4184 10.4397 12.9869 9.76211 12.1387 9.32078C12.7566 9.17859 13.2215 8.77227 13.3456 7.93281ZM11.1855 10.9614C10.894 12.1355 8.91703 11.5006 8.27609 11.3415L8.79563 9.26062C9.43656 9.42086 11.4912 9.7375 11.1855 10.9614ZM11.478 7.91586C11.2117 8.98391 9.56672 8.44086 9.03352 8.30797L9.50383 6.42125C10.037 6.55414 11.7559 6.80188 11.478 7.91586Z"\n fill="#FF9500" />\n</svg>',label:"BTC",pair:"BTC/USD",value:"btc_usd"},{icon:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M12.728 9.00034L8.75071 2.63672L4.77344 9.00034L8.75071 11.3867L12.728 9.00034Z" fill="#1296DB"/>\n<path d="M12.728 9.79579L8.75071 15.364L4.77344 9.79579L8.75071 12.1821L12.728 9.79579Z" fill="#1296DB"/>\n</svg>\n',label:"ETH",pair:"ETH/USDT",value:"eth_usd"},{icon:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.88186 12.3505C3.97786 12.2525 4.10987 12.1954 4.24988 12.1954H16.9468C17.1788 12.1954 17.2948 12.4812 17.1308 12.6486L14.6226 15.2088C14.5266 15.3068 14.3946 15.3639 14.2546 15.3639H1.5577C1.32568 15.3639 1.20968 15.0781 1.37369 14.9107L3.88186 12.3505Z" fill="url(#paint0_linear_2816_52157)"/>\n<path d="M3.88186 2.79188C3.98187 2.69388 4.11387 2.63672 4.24988 2.63672H16.9468C17.1788 2.63672 17.2948 2.92254 17.1308 3.08995L14.6226 5.65011C14.5266 5.7481 14.3946 5.80527 14.2546 5.80527H1.5577C1.32568 5.80527 1.20968 5.51944 1.37369 5.35203L3.88186 2.79188Z" fill="url(#paint1_linear_2816_52157)"/>\n<path d="M14.6226 7.54053C14.5266 7.44253 14.3946 7.38537 14.2546 7.38537H1.5577C1.32568 7.38537 1.20968 7.67119 1.37369 7.8386L3.88186 10.3988C3.97786 10.4967 4.10987 10.5539 4.24988 10.5539H16.9468C17.1788 10.5539 17.2948 10.2681 17.1308 10.1007L14.6226 7.54053Z" fill="url(#paint2_linear_2816_52157)"/>\n<defs>\n<linearGradient id="paint0_linear_2816_52157" x1="15.7338" y1="-41.9012" x2="-17.942" y2="-26.1687" gradientUnits="userSpaceOnUse">\n<stop stop-color="#00FFA3"/>\n<stop offset="1" stop-color="#DC1FFF"/>\n</linearGradient>\n<linearGradient id="paint1_linear_2816_52157" x1="11.8916" y1="-11.7308" x2="-21.7842" y2="4.00162" gradientUnits="userSpaceOnUse">\n<stop stop-color="#00FFA3"/>\n<stop offset="1" stop-color="#DC1FFF"/>\n</linearGradient>\n<linearGradient id="paint2_linear_2816_52157" x1="13.8005" y1="0.076964" x2="4.72661" y2="17.1042" gradientUnits="userSpaceOnUse">\n<stop stop-color="#00FFA3"/>\n<stop offset="1" stop-color="#DC1FFF"/>\n</linearGradient>\n</defs>\n</svg>\n',label:"SOL",pair:"SOL/USDT",value:"sol_usd"}],Ss="claw_last_token_v1",Es=ve("clawStore",()=>{const e=X(function(){try{const e=localStorage.getItem(Ss);if(e){const t=JSON.parse(e),n="string"==typeof(null==t?void 0:t.label)?t.label.toUpperCase():"";if(n)return bs.find(e=>e.label===n)||{icon:"",label:n,pair:"string"==typeof(null==t?void 0:t.pair)?t.pair:`${n}/USDT`,value:"string"==typeof(null==t?void 0:t.value)?t.value:`${n.toLowerCase()}_usd`}}}catch{}return bs[0]}()),t=X(1),n=X(!1),i=X((new Date).toLocaleTimeString()),s=X("Apex"),r=X(!1),o=X(0);return{token:e,timeframe:t,loading:n,updateTime:i,isIPCMode:r,exchange:s,refreshTick:o,setExchange:function(e){s.value=e},setToken:function(t){e.value=t;try{localStorage.setItem(Ss,JSON.stringify({label:t.label,pair:t.pair,value:t.value}))}catch{}},setTimeframe:function(e){t.value=e},setLoading:function(e){n.value=e},setUpdateTime:function(e){i.value=e},setIPCMode:function(e){r.value=e},refreshPage:function(){o.value+=1,i.value=(new Date).toLocaleTimeString()}}}),Ts={BLASTUSDT:"BYBIT",IPUSDT:"BYBIT",MEWUSDT:"BYBIT",METHUSDT:"BYBIT",SUNDOGUSDT:"BYBIT",LAUNCHCOINUSDT:"MEXC",MELANIAUSDT:"KRAKEN",AI16ZUSDT:"BYBIT",FARTCOINUSDT:"BITGET",GOATUSDT:"BYBIT",HIPPOUSDT:"HTX",HYPEUSDT:"BYBIT",MUSDT:"MEXC",MYXUSDT:"BITGET",NEIROETHUSDT:"BITGET",POPCATUSDT:"BYBIT",PUMPUSDT:"BYBIT",USELESSUSDT:"MEXC",UXLINKUSDT:"BYBIT",MOGUSDT:"BYBIT",MOODENGUSDT:"BITGET",RONUSDT:"BITGET",XPLUSDT:"BITGET"},xs={},Cs=new Set(["1_CUT_25BPS_FED_RATE_2025USDT","2_CUTS_25BPS_FED_RATE_2025USDT","3_CUTS_25BPS_FED_RATE_2025USDT","4_CUTS_25BPS_FED_RATE_2025USDT","BTC_HIT_115K_JULYUSDT","BTC_HIT_130K_DECUSDT","BTC_HIT_130K_JULYUSDT","DONALD_TRUMP_WIN_PRESIDENTIAL_ELECTION_2028USDT","DONALD_TRUMP_WINS_NOBEL_PEACE_PRIZE_2025USDT","ETH_ABOVE_2500_JULY04USDT","
2ETH_ABOVE_2500_JULY09USDT","ETH_HIT_2900_JULYUSDT","ETH_HIT_4000_DECUSDT","ETH_HIT_4000_JULYUSDT","ETH_HIT_5000_DECUSDT","EARTHQUAKE_7_OR_ABOVE_SEPTUSDT","ELON_MUSK_CREATE_NEW_POLITICAL_PARTY_DEC31USDT","F1_CHAMPION_OSCAR_PIASTRI_2025USDT","FED_INTEREST_RATES_NO_CHANGE_JULYUSDT","FED_INTEREST_RATES_NO_CHANGE_SEPTUSDT","GPT5_RELEASED_AUG31USDT","GOOGLE_HAS_BEST_AI_MODEL_JULYUSDT","ISRAEL_HAMAS_CEASEFIRE_JULY15USDT","JEROME_POWELL_OUT_AS_FED_CHAIR_2025USDT","NVIDIA_LARGEST_COMPANY_2025USDT","PUMP_FUN_MARKET_CAP_ABOVE_4B_AFTER_LAUNCHUSDT","SOL_HIT_140_DECUSDT","ZOHRAN_MAMDANI_WIN_NYC_MAYORAL_ELECTIONUSDT","CBBTCUSDT","CMETHUSDT","RNDRUSDT","RENDERUSDT","WETHUSDT","FIGHTUSDT","HPOS10IUSDT","USDEUSDT","XPLUSDT","BTCUSDC","ETHUSDC","SOLUSDC","XRPUSDC","DOGEUSDC","ADAUSDC","TRXUSDC","LINKUSDC","AVAXUSDC","BCHUSDC","LTCUSDC","DOTUSDC","MATICUSDC","UNIUSDC","ATOMUSDC","NEARUSDC","APTUSDC","SUIUSDC","OPUSDC","ARBUSDC","PEPEUSDC","SHIBUSDC","BONKUSDC","WBTCUSDC","DAIUSDC","USDCUSDT","GOLDUSDT","GOLD_USDT","XAUUSDT","GOLD_CLOSE_ABOVE_3000_JAN31USDT","GOLD_CLOSE_ABOVE_3100_JAN31USDT","RUSSIAUSDT","UKRAINEUSDT","RUSSIA_USDT","UKRAINE_USDT","RUSSIA_UKRAINE_CEASEFIRE_JAN31USDT","RUSSIA_UKRAINE_PEACE_DEAL_JAN31USDT","KTAUSDT"]);function As(e,t){const n=(e||"").trim().toUpperCase(),i=(t||"").trim().toUpperCase();return i&&Ts[i]?Ts[i]:xs[n]?xs[n]:"APEX"}const Ps=[/_(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|JULY|AUG|SEP|SEPT|OCT|NOV|DEC)\d*USDT$/i,/(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|JULY|AUG|SEP|SEPT|OCT|NOV|DEC)\d{2}USDT$/i,/_20\d{2}USDT$/i,/_HIT_\d+[KM]?_/i,/_ABOVE_\d+/i,/_BELOW_\d+/i,/_CLOSE_ABOVE_/i,/_CLOSE_BELOW_/i,/_WIN_/i,/_WINS_/i,/_CHAMPION_/i,/_RELEASED_/i,/_CEASEFIRE_/i,/_PEACE_/i,/_ELECTION/i,/_RATE_/i,/_RATES_/i,/_NO_CHANGE_/i,/_CUT_/i,/_CUTS_/i,/^FED_/i,/_FED_/i,/^FOMC_/i,/_FOMC_/i,/_INTEREST_/i,/_BPS_/i,/^DONALD_TRUMP/i,/^ELON_MUSK/i,/^JEROME_POWELL/i,/_LARGEST_COMPANY_/i,/_BEST_AI_MODEL_/i,/_MARKET_CAP_ABOVE_/i,/^EARTHQUAKE_/i,/^[A-Z]+_[A-Z]+_[A-Z]+.*\d+.*USDT$/i];function ks(e){const t=(e||"").toUpperCase();return!!Cs.has(t)||function(e){const t=(e||"").toUpperCase();return!!t.includes("_")&&Ps.some(e=>e.test(t))}(t)}const Ls={"1000PEPEUSDT":"PEPEUSDT","1000SHIBUSDT":"SHIBUSDT","1000BONKUSDT":"BONKUSDT","1000000MOGUSDT":"MOGUSDT",RENDERUSDT:"RNDRUSDT"};function Is(e){const t=(e||"").toUpperCase();return Ls[t]||t}const Ds=class e extends EventTarget{constructor(e){super(),W(this,"url","wss://stream.eagleailabs.com/claw"),W(this,"status"),W(this,"stableStatus","connecting"),W(this,"ws"),W(this,"timeout"),W(this,"subscriptionCounts",new Map),W(this,"pendingSubscriptions",new Set),W(this,"connectionLock",!1),W(this,"alternateAssets",{MOGUSDT:"1000000MOGUSDT",BONKUSDT:"1000BONKUSDT",PEPEUSDT:"1000PEPEUSDT",SHIBUSDT:"1000SHIBUSDT"}),W(this,"config"),W(this,"SYNC_LOCK",!1),W(this,"syncLockTimeout",null),W(this,"hasConnectedBefore",!1),W(this,"reconnectAttempts",0),W(this,"reconnectTimeout",null),W(this,"stableStatusTimeout",null),W(this,"lastSuccessfulConnection",0),W(this,"channelLastMessageAt",{}),this.config=e}updateStableStatus(t){return this.stableStatusTimeout&&(clearTimeout(this.stableStatusTimeout),this.stableStatusTimeout=null),"connected"===t?(this.stableStatus="connected",void this.dispatchEvent(new MessageEvent("stableStatus",{data:this.stableStatus}))):"connecting"===t&&"disconnected"===this.stableStatus?(this.stableStatus="connecting",void this.dispatchEvent(new MessageEvent("stableStatus",{data:this.stableStatus}))):void("disconnected"===t&&(this.stableStatusTimeout=setTimeout(()=>{this.stableStatus="disconnected",this.dispatchEvent(new MessageEvent("stableStatus",{data:this.stableStatus}))},e.STABLE_STATUS_GRACE_MS)))}getReconnectDelay(){return Math.min(e.BASE_RECONNECT_DELAY_MS*Math.pow(2,this.reconnectAttempts),e.MAX_RECONNECT_DELAY_MS)}resetReconnectAttempts(){this.reconnectAttempts=0}resetCooldown(){this.lastSuccessfulConnection=0,this.reconnectAttempts=0}subs(){var e;(null==(e=this.config)?void 0:e.customConnection)||["@twitter.all","@instrumental.full","@instrumental","@predictions","@predictions.v2","@prices","@global-stocks"].forEach(e
2=>{this.subscribe(e)})}subscribe(e){const[t,n]=e.split("@");e=this.getAlternateSymbolName(t)+"@"+n;const i=this.subscriptionCounts.get(e)??0;if(this.subscriptionCounts.set(e,i+1),!this.ws||"connected"!==this.status)return this.pendingSubscriptions.add(e),!1;if(i>0)return!0;try{const t=ms("token");return this.ws.send(JSON.stringify({action:"authenticate",token:t})),this.ws.send(JSON.stringify({action:"subscribe",channel:e})),this.pendingSubscriptions.delete(e),!0}catch(s){return console.error(`Failed to subscribe to ${e}:`,s),this.subscriptionCounts.set(e,i),0===i&&this.subscriptionCounts.delete(e),!1}}unsubscribe(e){const[t,n]=e.split("@");e=this.getAlternateSymbolName(t)+"@"+n;const i=this.subscriptionCounts.get(e)??0;if(i<=0)return this.pendingSubscriptions.delete(e),!0;if(i>1)return this.subscriptionCounts.set(e,i-1),!0;if(this.subscriptionCounts.delete(e),this.pendingSubscriptions.delete(e),!this.ws||"connected"!==this.status)return!0;try{return this.ws.send(JSON.stringify({action:"unsubscribe",channel:e})),!0}catch(s){return console.error(`Failed to unsubscribe from ${e}:`,s),!1}}isSubscribed(e){const[t,n]=e.split("@"),i=this.getAlternateSymbolName(t)+"@"+n;return(this.subscriptionCounts.get(i)??0)>0}getActiveSubscriptions(){return Array.from(this.subscriptionCounts.keys())}getPendingSubscriptions(){return Array.from(this.pendingSubscriptions)}processPendingSubscriptions(){this.pendingSubscriptions.size>0&&Array.from(this.pendingSubscriptions).forEach(e=>{this.subscribe(e)})}restoreActiveSubscriptionsOnReconnect(){if(!this.ws||"connected"!==this.status)return;if(0===this.subscriptionCounts.size)return;const e=ms("token");try{this.ws.send(JSON.stringify({action:"authenticate",token:e}));for(const e of this.subscriptionCounts.keys())this.ws.send(JSON.stringify({action:"subscribe",channel:e})),this.pendingSubscriptions.delete(e)}catch(t){console.error("[Socket] Failed to restore subscriptions after reconnect:",t)}}startSyncLock(){this.syncLockTimeout&&clearTimeout(this.syncLockTimeout),this.SYNC_LOCK=!0,this.syncLockTimeout=setTimeout(()=>{this.SYNC_LOCK=!1},e.SYNC_LOCK_DURATION_MS)}startSyncLockFromVisibility(){this.SYNC_LOCK||this.startSyncLock()}enableSyncLockForHidden(){this.syncLockTimeout&&(clearTimeout(this.syncLockTimeout),this.syncLockTimeout=null),this.SYNC_LOCK=!0}scheduleSyncLockRelease(){this.syncLockTimeout&&clearTimeout(this.syncLockTimeout),this.syncLockTimeout=setTimeout(()=>{this.SYNC_LOCK=!1,this.refreshSubscriptions()},e.SYNC_LOCK_DURATION_MS)}refreshSubscriptions(){"connected"===this.status&&0!==this.subscriptionCounts.size&&Array.from(this.subscriptionCounts.keys()).forEach(e=>{try{this.ws.send(JSON.stringify({action:"unsubscribe",channel:e})),setTimeout(()=>{"connected"===this.status&&this.ws.send(JSON.stringify({action:"subscribe",channel:e}))},50)}catch(t){console.error("[Socket] Failed to refresh subscription:",e,t)}})}connect(t){if(this.connectionLock)return;const n=Date.now()-this.lastSuccessfulConnection;if(this.lastSuccessfulConnection>0&&n<e.CONNECTION_COOLDOWN_MS){const i=e.CONNECTION_COOLDOWN_MS-n;return void(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,"disconnected"===this.status&&this.connect(t)},i+100)))}this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.ws&&this.ws.close(),this.status="connecting",this.updateStableStatus("connecting"),this.connectionLock=!0,setTimeout(()=>this.connectionLock=!1,5e3),this.dispatchEvent(new MessageEvent("status",{data:this.status})),this.ws=new WebSocket(this.url),this.ws.onopen=()=>{var e;this.status="connected",this.updateStableStatus("connected"),this.dispatchEvent(new MessageEvent("status",{data:this.status})),this.connectionLock=!1,this.lastSuccessfulConnection=Date.now(),this.reconnectAttempts=0,!(null==(e=this.config)?void 0:e.customConnection)&&this.hasConnectedBefore&&this.startSyncLock(),this.hasConnectedBefore=!0,this.subs(),this.restoreActiveSubscriptionsOnReconnect(),this.processPendingSubscriptions()};let i=null,s=0;this.ws.onmessage=e=>{if(this.SYNC_LOCK)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.channel){if(this.channelLastMessageAt[t.channel]&&Date.now()-this.channelLastMessageAt[t.channel]<100)return;this.channelLastMessageAt[t.channel]=Date.now();const e=t.channel,[n,i]=e.split("@");t.channel=this.getMainSymbolFromAlternateSymbol(n)+"@"+i}this.dispatchEvent(new MessageEvent("message",{data:t}));const n=Date.now();n-s>2e3&&(s=n,i||(i=Es()),i.setUpdateTime((new Date).toLocaleTimeString()))}
2,this.ws.onclose=e=>{var n;if(this.status="disconnected",this.updateStableStatus("disconnected"),this.dispatchEvent(new MessageEvent("status",{data:this.status})),!(null==(n=this.config)?void 0:n.manuallyReconnect)){const e=this.getReconnectDelay();this.reconnectAttempts++,this.reconnectTimeout=setTimeout(()=>this.connect(t),e)}},this.ws.onerror=e=>{this.status="disconnected",this.updateStableStatus("disconnected"),this.dispatchEvent(new MessageEvent("status",{data:this.status}))}}reconnect(e){if("connecting"!==this.status&&"connected"!==this.status&&(this.connect(e),e))for(const t of e)this.subscribe(t)}getAlternateSymbolName(e){return this.alternateAssets[e]??e}getMainSymbolFromAlternateSymbol(e){for(const[t,n]of Object.entries(this.alternateAssets))if(n===e)return t;return e}};W(Ds,"SYNC_LOCK_DURATION_MS",3e3),W(Ds,"BASE_RECONNECT_DELAY_MS",2e3),W(Ds,"MAX_RECONNECT_DELAY_MS",3e4),W(Ds,"STABLE_STATUS_GRACE_MS",4e3),W(Ds,"CONNECTION_COOLDOWN_MS",5e3);let Os=Ds;const Ns=new Os;Ns.connect();const Ms=new Os({customConnection:!0});Ms.connect(),"undefined"!=typeof document&&document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?(Ns.enableSyncLockForHidden(),Ms.enableSyncLockForHidden()):"visible"===document.visibilityState&&(Ns.scheduleSyncLockRelease(),Ms.scheduleSyncLockRelease(),"disconnected"===Ns.status&&(Ns.resetCooldown(),Ns.connect()),"disconnected"===Ms.status&&(Ms.resetCooldown(),Ms.connect()))});const $s=(...e)=>{},Rs={1:"1",3:"3",5:"5",15:"15",30:"30",60:"60",120:"120",240:"240",360:"360",480:"480",720:"720","1D":"D","1W":"W","1M":"M"},Fs=new EventTarget,Us=class e{constructor(){W(this,"socket",null),W(this,"subscribers",new Map),W(this,"resetCallbacks",new Map),W(this,"lastBars",new Map),W(this,"resolutions",new Map),W(this,"lastUpdateTime",new Map),W(this,"pendingBars",new Map),W(this,"pendingFlush",new Map),W(this,"lastHeartbeat",Date.now()),W(this,"lastBarUpdateTime",Date.now()),W(this,"INITIAL_LOAD_HAS_OCCURED",!1),W(this,"IS_RECONNECTING",!1),W(this,"connectionStatus","connecting"),W(this,"lastBarInfo",null),W(this,"SYNC_LOCK",!1),W(this,"reconnectingAt",0),W(this,"hiddenAt",0),this.socket=new Os({customConnection:!0,manuallyReconnect:!0}),this.socket.connect(),this.socket.addEventListener("message",this.handleSocketMessage.bind(this)),this.socket.addEventListener("status",this.handleStatusUpdate.bind(this)),this.connectionWatcher(),"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this))}handleVisibilityChange(){var e,t;if(document.hidden)this.hiddenAt=Date.now(),null==(e=this.socket)||e.enableSyncLockForHidden();else{const e=this.hiddenAt?Date.now()-this.hiddenAt:0;this.hiddenAt=0,this.lastHeartbeat=Date.now(),e>3e4&&(this.IS_RECONNECTING||(this.IS_RECONNECTING=!0,this.reconnectingAt=Date.now()-e)),null==(t=this.socket)||t.scheduleSyncLockRelease()}}handleSocketMessage(e){let t=!1,n=0;if(!this.SYNC_LOCK)try{const i=e.data;if(i.channel,"@prices.500ms"===i.channel&&i.data){const e=i.data;this.lastHeartbeat=Date.now(),this.IS_RECONNECTING&&(this.SYNC_LOCK=!0,setTimeout(()=>{this.SYNC_LOCK&&(this.SYNC_LOCK=!1)},5e3),this.IS_RECONNECTING=!1,t=!0,n=this.reconnectingAt,this.reconnectingAt=0,Fs.dispatchEvent(new MessageEvent("status",{data:"connected"}))),Object.keys(e).length,this.subscribers.size,this.subscribers.forEach(async(i,s)=>{const[r]=s.split("_"),o=e[r],a=this.lastBars.get(s),l=this.resolutions.get(s)||"1";if(t&&n>0&&a)try{await this.fillGapBars(s,r,l,a,i)}finally{this.SYNC_LOCK=!1}if(o){const e=parseFloat(o);e&&e>0&&this.ingestPriceTick(s,r,l,e,i)}})}}catch(i){console.error("[TradingView Datafeed] Error handling socket message:",i)}}handleStatusUpdate(e){"connected"===e.data&&(this.connectionStatus=e.data)}sessionBarKey(e,t){return`claw_tv_maxbar_${e}_${t}`}readMaxBarTime(e,t){try{const n=sessionStorage.getItem(this.sessionBarKey(e,t));return n&&parseInt(n,10)||0}catch{return 0}}writeMaxBarTime(e,t,n){try{n>this.readMaxBarTime(e,t)&&sessionStorage.setItem(this.sessionBarKey(e,t),String(n))}catch{}}ingestPriceTick(t,n,i,s,r){const o=this.lastBars.get(t);if(!o)return;const a=Math.abs(s-o.close)/o.close;if(a>e.RESET_ON_JUMP_PCT){console.warn("[TradingView Datafeed] Anomalous jump â requesting cache reset:",n,"oldClose:",o.close,"newPrice:",s,"changePct:",(100*a
2).toFixed(2)+"%");const e=this.resetCallbacks.get(t);return void(e&&e())}const l=1e3*this.getResolutionSeconds(i),c=Date.now(),u=Math.floor(c/l)*l;if(u>o.time){this.flushPending(t,r);const e={time:u,open:s,high:s,low:s,close:s,volume:0};return this.lastBars.set(t,e),this.lastBarInfo={time:e.time,resolution:i},this.writeMaxBarTime(n,i,e.time),void this.emitBar(t,e,r)}if(u<o.time)return;const d=this.pendingBars.get(t),h=d?{...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:{time:o.time,open:o.open,high:Math.max(o.high,s),low:Math.min(o.low,s),close:s,volume:o.volume||0};this.pendingBars.set(t,h),this.scheduleFlush(t,r)}scheduleFlush(t,n){if(this.pendingFlush.has(t))return;const i=this.lastUpdateTime.get(t)||0,s=Date.now()-i,r=Math.max(0,e.EMIT_THROTTLE_MS-s),o=window.setTimeout(()=>{this.pendingFlush.delete(t),this.flushPending(t,n)},r);this.pendingFlush.set(t,o)}flushPending(e,t){const n=this.pendingBars.get(e);if(!n)return;this.pendingBars.delete(e);const i=this.lastBars.get(e);i&&n.time<i.time||(this.lastBars.set(e,n),this.emitBar(e,n,t))}emitBar(e,t,n){this.lastUpdateTime.set(e,Date.now()),this.lastBarUpdateTime=Date.now();const i={time:t.time,open:t.open,high:t.high,low:t.low,close:t.close,volume:t.volume};setTimeout(()=>{try{n(i)}catch(e){console.error("[TradingView Datafeed] callback threw:",e)}},0)}connectionWatcher(){var e;const t=Date.now();!document.hidden&&t-this.lastHeartbeat>8e3&&this.INITIAL_LOAD_HAS_OCCURED&&!this.IS_RECONNECTING&&(this.IS_RECONNECTING=!0,this.reconnectingAt||(this.reconnectingAt=Date.now()),Fs.dispatchEvent(new MessageEvent("status",{data:"reconnecting"})),null==(e=this.socket)||e.reconnect(["@prices.500ms"])),setTimeout(this.connectionWatcher.bind(this),2e3)}transformCandlestcik(e){let t=parseInt(e.time||e.t||e.start||e[0]);return t>0&&t<1e10&&(t*=1e3),{time:t,open:parseFloat(e.open||e.o||e[1]),high:parseFloat(e.high||e.h||e[2]),low:parseFloat(e.low||e.l||e[3]),close:parseFloat(e.close||e.c||e[4]),volume:parseFloat(e.volume||e.v||e.vol||e.volume_usd||e[5]||"0")}}getResolutionSeconds(e){const t=String(e).toUpperCase();if("1D"===t||"D"===t)return 86400;if("1W"===t||"W"===t)return 604800;if("1M"===t||"M"===t)return 2592e3;const n=parseInt(e);return 60*(isNaN(n)?1:n)}async fillGapBars(t,n,i,s,r){var o;const a=(null==(o=localStorage.getItem("tradeview:exchange"))?void 0:o.toLowerCase())??"apex",l=this.getResolutionSeconds(i),c=Math.floor(Date.now()/1e3),u=Math.floor(s.time/1e3);if(c-u<l)return s;const d={from:u,to:c,timeframe:Rs[i]||i,exchange:a,symbol:n};try{const o=await this.fetchCandlesticks(d,2);let a=Array.isArray(o)?o:(null==o?void 0:o[n])??[];if(!Array.isArray(a)&&a&&"object"==typeof a){const e=Object.keys(a)[0];e&&Array.isArray(a[e])&&(a=a[e])}if(!Array.isArray(a)||0===a.length)return s;const l=a.map(e=>this.transformCandlestcik(e)).filter(e=>e.time>0&&isFinite(e.open)&&isFinite(e.close)).sort((e,t)=>e.time-t.time).filter((e,t,n)=>0===t||e.time!==n[t-1].time),c=l.filter(e=>e.time>s.time);if(c.length>e.MAX_FILL_BARS){c.length;const e=this.resetCallbacks.get(t);return e&&(this.SYNC_LOCK=!1,e()),s}const u=this.lastBars.get(t);let h=u&&u.time>s.time?u:s;const p=this.readMaxBarTime(n,i);p>h.time&&(h={...h,time:p});for(const e of l)(e.time>h.time||e.time===h.time)&&(r(e),h=e);return this.lastBars.set(t,h),this.lastUpdateTime.set(t,Date.now()),this.lastBarUpdateTime=Date.now(),this.lastBarInfo={time:h.time,resolution:i},this.writeMaxBarTime(n,i,h.time),h}catch(h){return console.error("[TradingView Datafeed] fillGapBars error:",h),s}}async fetchCandlesticks(e,t=0){try{return(await mt.post("https://claw-proxy-server.owoadeanuoluwapo2.workers.dev/tv",e)).data.data}catch(n){return t>0?(await new Promise(e=>setTimeout(e,100)),this.fetchCandlesticks(e,t-1)):(console.error(n),[])}}onReady(e){setTimeout(()=>{e({supported_resolutions:["1","5","15","60","240","1D"]})},0)}searchSymbols(e,t,n,i){i([])}getPricescaleForSymbol(e){const t=Array.from(this.lastBars.keys());for(const i of t)if(i.startsWith(e)){const e=this.lastBars.get(i);if(e&&e.close>0)return this.calculatePricescale(e.close)}const n=e.toUpperCase();return["SHIBUSDT","PEPEUSDT","BONKUSDT","FLOKIUSDT","LUNCUSDT","BTTUSDT","HOTUSDT","MOGUSDT"].includes(n)?1e8:(["OPUSDT","DOGEUSDT","ADAUSDT","XRPUSDT","MATICUSDT","ALGOUSDT","VETUSDT","ZILUSDT","TRXUSDT","XLMUSDT","HBARUSDT","FTMUSDT","CHZUSDT","MANAUSDT","SANDUSDT","GALAUSDT","APEUSDT","FLRUSDT"].includes(n),1e4)}calculatePricescale(e){const t=Math.abs(e);return 0===t?1e4:t<1e-4?1e8:t<.001?1e7:t<.01?1e6:t<.1?1e5:t<1?1e4:t<10?1e3:100}resolveSymbol(e,t,n){if(e.includes("/")||e.includes(".D")||e.includes("CRYPTOCAP:"))return void setTimeout(()=>n("Ratio and dominance symbols not supported by custom datafeed"),0);const i=Is(e),s=(localStorage.getItem("tradeview:exchange")||"apex").toUpperCase(),r={name:i,ticker:i,description:`${i} / Tether`,type:"crypto",session:"24x7",exchange:s,listed_exchange:s,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"Etc/UTC",format:"price",pricescale:this.getPricescaleForSymbol(i),minmov:1,has_intraday:!0,has_daily:!0,has_weekly_and_monthly:!0,supported_resolutions:["1","3","5","15","30","60","120","240","360","480","720","1D","1W","1M"],volume_precision:2,data_status:"streaming"};setTimeout(()=>t(r),0)}getBars(e,t,n,i,s){const{from:r,to:o,firstDataRequest:a}=n;
2e.name,new Date(1e3*r).toISOString(),new Date(1e3*o).toISOString(),this.fetchBinanceKlines(e.name,t,r,o).then(t=>{if(t.length,e.name,0===t.length)i([],{noData:!0});else{const n=t[t.length-1];if(n){JSON.stringify({time:n.time,timeISO:new Date(n.time).toISOString(),open:n.open,high:n.high,low:n.low,close:n.close,volume:n.volume}),this.lastBars.set(e.name,n);this.calculatePricescale(n.close)!==e.pricescale&&(e.pricescale,n.close)}i(t,{noData:!1})}this.INITIAL_LOAD_HAS_OCCURED=!0}).catch(e=>{console.error("[TradingView Datafeed] Error fetching bars:",e),s(e.message||"Failed to fetch data")})}async fetchBinanceKlines(e,t,n,i){const s=Is(e);return await this.fetchApexKlines(s,t,n,i)}async fetchApexKlines(e,t,n,i){var s;const r=Rs[t]||"60";localStorage.setItem("tradeview:interval",t||"60");const o=[],a=parseInt(t)||60,l="1D"===t?86400:"W"===t?604800:"M"===t?2592e3:60*a,c=(null==(s=localStorage.getItem("tradeview:exchange"))?void 0:s.toLowerCase())??"apex",u="apex"===c?200:1e3,d=Math.ceil((i-n)/l),h=Math.ceil(d/u),p=Math.min(h,20);for(let f=0;f<p;f++){const t=i-f*u*l,s={from:Math.max(n,t-u*l),to:t,timeframe:r,exchange:c,symbol:e},a="https://claw-proxy-server.owoadeanuoluwapo2.workers.dev";try{const e=(await mt.post(`${a}/tv`,s)).data;let t=e.data||e;if($s(),!Array.isArray(t)&&"object"==typeof t){const e=Object.keys(t)[0];if(!e||!Array.isArray(t[e]))throw console.error("[TradingView Datafeed] ApeX API returned non-array data:",t),new Error("ApeX API returned invalid data format");t=t[e]}if(!Array.isArray(t))throw console.error("[TradingView Datafeed] ApeX API data is not an array:",t),new Error("ApeX API returned invalid data format");const n=t.map((e,t)=>{let n=parseInt(e.start||e.t||e.time||e[0]);return n<1e10&&(n*=1e3),0===f&&0===t&&(e.volume,e.v,e.vol),{time:n,open:parseFloat(e.open||e.o||e[1]),high:parseFloat(e.high||e.h||e[2]),low:parseFloat(e.low||e.l||e[3]),close:parseFloat(e.close||e.c||e[4]),volume:parseFloat(e.volume||e.v||e.vol||e.volume_usd||e[5]||"0")}});if(o.push(...n),t.length<u){$s();break}f<p-1&&await new Promise(e=>setTimeout(e,100))}catch(g){console.error(`[TradingView Datafeed] ApeX - Error fetching batch ${f+1}:`,g);break}}const v=o.sort((e,t)=>e.time-t.time).filter((e,t,n)=>0===t||e.time!==n[t-1].time);return v.length>0&&(new Date(v[0].time).toISOString(),new Date(v[v.length-1].time).toISOString(),v.length),v}subscribeBars(e,t,n,i,s){e.name;const r=`${e.name}_${t}_${i}`;this.subscribers.set(r,n),this.resolutions.set(r,t),this.resetCallbacks.set(r,s);const o=this.lastBars.get(e.name);if(o&&this.lastBars.set(r,o),this.socket&&this.socket.subscribe("@prices.500ms"),o){this.SYNC_LOCK=!0;const i=window.setTimeout(()=>{this.SYNC_LOCK&&(this.SYNC_LOCK=!1)},1e4);this.fillGapBars(r,e.name,t,o,n).catch(e=>console.error("[TradingView Datafeed] Initial gap-fill failed:",e)).finally(()=>{this.SYNC_LOCK=!1,window.clearTimeout(i),this.INITIAL_LOAD_HAS_OCCURED=!0})}else this.INITIAL_LOAD_HAS_OCCURED=!0}unsubscribeBars(e){const t=[];this.subscribers.forEach((n,i)=>{i.endsWith(`_${e}`)&&t.push(i)}),t.forEach(e=>{this.subscribers.delete(e),this.lastBars.delete(e),this.resolutions.delete(e),this.resetCallbacks.delete(e),this.lastUpdateTime.delete(e),this.pendingBars.delete(e);const t=this.pendingFlush.get(e);t&&(window.clearTimeout(t),this.pendingFlush.delete(e))})}};W(Us,"MAX_FILL_BARS",50),W(Us,"RESET_ON_JUMP_PCT",.15),W(Us,"EMIT_THROTTLE_MS",100);let Bs=Us;const qs=()=>{const e=X(!1);return{isOpen:e,onOpen:()=>e.value=!0,onClose:()=>e.value=!1}};function js(e,t=32){if(!e)return"";let n=e.replace(/USDT$/i,"").replace(/USDC$/i,"").replace(/PERP$/i,"").replace(/-USDT$/i,"").trim().toLowerCase();n=n.replace(/^1000000/,"").replace(/^1000/,"");const i="svg"===t?"svg":"png";return`/Crypto_ICONS/${"svg"===t?"SVG":t.toString()}/${n}.${i}`}function Ws(e,t){var n;const i=e.target;if(!i)return;if("true"!==i.dataset.fallbackAttempted&&(i.dataset.fallbackAttempted="true",t)){const e=js(t,32);if(!i.src.endsWith(e))return void(i.src=e)}if(i.style.display="none","true"===i.dataset.badgeInserted)return;i.dataset.badgeInserted="true";const s=(t||i.alt||"?").charAt(0).toUpperCase(),r=document.createElement("span");r.textContent=s,r.style.cssText=`display:inline-flex;align-items:center;justify-content:center;border-radius:9999px;background:rgba(34,211,238,0.12);color:#22d3ee;font-weight:700;flex-shrink:0;width:${i.width||24}px;height:${i.height||24}px;font-size:${Math.max(8,.45*(i.width||24))}px`,null==(n=i.parentNode)||n.insertBefore(r,i)}function Hs(e,t){return e?e.startsWith("http://")||e.startsWith("https://")||e.includes("Crypto_ICONS")?e:/^\/?\w[\w\d]*\.png$/i.test(e.trim())?js(e.replace(/^\//,"").replace(/\.png$/i,""),32):(!e.includes("/")||e.split("/").filter(
2Boolean).length<=1)&&t?js(t,32):e:t?js(t,32):""}function Vs(e){if(!e)return"linear-gradient(135deg, #1870f6 0%, #00ffff 100%)";const t=["linear-gradient(135deg, #1870f6 0%, #00ffff 100%)","linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%)","linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)","linear-gradient(135deg, #10b981 0%, #34d399 100%)","linear-gradient(135deg, #ef4444 0%, #f87171 100%)","linear-gradient(135deg, #ec4899 0%, #f472b6 100%)","linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%)","linear-gradient(135deg, #6366f1 0%, #818cf8 100%)"];return t[e.charAt(0).toUpperCase().charCodeAt(0)%t.length]}const zs="claw_position_leverages",Gs=()=>{try{const e=localStorage.getItem(zs);return e?JSON.parse(e):{}}catch{return{}}},Ys="claw_mobile_trade_payload",Ks=()=>{try{const e=localStorage.getItem(Ys);return e?JSON.parse(e):null}catch{return null}},Js=e=>{try{localStorage.setItem(Ys,JSON.stringify(e))}catch(t){console.warn("Failed to save mobile trade payload:",t)}},Qs=()=>{try{localStorage.removeItem(Ys)}catch(e){console.warn("Failed to clear mobile trade payload:",e)}},Xs=(e,t)=>`${e}_${t}`,Zs=(e,t,n)=>{const i=Gs();i[Xs(e,t.toUpperCase())]=n,(e=>{try{localStorage.setItem(zs,JSON.stringify(e))}catch(t){console.warn("Failed to save position leverages:",t)}})(i)},er=(e,t)=>Gs()[Xs(e,t.toUpperCase())]||1,tr=ve("tradeStore",()=>{const{isOpen:e,onOpen:t,onClose:n}=qs(),i=X(0),s=Es(),r=X(!0),o=X([]),a=X(o.value[0]),l=X(),c=re(()=>{var e;return null==(e=l.value)?void 0:e.find(e=>e.baseTokenId==s.token.label)}),u=X([]),d=X([]),h=X(),p=X([]),v=X([]),g=X(!1);return ge(c,()=>{var e;o.value=[];const t=(null==(e=c.value)?void 0:e.riskLimitConfig.imrSteps)||[],n=[];for(let i=0;i<t.length;i++){const e=1/+t[i];n.push(e)}o.value=n.reverse(),a.value&&o.value.includes(a.value)||(a.value=o.value[0])},{immediate:!0}),{isLoading:g,isLeverageOpen:e,onLeverageOpen:t,onLeverageClose:n,leverageAnchorY:i,setLeverageAnchor:e=>{i.value=e},steps:o,leverage:a,symbols:l,symbol:c,positions:u,assets:d,balance:h,historicalOrders:p,historicalPnl:v,trigger:r,fireTrigger:()=>r.value=!r.value,updateLeverage:e=>a.value=e,updateSymbols:e=>l.value=e,updatePositions:e=>u.value=e,updateAssets:e=>{d.value=e.map(e=>({...e,logo:Hs(e.logo,e.symbol)}))},updateBalance:e=>h.value=e,updateHistoricalOrders:e=>p.value=e,updateHistoricalPnl:e=>v.value=e,updateLoading:e=>g.value=e}}),nr=ve("closeTradeStore",()=>{const{isOpen:e,onOpen:t,onClose:n}=qs(),i=X();return{isCloseTradeOpen:e,onCloseTradeOpen:t,onCloseTradeClose:n,payload:i,updatePayload:e=>i.value=e}}),ir=ve("shareStore",()=>{const{isOpen:e,onOpen:t,onClose:n}=qs(),i=X();return{isShareOpen:e,onShareOpen:t,onShareClose:n,payload:i,updatePayload:e=>i.value=e}}),sr="claw_tpsl_cache",rr=ve("tpSlStore",()=>{const{isOpen:e,onOpen:t,onClose:n}=qs(),i=X(),s=X(0),r=X((()=>{try{return JSON.parse(localStorage.getItem(sr)||"{}")}catch{return{}}})()),o=()=>{try{localStorage.setItem(sr,JSON.stringify(r.value))}catch{}},a=(e,t)=>`${e}:${t.toUpperCase()}`;return{isTpSlOpen:e,onTpSlOpen:t,onTpSlClose:n,payload:i,updatePayload:e=>i.value=e,anchorY:s,setAnchor:e=>{s.value=e},tpSlCache:r,setCachedTpSl:(e,t,n,i)=>{r.value[a(e,t)]={tp:n,sl:i},o()},getCachedTpSl:(e,t)=>r.value[a(e,t)]??null,clearCachedTpSl:(e,t)=>{delete r.value[a(e,t)],o()}}}),or="claw_paper_trading_",ar=1e4;function lr(){return`paper_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function cr(){try{const e=localStorage.getItem("token");if(e){const t=e.split(".");if(t.length>=2){const e=t[1].substring(0,16);return`${or}${e}`}}}catch(e){console.error("[PaperTrading] Error getting user storage key:",e)}return`${or}guest`}function ur(){try{const e=cr(),t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(e){console.error("[PaperTrading] Failed to load from storage:",e)}return null}function dr(){return{totalPnL:0,totalFees:0,winCount:0,lossCount:0,totalTrades:0,bestTrade:0,worstTrade:0,grossWins:0,grossLosses:0,totalHoldTimeMs:0,peakBalance:ar,maxDrawdownValue:0}}const hr=ve("paperTradingStore",()=>{const e=ur(),t=X((null==e?void 0:e.tradingMode)??"live"),n=X((null==e?void 0:e.virtualBalance)??ar),i=X((null==e?void 0:e.initialBalance)??ar),s=X((null==e?void 0:e.positions)??[]),r=X((null==e?void 0:e.orders)??[]),o=X((null==e?void 0:e.history)??[]),a=X((null==e?void 0:e.equityHistory)??[{timestamp:Date.now(),balance:(null==e?void 0:e.virtualBalance)??ar}]),l=(null==e?void 0:e.stats)??dr(),c=X({...dr(),...l}),u=re(()=>"paper"===t.value),d=re(()=>"live"===t.value),h=re(()=>r.value.filter(e=>"OPEN"===e.status)),p=re(()=>0===c.value.totalTrades?0:c.value.winCount/c.value.totalTrades*100),v=re(()=>0===i.value?0:(n.value-i.value)/i.value*100),g=re(()=>0===c.value.grossLosses?c.value.grossWins>0?1/0:0:c.value.grossWins/c.value.grossLosses),f=re(()=>0===c.value.peakBalance?0:c.value.maxDrawdownValue/c.value.peakBalance*100),m=re(()=>0===c.value.totalTrades?0:c.value.totalHoldTimeMs/c.value.totalTrades),_=re(()=>{const e=o.value;if(0===e.length)return 0;const t=e[0].pnl>0;let n=0;for(const i of e){if(i.pnl>0!==t)break;n++}return t?n:-n}),y=re(()=>{const e={};for(const t of o.value)e[t.symbol]||(e[t.symbol]={trades:0,winCount:0,pnl:0,fees:0}),e[t.symbol].trades++,e[t.symbol].pnl+=t.pnl,e[t.symbol].fees+=t.fee,t.pnl>0&&e[t.symbol].winCount++;return Object.entries(e).map(([e,t])=>
2({symbol:e,...t,winRate:t.trades>0?t.winCount/t.trades*100:0})).sort((e,t)=>t.pnl-e.pnl)});function w(){try{const e=cr(),l={tradingMode:t.value,virtualBalance:n.value,initialBalance:i.value,positions:s.value,orders:r.value,history:o.value,equityHistory:a.value,stats:c.value,lastUpdated:Date.now()};localStorage.setItem(e,JSON.stringify(l))}catch(e){console.error("[PaperTrading] Failed to persist:",e)}}let b;return ge([t,n,s,r,o,a,c],function(){b&&clearTimeout(b),b=setTimeout(w,500)},{deep:!0}),{tradingMode:t,virtualBalance:n,initialBalance:i,paperPositions:s,paperOrders:r,paperTradeHistory:o,equityHistory:a,stats:c,isPaperMode:u,isLiveMode:d,openOrders:h,winRate:p,accountPnLPercent:v,profitFactor:g,maxDrawdownPercent:f,avgHoldTimeMs:m,currentStreak:_,perSymbolStats:y,setTradingMode:function(e){t.value=e},toggleTradingMode:function(){t.value="live"===t.value?"paper":"live"},resetPaperAccount:function(e=1e4){n.value=e,i.value=e,s.value=[],r.value=[],o.value=[],a.value=[{timestamp:Date.now(),balance:e}],c.value={...dr(),peakBalance:e}},deductBalance:function(e){n.value-=e},addBalance:function(e){n.value+=e},addPosition:function(e){const t={...e,id:lr(),openedAt:Date.now()};return s.value.push(t),t},updatePosition:function(e,t){const n=s.value.findIndex(t=>t.id===e);-1!==n&&(s.value[n]={...s.value[n],...t})},removePosition:function(e){const t=s.value.findIndex(t=>t.id===e);if(-1!==t){const[e]=s.value.splice(t,1);return e}return null},getPositionBySymbol:function(e){return s.value.find(t=>t.symbol===e)},addOrder:function(e){const t={...e,id:lr(),createdAt:Date.now(),status:"OPEN"};return r.value.push(t),t},updateOrder:function(e,t){const n=r.value.findIndex(t=>t.id===e);-1!==n&&(r.value[n]={...r.value[n],...t})},cancelOrder:function(e){const t=r.value.find(t=>t.id===e);return!(!t||"OPEN"!==t.status||(t.status="CANCELLED",t.reservedMargin&&t.reservedMargin>0&&(n.value+=t.reservedMargin),0))},removeOrdersByPosition:function(e){r.value=r.value.filter(t=>t.positionId!==e)},addTradeToHistory:function(e){const t={...e,id:lr()};if(o.value.unshift(t),c.value.totalTrades++,c.value.totalPnL+=e.pnl,c.value.totalFees+=e.fee,e.pnl>0?(c.value.winCount++,c.value.grossWins+=e.pnl):e.pnl<0&&(c.value.lossCount++,c.value.grossLosses+=Math.abs(e.pnl)),e.pnl>c.value.bestTrade&&(c.value.bestTrade=e.pnl),e.pnl<c.value.worstTrade&&(c.value.worstTrade=e.pnl),c.value.totalHoldTimeMs+=e.closedAt-e.openedAt,a.value.push({timestamp:e.closedAt,balance:n.value}),n.value>c.value.peakBalance)c.value.peakBalance=n.value;else{const e=c.value.peakBalance-n.value;e>c.value.maxDrawdownValue&&(c.value.maxDrawdownValue=e)}return t},persist:w,generateId:lr,reloadFromStorage:function(){const e=ur();e&&(t.value=e.tradingMode??"live",n.value=e.virtualBalance??ar,i.value=e.initialBalance??ar,s.value=e.positions??[],r.value=e.orders??[],o.value=e.history??[],a.value=e.equityHistory??[{timestamp:Date.now(),balance:n.value}],c.value={...dr(),...e.stats??{}})}}}),pr=["12h","24h","3d","7d","30d","90d"],vr="12h",gr=new Map;function fr(e,t=0){const n="number"==typeof e?e:Number(e);return Number.isFinite(n)?n:t}function mr(e){const t=fr(e[0]);return"number"==typeof e[1]?[t,String(fr(e[1])),String(fr(e[2])),String(fr(e[3])),String(fr(e[4]))]:[t,String(e[1]??"0"),String(e[2]??"0"),String(e[3]??"0"),String(e[4]??"0")]}async function _r(e){var t;const n=null==(t=e.symbol)?void 0:t.trim();if(!n)throw new Error("Coinglass heatmap: missing symbol");const{data:i}=await mt.post("https://claw-proxy-server.owoadeanuoluwapo2.workers.dev/",{symbol:n,range:(s=e.range,"90d"===s?"30d":s),exchange:e.exchange},{timeout:2e4,withCredentials:!1});var s;if((null==i?void 0:i.code)&&"0"!==String(i.code)&&"200"!==String(i.code))throw new Error(i.msg?`Coinglass: ${i.msg}`:"Coinglass heatmap unavailable");const r=function(e){const t=((null==e?void 0:e.y_axis)??[]).map(e=>fr(e)).filter(e=>e>0),n=((null==e?void 0:e.price_candlesticks)??[]).map(mr),i=((null==e?void 0:e.liquidation_leverage_data)??[]).map(([e,t,n])=>[Math.round(fr(e)),Math.round(fr(t)),fr(n)]).filter(([e,n,i])=>e>=0&&n>=0&&n<t.length&&i>0);return{y_axis:t,price_candlesticks:n,liquidation_leverage_data:i}}((null==i?void 0:i.data)??i);if(!function(e){return e.y_axis.length>0&&e.price_candlesticks.length>0&&e.liquidation_leverage_data.length>0}(r))throw new Error("Coinglass heatmap empty");return r}async function yr(e){const t=function(e){return`${e.symbol}:${e.range}:${e.exchange}`}(e),n=Date.now();if(!e.forceRefresh){const e=gr.get(t);if(e&&n-e.timestamp<12e4)return e.data}const i={data:await _r(e)};return gr.set(t,{data:i,timestamp:n}),function(){if(gr.size<=20)return;const e=Array.from(gr.entries());e.sort((e,t)=>
2e[1].timestamp-t[1].timestamp),e.slice(0,e.length-20).forEach(([e])=>gr.delete(e))}(),i}const wr=ve("claw-heatmap",()=>{const e=X(""),t=X([]),n=X([]),i=X([]),s=X(0),r=X(0),o=X(0),a=X("ALL"),l=X(!1);function c(t){e.value=String(t||"").toUpperCase()}function u(e,s){s&&c(s),Array.isArray(null==e?void 0:e.price_candlesticks)&&(t.value=e.price_candlesticks),Array.isArray(null==e?void 0:e.y_axis)&&(n.value=e.y_axis),Array.isArray(null==e?void 0:e.liquidation_leverage_data)&&(i.value=e.liquidation_leverage_data),o.value=Date.now()}let d,h,p=!1;const v=3e5;let g,f=0;async function m(e="12h",t="Binance",n=!1){try{if(l.value)return;l.value=!0;const i=Es().token.label;if(!i)return;const{data:s}=await yr({symbol:i,range:e,exchange:t,forceRefresh:n});u(s,i),o.value=Date.now(),f=0}catch(i){f++,console.warn("[Heatmap] Refresh failed (attempt",f,"):",(null==i?void 0:i.message)||i),f>=3&&f<=5&&(g&&window.clearTimeout(g),g=window.setTimeout(()=>{g=void 0,m(e,t,!0)},3e4))}finally{l.value=!1}}return{symbol:e,candles:t,yAxis:n,liquidationLeverage:i,apexMinusBinanceSpread:s,spreadUpdatedAt:r,lastUpdatedAt:o,activeExchangeLabel:a,setSymbol
2:c,setFromResponse:u,setSpread:function(e){s.value=Number(e)||0,r.value=Date.now()},ensureStarted:function(e="12h",t="Binance"){if(p)return;p=!0,m(e,t,!1),(()=>{d&&(window.clearTimeout(d),d=void 0),h&&(window.clearInterval(h),h=void 0);const n=function(){const e=Date.now();return v-e%v+4500+Math.floor(8e3*Math.random())}();d=window.setTimeout(()=>{m(e,t,!0),h=window.setInterval(()=>m(e,t,!0),v)},n)})();const n=Es();ge(()=>n.token.label,()=>m(e,t,!1))},stop:function(){d&&(window.clearTimeout(d),d=void 0),h&&(window.clearInterval(h),h=void 0),g&&(window.clearTimeout(g),g=void 0),p=!1,f=0}}}),br={},Sr=(null==br?void 0:br.VITE_CLAW_API_URL)??"https://stream.eagleailabs.com",Er=X(!0),Tr=X(!1),xr=X(0),Cr=X(0),Ar=X(null),Pr=new Map;function kr(){try{return localStorage.getItem("token")}catch{return null}}async function Lr(e,t={}){if(!Er.value)return null;const n=kr();if(!n)return null;const i=new AbortController,s=setTimeout(()=>i.abort(),8e3);try{const s=await fetch(`${Sr}${e}`,{...t,signal:i.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`,...t.headers??{}}});return 404===s.status?(Er.value=!1,null):s}catch(r){return Ar.value=r instanceof Error?r.message:String(r),null}finally{clearTimeout(s)}}function Ir(e,t){const n=new Map(e.map(e=>[e.id,e]));return t.map(e=>{const t=n.get(e.id);return(null==t?void 0:t.imagePreview)&&!e.imagePreview?{...e,imagePreview:t.imagePreview}:e})}function Dr(e){const t=e.messages.find(e=>"user"===e.role);return(null==t?void 0:t.content)?t.content.slice(0,80).trim():""}function Or(e){return{id:e.id,createdAt:new Date(e.created_at??e.createdAt??Date.now()),updatedAt:new Date(e.updated_at??e.updatedAt??Date.now()),messages:Array.isArray(e.messages)?e.messages.map(e=>({...e,timestamp:e.timestamp??Date.now()})):[]}}async function Nr(){if(kr()&&Er.value&&!Tr.value){Tr.value=!0;try{const{useStealthAgentStore:t}=await dt(async()=>{const{useStealthAgentStore:e}=await Promise.resolve().then(()=>Hr);return{useStealthAgentStore:e}},void 0),n=t(),i=await Lr("/api/v1/stealth/sync/sessions?limit=50");if(null==i?void 0:i.ok)try{const e=await i.json(),t=(null==e?void 0:e.data)??[];await async function(e,t){const n=[];for(const o of e){const e=new Date(o.updated_at).getTime(),i=t.sessions.find(e=>e.id===o.id);i?e>new Date(i.updatedAt).getTime()&&n.push(o.id):n.push(o.id)}if(0===n.length)return;const i=await Promise.all(n.map(async e=>{const t=await Lr(`/api/v1/stealth/sync/sessions/${e}`);if(!(null==t?void 0:t.ok))return null;try{const e=await t.json();return null==e?void 0:e.data}catch{return null}}));let s=0,r=0;for(const o of i){if(!o)continue;const e=Or(o),n=t.sessions.findIndex(t=>t.id===e.id);n<0?(t.sessions.unshift(e),s++):(e.messages=Ir(t.sessions[n].messages,e.messages),t.sessions.splice(n,1,e),r++)}(s||r)&&t.persistSessions()}(t,n)}catch(e){}xr.value=Date.now()}finally{Tr.value=!1}}}function Mr(e){if(!kr()||!Er.value)return;const t=Pr.get(e);t&&clearTimeout(t),Pr.set(e,setTimeout(()=>{Pr.delete(e),Rr(e).catch(e=>{})},1500))}function $r(e){if(!kr()||!Er.value)return;const t=Pr.get(e);t&&(clearTimeout(t),Pr.delete(e)),Lr(`/api/v1/stealth/sync/sessions/${e}`,{method:"DELETE"}).then(()=>{Cr.value=Date.now()}).catch(e=>{})}async function Rr(e){const{useStealthAgentStore:t}=await dt(async()=>{const{useStealthAgentStore:e}=await Promise.resolve().then(()=>Hr);return{useStealthAgentStore:e}},void 0),n=t(),i=n.sessions.find(t=>t.id===e);if(!i)return void $r(e);const s=i.messages.map(e=>{if(!e.imagePreview)return e;const{imagePreview:t,...n}=e;return n}),r=function(e){try{return new Blob([JSON.stringify(e)]).size}catch{return 0}}(s);if(r>204800)return void(r/1024).toFixed(1);const o={title:Dr(i),messages:s,message_count:s.length,pinned:!1,updated_at:new Date(i.updatedAt).toISOString()},a=await Lr(`/api/v1/stealth/sync/sessions/${e}`,{method:"PUT",body:JSON.stringify(o)});if(a)if(409!==a.status)a.ok?Cr.value=Date.now():a.status;else try{const e=await a.json(),t=null==e?void 0:e.server;if(null==t?void 0:t.id){const e=Or(t);e.messages=Ir(i.messages,e.messages);const s=n.sessions.findIndex(t=>t.id===e.id);s>=0?n.sessions.splice(s,1,e):n.sessions.unshift(e),n.persistSessions()}}catch(l){}}async function Fr(){const e=Array.from(Pr.keys());
2Pr.forEach(e=>clearTimeout(e)),Pr.clear(),await Promise.all(e.map(e=>Rr(e).catch(()=>{})))}function Ur(){return{enabled:Er,isSyncing:Tr,lastPullAt:xr,lastPushAt:Cr,lastError:Ar,pullAll:Nr,schedulePushSession:Mr,pushDeleteSession:$r,flushPending:Fr}}const Br="stealth:claw:sessions",qr="stealth:claw:active_session";function jr(e){try{const t=[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).slice(0,30);localStorage.setItem(Br,JSON.stringify(t))}catch{}}const Wr=ve("stealthAgent",()=>{const e=X(function(){var e,t;try{const e=localStorage.getItem(Br);if(e)return JSON.parse(e).map(e=>({...e,createdAt:new Date(e.createdAt??Date.now()),updatedAt:new Date(e.updatedAt??Date.now()),messages:Array.isArray(e.messages)?e.messages:[]})).sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}catch{}try{const n=localStorage.getItem("stealth_transcript"),i=localStorage.getItem("stealth_session_id");if(n){const s=JSON.parse(n);if(Array.isArray(s)&&s.length){const n={id:i??crypto.randomUUID(),messages:s,createdAt:new Date((null==(e=s[0])?void 0:e.timestamp)??Date.now()),updatedAt:new Date((null==(t=s[s.length-1])?void 0:t.timestamp)??Date.now())};return localStorage.removeItem("stealth_transcript"),localStorage.removeItem("stealth_session_id"),[n]}}}catch{}return[]}()),t=X(function(e){var t;if(!e.length)return null;const n=localStorage.getItem(qr);return n&&e.find(e=>e.id===n)?n:(null==(t=e[0])?void 0:t.id)??null}(e.value));if(0===e.value.length){const n=crypto.randomUUID();e.value.push({id:n,messages:[],createdAt:new Date,updatedAt:new Date}),t.value=n}const n=re(()=>e.value.find(e=>e.id===t.value)??null),i=re(()=>{var e;return(null==(e=n.value)?void 0:e.messages)??[]}),s=re(()=>t.value??""),r=X(null),o=X(!1),a=re(()=>{var e;return((null==(e=r.value)?void 0:e.balance)??1)>0}),l=re(()=>{var e;return(null==(e=r.value)?void 0:e.balance)??null}),c=X(null),u=X(null),d=X(0),h=X(!1);function p(){const t=n.value;t&&(t.updatedAt=new Date),jr(e.value)}ge(t,e=>{e?localStorage.setItem(qr,e):localStorage.removeItem(qr)});const v=p;function g(n){p();const i=crypto.randomUUID();e.value.unshift({id:i,messages:[],createdAt:new Date,updatedAt:new Date,tradeTypeId:null==n?void 0:n.tradeTypeId,tradeTypeLabel:null==n?void 0:n.tradeTypeLabel}),t.value=i,jr(e.value)}const f=X(null),m=X(null),_=X(null);return{sessions:e,activeSessionId:t,activeSession:n,messages:i,sessionId:s,credits:r,isLoading:o,hasCredits:a,creditsBalance:l,pendingAiLevels:c,activeDrawnLevels:u,clearLinesSignal:d,autoFillTrade:h,newSession:g,setActiveSessionTradeType:function(e,t){const i=n.value;i&&(i.tradeTypeId=e,i.tradeTypeLabel=t,p())},clearMessages:function(){g()},loadSession:function(n){e.value.find(e=>e.id===n)&&(p(),t.value=n)},deleteSession:function(n){const i=e.value.findIndex(e=>e.id===n);if(!(i<0)){e.value.splice(i,1),t.value===n&&(0===e.value.length?g():t.value=e.value[0].id),jr(e.value);try{$r(n)}catch{}}},persistSessions:p,persistTranscript:v,addMessage:function(e){n.value||g();const t=n.value;t.messages.push(e),t.messages.length>50&&t.messages.splice(0,t.messages.length-50),p();try{Mr(t.id)}catch{}},updateLastAssistantMessage:function(e){const t=[...i.value].reverse().find(e=>"assistant"===e.role);t&&Object.assign(t,e),p()},appendToLastAssistantMessage:function(e){const t=[...i.value].reverse().find(e=>"assistant"===e.role);t&&(t.content+=e)},restoreTranscript:function(e){n.value||g(),n.value.messages=e.map(e=>({...e,isStreaming:!1})).filter(e=>"user"===e.role||!!e.content),p()},setCredits:function(e){r.value=e},setLoading:function(e){o.value=e},setAiLevels:function(e){c.value=e},clearAiLevels:function(){c.value=null},setActiveDrawnLevels:function(e){u.value=e},requestClearLines:function(){d.value++,u.value=null},setAutoFillTrade:function(e){h.value=e},pendingReview:f,queueReview:function(e){g(),f.value=e},clearPendingReview:function(){f.value=null},pendingCopyTraderId:m,queueCopyTrader:function(e){m.value=e},clearPendingCopyTrader:function(){m.value=null},pendingDiscoverSearch:_,queueDiscoverSearch:function(e){_.value=e},clearDiscoverSearch:function(){_.value=null}}}),Hr=Object.freeze(Object.defineProperty({__proto__:null,useStealthAgentStore:Wr},Symbol.toStringTag,{value:"Module"})),Vr={name:"Eagle Money Line Machine Learning",metainfo:{_metainfoVersion:51,id:"EagleMoneyLine@tv-basicstudies-1",name:"Eagle Money Line Machine Learning",description:"Eagle Money Line Machine Learning",shortDe
2scription:"Eagle Money Line Machine Learning",is_price_study:!0,is_hidden_study:!1,isCustomIndicator:!0,format:{type:"price",precision:2},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},plot_1:{linestyle:0,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"}},inputs:{kNeighbors:8}},styles:{plot_0:{title:"Trend Line",histogramBase:0,joinPoints:!0},plot_1:{title:"Trend Line",histogramBase:0,joinPoints:!0}},inputs:[{id:"kNeighbors",name:"K Neighbors",defval:8,type:"integer",min:1,max:20}]},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._closes=[],this._volumes=[],this._historicalFeatures=[],this._historicalLabels=[],this._lastSignal=0,this._signals=[]},this.main=function(e,t){this._context=e,this._input=t;const n=e.symbol.close,i=e.symbol.volume||1;if(this._closes.push(n),this._volumes.push(i),this._closes.length>500&&(this._closes.shift(),this._volumes.shift()),this._closes.length<9)return[n,NaN];const s=this._calculateRSI(this._closes,14),r=this._calculateMACD(this._closes),o=this._calculateEMA(this._closes,9),a=[s,r,this._calculateVWAP(this._closes,this._volumes),this._calculateKST(this._closes),this._calculateCPMA(this._closes,9),this._calculateFRAMA(this._closes,14)];if(this._closes.length>50){this._historicalFeatures.push(a);const e=this._closes[Math.max(0,this._closes.length-5)],t=n>e?1:n<e?-1:0;this._historicalLabels.push(t),this._historicalFeatures.length>200&&(this._historicalFeatures.shift(),this._historicalLabels.shift())}let l=0;if(this._historicalFeatures.length>=8){const e=[];for(let t=0;t<this._historicalFeatures.length;t++){const n=this._cosineSimilarity(a,this._historicalFeatures[t]);e.push({dist:n,label:this._historicalLabels[t]})}e.sort((e,t)=>t.dist-e.dist),l=e.slice(0,8).reduce((e,t)=>e+t.label,0)}const c=n>=o,u=n<=o;l>4&&c&&1!==this._lastSignal&&(this._lastSignal=1,this._signals.push({type:"BUY",price:n,prediction:l,barIndex:this._closes.length,timestamp:(new Date).toISOString()})),l<-4&&u&&-1!==this._lastSignal&&(this._lastSignal=-1,this._signals.push({type:"SELL",price:n,prediction:l,barIndex:this._closes.length,timestamp:(new Date).toISOString()})),this._closes.length%100==0&&this._signals.length>0&&this._calculateAccuracy();const d=[c?o:NaN,u?o:NaN];return this._closes.length,d},this._calculateRSI=function(e,t=14){if(!e||e.length<t+1)return.5;let n=0,i=0;for(let o=e.length-t;o<e.length;o++){const t=e[o]-e[o-1];t>0?n+=t:i+=Math.abs(t)}const s=i/t,r=(100-100/(1+(0===s?100:n/t/s)))/100;return isNaN(r)?.5:r},this._calculateEMA=function(e,t){if(!e||0===e.length)return 0;if(e.length<t){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}const n=2/(t+1);let i=0;for(let s=0;s<t;s++)i+=e[s];i/=t;for(let s=t;s<e.length;s++)i=e[s]*n+i*(1-n);return isNaN(i)?e[e.length-1]:i},this._calculateMACD=function(e){return e.length<26?.5:.5+(this._calculateEMA(e.slice(-26),12)-this._calculateEMA(e.slice(-26),26))/(Math.max(...e.slice(-26))-Math.min(...e.slice(-26))||1)*.5},this._calculateVWAP=function(e,t){if(0===e.length)return.5;let n=0,i=0;const s=Math.min(20,e.length);for(let l=e.length-s;l<e.length;l++)n+=e[l]*(t[l]||1),i+=t[l]||1;const r=0===i?e[e.length-1]:n/i,o=Math.max(...e.slice(-s)),a=Math.min(...e.slice(-s));return(r-a)/(o-a||1)},this._calculateKST=function(e){return e.length<30?.5:.5+(e[e.length-1]-e[Math.max(0,e.length-10)]+2*(e[e.length-1]-e[Math.max(0,e.length-15)])+3*(e[e.length-1]-e[Math.max(0,e.length-20)])+4*(e[e.length-1]-e[Math.max(0,e.length-30)]))/(Math.max(...e.slice(-30))-Math.min(...e.slice(-30))||1)*.5},this._calculateCPMA=function(e,t=9){if(e.length<t)return e[e.length-1];const n=Math.floor(t/2);let i=0;for(let s=0;s<t;s++){const r=1+Math.abs(s-n);i+=e[e.length-t+s]*r}return i/(t*(t+1)/2)},this._calculateFRAMA=function(e,t=14){if(e.length<t)return e[e.length-1];const n=Math.max(...e.slice(-t)),i=Math.min(...e.slice(-t)),s=n-i||1;return(e[e.length-1]-i)/s},this._cosineSimilarity=function(e,t){let n=0,i=0,s=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r],i+=e[r]*e[r],s+=t[r]*t[r];return i=Math.sqrt(i),s=Math.sqrt(s),0===i||0===s?0:n/(i*s)},this._calculateAccuracy=function(){if(this._signals.length<1||this._closes.length<10)return;let e=0,t=0;for(let i=0;i<this._signals.length-1;i++){const n=this._signals[i],s=n.barIndex,r=3,o=Math.min(s+r,this._closes.length-1);if(!(o<=s))if(t++,"BUY"===n.type)this._closes[o]-n.price>0&&e++;else if("SELL"===n.type){const t=this._closes[o];n.price-t>0&&e++}}const n=t>0?(e/t*100).toFixed(2):"0";"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("eagle-accuracy-update",{detail:{accuracy:n,correct:e,total:t}}))}}},zr={bufferTicks:2,atrPeriod:14,atrFactor:1,tpMultiples:[1,2,3],strongCloseAtrMult:.5};function Gr(e){return"number"==typeof e&&Number.isFinite(e)}function Yr(){const e=Es();let t=Number(null==e?void 0:e.price);if(!Number.isFinite(t)){const e=wr();t=Array.isArray(null==e?void 0:e.candles)&&e.candles.length?Number(e.candles.at(-1)[4]):NaN}return Number.isFinite(t)?t>=1e3?1:t>=100?.1:t>=1?.01:t>=.1?.001:t>=.01?1e-4:t>=.001?1e-5:1e-6:.01}function Kr(e){const t=Yr();return Math.round(e/t)*t}function Jr(e){return Yr()*e}function Qr(e){if(!Gr(e))return"â";let t=0,n=Yr();for(;n<1&&t<8;)n*=10,t++;return Kr(e).toFixed(Math.min(8,t))}function Xr(e,t){const n=e.slice(-12);return n.length?{hi:Math.max(...n.map(e=>e.close)),lo:Math.min(...n.map(e=>e.close))}:{hi:void 0,lo:void 0}}
2let Zr,eo,to,no,io=null,so=null,ro=null;function oo(){var e;try{const t=Es();return`clawDecision:${String((null==(e=null==t?void 0:t.token)?void 0:e.label)||"").toUpperCase()}`}catch{return"clawDecision:"}}function ao(){try{return"undefined"!=typeof localStorage}catch{return!1}}function lo(e){try{if(!ao())return;const t=oo(),n={ts:Date.now(),kind:e.kind};"LONG_READY"!==e.kind&&"SHORT_READY"!==e.kind||(n.side="LONG_READY"===e.kind?"long":"short",n.entry=e.entry,n.stop=e.stop,n.tps=e.tps||[],n.invalidate=e.invalidate,n.stage=(null==so?void 0:so.stage)??0,n.triggeredAt=null==so?void 0:so.triggeredAt),localStorage.setItem(t,JSON.stringify(n))}catch{}}function co(){const e=function(){var e;const t=Es();return`${String((null==(e=null==t?void 0:t.token)?void 0:e.label)||"").toUpperCase()}:${String((null==t?void 0:t.timeframe)??"5m")}`}();e!==to&&(io=null,so=null,ro=null,Zr=void 0,eo=void 0,no=void 0,to=e,function(){try{if(!ao())return;const e=oo(),t=localStorage.getItem(e);if(!t)return;const n=JSON.parse(t);if(!n||"object"!=typeof n)return;if(!Number.isFinite(n.ts)||Date.now()-Number(n.ts)>432e5)return void localStorage.removeItem(e);if("LONG_READY"===n.kind||"SHORT_READY"===n.kind){const e="LONG_READY"===n.kind?"long":"short",t=Number(n.entry),i=Number(n.stop),s=Array.isArray(n.tps)?n.tps.map(e=>Number(e)).filter(e=>Number.isFinite(e)):[],r=Number(n.invalidate),o="number"==typeof n.stage&&n.stage>=0&&n.stage<=3?n.stage:0,a="string"==typeof n.triggeredAt?n.triggeredAt:void 0;[t,i,r].every(e=>Number.isFinite(e))&&(so={side:e,entry:t,stop:i,tps:s,invalidate:r,stage:o,triggeredAt:a})}}catch{}}())}function uo(e){ro&&(e>ro.lo&&e<ro.hi?ro.backInsideCount+=1:ro.backInsideCount=0,ro.backInsideCount>=3&&(ro=null))}function ho(){function e(){var e,t,n;const i=String((null==(t=null==(e=Es())?void 0:e.token)?void 0:t.label)||"").toUpperCase(),s=wr(),r=String((null==s?void 0:s.symbol)||"").toUpperCase()===i?null==s?void 0:s.candles:[];let o=[];if(Array.isArray(r)&&r.length)o=r.map(([e,t,n,i,s])=>({ts:Number(e),open:Number(t),high:Number(n),low:Number(i),close:Number(s)}));else{const e=Es(),t=String((null==e?void 0:e.timeframe)??"5m"),i=null==(n=null==e?void 0:e.ohlcv)?void 0:n[t];o=Array.isArray(i)?i:[]}const a=new Map;for(const l of o)if([l.open,l.high,l.low,l.close].every(Gr)){const e=Number(l.ts??0);a.set(e,{...l,ts:e})}return[...a.values()].sort((e,t)=>(e.ts??0)-(t.ts??0))}return{decide:function(){co();const t=e(),n=t.at(-1),i=t.at(-2),s=Xr(t);if(!(Gr(s.hi)&&Gr(s.lo)&&n)){const e={kind:"NEUTRAL_WAIT",text:"Waiting for enough candles to compute range."};return lo(e),e}let r=s.lo,o=s.hi,a="";if(ro)r=ro.lo,o=ro.hi;else{const e=Jr(3),t=n.close>r+.2*(o-r)&&n.close<r+.8*(o-r);void 0===Zr&&(Zr=r),void 0===eo&&(eo=o),Math.abs(r-Zr)>=e&&t&&(Zr=r),Math.abs(o-eo)>=e&&t&&(eo=o),r=Zr,o=eo;const i=function(e,t){if(ro||so||io)return{lo:e,hi:t,note:""};const n=wr();if(!Array.isArray(null==n?void 0:n.yAxis)||!Array.isArray(null==n?void 0:n.liquidationLeverage))return{lo:e,hi:t,note:""};const i=n.yAxis,s=n.liquidationLeverage,r={};for(const h of s){const e=Number(h[1]),t=Number(h[2]);Number.isFinite(e)&&Number.isFinite(t)&&(r[e]=(r[e]||0)+t)}const o=Object.entries(r).map(([e,t])=>({price:i[Number(e)],w:Number(t)})).filter(e=>Number.isFinite(e.price));if(!o.length)return{lo:e,hi:t,note:""};const a=Jr(12),l=o.filter(e=>e.price>t&&e.price-t<=a).sort((e,t)=>t.w-e.w)[0],c=o.filter(t=>t.price<e&&e-t.price<=a).sort((e,t)=>t.w-e.w)[0],u=l?Kr(l.price):t,d=c?Kr(c.price):e;return{lo:d,hi:u,note:l||c?` (HM walls â lower ${Qr(d)}, upper ${Qr(u)})`:""}}(r,o);r=i.lo,o=i.hi,a=i.note}const l=function(e,t){if(!Array.isArray(e)||e.length<2)return 0;const n=Math.min(t,e.length-1);let i=0;for(let s=e.length-n;s<e.length;s++){const t=e[s],n=e[s-1]||t;i+=Math.max(t.high-t.low,Math.abs(t.high-n.close),Math.abs(t.low-n.close))}return i/n}(t,zr.atrPeriod);Jr(zr.bufferTicks);const c=Jr(.5);if(!Gr(o)||!Gr(r)||o<=r){const e={kind:"NEUTRAL_WAIT",text:"Waiting for a valid range."};return lo(e),e}
2if(o-r<Jr(2)){const e={kind:"NEUTRAL_WAIT",up:o,down:r,text:`Range too tight to trade (${Qr(r)}â${Qr(o)}).`};return lo(e),e}const u=function(e,t,n){const i=Jr(zr.bufferTicks),s=Yr(),r=Math.max(i,s,Kr(n*zr.atrFactor)),o=Kr(t+i),a=Kr(e-i),l=Kr(o-r),c=Kr(a+r),u=zr.tpMultiples.map(e=>Kr(o+e*r)),d=zr.tpMultiples.map(e=>Kr(a-e*r)),h=Kr(t-i),p=Kr(e+i);return{long:{entry:o,stop:l,tps:u,invalidate:h},short:{entry:a,stop:c,tps:d,invalidate:p}}}(r,o,l);if(so){let e="";if("long"===so.side?(so.stage??0)<1&&n.close>=so.tps[0]?(so.stage=1,so.stop=Kr(o),e=" TP1 hit â SL to range edge."):(so.stage??0)<2&&n.close>=so.tps[1]?(so.stage=2,so.stop=Kr(o+Jr(1)),e=" TP2 hit â trailing a tick."):(so.stage??0)<3&&n.close>=so.tps[2]&&(so.stage=3,e=" TP3 reached."):(so.stage??0)<1&&n.close<=so.tps[0]?(so.stage=1,so.stop=Kr(r),e=" TP1 hit â SL to range edge."):(so.stage??0)<2&&n.close<=so.tps[1]?(so.stage=2,so.stop=Kr(r-Jr(1)),e=" TP2 hit â trailing a tick."):(so.stage??0)<3&&n.close<=so.tps[2]&&(so.stage=3,e=" TP3 reached."),(so.stage??0)>=3){const e="long"===so.side?"Long":"Short";if(!no){no=n.ts??Date.now();const t=`${e} TP3 reached! Waiting for next candle close + heatmap refresh to reset. Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}.${a}`,i="long"===so.side?{kind:"LONG_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invalidate:so.invalidate}:{kind:"SHORT_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invalidate:so.invalidate};return lo(i),i}const i=n.ts??Date.now(),s=i>(no??0),r=Date.now()-i;if(s&&r>=2e4){so=null,io=null,ro=null,Zr=void 0,eo=void 0,no=void 0;const n=Xr(t),i=n.lo,s=n.hi,r={kind:"NEUTRAL_WAIT",up:s,down:i,text:`${e} trade completed (TP3). Fresh range recalculated: ${Qr(i)}â${Qr(s)}${a}. Watching > ${Qr(s)} for long, < ${Qr(i)} for short.`,plans:u};return lo(r),r}{const t=`${e} TP3 reached! ${s?`Waiting for heatmap refresh (${Math.max(0,20-Math.floor(r/1e3))}s)`:"Waiting for candle close"}. Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}.${a}`,n="long"===so.side?{kind:"LONG_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invalidate:so.invalidate}:{kind:"SHORT_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invalidate:so.invalidate};return lo(n),n}}const i=so.invalidate;if("long"===so.side&&n.close<=i||"short"===so.side&&n.close>=i){so=null,io=null,uo(n.close);const e={kind:"NEUTRAL_WAIT",up:o,down:r,text:`Setup invalidated (on close). Range ${Qr(r)}â${Qr(o)}${a}. Watching > ${Qr(o)} for long, < ${Qr(r)} for short.`,plans:u};return lo(e),e}const s=so.triggeredAt?` (triggered at ${so.triggeredAt})`:"",l="long"===so.side?`Long active${s}. Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}. Invalidation on close ⤠${Qr(so.invalidate)}.${e}${a}`:`Short active${s}. Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}. Invalidation on close ⥠${Qr(so.invalidate)}.${e}${a}`,c="long"===so.side?{kind:"LONG_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:l,invalidate:so.invalidate}:{kind:"SHORT_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:l,invalidate:so.invalidate};return lo(c),c}if(io&&n)if("long"===io.side){if(n.low<=io.level&&n.close>=io.level+c){const e=(new Date).toLocaleTimeString();so={side:"long",entry:io.entry,stop:io.stop,tps:io.tps,invalidate:io.invalidate,stage:0,triggeredAt:e},io=null,ro||(ro={lo:r,hi:o,locked:"long",backInsideCount:0},Zr=void 0,eo=void 0);const t=`<b>ð¢ LONG LEAN triggered at ${e}</b><br>Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}. Invalidation on close ⤠${Qr(so.invalidate)}.${a}`,n={kind:"LONG_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invalidate:so.invalidate};return lo(n),n}}else if(n.high>=io.level&&n.close<=io.level-c){const e=(new Date).toLocaleTimeString();so={side:"short",entry:io.entry,stop:io.stop,tps:io.tps,invalidate:io.invalidate,stage:0,triggeredAt:e},io=null,ro||(ro={lo:r,hi:o,locked:"short",backInsideCount:0},Zr=void 0,eo=void 0);const t=`<b>ð´ SHORT LEAN triggered at ${e}</b><br>Entry ${Qr(so.entry)}, SL ${Qr(so.stop)}, TP ${so.tps.map(Qr).join(", ")}. Invalidation on close ⥠${Qr(so.invalidate)}.${a}`,n={kind:"SHORT_READY",entry:so.entry,stop:so.stop,tps:so.tps,text:t,invali
2date:so.invalidate};return lo(n),n}const d=n.close,h=null==i?void 0:i.close,p=Gr(h)&&h>=o&&d>=o+c,v=Gr(h)&&h<=r&&d<=r-c,g=d-o>=zr.strongCloseAtrMult*(l||0),f=r-d>=zr.strongCloseAtrMult*(l||0);if(!so&&!io){if(p||g){const e=u.long.entry,t=u.long.stop,n=u.long.tps,i=u.long.invalidate;if(io={side:"long",level:o,entry:e,stop:t,tps:n,invalidate:i},ro||(ro={lo:r,hi:o,locked:"long",backInsideCount:0},Zr=void 0,eo=void 0),d>=o+c){const s=(new Date).toLocaleTimeString();so={side:"long",entry:e,stop:t,tps:n,invalidate:i,stage:0,triggeredAt:s},io=null;const r=`<b>ð¢ LONG LEAN triggered at ${s}</b> (break-and-go)<br>Entry ${Qr(e)}, SL ${Qr(t)}, TP ${n.map(Qr).join(", ")}. Invalidation on close ⤠${Qr(i)}.${a}`,o={kind:"LONG_READY",entry:e,stop:t,tps:n,text:r,invalidate:i};return lo(o),o}const s={kind:"NEUTRAL_WAIT",up:o,down:r,text:`Armed long above ${Qr(o)} â waiting retest.`,plans:u};return lo(s),s}if(v||f){const e=u.short.entry,t=u.short.stop,n=u.short.tps,i=u.short.invalidate;if(io={side:"short",level:r,entry:e,stop:t,tps:n,invalidate:i},ro||(ro={lo:r,hi:o,locked:"short",backInsideCount:0},Zr=void 0,eo=void 0),d<=r-c){const s=(new Date).toLocaleTimeString();so={side:"short",entry:e,stop:t,tps:n,invalidate:i,stage:0,triggeredAt:s},io=null;const r=`<b>ð´ SHORT LEAN triggered at ${s}</b> (break-and-go)<br>Entry ${Qr(e)}, SL ${Qr(t)}, TP ${n.map(Qr).join(", ")}. Invalidation on close ⥠${Qr(i)}.${a}`,o={kind:"SHORT_READY",entry:e,stop:t,tps:n,text:r,invalidate:i};return lo(o),o}const s={kind:"NEUTRAL_WAIT",up:o,down:r,text:`Armed short below ${Qr(r)} â waiting retest.`,plans:u};return lo(s),s}}so||io||uo(n.close);const m={kind:"NEUTRAL_WAIT",up:o,down:r,text:`Range ${Qr(r)}â${Qr(o)}${a}. Watching > ${Qr(o)} for long, < ${Qr(r)} for short.`,plans:u};return lo(m),m},computeFacts:function(){co();const t=e(),n=t.at(-1),i=Xr(t);let s=i.lo,r=i.hi;const o=Gr(r)&&Gr(s)&&!!n;return o&&ro&&(s=ro.lo,r=ro.hi),{candles:t,candlesCount:t.length,last:n,rangeHi:r,rangeLo:s,enoughData:o}},describeFacts:function(e){var t,n,i;return{summary:Gr(e.rangeHi)&&Gr(e.rangeLo)&&Gr(null==(t=e.last)?void 0:t.close)?`Range ${Qr(e.rangeLo)}â${Qr(e.rangeHi)}; last ${Qr(null==(n=e.last)?void 0:n.close)}.`:"Not enough data to compute range.",waiting:!e.enoughData,candles:e.candlesCount,rangeHi:e.rangeHi,rangeLo:e.rangeLo,lastClose:null==(i=e.last)?void 0:i.close}}}}const po={name:"Breakout Bot Signals",metainfo:{_metainfoVersion:51,id:"BreakoutBot@tv-basicstudies-1",name:"Breakout Bot Signals",description:"Shows breakout bot entry and take profit levels on the chart",shortDescription:"Breakout Bot",is_price_study:!0,is_hidden_study:!1,isCustomIndicator:!0,format:{type:"price",precision:2},plots:[{id:"long_entry",type:"line"},{id:"long_tp1",type:"line"},{id:"long_tp2",type:"line"},{id:"long_tp3",type:"line"},{id:"short_entry",type:"line"},{id:"short_tp1",type:"line"},{id:"short_tp2",type:"line"},{id:"short_tp3",type:"line"}],defaults:{styles:{long_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},long_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},long_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},long_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},short_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"},short_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"},short_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"},short_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"}},inputs:{}},styles:{long_entry:{title:"Long Entry",histogramBase:0,joinPoints:!1},long_tp1:{title:"Long TP1",histogramBase:0,joinPoints:!1},long_tp2:{title:"Long TP2",histogramBase:0,joinPoints:!1},long_tp3:{title:"Long TP3",histogramBase:0,joinPoints:!1},short_entry:{title:"Short Entry",histogramBase:0,joinPoints:!1},short_tp1:{title:"Short TP1",histogramBase:0,joinPoints:!1},short_tp2:{title:"Short TP2",histogramBase:0,joinPoints:!1},short_tp3:{title:"Short TP3",histogramBase:0,joinPoints:!1}},inputs:[]},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._lastDecisionKey=null,this._updateCounter=0,this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN},this.main=function(e,t){var n,i,s,r,o,a,l;this._context=e,this._input=t,this._updateCounter++;try{const{decide:e}=ho(),t=e(),c=`${t.kind}-${"LONG_READY"===t.kind||"SHORT_READY"===t.kind?`${t.entry}-${t.stop}-${null==(n=t.tps)?void 0:n.join(",")}`:(null==(s=null==(i=t.plans)?void 0:i.long)?void 0:s.entry)+"|"+(null==(o=null==(r=t.plans)?void 0:r.short)?void 0:o.entry)}`;return c!==this._lastDecisionKey&&(this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN,"LONG_READY"===t.kind?(this._cachedLongEntry=t.entry,Array.isArray(t.tps)&&t.tps.length>=3&&(this._cachedLongTp1=t.tps[0],this._cachedLongTp2=t.tps[1],this._cachedLongTp3=t.tps[2])):"SHORT_READY"===t.kind?(this._cachedShortEntry=t.entry,Array.isArray(t.tps)&&t.tps.length>=3&&(this._cachedShortTp1=t.tps[0],this._cachedShortTp2=t.tps[1],this._cachedShortTp3=t.tps[2])):"NEUTRAL_WAIT"===t.kind&&t.plans&&((null==(a=t.plans.long)?void 0:a.entry)&&(this._cachedLongEntry=t.plans.long.entry),(null==(l=t.plans.short)?void 0:l.entry)&&(this._cachedShortEntry=t.plans.short.entry)),this._lastDecisionKey=c),[this._cachedLongEntry,this._cachedLongTp1,this._cachedLongTp2,this._cachedLongTp3,this._cachedShortEntry,this._cachedShortTp1,this._cachedShortTp2,this._cachedShortTp3]}catch(c){return console.error("ð¤ [Breakout Bot] Error in main():",c),[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN]}}}},vo={rangeLookback:24,range:{useCloses:!0,hysteresis:{needTwoCloses:!0,minTicks:5,minAtrMult:.25}},minMovePct:.05,bufferPts:2,biasInvalidationTicks:5,strongBreakPct:.003,strongBreakMinPct:.003,useAtrForStrongBreak:!0,strongBreakAtrMult:.5,atrPeriod:14,atrMode:"wilder",atrFactor:.25,minStopPts:5,minStopPtsBySymbol:{BTC:10,ETH:6},minRR:1.8,softInvalidationCandles:3,trailAfterTP2Pts:10,volFilterEnabled:!1,minAtrForBreak:2,minAtrForBreakBySymbol:{DOGE:.5,TRX:.2},allowAggressiveActivation:!0,alphaTpEnabled:!0,alphaTpLookback:12,minTick:{BTC:5,ETH:1,SOL:.05,DOGE:.001,TRX:1e-4,DEFAULT:.01},slippageBuffer:1,breakoutSource:"range",liq:{quantile:.68,proxTicks:20,minAbs:0,atrProxMult:1.4,atrProxMaxTicks:180,proxOverrides:{BTC:80,ETH:30,SOL:18}},enableSweepActivate:!0,sweepRequireConfluence:!1,fallbackIfNoConfluence:{afterCandles:2,positionFactor:.5},featureFlags:{rangeUseCloses:!0,freezeOnArmed:!0,hmReadinessRequired:!1,spreadFreshRequired:!0}},go={...vo,atrFactor:1,cascade:{minTp3Count:2,windowMs:36e5,blockOppositeSignals:!0},volatility:{enabled:!0,highVolAtrMult:1.5,rollingAtrPeriod:10,godCandleAtrMult:2,intraCandleMoveAtrMult:1.5,pauseAfterGodCandleMs:3e5},momentum:{lookbackCandles:5,strongMomentumThreshold:4}
2,weakBounce:{enabled:!0,minBodyRatio:.3},extendedTargets:{enabled:!0,cascadeTpMultiples:[1,2,3,5,8]}};let fo,mo,_o,yo,wo,bo,So,Eo,To,xo=null,Co=null,Ao=null,Po=[],ko=!1,Lo=null;function Io(e){return"number"==typeof e&&Number.isFinite(e)}function Do(){const e=Es();let t=Number(null==e?void 0:e.price);if(!Number.isFinite(t)){const e=wr();t=Array.isArray(null==e?void 0:e.candles)&&e.candles.length?Number(e.candles.at(-1)[4]):NaN}return Number.isFinite(t)?t>=1e3?1:t>=100?.1:t>=1?.01:t>=.1?.001:t>=.01?1e-4:t>=.001?1e-5:1e-6:.01}function Oo(e){const t=Do();return Math.round(e/t)*t}function No(e){return Do()*e}function Mo(e){if(!Io(e))return"â";let t=0,n=Do();for(;n<1&&t<8;)n*=10,t++;return Oo(e).toFixed(Math.min(8,t))}function $o(e,t){const n=e.slice(-12);return n.length?{hi:Math.max(...n.map(e=>e.close)),lo:Math.min(...n.map(e=>e.close))}:{hi:void 0,lo:void 0}}function Ro(e,t){if(!Array.isArray(e)||e.length<2)return 0;const n=Math.min(t,e.length-1);let i=0;for(let s=e.length-n;s<e.length;s++){const t=e[s],n=e[s-1]||t;i+=Math.max(t.high-t.low,Math.abs(t.high-n.close),Math.abs(t.low-n.close))}return i/n}function Fo(){const e=Date.now()-72e5;Po=Po.filter(t=>t.ts>e)}function Uo(){Fo();const e=go.cascade.windowMs,t=Po.filter(t=>Date.now()-t.ts<e),n=t.filter(e=>"long"===e.side),i=t.filter(e=>"short"===e.side),s=go.cascade.minTp3Count;if(i.length>=s){const e=i[i.length-1];return{active:!0,side:"short",count:i.length,lastTp3Ts:e.ts,message:`ð´ CASCADE SHORT: ${i.length} short TP3s in last hour. Momentum is DOWN.`}}if(n.length>=s){const e=n[n.length-1];return{active:!0,side:"long",count:n.length,lastTp3Ts:e.ts,message:`ð¢ CASCADE LONG: ${n.length} long TP3s in last hour. Momentum is UP.`}}return{active:!1,side:null,count:0,lastTp3Ts:null,message:"No cascade detected."}}function Bo(){var e;try{const t=Es();return`clawDecisionV2:${String((null==(e=null==t?void 0:t.token)?void 0:e.label)||"").toUpperCase()}`}catch{return"clawDecisionV2:"}}function qo(){try{return"undefined"!=typeof localStorage}catch{return!1}}function jo(e){try{if(!qo())return;const t=Bo(),n={ts:Date.now(),kind:e.kind};"LONG_READY"!==e.kind&&"SHORT_READY"!==e.kind||(n.side="LONG_READY"===e.kind?"long":"short",n.entry=e.entry,n.stop=e.stop,n.tps=e.tps||[],n.invalidate=e.invalidate,n.stage=(null==Co?void 0:Co.stage)??0,n.triggeredAt=null==Co?void 0:Co.triggeredAt),localStorage.setItem(t,JSON.stringify(n))}catch{}}function Wo(){const e=function(){var e;const t=Es();return`${String((null==(e=null==t?void 0:t.token)?void 0:e.label)||"").toUpperCase()}:${String((null==t?void 0:t.timeframe)??"5m")}`}();e!==_o&&(xo=null,Co=null,Ao=null,fo=void 0,mo=void 0,yo=void 0,_o=e,function(){try{if(!qo())return;const e=Bo(),t=localStorage.getItem(e);if(!t)return;const n=JSON.parse(t);if(!n||"object"!=typeof n)return;if(!Number.isFinite(n.ts)||Date.now()-Number(n.ts)>432e5)return void localStorage.removeItem(e);if("LONG_READY"===n.kind||"SHORT_READY"===n.kind){const e="LONG_READY"===n.kind?"long":"short",t=Number(n.entry),i=Number(n.stop),s=Array.isArray(n.tps)?n.tps.map(e=>Number(e)).filter(e=>Number.isFinite(e)):[],r=Number(n.invalidate),o="number"==typeof n.stage&&n.stage>=0&&n.stage<=3?n.stage:0,a="string"==typeof n.triggeredAt?n.triggeredAt:void 0;[t,i,r].every(e=>Number.isFinite(e))&&(Co={side:e,entry:t,stop:i,tps:s,invalidate:r,stage:o,triggeredAt:a})}}catch{}}())}function Ho(e){Ao&&(e>Ao.lo&&e<Ao.hi?Ao.backInsideCount+=1:Ao.backInsideCount=0,Ao.backInsideCount>=3&&(Ao=null))}function Vo(){function e(){var e,t,n;const i=String((null==(t=null==(e=Es())?void 0:e.token)?void 0:t.label)||"").toUpperCase(),s=wr(),r=String((null==s?void 0:s.symbol)||"").toUpperCase()===i?null==s?void 0:s.candles:[];let o=[];if(Array.isArray(r)&&r.length)o=r.map(([e,t,n,i,s])=>({ts:Number(e),open:Number(t),high:Number(n),low:Number(i),close:Number(s)}));else{const e=Es(),t=String((null==e?void 0:e.timeframe)??"5m"),i=null==(n=null==e?void 0:e.ohlcv)?void 0:n[t];o=Array.isArray(i)?i:[]}const a=new Map;for(const l of o)if([l.open,l.high,l.low,l.close].every(Io)){const e=Number(l.ts??0);a.set(e,{...l,ts:e})}return[...a.values()].sort((e,t)=>
2(e.ts??0)-(t.ts??0))}return{decide:function(t){var n,i,s;Wo(),void 0!==t&&Io(s=t)&&(bo=s);const r=e(),o=r.at(-1),a=r.at(-2),l=$o(r),c=Uo(),u=function(e,t){!function(e){const t=Date.now();if(!Eo||!To||t-To>36e5){const n=Ro(e,50);n>0&&(Eo=n,To=t)}}(e);const n=Ro(e,go.volatility.rollingAtrPeriod),i=Eo||n,s=n>i*go.volatility.highVolAtrMult,r=e.at(-1),o=r?r.high-r.low:0,a=o>i*go.volatility.godCandleAtrMult;let l=0;t&&r&&(l=Math.abs(t-r.open));const c=l>i*go.volatility.intraCandleMoveAtrMult;let u="";return u=a?`ð GOD CANDLE: Last candle range ${Mo(o)} > ${go.volatility.godCandleAtrMult}x ATR`:s?`â ï¸ HIGH VOLATILITY: ATR ${Mo(n)} > ${go.volatility.highVolAtrMult}x normal (${Mo(i)})`:c?`â¡ BIG INTRA-CANDLE MOVE: ${Mo(l)} from candle open`:"Volatility normal.",{highVol:s,currentAtr:n,normalAtr:i,godCandleDetected:a,intraCandleMove:l,message:u}}(r,bo);Lo=u;const d=function(e){const t=go.momentum.lookbackCandles,n=e.slice(-t);if(n.length<t)return{direction:"neutral",strength:0};let i=0,s=0;for(const o of n)o.close>o.open?i++:o.close<o.open&&s++;const r=go.momentum.strongMomentumThreshold;return i>=r?{direction:"up",strength:i/t}:s>=r?{direction:"down",strength:s/t}:{direction:"neutral",strength:0}}(r),h=function(e){if(e.length<2)return!1;const t=e.at(-1),n=e.at(-2),i=Math.abs(t.close-t.open),s=Math.abs(n.close-n.open);if(0===s)return!1;const r=i/s;return t.close>t.open!=n.close>n.open&&r<go.weakBounce.minBodyRatio}(r);if(u.godCandleDetected&&go.volatility.enabled&&(So=Date.now()+go.volatility.pauseAfterGodCandleMs),So&&Date.now()<So)return ko=!0,{kind:"PAUSED",text:"ð PAUSED: God candle detected. Waiting for volatility to calm.",reason:"god_candle",cascadeState:c,volatilityState:u};if(ko&&(ko=!1,Ao=null,Co=null,xo=null,fo=void 0,mo=void 0),!(Io(l.hi)&&Io(l.lo)&&o)){const e={kind:"NEUTRAL_WAIT",text:"Waiting for enough candles to compute range.",cascadeState:c,volatilityState:u};return jo(e),e}let p=l.lo,v=l.hi,g="";if(Ao)p=Ao.lo,v=Ao.hi;else{const e=No(3),t=o.close>p+.2*(v-p)&&o.close<p+.8*(v-p);void 0===fo&&(fo=p),void 0===mo&&(mo=v),Math.abs(p-fo)>=e&&t&&(fo=p),Math.abs(v-mo)>=e&&t&&(mo=v),p=fo,v=mo;const n=function(e,t){if(Ao||Co||xo)return{lo:e,hi:t,note:""};const n=wr();if(!Array.isArray(null==n?void 0:n.yAxis)||!Array.isArray(null==n?void 0:n.liquidationLeverage))return{lo:e,hi:t,note:""};const i=n.yAxis,s=n.liquidationLeverage,r={};for(const h of s){const e=Number(h[1]),t=Number(h[2]);Number.isFinite(e)&&Number.isFinite(t)&&(r[e]=(r[e]||0)+t)}const o=Object.entries(r).map(([e,t])=>({price:i[Number(e)],w:Number(t)})).filter(e=>Number.isFinite(e.price));if(!o.length)return{lo:e,hi:t,note:""};const a=No(12),l=o.filter(e=>e.price>t&&e.price-t<=a).sort((e,t)=>t.w-e.w)[0],c=o.filter(t=>t.price<e&&e-t.price<=a).sort((e,t)=>t.w-e.w)[0],u=l?Oo(l.price):t,d=c?Oo(c.price):e;return{lo:d,hi:u,note:l||c?` (HM walls â lower ${Mo(d)}, upper ${Mo(u)})`:""}}(p,v);p=n.lo,v=n.hi,g=n.note}const f=Ro(r,go.atrPeriod);No(go.bufferPts);const m=No(.5);if(!Io(v)||!Io(p)||v<=p){const e={kind:"NEUTRAL_WAIT",text:"Waiting for a valid range.",cascadeState:c,volatilityState:u};return jo(e),e}if(v-p<No(2)){const e={kind:"NEUTRAL_WAIT",up:v,down:p,text:`Range too tight to trade (${Mo(p)}â${Mo(v)}).`,cascadeState:c,volatilityState:u};return jo(e),e}const _=function(e,t,n){const i=No(go.bufferPts),s=Do(),r=Math.max(i,s,Oo(n*go.atrFactor)),o=Oo(t+i),a=Oo(e-i),l=Oo(o-r),c=Oo(a+r),u=Uo().active&&go.extendedTargets.enabled?go.extendedTargets.cascadeTpMultiples:[1,2,3],d=u.map(e=>Oo(o+e*r)),h=u.map(e=>Oo(a-e*r)),p=Oo(t-i),v=Oo(e+i);return{long:{entry:o,stop:l,tps:d,invalidate:p},short:{entry:a,stop:c,tps:h,invalidate:v}}}(p,v,f);let y="";if(c.active&&(y+=` ð CASCADE ${null==(n=c.side)?void 0:n.toUpperCase()} (${c.count}x TP3).`),u.highVol&&(y+=" â ï¸ HIGH VOL."),h&&go.weakBounce.enabled&&(y+=" â¡ WEAK BOUNCE."),"neutral"!==d.direction&&(y+=` ð MOMENTUM ${d.direction.toUpperCase()} (${Math.round(100*d.strength)}%).`),Co){let e="";const t=bo??o.close;if("long"===Co.side?(Co.stage??0)<1&&t>=Co.tps[0]?(Co.stage=1,Co.stop=Oo(v),e=" TP1 hit â SL to range edge."):(Co.stage??0)<2&&t>=Co.tps[1]?(Co.stage=2,Co.stop=Oo(v+No(1)),e=" TP2 hit â trailing."):(Co.stage??0)<3&&t>=Co.tps[2]&&(Co.stage=3,e=" TP3 reached."):(Co.stage??0)<1&&t<=Co.tps[0]?(Co.stage=1,Co.stop=Oo(p),e=" TP1 hit â SL to range edge."):(Co.stage??0)<2&&t<=Co.tps[1]?(Co.stage=2,Co.stop=Oo(p-No(1)),e=" TP2 hit â trailing."):(Co.stage??0)<3&&t<=Co.tps[2]&&(Co.stage=3,e=" TP3 reached."),(Co.stage??0)>=3){const e="long"===Co.side?"Long":"Short",t=c.active&&c.side===Co.side,n="long"===Co.side?Co.entry-Co.stop:Co.stop-Co.entry;let s="";if(t&&go.extendedTargets.enabled){const e=go.extendedTargets.cascadeTpMultiples,t="long"===Co.side?Oo(Co.entry+e[3]*n):Oo(Co.entry-e[3]*n),i="long"===Co.side?Oo(Co.entry+e[4]*n):Oo(Co.entry-e[4]*n);s=` ð CASCADE RIDE: Consider holding runners! TP4 @ ${Mo(t)}, TP5 @ ${Mo(i)}.`}if(!yo){let n;yo=o.ts??Date.now(),wo=Date.now(),function(e,t,n,i){Fo(),Po.push({side:e,ts:Date.now(),price:t,entry:n,tp3:i})}(Co.side,o.close,Co.entry,Co.tps[2]),n=t?`ð¯ ${e} TP3 hit! ð BUT WE'RE IN A ${null==(i=c.side)?void 0:i.toUpperCase()} CASCADE - HOLD ON FOR THE RIDE! ð°${s}${y}${g}`:`${e} TP3 reached! Waiting for next candle + heatmap refresh.${y}${g}`;const r="long"===Co.side?{kind:"LONG_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:n,invalidate:Co.invalidate,cascadeState:c,volatilityState:u}:{kind:"SHORT_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:n,invalidate:Co.invalidate,cascadeState:c,volatilityState:u};return jo(r),r}const a=o.ts??Date.now(),l=a>(yo??0),d=Date.now()-a>=2e4,h=wo?Date.now()-wo:0;if(l&&d||h>=3e5){const n=t;Co=null,xo=null,Ao=null,fo=void 0,mo=void 0,yo=void 0,wo=void 0;const i=$o(r),s=i.lo,o=i.hi;let a=`${e} TP3 completed. Fresh range: ${Mo(s)}â${Mo(o)}.`;n&&(a=`ð¯ ${e} TP3 completed! ð CASCADE still active - look for re-entry! Fresh range: ${Mo(s)}â${Mo(o)}.`);const l={kind:"NEUTRAL_WAIT",up:o,down:s,text:`${a}${y}${g}`,plans:_,cascadeState:c,volatilityState:u};return jo(l),l}{const n=l?"Waiting for heatmap refresh":"Waiting for candle close";let i;i=t?`ð¯ ${e} TP3 hit! ð CASCADE MODE - RIDE IT! ${n}.${s}${y}${g}`:`${e} TP3 reached! ${n}.${y}${g}`;const r="long"===Co.side?{kind:"LONG_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:i,invalidate:Co.invalidate,cascadeState:c,volatilityState:u}:{kind:"SHORT_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:i,invalidate:Co.invalidate,cascadeState:c,volatilityState:u};return jo(r),r}}const n=Co.invalidate;if("long"===Co.side&&o.close<=n||"short"===Co.side&&o.close>=n){Co=null,xo=null,Ho(o.close);
2const e={kind:"NEUTRAL_WAIT",up:v,down:p,text:`Setup invalidated.${y}${g}`,plans:_,cascadeState:c,volatilityState:u};return jo(e),e}const s=Co.triggeredAt?` (triggered at ${Co.triggeredAt})`:"",a="long"===Co.side?`Long active${s}. Entry ${Mo(Co.entry)}, SL ${Mo(Co.stop)}.${e}${y}${g}`:`Short active${s}. Entry ${Mo(Co.entry)}, SL ${Mo(Co.stop)}.${e}${y}${g}`,l="long"===Co.side?{kind:"LONG_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:a,invalidate:Co.invalidate,cascadeState:c,volatilityState:u}:{kind:"SHORT_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:a,invalidate:Co.invalidate,cascadeState:c,volatilityState:u};return jo(l),l}if(xo&&o)if("long"===xo.side){if(o.low<=xo.level&&o.close>=xo.level+m){const e=(new Date).toLocaleTimeString();Co={side:"long",entry:xo.entry,stop:xo.stop,tps:xo.tps,invalidate:xo.invalidate,stage:0,triggeredAt:e},xo=null,Ao||(Ao={lo:p,hi:v,locked:"long",backInsideCount:0},fo=void 0,mo=void 0);const t=`<b>ð¢ LONG LEAN triggered at ${e}</b>${y}${g}`,n={kind:"LONG_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:t,invalidate:Co.invalidate,cascadeState:c,volatilityState:u};return jo(n),n}}else if(o.high>=xo.level&&o.close<=xo.level-m){const e=(new Date).toLocaleTimeString();Co={side:"short",entry:xo.entry,stop:xo.stop,tps:xo.tps,invalidate:xo.invalidate,stage:0,triggeredAt:e},xo=null,Ao||(Ao={lo:p,hi:v,locked:"short",backInsideCount:0},fo=void 0,mo=void 0);const t=`<b>ð´ SHORT LEAN triggered at ${e}</b>${y}${g}`,n={kind:"SHORT_READY",entry:Co.entry,stop:Co.stop,tps:Co.tps,text:t,invalidate:Co.invalidate,cascadeState:c,volatilityState:u};return jo(n),n}const w=o.close,b=null==a?void 0:a.close,S=go.range.hysteresis.needTwoCloses?Io(b)&&b>=v&&w>=v+m:w>=v+m,E=go.range.hysteresis.needTwoCloses?Io(b)&&b<=p&&w<=p-m:w<=p-m,T=w-v>=go.strongBreakAtrMult*(f||0),x=p-w>=go.strongBreakAtrMult*(f||0);if(!Co&&!xo){const e=c.active&&"short"===c.side&&go.cascade.blockOppositeSignals,t=c.active&&"long"===c.side&&go.cascade.blockOppositeSignals;if(S||T){if(e){const e={kind:"NEUTRAL_WAIT",up:v,down:p,text:`ð« LONG blocked by cascade. ${c.count}x short TP3s.${y}${g}`,plans:_,cascadeState:c,volatilityState:u};return jo(e),e}const t=_.long.entry,n=_.long.stop,i=_.long.tps,s=_.long.invalidate;if(xo={side:"long",level:v,entry:t,stop:n,tps:i,invalidate:s},Ao||(Ao={lo:p,hi:v,locked:"long",backInsideCount:0},fo=void 0,mo=void 0),go.allowAggressiveActivation&&w>=v+m){const e=(new Date).toLocaleTimeString();Co={side:"long",entry:t,stop:n,tps:i,invalidate:s,stage:0,triggeredAt:e},xo=null;const r={kind:"LONG_READY",entry:t,stop:n,tps:i,text:`<b>ð¢ LONG LEAN triggered at ${e}</b> (break-and-go)${y}${g}`,invalidate:s,cascadeState:c,volatilityState:u};return jo(r),r}const r={kind:"NEUTRAL_WAIT",up:v,down:p,text:`Armed long above ${Mo(v)} â waiting retest.${y}`,plans:_,cascadeState:c,volatilityState:u};return jo(r),r}if(E||x){if(t){const e={kind:"NEUTRAL_WAIT",up:v,down:p,text:`ð« SHORT blocked by cascade. ${c.count}x long TP3s.${y}${g}`,plans:_,cascadeState:c,volatilityState:u};return jo(e),e}const e=_.short.entry,n=_.short.stop,i=_.short.tps,s=_.short.invalidate;if(xo={side:"short",level:p,entry:e,stop:n,tps:i,invalidate:s},Ao||(Ao={lo:p,hi:v,locked:"short",backInsideCount:0},fo=void 0,mo=void 0),go.allowAggressiveActivation&&w<=p-m){const t=(new Date).toLocaleTimeString();Co={side:"short",entry:e,stop:n,tps:i,invalidate:s,stage:0,triggeredAt:t},xo=null;const r={kind:"SHORT_READY",entry:e,stop:n,tps:i,text:`<b>ð´ SHORT LEAN triggered at ${t}</b> (break-and-go)${y}${g}`,invalidate:s,cascadeState:c,volatilityState:u};return jo(r),r}const r={kind:"NEUTRAL_WAIT",up:v,down:p,text:`Armed short below ${Mo(p)} â waiting retest.${y}`,plans:_,cascadeState:c,volatilityState:u};return jo(r),r}}Co||xo||Ho(o.close);const C={kind:"NEUTRAL_WAIT",up:v,down:p,text:`Range ${Mo(p)}â${Mo(v)}.${y}${g}`,plans:_,cascadeState:c,volatilityState:u};return jo(C),C},computeFacts:function(){Wo();const t=e(),n=t.at(-1),i=$o(t);let s=i.lo,r=i.hi;const o=Io(r)&&Io(s)&&!!n;return o&&Ao&&(s=Ao.lo,r=Ao.hi),{candles:t,candlesCount:t.length,last:n,rangeHi:r,rangeLo:s,enoughData:o}},describeFacts:function(e){var t,n,i;return{summary:Io(e.rangeHi)&&Io(e.rangeLo)&&Io(null==(t=e.last)?void 0:t.close)?`Range ${Mo(e.rangeLo)}â${Mo(e.rangeHi)}; last ${Mo(null==(n=e.last)?void 0:n.close)}.`:"Not enough data to compute range.",waiting:!e.enoughData,candles:e.candlesCount,rangeHi:e.rangeHi,rangeLo:e.rangeLo,lastClose:null==(i=e.last)?void 0:i.close}},getCascadeState:Uo}}const zo={name:"Breakout Bot V2 Signals",metainfo:{_metainfoVersion:51,id:"BreakoutBotV2@tv-basicstudies-1",name:"Breakout Bot V2 Signals",description:"Shows BB V2 entry and take profit levels with cascade detection",shortDe
2scription:"Breakout Bot V2",is_price_study:!0,is_hidden_study:!1,isCustomIndicator:!0,format:{type:"price",precision:2},plots:[{id:"long_entry",type:"line"},{id:"long_tp1",type:"line"},{id:"long_tp2",type:"line"},{id:"long_tp3",type:"line"},{id:"short_entry",type:"line"},{id:"short_tp1",type:"line"},{id:"short_tp2",type:"line"},{id:"short_tp3",type:"line"}],defaults:{styles:{long_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ffaa"},long_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ffaa"},long_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ffaa"},long_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ffaa"},short_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff6b6b"},short_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff6b6b"},short_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff6b6b"},short_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff6b6b"}},inputs:{}},styles:{long_entry:{title:"V2 Long Entry",histogramBase:0,joinPoints:!1},long_tp1:{title:"V2 Long TP1",histogramBase:0,joinPoints:!1},long_tp2:{title:"V2 Long TP2",histogramBase:0,joinPoints:!1},long_tp3:{title:"V2 Long TP3",histogramBase:0,joinPoints:!1},short_entry:{title:"V2 Short Entry",histogramBase:0,joinPoints:!1},short_tp1:{title:"V2 Short TP1",histogramBase:0,joinPoints:!1},short_tp2:{title:"V2 Short TP2",histogramBase:0,joinPoints:!1},short_tp3:{title:"V2 Short TP3",histogramBase:0,joinPoints:!1}},inputs:[]},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._lastDecisionKey=null,this._updateCounter=0,this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN},this.main=function(e,t){var n,i,s,r,o,a,l;this._context=e,this._input=t,this._updateCounter++;try{const{decide:e}=Vo(),t=e(),c=`${t.kind}-${"LONG_READY"===t.kind||"SHORT_READY"===t.kind?`${t.entry}-${t.stop}-${null==(n=t.tps)?void 0:n.join(",")}`:"PAUSED"===t.kind?`paused-${t.reason}`:(null==(s=null==(i=t.plans)?void 0:i.long)?void 0:s.entry)+"|"+(null==(o=null==(r=t.plans)?void 0:r.short)?void 0:o.entry)}`;return c!==this._lastDecisionKey&&(this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN,"PAUSED"===t.kind||("LONG_READY"===t.kind?(this._cachedLongEntry=t.entry,Array.isArray(t.tps)&&t.tps.length>=3&&(this._cachedLongTp1=t.tps[0],this._cachedLongTp2=t.tps[1],this._cachedLongTp3=t.tps[2])):"SHORT_READY"===t.kind?(this._cachedShortEntry=t.entry,Array.isArray(t.tps)&&t.tps.length>=3&&(this._cachedShortTp1=t.tps[0],this._cachedShortTp2=t.tps[1],this._cachedShortTp3=t.tps[2])):"NEUTRAL_WAIT"===t.kind&&t.plans&&((null==(a=t.plans.long)?void 0:a.entry)&&(this._cachedLongEntry=t.plans.long.entry),(null==(l=t.plans.short)?void 0:l.entry)&&(this._cachedShortEntry=t.plans.short.entry))),this._lastDecisionKey=c),[this._cachedLongEntry,this._cachedLongTp1,this._cachedLongTp2,this._cachedLongTp3,this._cachedShortEntry,this._cachedShortTp1,this._cachedShortTp2,this._cachedShortTp3]}catch(c){return console.error("ð¤ [Breakout Bot V2] Error in main():",c),[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN]}}}},Go={minWallIntensity:100,maxWallsPerSide:3,wallAggregationTicks:5,nearestMinIntensityPct:.002,approachTicks:25,atrApproachMult:.6,sweepMinPenetration:0,rejectionEpsTicks:2,sweepTolerancePct:{TIER_HIGH:5e-4,TIER_MID:.001,TIER_LOW:.0015,ETH:.0015},entryBufferTicks:3,stopBufferTicks:5,atrStopMult:1,tpMultiples:[1,1.5,2.5],minRR:1.5,maxStopPct:.02,invalidateTicks:3,softInvalidationCandles:2,atrPeriod:14,godCandleAtrMult:2,persistExpiryMs:432e5,tickSizes:{BTC:5,ETH:1,SOL:.05,DOGE:.001,TRX:1e-4,DEFAULT:.01},minStopTicksBySymbol:{BTC:25,ETH:20,SOL:15,DEFAULT:15},featureFlags:{allowImmediateActivation:!0}},Yo=5e6;let Ko,Jo,Qo=null,Xo=null,Zo=null;const ea=Go.persistExpiryMs;function ta(e){return"number"==typeof e&&Number.isFinite(e)}function na(){var e;try{const t=Es();return String((null==(e=null==t?void 0:t.token)?void 0:e.label)||"").toUpperCase()}catch{return""}}function ia(){const e=na();if(Go.tickSizes[e])return Go.tickSizes[e];const t=Es();let n=Number(null==t?void 0:t.price);if(!Number.isFinite(n)){const e=wr();n=Array.isArray(null==e?void 0:e.candles)&&e.candles.length?Number(e.candles.at(-1)[4]):NaN}return Number.isFinite(n)?n>=1e3?Go.tickSizes.DEFAULT:n>=100?.1:n>=1?.01:n>=.1?.001:n>=.01?1e-4:1e-5:Go.tickSizes.DEFAULT}function sa(e){const t=ia();return Math.round(e/t)*t}function ra(e){return ia()*e}function oa(e){const t=na(),n=Go.sweepTolerancePct||{};return void 0!==n[t]?e*n[t]:e>=1e4?e*(n.TIER_HIGH||5e-4):e>=100?e*(n.TIER_MID||.001):e*(n.TIER_LOW||.0015)}function aa(e){if(!ta(e))return"â";let t=0,n=ia();for(;n<1&&t<8;)n*=10,t++;return sa(e).toFixed(Math.min(8,t))}function la(){var e;
2const t=na(),n=wr(),i=String((null==n?void 0:n.symbol)||"").toUpperCase()===t?null==n?void 0:n.candles:[];let s=[];if(Array.isArray(i)&&i.length)s=i.map(([e,t,n,i,s])=>({ts:Number(e),open:Number(t),high:Number(n),low:Number(i),close:Number(s)}));else{const t=Es(),n=String((null==t?void 0:t.timeframe)??"5m"),i=null==(e=null==t?void 0:t.ohlcv)?void 0:e[n];s=Array.isArray(i)?i:[]}const r=new Map;for(const o of s)if([o.open,o.high,o.low,o.close].every(ta)){const e=Number(o.ts??0);r.set(e,{...o,ts:e})}return[...r.values()].sort((e,t)=>(e.ts??0)-(t.ts??0))}function ca(e){var t,n,i,s;const r=wr();if(!Array.isArray(null==r?void 0:r.yAxis)||!Array.isArray(null==r?void 0:r.liquidationLeverage))return{upper:null,lower:null,allWalls:[]};const o=r.yAxis,a=r.liquidationLeverage,l=r.candles||[],c=new Map;for(let b=0;b<l.length;b++){const e=l[b],t=Number(e[2]),n=Number(e[3]);if(!Number.isFinite(t)||!Number.isFinite(n))continue;const i=ra(Go.wallAggregationTicks),s=Math.floor(n/i)*i,r=Math.ceil(t/i)*i;for(let o=s;o<=r;o+=i)c.set(o,b)}const u=new Map;for(const b of a){const e=Number(b[0]),t=Number(b[1]),n=Number(b[2]);if(!Number.isFinite(t)||!Number.isFinite(n)||n<=0)continue;const i=o[t];if(!ta(i))continue;const s=sa(Math.round(i/ra(Go.wallAggregationTicks))*ra(Go.wallAggregationTicks)),r=c.get(s);!(void 0!==r&&e<=r)&&u.set(s,(u.get(s)||0)+n)}if(0===u.size)return{upper:null,lower:null,allWalls:[]};const d=[];for(const[b,S]of u)S>=Go.minWallIntensity&&d.push({price:b,intensity:S});if(0===d.length)return{upper:null,lower:null,allWalls:[]};let h;{const e=Math.max(...d.map(e=>e.intensity))*Go.nearestMinIntensityPct;h=d.filter(t=>t.intensity>=e),d.length,h.length,(100*Go.nearestMinIntensityPct).toFixed(0),e.toFixed(0)}const p=ra(5),v=la().slice(-24),g=h.filter(e=>!function(e,t,n=0){for(const i of t)if(i.low-n<=e&&e<=i.high+n)return!0;return!1}(e.price,v,p));h.length-g.length>0&&g.length;const f=g.filter(t=>t.price>e),m=g.filter(t=>t.price<e);f.sort((e,t)=>e.price-t.price),m.sort((e,t)=>t.price-e.price),null==(n=null==(t=f[0])?void 0:t.price)||n.toFixed(0),null==(s=null==(i=m[0])?void 0:i.price)||s.toFixed(0);const _=f.slice(0,Go.maxWallsPerSide),y=m.slice(0,Go.maxWallsPerSide),w=[..._.map((e,t)=>({...e,rank:t+1})),...y.map((e,t)=>({...e,rank:t+1}))];return{upper:_.length>0?{..._[0],rank:1}:null,lower:y.length>0?{...y[0],rank:1}:null,allWalls:w}}function ua(){return`clawMagnet:${na()}`}function da(){try{return"undefined"!=typeof localStorage}catch{return!1}}function ha(e){if(da())try{const t=ua(),n={ts:Date.now(),kind:e.kind};"LONG_READY"!==e.kind&&"SHORT_READY"!==e.kind||(n.side="LONG_READY"===e.kind?"long":"short",n.entry=e.entry,n.stop=e.stop,n.tps=e.tps,n.invalidate=e.invalidate,n.wall=e.wall,n.sweepExtreme="LONG_READY"===e.kind?e.sweepLow:e.sweepHigh,n.stage=(null==Qo?void 0:Qo.stage)??0,n.triggeredAt=null==Qo?void 0:Qo.triggeredAt,n.triggeredCandleTs=null==Qo?void 0:Qo.triggeredCandleTs),"SWEEP_UPPER"!==e.kind&&"SWEEP_LOWER"!==e.kind||(n.wall=e.wall,n.sweepExtreme="SWEEP_UPPER"===e.kind?e.sweepHigh:e.sweepLow,Xo&&(n.candleTs=Xo.candleTs,n.candlesPastWall=Xo.candlesPastWall)),localStorage.setItem(t,JSON.stringify(n))}catch(t){}}function pa(e,t,n,i,s){const r=na(),o=Go.minStopTicksBySymbol[r]||Go.minStopTicksBySymbol.DEFAULT;if("long"===e){const e=sa(t.price+ra(Go.entryBufferTicks));let i=Math.abs(e-n)+ra(Go.stopBufferTicks);i=Math.max(i,s*Go.atrStopMult),i=Math.max(i,ra(o));const r=sa(e-i),a=e-r;let l;l=Go.tpMultiples.map(t=>sa(e+a*t));const c=sa(t.price-ra(Go.invalidateTicks)),u=(Math.max(...l)-e)/a;if(u<Go.minRR)return u.toFixed(2),null;const d=a/e;return d>Go.maxStopPct?((100*d).toFixed(2),null):{entry:e,stop:r,tps:l,invalidate:c}}{const e=sa(t.price-ra(Go.entryBufferTicks));let i=Math.abs(n-e)+ra(Go.stopBufferTicks);i=Math.max(i,s*Go.atrStopMult),i=Math.max(i,ra(o));const r=sa(e+i),a=r-e;let l;l=Go.tpMultiples.map(t=>sa(e-a*t));const c=sa(t.price+ra(Go.invalidateTicks)),u=Math.min(...l),d=(e-u)/a;if(d<Go.minRR)return d.toFixed(2),null;const h=a/e;return h>Go.maxStopPct?((100*h).toFixed(2),null):{entry:e,stop:r,tps:l,invalidate:c}}}function va(){function e(){if(Zo)return Zo;const e=la().at(-1);return e?ca(e.close):{upper:null,lower:null}}return{decide:function(e){var t,n;!function(){const e=function(){const e=Es();return`${na()}:${String((null==e?void 0:e.timeframe)??"5m")}`}();e!==Ko&&(Qo=null,Xo=null,Zo=null,Jo=void 0,Ko=e,function(){if(da())try{const e=ua(),t=localStorage.getItem(e);if(!t)return;const n=JSON.parse(t);if(!n||"object"!=typeof n)return;if(!Number.isFinite(n.ts)||Date.now()-Number(n.ts)>ea)return void localStorage.removeItem(e);if("LONG_READY"===n.kind||"SHORT_READY"===n.kind){const e="LONG_READY"===n.kind?"long":"short",t=Number(n.entry),i=Number(n.stop),s=Array.isArray(n.tps)?n.tps.map(Number).filter(ta):[],r=Number(n.invalidate),o="number"==typeof n.stage&&n.stage>=0&&n.stage<=3?n.stage:0,a="string"==typeof n.triggeredAt?n.triggeredAt:(new Date).toLocaleTimeString(),l=n.wall,c=Number(n.sweepExtreme),u="number"==typeof n.triggeredCandleTs?n.triggeredCandleTs:void 0;[t,i,r,c].every(ta)&&l&&(Qo={side:e,entry:t,stop:i,tps:s,invalidate:r,stage:o,wall:l,sweepExtreme:c,triggeredAt:a,triggeredCandleTs:u})}if("SWEEP_UPPER"===n.kind||"SWEEP_LOWER"===n.kind){const e=n.wall,t=Number(n.sweepExtreme),i="number"==typeof n.candleTs?n.candleTs:Date.now(),s="number"==typeof n.candlesPastWall?n.candlesPastWall:0;e&&ta(t)&&(Xo={side:"SWEEP_UPPER"===n.kind?"upper":"lower",wall:e,sweepExtreme:t,candleTs:i,candlesPastWall:s})}}catch(e){}}())}();const i=la(),s=i.at(-1);if(!s)return{kind:"NEUTRAL_SCAN",text:"Waiting for candle data..."};const r=e&&Number.isFinite(e)?e:s.close,o=s.close,a=function(e,t){if(!Array.isArray(e)||e.length<2)return 0;const n=Math.min(t,e.length-1);let i=0;for(let s=e.length-n;s<e.length;s++){const t=e[s],n=e[s-1]||t;i+=Math.max(t.high-t.low,Math.abs(t.high-n.close),Math.abs(t.low-n.close))}return i/n}(i,Go.atrPeriod),l=ra(Go.rejectionEpsTicks);let c;if(Zo&&(Qo||Xo))c=Zo;else{const e=ca(o);(!Zo||(!Zo.lower||Math.abs(o-Zo.lower.price)>.02*o)&&(!Zo.upper||Math.abs(o-Zo.upper.price)>.02*o))&&(Zo=e,null==(t=Zo.upper)||t.price,null==(n=Zo.lower)||n.price),c=Zo??e}const{upper:u,lower:d}=c;if(Qo){let e="";if("long"===Qo.side?Qo.stage<1&&r>=Qo.tps[0]?(Qo.stage=1,Qo.stop=sa(Qo.wall.price),e=" TP1 hit â SL moved to wall."):Qo.stage<2&&r>=Qo.tps[1]?(Qo.stage=2,Qo.stop=sa(Qo.wall.price+ra(2)),e=" TP2 hit â trailing."):Qo.stage<3&&r>=Qo.tps[2]&&(Qo.stage=3,e=" TP3 reached!"):Qo.stage<1&&r<=Qo.tps[0]?(Qo.stage=1,Qo.stop=sa(Qo.wall.price),e=" TP1 hit â SL moved to wall."):Qo.stage<2&&r<=Qo.tps[1]?(Qo.stage=2,Qo.stop=sa(Qo.wall.price-ra(2)),e=" TP2 hit â trailing."):Qo.stage<3&&r<=Qo.tps[2]&&(Qo.stage=3,e=" TP3 reached!"),Qo.stage>=3){Jo||(Jo=s.ts??Date.now());const e=(s.ts??0)>(Jo??0),t=Date.now()-(s.ts??0);if(e&&t>=2e4){const e="long"===Qo.side?"Long":"Short";Qo=null,Zo=null,Xo=null,Jo=void 0;const t={kind:"NEUTRAL_SCAN",text:`${e} trade completed (TP3). Scanning for new walls...`,walls:ca(o)};return ha(t),t}const n=e?`Heatmap refresh (${Math.max(0,20-Math.floor(t/1e3))}s)`:"Waiting for candle close",i=`${"long"===Qo.side?"Long":"Short"} TP3 reached! ${n}. Entry ${aa(Qo.entry)}, TPs ${Qo.tps.map(aa).join(", ")}.`,r="long"===Qo.side?{kind:"LONG_READY",entry:Qo.entry,stop:Qo.stop,tps:Qo.tps,invalidate:Qo.invalidate,text:i,wall:Qo.wall,sweepLow:Qo.sweepExtreme,triggeredAt:Qo.triggeredAt}:{kind:"SHORT_READY",entry:Qo.entry,stop:Qo.stop,tps:Qo.tps,invalidate:Qo.invalidate,text:i,wall:Qo.wall,sweepHigh:Qo.sweepExtreme,triggeredAt:Qo.triggeredAt};return ha(r),r}if(!Qo.triggeredCandleTs||s.ts!==Qo.triggeredCandleTs){const e=Qo.stop,t="long"===Qo.side;if(t&&o<=e||!t&&o>=e){Qo=null,Zo=null,Xo=null;
2const n=ca(o),i={kind:"NEUTRAL_SCAN",text:`Setup invalidated (close ${aa(o)} ${t?"below":"above"} stop ${aa(e)}). Scanning for new walls...`,walls:n};return ha(i),i}}const t=Qo.triggeredAt?` (triggered ${Qo.triggeredAt})`:"",n=`${"long"===Qo.side?"ð¢ Long":"ð´ Short"} MAGNET active${t}. Entry ${aa(Qo.entry)}, SL ${aa(Qo.stop)}, TP ${Qo.tps.map(aa).join(", ")}.${e}`,i="long"===Qo.side?{kind:"LONG_READY",entry:Qo.entry,stop:Qo.stop,tps:Qo.tps,invalidate:Qo.invalidate,text:n,wall:Qo.wall,sweepLow:Qo.sweepExtreme,triggeredAt:Qo.triggeredAt}:{kind:"SHORT_READY",entry:Qo.entry,stop:Qo.stop,tps:Qo.tps,invalidate:Qo.invalidate,text:n,wall:Qo.wall,sweepHigh:Qo.sweepExtreme,triggeredAt:Qo.triggeredAt};return ha(i),i}if(!u&&!d){Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:"No significant liquidation walls detected. Waiting for walls to form...",walls:{upper:null,lower:null}};return ha(e),e}let h=null,p=!1,v=!1;try{h=Uo(),h.active&&("short"===h.side?(p=!0,h.count):"long"===h.side&&(v=!0,h.count))}catch(x){}let g=!1,f="",m=null;try{m=Lo,(null==m?void 0:m.godCandleDetected)&&(g=!0,f=`ð¥ BB V2 GOD CANDLE: ${m.message}`)}catch(x){}const _=s.high-s.low,y=a*Go.godCandleAtrMult;if(_>y&&(g=!0,f=`ð¥ LM GOD CANDLE detected (${_.toFixed(0)}pt > ${y.toFixed(0)}pt threshold). Pausing entries.`),!g&&i.length>=2){const e=i[i.length-2],t=e.high-e.low;t>y&&(g=!0,f=`ð¥ Recent GOD CANDLE (${t.toFixed(0)}pt). Still in pause window.`)}if(Xo){const e=Xo.wall;if("lower"===Xo.side){if(!(s.close>e.price+l)){if(Xo.candlesPastWall+=1,Xo.candlesPastWall>=Go.softInvalidationCandles){Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:"Sweep failed to reject in time. Resetting...",walls:ca(o)};return ha(e),e}const t={kind:"SWEEP_LOWER",wall:e,sweepLow:Xo.sweepExtreme,text:`â¡ Lower wall SWEPT at ${aa(e.price)}. Sweep low: ${aa(Xo.sweepExtreme)}. Waiting for rejection close above ${aa(e.price+l)}... (${Xo.candlesPastWall}/${Go.softInvalidationCandles} candles)`};return ha(t),t}{if(p){null==h||h.count,Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Long entry blocked.${h?` ð CASCADE SHORT active (${h.count}x TP3) - not fading this move.`:""} BB says momentum is DOWN.`,walls:{upper:u,lower:d}};return ha(e),e}if(g){Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Long entry blocked. ${f}`,walls:{upper:u,lower:d}};return ha(e),e}const t=pa("long",e,Xo.sweepExtreme,0,a);if(t&&Go.featureFlags.allowImmediateActivation){const n=(new Date).toLocaleTimeString();Qo={side:"long",...t,stage:0,wall:e,sweepExtreme:Xo.sweepExtreme,triggeredAt:n,triggeredCandleTs:s.ts},Zo={upper:u,lower:d};const i=Xo.sweepExtreme;Xo=null;const r=`<b>ð¢ LONG MAGNET triggered at ${n}</b><br>Swept ${aa(e.price)} (intensity ${e.intensity.toFixed(0)}), rejected at ${aa(s.close)}.<br>Entry ${aa(t.entry)}, SL ${aa(t.stop)}, TP ${t.tps.map(aa).join(", ")}.`,o={kind:"LONG_READY",...t,text:r,wall:e,sweepLow:i??s.low,triggeredAt:n};return ha(o),o}t||(Xo=null)}}else{if(!(s.close<e.price-l)){if(Xo.candlesPastWall+=1,Xo.candlesPastWall>=Go.softInvalidationCandles){Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:"Sweep failed to reject in time. Resetting...",walls:ca(o)};return ha(e),e}const t={kind:"SWEEP_UPPER",wall:e,sweepHigh:Xo.sweepExtreme,text:`â¡ Upper wall SWEPT at ${aa(e.price)}. Sweep high: ${aa(Xo.sweepExtreme)}. Waiting for rejection close below ${aa(e.price-l)}... (${Xo.candlesPastWall}/${Go.softInvalidationCandles} candles)`};return ha(t),t}{if(v){null==h||h.count,Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Short entry blocked.${h?` ð CASCADE LONG active (${h.count}x TP3) - not fading this move.`:""} BB says momentum is UP.`,walls:{upper:u,lower:d}};return ha(e),e}if(g){Xo=null,Zo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Short entry blocked. ${f}`,walls:{upper:u,lower:d}};return ha(e),e}const t=pa("short",e,Xo.sweepExtreme,0,a);if(t&&Go.featureFlags.allowImmediateActivation){const n=(new Date).toLocaleTimeString();Qo={side:"short",...t,stage:0,wall:e,sweepExtreme:Xo.sweepExtreme,triggeredAt:n,triggeredCandleTs:s.ts},Zo={upper:u,lower:d};const i=Xo.sweepExtreme;Xo=null;const r=`<b>ð´ SHORT MAGNET triggered at ${n}</b><br>Swept ${aa(e.price)} (intensity ${e.intensity.toFixed(0)}), rejected at ${aa(s.close)}.<br>Entry ${aa(t.entry)}, SL ${aa(t.stop)}, TP ${t.tps.map(aa).join(", ")}.`,o={kind:"SHORT_READY",...t,text:r,wall:e,sweepHigh:i??s.high,triggeredAt:n};return ha(o),o}t||(Xo=null)}}}if(r&&!Xo){const e=oa(r),t=ra(Go.sweepMinPenetration),n=Math.max(e,t);if(d&&r<=d.price+n){d.price,n.toFixed(2),Xo={side:"lower",wall:d,sweepExtreme:r,candleTs:Date.now(),candlesPastWall:0};const e={kind:"SWEEP_LOWER",wall:d,sweepLow:r,text:`â¡ LIVE: Lower wall SWEPT at ${aa(d.price)}! Price: ${aa(r)}. Watching for candle rejection...`};return ha(e),e}if(u&&r>=u.price-n){u.price,n.toFixed(2),Xo={side:"upper",wall:u,sweepExtreme:r,candleTs:Date.now(),candlesPastWall:0};const e={kind:"SWEEP_UPPER",wall:u,sweepHigh:r,text:`â¡ LIVE: Upper wall SWEPT at ${aa(u.price)}! Price: ${aa(r)}. Watching for candle rejection...`};return ha(e),e}}Xo&&r&&("lower"===Xo.side&&r<Xo.sweepExtreme||"upper"===Xo.side&&r>Xo.sweepExtreme)&&(Xo.sweepExtreme=r);const w=oa(s.close),b=ra(Go.sweepMinPenetration),S=Math.max(w,b);
2if(!Xo&&d&&s.low<=d.price+S){if(d.price,s.low,S.toFixed(2),Xo={side:"lower",wall:d,sweepExtreme:s.low,candleTs:s.ts??Date.now(),candlesPastWall:0},s.close>d.price+l){if(p){Xo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Long entry blocked.${h?` ð CASCADE SHORT active (${h.count}x TP3).`:""} BB says momentum is DOWN.`,walls:{upper:u,lower:d}};return ha(e),e}if(g){Xo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Long entry blocked. ${f}`,walls:{upper:u,lower:d}};return ha(e),e}const e=pa("long",d,s.low,0,a);if(e&&Go.featureFlags.allowImmediateActivation){const t=(new Date).toLocaleTimeString();Qo={side:"long",...e,stage:0,wall:d,sweepExtreme:s.low,triggeredAt:t,triggeredCandleTs:s.ts},Zo={upper:u,lower:d},Xo=null;const n=`<b>ð¢ LONG MAGNET triggered at ${t}</b><br>Swept & rejected ${aa(d.price)} on same candle.<br>Entry ${aa(e.entry)}, SL ${aa(e.stop)}, TP ${e.tps.map(aa).join(", ")}.`,i={kind:"LONG_READY",...e,text:n,wall:d,sweepLow:s.low,triggeredAt:t};return ha(i),i}}const e={kind:"SWEEP_LOWER",wall:d,sweepLow:s.low,text:`â¡ Lower wall SWEPT at ${aa(d.price)}! Sweep low: ${aa(s.low)}. Watching for rejection...`};return ha(e),e}if(!Xo&&u&&s.high>=u.price-S){if(u.price,s.high,S.toFixed(2),Xo={side:"upper",wall:u,sweepExtreme:s.high,candleTs:s.ts??Date.now(),candlesPastWall:0},s.close<u.price-l){if(v){Xo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Short entry blocked.${h?` ð CASCADE LONG active (${h.count}x TP3).`:""} BB says momentum is UP.`,walls:{upper:u,lower:d}};return ha(e),e}if(g){Xo=null;const e={kind:"NEUTRAL_SCAN",text:`ð« Short entry blocked. ${f}`,walls:{upper:u,lower:d}};return ha(e),e}const e=pa("short",u,s.high,0,a);if(e&&Go.featureFlags.allowImmediateActivation){const t=(new Date).toLocaleTimeString();Qo={side:"short",...e,stage:0,wall:u,sweepExtreme:s.high,triggeredAt:t,triggeredCandleTs:s.ts},Zo={upper:u,lower:d},Xo=null;const n=`<b>ð´ SHORT MAGNET triggered at ${t}</b><br>Swept & rejected ${aa(u.price)} on same candle.<br>Entry ${aa(e.entry)}, SL ${aa(e.stop)}, TP ${e.tps.map(aa).join(", ")}.`,i={kind:"SHORT_READY",...e,text:n,wall:u,sweepHigh:s.high,triggeredAt:t};return ha(i),i}}const e={kind:"SWEEP_UPPER",wall:u,sweepHigh:s.high,text:`â¡ Upper wall SWEPT at ${aa(u.price)}! Sweep high: ${aa(s.high)}. Watching for rejection...`};return ha(e),e}const E=Math.max(ra(Go.approachTicks),a*Go.atrApproachMult);if(d&&o-d.price<=E&&o>d.price){const e=o-d.price,t={kind:"APPROACH_LOWER",wall:d,distance:e,text:`ð Approaching lower wall at ${aa(d.price)} (intensity ${d.intensity.toFixed(0)}). Distance: ${aa(e)}. Upper wall: ${u?aa(u.price):"none"}.`};return ha(t),t}if(u&&u.price-o<=E&&o<u.price){const e=u.price-o,t={kind:"APPROACH_UPPER",wall:u,distance:e,text:`ð Approaching upper wall at ${aa(u.price)} (intensity ${u.intensity.toFixed(0)}). Distance: ${aa(e)}. Lower wall: ${d?aa(d.price):"none"}.`};return ha(t),t}const T={kind:"NEUTRAL_SCAN",text:`ð Scanning... Upper wall: ${u?`${aa(u.price)} (${u.intensity.toFixed(0)})`:"none"}. Lower wall: ${d?`${aa(d.price)} (${d.intensity.toFixed(0)})`:"none"}. Current: ${aa(o)}.`,walls:{upper:u,lower:d}};return ha(T),T},getWalls:e,getWallPlans:function(){const t=e(),n=la();if(n.length<14)return{upper:null,lower:null};let i=0;for(let e=n.length-14;e<n.length;e++)i+=n[e].high-n[e].low;i/=14;const s={upper:null,lower:null};if(t.upper){const e=t.upper,n=e.price+ra(2);t.lower;const i=sa(e.price-ra(Go.entryBufferTicks));let r=Math.abs(n-i)+ra(Go.stopBufferTicks);const o=na(),a=Go.minStopTicksBySymbol[o]||Go.minStopTicksBySymbol.DEFAULT;r=Math.max(r,ra(a));const l=sa(i+r),c=l-i;let u;u=Go.tpMultiples.map(e=>sa(i-c*e));const d=Math.min(...u),h=(i-d)/c,p=i?c/i*100:0;s.upper={side:"short",wall:e,entry:i,stop:l,tps:u,risk:c,riskPct:p,rr:h}}if(t.lower){const e=t.lower,n=e.price-ra(2);t.upper;const i=sa(e.price+ra(Go.entryBufferTicks));let r=Math.abs(i-n)+ra(Go.stopBufferTicks);const o=na(),a=Go.minStopTicksBySymbol[o]||Go.minStopTicksBySymbol.DEFAULT;r=Math.max(r,ra(a));const l=sa(i-r),c=i-l;let u;u=Go.tpMultiples.map(e=>sa(i+c*e));const d=(Math.max(...u)-i)/c,h=i?c/i*100:0;
2s.lower={side:"long",wall:e,entry:i,stop:l,tps:u,risk:c,riskPct:h,rr:d}}return s}}}const ga={name:"Liquidity Magnet Signals",metainfo:{_metainfoVersion:51,id:"LiquidityMagnet@tv-basicstudies-1",name:"Liquidity Magnet Signals",description:"Shows liquidity magnet entry and take profit levels on the chart",shortDescription:"Liquidity Magnet",is_price_study:!0,is_hidden_study:!1,isCustomIndicator:!0,format:{type:"price",precision:2},plots:[{id:"long_entry",type:"line"},{id:"long_tp1",type:"line"},{id:"long_tp2",type:"line"},{id:"long_tp3",type:"line"},{id:"short_entry",type:"line"},{id:"short_tp1",type:"line"},{id:"short_tp2",type:"line"},{id:"short_tp3",type:"line"}],defaults:{styles:{long_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#9b59b6"},long_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#9b59b6"},long_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#9b59b6"},long_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#9b59b6"},short_entry:{linestyle:2,linewidth:2,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#e67e22"},short_tp1:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#e67e22"},short_tp2:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#e67e22"},short_tp3:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#e67e22"}},inputs:{}},styles:{long_entry:{title:"LM Long Entry",histogramBase:0,joinPoints:!1},long_tp1:{title:"LM Long TP1",histogramBase:0,joinPoints:!1},long_tp2:{title:"LM Long TP2",histogramBase:0,joinPoints:!1},long_tp3:{title:"LM Long TP3",histogramBase:0,joinPoints:!1},short_entry:{title:"LM Short Entry",histogramBase:0,joinPoints:!1},short_tp1:{title:"LM Short TP1",histogramBase:0,joinPoints:!1},short_tp2:{title:"LM Short TP2",histogramBase:0,joinPoints:!1},short_tp3:{title:"LM Short TP3",histogramBase:0,joinPoints:!1}},inputs:[]},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._lastDecisionKey=null,this._updateCounter=0,this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN},this.main=function(e,t){var n,i,s,r,o;this._context=e,this._input=t,this._updateCounter++;try{const{decide:e,getWallPlans:t}=va(),a=e(),l=t(),c=`${a.kind}-${"LONG_READY"===a.kind||"SHORT_READY"===a.kind?`${a.entry}-${a.stop}-${null==(n=a.tps)?void 0:n.join(",")}`:`${(null==(i=null==l?void 0:l.lower)?void 0:i.entry)||"none"}|${(null==(s=null==l?void 0:l.upper)?void 0:s.entry)||"none"}`}`;return c!==this._lastDecisionKey&&(this._cachedLongEntry=NaN,this._cachedLongTp1=NaN,this._cachedLongTp2=NaN,this._cachedLongTp3=NaN,this._cachedShortEntry=NaN,this._cachedShortTp1=NaN,this._cachedShortTp2=NaN,this._cachedShortTp3=NaN,"LONG_READY"===a.kind?(this._cachedLongEntry=a.entry,Array.isArray(a.tps)&&a.tps.length>=3&&(this._cachedLongTp1=a.tps[0],this._cachedLongTp2=a.tps[1],this._cachedLongTp3=a.tps[2])):"SHORT_READY"===a.kind?(this._cachedShortEntry=a.entry,Array.isArray(a.tps)&&a.tps.length>=3&&(this._cachedShortTp1=a.tps[0],this._cachedShortTp2=a.tps[1],this._cachedShortTp3=a.tps[2])):((null==(r=null==l?void 0:l.lower)?void 0:r.entry)&&(this._cachedLongEntry=l.lower.entry),(null==(o=null==l?void 0:l.upper)?void 0:o.entry)&&(this._cachedShortEntry=l.upper.entry)),this._lastDecisionKey=c),[this._cachedLongEntry,this._cachedLongTp1,this._cachedLongTp2,this._cachedLongTp3,this._cachedShortEntry,this._cachedShortTp1,this._cachedShortTp2,this._cachedShortTp3]}catch(a){return console.error("ð§² [Liquidity Magnet] Error in main():",a),[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN]}}}},fa={name:"Liquidation Zones",metainfo:{_metainfoVersion:51,id:"LiquidationZones@tv-basicstudies-1",name:"Liquidation Zones",description:"Shows major liquidation walls from heatmap data",shortDescription:"LZ Zones",is_hidden_study:!1,is_price_study:!0,isCu
2stomIndicator:!0,format:{type:"price",precision:2},plots:[{id:"long_zone_top",type:"line"},{id:"long_zone_bottom",type:"line"},{id:"short_zone_top",type:"line"},{id:"short_zone_bottom",type:"line"}],defaults:{styles:{long_zone_top:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},long_zone_bottom:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#00ff00"},short_zone_top:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"},short_zone_bottom:{linestyle:0,linewidth:1,plottype:2,trackPrice:!1,transparency:0,visible:!0,color:"#ff0000"}},filledAreasStyle:{long_zone_fill:{color:"#00ff00",transparency:85,visible:!0},short_zone_fill:{color:"#ff0000",transparency:85,visible:!0}},inputs:{}},styles:{long_zone_top:{title:"Long LZ Top",histogramBase:0,joinPoints:!1},long_zone_bottom:{title:"Long LZ Bottom",histogramBase:0,joinPoints:!1},short_zone_top:{title:"Short LZ Top",histogramBase:0,joinPoints:!1},short_zone_bottom:{title:"Short LZ Bottom",histogramBase:0,joinPoints:!1}},filledAreas:[{id:"long_zone_fill",objAId:"long_zone_top",objBId:"long_zone_bottom",type:"plot_plot",title:"Long LZ Zone",palette:"long_zone_fill"},{id:"short_zone_fill",objAId:"short_zone_top",objBId:"short_zone_bottom",type:"plot_plot",title:"Short LZ Zone",palette:"short_zone_fill"}]},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._lastLongZone=null,this._lastShortZone=null,this._updateCounter=0,this._cachedZones=null,this._lastHeatmapUpdate=0,this._lastInterval=null,this._lastCalculatedPrice=null,"undefined"!=typeof window&&window.toggleLiquidationZones&&window.toggleLiquidationZones(!0)},this.destroy=function(){"undefined"!=typeof window&&window.toggleLiquidationZones&&window.toggleLiquidationZones(!1)},this.main=function(e,t){return this._context=e,this._input=t,this._updateCounter++,[NaN,NaN,NaN,NaN]},this.calculateLongLiquidationZone=function(e,t){const{liquidationLeverage:n,yAxis:i}=e;if(!n||0===n.length||!i||0===i.length)return null;const s=new Map;for(const[l,c,u]of n){const e=i[c];if(e&&e>t){const t=s.get(e)||0;s.set(e,t+u)}}let r=0,o=0;for(const[l,c]of s.entries())c>r&&(r=c,o=l);if(!o)return null;const a=.003*o;return{top:o+a/2,bottom:o-a/2,center:o,size:r}},this.calculateShortLiquidationZone=function(e,t){const{liquidationLeverage:n,yAxis:i}=e;if(!n||0===n.length||!i||0===i.length)return null;const s=new Map;for(const[l,c,u]of n){const e=i[c];if(e&&e<t){const t=s.get(e)||0;s.set(e,t+u)}}let r=0,o=0;for(const[l,c]of s.entries())c>r&&(r=c,o=l);if(!o)return null;const a=.003*o;return{top:o+a/2,bottom:o-a/2,center:o,size:r}}}};function ma(e,t={}){const{onError:n,fallbackValue:i=null}=t,s=(e,t)=>{try{return gt(e,t)}catch(s){return null==n||n(s),i}};return{header:re(()=>s(fe(e),{header:!0})),payload:re(()=>s(fe(e)))}}const _a=String("https://stream.eagleailabs.com").replace(/\/$/,""),ya=ee({created_at:"",daily_api_call_limit:0,email:"",first_name:"",gold_tier_holder:!1,dashboard_tier:!1,is_active:!1,is_confirmed:!1,last_name:"",subscription:"",telegram_id:"",updated_at:"",user_id:0,wallet_address:"",vested_amount:0,is_vip:!1,avatar_url:""}),wa=X(!1),ba=X(!1),Sa=()=>{const e=ms("token");if(!e&&window.location.hostname.includes("localhost"))return{created_at:"",daily_api_call_limit:0,email:"[email protected]",first_name:"Dev",gold_tier_holder:!1,dashboard_tier:!1,is_active:!0,is_confirmed:!0,last_name:"User",subscription:"claw",telegram_id:"",updated_at:"",user_id:0,wallet_address:"",vested_amount:0,is_vip:!1};if(!ba.value&&e){!async function(e=!1){const t=ms("token");if(t)try{wa.value=!0;const n=e?`${_a}/api/v1/users/account?_t=${Date.now()}`:`${_a}/api/v1/users/account`,{data:i}=await mt.get(n,{headers:{Authorization:`Bearer ${t}`}});if(i.data){const e={...i.data,avatar_url:i.data.avatarUrl||i.data.avatar_url||""};Object.assign(ya,e),localStorage.setItem("user",JSON.stringify(e)),ba.value=!0}}catch(n){console.error("[useUser] Failed to fetch user data from API:",n);const{payload:e}=ma(t);e.value&&Object.assign(ya,e.value)}finally{wa.value=!1}}();const{payload:t}=ma(e);t.value&&!ba.value&&Object.assign(ya,t.value)}return ya},Ea={class:"chart-wrapper"},Ta={key:0,class:"drag-overlay"},xa={class:"position-box-content"},Ca={class:"position-symbol"},Aa={class:"position-size"},Pa=["onClick"],ka={class:"liq-levels-cluster"},La=["title"],Ia={key:3,class:"accuracy-overlay"},Da={class:"accuracy-box"},Oa={class:"accuracy-header"},Na={class:"accuracy-stat"},Ma={class:"accuracy-value"},$a={class:"accuracy-stat"},Ra={class:"accuracy-value"},Fa="stealth:drawn-levels",Ua="@prices.500ms",Ba="positionBoxPos",qa=(e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n}
2,ja=qa(se({__name:"TradingViewAdvancedChart",props:{symbolLabel:{},compareWith:{},dominanceOf:{},timeframe:{},exchange:{}},setup(e,{expose:t}){const n=(...e)=>{},i=X(null),s=X(!1),r=X(new Map),o=X(new Map),a=X(new Map),l=X({}),c=X(!1),u=e,d=re(()=>u.timeframe||"60"),h=Es(),p=tr(),v=nr(),g=wr(),f=hr(),m=ys(),_=Wr(),y=X([]),w=re(()=>f.isPaperMode),b=`tv-chart-${Math.random().toString(36).substring(2,11)}`;let S=null,E=!1,T=!1,x=!1;const C=new Bs;let A=null,P=null,k=null;const L=new Os({customConnection:!0});L.connect(),L.subscribe(Ua),L.addEventListener("message",e=>{const t=e.data;if((null==t?void 0:t.channel)===Ua&&(null==t?void 0:t.data)){const e=t.data;Object.keys(e).forEach(t=>{const n=parseFloat(e[t]);isFinite(n)&&(l.value[t]=n)})}}),Fs.addEventListener("status",e=>{if(c.value="reconnecting"===e.data,"connected"===e.data&&S)try{S.activeChart().resetData()}catch(t){}});const I=re(()=>p.positions.length>0),D=re(()=>{const e={};return p.positions.forEach(t=>{const n=parseFloat(t.entryPrice),i=parseFloat(t.size);if(i<=0||n<=0)return;const s=t.symbol.replace(/-?USDT$/,"")+"USDT",r=t.symbol.replace(/-?USDT$/,""),o=t.side,a=l.value[s.toUpperCase()];if(!a)return;const c=parseFloat(t.customInitialMarginRate||"0"),{pnl:u,pnlPercent:d}=((e,t,n,i,s)=>{const r=("LONG"===i?t-e:e-t)*n,o=n*e/(s&&s>0?Math.round(1/s):1);return{pnl:r,pnlPercent:o>0?r/o*100:0}})(n,a,i,o,c),h=`${t.symbol}-${o}`;e[h]={originalSymbol:t.symbol,symbol:s,displaySymbol:r,entryPrice:n,size:i,side:o,pnl:u,pnlPercent:d,isProfitable:u>=0}}),e}),O=X(null),N=X(!1),M=(()=>{try{const e=localStorage.getItem(Ba);if(e){const t=JSON.parse(e);if(t.x>=0&&t.y>=0)return N.value=!0,{x:t.x,y:t.y}}}catch(e){console.warn("Failed to load position box position",e)}return null})(),$=X(M||{x:0,y:60}),R=X(!1),F=X(!1),U=X({x:0,y:0}),B=re(()=>N.value?{top:$.value.y+"px",left:$.value.x+"px",right:"auto"}:{top:"60px",right:"20px",left:"auto"}),q=()=>{try{localStorage.setItem(Ba,JSON.stringify($.value))}catch(e){console.warn("Failed to save position box position",e)}},j=e=>{if(e.target.closest(".close-position-btn"))return;const t=O.value;if(t){const e=t.getBoundingClientRect();$.value={x:e.left,y:e.top}}R.value=!0,F.value=!0,N.value=!0,U.value={x:e.clientX-$.value.x,y:e.clientY-$.value.y},document.addEventListener("mousemove",W),document.addEventListener("mouseup",H)},W=e=>{R.value&&($.value={x:Math.max(0,e.clientX-U.value.x),y:Math.max(0,e.clientY-U.value.y)})},H=()=>{R.value=!1,F.value=!1,q(),document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",H)},V=e=>{if(e.target.closest(".close-position-btn"))return;const t=O.value;if(t){const e=t.getBoundingClientRect();$.value={x:e.left,y:e.top}}const n=e.touches[0];R.value=!0,F.value=!0,N.value=!0,U.value={x:n.clientX-$.value.x,y:n.clientY-$.value.y},document.addEventListener("touchmove",z,{passive:!1}),document.addEventListener("touchend",G)},z=e=>{if(!R.value)return;e.preventDefault();const t=e.touches[0];$.value={x:Math.max(0,t.clientX-U.value.x),y:Math.max(0,t.clientY-U.value.y)}},G=()=>{R.value=!1,F.value=!1,q(),document.removeEventListener("touchmove",z),document.removeEventListener("touchend",G)};re(()=>!!u.dominanceOf||!!u.compareWith);const Y=re(()=>!!u.symbolLabel&&u.symbolLabel.length>0),K=re(()=>Y.value?u.symbolLabel:h.token.label),J=re(()=>{if(u.dominanceOf){const e=u.dominanceOf.trim().toUpperCase();return u.compareWith?`CRYPTOCAP:${e}.D/CRYPTOCAP:${u.compareWith.trim().toUpperCase()}.D`:`CRYPTOCAP:${e}.D`}u.compareWith&&console.warn("[TradingView] Ratio comparison not yet supported with custom datafeed");const e=K.value||"BTC",t=Is(`${e}USDT`);return ks(t)?(console.warn("[TradingView] Symbol is in removed list:",t),"BTCUSDT"):(As(e,t),t)}),Z=()=>{if(!document.getElementById(b))return console.warn("[TradingView] Container not found, retrying in 100ms..."),void setTimeout(Z,100);if(S){try{S.remove()}catch(t){console.warn("[TradingView] Error removing widget:",t)}S=null,E=!1}const e=document.createElement("script");e.src="/charting_library/charting_library.standalone.js",e.async=!0,e.onload=()=>{window.TradingView?setTimeout(ee,50):console.error("[TradingView] Library loaded but window.TradingView is undefined")},e.onerror=e=>{console.error("[TradingView] Failed to load library script:",e)},window.TradingView?setTimeout(ee,50):document.head.appendChild(e)},ee=()=>{if(!window.TradingView)return void console.error("[TradingView] Cannot create widget: TradingView library n
2ot loaded");if(!document.getElementById(b))return void console.error("[TradingView] Container element not found:",b);J.value;const e={getAllCharts:()=>{const e=localStorage.getItem("tradingview.charts"),t=e?JSON.parse(e):[];return Promise.resolve(t)},removeChart:e=>{const t=JSON.parse(localStorage.getItem("tradingview.charts")||"[]").filter(t=>t.id!==e);return localStorage.setItem("tradingview.charts",JSON.stringify(t)),Promise.resolve()},saveChart:e=>{e.id,e.name;const t=JSON.parse(localStorage.getItem("tradingview.charts")||"[]"),n=t.findIndex(t=>t.name===e.name);if(n>=0){e.name;const i=t[n];e.id=i.id,t[n]=e}else{e.name;const n=`chart_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;e.id=n,t.push(e)}return localStorage.setItem("tradingview.charts",JSON.stringify(t)),t.length,t.map(e=>e.name||e.id),Promise.resolve(e.id)},getChartContent:e=>{const t=JSON.parse(localStorage.getItem("tradingview.charts")||"[]").find(t=>t.id===e);return Promise.resolve(t?t.content:null)},getAllStudyTemplates:()=>Promise.resolve([]),removeStudyTemplate:()=>Promise.resolve(),saveStudyTemplate:()=>Promise.resolve(),getStudyTemplateContent:()=>Promise.resolve(""),getDrawingTemplates:()=>Promise.resolve([]),loadDrawingTemplate:()=>Promise.resolve(""),removeDrawingTemplate:()=>Promise.resolve(),saveDrawingTemplate:()=>Promise.resolve()},t=Intl.DateTimeFormat().resolvedOptions().timeZone||"Etc/UTC",n={symbol:J.value,datafeed:C,interval:d.value,container:b,library_path:"/charting_library/",locale:"en",timezone:t,disabled_features:["timeframes_toolbar","edit_buttons_in_legend","control_bar","border_around_the_chart","main_series_scale_menu","display_market_status","header_compare","header_screenshot","header_chart_type","header_settings","header_symbol_search","symbol_search_hot_key","header_undo_redo","legend_context_menu"],enabled_features:["study_templates","side_toolbar_in_fullscreen_mode","header_in_fullscreen_mode","create_volume_indicator_by_default","save_chart_properties_to_local_storage","confirm_overwrite_if_chart_layout_with_name_exists","request_only_visible_range_on_reset"],autosize:!0,theme:"dark",auto_save_delay:5,save_load_adapter:e,client_id:"claw_trading",user_id:"user_1",load_last_chart:!0,fullscreen:!1,toolbar_bg:"#000000",loading_screen:{backgroundColor:"#0a0f1a",foregroundColor:"#22d3ee"},custom_indicators_getter:e=>{const t=ms("token"),n=Sa();return t&&(null==n?void 0:n.email)?Promise.resolve([Vr,po,zo,ga,fa]):Promise.resolve([])},overrides:{"paneProperties.background":"#000000","paneProperties.backgroundType":"solid","paneProperties.vertGridProperties.color":"#1a1a1a","paneProperties.horzGridProperties.color":"#1a1a1a","scalesProperties.textColor":"#888888","scalesProperties.lineColor":"#1a1a1a","mainSeriesProperties.candleStyle.upColor":"#00ff00","mainSeriesProperties.candleStyle.downColor":"#ff0000","mainSeriesProperties.candleStyle.borderUpColor":"#00ff00","mainSeriesProperties.candleStyle.borderDownColor":"#ff0000","mainSeriesProperties.candleStyle.wickUpColor":"#00ff00","mainSeriesProperties.candleStyle.wickDownColor":"#ff0000","mainSeriesProperties.hollowCandleStyle.upColor":"#00ff00","mainSeriesProperties.hollowCandleStyle.downColor":"#ff0000","mainSeriesProperties.hollowCandleStyle.borderUpColor":"#00ff00","mainSeriesProperties.hollowCandleStyle.borderDownColor":"#ff0000","mainSeriesProperties.hollowCandleStyle.wickUpColor":"#00ff00","mainSeriesProperties.hollowCandleStyle.wickDownColor":"#ff0000","mainSeriesProperties.barStyle.upColor":"#00ff00","mainSeriesProperties.barStyle.downColor":"#ff0000","mainSeriesProperties.lineStyle.color":"#00ff00","mainSeriesProperties.areaStyle.color1":"#00ff00","mainSeriesProperties.areaStyle.color2":"#000000","mainSeriesProperties.areaStyle.linecolor":"#00ff00"}};try{S=new window.TradingView.widget(n),null==S||S.onChartReady(()=>{J.value,S.headerReady().then(()=>{S.createButton({useTradingViewStyle:!0,align:"right",text:"Save As",title:"Save As New Layout",onClick:()=>{S.showSaveAsChartDialog()}})});const e=(e,t)=>{try{const t=et(e)||J.value;if(!t)return;localStorage.setItem(`tradingview_state_${t}`,JSON.stringify(e))}catch(n){console.warn("[TradingView] persistStateByItsOwnSymbol failed:",n)}};S.subscribe("onAutoSaveNeeded",()=>{S.save(t=>e(t))}),S.subscribe("drawing",()=>{S.save(t=>e(t))}),window.addEventListener("beforeunload",()=>{S&&S.save(t=>e(t))});const t=localStorage.getItem(`tradingview_state_${J.value}`);if(t){J.value;try{S.load(JSON.parse(t))}catch(i){console.error("[TradingView] Error loading saved state:",i)}}T||(T=!0,S.activeChart().onDataLoaded().subscribe(null,()=>{E=!0;try{S.activeChart().scrollToRealtime()}catch{}Xe(),Ze()},!1));const n=()=>
2{if(S)try{const e=S.activeChart(),t=e.resolution(),n=(e=>{const t=String(e).toUpperCase();return"1"===t||"3"===t?180:"5"===t||"15"===t?200:"30"===t||"60"===t||"1H"===t||"120"===t?150:"240"===t?180:"360"===t||"480"===t||"720"===t?150:"1D"===t||"D"===t?120:"1W"===t||"W"===t?60:"1M"===t||"M"===t?48:150})(t),i=(e=>{const t=String(e).toUpperCase();if("1D"===t||"D"===t)return 86400;if("1W"===t||"W"===t)return 604800;if("1M"===t||"M"===t)return 2592e3;const n=parseInt(e);return 60*(isNaN(n)?1:n)})(t),s=Math.floor(Date.now()/1e3),r=Math.round(.05*n)*i,o=s-n*i,a=s+r,l=e.setVisibleRange({from:o,to:a});l&&"function"==typeof l.catch&&l.catch(e=>{})}catch(i){}};try{const e=S.activeChart();e.onDataLoaded().subscribe(null,()=>requestAnimationFrame(n),!0),e.onIntervalChanged().subscribe(null,()=>{e.onDataLoaded().subscribe(null,()=>requestAnimationFrame(n),!0)})}catch(i){console.warn("[TradingView] Could not wire up auto-fit handlers:",i)}ie.value&&je(),A=setInterval(()=>{ie.value&&je()},5e3),pe.value&&(Be(),qe(),setTimeout(Ue,3e3)),se.value&&setTimeout(()=>{if(S)try{S.activeChart().getAllStudies().some(e=>"Liquidation Zones"===e.name||"LZ Zones"===e.name||e.name.includes("Liquidation")||e.name.includes("liquidation")||"Shows major liquidation walls from heatmap data"===e.description)?he(!0):(se.value=!1,localStorage.setItem("tradingview.showLiquidationZones","false"))}catch(i){console.error("Error checking for LZ indicator on init:",i)}else console.warn("â ï¸ TradingView widget not ready yet")},2e3),se.value,P=setInterval(()=>{if(S)try{const e=S.activeChart().getAllStudies(),t=e.map(e=>e.name),n=e.some(e=>"Liquidation Zones"===e.name||"LZ Zones"===e.name||e.name.includes("Liquidation")||e.name.includes("liquidation")||"Shows major liquidation walls from heatmap data"===e.description);se.value,t.join(", "),n&&!se.value?he(!0):!n&&se.value&&he(!1)}catch(i){console.error("Error in LZ indicator watcher:",i)}},1e3)})}catch(i){console.error("Error creating TradingView widget:",i)}},te=X(new Map);let ne=X("");const ie=X("true"===localStorage.getItem("tradingview.showBreakoutBotLines"));"undefined"!=typeof window&&(window.toggleBreakoutBotLines=e=>{const t=void 0!==e?e:!ie.value;if(ie.value=t,localStorage.setItem("tradingview.showBreakoutBotLines",String(t)),t)je();else if(S)try{const e=S.activeChart();Array.from(te.value.entries()).forEach(([t,n])=>{try{e.removeEntity(n)}catch(i){}}),te.value.clear()}catch(n){console.warn("Error removing Breakout Bot lines:",n)}});const se=X("true"===localStorage.getItem("tradingview.showLiquidationZones")),oe=X(new Map);let le=X(""),ue=null,de=null;const he=e=>{const t=void 0!==e?e:!se.value;if(se.value=t,localStorage.setItem("tradingview.showLiquidationZones",String(t)),t)We(),ue&&(clearInterval(ue),ue=null),de&&(clearTimeout(de),de=null),(()=>{const e=3e5,t=()=>{const n=Date.now();de=setTimeout(()=>{let e=12;const n=setInterval(()=>{se.value?(We(),e--,e<=0&&(clearInterval(n),t())):clearInterval(n)},5e3);ue=n},e-n%e-3e4)};t()})();else{if(ue&&(clearInterval(ue),ue=null),de&&(clearTimeout(de),de=null),S){const e=S.activeChart();Array.from(oe.value.entries()).forEach(([t,n])=>{try{e.removeEntity(n)}catch(i){}}),oe.value.clear()}le.value=""}};window.toggleLiquidationZones=he;const pe=X("false"!==localStorage.getItem("tradingview.showLiqLines")),ve=X(new Map),fe=X(new Map);let Pe="",ke="",Le=null,Ie=null,De=!1,Oe=!1;function Ne(){const e=(h.token.label+"USDT").toUpperCase(),t=l.value[e];if(Number.isFinite(t)&&t>0)return t;const n=g.candles;if(Array.isArray(n)&&n.length){const e=parseFloat(String(n[n.length-1][4]));if(Number.isFinite(e)&&e>0)return e}return null}function Me(e,t,n){const{liquidationLeverage:i,yAxis:s}=g;if(!Array.isArray(i)||!Array.isArray(s))return[];let r=0;for(const[l]of i)l>r&&(r=l);const o=.6*r,a=new Map;for(const[l,c,u]of i){if(l<o)continue;const n=s[c];null!=n&&("above"===t&&n<=e||"below"===t&&n>=e||u>(a.get(n)??0)&&a.set(n,u))}return Array.from(a.entries()).sort((e,t)=>t[1]-e[1]).slice(0,n).map(([e,t])=>({price:e,size:t}))}function $e(e,t){return`${e}_${t.toFixed(2)}`}function Re(e,t){return"above"===e?t>.7?"#5ec485":t>.35?"#22c55e":"#86efac":t>.7?"#eb5c57":t>.35?"#fb923c":"#ffd166"}function Fe(e,t){const n=t>=1e3?t.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g,","):t.toFixed(4);return"above"===e?`SHORT LIQ ${n}`:`LONG LIQ ${n}`}async function Ue(){if(S&&pe.value)if(De)Oe=!0;else{De=!0;try{g.ensureStarted();const e=Ne();if(!e)return;const t=Me(e,"above",5),n=Me(e,"below",5),i=[...t,...n].map(e=>`${e.price.toFixed(2)}:${e.size.toFixed(0)}`).join("|");if(i===Pe)return;Pe=i;const s=S.activeChart(),r=[...t,...n],o=r.length?Math.max(...r.map(e=>e.size)):1,a=new Map;for(const{price:l,size:c}of t){const e=$e("above",l);a.set(e,{price:l,side:"above",color:Re("above",c/o),label:Fe("above",l),vertAlign:"top"})}for(const{price:l,size:c}of n){const e=$e("below",l);a.set(e,{price:l,side:"below",color:Re("below",c/o),label:Fe("below",l),vertAlign:"bottom"})}for(const[l,c]of[...ve.value.entries()])if(!a.has(l)){try{s.removeEntity(c)}catch{}ve.value.delete(l),fe.value.delete(l)}for(const[l,{price:c,color:u,label:d,vertAlign:h}]of a.entries())if(!ve.value.has(l))try{const e=await s.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:c}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:u,linewidth:1,linestyle:2,showLabel:!0,horzLabelsAlign:"right",vertLabelsAlign:h,text:d,textcolor:u,fontsize:13,showPrice:!1}});ve.value.set(l,e),fe.value.set(l,c)}catch{}}finally{De=!1,Oe&&(Oe=!1,setTimeout(Ue,50))}}}function Be(){Ie&&(Ie(),Ie=null),Ie=ge(()=>{var e;return[g.lastUpdatedAt,null==(e=g.liquidationLeverage)?void 0:e.length]},([e,t])=>{e&&t&&t>0&&pe.value&&(Pe="",Ue())})}function qe(){Le&&(Le(),Le=null),Le=ge(l,e=>{if(!pe.value||!fe.value.size||!S)return;const t=e[(h.token.label+"USDT").toUpperCase()];if(!t)return;let n=!1,i=null;try{i=S.activeChart()}catch{return}for(const[s,r]of[...fe.value.entries()]){if(!(s.startsWith("above_")&&t>=r||s.startsWith("below_")&&t<=r))continue;const e=ve.value.get(s);if(e){try{i.removeEntity(e)}catch{}ve.value.delete(s)}fe.value.delete(s),n=!0}n&&(Pe="",Ue())},{deep:!0})}ge(()=>m.shouldShowChart,(e,t)=>{e&&!t&&S&&(ke="",y.value=[],setTimeout(()=>{Xe(),Ze(),pe.value&&(ve.value.clear(),fe.value.clear(),Pe="",setTimeout(Ue,300)),setTimeout(tt,300)},200))}),ge(()=>m.activePlaceholderId,(e,t)=>{e&&e!==t&&(ke="",y.value=[],setTimeout(tt,400))});const je=async()=>{var e,t,n,i,s;if(S&&ie.value&&localStorage.getItem("token"))try{const{decide:o}
2=ho(),l=o(),c=e=>Math.round(100*e)/100,u=`${l.kind}-${"LONG_READY"===l.kind||"SHORT_READY"===l.kind?`${c(l.entry)}-${c(l.stop)}-${null==(e=l.tps)?void 0:e.map(c).join(",")}`:`${c((null==(n=null==(t=l.plans)?void 0:t.long)?void 0:n.entry)||0)}|${c((null==(s=null==(i=l.plans)?void 0:i.short)?void 0:s.entry)||0)}`}`;if(u===ne.value)return;ne.value=u;const d=S.activeChart(),h=d.getAllShapes(),p=new Set(Array.from(r.value.values())),v=new Set(Array.from(a.value.values()));for(const e of h)if("horizontal_line"===e.name&&!p.has(e.id)&&!v.has(e.id))try{d.removeEntity(e.id)}catch{}te.value.clear(),await new Promise(e=>setTimeout(e,100)),await Qe(d,l)}catch(o){console.error("[TradingView] Error in drawBreakoutBotLines:",o)}},We=async()=>{if(S&&se.value)try{const t=S.activeChart();g.ensureStarted();const n=Ne();if(!n)return void h.token.label;const i=function(e,t){const{liquidationLeverage:n,yAxis:i}=e;if(!Array.isArray(n)||!Array.isArray(i))return null;const s=1.005*t,r=1.05*t,o=new Map;for(const[u,d,h]of n){const e=i[d];if(e&&e>=s&&e<=r){const t=o.get(e)||0;o.set(e,t+h)}}if(o.size,s.toFixed(2),r.toFixed(2),0===o.size)return null;let a=0,l=0;if(Array.from(o.entries()).forEach(([e,t])=>{t>a&&(a=t,l=e)}),l.toFixed(2),0===a)return null;const c=.003*l;return{top:l+c/2,bottom:l-c/2,center:l,size:a}}(g,n),s=function(e,t){const{liquidationLeverage:n,yAxis:i}=e;if(!Array.isArray(n)||!Array.isArray(i))return null;const s=new Map;for(const[l,c,u]of n){const e=i[c];if(e&&e<t){const t=s.get(e)||0;s.set(e,t+u)}}if(s.size,0===s.size)return null;let r=0,o=0;if(Array.from(s.entries()).forEach(([e,t])=>{t>r&&(r=t,o=e)}),0===r)return null;const a=.003*o;return{top:o+a/2,bottom:o-a/2,center:o,size:r}}(g,n),r=`${i?`${i.top.toFixed(2)}-${i.bottom.toFixed(2)}`:"none"}|${s?`${s.top.toFixed(2)}-${s.bottom.toFixed(2)}`:"none"}`;if(r===le.value)return;le.value,Array.from(oe.value.entries()).forEach(([e,n])=>{try{t.removeEntity(n)}catch(i){console.warn("ð¯ Error removing tracked zone:",i)}}),oe.value.clear();try{const n=t.getAllShapes();let i=0;for(const s of n)if("rectangle"===s.name)try{t.removeEntity(s.id),i++}catch(e){}}catch(e){console.warn("ð¯ Error in rectangle cleanup:",e)}const o=t.getVisibleRange();if(i){const e=await t.createMultipointShape([{time:o.from,price:i.top},{time:o.to,price:i.bottom}],{shape:"rectangle",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,zOrder:"bottom",overrides:{backgroundColor:"rgba(0, 255, 0, 0.1)",borderColor:"#00ff00",borderWidth:1,fillBackground:!0,transparency:90}});oe.value.set("long_zone_rect",e),i.top.toFixed(2),i.bottom.toFixed(2)}if(s){const e=await t.createMultipointShape([{time:o.from,price:s.top},{time:o.to,price:s.bottom}],{shape:"rectangle",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,zOrder:"bottom",overrides:{backgroundColor:"rgba(255, 0, 0, 0.1)",borderColor:"#ff0000",borderWidth:1,fillBackground:!0,transparency:90}});oe.value.set("short_zone_rect",e),s.top.toFixed(2),s.bottom.toFixed(2)}le.value=r,oe.value.size}catch(t){console.error("[TradingView] Error in drawLiquidationZones:",t)}};let He=!1,Ve=null;const ze=async()=>{He||(He=!0,Ve&&clearTimeout(Ve),Ve=setTimeout(async()=>{await Ge(),He=!1},100))},Ge=async()=>{if(S&&E)try{const t=S.activeChart(),n=t.getAllShapes();n.length;let i=0;for(const s of n)if("horizontal_line"===s.name)try{t.removeEntity(s.id),i++}catch(e){}r.value.clear(),o.value.clear(),a.value.clear(),te.value.clear(),ve.value.clear(),fe.value.clear(),Pe="",ke="",y.value=[],await new Promise(e=>setTimeout(e,50)),await Ye(),await Ke(),ie.value&&await Je(),pe.value&&setTimeout(Ue,50),setTimeout(tt,50)}catch(t){console.error("[TradingView] Error in redrawAllLines:",t)}},Ye=async()=>{if(S)try{const t=S.activeChart(),i=J.value;w.value;for(const s of p.positions){const a=parseFloat(s.entryPrice),l=parseFloat(s.size);if(l<=0||a<=0)continue;const c=s.symbol.replace(/-?USDT$/,"")+"USDT";if(c!==i)continue;const u=s.side,d="LONG"===u?"#00ff00":"#ff0000";try{const e=await t.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:a}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:d,linestyle:2,linewidth:2,showLabel:!0,text:"LONG"===u?"Long":"Short",textcolor:d,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}}),i=`${s.symbol}-${u}`;r.value.set(i,e),o.value.set(i,{entryPrice:a,size:l,side:u,symbol
2:c}),n()}catch(e){console.error("[TradingView] Error creating position line:",e)}}if(w.value)for(const s of f.paperPositions){const a=s.entryPrice,l=s.size;if(l<=0||a<=0)continue;const c=s.symbol.replace(/-?USDT$/,"")+"USDT";if(c!==i)continue;const u=s.side,d="LONG"===u?"#10b981":"#f43f5e";try{const e=await t.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:a}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:d,linestyle:0,linewidth:2,showLabel:!0,text:"LONG"===u?"Paper Long":"Paper Short",textcolor:d,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}}),i=`paper-${s.id}-${u}`;r.value.set(i,e),o.value.set(i,{entryPrice:a,size:l,side:u,symbol:c}),n()}catch(e){console.error("[TradingView] Error creating paper position line:",e)}}}catch(t){console.error("[TradingView] Error in drawPositionLinesOnly:",t)}},Ke=async()=>{if(S)try{const t=S.activeChart(),i=J.value;p.historicalOrders.length,w.value;const s=p.historicalOrders.filter(e=>{const t=e.symbol.replace(/-?USDT$/,"")+"USDT",n="TAKE_PROFIT_MARKET"===e.type||"STOP_MARKET"===e.type,s="OPEN"===e.status||"UNTRIGGERED"===e.status,r=n&&s&&t===i;return n&&(e.orderId,e.type,e.status,e.triggerPrice),r});s.length;for(const r of s){const i=parseFloat(r.triggerPrice);if(i<=0)continue;const s="TAKE_PROFIT_MARKET"===r.type,o=s?"#00ff00":"#ff0000",l=s?"TP":"SL";try{const e=await t.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:i}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:o,linestyle:0,linewidth:2,showLabel:!0,text:l,textcolor:o,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});a.value.set(r.orderId,e),n()}catch(e){console.error("[TradingView] Error creating TP/SL line:",e)}}if(w.value)for(const r of f.paperPositions)if(r.symbol.replace(/-?USDT$/,"")+"USDT"===i){if(r.tpPrice&&r.tpPrice>0)try{const e=await t.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:r.tpPrice}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:"#10b981",linestyle:0,linewidth:2,showLabel:!0,text:"TP (Paper)",textcolor:"#10b981",horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});a.value.set(`paper-tp-${r.id}`,e),n(r.tpPrice)}catch(e){console.error("[TradingView] Error creating paper TP line:",e)}if(r.slPrice&&r.slPrice>0)try{const e=await t.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:r.slPrice}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:"#f43f5e",linestyle:0,linewidth:2,showLabel:!0,text:"SL (Paper)",textcolor:"#f43f5e",horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});a.value.set(`paper-sl-${r.id}`,e),n(r.slPrice)}catch(e){console.error("[TradingView] Error creating paper SL line:",e)}}}catch(t){console.error("[TradingView] Error in drawTpSlLinesOnly:",t)}},Je=async()=>{var e,t,n,i,s;if(S&&ie.value&&localStorage.getItem("token"))try{const r=S.activeChart(),{decide:o}=ho(),a=o();ne.value=`${a.kind}-${"LONG_READY"===a.kind||"SHORT_READY"===a.kind?`${a.entry}-${a.stop}-${null==(e=a.tps)?void 0:e.join(",")}`:(null==(n=null==(t=a.plans)?void 0:t.long)?void 0:n.entry)+"|"+(null==(s=null==(i=a.plans)?void 0:i.short)?void 0:s.entry)}`,await Qe(r,a)}catch(r){console.error("[TradingView] Error in drawBreakoutBotLinesOnly:",r)}},Qe=async(e,t)=>{var n,i,s,r;const o=async(t,n,i,s,r)=>e.createMultipointShape([{time:Math.floor(Date.now()/1e3),price:t}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,disableUndo:!0,overrides:{linecolor:i,linestyle:s,linewidth:r,showLabel:!0,text:n,textcolor:i,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});if("LONG_READY"===t.kind){if(te.value.set("long_entry",await o(t.entry,"LONG ENTRY","#00ff00",2,2)),t.stop&&te.value.set("long_sl",await o(t.stop,"SL","#ff0000",0,2)),Array.isArray(t.tps)&&t.tps.length>=3)for(let a=0;a<3;a++)te.value.set(`long_tp${a+1}`,await o(t.tps[a],`TP${a+1}`,"#00ff00",0,1))}else if("SHORT_READY"===t.kind){if(te.value.set("short_entry",await o(t.entry,"SHORT ENTRY","#ff0000",2,2)),t.stop&&te.value.set("short_sl",await o(t.stop,"SL","#ff0000",0,2)),Array.isArray(t.tps)&&t.tps.length>=3)for(let a=0;a<3;a++)te.value.set(`short_tp${a+1}`,await o(t.tps[a],`TP${a+1}`,"#ff0000",0,1))}else"NEUTRAL_WAIT"===t.kind&&((null==(i=null==(n=t.plans)?void 0:n.long)?void 0:i.entry)&&te.value.set("neutral_long",await o(t.plans.long.entry,"LONG","#00ff00",1,1)),(null==(r=null==(s=t.plans)?void 0:s.short)?void 0:r.entry)&&te.value.set("neutral_short",await o(t.plans.short.entry,"SHORT","#ff0000",1,1)))},Xe=async()=>{await ze()},Ze=async()=>{await ze()};function et(e){var t,n,i,s,r,o;try{const a=null==(t=null==e?void 0:e.charts)?void 0:t[0];if(a){const e=(null==(n=a.mainSource)?void 0:n.symbol)||(null==(o=null==(r=null==(s=null==(i=a.panes)?void 0:i[0])?void 0:s.sources)?void 0:r[0])?void 0:o.symbol)||a.symbol;if("string"==typeof e&&e.length)return e.toUpperCase()}const l=JSON.stringify(e??{}),c=/"symbol"\s*:\s*"([^"]+)"/.exec(l);return c?c[1].toUpperCase():null}catch{return null}}async function tt(){if(S&&E&&!x)try{const t=localStorage.getItem(Fa);if(!t)return;const n=JSON.parse(t);if("number"!=typeof(null==n?void 0:n.entry)&&"number"!=typeof(null==n?void 0:n.sl)&&"number"!=typeof(null==n?void 0:n.tp))return void localStorage.removeItem(Fa);const i=`${n.entry??""}|${n.sl??""}|${n.tp??""}|${n.side??""}`;if(i===ke&&y.value.length>0)return;ke=i,x=!0;try{const t=S.activeChart();for(const e of y.value)try{t.removeEntity(e)}catch{}y.value=[];const i=Math.floor(Date.now()/1e3),s=[];null!=n.entry&&s.push({price:n.entry,color:"#00F6FF",label:"short"===n.side?"ð¤ Short Entry":"ð¤ Long Entry",style:0}),null!=n.sl&&s.push({price:n.sl,color:"#eb5c57",label:"ð Stop Loss",style:2}),null!=n.tp&&s.push({price:n.tp,color:"#5ec485",label:"â
Take Profit",style:2});for(const n of s)try{const e=await t.createMultipointShape([{time:i,price:n.price}],{shape:"horizontal_line",lock:!1,disableSelection:!1,disableSave:!0,disableUndo:!0,overrides:{linecolor:n.color,linestyle:n.style,linewidth:2,showLabel:!0,text:n.label,textcolor:n.color,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});e&&y.value.push(e)}catch(e){console.error("[TradingView] Error restoring AI level:",e)}_.setActiveDrawnLevels(n)}finally{x=!1}}catch{}}return ge(J,(e,t)=>{if(!S||!e)return;const n=t,i=()=>{try{S.setSymbol(e,d.value,()=>{const t=localStorage.getItem(`tradingview_state_${e}`);if(t)try{const n=JSON.parse(t),i=et(n);i&&i!==e.toUpperCase()?localStorage.removeItem(`tradingview_state_${e}`):S.load(n)}catch(n){console.error("[TradingView] Error loading saved state:",n)}setTimeout(()=>{Xe(),Ze(),Pe="",pe.value&&setTimeout(Ue,1e3)},500)})}catch(t){console.error("Error changing symbol:",t)}};if(n)try{S.save(e=>{try{localStorage.setItem(`tradingview_state_${n}`,JSON.stringify(e))}catch(t){console.warn("[TradingView] Failed to persist old symbol state:",t)}i()})}catch(s){console.warn("[TradingView] save() threw, switching anyway:",s),i()}else i()}),ge(()=>[p.positions.length,...p.positions.map(e=>`${e.symbol}-${e.side}-${e.entryPrice}`)],(e,t)=>{p.positions.length,p.positions,Xe(),Ze()}),ge(()=>[f.paperPositions.length,...f.paperPositions.map(e=>`${e.id}-${e.symbol}-${e.side}-${e.tpPrice}-${e.slPrice}`)],(e,t)=>{w.value&&(f.paperPositions.length,Xe(),Ze())}),ge(()=>f.tradingMode,(e,t)=>{Xe(),Ze()}),ge(()=>[p.historicalOrders.length,...p.historicalOrders.map(e=>`${e.orderId}-${e.status}-${e.type}-${e.triggerPrice}`)],(e,t)=>{p.historicalOrders.length,p.historicalOrders.filter(e=>!("TAKE_PROFIT_MARKET"!==e.type&&"STOP_MARKET"!==e.type||"OPEN"!==e.status&&"UNTRIGGERED"!==e.status)),Ze()}),ge(()=>[u.compareWith,u.dominanceOf,u.exchange],()=>{Z()}),ge(()=>_.pendingAiLevels,async e=>{if(!e||!S||!E)return;let t;try{t=S.activeChart()}catch{return}await async function(e){if(x)return;const t=_.pendingAiLevels;if(t){x=!0;try{for(const t of y.value)try{e.removeEntity(t)}catch{}y.value=[];const i=Math.floor(Date.now()/1e3),s=[];null!=t.entry&&s.push({price:t.entry,color:"#00F6FF",label:"short"===t.side?"ð¤ Short Entry":"ð¤ Long Entry",style:0}),null!=t.sl&&s.push({price:t.sl,color:"#eb5c57",label:"ð Stop Loss",style:2}),null!=t.tp&&s.push({price:t.tp,color:"#5ec485",label:"â
Take Profit",style:2});for(const t of s)try{const n=await e.createMultipointShape([{time:i,price:t.price}],{shape:"horizontal_line",lock:!1,disableSelection:!1,disableSave:!0,disableUndo:!0,overrides:{linecolor:t.color,linestyle:t.style,linewidth:2,showLabel:!0,text:t.label,textcolor:t.color,horzLabelsAlign:"right",vertLabelsAlign:"middle",showPrice:!0}});n&&y.value.push(n)}catch(n){console.error("[TradingView] Error drawing AI level:",n)}try{localStorage.setItem(Fa,JSON.stringify(t))}catch{}ke=`${t.entry??""}|${t.sl??""}|${t.tp??""}|${t.side??""}`,_.setActiveDrawnLevels(t),_.clearAiLevels()}finally{x=!1}}}(t)},{deep:!0}),ge(()=>_.clearLinesSignal,()=>{if(!S||!E)return;let e;try{e=S.activeChart()}catch{return}for(const t of y.value)try{e.removeEntity(t)}catch{}y.value=[],ke="";try{localStorage.removeItem(Fa)}catch{}}),ge(()=>u.timeframe,e=>{if(S&&e)try{S.activeChart().setResolution(e,()=>{})}catch(t){console.error("[TradingView] Error changing timeframe:",t)}}),ae(()=>{p.positions.length,r.value.size,window.addEventListener("eagle-accuracy-update",e=>{e.detail&&(i.value=e.detail)}),Z(),k=setInterval(()=>{if(S&&Date.now()-C.lastBarUpdateTime>3e4)try{S.activeChart().resetData()}catch(e){}},3e4)}),me(()=>{if(p.positions.length,r.value.size,A&&(clearInterval(A),A=null),P&&(clearInterval(P),P=null),k&&(clearInterval(k),k=null),Le&&(Le(),Le=null),Ie&&(Ie(),Ie=null),S)try{J.value,S.save(e=>{const t=et(e)||J.value;t&&localStorage.setItem(`tradingview_state_${t}`,JSON.stringify(e))}),setTimeout(()=>{null==S||S.remove(),S=null,E=!1},100)}catch(e){S=null,E=!1}}),t({widget:S,symbol:J}),(e,t)=>(Ae(),_e("div",Ea,[ye("div",{id:b,class:"tradingview-advanced-chart w-full h-full"}),F.value?(Ae(),_e("div",Ta)):we("",!0),I.value?(Ae(),_e("div",{key:1,ref_key:"positionBoxRef",ref:O,class:Se(["position-boxes-overlay",{"is-dragging":F.value}]),style:be(B.value)},[ye("div",{class:"drag-handle",title:"Drag to reposition",onMousedown:Ee(j,["stop"]),onTouchstart:Ee(V,["stop"])},t[3]||(t[3]=[ye("span",{class:"drag-icon"},"â®â®",-1)]),32),(Ae(!0),_e(ce,null,Te(D.value,(e,t)=>(Ae(),_e("div",{key:t,class:Se(["position-box",{long:"LONG"===e.side,short:"SHORT"===e.side}])},[ye("div",xa,[ye("span",Ca,xe(e.displaySymbol),1),ye("span",{class:"position-label",style:be({color:e.pnl>=0?"#00ff00":"#ff0000"})},xe(e.pnl>=0?"+":"")+xe(e.pnl.toFixed(2)),5),ye("span",Aa,xe(e.size.toFixed(4)),1),ye("button",{class:"close-position-btn",onClick:Ee(t=>(e=>{const t=l.value[e.symbol.toUpperCase()];
2v.updatePayload({type:"Market",symbol:e.originalSymbol,side:e.side,entryPrice:e.entryPrice.toString(),lastPrice:(null==t?void 0:t.toString())||e.entryPrice.toString(),quantity:e.size.toString(),pnl:e.pnl,pnlPercent:e.pnlPercent}),v.onCloseTradeOpen()})(e),["stop"]),title:"Close position"},"Ã",8,Pa)])],2))),128))],6)):we("",!0),ye("div",ka,[ye("div",{class:Se(["liq-levels-toggle-btn",{active:pe.value}]),onClick:t[0]||(t[0]=e=>function(){const e=!pe.value;pe.value=e,localStorage.setItem("tradingview.showLiqLines",String(e)),e?(qe(),Be(),Ue()):(function(){if(S){try{const e=S.activeChart();for(const[,t]of ve.value)try{e.removeEntity(t)}catch{}}catch{}ve.value.clear(),fe.value.clear(),Pe="",De=!1,Oe=!1}}(),Le&&(Le(),Le=null),Ie&&(Ie(),Ie=null))}()),title:"Toggle liquidation level lines on chart"}," LIQ LEVELS ",2),pe.value?(Ae(),_e("div",{key:0,class:"liq-exch-badge",title:`Showing levels from: ${Q(g).activeExchangeLabel}`},xe(Q(g).activeExchangeLabel),9,La)):we("",!0)]),i.value?(Ae(),_e("div",{key:2,class:Se(["stats-toggle-btn",{active:s.value}]),onClick:t[1]||(t[1]=e=>s.value=!s.value)}," STATS ð¦
",2)):we("",!0),i.value&&s.value?(Ae(),_e("div",Ia,[ye("div",Da,[ye("div",Oa,[t[4]||(t[4]=ye("div",{class:"accuracy-title"},"Eagle Money Line",-1)),ye("button",{class:"close-btn",onClick:t[2]||(t[2]=e=>s.value=!1)},"Ã")]),ye("div",Na,[t[5]||(t[5]=Ce("Win Rate: ",-1)),ye("span",Ma,xe(i.value.accuracy)+"%",1)]),ye("div",$a,[t[6]||(t[6]=Ce("Signals: ",-1)),ye("span",Ra,xe(i.value.correct)+"/"+xe(i.value.total),1)])])])):we("",!0)]))}}),[["__scopeId","data-v-9e0c0be8"]]),Wa=function(e,t="USDT"){if(!e)return"";let n=String(e).trim();if(!n)return"";if(n=n.replace(/\s+/g,""),n.includes("/")){const[e,t]=n.split("/");return`${(e||"").toUpperCase()}/${(t||"").toUpperCase()}`}if(n.includes("_")){const[e,t]=n.split("_");return`${(e||"").toUpperCase()}/${(t||"").toUpperCase()}`}const i=n.toUpperCase(),s=["USDT","USDC","USD","USDD","USDP","BUSD","FDUSD","EUR","BTC","ETH","BNB","TRY","BRL","JPY","GBP","AUD","CAD","IDR","RUB","MXN","PEN","ARS","KRW","INR","AED","SAR","TWD","VND","MYR","PHP","THB","ZAR","NGN"];for(const r of s)if(i.endsWith(r)){const e=i.slice(0,i.length-r.length);if(e)return`${e}/${r}`}return`${i}/${t.toUpperCase()}`},Ha={class:"pair-badge"},Va=qa(se({__name:"TradingViewChart",props:{symbolLabel:{},compareWith:{},dominanceOf:{}},setup(e){const t=e,n=Es(),i=re(()=>!!t.symbolLabel&&t.symbolLabel.length>0),s=re(()=>i.value?t.symbolLabel:n.token.label),r=re(()=>`${As(s.value,`${s.value}USDT`)}:${s.value}USDT`),o=re(()=>{const e=(t.dominanceOf||"").trim().toUpperCase(),n=(t.compareWith||"").trim().toUpperCase();if(e)return n?`CRYPTOCAP:${e}.D/CRYPTOCAP:${n}.D`:`CRYPTOCAP:${e}.D`;const i=r.value;return n?`${i}/${function(e){if(!e)return"";const t=e.trim();return t.includes(":")?t:`${As(t.toUpperCase(),`${t.toUpperCase()}USDT`)}:${t.toUpperCase()}USDT`}(n)}`:i}),a=re(()=>Wa(`${s.value}USDT`)),l=re(()=>[]),c=X(""),u=X(null),d=()=>{const e=h.value;e.innerHTML="";const t=document.createElement("script");t.async=!0,t.src="https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js";const i=Intl.DateTimeFormat().resolvedOptions().timeZone||"Etc/UTC";s.value,t.innerHTML=JSON.stringify({allow_symbol_change:!1,calendar:!1,details:!1,hide_side_toolbar:!1,hide_top_toolbar:!1,backgroundColor:"#000000",gridColor:"#00000000",hide_legend:!1,hide_volume:!1,hotlist:!1,interval:"H",locale:"en",save_image:!1,style:"1",symbol:o.value,theme:"dark",timezone:i,watchlist:[],withdateranges:!1,compareSymbols:[],studies:l.value}),e.appendChild(t),c.value=o.value,u.value=n.timeframe},h=X(null);return ae(d),ge(()=>[n.timeframe,i.value?t.symbolLabel:n.token.label,t.compareWith,t.dominanceOf],()=>{const e=o.value;c.value===e&&u.value===n.timeframe||d()}),(e,t)=>(Ae(),_e("div",{class:"tradingview-widget-container",ref_key:"root",ref:h},[t[0]||(t[0]=ye("div",{class:"tradingview-widget-container__widget"},null,-1)),ye("div",Ha,xe(a.value),1)],512))}}),[["__scopeId","data-v-d2c3cbb5"]]),za=qa(se({__name:"PersistentChart",setup(e){const t=ys(),n=ws(),i=Es(),{shouldShowChart:s,chartStyle:r,activeSlotId:o,compareSymbol:a,dominanceOf:l,exchange:c,isBlurred:u}=Pe(t),d=X(!1),h=re(()=>!!a.value||!!l.value),p=re(()=>{var e;if(o.value){const e=n.get(o.value);if("local"===(null==e?void 0:e.assetMode)&&(null==e?void 0:e.selectedSymbol))return e.selectedSymbol}return(null==(e=i.token)?void 0:e.label)||"BTC"}),v=re(()=>localStorage.getItem("tradeview:interval")||"60");ge(s,e=>{e&&!d.value&&(d.value=!0)});const g=ft(()=>{requestAnimationFrame(()=>{t.recalculatePosition()})},100,{maxWait:300});return ae(()=>{s.value&&(d.value=!0),window.addEventListener("resize",g)}),me(()=>{window.removeEventListener("resize",g)}),(e,t)=>ke((Ae(),_e("div",{ref:"chartContainer",class:"persistent-chart-container",style:be(Q(r))},[d.value?(Ae(),_e("div",{key:0,class:Se(["chart-content",{"chart-blurred":Q(u)}])},[h.value?(Ae(),Ie(Va,{key:`tv-old-${Q(i).refreshTick}`,"symbol-label":p.value,"compare-with":Q(a),"dominance-of":Q(l)},null,8,["symbol-label","compare-with","dominance-of"])):(Ae(),Ie(ja,{key:`tv-adv-${Q(i).refreshTick}`,"symbol-label":p.value,timeframe:v.value,exchange:Q(c)}
2,null,8,["symbol-label","timeframe","exchange"]))],2)):we("",!0)],4)),[[Le,Q(s)]])}}),[["__scopeId","data-v-bf0298b9"]]),Ga="/claw-icon.svg",Ya={class:"relative flex-shrink-0 px-6 pt-5 pb-3"},Ka={class:"flex items-center gap-1.5 justify-center mb-1"},Ja={class:"text-center text-[9px] text-white/20 uppercase tracking-[0.2em]"},Qa={class:"relative flex-1 overflow-y-auto overflow-x-hidden px-6 pb-2"},Xa={key:0,class:"flex flex-col items-center text-center gap-5 pb-2"},Za={key:1,class:"flex flex-col gap-4 pb-2"},el={class:"wv2-slide-header"},tl={class:"wv2-slide-icon",style:{"--ic":"#10b981","--icb":"rgba(16,185,129,0.15)"}},nl={class:"flex flex-col gap-2"},il={class:"wv2-row wv2-row--indigo"},sl={class:"wv2-num",style:{"--nc":"#818cf8","--nb":"rgba(129,140,248,0.1)"}},rl={class:"wv2-success-bar"},ol={key:2,class:"flex flex-col gap-4 pb-2"},al={class:"wv2-slide-header"},ll={class:"wv2-slide-icon",style:{"--ic":"#22d3ee","--icb":"rgba(34,211,238,0.12)"}},cl={class:"grid grid-cols-2 gap-2"},ul={class:"wv2-chip"},dl={class:"wv2-chip"},hl={class:"wv2-chip"},pl={class:"wv2-chip"},vl={class:"wv2-credit-bar"},gl={key:3,class:"flex flex-col gap-4 pb-2"},fl={class:"wv2-slide-header"},ml={class:"wv2-slide-icon",style:{"--ic":"#818cf8","--icb":"rgba(129,140,248,0.12)"}},_l={class:"wv2-row",style:{"border-color":"rgba(129,140,248,0.15)",background:"rgba(129,140,248,0.04)"}},yl={key:4,class:"flex flex-col gap-4 pb-2"},wl={class:"wv2-slide-header"},bl={class:"wv2-slide-icon",style:{"--ic":"#f59e0b","--icb":"rgba(245,158,11,0.12)"}},Sl={class:"grid grid-cols-2 gap-2.5"},El={class:"wv2-tool-card",style:{"--tc":"#ef4444"}},Tl={class:"wv2-tool-icon"},xl={class:"wv2-tool-card",style:{"--tc":"#10b981"}},Cl={class:"wv2-tool-icon"},Al={class:"wv2-tool-card",style:{"--tc":"#22d3ee"}},Pl={class:"wv2-tool-icon"},kl={class:"wv2-tool-card",style:{"--tc":"#818cf8"}},Ll={class:"wv2-tool-icon"},Il={key:5,class:"flex flex-col items-center text-center gap-5 py-2 pb-2"},Dl={class:"flex flex-col gap-2.5 w-full"},Ol={class:"relative flex items-center justify-between gap-3 px-5 py-4 flex-shrink-0",style:{"border-top":"1px solid rgba(255,255,255,0.05)"}},Nl={key:1},Ml="claw-v2-no-show",$l="claw-v2-seen-this-session",Rl=qa(se({__name:"WelcomeV2Modal",setup(e,{expose:t}){const n=new Date("2026-05-18T16:00:00Z"),i=X(!1),s=X(0),r=X("wv2-slide-fwd"),o=[0,1,2,3,4,5];function a(){r.value="wv2-slide-fwd",s.value++}function l(){r.value="wv2-slide-back",s.value--}function c(){i.value=!1,sessionStorage.setItem($l,"true")}function u(){i.value=!1,localStorage.setItem(Ml,"never")}function d(){s.value>=o.length-1&&c()}return t({maybeShow:function(){localStorage.getItem(Ml)||(Date.now()>n.getTime()+2592e5?localStorage.setItem(Ml,"expired"):sessionStorage.getItem($l)||setTimeout(()=>{i.value=!0},600))}}),"undefined"!=typeof window&&window.addEventListener("keydown",e=>{"Escape"===e.key&&i.value&&c()}),(e,t)=>{const n=Me("RouterLink");return Ae(),Ie(Ne,{to:"body"},[oe(De,{name:"wv2-fade"},{default:Oe(()=>[i.value?(Ae(),_e("div",{key:0,class:"fixed inset-0 z-[9998] flex items-end sm:items-center justify-center p-0 sm:p-6",onClick:Ee(d,["self"])},[ye("div",{class:"absolute inset-0 bg-black/90 backdrop-blur-md",onClick:d}),ye("div",{class:"wv2-card relative w-full sm:w-[min(94vw,620px)] max-h-[96dvh] sm:max-h-[90dvh] flex flex-col rounded-t-[28px] sm:rounded-[24px] overflow-hidden",onClick:t[0]||(t[0]=Ee(()=>{},["stop"]))},[t[36]||(t[36]=ye("div",{class:"wv2-grid-bg pointer-events-none absolute inset-0"},null,-1)),t[37]||(t[37]=ye("div",{class:"pointer-events-none absolute -top-32 -right-32 w-80 h-80 rounded-full wv2-orb-cyan"},null,-1)),t[38]||(t[38]=ye("div",{class:"pointer-events-none absolute -bottom-32 -left-32 w-72 h-72 rounded-full wv2-orb-indigo"},null,-1)),t[39]||(t[39]=ye("div",{class:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-96 h-32 wv2-orb-mid"},null,-1)),t[40]||(t[40]=ye("div",{class:"wv2-border-shimmer pointer-events-none absolute inset-0 rounded-t-[28px] sm:rounded-[24px]"},null,-1)),ye("div",Ya,[ye("div",Ka,[(Ae(),_e(ce,null,Te(o,(e,t)=>ye("div",{key:t,class:Se(["wv2-dot",t===s.value?"wv2-dot--active":t<s.value?"wv2-dot--done":""])},null,2)),64))]),ye("p",Ja,xe(s.value+1)+" / "+xe(o.length),1)]),ye("div",Qa,[oe(De,{name:r.value,mode:"out-in"},{default:Oe(()=>[(Ae(),_e("div",{key:s.value},[0===s.value?(Ae(),_e("div",Xa,t[1]||(t[1]=[ye("div",{class:"relative mt-2"},[ye("div",{class:"wv2-logo-ring"},[ye("img",{src:Ga,alt:"CLAW",class:"w-16 h-16 relative z-10 wv2-float"})])],-1),ye("div",{class:"space-y-2"},[ye("p",{class:"wv2-eyebrow"},"CLAW v2 â 18th May 2026"),ye("h2",{class:"wv2-hero-title"},[Ce(" This is the turning"),ye("br"),Ce("point for the Eagles. "),ye("span",{class:"wv2-eagle-emoji"},"ð¦
")]),ye("p",{class:"text-white/60 text-sm leading-relaxed"}," From Rocks, Jambo & DK â we are incredibly proud of what this community and team has built. CLAW v2 isn't just an upgrade. It's the platform we always knew we could build â free for Eagles, packed with tools that give you a genuine market edge. ")],-1),ye("div",{class:"flex gap-4 items-center justify-center"},[ye("div",{class:"wv2-founder-wrap",style:{"--glow":"#22d3ee"}},[ye("img",{src:"/founders-rocks.png",alt:"Rocks",class:"wv2-founder-img"}),ye("span",{class:"wv2-founder-label"},"Rocks")]),ye("div",{class:"wv2-founder-wrap",style:{"--glow":"#818cf8"}},[ye("img",{src:"/founders-jambo.png",alt:"Jambo",class:"wv2-founder-img"}),ye("span",{class:"wv2-founder-label"},"Jambo")]),ye("div",{class:"wv2-founder-wrap",style:{"--glow":"#4ade80"}},[ye("img",{src:"/founders-dk.png",alt:"DK",class:"wv2-founder-img"}),ye("span",{class:"wv2-founder-label"},"DK")])],-1),ye("div",{class:"wv2-callout w-full"},[ye("div",{class:"wv2-callout-dot"}),ye("p",{class:"text-white/55 text-xs leading-relaxed text-center"},[Ce(" Built by "),ye("strong",{class:"text-white"},"3 developers"),Ce(" â no external sources, no big team, no shortcuts. Just three young lads working hard, building something we're genuinely proud of. ð ")])],-1),ye("p",{class:"text-white/30 text-xs w-full text-center"}
2,"Welcome to the next chapter â let's walk you through what's new.",-1)]))):1===s.value?(Ae(),_e("div",Za,[ye("div",el,[ye("div",tl,[oe(Q(_t),{icon:"mdi:lock-open-variant",width:"22"})]),t[2]||(t[2]=ye("div",null,[ye("p",{class:"wv2-tag",style:{color:"rgba(52,211,153,0.8)"}},"What's New"),ye("h3",{class:"wv2-slide-title"},"CLAW is Free for Eagles")],-1))]),t[6]||(t[6]=ye("p",{class:"text-white/55 text-sm leading-relaxed"},"No subscription, no credit card. Verify an exchange UID and you're in â permanently.",-1)),ye("div",nl,[t[4]||(t[4]=ye("div",{class:"wv2-row wv2-row--green"},[ye("span",{class:"wv2-num"},"1"),ye("div",null,[ye("p",{class:"wv2-row-title"},"Verify your exchange UID"),ye("p",{class:"wv2-row-sub"},"Sign up to ApeX, BloFin, MEXC or Binance via our affiliate link â or verify an existing ApeX account by wallet.")])],-1)),ye("div",il,[ye("span",sl,[oe(Q(_t),{icon:"mdi:discord",width:"13"})]),t[3]||(t[3]=ye("div",null,[ye("p",{class:"wv2-row-title"},"Bonus â Join the Eagle Discord"),ye("p",{class:"wv2-row-sub"},"Exclusive trade setups, market analysis and a direct line to the team. Optional â not required for access.")],-1))])]),ye("div",rl,[oe(Q(_t),{icon:"mdi:check-circle",width:"14",class:"shrink-0"}),t[5]||(t[5]=Ce(" Exchange UID verified? You're in. Permanently. No renewal, no fees. ",-1))])])):2===s.value?(Ae(),_e("div",ol,[ye("div",al,[ye("div",ll,[oe(Q(_t),{icon:"mdi:robot-outline",width:"22"})]),t[7]||(t[7]=ye("div",null,[ye("p",{class:"wv2-tag",style:{color:"rgba(34,211,238,0.8)"}},"New Feature"),ye("h3",{class:"wv2-slide-title"},"Ask CLAW â AI Trading Assistant")],-1))]),t[13]||(t[13]=ye("p",{class:"text-white/55 text-sm leading-relaxed"},"Your personal AI analyst on every screen. Ask it anything â it has live context from the exact charts you're looking at.",-1)),t[14]||(t[14]=ye("div",{class:"wv2-chat-preview"},[ye("div",{class:"wv2-chat-msg wv2-chat-user"},'"Why is BTC dumping right now?"'),ye("div",{class:"wv2-chat-msg wv2-chat-ai"},[ye("span",{class:"wv2-ai-dot"}),Ce(" Based on your current chart, funding rates flipped negative at 14:20 UTC â large short positions are opening. Key support at $96,400. Watch for liquidation cluster below. ")])],-1)),ye("div",cl,[ye("div",ul,[oe(Q(_t),{icon:"mdi:chart-line",width:"13",class:"text-cyan-400 shrink-0"}),t[8]||(t[8]=ye("span",null,'"Why is BTC pumping?"',-1))]),ye("div",dl,[oe(Q(_t),{icon:"mdi:fire",width:"13",class:"text-orange-400 shrink-0"}),t[9]||(t[9]=ye("span",null,'"What\'s the sentiment?"',-1))]),ye("div",hl,[oe(Q(_t),{icon:"mdi:target",width:"13",class:"text-indigo-400 shrink-0"}),t[10]||(t[10]=ye("span",null,'"Set me key levels"',-1))]),ye("div",pl,[oe(Q(_t),{icon:"mdi:content-copy",width:"13",class:"text-emerald-400 shrink-0"}),t[11]||(t[11]=ye("span",null,'"Find me a copy trade"',-1))])]),ye("div",vl,[oe(Q(_t),{icon:"mdi:gift-outline",width:"15",class:"shrink-0 text-cyan-300"}),t[12]||(t[12]=ye("p",null,[ye("strong",{class:"text-white"},"50 free credits"),Ce(" to start. Subscribe or buy packs to top up any time.")],-1))])])):3===s.value?(Ae(),_e("div",gl,[ye("div",fl,[ye("div",ml,[oe(Q(_t),{icon:"mdi:account-multiple",width:"22"})]),t[15]||(t[15]=ye("div",null,[ye("p",{class:"wv2-tag",style:{color:"rgba(129,140,248,0.8)"}},"New Feature"),ye("h3",{class:"wv2-slide-title"},"Copy Trade â Follow the Best")],-1))]),t[17]||(t[17]=ye("p",{class:"text-white/55 text-sm leading-relaxed"},"Discover top traders on ApeX, see their live P&L, win rate, strategy â then copy their trades automatically with one tap.",-1)),t[18]||(t[18]=ye("div",{class:"wv2-leaderboard"},[ye("div",{class:"wv2-lb-row"},[ye("span",{class:"wv2-lb-rank"},"ð¥"),ye("div",{class:"flex-1"},[ye("p",{class:"text-white text-xs font-bold"},"CryptoHawk"),ye("p",{class:"text-white/35 text-[10px]"},"+847% ROI · 78% win rate")]),ye("span",{class:"wv2-lb-copy"},"Follow")]),ye("div",{class:"wv2-lb-row"},[ye("span",{class:"wv2-lb-rank"},"ð¥"),ye("div",{class:"flex-1"},[ye("p",{class:"text-white text-xs font-bold"},"AlphaEdge"),ye("p",{class:"text-white/35 text-[10px]"},"+612% ROI · 71% win rate")]),ye("span",{class:"wv2-lb-copy"},"Follow")]),ye("div",{class:"wv2-lb-row"},[ye("span",{class:"wv2-lb-rank"},"ð¥"),ye("div",{class:"flex-1"},[ye("p",{class:"text-white text-xs font-bold"},"SteelHands"),ye("p",{class:"text-white/35 text-[10px]"},"+498% ROI · 69% win rate")]),ye("span",{class:"wv2-lb-copy"},"Follow")])],-1)),ye("div",_l,[oe(Q(_t),{icon:"mdi:robot",width:"16",class:"text-indigo-400 shrink-0 mt-0.5"}),t[16]||(t[16]=ye("div",null,[ye("p",{class:"wv2-row-title"},"Ask CLAW to find your trader"),ye("p",{class:"wv2-row-sub"},'"Low drawdown, BTC only" â the AI picks the best match for your style.')],-1))])])):4===s.value?(Ae(),_e("div",yl,[ye("div",wl,[ye("div",bl,[oe(Q(_t),{icon:"mdi:chart-bar",width:"22"})]),t[19]||(t[19]=ye("div",null,[ye("p",{class:"wv2-tag",style:{color:"rgba(251,191,36,0.8)"}},"Pre & Post Trade"),ye("h3",{class:"wv2-slide-title"},"Your Full Trade Cockpit")],-1))]),t[28]||(t[28]=ye("p",{class:"text-white/55 text-sm leading-relaxed"},"Every tool you need before you pull the trigger â and everything to review after.",-1)),ye("div",Sl,[ye("div",El,[ye("div",Tl,[oe(Q(_t),{icon:"mdi:map-marker-path",width:"16"})]),t[20]||(t[20]=ye("p",{class:"text-white text-xs font-bold"},"Liquidation Maps",-1)),t[21]||(t[21]=ye("p",{class:"text-white/40 text-[10px] leading-relaxed"},"See where liquidations are clustered in real time.",-1))]),ye("div",xl,[ye("div",Cl,[oe(Q(_t),{icon:"mdi:cash-multiple",width:"16"})]),t[22]||(t[22]=ye("p",{class:"text-white text-xs font-bold"},"Funding Rates",-1)),t[23]||(t[23]=ye("p",{class:"text-white/40 text-[10px] leading-relaxed"},"Live funding across all major perp exchanges.",-1))]),ye("div",Al,[ye("div",Pl,[oe(Q(_t),{icon:"mdi:trending-up",width:"16"})]),t[24]||(t[24]=ye("p",{class:"text-white text-xs font-bold"},"Trade Analysis",-1)),t[25]||(t[25]=ye("p",{class:"text-white/40 text-[10px] leading-relaxed"},"Review closed positions with full P&L breakdown.",-1))]),ye("div",kl,[ye("div",Ll,[oe(Q(_t),{icon:"mdi:brain",width:"16"})]),t[26]||(t[26]=ye("p",{class:"text-white text-xs font-bold"},"AI Market Intel",-1)),t[27]||(t[27]=ye("p",{class:"text-white/40 text-[10px] leading-relaxed"},"Real-time AI signals surfaced from across the market.",-1))])])])):5===s.value?(Ae(),_e("div",Il,[t[30]||(t[30]=ye("div",{class:"relative flex items-center justify-center mt-3"},[ye("div",{class:"wv2-pulse-ring wv2-pulse-ring--1"}),ye("div",{class:"wv2-pulse-ring wv2-pulse-ring--2"}),ye("div",{class:"wv2-pulse-ring wv2-pulse-ring--3"}),ye("span",{class:"text-6xl relative z-10 wv2-float"},"ð¦
")],-1)),t[31]||(t[31]=ye("div",{class:"space-y-2"},[ye("p",{class:"wv2-eyebrow"},"You're ready."),ye("h2",{class:"text-[28px] font-black text-white leading-tight"},[Ce(" Let's get to"),ye("br"),ye("span",{class:"wv2-gradient-text"}
2,"work.")]),ye("p",{class:"text-white/50 text-sm leading-relaxed"},[Ce(" Head to "),ye("strong",{class:"text-white"},"Account â Verification"),Ce(" to complete your UID gate and unlock everything. Or dive straight in â the tools are waiting. ")])],-1)),ye("div",Dl,[oe(n,{to:"/account/verification",class:"wv2-btn-cta",onClick:c},{default:Oe(()=>[oe(Q(_t),{icon:"mdi:shield-check",width:"16"}),t[29]||(t[29]=Ce(" Complete Verification ",-1)),oe(Q(_t),{icon:"mdi:arrow-right",width:"15",class:"ml-auto"})]),_:1,__:[29]}),ye("button",{class:"wv2-btn-ghost",onClick:c}," Explore CLAW v2 ")]),t[32]||(t[32]=ye("p",{class:"text-white/20 text-[10px] tracking-wider"},"â Rocks, Jambo & DK",-1))])):we("",!0)]))]),_:1},8,["name"])]),ye("div",Ol,[s.value>0?(Ae(),_e("button",{key:0,class:"wv2-nav-back",onClick:l},[oe(Q(_t),{icon:"mdi:chevron-left",width:"16"}),t[33]||(t[33]=Ce(" Back ",-1))])):(Ae(),_e("div",Nl)),s.value<o.length-1?(Ae(),_e("button",{key:2,class:"wv2-btn-next ml-auto",onClick:a},[t[34]||(t[34]=Ce(" Next ",-1)),oe(Q(_t),{icon:"mdi:chevron-right",width:"15"})])):(Ae(),_e("button",{key:3,class:"wv2-btn-next ml-auto",onClick:c},[t[35]||(t[35]=Ce(" Let's go ",-1)),oe(Q(_t),{icon:"mdi:rocket-launch-outline",width:"14"})])),s.value<o.length-1?(Ae(),_e("button",{key:4,class:"text-[11px] text-white/35 hover:text-white/60 transition-colors underline underline-offset-2",onClick:u},"Don't show again")):we("",!0)])])])):we("",!0)]),_:1})])}}}),[["__scopeId","data-v-a83d414d"]]);function Fl(){const e=localStorage.getItem("token");return e?{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}:null}async function Ul(e){const t=Fl();t&&await mt.put(`${_a}/api/v1/users/notification-preferences`,{preferences:e},{headers:t})}const Bl=ve("notifications",()=>{const e=X([]),t=X([]),n=X(0),i=X(!1),s=X(!1),r=X("all"),o=X(!1),a=X(!1),l=X(!0),c=re(()=>e.value.filter(e=>!e.read)),u=re(()=>c.value.length),d=re(()=>"all"===r.value?e.value:"unread"===r.value?c.value:e.value.filter(e=>e.feature===r.value)),h=re(()=>{const e=u.value;return 0===e?"":e>9?"9+":e.toString()}),p=re(()=>u.value>0);async function v(t=50,s=!1){var o;if(ms("token")){i.value=!0;try{const i=s&&e.value.length>0?e.value[e.value.length-1].id:void 0,o="all"!==r.value?r.value:void 0,a=await async function(e={}){const t=Fl();if(!t)return{notifications:[],count:0};const{data:n}=await mt.get(`${_a}/api/v1/users/notifications`,{headers:t,params:e});return n.data}({per_page:t,last_id:i,filter:o}),c=a.notifications??[];e.value=s?[...e.value,...c]:c,n.value=a.count??0,l.value=c.length>=t}catch(a){404!==(null==(o=null==a?void 0:a.response)?void 0:o.status)&&console.error("Failed to load notifications:",a)}finally{i.value=!1}}}function g(e,n){return t.value.find(t=>t.feature===e&&t.notification_type===n)??t.value.find(t=>t.feature===e&&t.notification_type===e)}return{notifications:e,preferences:t,totalCount:n,isLoading:i,isCenterOpen:s,currentFilter:r,telegramEnabled:o,emailVerified:a,hasMore:l,unreadNotifications:c,unreadCount:u,filteredNotifications:d,badgeCount:h,hasUnread:p,loadNotifications:v,loadMore:async function(){l.value&&!i.value&&await v(50,!0)},loadPreferences:async function(){var e;if(ms("token"))try{const e=(await async function(){const e=Fl();if(!e)return{preferences:[]};const{data:t}=await mt.get(`${_a}/api/v1/users/notification-preferences`,{headers:e});return t.data}()).preferences??[];if(0===e.length){const{getDefaultPreferences:e}=await dt(async()=>{const{getDefaultPreferences:e}=await import("./DAaHs7Hd.js");return{getDefaultPreferences:e}},[]),n=e();try{await Ul(n)}catch{}t.value=n}else t.value=e}catch(n){if(404===(null==(e=null==n?void 0:n.response)?void 0:e.status)){const{getDefaultPreferences:e}=await dt(async()=>{const{getDefaultPreferences:e}=await import("./DAaHs7Hd.js");return{getDefaultPreferences:e}},[]);t.value=e()}else console.error("Failed to load preferences:",n)}},savePreferences:async function(e){try{return await Ul(e),t.value=e,!0}catch(n){return console.error("Failed to save preferences:",n),!1}},markAsRead:async function(t){try{await async function(e){const t=Fl();t&&await mt.put(`${_a}/api/v1/users/notifications/${e}/read`,{},{headers:t})}(t);const n=e.value.find(e=>e.id===t);n&&!n.read&&(n.read=!0)}catch(n){console.error("Failed to mark notification as read:",n)}},markAllAsRead:async function(){try{const t="all"!==r.value?r.value:void 0;await async function(e){const t=Fl();t&&await mt.put(`${_a}/api/v1/users/notifications/mark-all-read`,{filter:e||""},{headers:t})}
2(t),e.value.forEach(e=>{e.read||(e.read=!0)})}catch(t){console.error("Failed to mark all as read:",t)}},deleteOne:async function(t){try{await async function(e){const t=Fl();t&&await mt.delete(`${_a}/api/v1/users/notifications/${e}`,{headers:t})}(t),e.value=e.value.filter(e=>e.id!==t),n.value=Math.max(0,n.value-1)}catch(i){console.error("Failed to delete notification:",i)}},clearAll:async function(){try{await async function(){const e=Fl();e&&await mt.delete(`${_a}/api/v1/users/notifications`,{headers:e})}(),e.value=[],n.value=0}catch(t){console.error("Failed to clear notifications:",t)}},addNotification:function(t){e.value.unshift(t),n.value++},toggleCenter:function(){s.value=!s.value},closeCenter:function(){s.value=!1},setFilter:function(e){r.value=e,v(50,!1)},getPreference:g,isDashboardEnabled:function(e,t){const n=g(e,t);return(null==n?void 0:n.dashboard)??!0}}});function ql(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),n=atob(t);return Uint8Array.from([...n].map(e=>e.charCodeAt(0)))}function jl(){return"serviceWorker"in navigator&&"PushManager"in window}async function Wl(){var e,t;try{if(!jl())return!1;const n=await Promise.race([navigator.serviceWorker.ready,new Promise((e,t)=>setTimeout(()=>t(new Error("No active service worker after 15s â try closing and reopening the app")),15e3))]),i=await n.pushManager.getSubscription();i&&await i.unsubscribe();const s=(await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ql("BKN0cYSzq-UT2YXrfi2siwh13RwpxfHjWNTUUqbTx833uCV57xfSiLyjoiCxrNEP_JIhBw-fWaEb3SzLiXnkfN4")})).toJSON();return await mt.post(`${_a}/api/v1/users/push-subscription`,{endpoint:s.endpoint,p256dh:null==(e=s.keys)?void 0:e.p256dh,auth:null==(t=s.keys)?void 0:t.auth},{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`,"Content-Type":"application/json"}}),localStorage.setItem("push_enabled","true"),console.info("[WebPush] Subscribed successfully"),!0}catch(n){const e=n instanceof Error?n.message:String(n);throw console.warn("[WebPush] Setup failed:",e),new Error(e)}}const Hl={key:0,class:"fixed bottom-6 left-4 right-4 z-[9999] bg-slate-900/95 backdrop-blur-xl border border-cyan-500/30 rounded-2xl p-4 shadow-2xl shadow-cyan-500/10 flex items-center gap-4"},Vl={class:"flex-1 min-w-0"},zl={class:"text-cyan-400 text-xs mt-1 flex items-center gap-1"},Gl=se({__name:"InstallPWABanner",setup(e){const t=X(!1);function n(){t.value=!1,localStorage.setItem("pwa-banner-dismissed","1")}return ae(()=>{if(localStorage.getItem("pwa-banner-dismissed"))return;const e=/iPad|iPhone|iPod/.test(navigator.userAgent),n=/Android/.test(navigator.userAgent),i=e||n,s=window.matchMedia("(display-mode: standalone)").matches||"standalone"in window.navigator&&!0===window.navigator.standalone;i&&!s&&localStorage.getItem("token")&&setTimeout(()=>{t.value=!0},5e3)}),(e,i)=>(Ae(),Ie(De,{"enter-active-class":"transition ease-out duration-300","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition ease-in duration-200","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:Oe(()=>[t.value?(Ae(),_e("div",Hl,[i[3]||(i[3]=ye("img",{src:"/icons/icon-192x192.png",alt:"CLAW",class:"w-12 h-12 rounded-xl flex-shrink-0"},null,-1)),ye("div",Vl,[i[1]||(i[1]=ye("p",{class:"text-white font-semibold text-sm"},"Add CLAW to Home Screen",-1)),i[2]||(i[2]=ye("p",{class:"text-slate-400 text-xs mt-0.5"},"Get trade notifications even when CLAW is closed",-1)),ye("p",zl,[oe(Q(_t),{icon:"mdi:export-variant",width:"14"}),i[0]||(i[0]=Ce(" Tap Share â Add to Home Screen ",-1))])]),ye("button",{onClick:n,class:"flex-shrink-0 w-7 h-7 flex items-center justify-center rounded-full bg-slate-700/80 text-slate-400 hover:text-white"},[oe(Q(_t),{icon:"mdi:close",width:"16"})])])):we("",!0)]),_:1}))}});var Yl,Kl;(Kl=Yl||(Yl={})).Unimplemented="UNIMPLEMENTED",Kl.Unavailable="UNAVAILABLE";class Jl extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const Ql=(e=>e.Capacitor=(e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},i=n.Plugins=n.Plugins||{},s=()=>null!==t?t.name:(e=>{var t,n;return(null==e?void 0:e.androidBridge)?"android":(null===(n=null===(t=null==e?void 0:e.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.bridge)?"ios":"web"})(e),r=e=>{var t;return null===(t=n.PluginHeaders)||void 0===t?void 0:t.find(t=>t.name===e)},o=new Map;return n.convertFileSrc||(n.convertFileSrc=e=>e),n.getPlatform=s,n.handleError=t=>e.console.error(t),n.isNativePlatform=()=>"web"!==s(),n.isPluginAvailable=e=>{const t=o.get(e);return!!(null==t?void 0:t.platforms.has(s()))||!!r(e)},n.registerPlugin=(e,a={})=>{const l=o.get(e);if(l)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),l.proxy;const c=s(),u=r(e);let d;const h=i=>{let s;const r=(...r)=>{const o=(async()=>(!d&&c in a?d=d="function"==typeof a[c]?await a[c]():a[c]:null!==t&&!d&&"web"in a&&(d=d="function"==typeof a.web?await a.web():a.web),d))().then(t=>{const o=((t,i)=>{var s,r;if(!u){if(t)return null===(r=t[i])||void 0===r?void 0:r.bind(t);throw new Jl(`"${e}" plugin is not implemented on ${c}`,Yl.Unimplemented)}{const r=null==u?void 0:u.methods.find(e=>i===e.name);if(r)return"promise"===r.rtype?t=>n.nativePromise(e,i.toString(),t):(t,s)=>n.nativeCallback(e,i.toString(),t,s);if(t)return null===(s=t[i])||void 0===s?void 0:s.bind(t)}})(t,i);if(o){const e=o(...r);return s=null==e?void 0:e.remove,e}throw new Jl(`"${e}.${i}()" is not implemented on ${c}`,Yl.Unimplemented)});return"addListener"===i&&(o.remove=async()=>s()),o};return r.toString=()=>`${i.toString()}() { [capacitor code] }
2`,Object.defineProperty(r,"name",{value:i,writable:!1,configurable:!1}),r},p=h("addListener"),v=h("removeListener"),g=(e,t)=>{const n=p({eventName:e},t),i=async()=>{const i=await n;v({eventName:e,callbackId:i},t)},s=new Promise(e=>n.then(()=>e({remove:i})));return s.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await i()},s},f=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return u?g:p;case"removeListener":return v;default:return h(t)}}});return i[e]=f,o.set(e,{name:e,proxy:f,platforms:new Set([...Object.keys(a),...u?[c]:[]])}),f},n.Exception=Jl,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),Xl=Ql.registerPlugin;class Zl{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let n=!1;this.listeners[e]||(this.listeners[e]=[],n=!0),this.listeners[e].push(t);const i=this.windowListeners[e];return i&&!i.registered&&this.addWindowListener(i),n&&this.sendRetainedArgumentsForEvent(e),Promise.resolve({remove:async()=>this.removeListener(e,t)})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,n){const i=this.listeners[e];if(i)i.forEach(e=>e(t));else if(n){let n=this.retainedEventArguments[e];n||(n=[]),n.push(t),this.retainedEventArguments[e]=n}}hasListeners(e){var t;return!!(null===(t=this.listeners[e])||void 0===t?void 0:t.length)}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e="not implemented"){return new Ql.Exception(e,Yl.Unimplemented)}unavailable(e="not available"){return new Ql.Exception(e,Yl.Unavailable)}async removeListener(e,t){const n=this.listeners[e];if(!n)return;const i=n.indexOf(t);this.listeners[e].splice(i,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(t=>{this.notifyListeners(e,t)}))}}const ec=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),tc=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class nc extends Zl{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach(e=>{if(e.length<=0)return;let[n,i]=e.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=tc(n).trim(),i=tc(i).trim(),t[n]=i}),t}async setCookie(e){try{const t=ec(e.key),n=ec(e.value),i=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",s=(e.path||"/").replace("path=",""),r=null!=e.url&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${n||""}${i}; path=${s}; ${r};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}Xl("CapacitorCookies",{web:()=>new nc});class ic extends Zl{async request(e){const t=((e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),i=((e={})=>{const t=Object.keys(e);return Object.keys(e).map(e=>e.toLocaleLowerCase()).reduce((n,i,s)=>(n[i]=e[t[s]],n),{})})(e.headers)["content-type"]||"";if("string"==typeof e.data)n.body=e.data;else if(i.includes("application/x-www-form-urlencoded")){const t=new URLSearchParams;for(const[n,i]of Object.entries(e.data||{}))t.set(n,i);n.body=t.toString()}else if(i.includes("multipart/form-data")||e.data instanceof FormData){const t=new FormData;if(e.data instanceof FormData)e.data.forEach((e,n)=>{t.append(n,e)});else for(const n of Object.keys(e.data))t.append(n,e.data[n]);n.body=t;const i=new Headers(n.headers);i.delete("content-type"),n.headers=i}else(i.includes("application/json")||"object"==typeof e.data)&&(n.body=JSON.stringify(e.data));return n})(e,e.webFetchExtra),n=((e,t=!0)=>e?Object.entries(e).reduce((e,n)=>{const[i,s]=n;let r,o;
2return Array.isArray(s)?(o="",s.forEach(e=>{r=t?encodeURIComponent(e):e,o+=`${i}=${r}&`}),o.slice(0,-1)):(r=t?encodeURIComponent(s):s,o=`${i}=${r}`),`${e}&${o}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),i=n?`${e.url}?${n}`:e.url,s=await fetch(i,t),r=s.headers.get("content-type")||"";let o,a,{responseType:l="text"}=s.ok?e:{};switch(r.includes("application/json")&&(l="json"),l){case"arraybuffer":case"blob":a=await s.blob(),o=await(async e=>new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const e=i.result;t(e.indexOf(",")>=0?e.split(",")[1]:e)},i.onerror=e=>n(e),i.readAsDataURL(e)}))(a);break;case"json":o=await s.json();break;default:o=await s.text()}const c={};return s.headers.forEach((e,t)=>{c[t]=e}),{data:o,headers:c,status:s.status,url:s.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}var sc,rc,oc,ac;Xl("CapacitorHttp",{web:()=>new ic}),(rc=sc||(sc={})).Dark="DARK",rc.Light="LIGHT",rc.Default="DEFAULT",(ac=oc||(oc={})).StatusBar="StatusBar",ac.NavigationBar="NavigationBar";class lc extends Zl{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Xl("SystemBars",{web:()=>new lc});const cc=Xl("App",{web:()=>dt(()=>import("./BZLwyJ1H.js"),__vite__mapDeps([15,2,7,1,8,9])).then(e=>new e.AppWeb)});var uc,dc,hc,pc;(dc=uc||(uc={})).Dark="DARK",dc.Light="LIGHT",dc.Default="DEFAULT",(pc=hc||(hc={})).None="NONE",pc.Slide="SLIDE",pc.Fade="FADE";const vc=Xl("StatusBar"),gc=Xl("SplashScreen",{web:()=>dt(()=>import("./CUtZKy9Q.js"),__vite__mapDeps([16,2,7,1,8,9])).then(e=>new e.SplashScreenWeb)});var fc,mc,_c,yc;(mc=fc||(fc={})).Heavy="HEAVY",mc.Medium="MEDIUM",mc.Light="LIGHT",(yc=_c||(_c={})).Success="SUCCESS",yc.Warning="WARNING",yc.Error="ERROR";const wc=Xl("Haptics",{web:()=>dt(()=>import("./CJnOj61d.js"),__vite__mapDeps([17,2,7,1,8,9])).then(e=>new e.HapticsWeb)});var bc,Sc,Ec,Tc;(Sc=bc||(bc={})).Dark="DARK",Sc.Light="LIGHT",Sc.Default="DEFAULT",(Tc=Ec||(Ec={})).Body="body",Tc.Ionic="ionic",Tc.Native="native",Tc.None="none";const xc=Xl("Keyboard"),Cc=Xl("Device",{web:()=>dt(()=>import("./BRAxK6-H.js"),__vite__mapDeps([18,2,7,1,8,9])).then(e=>new e.DeviceWeb)}),Ac=Xl("Preferences",{web:()=>dt(()=>import("./BhCxTHm4.js"),__vite__mapDeps([19,2,7,1,8,9])).then(e=>new e.PreferencesWeb)}),Pc=Ql.isNativePlatform(),kc="ios"===Ql.getPlatform(),Lc="android"===Ql.getPlatform(),Ic="web"===Ql.getPlatform(),Dc=X(!0),Oc=X(!1),Nc=X(0);Xl("PushNotifications",{});let Mc=!1;function $c(){function e(e){}function t(e){}let n=null;function i(e){var t;const n=window.getSelection();if(!n||n.isCollapsed)return;const i=n.toString();i.trim()&&(null==(t=e.clipboardData)||t.setData("text/plain",i+"\n\nâ © Eagle AI Labs Ltd. CLAW Platform â Proprietary & Confidential â"),e.preventDefault())}function s(e){const t=e.target;(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof SVGElement)&&e.preventDefault()}ae(()=>{(function(){const e=navigator;return!0===e.webdriver||!!/HeadlessChrome/i.test(navigator.userAgent)||void 0!==e.callPhantom||void 0!==window._phantom||0===screen.width||0===screen.height})()&&(document.open(),document.write("<!doctype html><html><head><title>Access Denied</title>\n <style>body{margin:0;background:#000;color:#fff;font-family:sans-serif;display:flex;\n align-items:center;justify-content:center;min-height:100vh;flex-direction:column;gap:12px}\n h1{color:#00f6ff;font-size:24px;margin:0}p{color:rgba(255,255,255,0.4);font-size:13px}</style>\n </head><body><h1>Access Denied</h1>\n <p>Automated access to this platform is not permitted.</p>\n <p>© Eagle AI Labs Ltd. All rights reserved.</p></body></html>"),document.close()),Mc||(Mc=!0,console.log("%cCLAW Platform","color:#00f6ff;font-size:22px;font-weight:800;letter-spacing:-0.02em;"),console.log("%câ STOP â Proprietary Software","color:#ff4444;font-size:14px;font-weight:700;"),console.log("%cThis browser console is intended for authorised Eagle AI Labs engineers only.\nUnauthorised inspection, reproduction, or distribution of any part of this\napplication is strictly prohibited and may result in civil and criminal prosecution.\n\n© Eagle AI Labs Ltd. All rights reserved.","color:rgba(255,255,255,0.5);font-size:11px;line-height:1.7;")),n=document.createElement("style"),n.id="__claw_print_block",n.textContent="@media print{*{display:none!important}}",document.head.appendChild(n),document.addEventListener("keydown",e,{capture:!0}),document.addEventListener("contextmenu",t),document.addEventListener("copy",i),document.addEventListener("dragstart",s)}),le(()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("contextmenu",t),document.removeEventListener("copy",i),document.removeEventListener("dragstart",s),null==n||n.remove()})}const Rc=["[email protected]","[email protected]","[email protected]","[email protected]","[email protected]
2om","[email protected]"];function Fc(){try{const e=localStorage.getItem("user");if(e){const t=JSON.parse(e);if(null==t?void 0:t.email)return t.email.toLowerCase()}return(localStorage.getItem("user_email")||"").toLowerCase()}catch{return""}}function Uc(e){return!(!e||!e.endsWith("@eagleailabs.com")&&!Rc.includes(e))}const Bc={key:0,class:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-[#060d18] text-white select-none"},qc={class:"flex flex-col items-center gap-6 max-w-sm text-center px-6"},jc={class:"grid grid-cols-4 gap-2 w-full"},Wc={class:"w-full rounded-lg border border-white/[0.08] bg-white/[0.03] py-2.5 text-center"},Hc={class:"text-[9px] text-white/30 uppercase tracking-wider"},Vc={class:"w-full border border-white/[0.08] rounded-lg px-4 py-3 bg-white/[0.03] text-left"},zc={class:"text-[13px] text-white/60 font-mono"},Gc={class:"contents"},Yc=se({__name:"App",setup(e){_s(),$c();const t=Ue(),n=Re(),i=new Date("2026-05-18T16:00:00Z").getTime(),s=X(Date.now()),r=setInterval(()=>{s.value=Date.now()},1e3);le(()=>clearInterval(r)),re(()=>{const e=new Date(i);return e.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",timeZone:"Europe/London"})+" at "+e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",timeZone:"Europe/London"})+" UK"});const o=re(()=>!!localStorage.getItem("token")),a=re(()=>!(s.value>=i)&&(!!o.value&&(!["/auth","/login","/signup","/verify"].some(e=>n.path.startsWith(e))&&!Uc(Fc())))),l=re(()=>{const e=Math.max(0,i-s.value),t=Math.floor(e/1e3);return{d:Math.floor(t/86400),h:Math.floor(t%86400/3600),m:Math.floor(t%3600/60),s:t%60}});function c(){localStorage.removeItem("token"),localStorage.removeItem("user"),localStorage.removeItem("user_email"),t.push("/auth/login")}const u=X(null);ge(a,e=>{e||setTimeout(()=>{var e;return null==(e=u.value)?void 0:e.maybeShow()},800)},{immediate:!0});const d=ys();ge(()=>n.name,e=>{d.setRoute(e)},{immediate:!0}),Bl();const{initNative:h,isNative:p}=function(){const e=async()=>{if(Pc)try{await vc.setStyle({style:uc.Dark}),await vc.setBackgroundColor({color:"#090f1d"}),kc&&await vc.setOverlaysWebView({overlay:!0})}catch(e){console.warn("[Capacitor] StatusBar setup failed:",e)}},t=async()=>{if(Pc)try{await gc.hide({fadeOutDuration:300})}catch(e){console.warn("[Capacitor] SplashScreen hide failed:",e)}};return{isNative:Pc,isIOS:kc,isAndroid:Lc,isWeb:Ic,appIsActive:$e(Dc),keyboardVisible:$e(Oc),keyboardHeight:$e(Nc),initNative:async()=>{Pc&&(await e(),Pc&&(cc.addListener("appStateChange",({isActive:e})=>{Dc.value=e}),cc.addListener("backButton",({canGoBack:e})=>{e?window.history.back():cc.minimizeApp()})),Pc&&(xc.addListener("keyboardWillShow",e=>{Oc.value=!0,Nc.value=e.keyboardHeight}),xc.addListener("keyboardWillHide",()=>{Oc.value=!1,Nc.value=0})),setTimeout(()=>t(),200))},setupStatusBar:e,hideSplash:t,hapticLight:async()=>{Pc&&await wc.impact({style:fc.Light})},hapticMedium:async()=>{Pc&&await wc.impact({style:fc.Medium})},hapticHeavy:async()=>{Pc&&await wc.impact({style:fc.Heavy})},hapticSuccess:async()=>{Pc&&await wc.notification({type:_c.Success})},hapticError:async()=>{Pc&&await wc.notification({type:_c.Error})},hapticWarning:async()=>{Pc&&await wc.notification({type:_c.Warning})},getDeviceInfo:async()=>Pc?await Cc.getInfo():null,getDeviceId:async()=>{if(!Pc)return null;const{identifier:e}=await Cc.getId();return e},secureSet:async(e,t)=>{await Ac.set({key:e,value:t})},secureGet:async e=>{const{value:t}=await Ac.get({key:e});return t},secureRemove:async e=>{await Ac.remove({key:e})}}}();return ae(async()=>{p&&await h()}),le(()=>{}),(e,t)=>{const n=Me("router-view");return Ae(),_e(ce,null,[a.value?(Ae(),_e("div",Bc,[ye("div",qc,[t[1]||(t[1]=Fe('<div class="flex items-center gap-2"><div class="w-8 h-8 rounded-full border border-[#00f6ff]/30 bg-[#00f6ff]/10 flex items-center justify-center"><span class="text-[#00f6ff] text-[14px] font-bold">E</span></div><span class="text-white font-bold text-[15px] tracking-tight">Eagle AI Labs</span></div><div><p class="text-[10px] font-bold uppercase tracking-[0.2em] text-[#00f6ff]/60 mb-2">CLAW v2</p><h1 class="text-[22px] font-bold text-white mb-2">Launching Today â 17:00 UK</h1><p class="text-[13px] text-white/40 leading-relaxed"> CLAW v2 goes live today, 18th May 2026 at 17:00 UK time.<br> Hang tight â the countdown is live. </p></div>',2)),ye("div",jc,[(Ae(!0),_e(ce,null,Te([{val:l.value.d,label:1===l.value.d?"Day":"Days"},{val:l.value.h,label:1===l.value.h?"Hour":"Hours"},{val:l.value.m,label:1===l.value.m?"Min":"Mins"},{val:l.value.s,label:1===l.value.s?"Sec":"Secs"}],e=>(Ae(),_e("div",{key:e.label,class:"flex flex-col items-center gap-1"},[ye("div",Wc,[ye("span",{class:Se(["text-[22px] font-bold tabular-nums",e.label.startsWith("Sec")?"text-[#00f6ff]":"text-white"])}
2,xe(e.val.toString().padStart(2,"0")),3)]),ye("span",Hc,xe(e.label),1)]))),128))]),ye("div",Vc,[t[0]||(t[0]=ye("p",{class:"text-[10px] text-white/30 uppercase tracking-wider mb-1"},"Signed in as",-1)),ye("p",zc,xe(Q(Fc)()||"Unknown"),1)]),ye("button",{onClick:c,class:"w-full py-2.5 rounded-lg border border-white/10 text-[12px] font-semibold text-white/50 hover:text-white/80 hover:bg-white/[0.04] transition-all uppercase tracking-wide"}," Sign out & use a different account "),t[2]||(t[2]=ye("p",{class:"text-[10px] text-white/20"}," Questions? Contact [email protected] ",-1))])])):we("",!0),oe(Rl,{ref_key:"welcomeModalRef",ref:u},null,512),a.value?we("",!0):(Ae(),Ie(za,{key:1})),a.value?we("",!0):(Ae(),Ie(Gl,{key:2})),a.value?we("",!0):(Ae(),Ie(n,{key:3},{default:Oe(({Component:e,route:n})=>[(Ae(),Ie(Be,null,{default:Oe(()=>{var t;return[ye("div",Gc,[(Ae(),Ie(qe(e),{key:(null==(t=n.matched[0])?void 0:t.path)||n.fullPath}))])]}),fallback:Oe(()=>t[3]||(t[3]=[ye("div",{class:"min-h-[50vh] flex items-center justify-center"},[ye("span",{class:"h-8 aspect-square border-2 border-r-transparent border-gray-400 rounded-full animate-spin"})],-1)])),_:2},1024))]),_:1}))],64)}}}),Kc=je({history:We("/"),routes:[{path:"/",redirect:()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768?"/mobile/app":"/claw/pretrade"},{path:"/home",name:"Home",component:()=>dt(()=>import("./CXN_3OtP.js"),__vite__mapDeps([20,21,22,23,2,9,24,25,8,26,27,28,29,30,31,32,7,33,34,35,36,37,38,1]))},{path:"/present",name:"Present",component:()=>dt(()=>import("./CWlyhySx.js"),__vite__mapDeps([39,2,7,1,8,9,40]))},{path:"/currencies/:currency",name:"Currencies",component:()=>dt(()=>import("./CfYS30Vs.js"),__vite__mapDeps([41,2,42,43,23,9,24,25,8,26,27,28,29,30,44,45,46,47,48,49,34,33,7,50,22,31,32,35,1,51]))},{path:"/claw",name:"Claw",component:()=>dt(()=>import("./C9GU9yEq.js"),__vite__mapDeps([52,2,8,22,23,9,24,25,26,27,28,29,30,31,32,7,33,34,35,53,1]))},{path:"/claw/pretrade",name:"PreTrade",component:()=>dt(()=>import("./BPMS6bQG.js"),__vite__mapDeps([54,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,68,24,50,69,26,27,70,25,71,72,73,74,32,33,34,28,31,75,76,77,78,79,23,29,30,80,81,53,82]))},{path:"/claw/trade",name:"Trade",component:()=>dt(()=>import("./qcbTwwbQ.js"),__vite__mapDeps([83,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,32,33,34,28,31,71,72,84,76,77,78,23,29,30,79,80,81,85,86,53,87]))},{path:"/claw/posttrade",name:"PostTrade",component:()=>dt(()=>import("./DNiDb_NN.js"),__vite__mapDeps([88,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,71,72,84,78,28,32,33,34,76,77,23,29,30,53,89]))},{path:"/claw/copytrade",name:"Copy",component:()=>dt(()=>import("./D6SZqLp9.js"),__vite__mapDeps([90,91,2,9,78,8,92,28,93,1,94,95,96,48,97,81,98,46,47,7,99,100,63,56,24,73,74,50,69,26,27,70,25,36,38,37,61,66,84,65,32,33,34,64,35,76,77,23,29,30,101]))},{path:"/claw/social",name:"Social",component:()=>dt(()=>import("./BNz9vWqK.js"),__vite__mapDeps([102,2,55,9,56,8,57,103,7,1,104,81,62,63,78,24,50,73,74,69,26,27,70,25,28,35,76,36,37,65,77,23,29,30,105]))},{path:"/mirror",redirect:"/mirror/pretrade"},{path:"/mirror/pretrade",name:"MirrorPretrade",component:()=>dt(()=>import("./BPMS6bQG.js"),__vite__mapDeps([54,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,68,24,50,69,26,27,70,25,71,72,73,74,32,33,34,28,31,75,76,77,78,79,23,29,30,80,81,53,82])),meta:{mirrorFollower:!0}},{path:"/mirror/trade",name:"MirrorTrade",component:()=>dt(()=>import("./qcbTwwbQ.js"),__vite__mapDeps([83,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,32,33,34,28,31,71,72,84,76,77,78,23,29,30,79,80,81,85,86,53,87])),meta:{mirrorFollower:!0}},{path:"/mirror/posttrade",name:"MirrorPosttrade",component:()=>dt(()=>import("./DNiDb_NN.js"),__vite__mapDeps([88,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,71,72,84,78,28,32,33,34,76,77,23,29,30,53,89])),meta:{mirrorFollower:!0}},{path:"/mirror/copytrade",name:"MirrorCopytrade",component:()=>dt(()=>import("./D6SZqLp9.js"),__vite__mapDeps([90,91,2,9,78,8,92,28,93,1,94,95,96,48,97,81,98,46,47,7,99,100,63,56,24,73,74,50,69,26,27,70,25,36,38,37,61,
266,84,65,32,33,34,64,35,76,77,23,29,30,101])),meta:{mirrorFollower:!0}},{path:"/claw/learn",alias:"/learn",name:"Learn",component:()=>dt(()=>import("./BzeB-qPB.js"),__vite__mapDeps([106,2,68,24,50,69,26,27,70,25,8,56,36,38,61,66,71,72,9,73,1,74,32,7,33,34,28,31,35,75,62,63,53,107]))},{path:"/tradealerts",name:"TradeAlerts",component:()=>dt(()=>import("./BKoDskQV.js"),__vite__mapDeps([108,23,2,9,24,25,8,26,27,28,29,30,49,34,33,7,45,42,22,31,32,35,1]))},{path:"/traderewards",name:"TradeRewards",component:()=>dt(()=>import("./B1ro2j9I.js"),__vite__mapDeps([109,22,23,2,9,24,25,8,26,27,28,29,30,31,32,7,33,34,35,110,111,44,42,45,46,47,1])),children:[{path:"stake",name:"StakeTab",component:()=>dt(()=>import("./D2FCpCWT.js"),__vite__mapDeps([112,113,2,9,26,27,28,111,29,7,33,114,32,115,1,8]))},{path:"withdraw",name:"WithdrawTab",component:()=>dt(()=>import("./xdKAjfXS.js"),__vite__mapDeps([116,117,2,9,33,34,111,29,28,7,115,1,8]))},{path:"rewards",name:"RewardsTab",component:()=>dt(()=>import("./DyKFFc-8.js"),__vite__mapDeps([118,119,9,2,33,111,29,28,7,32,8,115,21,1]))}]},{path:"/account",name:"Account",component:()=>dt(()=>import("./BTDeGexP.js"),__vite__mapDeps([120,2,9,26,27,24,8,114,35,22,23,25,28,29,30,31,32,7,33,34,80,63,81,1,121])),redirect:{name:"DetailsTab"},children:[{path:"details",name:"DetailsTab",component:()=>dt(()=>import("./BWMCf18O.js"),__vite__mapDeps([122,2,9,123,8,7,1]))},{path:"tradepersona",name:"TradePersonaTab",component:()=>dt(()=>import("./DUebDi6X.js"),__vite__mapDeps([124,2,43,123,7,1,8,9]))},{path:"credits",name:"CreditsTab",component:()=>dt(()=>import("./BjRGCTWB.js"),__vite__mapDeps([125,9,2,126,127,8,7,1,128]))},{path:"subscriptions",alias:"subscription",name:"SubscriptionTab",component:()=>dt(()=>import("./mMf60xOV.js"),__vite__mapDeps([129,2,9,126,127,8,7,1,130]))},{path:"verification",name:"VerificationTab",component:()=>dt(()=>import("./BfJnw-pn.js"),__vite__mapDeps([131,9,2,35,63,81,7,1,8]))},{path:"customization",name:"CustomizationTab",component:()=>dt(()=>import("./AxFR1lLt.js"),__vite__mapDeps([132,9,2,70,25,8,56,7,1]))},{path:"trade",name:"TradeAccountTab",component:()=>dt(()=>import("./C5kG8ccB.js"),__vite__mapDeps([133,9,2,78,8,81,97,35,72,7,1]))},{path:"wallets",name:"WalletsTab",component:()=>dt(()=>import("./TaQbV1Hu.js"),__vite__mapDeps([134,9,2,8,7,1]))},{path:"staking",name:"StakingTab",component:()=>dt(()=>import("./D9bscKhZ.js"),__vite__mapDeps([135,9,2,110,111,29,28,7,33,32,8,113,26,27,114,115,117,34,119,21,1,136]))},{path:"traderewards",redirect:{name:"StakingTab"}},{path:"affiliate",name:"AffiliateTab",component:()=>dt(()=>import("./o34hWSnY.js"),__vite__mapDeps([137,8,9,2,86,1,7,138]))},{path:"copytrade",name:"CopyTradeTab",component:()=>dt(()=>import("./BlhlMdra.js"),__vite__mapDeps([139,2,123,9,8,35,7,1]))},{path:"notifications",name:"NotificationsTab",component:()=>dt(()=>import("./F6kwbrFM.js"),__vite__mapDeps([140,2,9,141,7,1,8]))},{path:"admin",name:"AdminTab",component:()=>dt(()=>import("./CIPWNpOv.js"),__vite__mapDeps([142,2,9,8,143,7,1]))},{path:"operator",name:"OperatorTab",component:()=>dt(()=>import("./DQWYzlet.js"),__vite__mapDeps([144,2,9,8,48,7,1]))}]},{path:"/billing/success",name:"BillingSuccess",component:()=>dt(()=>import("./BOKr08t9.js"),__vite__mapDeps([145,2,9,126,7,1,8,146]))},{path:"/admin",redirect:"/account/admin"},{path:"/login",redirect:"/auth/login"},{path:"/auth",name:"auth",component:()=>dt(()=>import("./D86-qGjt.js"),__vite__mapDeps([147,2,7,1,8,9,148])),children:[{path:"signup",name:"signup",component:()=>dt(()=>import("./BjbGcmyB.js"),__vite__mapDeps([149,2,123,8,7,1,9,150]))},{path:"login",name:"login",component:()=>dt(()=>import("./B7X20XLn.js"),__vite__mapDeps([151,123,2,9,8,1,7,152]))},{path:"verify",name:"verify",component:()=>dt(()=>import("./DWI8jDBV.js"),__vite__mapDeps([153,2,8,123,154,7,1,9,155]))},{path:"forgot-password",name:"forgot-password",component:()=>dt(()=>import("./CJY-ZI4I.js"),__vite__mapDeps([156,9,2,123,154,8,7,1,157]))}]},{path:"/mobile",redirect:"/mobile/app"},{path:"/mobile/login",name:"MobileLogin",component:()=>dt(()=>import("./C6i5R1My.js"),__vite__mapDeps([158,2,8,7,1,9,159]))},{path:"/mobile/app",name:"MobileApp",component:()=>dt(()=>
2import("./C9tnWdE_.js"),__vite__mapDeps([160,2,1,85,21,9,28,8,86,161,60,7,36,37,38,65,32,33,34,73,74,61,72,162,91,78,92,93,94,95,96,48,97,81,98,46,47,99,100,56,163,164,165,166,167,35,168,169,45,170,171,172,173,174,175]))},{path:"/mobile/chart",name:"MobileChart",component:()=>dt(()=>import("./CdpMkf8y.js"),__vite__mapDeps([176,2,36,161,7,1,8,9,177]))}]});Kc.beforeEach(async e=>{if(e.path.startsWith("/account/admin")||"/admin"===e.path||e.path.startsWith("/account/operator"))try{const e=localStorage.getItem("token");if(!e)return{path:"/auth/login"};if(!(JSON.parse(atob(e.split(".")[1])).email||"").toLowerCase().endsWith("@eagleailabs.com"))return{path:"/account/your-details"}}catch{return{path:"/account/your-details"}}const t=ms("token"),{payload:n}=ma(t);return!!n.value||!!(e.path.startsWith("/auth")||"Home"===e.name||e.path.startsWith("/claw")||e.path.startsWith("/mobile"))||{name:"login"}}),Kc.onError((e,t)=>{(e.message.includes("Failed to fetch dynamically imported module")||e.message.includes("Importing a module script failed")||e.message.includes("error loading dynamically imported module"))&&(console.error("[Router] Chunk load error detected:",e.message),sessionStorage.setItem("claw_reload_target",t.fullPath),window.location.href=t.fullPath)}),Kc.afterEach(()=>{dt(async()=>{const{useSkinStore:e}=await import("./C5MY0BRS.js").then(e=>e.s);return{useSkinStore:e}},__vite__mapDeps([56,8,2])).then(({useSkinStore:e})=>{const t=e();setTimeout(()=>{t.applySkinClass(),"custom"===t.activeSkinId&&t.applyCustomColors()},100)})});let Jc=!1;Kc.afterEach(e=>{!Jc&&e.path.startsWith("/claw")&&(Jc=!0,(()=>{const e=()=>{dt(()=>import("./BPMS6bQG.js"),__vite__mapDeps([54,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,68,24,50,69,26,27,70,25,71,72,73,74,32,33,34,28,31,75,76,77,78,79,23,29,30,80,81,53,82])),dt(()=>import("./qcbTwwbQ.js"),__vite__mapDeps([83,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,32,33,34,28,31,71,72,84,76,77,78,23,29,30,79,80,81,85,86,53,87])),dt(()=>import("./DNiDb_NN.js"),__vite__mapDeps([88,8,55,2,9,56,57,58,7,1,59,60,61,62,63,35,64,36,65,37,38,43,21,66,67,50,24,73,74,26,27,69,70,25,71,72,84,78,28,32,33,34,76,77,23,29,30,53,89])),dt(()=>import("./D6SZqLp9.js"),__vite__mapDeps([90,91,2,9,78,8,92,28,93,1,94,95,96,48,97,81,98,46,47,7,99,100,63,56,24,73,74,50,69,26,27,70,25,36,38,37,61,66,84,65,32,33,34,64,35,76,77,23,29,30,101])),dt(()=>import("./BNz9vWqK.js"),__vite__mapDeps([102,2,55,9,56,8,57,103,7,1,104,81,62,63,78,24,50,73,74,69,26,27,70,25,28,35,76,36,37,65,77,23,29,30,105])),dt(()=>import("./BzeB-qPB.js"),__vite__mapDeps([106,2,68,24,50,69,26,27,70,25,8,56,36,38,61,66,71,72,9,73,1,74,32,7,33,34,28,31,35,75,62,63,53,107]))};"requestIdleCallback"in window?window.requestIdleCallback(e,{timeout:3e3}):setTimeout(e,2e3)})())});var Qc="undefined"!=typeof window?window:void 0,Xc="undefined"!=typeof globalThis?globalThis:Qc;"undefined"==typeof self&&(Xc.self=Xc),"undefined"==typeof File&&(Xc.File=function(){});var Zc=null==Xc?void 0:Xc.navigator,eu=null==Xc?void 0:Xc.document,tu=null==Xc?void 0:Xc.location,nu=null==Xc?void 0:Xc.fetch,iu=null!=Xc&&Xc.XMLHttpRequest&&"withCredentials"in new Xc.XMLHttpRequest?Xc.XMLHttpRequest:void 0,su=null==Xc?void 0:Xc.AbortController,ru=null==Xc?void 0:Xc.CompressionStream,ou=null==Zc?void 0:Zc.userAgent,au=null!=Qc?Qc:{},lu="1.376.2",cu={DEBUG:!1,LIB_VERSION:lu,LIB_NAME:"web",JS_SDK_VERSION:lu};function uu(e,t,n,i,s,r,o){try{var a=e[r](o),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(i,s)}function du(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var r=e.apply(t,n);function o(e){uu(r,i,s,o,a,"next",e)}function a(e){uu(r,i,s,o,a,"throw",e)}o(void 0)})}}function hu(){return hu=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},hu.apply(null,arguments)}function pu(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}var vu,gu,fu=((gu={}).GZipJS="gzip-js",gu.Base64="base64",gu),mu=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],_u="NativeGzipValidationError",yu=e=>e.length>=2&&31===e[0]&&139===e[1],wu=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),bu=e=>
2{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=_u,t},Su=function(){var e=du(function*(e,t){18>e.size&&bu("too-short");var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());yu(n)&&8===n[2]||bu("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(vu)return vu;vu=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;vu[e]=t>>>0}return vu})(),n=4294967295,i=0;e.length>i;i++)n=t[255&(n^e[i])]^n>>>8;return(4294967295^n)>>>0})(t)&&bu("invalid-crc");var s=t.length>>>0;i.getUint32(4,!0)!==s&&bu("invalid-size")});return function(t,n){return e.apply(this,arguments)}}();function Eu(){return Eu=du(function*(e,t,n){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),s=new CompressionStream("gzip"),r=s.writable.getWriter(),o=r.write(i).then(()=>r.close()).catch((c=du(function*(e){try{yield r.abort(e)}catch(t){}throw e}),function(e){return c.apply(this,arguments)})),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield Su(l,i),l}catch(c){if(null!=n&&n.rethrow)throw c;return t&&console.error("Failed to gzip compress data",c),null}var c}),Eu.apply(this,arguments)}var Tu=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],xu=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Tu.concat(t).some(e=>{var t=e.toLowerCase();return-1!==n.indexOf(t)})};function Cu(e,t){return-1!==e.indexOf(t)}var Au=function(e){return e.trim()},Pu=function(e){return e.replace(/^\$/,"")},ku=Object.prototype,Lu=ku.hasOwnProperty,Iu=ku.toString,Du=Array.isArray||function(e){return"[object Array]"===Iu.call(e)},Ou=e=>"function"==typeof e,Nu=e=>e===Object(e)&&!Du(e),Mu=e=>{if(Nu(e)){for(var t in e)if(Lu.call(e,t))return!1;return!0}return!1},$u=e=>void 0===e,Ru=e=>"[object String]"==Iu.call(e),Fu=e=>Ru(e)&&0===e.trim().length,Uu=e=>null===e,Bu=e=>$u(e)||Uu(e),qu=e=>"[object Number]"==Iu.call(e)&&e==e,ju=e=>qu(e)&&e>0,Wu=e=>"[object Boolean]"===Iu.call(e),Hu=e=>Cu(mu,e);function Vu(e){return null===e||"object"!=typeof e}function zu(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Gu(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(n){return!1}}(e,Event)}var Yu=[!0,"true",1,"1","yes"],Ku=e=>Cu(Yu,e),Ju=[!1,"false",0,"0","no"];function Qu(e,t,n,i,s){return t>n&&(i.warn("min cannot be greater than max."),t=n),qu(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),Qu(s||n,t,n,i))}class Xu{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Qu(e.bucketSize,0,100,e.Gt),this.Qt=Qu(e.refillRate,0,this.Zt,e.Gt),this.Jt=Qu(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var n=Math.floor((t-e.lastAccess)/this.Jt);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qt,this.Zt),e.lastAccess=e.lastAccess+n*this.Jt)}consumeRateLimit(e){var t,n=Date.now(),i=String(e),s=this.$t[i];return s?this.Kt(s,n):this.$t[i]=s={tokens:this.Zt,lastAccess:n},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.zt)||t.call(this,e)),0===s.tokens)}
2stop(){this.$t={}}}var Zu,ed,td,nd="Mobile",id="iOS",sd="Android",rd="Tablet",od=sd+" "+rd,ad="iPad",ld="Apple",cd=ld+" Watch",ud="Safari",dd="BlackBerry",hd="Samsung",pd=hd+"Browser",vd=hd+" Internet",gd="Chrome",fd=gd+" OS",md=gd+" "+id,_d="Internet Explorer",yd=_d+" "+nd,wd="Opera",bd=wd+" Mini",Sd="Edge",Ed="Microsoft "+Sd,Td="Firefox",xd=Td+" "+id,Cd="Nintendo",Ad="PlayStation",Pd="Xbox",kd=sd+" "+nd,Ld=nd+" "+ud,Id="Windows",Dd=Id+" Phone",Od="Nokia",Nd="Ouya",Md="Generic",$d=Md+" "+nd.toLowerCase(),Rd=Md+" "+rd.toLowerCase(),Fd="Konqueror",Ud="Oculus Browser",Bd="(\\d+(\\.\\d+)?)",qd=new RegExp("Version/"+Bd),jd=new RegExp(Pd,"i"),Wd=new RegExp(Ad+" \\w+","i"),Hd=new RegExp(Cd+" \\w+","i"),Vd=new RegExp(dd+"|PlayBook|BB10","i"),zd={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Gd=function(e,t){return t=t||"",Cu(e," OPR/")&&Cu(e,"Mini")?bd:Cu(e," OPR/")?wd:Vd.test(e)?dd:Cu(e,"IE"+nd)||Cu(e,"WPDesktop")?yd:Cu(e,"OculusBrowser")?Ud:Cu(e,pd)?vd:Cu(e,Sd)||Cu(e,"Edg/")?Ed:Cu(e,"FBIOS")?"Facebook "+nd:Cu(e,"UCWEB")||Cu(e,"UCBrowser")?"UC Browser":Cu(e,"CriOS")?md:Cu(e,"CrMo")||Cu(e,gd)?gd:Cu(e,sd)&&Cu(e,ud)?kd:Cu(e,"FxiOS")?xd:Cu(e.toLowerCase(),Fd.toLowerCase())?Fd:(n=e,(i=t)&&Cu(i,ld)||Cu(s=n,ud)&&!Cu(s,gd)&&!Cu(s,sd)?Cu(e,nd)?Ld:ud:Cu(e,Td)?Td:Cu(e,"MSIE")||Cu(e,"Trident/")?_d:Cu(e,"Gecko")?Td:"");var n,i,s},Yd={[yd]:[new RegExp("rv:"+Bd)],[Ed]:[new RegExp(Sd+"?\\/"+Bd)],[gd]:[new RegExp("("+gd+"|CrMo)\\/"+Bd)],[md]:[new RegExp("CriOS\\/"+Bd)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Bd)],[ud]:[qd],[Ld]:[qd],[wd]:[new RegExp("(Opera|OPR)\\/"+Bd)],[Td]:[new RegExp(Td+"\\/"+Bd)],[xd]:[new RegExp("FxiOS\\/"+Bd)],[Fd]:[new RegExp("Konqueror[:/]?"+Bd,"i")],[dd]:[new RegExp(dd+" "+Bd),qd],[kd]:[new RegExp("android\\s"+Bd,"i")],[vd]:[new RegExp(pd+"\\/"+Bd)],[Ud]:[new RegExp("OculusBrowser\\/"+Bd)],[_d]:[new RegExp("(rv:|MSIE )"+Bd)],Mozilla:[new RegExp("rv:"+Bd)]},Kd=function(e,t){var n=Gd(e,t),i=Yd[n];if($u(i))return null;for(var s=0;i.length>s;s++){var r=e.match(i[s]);if(r)return parseFloat(r[r.length-2])}return null},Jd=[[new RegExp(Pd+"; "+Pd+" (.*?)[);]","i"),e=>[Pd,e&&e[1]||""]],[new RegExp(Cd,"i"),[Cd,""]],[new RegExp(Ad,"i"),[Ad,""]],[Vd,[dd,""]],[new RegExp(Id,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Dd,""];if(new RegExp(nd).test(t)&&!/IEMobile\b/.test(t))return[Id+" "+nd,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=zd[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Id,i]}return[Id,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[id,[e[3],e[4],e[5]||"0"].join(".")]:[id,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=$u(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+sd+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+sd+")","i"),e=>e&&e[2]?[sd,[e[2],e[3],e[4]||"0"].join(".")]:[sd,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[fd,""]],[/Linux|debian/i,["Linux",""]]],Qd=function(e){return Hd.test(e)?Cd:Wd.test(e)?Ad:jd.test(e)?Pd:new RegExp(Nd,"i").test(e)?Nd:new RegExp("("+Dd+"|WPDesktop)","i").test(e)?Dd:/iPad/.test(e)?ad:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?cd:Vd.test(e)?dd:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Od,"i").test(e)?Od:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(nd).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?sd:od:new RegExp("(pda|"+nd+")","i").test(e)?$d:new RegExp(rd,"i").test(e)&&!new RegExp(rd+" pc","i").test(e)?Rd:""},Xd=e=>e instanceof Error,Zd={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},eh=Zd.info;function th(e){if(Wu(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Du(e))return{arrayValue:{values:e.map(e=>th(e))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function nh(e){var t=[];for(var n in e){var i=e[n];Uu(i)||$u(i)||t.push({key:n,value:th(i)})}return t}function ih(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return td&&n.length===ed||(ed=n.length,td=n.reduce((n,i)=>{Zu||(Zu={});var s=Zu[i];if(s)n[s[0]]=s[1];else for(var r=e(i),o=r.length-1;o>=0;o--){var a=r[o],l=null==a?void 0:a.filename,c=t[i];
vendor: 5,052 bytes, line 2
2if(l&&c){n[l]=c,Zu[i]=[l,c];break}}return n},{})),td}}class sh{constructor(e,t,n){void 0===n&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){void 0===t&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),s=this.buildParsingContext(t),r=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(r,n),$exception_level:"error"}}modifyFrames(e){var t=this;return du(function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&Du(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n,i;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),hu({},e,{cause:n,stack:i})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return du(function*(){var n=e;for(var i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){var n,i,s,r={type:e.type,value:e.value,mechanism:{type:null!==(n=t.type)&&void 0!==n?n:"generic",handled:null===(i=t.handled)||void 0===i||i,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});var o=[r];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,hu({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:ih(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,n){void 0===n&&(n=0);var i=(n,i)=>{if(4>=i){var s=this.buildCoercingContext(e,t,i);return this.applyCoercers(n,s)}};return hu({},t,{syntheticException:0==n?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,n),next:e=>i(e,n+1)})}}var rh="?";function oh(e,t,n,i,s){var r={platform:e,filename:t,function:"<anonymous>"===n?rh:n,in_app:!0};return $u(i)||(r.lineno=i),$u(s)||(r.colno=s),r}var ah=(e,t)=>{var n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:rh,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},lh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ch=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uh=/\((\S*)(?::(\d+))(?::(\d+))\)/,dh=(e,t)=>{var n=lh.exec(e);if(n){var[,i,s,r]=n;return oh(t,i,rh,+s,+r)}var o=ch.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=uh.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=ah(o[1]||rh,o[2]);return oh(t,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},hh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ph=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vh=(e,t)=>{var n=hh.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=ph.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var s=n[3],r=n[1]||rh;return[r,s]=ah(r,s),oh(t,s,r,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},gh=/\(error: (.*)\)/;class fh{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Ru(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return zu(e,"DOMException")}isDOMError(e){return zu(e,"DOMError")}}class mh{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}}class _h{constructor(){}match(e){return zu(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var n;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}var yh=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class wh{match(e){return"string"==typeof e}coerce(e,t){var n,[i,s]=this.getInfos(e);return{type:null!=i?i:"Error",value:null!=s?s:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}getInfos(e){var t="Error",n=e,i=e.match(yh);return i&&(t=i[1],n=i[2]),[t,n]}}var bh=["fatal","error","warning","log","info","debug"];function Sh(e,t){void 0===t&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var s=n.slice(0,i).join(", ");
2if(t>=s.length)return i===n.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class Eh{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(n=t.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Gu(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+Sh(e)}isSeverityLevel(e){return Ru(e)&&!Fu(e)&&bh.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(Xd(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(n){return}}}class Th{match(e){return Gu(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Sh(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}class xh{match(e){return Vu(e)}coerce(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}class Ch{match(e){return zu(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Gu(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(n){return!1}}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Vu(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}}var Ah="$message",Ph="$timestamp",kh=new Set([Ah,Ph]),Lh={enabled:!0,max_bytes:32768};function Ih(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Lh.enabled,max_bytes:Oh(e.max_bytes,Lh.max_bytes)}:hu({},Lh)}class Dh{constructor(e){this.Yt=[],this.Xt=0,this.qt=Ih(e)}setConfig(e){this.qt=Ih(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,(e,n)=>{if("bigint"==typeof n)return n.toString();if("function"!=typeof n&&"symbol"!=typeof n){if(n instanceof Date)return n.toISOString();if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&"object"==typeof n){if(t.has(n))return"[Circular]";t.add(n)}return n}})}catch(n){return}}(e);if(t)try{var n=JSON.parse(t);if(!Nu(n))return;var i=n,s=i[Ah],r=i[Ph];if(!Ru(s)||0===s.trim().length)return;if(!Ru(r)&&!qu(r))return;return{step:i,json:t}}catch(o){return}}(e);if(t){var n=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),n=0,i=0;t.length>i;i++)"%"===t[i]?(n+=1,i+=2):n+=1;return n}(t.json);n>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:n}),this.Xt+=n,this.er())}}getAttachable(){return this.Yt.map(e=>e.step)}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}function Oh(e,t){if(!qu(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Nh=function(e,t){var{debugEnabled:n}=void 0===t?{}:t,i={k(t){if(Qc&&(cu.DEBUG||au.POSTHOG_DEBUG||n)&&!$u(Qc.console)&&Qc.console){for(var i=("__rrweb_original__"in Qc.console[t]?Qc.console[t].__rrweb_original__:Qc.console[t]),s=arguments.length,r=new Array(s>1?s-1:0),o=1;s>o;o++)r[o-1]=arguments[o];i(e,...r)}},debug(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k("error",...t)},critical(){for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];console.error(e,...n)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,n)=>Nh(e+" "+t,n)};return i},Mh=Nh("[PostHog.js]"),$h=Mh.createLogger,Rh=$h("[ExternalScriptsLoader]"),Fh=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Rh.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==eu?void 0:eu.querySelectorAll("script");
2if(i)for(var s,r=function(){if(i[o].src===t){var e=i[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)}),e.onerror=e=>n(e),{v:void 0})}},o=0;i.length>o;o++)if(s=r())return s.v;var a=()=>{if(!eu)return n("document not found");var i=eu.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=e=>{i.__posthog_loading_callback_fired=!0,n(void 0,e)},i.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)eu.head.appendChild(i);else{var s,r=eu.querySelectorAll("body > script");r.length>0?null==(s=r[0].parentNode)||s.insertBefore(i,r[0]):eu.body.appendChild(i)}};null!=eu&&eu.body?a():null==eu||eu.addEventListener("DOMContentLoaded",a)};au.__PosthogExtensions__=au.__PosthogExtensions__||{},au.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if("remote-config"!==t){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var s="/static/"+t+".js?v="+e.version;if("toolbar"===t){var r=3e5;s=s+"&t="+Math.floor(Date.now()/r)*r}i=e.requestRouter.endpointFor("assets",s)}Fh(e,i,n)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Fh(e,o,n)}},au.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);Fh(e,i,n)};var Uh="$people_distinct_id",Bh="$device_id",qh="__alias",jh="__timers",Wh="$autocapture_disabled_server_side",Hh="$heatmaps_enabled_server_side",Vh="$exception_capture_enabled_server_side",zh="$error_tracking_suppression_rules",Gh="$error_tracking_capture_extension_exceptions",Yh="$web_vitals_enabled_server_side",Kh="$dead_clicks_enabled_server_side",Jh="$product_tours_enabled_server_side",Qh="$web_vitals_allowed_metrics",Xh="$session_recording_remote_config",Zh="$replay_override_sampling",ep="$replay_override_linked_flag",tp="$replay_override_url_trigger",np="$replay_override_event_trigger",ip="$sesid",sp="$session_is_sampled",rp="$enabled_feature_flags",op="$active_feature_flags",ap="$early_access_features",lp="$feature_flag_details",cp="$feature_flag_payloads",up="$feature_flag_request_id",dp="$override_feature_flags",hp="$override_feature_flag_payloads",pp="$stored_person_properties",vp="$stored_group_properties",gp="$surveys",fp="$surveys_activated",mp="ph_product_tours",_p="$flag_call_reported",yp="$flag_call_reported_session_id",wp="$feature_flag_errors",bp="$feature_flag_evaluated_at",Sp="$user_state",Ep="$client_session_props",Tp="$capture_rate_limit",xp="$initial_campaign_params",Cp="$initial_referrer_info",Ap="$initial_person_info",Pp="$epp",kp="__POSTHOG_TOOLBAR__",Lp="$posthog_cookieless",Ip="$sdk_debug_extensions_init_method",Dp="$sdk_debug_extensions_init_time_ms",Op="$sdk_debug_recording_script_not_loaded",Np="PostHog loadExternalDependency extension not found.",Mp="on_reject",$p="always",Rp="anonymous",Fp="identified",Up="identified_only",Bp="visibilitychange",qp="beforeunload",jp="$pageview",Wp="$pageleave",Hp="$identify",Vp="$groupidentify";function zp(e,t){Du(e)&&e.forEach(t)}function Gp(e,t){if(!Bu(e))if(Du(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(var n in e)Lu.call(e,n)&&t(e[n],n)}var Yp=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var s of n)for(var r in s)void 0!==s[r]&&(e[r]=s[r]);return e};function Kp(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var Jp=function(e){try{return e()}catch(t){return}},Qp=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(s){Mh.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Mh.critical(s)}}},Xp=function(e){var t={};return Gp(e,function(e,n){(Ru(e)&&e.length>0||qu(e))&&(t[n]=e)}),t},Zp=["herokuapp.com","vercel.app","netlify.app"];function ev(e){var t=null==e?void 0:e.hostname;if(!Ru(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of Zp)if(n===i)return!1;return!0}function tv(e,t,n,i){var{capture:s=!1,passive:r=!0}=null!=i?i:{};null==e||e.addEventListener(t,n,{capture:s,passive:r})}function nv(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return qu(e)&&isFinite(e)&&Math.floor(e)===e});class iv{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||0>e||0>t||0>n||0>i||e>0xffffffffffff||t>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new iv(s)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new iv(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}class sv{constructor(){this.S=0,this.C=0,this.I=new av}generate(){var e=this.generateOrAbort();if($u(e)){this.S=0;var t=this.generateOrAbort();if($u(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return iv.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var rv,ov=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Qc&&!$u(Qc.crypto)&&crypto.getRandomValues&&(ov=e=>crypto.getRandomValues(e));class av{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(ov(this.M),this.O=0),this.M[this.O++]}}var lv=()=>cv().toString(),cv=()=>(rv||(rv=new sv)).generate(),uv="",dv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,hv={R:()=>!!eu,D(e){Mh.error("cookieStore error: "+e)},A(e){if(eu){try{for(var t=e+"=",n=eu.cookie.split(";").filter(e=>e.length),i=0;n.length>i;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(r){}return null}},F(e){var t;try{t=JSON.parse(hv.A(e))||{}}catch(n){}return t},N(e,t,n,i,s){if(eu)try{var r="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=eu),uv)return uv;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),s="dmn_chk_"+lv();!uv&&i--;){var r=n.slice(i).join("."),o=s+"=1;domain=."+r+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",uv=r)}return uv}(e);if(!n){var i=(s=e.match(dv))?s[0]:"";i!==n&&Mh.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}var s;return""}(eu.location.hostname,i);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),r="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&Mh.warn("cookieStore warning: large cookie, len="+c.length),eu.cookie=c,c}catch(u){return}},q(e,t){if(null!=eu&&eu.cookie)try{hv.N(e,"",-1,t)}catch(n){return}}},pv=null,vv={R(){if(!Uu(pv))return pv;var e=!0;if($u(Qc))e=!1;
2else try{var t="__mplssupport__";vv.N(t,"xyz"),'"xyz"'!==vv.A(t)&&(e=!1),vv.q(t)}catch(gu){e=!1}return e||Mh.error("localStorage unsupported; falling back to cookie store"),pv=e,e},D(e){Mh.error("localStorage error: "+e)},A(e){try{return null==Qc?void 0:Qc.localStorage.getItem(e)}catch(gu){vv.D(gu)}return null},F(e){try{return JSON.parse(vv.A(e))||{}}catch(t){}return null},N(e,t){try{null==Qc||Qc.localStorage.setItem(e,JSON.stringify(t))}catch(gu){vv.D(gu)}},q(e){try{null==Qc||Qc.localStorage.removeItem(e)}catch(gu){vv.D(gu)}}},gv=[Bh,"distinct_id",ip,sp,Pp,Ap,Sp],fv={},mv={R:()=>!0,D(e){Mh.error("memoryStorage error: "+e)},A:e=>fv[e]||null,F:e=>fv[e]||null,N(e,t){fv[e]=t},q(e){delete fv[e]}},_v=null,yv={R(){if(!Uu(_v))return _v;if(_v=!0,$u(Qc))_v=!1;else try{var e="__support__";yv.N(e,"xyz"),'"xyz"'!==yv.A(e)&&(_v=!1),yv.q(e)}catch(gu){_v=!1}return _v},D(e){Mh.error("sessionStorage error: ",e)},A(e){try{return null==Qc?void 0:Qc.sessionStorage.getItem(e)}catch(gu){yv.D(gu)}return null},F(e){try{return JSON.parse(yv.A(e))||null}catch(t){}return null},N(e,t){try{null==Qc||Qc.sessionStorage.setItem(e,JSON.stringify(t))}catch(gu){yv.D(gu)}},q(e){try{null==Qc||Qc.sessionStorage.removeItem(e)}catch(gu){yv.D(gu)}}};class wv{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===$p||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===Mp}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return Ku(e)?1:Cu(Ju,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?vv:hv;if(!this.ar||this.ar!==t){this.ar=t;var n="localStorage"===e?hv:vv;n.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Ku(n.A(this.sr))),n.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[null==Zc?void 0:Zc.doNotTrack,null==Zc?void 0:Zc.msDoNotTrack,au.doNotTrack].some(e=>Ku(e))}}var bv=$h("[Dead Clicks]"),Sv=()=>!0,Ev=e=>{var t,n=!(null==(t=e.instance.persistence)||!t.get_property(Kh)),i=e.instance.config.capture_dead_clicks;return Wu(i)?i:!!Nu(i)||n};class Tv{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Kh]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.hr()}):this.stop()}lr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?bv.error("failed to load script",t):e()})}hr(){var e;if(eu){if(!this.ur&&null!=(e=au.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Nu(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=au.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(eu),bv.info("starting...")}}else bv.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,bv.info("stopping..."))}}var xv=$h("[SegmentIntegration]"),Cv="posthog-js";function Av(e,t){var{organization:n,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,c,u,d;if("*"!==r&&!r.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>hu({},e,{stacktrace:e.stacktrace?hu({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>hu({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(c=v[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=v[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:t.tags};return n&&i&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Pv{constructor(e,t,n,i,s,r){this.name=Cv,this.setupOnce=function(o){o(Av(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}}
2class kv{constructor(e){this.cr=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(Mh.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:n}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}destroy(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}doPageView(e,t){var n,i=this.gr(e,t);return this.dr={pathname:null!==(n=null==Qc?void 0:Qc.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}gr(e,t){var n=this.dr;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:r,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!($u(r)||$u(o)||$u(a)||$u(l)||$u(c)||$u(u))){r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var d=r>1?Qu(o/r,0,1,Mh):1,h=r>1?Qu(a/r,0,1,Mh):1,p=l>1?Qu(c/l,0,1,Mh):1,v=l>1?Qu(u/l,0,1,Mh):1;i=Yp(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:v})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}var Lv={[Uh]:{exposure:"hidden"},[qh]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[jh]:{exposure:"hidden"},[Wh]:{exposure:"event"},[Hh]:{exposure:"hidden"},[Vh]:{exposure:"event"},[zh]:{exposure:"hidden"},[Gh]:{exposure:"event"},[Yh]:{exposure:"event"},[Kh]:{exposure:"event"},[Jh]:{exposure:"hidden"},[Qh]:{exposure:"event"},[Xh]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ip]:{exposure:"hidden"},[sp]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[rp]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Nu(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[op]:{exposure:"event"},[ap]:{exposure:"hidden"},[lp]:{exposure:"hidden"}
2,[cp]:{exposure:"event"},[up]:{exposure:"event"},[dp]:{exposure:"event"},[hp]:{exposure:"hidden"},[pp]:{exposure:"hidden"},[vp]:{exposure:"hidden"},[gp]:{exposure:"hidden"},[fp]:{exposure:"event"},[mp]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[_p]:{exposure:"hidden"},[yp]:{exposure:"hidden"},[wp]:{exposure:"hidden"},[bp]:{exposure:"hidden"},[Sp]:{exposure:"hidden"},[Ep]:{exposure:"hidden"},[Tp]:{exposure:"hidden"},[xp]:{exposure:"hidden"},[Cp]:{exposure:"hidden"},[Ap]:{exposure:"hidden"},[Pp]:{exposure:"hidden"},[Zh]:{exposure:"event"},[ep]:{exposure:"event"},[tp]:{exposure:"event"},[np]:{exposure:"event"},[Ip]:{exposure:"event"},[Dp]:{exposure:"event"},[Op]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Iv=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Dv=e=>{var t=null==eu?void 0:eu.createElement("a");return $u(t)?null:(t.href=e,t)},Ov=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var r=i[s].split("=");if(r[0]===t){n=r;break}}if(!Du(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(a){Mh.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Nv=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],r=(i[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var d=l[u].split("=");Du(d)&&(t.includes(d[0])?c.push(d[0]+"="+n):c.push(l[u]))}var h=a;return null!=o&&(h+="?"+c.join("&")),null!=s&&(h+="#"+s),h},Mv=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},$v="https?://(.*)",Rv=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Fv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Rv],Uv="<masked>",Bv=["li_fat_id"];function qv(e,t,n){if(!eu)return{};var i,s=t?[...Rv,...n||[]]:[],r=jv(Nv(eu.URL,s,Uv),e),o=(i={},Gp(Bv,function(e){var t=hv.A(e);i[e]=t||null}),i);return Yp(o,r)}function jv(e,t){var n=Fv.concat(t||[]),i={};return Gp(n,function(t){var n=Ov(e,t);i[t]=n||null}),i}function Wv(e){var t,n=(t=e)?0===t.search($v+"google.([^/?]*)")?"google":0===t.search($v+"bing.com")?"bing":0===t.search($v+"yahoo.com")?"yahoo":0===t.search($v+"duckduckgo.com")?"duckduckgo":null:null,i="yahoo"!=n?"q":"p",s={};if(!Uu(n)){s.$search_engine=n;var r=eu?Ov(eu.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Hv(){return navigator.language||navigator.userLanguage}var Vv="$direct";function zv(){return(null==eu?void 0:eu.referrer)||Vv}function Gv(e,t){var n=e?[...Rv,...t||[]]:[],i=null==tu?void 0:tu.href.substring(0,1e3);return{r:zv().substring(0,1e3),u:i?Nv(i,n,Uv):void 0}}function Yv(e){var t,{r:n,u:i}=e,s={$referrer:n,$referring_domain:null==n?void 0:n==Vv?Vv:null==(t=Dv(n))?void 0:t.host};if(i){s.$current_url=i;var r=Dv(i);s.$host=null==r?void 0:r.host,s.$pathname=null==r?void 0:r.pathname;var o=jv(i);Yp(s,o)}if(n){var a=Wv(n);Yp(s,a)}return s}function Kv(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(gu){return}}function Jv(){try{return(new Date).getTimezoneOffset()}catch(gu){return}}var Qv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Xv{constructor(e,t){var n,i;this.qt=e,this.props={},this.mr=!1,this.yr=(i="",(n=e).token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"),this.nr=this.br(e),this.load(),e.debug&&Mh.info("Persistence loaded",e.persistence,hu({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){-1===Qv.indexOf(e.persistence.toLowerCase())&&(Mh.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...gv,...e];return hu({},vv,{F(e){try{var t={};try{t=hv.F(e)||{}}catch(i){}var n=Yp(t,JSON.parse(vv.A(e)||"{}"));return vv.N(e,n),n}catch(i){}return null},N(e,n,i,s,r,o){try{vv.N(e,n,void 0,void 0,o);var a={};
2t.forEach(e=>{n[e]&&(a[e]=n[e])}),Object.keys(a).length&&hv.N(e,a,i,s,r,o)}catch(l){vv.D(l)}},q(e,t){try{null==Qc||Qc.localStorage.removeItem(e),hv.q(e,t)}catch(gu){vv.D(gu)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&vv.R()?vv:"localstorage+cookie"===n&&t.R()?t:"sessionstorage"===n&&yv.R()?yv:"memory"===n?mv:"cookie"===n?hv:t.R()?t:hv}wr(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[bp];return!n||"number"!=typeof n||Date.now()-n>t}properties(){var e={};return Gp(this.props,(t,n)=>{var i=(e=>{var t=Lv[e];if(t)return t;for(var[n,i]of Iv)if(0===e.indexOf(n))return i})(n);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,n===rp?()=>this.wr():()=>!1))return;i.transformToEventProperties&&Yp(e,i.transformToEventProperties(t))}else i&&"event"!==i.exposure||(e[n]=t)}),e}load(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=Yp({},e))}}save(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}remove(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Nu(e)){$u(t)&&(t="None"),this.Sr=$u(n)?this.Ir:n;var i=!1;if(Gp(e,(e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Tr(n,e),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Nu(e)){this.Sr=$u(t)?this.Ir:t;var n=!1;if(Gp(e,(t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this.Tr(i,t),n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Er(e),this.save())}update_campaign_params(){if(!this.mr){var e=qv(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);Mu(Xp(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=null==eu?void 0:eu.referrer)?Wv(e):{})}update_referrer_info(){var e;this.register_once({$referrer:zv(),$referring_domain:null!=eu&&eu.referrer&&(null==(e=Dv(eu.referrer))?void 0:e.host)||Vv},void 0)}set_initial_person_info(){this.props[xp]||this.props[Cp]||this.register_once({[Ap]:Gv(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Gp([Cp,xp],t=>{var n=this.props[t];n&&Gp(n,function(t,n){e["$initial_"+Pu(n)]=t})});var t,n,i=this.props[Ap];if(i){var s=(t=Yv(i),n={},Gp(t,function(e,t){n["$initial_"+Pu(t)]=e}),n);Yp(e,s)}return e}safe_merge(e){return Gp(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){if(this.Ir=this.Sr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),i=[...t].sort();return n.every((e,t)=>e===i[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.br(e),s=this.props;this.clear(),this.nr=i,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[jh]||{};n[e]=t,this.Tr(jh,n),this.save()}remove_event_timer(e){var t=this.props[jh]||{},n=t[e];return $u(n)||(delete t[e],this.Tr(jh,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Er(e){delete this.props[e]}}var Zv="events",eg="cancelEvents",tg="survey shown",ng="survey sent",ig="$survey_last_seen_date",sg="popover",rg=$h("[RateLimiter]");class og{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{rg.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(n){return void rg.warn('could not rate limit - continuing. Error: "'+(null==n?void 0:n.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,i;void 0===e&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null==(n=this.instance.persistence)?void 0:n.get_property(Tp))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(Tp,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var ag=$h("[RemoteConfig]");class lg{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=au._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Mr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Pr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return ag.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void ag.warn("Remote config is disabled. Falling back to local config.");this.Mr(e=>{if(!e)return ag.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pr(e=>{this.Rr(e),this.Or()});this.Rr(e),this.Or()})}catch(gu){ag.error("Error loading remote config",gu)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}
vendor: 4,746 bytes, line 2
2refresh(){!this._instance.Lr()&&eu&&"hidden"!==eu.visibilityState&&this._instance.reloadFeatureFlags()}Or(){var e;if(!this.Fr){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.Fr=setInterval(()=>{this.refresh()},t))}}Rr(e){var t;e||ag.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var cg="gzip-js",ug="base64",dg=Uint8Array,hg=Uint16Array,pg=Uint32Array,vg=new dg([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gg=new dg([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),fg=new dg([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mg=function(e,t){for(var n=new hg(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var s=new pg(n[30]);for(i=1;30>i;++i)for(var r=n[i];n[i+1]>r;++r)s[r]=r-n[i]<<5|i;return[n,s]},_g=mg(vg,2),yg=_g[1];_g[0][28]=258,yg[258]=28;for(var wg=mg(gg,0)[1],bg=new hg(32768),Sg=0;32768>Sg;++Sg){var Eg=(43690&Sg)>>>1|(21845&Sg)<<1;bg[Sg]=((65280&(Eg=(61680&(Eg=(52428&Eg)>>>2|(13107&Eg)<<2))>>>4|(3855&Eg)<<4))>>>8|(255&Eg)<<8)>>>1}var Tg=function(e,t,n){for(var i=e.length,s=0,r=new hg(t);i>s;++s)++r[e[s]-1];var o,a=new hg(t);for(s=0;t>s;++s)a[s]=a[s-1]+r[s-1]<<1;for(o=new hg(i),s=0;i>s;++s)o[s]=bg[a[e[s]-1]++]>>>15-e[s];return o},xg=new dg(288);for(Sg=0;144>Sg;++Sg)xg[Sg]=8;for(Sg=144;256>Sg;++Sg)xg[Sg]=9;for(Sg=256;280>Sg;++Sg)xg[Sg]=7;for(Sg=280;288>Sg;++Sg)xg[Sg]=8;var Cg=new dg(32);for(Sg=0;32>Sg;++Sg)Cg[Sg]=5;var Ag=Tg(xg,9),Pg=Tg(Cg,5),kg=function(e){return(e/8|0)+(7&e&&1)},Lg=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof hg?hg:e instanceof pg?pg:dg)(n-t);return i.set(e.subarray(t,n)),i},Ig=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Dg=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Og=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var s=n.length,r=n.slice();if(!s)return[new dg(0),0];if(1==s){var o=new dg(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=n[n[d].f>n[c].f?c++:d++],l=n[c!=u&&n[d].f>n[c].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(i=1;s>i;++i)r[i].s>h&&(h=r[i].s);var p=new hg(h+1),v=Ng(n[u-1],p,0);if(v>t){i=0;var g=0,f=v-t,m=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>i;++i){var _=r[i].s;if(t>=p[_])break;g+=m-(1<<v-p[_]),p[_]=t}for(g>>>=f;g>0;){var y=r[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var w=r[i].s;p[w]==t&&(--p[w],++g)}v=t}return[new dg(p),v]},Ng=function(e,t,n){return-1==e.s?Math.max(Ng(e.l,t,n+1),Ng(e.r,t,n+1)):t[e.s]=n},Mg=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new hg(++t),i=0,s=e[0],r=1,o=function(e){n[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++r;else{if(!s&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=e[a]}return[n.subarray(0,i),t]},$g=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},Rg=function(e,t,n){var i=n.length,s=kg(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var r=0;i>r;++r)e[s+r+4]=n[r];return 8*(s+4+i)},Fg=function(e,t,n,i,s,r,o,a,l,c,u){Ig(t,u++,n),++s[256];for(var d=Og(s,15),h=d[0],p=d[1],v=Og(r,15),g=v[0],f=v[1],m=Mg(h),_=m[0],y=m[1],w=Mg(g),b=w[0],S=w[1],E=new hg(19),T=0;_.length>T;++T)E[31&_[T]]++;for(T=0;b.length>T;++T)E[31&b[T]]++;for(var x=Og(E,7),C=x[0],A=x[1],P=19;P>4&&!C[fg[P-1]];--P);var k,L,I,D,O=c+5<<3,N=$g(s,xg)+$g(r,Cg)+o,M=$g(s,h)+$g(r,g)+o+14+3*P+$g(E,C)+(2*E[16]+3*E[17]+7*E[18]);if(N>=O&&M>=O)return Rg(t,u,e.subarray(l,l+c));if(Ig(t,u,1+(N>M)),u+=2,N>M){k=Tg(h,p),L=h,I=Tg(g,f),D=g;var $=Tg(C,A);for(Ig(t,u,y-257),Ig(t,u+5,S-1),Ig(t,u+10,P-4),u+=14,T=0;P>T;++T)Ig(t,u+3*T,C[fg[T]]);u+=3*P;for(var R=[_,b],F=0;2>F;++F){var U=R[F];for(T=0;U.length>T;++T)Ig(t,u,$[B=31&U[T]]),u+=C[B],B>15&&(Ig(t,u,U[T]>>>5&127),u+=U[T]>>>12)}}else k=Ag,L=xg,I=Pg,D=Cg;for(T=0;a>T;++T)if(i[T]>255){var B;Dg(t,u,k[257+(B=i[T]>>>18&31)]),u+=L[B+257],B>7&&(Ig(t,u,i[T]>>>23&31),u+=vg[B]);var q=31&i[T];Dg(t,u,I[q]),u+=D[q],q>3&&(Dg(t,u,i[T]>>>5&8191),u+=gg[q])}else Dg(t,u,k[i[T]]),u+=L[i[T]];return Dg(t,u,k[256]),u+L[256]},Ug=new pg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bg=function(){for(var e=new pg(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),qg=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},jg=!!iu||!!nu,Wg="text/plain",Hg=!1,Vg=(e,t)=>
2{var[n,i]=e.split("#"),[s,r]=n.split("?");if(!r)return e;var o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return s+(o?"?"+o:"")+(i?"#"+i:"")},zg=function(e,t,n){var i;void 0===n&&(n=!0);var[s,r]=e.split("?"),o=hu({},t),a=null!==(i=null==r?void 0:r.split("&").map(e=>{var t,[i,s]=e.split("="),r=n&&null!==(t=o[i])&&void 0!==t?t:s;return delete o[i],i+"="+r}))&&void 0!==i?i:[],l=function(e,t){var n,i;void 0===t&&(t="&");var s=[];return Gp(e,function(e,t){$u(e)||$u(t)||"undefined"===t||(n=encodeURIComponent(e instanceof File?e.name:e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Gg=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Yg=e=>{if(e.tr)return e.tr;var t,{data:n,compression:i}=e;if(n){if(i===cg){var s=function(e,t){void 0===t&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,i=0;t.length>i;++i)n=Bg[255&n^t[i]]^n>>>8;e=n},d:()=>4294967295^e}}(),i=e.length;n.p(e);var s,r,o,a,l=(a=10+((s=t).filename&&s.filename.length+1||0),function(e,t,n,i){var s=e.length,r=new dg(i+s+5*(1+Math.floor(s/7e3))+8),o=r.subarray(i,r.length-8),a=0;if(!t||8>s)for(var l=0;s>=l;l+=65535){var c=l+65535;s>c?a=Rg(o,a,e.subarray(l,c)):(o[l]=!0,a=Rg(o,a,e.subarray(l,s)))}else{for(var u=Ug[t-1],d=u>>>13,h=8191&u,p=(1<<n)-1,v=new hg(32768),g=new hg(p+1),f=Math.ceil(n/3),m=2*f,_=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<m)&p},y=new pg(25e3),w=new hg(288),b=new hg(32),S=0,E=0,T=(l=0,0),x=0,C=0;s>l;++l){var A=_(l),P=32767&l,k=g[A];if(v[P]=k,g[A]=P,l>=x){var L=s-l;if((S>7e3||T>24576)&&L>423){a=Fg(e,o,0,y,w,b,E,T,C,l-C,a),T=S=E=0,C=l;for(var I=0;286>I;++I)w[I]=0;for(I=0;30>I;++I)b[I]=0}var D=2,O=0,N=h,M=P-k&32767;if(L>2&&A==_(l-M))for(var $=Math.min(d,L)-1,R=Math.min(32767,l),F=Math.min(258,L);R>=M&&--N&&P!=k;){if(e[l+D]==e[l+D-M]){for(var U=0;F>U&&e[l+U]==e[l+U-M];++U);if(U>D){if(D=U,O=M,U>$)break;var B=Math.min(M,U-2),q=0;for(I=0;B>I;++I){var j=l-M+I+32768&32767,W=j-v[j]+32768&32767;W>q&&(q=W,k=j)}}}M+=(P=k)-(k=v[P])+32768&32767}if(O){y[T++]=268435456|yg[D]<<18|wg[O];var H=31&yg[D],V=31&wg[O];E+=vg[H]+gg[V],++w[257+H],++b[V],x=l+D,++S}else y[T++]=e[l],++w[e[l]]}}a=Fg(e,o,!0,y,w,b,E,T,C,l-C,a)}return Lg(r,0,i+kg(a)+8)}(r=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,a)),c=l.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&qg(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;n.length>=i;++i)e[i+10]=n.charCodeAt(i)}}(l,t),qg(l,c-8,n.d()),qg(l,c-4,i),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new dg(e.length+(e.length>>>1)),i=0,s=function(e){n[i++]=e},r=0;t>r;++r){if(i+5>n.length){var o=new dg(i+8+(t-r<<1));o.set(n),n=o}var a=e.charCodeAt(r);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++r))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return Lg(n,0,i)}(Gg(n)),{mtime:0});return{contentType:Wg,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===ug){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:Gg(e)))((t=Gg(n))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):t);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var o=Gg(n);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Kg=e=>{var t,n,i,s=Yg(e);return!s||(n=e.compression,i=Ov(e.url,"compression"),n!==fu.GZipJS&&i!==fu.GZipJS&&"gzip"!==i)||((t=s.body)instanceof ArrayBuffer?yu(new Uint8Array(t)):ArrayBuffer.isView(t)&&yu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:s}:(Hg=!0,{url:Vg(e.url,"compression"),encodedBody:Yg(hu({},e,{compression:void 0,tr:void 0}))})},Jg=function(){var e=du(function*(e){var t=Gg(e.data),n=yield function(e,t,n){return Eu.apply(this,arguments)}(t,cu.DEBUG,{rethrow:!0});if(!n)return e;var i=yield n.arrayBuffer();return hu({},e,{tr:{contentType:Wg,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Qg=(e,t)=>
2zg(e,{_:(new Date).getTime().toString(),ver:cu.JS_SDK_VERSION,compression:t}),Xg=[];nu&&Xg.push({transport:"fetch",method(e){var t,{url:n,encodedBody:i}=Kg(e),{contentType:s,body:r,estimatedSize:o}=null!=i?i:{},a=new Headers;Gp(e.headers,function(e,t){a.append(t,e)}),s&&a.append("Content-Type",s);var l=null;if(su){var c=new su;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}nu(n,hu({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:r,signal:null==(t=l)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(n=>{var i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(s){Mh.error(s)}null==e.callback||e.callback(i)})).catch(t=>{Mh.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),iu&&Xg.push({transport:"XHR",method(e){var t=new iu,{url:n,encodedBody:i}=Kg(e);t.open(e.method||"GET",n,!0);var{contentType:s,body:r}=null!=i?i:{};Gp(e.headers,function(e,n){t.setRequestHeader(n,e)}),s&&t.setRequestHeader("Content-Type",s),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(4===t.readyState){var n={statusCode:t.status,text:t.responseText};if(200===t.status)try{n.json=JSON.parse(t.responseText)}catch(i){}null==e.callback||e.callback(n)}},t.send(r)}}),null!=Zc&&Zc.sendBeacon&&Xg.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=Kg(e),i=zg(t,{beacon:"1"}),{contentType:s,body:r}=null!=n?n:{};if(!r)return;var o=r instanceof Blob?r:new Blob([r],{type:s});Zc.sendBeacon(i,o)}catch(a){}}});var Zg=3e3;class ef{constructor(e,t){this.Ar=!0,this.Nr=[],this.$r=Qu((null==t?void 0:t.flush_interval_ms)||Zg,250,5e3,Mh.createLogger("flush interval"),Zg),this.Dr=e}enqueue(e){this.Nr.push(e),this.qr||this.jr()}unload(){this.Hr();var e=this.Nr.length>0?this.Ur():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Dr(hu({},e,{transport:"sendBeacon"}))})}enable(){this.Ar=!1,this.jr()}jr(){var e=this;this.Ar||(this.qr=setTimeout(()=>{if(this.Hr(),this.Nr.length>0){var t=this.Ur(),n=function(){var n=t[i],s=(new Date).getTime();n.data&&Du(n.data)&&Gp(n.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.Dr(n)};for(var i in t)n()}},this.$r))}Hr(){clearTimeout(this.qr),this.qr=void 0}Ur(){var e={};return Gp(this.Nr,t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;$u(e[s])&&(e[s]=hu({},i,{data:[]})),null==(n=e[s].data)||n.push(i.data)}),this.Nr=[],e}}var tf=["retriesPerformedSoFar"];class nf{constructor(e){this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=e,this.Nr=[],this.Vr=!0,!$u(Qc)&&"onLine"in Qc.navigator&&(this.Vr=Qc.navigator.onLine,this.Wr=()=>{this.Vr=!0,this.Zr()},this.Gr=()=>{this.Vr=!1},tv(Qc,"online",this.Wr),tv(Qc,"offline",this.Gr))}get length(){return this.Nr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=pu(e,tf);ju(t)&&(n.url=zg(n.url,{retry_count:t})),this._instance._send_request(hu({},n,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==n.callback||n.callback(e):this.Qr(hu({retriesPerformedSoFar:t},n))}}))}Qr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n,i,s,r,o,a=(n=t,s=(i=3e3*Math.pow(2,n))/2,r=Math.min(18e5,i),o=Math.random()-.5,Math.ceil(r+o*(r-s))),l=Date.now()+a;this.Nr.push({retryAt:l,requestOptions:e});var c="Enqueued failed request for retry in "+a;navigator.onLine||(c+=" (Browser is offline)"),Mh.warn(c),this.Br||(this.Br=!0,this.Jr())}Jr(){if(this.Kr&&clearTimeout(this.Kr),0===this.Nr.length)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout(()=>{this.Vr&&this.Nr.length>0&&this.Zr(),this.Jr()},this.zr)}Zr(){var e=Date.now(),t=[],n=this.Nr.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.Nr=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,$u(Qc)||(this.Wr&&(Qc.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&(Qc.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr))try{this._instance._send_request(hu({},e,{transport:"sendBeacon"}))}catch(gu){Mh.error(gu)}this.Nr=[]}}class sf{constructor(e){this.Yr=()=>{var e,t,n,i;this.Xr||(this.Xr={});var s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=r+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Xr.lastScrollY=Math.ceil(r),this.Xr.maxScrollY=Math.max(r,null!==(e=this.Xr.maxScrollY)&&void 0!==e?e:0),this.Xr.maxScrollHeight=Math.max(o,null!==(t=this.Xr.maxScrollHeight)&&void 0!==t?t:0),this.Xr.lastContentY=a,this.Xr.maxContentY=Math.max(a,null!==(n=this.Xr.maxContentY)&&void 0!==n?n:0),this.Xr.maxContentHeight=Math.max(l,null!==(i=this.Xr.maxContentHeight)&&void 0!==i?i:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Xr}resetContext(){var e=this.Xr;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){tv(Qc,"scroll",this.Yr,{capture:!0}),tv(Qc,"scrollend",this.Yr,{capture:!0}),tv(Qc,"resize",this.Yr)}scrollElement(){if(!this.ei)return null==Qc?void 0:Qc.document.documentElement;var e=Du(this.ei)?this.ei:[this.ei];for(var t of e){var n=null==Qc?void 0:Qc.document.querySelector(t);if(n)return n}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return Qc&&(Qc.scrollY||Qc.pageYOffset||Qc.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return Qc&&(Qc.scrollX||Qc.pageXOffset||Qc.document.documentElement.scrollLeft)||0}}var rf=e=>Gv(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class of{constructor(e,t,n,i){this.ti=e=>{var t=this.ri();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.ii(this._instance)};this.ni.register({[Ep]:n})}},this._instance=e,this.si=t,this.ni=n,this.ii=i||rf,this.si.onSessionId(this.ti)}ri(){return this.ni.props[Ep]}getSetOnceProps(){var e,t=null==(e=this.ri())?void 0:e.props;return t?"r"in t?Yv(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Gp(Xp(this.getSetOnceProps()),(t,n)=>{"$current_url"===n&&(n="url"),e["$session_entry_"+Pu(n)]=t}),e}}class af{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter(e=>e!==t)}}emit(e,t){for(var n of this.oi[e]||[])n(t);for(var i of this.oi["*"]||[])i(e,t)}}var lf=$h("[SessionId]");class cf{on(e,t){return this.ai.on(e,t)}constructor(e,t,n){var i;if(this.ui=[],this.li=void 0,this.ai=new af,this.hi=(e,t)=>!(!ju(e)||!ju(t))&&Math.abs(e-t)>
2this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===$p)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||lv,this.fi=n||lv;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Qu(this.qt.session_idle_timeout_seconds||1800,60,36e3,lf.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var r=yv.F(this.gi),o=yv.F(this.mi);r&&!o?this.ci=r:yv.q(this.gi),yv.N(this.mi,!0)}if(null!=(i=this.qt.bootstrap)&&i.sessionID)try{var a=(()=>{var e=this.qt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.bi(this.qt.bootstrap.sessionID,(new Date).getTime(),a)}catch(l){lf.error("Invalid sessionID in bootstrap",l)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return $u(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),()=>{this.ui=this.ui.filter(t=>t!==e)}}yi(){return"memory"!==this.qt.persistence&&!this.ni._r&&yv.R()}xi(e){e!==this.ci&&(this.ci=e,this.yi()&&yv.N(this.gi,e))}Si(){return this.ci?this.ci:this.yi()?yv.F(this.gi):null}bi(e,t,n){e===this.di&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[ip]:[t,e,n]}))}ki(){var e=this.ni.props[ip];return Du(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&Qc&&(Qc.removeEventListener(qp,this.li,{capture:!1}),this.li=void 0),this.ui=[]}wi(){this.li=()=>{this.yi()&&yv.q(this.mi)},tv(Qc,qp,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===$p)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),[i,s,r]=this.ki(),o=this.Si(),a=ju(r)&&Math.abs(n-r)>864e5,l=!1,c=!s,u=!c&&!e&&this.hi(n,i);c||u||a?(s=this.vi(),o=this.fi(),lf.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),r=n,l=!0):o||(o=this.fi(),l=!0);var d=ju(i)&&e&&!a?i:n,h=ju(r)?r:(new Date).getTime();return this.xi(o),this.bi(s,d,h),e||this.pi(),l&&this.ui.forEach(e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:h,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:i}}pi(){clearTimeout(this.Ci),this.Ci=setTimeout(()=>{var[e]=this.ki();if(this.hi((new Date).getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var uf=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&xu(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(e=>xu(null==e?void 0:e.brand,t)))return!0}catch(s){}return!!e.webdriver},df=function(e,t){if(!function(e){try{new RegExp(e)}catch(t){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(n){return!1}};function hf(e,t,n){return Gg({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var pf={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>df(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!df(t,e))),icontains:(e,t)=>t.map(vf).some(t=>e.map(vf).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(vf).every(t=>e.map(vf).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})},vf=e=>e.toLowerCase();function gf(e,t){return!e||Object.entries(e).every(e=>{var[n,i]=e,s=null==t?void 0:t[n];if($u(s)||Uu(s))return!1;
2var r=[String(s)],o=pf[i.operator];return!!o&&o(i.values,r)})}var ff="custom",mf="i.posthog.com",_f=/^\/static\//;class yf{constructor(e){this.Ii={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+mf,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ii[this.apiHost]||(this.Ii[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ff),this.Ii[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&_f.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var n=this.Ti(t);if(n)return""+n+t}if(this.region===ff)return this.apiHost+t;var i=mf+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var wf=$h("[Surveys]"),bf="seenSurvey_",Sf=["popover","widget","api"],Ef={ignoreConditions:!1,ignoreDelay:!1,displayType:sg},Tf=$h("[PostHog ExternalIntegrations]"),xf={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cf{constructor(e){this._instance=e}lr(e,t){var n;null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,e=>{if(e)return Tf.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var n,s,r;!i||null!=(n=au.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.lr(xf[t],()=>{var n;null==(n=au.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!i&&null!=(s=au.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(r=au.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[t])||r.stop())};for(var[n,i]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(n)}}}var Af,Pf={},kf=0,Lf=()=>{},If='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Df="Surveys module not available",Of="sanitize_properties is deprecated. Use before_send instead",Nf="Invalid value for property_denylist config: ",Mf="posthog",$f=!jg&&-1===(null==ou?void 0:ou.indexOf("MSIE"))&&-1===(null==ou?void 0:ou.indexOf("Mozilla")),Rf=e=>{var t;return hu({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ev(null==eu?void 0:eu.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Lf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:tu&&Ru(null==tu?void 0:tu.search)&&-1!==tu.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Qc||null==(t=Qc.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Mh.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Up,before_send:void 0,request_queue_config:{flush_interval_ms:Zg},error_tracking:{},_onCapture:Lf,__preview_eager_load_replay:!1},(e=>({rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},Ff=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Uf=e=>{var t={};
2for(var[n,i]of Ff)$u(e[n])||(t[i]=e[n]);var s=Yp({},t,e);return Du(e.property_blacklist)&&($u(e.property_denylist)?s.property_denylist=e.property_blacklist:Du(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:Mh.error(Nf+e.property_denylist)),s};class Bf{constructor(){this.__forceAllowLocalhost=!1}get Ei(){return this.__forceAllowLocalhost}set Ei(e){Mh.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class qf{Mi(e,t){if(e){var n=this.Pi.indexOf(e);-1!==n&&this.Pi.splice(n,1)}return this.Pi.push(t),null==t.initialize||t.initialize(),t}Ri(){return this.config.cookieless_mode===$p||this.config.cookieless_mode===Mp&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Bf,this.Oi=!1,this.version=cu.LIB_VERSION,this.Li=new af,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rf(),this.SentryIntegration=Pv,this.sentryIntegration=e=>{return t=Av(this,e),{name:Cv,processEvent:e=>t(e)};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new sf(this),this.pageViewManager=new kv(this),this.rateLimiter=new og(this),this.requestRouter=new yf(this),this.consent=new wv(this),this.externalIntegrations=new Cf(this);var t=null!==(e=qf.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{var i=Ru(e)?{[e]:t}:e;this.setPersonProperties(i),null==n||n({})},set_once:(e,t,n)=>{var i=Ru(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==n||n({})}},this.on("eventCaptured",e=>Mh.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==Mf){var i,s=null!==(i=Pf[n])&&void 0!==i?i:new qf;return s._init(e,t,n),Pf[n]=s,Pf[Mf][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i,s;if(void 0===t&&(t={}),$u(e)||Fu(e))return Mh.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Di(t.debug),this.qi=t,this.ji=[],t.person_profiles?this.Ni=t.person_profiles:t.process_person&&(this.Ni=t.process_person),this.set_config(Yp({},Rf(t.defaults),Uf(t),{name:n,token:e})),this.config.on_xhr_error&&Mh.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:cg;var r=this.Hi();this.persistence=new Xv(this.config,r),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xv(hu({},this.config,{persistence:"sessionStorage"}),r);var o=hu({},this.persistence.props),a=hu({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ui=new ef(e=>this.Bi(e),this.config.request_queue_config),this.zi=new nf(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new cf(this),this.sessionPropsManager=new of(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Mh.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(l)},0)):(Mh.info("Initializing extensions synchronously"),this.Vi(l)),cu.DEBUG=cu.DEBUG||this.config.debug,cu.DEBUG&&Mh.info("Starting in debug mode",{this:this,config:t,thisC:hu({},this.config),p:o,s:a}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=hu({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
2)),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var c=t.bootstrap.distinctID,u=this.get_distinct_id(),d=this.persistence.get_property(Sp);if(t.bootstrap.isIdentifiedID&&null!=u&&u!==c&&d===Rp)this.identify(c);else if(t.bootstrap.isIdentifiedID&&null!=u&&u!==c&&d===Fp)Mh.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var h=this.config.get_device_id(lv()),p=t.bootstrap.isIdentifiedID?h:c;this.persistence.set_property(Sp,t.bootstrap.isIdentifiedID?Fp:Rp),this.register({distinct_id:c,$device_id:p})}}if(l)this.register_once({distinct_id:Lp,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(lv());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(Sp,Rp)}return tv(Qc,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=n=>{var i=()=>n.anonymousId()||lv();e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(Sp,Fp)),t()},s=n.user();"then"in s&&Ou(s.then)?s.then(i):i(s)}(e,()=>{n.register((e=>{Promise&&Promise.resolve||xv.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(xv.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(xv.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,jp),identify:e=>t(e,Hp),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Wi()):this.Wi(),Ou(this.config._onCapture)&&this.config._onCapture!==Lf&&(Mh.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Mh.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Vi(e){var t,n,i,s,r,o,a,l=performance.now(),c=hu({},qf.__defaultExtensionClasses,this.config.__extensionClasses),u=[];c.featureFlags&&this.Pi.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this.Pi.push(this.exceptions=null!==(n=this.exceptions)&&void 0!==n?n:new c.exceptions(this)),c.historyAutocapture&&this.Pi.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Pi.push(new c.tracingHeaders(this)),c.siteApps&&this.Pi.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Pi.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||u.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Pi.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Pi.push(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new c.surveys(this)),c.logs&&this.Pi.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new c.logs(this)),c.conversations&&this.Pi.push(this.conversations=null!==(r=this.conversations)&&void 0!==r?r:new c.conversations(this)),c.productTours&&this.Pi.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Pi.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Pi.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Ev)),c.toolbar&&this.Pi.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new c.toolbar(this)),c.experiments&&this.Pi.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new c.experiments(this)),this.Pi.forEac
2h(e=>{e.initialize&&u.push(()=>{null==e.initialize||e.initialize()})}),u.push(()=>{if(this.Zi){var e=this.Zi;this.Zi=void 0,this.Rr(e)}}),this.Gi(u,l)}Gi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Gi(e,t)},0);var n=e.shift();if(n)try{n()}catch(s){Mh.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-t);this.register_for_session({[Ip]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dp]:i}),this.config.__preview_deferred_init_extensions&&Mh.info("PostHog extensions initialized ("+i+"ms)")}Rr(e){var t;if(!eu||!eu.body)return Mh.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Zi=e),this.Qi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Cu(e.supportedCompression,cg)?cg:Cu(e.supportedCompression,ug)?ug:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:Up}),this.Pi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Wi(){try{this.config.loaded(this)}catch(n){Mh.critical("`loaded` function failed",n)}if(this.Ji(),this.config.internal_or_test_user_hostname&&null!=tu&&tu.hostname){var e=tu.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ri())&&this.Ki()},1),this.Yi=new lg(this),this.Yi.load()}Ji(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ui)||e.enable())}_dom_loaded(){this.is_capturing()&&zp(this.__request_queue,e=>this.Bi(e)),this.__request_queue=[],this.Ji()}_handle_unload(){var e,t,n,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(Wp),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(n=this.Ui)||n.unload(),null==(i=this.zi)||i.unload()):this.Xi()&&this.capture(Wp,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&($f?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=zg(e.url,{ip:this.config.ip?1:0}),e.headers=hu({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,n,i,s=hu({},e);s.timeout=s.timeout||6e4,s.url=Qg(s.url,s.compression);var r=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Xg.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(n=null==(i=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===r)return e[t]}(o))?void 0:i.method)&&void 0!==n?n:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==r&&s.data&&s.compression===cg&&ru&&!Hg?Jg(s).then(e=>{a(e)}).catch(t=>{if(wu(t))return Hg=!0,void a(hu({},s,{compression:void 0,url:Qg(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return wu(e)||t===_u})(t)&&(Hg=!0),a(s)}):a(s)})(hu({},e,{callback:t=>{var n,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(n=(i=this.config).on_request_error)||n.call(i,t),null==e.callback||e.callback(t)}}))))}Bi(e){this.zi?this.zi.retriableRequest(e):this._send_request(e)}_execute_array(e){kf++;try{var t,n=[],i=[],s=[];zp(e,e=>{if(e)if(Du(t=e[0]))s.push(e);else if(Ou(e))try{e.call(this)}catch(r){Mh.error("Error executing queued PostHog call",e,r)}else Du(e)&&"alias"===t?n.push(e):Du(e)&&-1!==t.indexOf("capture")&&Ou(this[t])?s.push(e):i.push(e)});var r=function(e,t){zp(e,function(e){try{if(Du(e[0])){var n=t;Gp(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(i){Mh.error("Error executing queued PostHog call",e,i)}})};r(n,this),r(i,this),r(s,this)}finally{kf--}}push(e){if(kf>0&&Du(e)&&Ru(e[0])){var t=qf.prototype[e[0]];Ou(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,n){var i,s,r,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ui){if(this.is_capturing())if(!$u(e)&&Ru(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Ru(null==t?void 0:t.$current_url)&&(Mh.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=n&&n.en||Mh.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var u=new Date,d=(null==n?void 0:n.timestamp)||u,h=(null==n?void 0:n.uuid)||lv(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===jp&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&
2(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==n?void 0:n.$set)&&(p.$set=null==n?void 0:n.$set);var v,g,f,m=this.tn(null==n?void 0:n.$set_once,e!==Vp,e===Hp);if(m&&(p.$set_once=m),null!=n&&n._noTruncate||(s=this.config.properties_string_max_length,r=p,o=e=>Ru(e)?e.slice(0,s):e,a=new Set,p=function e(t,n){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),Du(t)?(i=[],zp(t,t=>{i.push(e(t))})):(i={},Gp(t,(t,n)=>{a.has(t)||(i[n]=e(t))})),i);var i}(r)),p.timestamp=d,$u(null==n?void 0:n.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=u),"survey dismissed"===e||e===ng){var _=null==t?void 0:t.$survey_id,y=null==t?void 0:t.$survey_iteration;(e=>{try{var t=(s=""+bf+(i=n=e).id,i.current_iteration&&i.current_iteration>0&&(s=""+bf+i.id+"_"+i.current_iteration),s);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){wf.error("Failed to persist survey seen state",n)}var n,i,s})({id:_,current_iteration:y}),p.$set=hu({},p.$set,{[(v={id:_,current_iteration:y},g=e===ng?"responded":"dismissed",f="$survey_"+g+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(f="$survey_"+g+"/"+v.id+"/"+v.current_iteration),f)]:!0})}else e===tg&&(p.$set=hu({},p.$set,{[ig]:(new Date).toISOString()}));if("product tour shown"===e){var w=null==t?void 0:t.$product_tour_type;w&&(p.$set=hu({},p.$set,{["$product_tour_last_seen_date/"+w]:(new Date).toISOString()}))}var b=hu({},p.properties.$set,p.$set);if(Mu(b)||this.setPersonPropertiesForFlags(b),!Bu(this.config.before_send)){var S=this.rn(p);if(!S)return;p=S}this.Li.emit("eventCaptured",p);var E={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==n?void 0:n._batchKey,transport:null==n?void 0:n.transport};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Bi(E):this.Ui.enqueue(E),p}Mh.critical("This capture call is ignored due to client rate limiting.")}}else Mh.error("No event name provided to posthog.capture")}else Mh.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var r=s?void 0:this.persistence.remove_event_timer(e),o=hu({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=hu({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!Ru(o.distinct_id)&&!qu(o.distinct_id)||Fu(o.distinct_id))&&Mh.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,c=function(e,t){var n,i,s,r;if(!ou)return{};var o,a,l,c,u,d,h,p,v=e?[...Rv,...t||[]]:[],[g,f]=function(e){for(var t=0;Jd.length>t;t++){var[n,i]=Jd[t],s=n.exec(e),r=s&&(Ou(i)?i(s,e):i);if(r)return r}return["",""]}(ou);return Yp(Xp({$os:g,$os_version:f,$browser:Gd(ou,navigator.vendor),$device:Qd(ou),$device_type:(a=ou,l={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(i=navigator)?void 0:i.maxTouchPoints,screenWidth:null==Qc||null==(s=Qc.screen)?void 0:s.width,screenHeight:null==Qc||null==(r=Qc.screen)?void 0:r.height,devicePixelRatio:null==Qc?void 0:Qc.devicePixelRatio},p=Qd(a),p===ad||p===od||"Kobo"===p||"Kindle Fire"===p||p===Rd?rd:p===Cd||p===Pd||p===Ad||p===Nd?"Console":p===cd?"Wearable":p?nd:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(c=null==l?void 0:l.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(u=null==l?void 0:l.screenWidth)&&void 0!==u?u:0,null!==(d=null==l?void 0:l.screenHeight)&&void 0!==d?d:0)/(null!==(h=null==l?void 0:l.devicePixelRatio)&&void 0!==h?h:1)?nd:rd:"Desktop"),$timezone:Kv(),$timezone_offset:Jv()}),{$current_url:Nv(null==tu?void 0:tu.href,v,Uv),$host:null==tu?void 0:tu.host,$pathname:null==tu?void 0:tu.pathname,$raw_user_agent:ou.length>1e3?ou.substring(0,997)+"...":ou,$browser_version:Kd(ou,navigator.vendor),$browser_language:Hv(),$browser_language_prefix:(o=Hv(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==Qc?void 0:Qc.screen.height,$screen_width:null==Qc?void 0:Qc.screen.width,$viewport_height:null==Qc?void 0:Qc.innerHeight,$viewport_width:null==Qc?void 0:Qc.innerWidth,$lib:cu.LIB_NAME,$lib_version:cu.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());o.$session_id=u,o.$window_id=d}this.sessionPropsManager&&Yp(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Yp(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(h=this.zi)?void 0:h.length}catch(gu){o.$sdk_debug_error_capturing_properties=String(gu)}if(this.requestRouter.region===ff&&(o.$lib_custom_api_host=this.config.api_host),l=e!==jp||s?e!==Wp||s?this.pageViewM
2anager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=Yp(o,l),e===jp&&eu&&(o.title=eu.title),!$u(r)){var p=n.getTime()-r;o.$duration=parseFloat((p/1e3).toFixed(3))}ou&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Yp({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),Du(this.config.property_denylist)?Gp(this.config.property_denylist,function(e){delete o[e]}):Mh.error(Nf+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Mh.error(Of),o=v(o,e));var g=this.nn();return o.$process_person_profile=g,g&&!s&&this.sn("_calculate_event_properties"),o}tn(e,t,n){var i;if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.nn())return e;if(this.Oi&&!n)return e;var s=this.persistence.get_initial_props(),r=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Yp({},s,r||{},e||{}),a=this.config.sanitize_properties;return a&&(Mh.error(Of),o=a(o,"$set_once")),t&&(this.Oi=!0),Mu(o)?void 0:o}register(e,t){var n;null==(n=this.persistence)||n.register(e,t)}register_once(e,t,n){var i;null==(i=this.persistence)||i.register_once(e,t,n)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}an(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var n;return null==(n=this.featureFlags)?void 0:n.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,n){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.Li.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Df}),()=>{})}onSessionId(e){var t,n;return null!==(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Df})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Df})}renderSurvey(e,t){var n;null==(n=this.surveys)||n.renderSurvey(e,t)}displaySurvey(e,t){var n;void 0===t&&(t=Ef),null==(n=this.surveys)||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,n;return null!==(t=null==(n=this.surveys)?void 0:n.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Df}}canRenderSurveyAsync(e,t){var n,i;return void 0===t&&(t=!1),null!==(n=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==n?n:Promise.resolve({visible:!1,disabledReason:Df})}un(e){return!e||Fu(e)?(Mh.critical("Unique user id has not been set in posthog.identify"),!1):e===Lp?(Mh.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Mh.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return Mh.uninitializedWarning("posthog.identify");if(qu(e)&&(e=e.toString(),Mh.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(e)&&this.sn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Bh)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(qh)&&(this.unregister(qh),this.register({distinct_id:e}));var s,r=(this.persistence.get_property(Sp)||Rp)===Rp;e!==i&&r?(this.persistence.set_property(Sp,Fp),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(Hp,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.$i=hf(e,t,n),null==(s=this.featureFlags)||s.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(_p))}}setPersonProperties(e,t){if((e||t)&&this.sn("posthog.setPersonProperties")){var n=hf(this.get_distinct_id(),e,t);this.$i!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.$i=n):Mh.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var i=this.getGroups(),s=i[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:hu({},i,{[e]:t})}),s||n){var r={$group_type:e,$group_key:t};n&&(r.$group_set=n),this.capture(Vp,r)}n&&this.setGroupPropertiesForFlags({[e]:n}),s&&!n&&this.reloadFeatureFlags()}else Mh.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var n;void 0===t&&(t=!0),null==(n=this.featureFlags)||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var n;void 0===t&&(t=!0),this.sn("posthog.setGroupPropertiesForFlags")&&(null==(n=this.featureFlags)||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,n,i,s,r,o,a,l;if(Mh.info("reset"),!this.__loaded)return Mh.uninitializedWarning("posthog.reset");var c,u=this.get_property(Bh),d=this.get_property(Xh);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),$u(d)||null==(c=this.persistence)||c.register({[Xh]:d}),null==(i=this.surveys)||i.reset(),null==(s=this.Yi)||s.stop(),null==(r=this.featureFlags)||r.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Sp,Rp),null==(l=this.sessionManager)||l.resetSessionId(),this.$i=null,this.config.cookieless_mode===$p)this.register_once({distinct_id:Lp,$device_id:null},"");else{var h=this.config.get_device_id(lv());this.register_once({distinct_id:h,$device_id:e?h:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(n=this.conversations)||n.ln()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&n){var s,r=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-n)/1e3)-r,0)}return i}alias(e,t){return e===this.get_property(Uh)?(Mh.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?($u(t)&&(t=this.get_distinct_id()),e!==t?(this.an(qh,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Mh.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=hu({},this.config);if(Nu(e)){var n,i,s,r,o,a,l,c,u,d;Yp(this.config,Uf(e));var h=this.Hi();null==(n=this.persistence)||n.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xv(hu({},this.config,{persistence:"sessionStorage"}),h);var p=this.Di(this.config.debug);Wu(p)&&(this.config.debug=p),Wu(this.config.debug)&&(this.config.debug?(cu.DEBUG=!0,vv.R()&&vv.N("ph_debug",!0),Mh.info("set_config",{config:e,oldConfig:t,newConfig:hu({},this.config)})):(cu.DEBUG=!1,vv.R()&&vv.q("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(l=this.exceptionObserver)||l.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||
2c.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.cn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){cu.LIB_NAME=e,cu.LIB_VERSION=t}startSessionRecording(e){var t,n,i,s,r,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(hu({},i,t))}}addExceptionStep(e,t){var n;null==(n=this.exceptions)||n.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:qf.dn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,n;return null!==(t=null==(n=this.toolbar)?void 0:n.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Mf;return t!==Mf&&(t=Mf+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(Sp))===Fp||(null==(t=this.sessionPersistence)?void 0:t.get_property(Sp))===Fp}nn(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Up&&!this._isIdentified()&&Mu(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[qh])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Pp]))}Xi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(e){return"never"===this.config.person_profiles?(Mh.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Pp,!0),!0)}Hi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Mp)}cn(){var e,t,n,i,s=this.Hi();return(null==(e=this.persistence)?void 0:e._r)!==s&&(null==(n=this.persistence)||n.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._r)!==s&&(null==(i=this.sessionPersistence)||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==$p){if(this.Ri()){var n,i,s,r,o;this.reset(!0),null==(n=this.sessionManager)||n.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=new cf(this),this.pageViewManager=new kv(this),this.persistence&&(this.sessionPropsManager=new of(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(r=this.config.__extensionClasses)?void 0:r.sessionRecording)&&void 0!==s?s:null==(o=qf.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Mi(this.sessionRecording,new l(this)),this.Qi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Qi)))}var c,u;this.consent.optInOut(!0),this.cn(),this.Ji(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Mp&&(null==(c=this.surveys)||c.loadIfEnabled()),($u(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else Mh.warn(If)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode!==$p?(this.config.cookieless_mode===Mp&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Mp&&(this.register({distinct_id:Lp,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(n=this.pageViewM
2anager)||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki())):Mh.warn(If)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===$p||(this.config.cookieless_mode===Mp?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return Zc?uf(Zc,this.config.custom_blocked_useragents):void 0}Ki(){eu&&("visible"===eu.visibilityState?this.Fi||(this.Fi=!0,this.capture(jp,{title:eu.title},{send_instantly:!0}),this.Ai&&(eu.removeEventListener(Bp,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),tv(eu,Bp,this.Ai)))}debug(e){!1===e?(null==Qc||Qc.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Qc||Qc.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Lr(){var e,t,n,i,s,r,o=this.qi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Mh.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",i=Mh,s=(t="advanced_disable_flags")in(e=o)&&!Bu(e[t]),r=n in e&&!Bu(e[n]),s?e[t]:!!r&&(i&&i.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]))}rn(e){if(Bu(this.config.before_send))return e;var t=Du(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),Bu(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return Hu(e.event)?Mh.warn(s+". This can cause unexpected behavior."):Mh.info(s),null}n.properties&&!Mu(n.properties)||Mh.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return null==(e=this.pageViewManager.dr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Di(e){var t=Wu(e)&&!e,n=vv.R()&&"true"===vv.A("ph_debug");return!t&&(!!n||e)}}function jf(e){return e instanceof Element&&(e.id===kp||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Wf(e){return!!e&&1===e.nodeType}function Hf(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Vf(e){return!!e&&3===e.nodeType}function zf(e){return!!e&&11===e.nodeType&&Wf(e.host)}function Gf(e){return e?Au(e).split(/\s+/):[]}function Yf(e){var t=null==Qc?void 0:Qc.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Kf(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Gf(t)}function Jf(e){return Bu(e)?null:Au(e).split(/(\s+)/).filter(e=>vm(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Qf(e){var t="";return om(e)&&!am(e)&&e.childNodes&&e.childNodes.length&&Gp(e.childNodes,function(e){var n;Vf(e)&&e.textContent&&(t+=null!==(n=Jf(e.textContent))&&void 0!==n?n:"")}),Au(t)}function Xf(e){return $u(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}qf.__defaultExtensionClasses={},qf.dn={trace:Af=()=>{},debug:Af,info:Af,warn:Af,error:Af,fatal:Af},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=Qp(e.prototype[t[n]])}(qf,["identify"]);var Zf=["a","button","form","input","select","textarea","label"];function em(e,t){if($u(t))return!0;var n,i=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(n=i(s))return n.v;return!1}function tm(e){var t=e.parentNode;return!(!t||!Wf(t))&&t}var nm=["next","previous","prev",">","<"],im=[".ph-no-rageclick",".ph-no-capture"],sm=e=>!e||Hf(e,"html")||!Wf(e),rm=(e,t)=>
vendor: 9,181 bytes, line 2
2{if(!Qc||sm(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],s=e;s.parentNode&&!Hf(s,"body");)if(zf(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var r=tm(s);if(!r)break;if(t||Zf.indexOf(r.tagName.toLowerCase())>-1)n=!0;else{var o=Qc.getComputedStyle(r);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}i.push(r),s=r}return{parentIsUsefulElement:n,targetElementList:i}};function om(e){for(var t=e;t.parentNode&&!Hf(t,"body");t=t.parentNode){var n=Kf(t);if(Cu(n,"ph-sensitive")||Cu(n,"ph-no-capture"))return!1}if(Cu(Kf(e),"ph-include"))return!0;var i=e.type||"";if(Ru(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!Ru(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function am(e){return!!(Hf(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Hf(e,"select")||Hf(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var lm="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",cm=new RegExp("^(?:"+lm+")$"),um=new RegExp(lm),dm="\\d{3}-?\\d{2}-?\\d{4}",hm=new RegExp("^("+dm+")$"),pm=new RegExp("("+dm+")");function vm(e,t){if(void 0===t&&(t=!0),Bu(e))return!1;if(Ru(e)){if(e=Au(e),(t?cm:um).test((e||"").replace(/[- ]/g,"")))return!1;if((t?hm:pm).test(e))return!1}return!0}function gm(e){var t=Qf(e);return vm(t=(t+" "+fm(e)).trim())?t:""}function fm(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Gp(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var i=Qf(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+fm(e)).trim())}catch(s){Mh.error("[AutoCapture]",s)}}),t}function mm(e){return e.replace(/"|\\"/g,'\\"')}function _m(e){var t=e.attr__class;return t?Du(t)?t:Gf(t):void 0}class ym{constructor(e){this.disabled=!1===e;var t=Nu(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}var wm="$copy_autocapture",bm=$h("[AutoCapture]");function Sm(e,t){return t.length>e?t.slice(0,e)+"...":t}function Em(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Wf(t));return t}var Tm=$h("[ExceptionAutocapture]");function xm(e,t,n){try{if(!(t in e))return()=>{};var i=e[t],s=n(i);return Ou(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=i}}catch(r){return()=>{}}}var Cm=$h("[TracingHeaders]"),Am=$h("[Web Vitals]"),Pm=9e5,km="disabled",Lm="lazy_loading",Im="awaiting_config",Dm="missing_config";$h("[SessionRecording]"),$h("[SessionRecording]");var Om="[SessionRecording]",Nm=$h(Om),Mm=$h("[Heatmaps]");function $m(e){return Nu(e)&&"clientX"in e&&"clientY"in e&&qu(e.clientX)&&qu(e.clientY)}var Rm=$h("[Product Tours]"),Fm=["$set_once","$set"],Um=$h("[SiteApps]"),Bm="Error while initializing PostHog app with config id ";function qm(e,t,n){if(Bu(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(s){return!1}default:return!1}}class jm{constructor(e){this.vn=new af,this.fn=(e,t)=>this.pn(e,t)&&this.gn(e,t)&&this.mn(e,t)&&this.yn(e,t),this.pn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,t;$u(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,n;if(!$u(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,n;null==(t=this._n)||t.add(e),null==(n=e.steps)||n.forEach(e=>{var t;null==(t=this.bn)||t.add((null==e?void 0:e.event)||"")})}),null!=(n=this._instance)&&n.autocapture)){var i,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(i=this._instance)||i.autocapture.setElementSelectors(s)}}on(e,t){var n;null!=t&&0!=e.length&&(this.bn.has(e)||this.bn.has(null==t?void 0:t.event))&&this._n&&(null==(n=this._n)?void 0:n.size)>0&&this._n.forEach(e=>{this.wn(t,e)&&this.vn.emit("actionCaptured",e.name)})}xn(e){this.onAction("actionCaptured",t=>e(t))}wn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var n of t.steps)if(this.fn(e,n))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(null!=t&&t.url){var n,i=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!i||"string"!=typeof i)return!1;if(!qm(i,t.url,t.url_matching||"contains"))return!1}return!0}mn(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}Sn(e,t){var n;if(null==t||!t.href)return!0;var i=this.In(e);if(i.length>0)return i.some(e=>qm(e.href,t.href,t.href_matching||"exact"));var s,r=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!r&&qm((s=r.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}kn(e,t){var n;if(null==t||!t.text)return!0;var i=this.In(e);if(i.length>0)return i.some(e=>qm(e.text,t.text,t.text_matching||"exact")||qm(e.$el_text,t.text,t.text_matching||"exact"));var s,r,o,a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(s=function(e){for(var t,n=[],i=/(?::|")text="(.*?)"/g;!Bu(t=i.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),r=t.text,o=t.text_matching||"exact",s.some(e=>qm(e,r,o)))}Cn(e,t){var n,i;if(null==t||!t.selector)return!0;var s=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var r=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(o){return!1}return!1}In(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}yn(e,t){return null==t||!t.properties||0===t.properties.length||gf(t.properties.reduce((e,t)=>{var n=Du(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class Wm{constructor(e){this._instance=e,this.Tn=new Map,this.En=new Map,this.Mn=new Map}Pn(e,t){return!!e&&gf(e.propertyFilters,null==t?void 0:t.properties)}Rn(e,t){var n=new Map;return e.forEach(e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(t=>{if(null!=t&&t.name){var i=n.get(t.name)||[];i.push(e.id),n.set(t.name,i)}})}),n}On(e,t,n){var i=(n===Zv?this.Tn:this.En).get(e),s=[];return this.Ln(e=>{s=e.filter(e=>null==i?void 0:i.includes(e.id))}),s.filter(i=>{var s,r=null==(s=i.conditions)||null==(s=s[n])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this.Pn(r,t)})}register(e){var t;$u(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}An(e){var t=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0});0!==t.length&&(null==this.Nn&&(this.Nn=new jm(this._instance),this.Nn.init(),this.Nn.xn(e=>{this.onAction(e)})),t.forEach(e=>{var t,n,i,s,r;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(n=e.conditions)&&null!=(n=n.actions)&&n.values&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0&&(null==(s=this.Nn)||s.register(e.conditions.actions.values),null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)||r.forEach(t=>{if(t&&t.name){var n=this.Mn.get(t.name);n&&n.push(e.id),this.Mn.set(t.name,n||[e.id])}}))}))}Fn(e){var t,n=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),i=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0});0===n.length&&0===i.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Tn=this.Rn(e,Zv),this.En=this.Rn(e,eg))}onEvent(e,t){var n,i=this.le(),s=this.$n(),r=this.Dn(),o=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[s])||[];if(r===e&&t&&o.length>0){var a,l;i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var c=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var u=o.indexOf(c);0>u||(o.splice(u,1),this.qn(o))}}else{if(this.En.has(e)){var d=this.On(e,t,eg);d.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(e=>e.id)}
2),d.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.jn(e.id)}),this.qn(o))}if(this.Tn.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var h=this.On(e,t,Zv);this.qn(o.concat(h.map(e=>e.id)||[]))}}}onAction(e){var t,n=this.$n(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.Mn.has(e)&&this.qn(i.concat(this.Mn.get(e)||[]))}qn(e){var t=this.le(),n=[...new Set(e)].filter(e=>!this.Hn(e));t.info("updating activated items",{activatedItems:n}),this.Un(n)}getActivatedIds(){var e,t=this.$n();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Bn(){return this.Nn}}class Hm extends Wm{constructor(e){super(e)}$n(){return fp}Dn(){return tg}Ln(e){var t;null==(t=this._instance)||t.getSurveys(e)}jn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}le(){return wf}Un(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[fp]:e})}Hn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Vm="SDK is not enabled or survey functionality is not yet loaded",zm="Disabled. Not loading surveys.",Gm=null!=Qc&&Qc.location?Mv(Qc.location.hash,"__posthog")||Mv(location.hash,"state"):null,Ym="_postHogToolbarParams",Km=$h("[Toolbar]"),Jm=$h("[FeatureFlags]"),Qm=$h("[FeatureFlags]",{debugEnabled:!0}),Xm="\" failed. Feature flags didn't load in time.",Zm=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},e_=e=>{var t={};for(var[n,i]of Kp(e||{}))i&&(t[n]=i);return t},t_=$h("[Error tracking]"),n_="Refusing to render web experiment since the viewer is a likely bot",i_={icontains:(e,t)=>!!Qc&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Qc&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!Qc&&df(t.href,e),not_regex:(e,t)=>!!Qc&&!df(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class s_{get qt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{s_.zn("retrieved web experiments from the server"),t.Vn=new Map,e.forEach(e=>{if(e.feature_flag_key){var n;t.Vn&&(s_.zn("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(n=t.Vn)||n.set(e.feature_flag_key,e));var i=t._instance.getFeatureFlag(e.feature_flag_key);Ru(i)&&e.variants[i]&&t.Wn(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var s in e.variants){var r=e.variants[s];s_.Zn(r)&&t.Wn(e.name,s,r.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())s_.zn(n_);else if(!this.qt.disable_web_experiments){if(Bu(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();s_.zn("applying feature flags",e),e.forEach(e=>{var t;if(this.Vn&&null!=(t=this.Vn)&&t.has(e)){var n,i=this._instance.getFeatureFlag(e),s=null==(n=this.Vn)?void 0:n.get(e);i&&null!=s&&s.variants[i]&&this.Wn(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){var e=s_.getWindowLocation();if(null!=e&&e.search){var t=Ov(null==e?void 0:e.search,"__experiment_id"),n=Ov(null==e?void 0:e.search,"__experiment_variant");t&&n&&(s_.zn("previewing web experiments "+t+" && "+n),this.getWebExperiments(e=>{this.Gn(parseInt(t),n,e)},!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.qt.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Gn(e,t,n){var i=n.filter(t=>t.id===e);i&&i.length>0&&(s_.zn("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Wn(i[0].name,t,i[0].variants[t].transforms))}static Zn(e){return!Bu(e.conditions)&&s_.Qn(e)&&s_.Jn(e)}static Qn(e){var t;if(Bu(e.conditions)||Bu(null==(t=e.conditions)?void 0:t.url))return!0;var n,i,s,r=s_.getWindowLocation();return!!r&&(null==(n=e.conditions)||!n.url||i_[null!==(i=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==i?i:"icontains"](e.conditions.url,r))}
2static getWindowLocation(){return null==Qc?void 0:Qc.location}static Jn(e){var t;if(Bu(e.conditions)||Bu(null==(t=e.conditions)?void 0:t.utm))return!0;var n=qv();if(n.utm_source){var i,s,r,o,a,l,c,u,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==n.utm_campaign,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==n.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==n.utm_medium,v=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==n.utm_term;return d&&p&&v&&h}return!1}static zn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];Mh.info("[WebExperiments] "+e,n)}Wn(e,t,n){this._is_bot()?s_.zn(n_):"control"!==t?n.forEach(n=>{if(n.selector){var i;s_.zn("applying transform of variant "+t+" for experiment "+e+" ",n);var s=null==(i=document)?void 0:i.querySelectorAll(n.selector);null==s||s.forEach(e=>{var t=e;n.html&&(t.innerHTML=n.html),n.css&&t.setAttribute("style",n.css)})}}):s_.zn("Control variants leave the page unmodified.")}_is_bot(){return Zc&&this._instance?uf(Zc,this.qt.custom_blocked_useragents):void 0}}var r_=$h("[Conversations]"),o_="Conversations not available yet.",a_={featureFlags:class{constructor(e){this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}us(){var e,t;return null!==(e=null==(t=this.ni)?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}ls(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,Jm.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=null!==(e=this.qt.evaluation_contexts)&&void 0!==e?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(Jm.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Jm.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}cs(){return this.hs().length>0}ds(){var e=this.qt.flag_keys;if(!$u(e)){if(Du(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Jm.error("Invalid flag key found:",e,"Expected non-empty string"),t});Jm.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,i=null!==(e=null==(t=n.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var s,r,o=null!==(s=null==(r=n.bootstrap)?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(i).filter(e=>!!i[e]).reduce((e,t)=>(e[t]=i[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,n){var i=null!=n&&n.merge?this.getFlagVariants():{},s=null!=n&&n.merge?this.getFlagPayloads():{},r=hu({},i,e),o=hu({},s,t),a={};for(var[l,c]of Object.entries(r)){var u="string"==typeof c;
2a[l]={key:l,enabled:!!u||Boolean(c),variant:u?c:void 0,reason:void 0,metadata:$u(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(lp),t=this.os(dp),n=this.os(hp);if(!n&&!t)return e||{};var i=Yp({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var r of s){var o,a,l=i[r],c=null==t?void 0:t[r],u=$u(c)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!c,d=$u(c)?l.variant:"string"==typeof c?c:void 0,h=null==n?void 0:n[r],p=hu({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),h&&(p.metadata=hu({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[r]=p}return this.Kn||(Jm.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Kn=!0),i}getFlagVariants(){var e=this.os(rp),t=this.os(dp);if(!t)return e||{};for(var n=Yp({},e),i=Object.keys(t),s=0;i.length>s;s++)n[i[s]]=t[i[s]];return this.Kn||(Jm.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Kn=!0),n}getFlagPayloads(){var e=this.os(cp),t=this.os(hp);if(!t)return e||{};for(var n=Yp({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)n[i[s]]=t[i[s]];return this.Kn||(Jm.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Kn=!0),n}reloadFeatureFlags(){this.es||this.qt.advanced_disable_feature_flags||this.vs||(this._instance.Li.emit("featureFlagsReloading",!0),this.vs=setTimeout(()=>{this.fs()},5))}ps(){clearTimeout(this.vs),this.vs=void 0}ensureFlagsLoaded(){this.Yn||this.Xn||this.vs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}fs(e){var t;if(this.ps(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var n=this.qt.token,i=this.os(Bh),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:hu({},(null==(t=this.ni)?void 0:t.get_initial_props())||{},this.os(pp)||{}),group_properties:this.os(vp),timezone:Kv()};Uu(i)||$u(i)||(s.$device_id=i),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var r=this.ds();$u(r)||(s.flag_keys=r);var o=!!this.qt.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.qt.disable_compression?void 0:ug,timeout:this.qt.feature_flag_request_timeout_ms,callback:e=>{var t,n,i,r=!0;if(200===e.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),r=!1),this.Xn=!1,!s.disable_flags||this.ts){this.rs=!r;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,c=!(null==(n=e.json)||null==(n=n.quotaLimited)||!n.includes("feature_flags"));c&&a.push("quota_limited"),null==(i=this.ni)||i.register({[wp]:a}),c?Jm.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},r,{partialResponse:o}),this.ts&&(this.ts=!1,this.fs()))}}})}}getFeatureFlag(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFeatureFlagResult(e,t);return null!==(n=null==i?void 0:i.variant)&&void 0!==n?n:null==i?void 0:i.enabled}}else Jm.warn('getFeatureFlag for key "'+e+Xm)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),i=e in n,s=n[e],r=this.getFlagPayloads()[e],o=String(s),a=this.os(up)||void 0,l=this.os(bp)||void 0,c=this.os(_p)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),h=this.os(yp);d&&d!==h&&(c={},null==(u=this.ni)||u.register({[_p]:c,[yp]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(o))){var p,v,g,f,m,_,y,w,b,S;Du(c[e])?c[e].push(o):c[e]=[o],null==(p=this.ni)||p.register({[_p]:c});var E=this.getFeatureFlagDetails(e),T=[...null!==(v=this.os(wp))&&void 0!==v?v:[]];$u(s)&&T.push("flag_missing");var x={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:r||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(f=this.qt.bootstrap)||null==(f=f.featureFlagPayloads)?void 0:f[e])||null,$used_bootstrap_value:!this.rs};
2$u(null==E||null==(m=E.metadata)?void 0:m.version)||(x.$feature_flag_version=E.metadata.version);var C,A=null!==(_=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==_?_:null==E||null==(w=E.reason)?void 0:w.code;A&&(x.$feature_flag_reason=A),null!=E&&null!=(b=E.metadata)&&b.id&&(x.$feature_flag_id=E.metadata.id),$u(null==E?void 0:E.original_variant)&&$u(null==E?void 0:E.original_enabled)||(x.$feature_flag_original_response=$u(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(S=E.metadata)&&S.original_payload&&(x.$feature_flag_original_payload=null==E||null==(C=E.metadata)?void 0:C.original_payload),T.length&&(x.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",x)}if(i){var P=r;if(!$u(r))try{P=JSON.parse(r)}catch(k){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:P}}}}else Jm.warn('getFeatureFlagResult for key "'+e+Xm)}getRemoteConfigPayload(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.cs()&&(i.evaluation_contexts=this.hs());var s=this.ds();$u(s)||(i.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.qt.disable_compression?void 0:ug,timeout:this.qt.feature_flag_request_timeout_ms,callback(n){var i,s=null==(i=n.json)?void 0:i.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return $u(n)?void 0:!!n}Jm.warn('isFeatureEnabled for key "'+e+Xm)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){if(this.ni){this.Yn=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,n,i,s,r){void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s={});var o,a,l=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):Jm.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),c=l.flags,u=l.featureFlags,d=l.featureFlagPayloads;if(u){var h=e.requestId,p=e.evaluatedAt;if(Du(u)){Jm.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(u)for(var g=0;u.length>g;g++)v[u[g]]=!0;t&&t.register({[op]:u,[rp]:v})}else{var f=u,m=d,_=c;if(null!=r&&r.partialResponse)f=hu({},n,f),m=hu({},i,m),_=hu({},s,_);else if(e.errorsWhileComputingFlags)if(c){var y=new Set(Object.keys(c).filter(e=>{var t;return!(null!=(t=c[e])&&t.failed)}));f=hu({},n,Object.fromEntries(Object.entries(f).filter(e=>{var[t]=e;return y.has(t)}))),m=hu({},i,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)}))),_=hu({},s,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return y.has(t)})))}else f=hu({},n,f),m=hu({},i,m),_=hu({},s,_);t&&t.register(hu({[op]:Object.keys(e_(f)),[rp]:f||{},[cp]:m||{},[lp]:_||{}},h?{[up]:h}:{},p?{[bp]:p}:{}))}}}(e,this.ni,i,s,r,n),t||(this.ss=!1),this.gs(t)}}override(e,t){void 0===t&&(t=!1),Jm.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return Jm.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ni.unregister(dp),this.ni.unregister(hp),this.gs(),Qm.info("All overrides cleared");if(Du(e)){var t=Zm(e);return this.ni.register({[dp]:t}),this.gs(),Qm.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var n,i=e;if(this.Kn=Boolean(null!==(n=i.suppressWarning)&&void 0!==n&&n),"flags"in i)if(!1===i.flags)this.ni.unregister(dp),Qm.info("Flag overrides cleared");else if(i.flags){if(Du(i.flags)){var s=Zm(i.flags);this.ni.register({[dp]:s})}else this.ni.register({[dp]:i.flags});Qm.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this.ni.unregister(hp),Qm.info("Payload overrides cleared")):i.payloads&&(this.ni.register({[hp]:i.payloads}),Qm.info("Payload overrides set",{payloads:i.payloads}))),void this.gs()}if(e&&"object"==typeof e)return this.ni.register({[dp]:e}),this.gs(),Qm.info("Flag overrides set",{flags:e});Jm.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:n}=this.ys();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this.os(ap)||[]).find(t=>t.flagKey===e),r={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};s&&(o.$early_access_feature_name=s.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(r,!1);var a=hu({},this.getFlagVariants(),{[e]:t});null==(i=this.ni)||i.register({[op]:Object.keys(e_(a)),[rp]:a}),this.gs()}
2getEarlyAccessFeatures(e,t,n){void 0===t&&(t=!1);var i=this.os(ap),s=n?"&"+n.map(e=>"stage="+e).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:t=>{var n,i;if(t.json){var s=t.json.earlyAccessFeatures;return null==(n=this.ni)||n.unregister(ap),null==(i=this.ni)||i.register({[ap]:s}),e(s)}}})}ys(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,n)=>(e[n]=t[n],e),{})}}gs(e){var{flags:t,flagVariants:n}=this.ys();this.featureFlagEventHandlers.forEach(i=>i(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var n=this.os(pp)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,r={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in n||(r[o]=s[o]));this._instance.register({[pp]:hu({},n,r,i)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(pp)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var n=this.os(vp)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(t=>{n[t]=hu({},n[t],e[t]),delete e[t]}),this._instance.register({[vp]:hu({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(vp)||{};this._instance.register({[vp]:hu({},t,{[e]:{}})})}else this._instance.unregister(vp)}reset(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.ps(),this.Kn=!1}}},l_={sessionRecording:class{get qt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!(null==(e=this.bs)||!e.isStarted)}get status(){var e,t;return this._s===Im||this._s===Dm?this._s:null!==(e=null==(t=this.bs)?void 0:t.status)&&void 0!==e?e:this._s}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._s=km,this.ws=void 0,this._instance=e,!this._instance.sessionManager)throw Nm.error("started without valid sessionManager"),new Error(Om+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===$p)throw new Error(Om+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get xs(){var e,t=!(null==(e=this._instance.get_property(Xh))||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return Qc&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.xs||null==(t=this.bs)||!t.isStarted){var n=!$u(Object.assign)&&!$u(Array.from);this.xs&&n?(this.Ss(e),Nm.info("starting")):(this._s=km,this.stopRecording())}}Ss(e){var t,n,i;this.xs&&(this._s!==Im&&this._s!==Dm&&(this._s=Lm),null!=au&&null!=(t=au.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=au.__PosthogExtensions__)&&n.initSessionRecording?this.ks(e):null==(i=au.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Cs,t=>{if(t)return Nm.error("could not load recorder",t);this.ks(e)}))}stopRecording(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.stop()}Is(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.discard()}Ts(){var e;null==(e=this.ni)||e.unregister(sp)}Es(e,t){if(Bu(e))return null;var n,i=qu(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Nm.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Ms(e){if(this.ni){var t,n,i=this.ni,s=()=>{var t,n=!1===e.sessionRecording?void 0:e.sessionRecording,s=this.Es(null==(t=this.qt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),r=this.Es(null==n?void 0:n.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Bu(o)&&this.Ts();var a=null==n?void 0:n.minimumDurationMilliseconds;i.register({[Xh]:hu({cache_timestamp:Date.now(),enabled:!!n},n,{networkPayloadCapture:hu({capturePerformance:e.capturePerformance},null==n?void 0:n.networkPayloadCapture),canvasRecording:{enabled:null==n?void 0:n.recordCanvas,fps:null==n?void 0:n.canvasFps,quality:null==n?void 0:n.canvasQuality},sampleRate:o,minimumDurationMilliseconds:$u(a)?null:a,endpoint:null==n?void 0:n.endpoint,triggerMatchType:null==n?void 0:n.triggerMatchType,masking:null==n?void 0:n.masking,urlTriggers:null==n?void 0:n.urlTriggers,version:null==n?void 0:n.version,triggerGroups:null==n?void 0:n.triggerGroups})})};s(),null==(t=this.ws)||t.call(this),this.ws=null==(n=this._instance.sessionManager)?void 0:n.onSessionId(s)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ms(e),void this.Is()):(this.Ms(e),void this.startIfEnabledOrStop()):(this._s===Im&&(this._s=Dm,Nm.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;void 0===t&&(t="log"),null!=(n=this.bs)&&n.log?this.bs.log(e,t):Nm.w
2arn("log called before recorder was ready")}get Cs(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Xh);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}Ps(){var e,t,n=this._instance.get_property(Xh);if(!n)return!1;try{t="object"==typeof n?n:JSON.parse(n)}catch(s){return Nm.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}var i=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}ks(e){var t,n;if(null==(t=au.__PosthogExtensions__)||!t.initSessionRecording)return Nm.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Op]:!0});if(this.bs||(this.bs=null==(n=au.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ps()){if(this._s===Dm||this._s===Im)return;return this._s=Im,Nm.info("persisted remote config is stale, requesting fresh config before starting"),void new lg(this._instance).load()}this._s=Lm,this.bs.start(e)}onRRwebEmit(e){var t;null==(t=this.bs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.bs||null==(t=this.ni)||t.register({[ep]:!0}),null==(e=this.bs)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.bs||null==(t=this.ni)||t.register({[Zh]:!0}),null==(e=this.bs)||e.overrideSampling()}overrideTrigger(e){var t,n;this.bs||null==(n=this.ni)||n.register({["url"===e?tp:np]:!0}),null==(t=this.bs)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.bs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!(null==(n=this.bs)||!n.tryAddCustomEvent(e,t))}}},c_={autocapture:class{constructor(e){this.Rs=!1,this.Os=null,this.Ls=!1,this.instance=e,this.rageclicks=new ym(e.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get qt(){var e,t,n=Nu(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null==(e=n.url_allowlist)?void 0:e.map(e=>new RegExp(e)),n.url_ignorelist=null==(t=n.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),n}As(){if(this.isBrowserSupported()){if(Qc&&eu){var e=e=>{e=e||(null==Qc?void 0:Qc.event);try{this.Ns(e)}catch(gu){bm.error("Failed to capture event",gu)}};if(tv(eu,"submit",e,{capture:!0}),tv(eu,"change",e,{capture:!0}),tv(eu,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=e=>{e=e||(null==Qc?void 0:Qc.event);try{this.Ns(e,wm)}catch(gu){bm.error("Failed to capture copy/cut event",gu)}};tv(eu,"copy",t,{capture:!0}),tv(eu,"cut",t,{capture:!0})}}}else bm.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.As(),this.Rs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Ls=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Wh]:!!e.autocapture_opt_out}),this.Os=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Fs=e}getElementSelectors(e){var t,n=[];return null==(t=this.Fs)||t.forEach(t=>{var i=null==eu?void 0:eu.querySelectorAll(t);null==i||i.forEach(i=>{e===i&&n.push(t)})}),n}get isEnabled(){var e,t,n=null==(e=this.instance.persistence)?void 0:e.props[Wh];if(Uu(this.Os)&&!Wu(n)&&!this.instance.Lr())return!1;var i=null!==(t=this.Os)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}Ns(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=Xf(e);Vf(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!Qc||sm(e))return!1;var n,i,s;if(Wu(t)?(n=!!t&&im,i=void 0):(n=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:im,i=null==t?void 0:t.content_ignorelist),!1===n)return!1;var{targetElementList:r}=rm(e,!1);return!function(e,t){if(!1===e||$u(e))return!1;var n;if(!0===e)n=nm;else{if(!Du(e))return!1;if(e.length>10)return Mh.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:i}=e;return n.some(e=>t.includes(e)||i.includes(e))})}(i,r.map(e=>{var t;return{safeText:Qf(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!em(r,n)}(i,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var s=t===wm;if(i&&function(e,t,n,i,s){var r,o,a,l;if(void 0===n&&(n=void 0),!Qc||sm(e))return!1;if(null!=(r=n)&&r.url_allowlist&&!Yf(n.url_allowlist))return!1;if(null!=(o=n)&&o.url_ignorelist&&Yf(n.url_ignorelist))return!1;if(null!=(a=n)&&a.dom_event_allowlist){var c=n.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:u,targetElementList:d}=rm(e,i);if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if($u(n))return!0;var i,s=function(e){if(n.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}(d,n))return!1;if(!em(d,null==(l=n)?void 0:l.css_selector_allowlist))return!1;var h=Qc.getComputedStyle(e);
2if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return u?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(Zf.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.qt,s,s?["copy","cut"]:void 0)){var{props:r,explicitNoCapture:o}=function(e,t){var n,i,{e:s,maskAllElementAttributes:r,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t;if(!Wf(e))return{props:{}};for(var c=[e],u=e;u.parentNode&&!Hf(u,"body");)if(zf(u.parentNode))c.push(u.parentNode.host),u=u.parentNode.host;else{if(!Wf(u.parentNode))break;c.push(u.parentNode),u=u.parentNode}var d,h,p=[],v={},g=!1,f=!1;if(Gp(c,e=>{var t=om(e);if(Hf(e,"a")){var n=e.getAttribute("href");g=t&&!!n&&vm(n)&&n}Cu(Kf(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,n,i){var s=e.tagName.toLowerCase(),r={tag_name:s};Zf.indexOf(s)>-1&&!n&&(r.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Sm(1024,gm(e)):Sm(1024,Qf(e)));var o=Kf(e);o.length>0&&(r.classes=o.filter(function(e){return""!==e})),Gp(e.attributes,function(n){var s;if((!am(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&vm(n.value)&&(!Ru(s=n.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=n.value;"class"===n.name&&(o=Gf(o).join(" ")),r["attr__"+n.name]=Sm(1024,o)}});for(var a=1,l=1,c=e;c=Em(c);)a++,c.tagName===e.tagName&&l++;return r.nth_child=a,r.nth_of_type=l,r}(e,r,o,a));var i=function(e){if(!om(e))return{};var t={};return Gp(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&vm(i)&&(t[n]=i)}}),t}(e);Yp(v,i)}),f)return{props:{},explicitNoCapture:f};if(o||(p[0].$el_text=Hf(e,"a")||Hf(e,"button")?gm(e):Qf(e)),g){var m,_;p[0].attr__href=g;var y=null==(m=Dv(g))?void 0:m.host,w=null==Qc||null==(_=Qc.location)?void 0:_.host;y&&w&&y!==w&&(d=g)}return{props:Yp({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map(e=>{var t,n,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var r=hu({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Kp(r).sort((e,t)=>{var[n]=e,[i]=t;return n.localeCompare(i)}).forEach(e=>{var[t,n]=e;return o[mm(t.toString())]=mm(n.toString())}),(i+=":")+Kp(o).map(e=>{var[t,n]=e;return t+'="'+n+'"'}).join("")}).join(";")}(function(e){return e.map(e=>{var t,n,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:_m(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Kp(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,n]=e;return i.attributes[t]=n}),i})}(h)))},null!=(n=p[0])&&n.$el_text?{$el_text:null==(i=p[0])?void 0:i.$el_text}:{},d&&"click"===s.type?{$external_click_url:d}:{},v)}}(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Ls});if(o)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(r.$element_selectors=a),t===wm){var l,c=Jf(null==Qc||null==(l=Qc.getSelection())?void 0:l.toString()),u=e.type||"clipboard";if(!c)return!1;r.$selected_content=c,r.$copy_type=u}return this.instance.capture(t,r),!0}}}isBrowserSupported(){return Ou(null==eu?void 0:eu.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.$s=(null==Qc||null==(t=Qc.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Mh.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,Mh.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Qc&&Qc.history){var n=this;null!=(e=Qc.history.pushState)&&e.__posthog_wrapped__||xm(Qc.history,"pushState",e=>function(t,i,s){e.call(this,t,i,s),n.qs("pushState")}),null!=(t=Qc.history.replaceState)&&t.__posthog_wrapped__||xm(Qc.history,"replaceState",e=>function(t,i,s){e.call(this,t,i,s),n.qs("replaceState")}),this.js()}}qs(e){try{var t,n=null==Qc||null==(t=Qc.location)?void 0:t.pathname;if(!n)return;n!==this.$s&&this.isEnabled&&this._instance.capture(jp,{navigation_type:e}),this.$s=n}catch(gu){Mh.error("Error capturing "+e+" pageview",gu)}}js(){if(!this.Ds){var e=()=>{this.qs("popstate")};tv(Qc,"popstate",e),this.Ds=()=>{Qc&&Qc.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.Hs=!1,this.Rs=!1,this.Us=null,this.instance=e,this.Hs=!(null==(t=this.instance.persistence)||!t.props[Hh]),this.rageclicks=new ym(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Nu(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Bu(this.qt.capture_heatmaps)?Bu(this.qt.enable_heatmaps)?this.Hs:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Mm.info("starting..."),this.Bs(),this.At()}else{var e;clearInterval(null!==(e=this.Us)&&void 0!==e?e:void 0),this.zs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Hh]:t}),this.Hs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}Vs(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Us&&clearInterval(this.Us),this.Us="visible"===(null==eu?void 0:eu.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Bs(){Qc&&eu&&(this.Ws=this.Zr.bind(this),tv(Qc,qp,this.Ws),this.Zs=e=>this.Mt(e||(null==Qc?void 0:Qc.event)),tv(eu,"click",this.Zs,{capture:!0}),this.Gs=e=>this.Qs(e||(null==Qc?void 0:Qc.event)),tv(eu,"mousemove",this.Gs,{capture:!0}),this.Js=new Tv(this.instance,Sv,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ks=this.At.bind(this),tv(eu,Bp,this.Ks),this.Rs=!0)}zs(){var e;Qc&&eu&&(this.Ws&&Qc.removeEventListener(qp,this.Ws),this.Zs&&eu.removeEventListener("click",this.Zs,{capture:!0}),this.Gs&&eu.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Ks&&eu.removeEventListener(Bp,this.Ks),clearTimeout(this.Ys),null==(e=this.Js)||e.stop(),this.Rs=!1)}Xs(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),r=function(e,t,n){for(var i=e;i&&Wf(i)&&!Hf(i,"body");){if(i===n)return!1;if(Cu(t,null==Qc?void 0:Qc.getComputedStyle(i).position))return!0;
2i=tm(i)}return!1}(Xf(e),["fixed","sticky"],s);return{x:e.clientX+(r?0:i),y:e.clientY+(r?0:n),target_fixed:r,type:t}}Mt(e,t){var n;if(void 0===t&&(t="click"),!jf(e.target)&&$m(e)){var i=this.Xs(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.eo(hu({},i,{type:"rageclick"})),this.eo(i)}}Qs(e){!jf(e.target)&&$m(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.eo(this.Xs(e,"mousemove"))},500))}eo(e){if(Qc){var t=Qc.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?[...Rv,...n||[]]:[],s=Nv(t,i,Uv);this.M=this.M||{},this.M[s]||(this.M[s]=[]),this.M[s].push(e)}}Zr(){this.M&&!Mu(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Tv,webVitalsAutocapture:class{constructor(e){var t;this.Hs=!1,this.Rs=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=()=>{clearTimeout(this.io),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce((e,t)=>hu({},e,{["$web_vitals_"+t.name+"_event"]:hu({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=e=>{var t;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.no();if(!$u(n))if(Bu(null==e?void 0:e.name)||Bu(null==e?void 0:e.value))Am.error("Invalid metric received",e);else if(!this.so||this.so>e.value){this.M.url!==n&&(this.ro(),this.io=setTimeout(this.ro,this.flushToCaptureTimeoutMs)),$u(this.M.url)&&(this.M.url=n),this.M.firstMetricTimestamp=$u(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=hu({},e,{$current_url:n,timestamp:Date.now()});$u(i)||(s.$session_id=i.sessionId,s.$window_id=i.windowId),this.M.metrics.push(s),this.M.metrics.length===this.allowedMetrics.length&&this.ro()}else Am.error("Ignoring metric with value >= "+this.so,e)},this.oo=()=>{if(!this.Rs){var e,t,n,i,s=au.__PosthogExtensions__;$u(s)||$u(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:i}=s.postHogWebVitalsCallbacks),e&&t&&n&&i?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.ht.bind(this)),this.Rs=!0):Am.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Hs=!(null==(t=this._instance.persistence)||!t.props[Yh]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Nu(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return Bu(n)?(null==(t=this._instance.persistence)?void 0:t.props[Qh])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Nu(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Nu(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}get so(){var e=Nu(this.ao)&&qu(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:Pm;return e>0&&6e4>=e?Pm:e}get isEnabled(){var e=null==tu?void 0:tu.protocol;if("http:"!==e&&"https:"!==e)return Am.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Nu(this.ao)?this.ao.web_vitals:Wu(this.ao)?this.ao:void 0;return Wu(t)?t:this.Hs}startIfEnabled(){this.isEnabled&&!this.Rs&&(Am.info("enabled, starting..."),this.lr(this.oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=Nu(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Nu(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yh]:t}),this._instance.persistence.register({[Qh]:n})),this.Hs=t,this.startIfEnabled()}}lr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?Am.error("failed to load script",t):e()})}no(){var e=Qc?Qc.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Rv,...t||[]]:[];return Nv(e,n,Uv)}Am.error("Could not determine current URL")}}},u_={exceptionObserver:class{constructor(e){var t,n,i;this.oo=()=>{var e;if(Qc&&this.isEnabled&&null!=(e=au.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=au.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=au.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=au.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.uo&&this.qt.capture_unhandled_errors&&(this.uo=t(this.captureException.bind(this))),!this.lo&&this.qt.capture_unhandled_rejections&&(this.lo=n(this.captureException.bind(this))),!this.ho&&this.qt.capture_console_errors&&(this.ho=i(this.captureException.bind(this)))}catch(gu){Tm.error("failed to start",gu),this.co()}}},this._instance=e,this.do=!(null==(t=this._instance.persistence)||!t.props[Vh]),this.vo=new Xu({refillRate:null!==(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==n?n:1,bucketSize:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10,refillInterval:1e4,Gt:Tm}),this.qt=this.fo(),this.startIfEnabledOrStop()}fo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Nu(e)?t=hu({},t,e):($u(e)?this.do:e)&&(t=hu({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Tm.info("enabled"),this.co(),this.lr(this.oo)):this.co()}lr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(
2),null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Tm.error("failed to load script",t);e()})}co(){var e,t,n;null==(e=this.uo)||e.call(this),this.uo=void 0,null==(t=this.lo)||t.call(this),this.lo=void 0,null==(n=this.ho)||n.call(this),this.ho=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.do=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Vh]:this.do}),this.qt=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.fo()}captureException(e){var t,n,i,s=null!==(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)&&void 0!==t?t:"Exception";this.vo.consumeRateLimit(s)?Tm.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.po=[],this.mo=new sh([new fh,new Ch,new _h,new mh,new Th,new Eh,new wh,new xh],function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var s=[],r=t.split("\n"),o=i;r.length>o;o++){var a=r[o];if(1024>=a.length){var l=gh.test(a)?a.replace(gh,"$1"):a;if(!l.match(/\S*Error: /)){for(var c of n){var u=c(l,e);if(u){s.push(u);break}}if(s.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return hu({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||rh});var n})}(s)}}("web:javascript",dh,vh)),this._instance=e,this.po=null!==(t=null==(n=this._instance.persistence)?void 0:n.get_property(zh))&&void 0!==t?t:[],this.yo=Ih(this.bo()),this._o=new Dh(this.yo)}onConfigChange(){this.yo=Ih(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(e){var t,n,i;if("errorTracking"in e){var s=null!==(t=null==(n=e.errorTracking)?void 0:n.suppressionRules)&&void 0!==t?t:[],r=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this.po=s,this._instance.persistence&&this._instance.persistence.register({[zh]:this.po,[Gh]:r})}}get wo(){var e,t=!!this._instance.get_property(Gh),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=n?n:t)&&void 0!==e&&e}buildProperties(e,t){return this.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.yo.enabled)try{if(!Ru(e)||0===e.trim().length)return void t_.warn("Ignoring exception step because message must be a non-empty string");var n=this.xo(t),{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((n,i)=>kh.has(i)?(t.push(i),n):(n[i]=e[i],n),{}),droppedKeys:t}}(n);s.length>0&&t_.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(hu({[Ah]:e,[Ph]:(new Date).toISOString()},i))}catch(r){t_.error("Failed to add exception step. Ignoring breadcrumb.",r)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.So(t)){if(this.ko(t))return this.Co("Exception dropped: matched a suppression rule"),void t_.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void t_.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void t_.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.yo.enabled&&Bu(e.$exception_steps)?this.Eo(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return i&&this._o.clear(),i}catch(s){return t_.error("Failed to capture exception event. Dropping this exception.",s),void this._o.clear()}}catch(s){return void t_.error("Failed to process exception event. Ignoring this exception.",s)}}Eo(e){try{var t=this._o.getAttachable();return 0===t.length?e:hu({},e,{$exception_steps:t})}catch(n){return t_.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Co(e){this.yo.enabled&&this._o.add({[Ah]:e,[Ph]:(new Date).toISOString()})}xo(e){return Nu(e)?hu({},e):{}}bo(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}ko(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>
2{var{type:n,value:i}=t;return Ru(n)&&n.length>0&&e.$exception_types.push(n),Ru(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.po.some(e=>{var n=e.values.map(e=>{var n,i=pf[e.operator],s=Du(e.value)?e.value:[e.value],r=null!==(n=t[e.key])&&void 0!==n?n:[];return s.length>0&&i(s,r)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}Io(e){return e.flatMap(e=>{var t,n;return null!==(t=null==(n=e.stacktrace)?void 0:n.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}To(e){if(e.length>0){var t,n,i,s,r=null!==(t=null==(n=e[0].stacktrace)?void 0:n.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(i=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==i&&i}return!1}So(e){return!Bu(e)&&Du(e)}}},d_=hu({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Mo=null,this.Po=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ni&&this.ni.register({[Jh]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Mo||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Jh)||this.lr(()=>this.Ro())}lr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",t=>{t?Rm.error("Could not load product tours script",t):e()})}Ro(){var e;!this.Mo&&null!=(e=au.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=au.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Du(this.Po)||t){var n=this.ni;if(n){var i=n.props[mp];if(Du(i)&&!t)return this.Po=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return Rm.error(s),void e([],{isLoaded:!1,error:s})}var r=Du(t.json.product_tours)?t.json.product_tours:[];this.Po=r,n&&n.register({[mp]:r}),e(r,{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}getActiveProductTours(e){Bu(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Mo)||t.showTourById(e)}previewTour(e){this.Mo?this.Mo.previewTour(e):this.lr(()=>{var t;this.Ro(),null==(t=this.Mo)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Mo)||e.nextStep()}previousStep(){var e;null==(e=this.Mo)||e.previousStep()}clearCache(){var e;this.Po=null,null==(e=this.ni)||e.unregister(mp)}resetTour(e){var t;null==(t=this.Mo)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Mo)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}},a_),h_={siteApps:class{constructor(e){this._instance=e,this.Oo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Lo(e,t){if(t){var n=this.globalsForEvent(t);this.Oo.push(n),this.Oo.length>1e3&&(this.Oo=this.Oo.slice(10))}}get siteAppLoaders(){var e;return null==(e=au._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Lo.bind(this));this.Fo=()=>{e(),this.Oo=[],this.Fo=void 0}}}globalsForEvent(e){var t,n,i,s,r,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(u))l[d]={id:c[d],type:d,properties:h};var{$set_once:p,$set:v}=e;return{event:hu({},pu(e,Fm),{properties:hu({},e.properties,v?{$set:hu({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:hu({},null!==(i=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==i?i:{},p)}:{}),elements_chain:null!==(r=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.Oo.length&&(Um.info("Processing "+this.Oo.length+" events for site app with id "+e.id),this.Oo.forEach(e
2=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(n=this.Fo)||n.call(this))},i=!1,s=s=>{t.errored=!s,t.loaded=!0,Um.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&n()};try{var{processEvent:r}=e.init({posthog:this._instance,callback(e){s(e)}});r&&(t.processEvent=r),i=!0}catch(o){Um.error(Bm+e.id,o),s(!1)}if(i&&t.loaded)try{n()}catch(a){Um.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Ao(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}No(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{null==n.processEvent||n.processEvent(t)}catch(i){Um.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Ao(),void this._instance.on("eventCaptured",e=>this.No(e))):void Um.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.Fo)||n.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var r=function(e){var t;au["__$$ph_site_app_"+e]=s._instance,null==(t=au.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return Um.error(Bm+e,t)})};for(var{id:o,url:a}of e.siteApps)r(o)}else Um.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},p_={tracingHeaders:class{constructor(e){this.$o=void 0,this.Do=void 0,this.oo=()=>{var e,t,n=this.qo()||[];$u(this.$o)&&(null==(e=au.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(n,this._instance.get_distinct_id(),this._instance.sessionManager)),$u(this.Do)&&(null==(t=au.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(n,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,n;null!=(t=au.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=au.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return Cm.error("failed to load script",t);e()})}qo(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.qo()?this.lr(this.oo):(null==(e=this.$o)||e.call(this),null==(t=this.Do)||t.call(this),this.$o=void 0,this.Do=void 0)}}},v_=hu({surveys:class{get qt(){return this._instance.config}constructor(e){this.jo=void 0,this._surveyManager=null,this.Ho=!1,this.Uo=[],this.Bo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(Bu(t))return wf.warn("Flags not loaded yet. Not loading surveys.");var n=Du(t);this.jo=n?t.length>0:t,wf.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(null!=n&&n.startsWith(bf)||null!=n&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Ho)wf.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)wf.info(zm);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())wf.info("Not loading surveys in cookieless mode without consent.");else{var e=null==au?void 0:au.__PosthogExtensions__;if(e){if(!$u(this.jo)||this.qt.advanced_enable_surveys){var t=this.jo||this.qt.advanced_enable_surveys;this.Ho=!0;try{var n=e.generateSurveys;if(n)return void this.zo(n,t);var i=e.loadExternalDependency;if(!i)return void this.Vo(Np);i(this._instance,"surveys",n=>{n||!e.generateSurveys?this.Vo("Could not load surveys script",n):this.zo(e.generateSurveys,t)})}catch(s){throw this.Vo("Error initializing surveys",s),s}finally{this.Ho=!1}}}else wf.error("PostHog Extensions not found.")}}zo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Hm(this._instance),wf.info("Surveys loaded successfully"),this.Wo({isLoaded:!0})}Vo(e,t){wf.error(e,t),this.Wo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Uo.push(e),this._surveyManager&&this.Wo({isLoaded:!0}),()=>{this.Uo=this.Uo.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.qt.disable_surveys)return wf.info(zm),e([]);var n,i=this._instance.get_property(gp);if(i&&!t)return e(i,{isLoaded:!0});"undefined"!=typeof Promise&&this.Bo?this.Bo.then(t=>{var{surveys:n,context:i}=t;return e(n,i)}):("undefined"!=typeof Promise&&(this.Bo=new Promise(e=>{n=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:t=>{var i;this.Bo=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;wf.error(r);var o={isLoaded:!1,error:r};return e([],o),void(null==n||n({surveys:[],context:o}))}
2var a,l=t.json.surveys||[],c=l.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});c.length>0&&(null==(a=this._surveyEventReceiver)||a.register(c)),null==(i=this._instance.persistence)||i.register({[gp]:l});var u={isLoaded:!0};e(l,u),null==n||n({surveys:l,context:u})}}))}Wo(e){for(var t of this.Uo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){wf.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Bu(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);wf.warn("init was not called")}Zo(e){var t=null;return this.getSurveys(n=>{var i;t=null!==(i=n.find(t=>t.id===e))&&void 0!==i?i:null}),t}Go(e){if(Bu(this._surveyManager))return{eligible:!1,reason:Vm};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Bu(this._surveyManager))return wf.warn("init was not called"),{visible:!1,disabledReason:Vm};var t=this.Go(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Bu(this._surveyManager)?(wf.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Vm})):new Promise(n=>{this.getSurveys(t=>{var i,s=null!==(i=t.find(t=>t.id===e))&&void 0!==i?i:null;if(s){var r=this.Go(s);n({visible:r.eligible,disabledReason:r.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(Bu(this._surveyManager))wf.warn("init was not called");else{var s="string"==typeof e?this.Zo(e):e;if(null!=s&&s.id)if(Sf.includes(s.type)){var r=null==eu?void 0:eu.querySelector(t);if(r)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(wf.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;wf.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,r,n),wf.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,r,n);wf.warn("Survey element not found")}else wf.warn("Surveys of type "+s.type+" cannot be rendered in the app");else wf.warn("Survey not found")}}displaySurvey(e,t){var n;if(Bu(this._surveyManager))wf.warn("init was not called");else{var i=this.Zo(e);if(i){var s=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=hu({},i,{appearance:hu({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==sg&&t.initialResponses&&wf.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var r=this.canRenderSurvey(i);if(!r.visible)return void wf.warn("Survey is not eligible to be displayed: ",r.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else wf.warn("Survey not found")}}cancelPendingSurvey(e){Bu(this._surveyManager)?wf.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},a_),g_={toolbar:class{constructor(e){this.instance=e}Qo(e){au.ph_toolbar_state=e}Jo(){var e;return null!==(e=au.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),nv(this.instance.config))return!1;if(!Qc||!eu)return!1;e=null!=e?e:Qc.location,n=null!=n?n:Qc.history;try{if(!t){try{Qc.localStorage.setItem("test","test"),Qc.localStorage.removeItem("test")}catch(gu){return!1}t=null==Qc?void 0:Qc.localStorage}var i,s=Gm||Mv(e.hash,"__posthog")||Mv(e.hash,"state"),r=s?Jp(()=>JSON.parse(atob(decodeURIComponent(s))))||Jp(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?((i=r).source="url",i&&Object.keys(i).length>
20&&(r.desiredHash?e.hash=r.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Ym)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(gu){return!1}}Ko(e){var t=au.ph_load_toolbar||au.ph_load_editor;!Bu(t)&&Ou(t)?t(e,this.instance):Km.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==eu||!eu.getElementById(kp));if(!Qc||t)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,i=hu({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Qc.localStorage.setItem(Ym,JSON.stringify(hu({},i,{source:void 0}))),2===this.Jo())this.Ko(i);else if(0===this.Jo()){var s;this.Qo(1),null==(s=au.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Km.error("[Toolbar] Failed to load",e),void this.Qo(0);this.Qo(2),this.Ko(i)}),tv(Qc,"turbolinks:load",()=>{this.Qo(0),this.loadToolbar(i)})}return!0}Yo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},f_=hu({experiments:s_},a_),m_={conversations:class{constructor(e){this.Xo=void 0,this._conversationsManager=null,this.ea=!1,this.ta=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Bu(t)||(Wu(t)?this.Xo=t:(this.Xo=t.enabled,this.ta=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Xo=void 0,this.ta=null}loadIfEnabled(){if(!(this._conversationsManager||this.ea||this._instance.config.disable_conversations||nv(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==au?void 0:au.__PosthogExtensions__;if(e&&!$u(this.Xo)&&this.Xo)if(this.ta&&this.ta.token){this.ea=!0;try{var t=e.initConversations;if(t)return this.ra(t),void(this.ea=!1);var n=e.loadExternalDependency;if(!n)return void this.ia(Np);n(this._instance,"conversations",t=>{t||!e.initConversations?this.ia("Could not load conversations script",t):this.ra(e.initConversations),this.ea=!1})}catch(i){this.ia("Error initializing conversations",i),this.ea=!1}}else r_.error("Conversations enabled but missing token in remote config.")}}ra(e){if(this.ta)try{this._conversationsManager=e(this.ta,this._instance),r_.info("Conversations loaded successfully")}catch(t){this.ia("Error completing conversations initialization",t)}else r_.error("Cannot complete initialization: remote config is null")}ia(e,t){r_.error(e,t),this._conversationsManager=null,this.ea=!1}show(){this._conversationsManager?this._conversationsManager.show():r_.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Xo&&!Uu(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,n){var i=this;return du(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(r_.warn(o_),null)})()}getMessages(e,t){var n=this;return du(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(r_.warn(o_),null)})()}markAsRead(e){var t=this;return du(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(r_.warn(o_),null)})()}getTickets(e){var t=this;return du(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(r_.warn(o_),null)})()}requestRestoreLink(e){var t=this;return du(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(r_.warn(o_),null)})()}restoreFromToken(e){var t=this;return du(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(r_.warn(o_),null)})()}restoreFromUrlToken(){var e=this;return du(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(r_.warn(o_),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}ln(){var e;null==(e=this._conversationsManager)||e.setIdentity()}hn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},__={logs:class{constructor(e){var t;this.na=!1,this.sa=!1,this.Gt=$h("[logs]"),this.oa=[],this.aa=0,this.ua=0,this.la=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.na=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Bu(n)&&n&&(this.na=!0,this.loadIfEnabled())}reset(){this.oa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.aa=0,this.ua=0,this.la=!1}loadIfEnabled(){if(this.na&&!this.sa){var e=null==au?void 0:au.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var n;t||null==(n=e.logs)||!n.initializeLogs?this.Gt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.sa=!0)}):this.Gt.error(Np)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,n,i,s,r,o;
2if(this._instance.is_capturing())if(e&&e.body){var a=null!==(t=null==(n=this._instance.config.logs)?void 0:n.flushIntervalMs)&&void 0!==t?t:3e3,l=null!==(i=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==i?i:1e3,c=Date.now();if(a>c-this.ua||(this.ua=c,this.aa=0,this.la=!1),l>this.aa){this.aa++;var u=function(e,t){var n=e.level||"info",{text:i,number:s}=Zd[n]||eh,r=String(Date.now())+"000000",o={};t.distinctId&&(o.posthogDistinctId=t.distinctId),t.sessionId&&(o.sessionId=t.sessionId),t.currentUrl&&(o["url.full"]=t.currentUrl),t.screenName&&(o["screen.name"]=t.screenName),t.appState&&(o["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(o.feature_flags=t.activeFeatureFlags);var a=hu({},o,e.attributes||{}),l={timeUnixNano:r,observedTimeUnixNano:r,severityNumber:s,severityText:i,body:{stringValue:e.body},attributes:nh(a)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),$u(e.trace_flags)||(l.flags=e.trace_flags),l}(e,this.ha());this.oa.push({record:u}),(null!==(r=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==r?r:100)>this.oa.length?this.ca():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.da||(this.da={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.da}flushLogs(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),0!==this.oa.length){var t=this.oa;this.oa=[];var n=this._instance.config.logs,i=hu({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),s=(o=t.map(e=>e.record),a=i,l=cu.LIB_NAME,c=cu.LIB_VERSION,{resourceLogs:[{resource:{attributes:nh(a)},scopeLogs:[{scope:{name:l,version:c},logRecords:o}]}]}),r=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:r,data:s,compression:"best-available",batchKey:"logs",transport:e})}var o,a,l,c}ca(){var e,t;this.qr||(this.qr=setTimeout(()=>{this.qr=void 0,this.flushLogs()},null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}ha(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(null!=au&&null!=(e=au.location)&&e.href&&(t.currentUrl=au.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},y_=hu({},a_,l_,c_,u_,d_,h_,v_,p_,g_,f_,m_,__);qf.__defaultExtensionClasses=hu({},y_);var w_,b_=(w_=Pf[Mf]=new qf,function(){function e(){e.done||(e.done=!0,$f=!1,Gp(Pf,function(e){e._dom_loaded()}))}null!=eu&&eu.addEventListener?"complete"===eu.readyState?e():tv(eu,"DOMContentLoaded",e,{capture:!1}):Qc&&Mh.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),w_);let S_=!1;const E_="phc_yiyXMJpStcsMXU2KFVdrVY8jcYJb6E8hsGViEohZtNGR";function T_(){return Boolean(E_)}function x_(){S_||"undefined"==typeof window||(b_.init(E_,{api_host:"https://eu.i.posthog.com",capture_pageview:!1,capture_pageleave:!0,persistence:"localStorage+cookie",autocapture:!1,loaded:()=>{console.info("%c[CLAW analytics] PostHog active (EU) â check Network tab for eu.i.posthog.com","color:#00f6ff;font-weight:600")}}),S_=!0,C_())}function C_(){try{const e=localStorage.getItem("token");if(!e)return;const t=JSON.parse(atob(e.split(".")[1])),n=String(t.sub??t.id??t.email??""),i=t.email;n&&b_.identify(n,i?{email:i}:void 0)}catch{}}const A_={"/claw/pretrade":"Pre-Trade","/claw/trade":"Trade","/claw/posttrade":"Post-Trade","/claw/copytrade":"Copy Trade","/claw/social":"Social","/claw/learn":"Learn","/account/details":"Account · Details","/account/verification":"Account · Verification","/account/trade":"Account · Trade","/account/copytrade":"Account · Copy Trade","/account/credits":"Account · Credits","/account/subscriptions":"Account · Subscription","/account/subscription":"Account · Subscription","/billing/success":"Billing · Success","/mobile/app":"Mobile · Home","/mobile/chart":"Mobile · Chart"};function P_(e){const t=e.split("?")[0].split("#")[0];return t.endsWith("/")&&t.length>1?t.slice(0,-1):t}function k_(e){T_()&&(x_(),b_.capture("claw_copytrade_cockpit",{subsection:e,section:`Copy Trade · ${e}`,surface:"desktop"}))}function L_(e){T_()&&(x_(),b_.capture("claw_mobile_tab",{tab:e,section:`Mobile · ${e}`,surface:"mobile"}))}const I_=["/claw","/mirror","/mobile","/account"];!function(){throw document.title="CLAW â Down for Maintenance",document.documentElement.innerHTML='\n <style>\n *{margin:0;padding:0;box-sizing:border-box}\n body{background:#060a14;color:#fff;font-family:Inter,system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;text-align:center;padding:2rem}\n .wrap{max-width:440px}\n .logo{font-size:2rem;font-weight:900;letter-spacing:-0.04em;color:#00f6ff;margin-bottom:1.5rem}\n h1{font-size:1.35rem;font-weight:700;margin-bottom:.75rem}\n p{color:rgba(255,255,255,.5);font-size:.9rem;line-height:1.65}\n </style>\n <body><div class="wrap">\n <div class="logo">/// CLAW</div>\n <h1>Down for Maintenance</h1>\n <p>CLAW is currently unavailable while we carry out maintenance. Please check back later.</p>\n </div></body>\n ',new Error("[CLAW] Down for maintenance")}(),function(){const e=window.location.hostname;if(!["app.eagleailabs.com","localhost","127.0.0.1"].some(t=>e===t||e.endsWith("."+t)))throw document.documentElement.innerHTML='\n <style>\n *{margin:0;padding:0;box-sizing:border-box}\n body{background:#060a14;color:#fff;font-family:Inter,system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;text-align:center;padding:2rem}\n .wrap{max-width:420px}\n .logo{font-size:2rem;font-weight:900;letter-spacing:-0.04em;color:#00f6ff;margin-bottom:1.5rem}\n h1{font-size:1.25rem;font-weight:700;margin-bottom:.75rem}\n p{color:rgba(255,255,255,.45);font-size:.875rem;line-height:1.6;margin-bottom:1.5rem}\n a{display:inline-block;background:#00f6ff;color:#060a14;font-weight:700;font-size:.875rem;padding:.75rem 2rem;border-radius:6px;text-decoration:none}\n </style>\n <body><div class="wrap">\n <div class="logo">/// CLAW</div>\n <h1>Unauthorised Access</h1>\n <p>You are accessing CLAW through an unofficial or unauthorised host. This may put your credentials and data at risk.</p>\n <a href="https://app.eagleailabs.com">Go to the official CLAW platform â</a>\n </div></body>\n ',new Error("[CLAW] Blocked: unauthorised host "+e)}();const D_=console.warn.bind(console);console.warn=(...e)=>{const t=e.find(e=>"string"==typeof e),n=void 0!==t&&(/20\d\d-\d\d-\d\dT.*:Property:/.test(t)||t.includes("does not match a schema")),i=void 0!==t&&(t.includes("Can't get DOM width or height")||t.includes("dom.clientWidth"));n||i||D_(...e)},fs({position:"bottom-left",autoClose:3e3,hideProgressBar:!0,closeButton:!1,closeOnClick:!0,icon:!1,theme:"dark",transition:"slide"});let O_=!1;mt.interceptors.response.use(e=>e,e=>{var t,n;if(401===(null==(t=e.response)?void 0:t.status)){const t=(null==(n=e.config)?void 0:n.url)||"",i=t.includes("stream.eagleailabs.com")||t.startsWith("/api/"),s=["customization","billing/prices","frame","credits","stealth"].some(e=>t.includes(e)),r=localStorage.getItem("token");if(i&&!s&&r&&!O_&&!window.location.pathname.startsWith("/auth")){O_=!0,localStorage.removeItem("token"),localStorage.removeItem("user"),window.location.pathname.startsWith("/mobile")&&vs("Your session has expired. Please log in again.",{type:"warning",position:"top-center",autoClose:3e3});const e=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`/auth/login?to=${e}&reason=expired`}}return Promise.reject(e)}),window.addEventListener("error",e=>{if(e.message.includes("Failed to fetch dynamically imported module")||e.message.includes("Importing a module script failed")||e.message.includes("error loading dynamically imported module")||e.filename&&e.filename.includes(".js")&&e.message.includes("Failed to fetch")){console.error("[ChunkLoadError] Detected stale cache, reloading page..."),console.error("[ChunkLoadError] Error:",e.message);const t="claw_chunk_reload_count",n=parseInt(sessionStorage.getItem(t)||"0",10);n<3?(sessionStorage.setItem(t,String(n+1)),window.location.reload()):(console.error("[ChunkLoadError] Too many reload attempts, stopping to prevent loop"),sessionStorage.removeItem(t),alert("Unable to load the application. Please clear your browser cache and try again.")),e.preventDefault()}}),window.addEventListener("load",()=>{sessionStorage.removeItem("claw_chunk_reload_count")});const N_=ie(Yc),M_=new si,$_=He();$_.use(function(e){const{store:t}=e;function n(e){try{return JSON.parse(JSON.stringify(e))}catch{return}}t.$subscribe((e,i)=>{var s,r;if("clawStore"===t.$id){const t=null==(s=null==e?void 0:e.events)?void 0:s.key;"token"!==t&&"timeframe"!==t||yt.publish("token",{label:null==(r=i.token)?void 0:r.label,timeframe:i.timeframe})}if("layoutStore"===t.$id){const e=n({slots:i.slots,slotDims:i.slotDims});e&&yt.publish("layout",e)}if("chart"===t.$id){const e=n({range:i.range,cursor:i.cursor});e&&yt.publish("chart",e)}}),yt.subscribe(e=>{try{"layout"===e.fragment&&(yt.isLeader||yt.publishAny("layout",e.payload))}catch{}})}),N_.use($_),N_.use(Kc),x_(),function(e){const t=(e,t)=>{I_.some(t=>e===t||e.startsWith(t+"/"))&&function(e,t){if(!T_())return;x_(),C_();const n=P_(e||window.location.pathname),i=function(e){const t=P_(e);return A_[t]?A_[t]:t.startsWith("/claw/")?`CLAW · ${t.replace("/claw/","")}`:t.startsWith("/account/")?`Account · ${t.replace("/account/","")}`:t.startsWith("/mobile/")?`Mobile · ${t.replace("/mobile/","")}`:t}(n),s=function(e){return e.startsWith("/mobile")?"mobile":e.startsWith("/account")?"account":e.startsWith("/auth")?"auth":e.startsWith("/claw")||e.startsWith("/mirror")?"desktop":"other"}(n);b_.capture("$pageview",{$current_url:window.location.href,path:n,route_name:t?String(t):void 0,section:i,surface:s,app:"claw"}),"other"!==s&&"auth"!==s&&b_.capture("claw_section_view",{section:i,path:n,surface:s,route_name:t?String(t):void 0})}(e,t)};e.isReady().then(()=>{t(e.currentRoute.value.path,e.currentRoute.value.name)}),e.afterEach(e=>{t(e.path,e.name)})}(Kc),N_.directive("no-select",yi),N_.mount("#app"),N_.use(on,{config:pi}),N_.use(ri,{queryClient:M_}),window.addEventListener("keydown",e=>{if(!e.ctrlKey&&!e.metaKey||!e.shiftKey)return;const t=e.key.toLowerCase();if("m"===t){const e=window.location.pathname;let t="/mirror/pretrade";!e.includes("/trade")||e.includes("/pretrade")||e.includes("/posttrade")?e.includes("/posttrade")?t="/mirror/posttrade":e.includes("/copytrade")&&(t="/mirror/copytrade"):t="/mirror/trade",window.open(t,"CLAW Mirror","popup=yes,width="+screen.availWi
2dth+",height="+screen.availHeight)}else"f"===t&&(document.fullscreenElement?bt():wt(document.documentElement))}),Kc.afterEach(e=>{if(yt.isLeader&&e.path.startsWith("/claw/")){const t=e.path.replace("/claw/","");yt.publish("route",{page:t})}}),yt.subscribe(e=>{var t;if("route"===e.fragment&&!yt.isLeader){const n=null==(t=e.payload)?void 0:t.page;if(n&&window.location.pathname.startsWith("/mirror")){const e="/mirror/"+n;window.location.pathname!==e&&Kc.push(e)}}});export{Vn as $,Uc as A,_a as B,kt as C,Fc as D,Ot as E,Lt as F,Dt as G,It as H,Dn as I,pn as J,wn as K,hn as L,cn as M,ln as N,un as O,dn as P,Ln as Q,jn as R,an as S,Tn as T,Un as U,yn as V,ti as W,kn as X,Zn as Y,mn as Z,qa as _,ms as a,Xn as a0,Bl as a1,jl as a2,Wl as a3,At as a4,rn as a5,ir as a6,Ga as a7,Wr as a8,k_ as a9,Uo as aA,Ur as aa,er as ab,wr as ac,ho as ad,Ks as ae,Ms as af,Js as ag,Qs as ah,Zs as ai,Vs as aj,vr as ak,pr as al,yr as am,L_ as an,Va as ao,ja as ap,vo as aq,va as ar,Gt as as,zt as at,Zl as au,fc as av,_c as aw,Wa as ax,Vo as ay,Yo as az,Es as b,hr as c,li as d,Is as e,bs as f,js as g,qs as h,ks as i,bt as j,wt as k,vs as l,tr as m,nr as n,St as o,rr as p,ws as q,ys as r,Ns as s,Ws as t,Sa as u,Hs as v,_s as w,ui as x,hi as y,ci as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.