PageSourceSearch

https://www.viewlink.dev/assets/index-B1JvnM16.js

js viewlink.dev collected 2026-10-02 01:52:50 UTC 782,036 bytes, 644 lines download raw bytes

1var dg=Object.defineProperty;var mg=(e,t,n)=>t in e?dg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Gl=(e,t,n)=>mg(e,typeof t!="symbol"?t+"":t,n);import{r as h,j as s,o as ee,v as fg,c as ha,g as Qd,b as pg}from"./vendor-react-DV7JxyZH.js";import{s as $e}from"./vendor-posthog-BiWB-aFH.js";import{V as Zd,R as em,A as tm,C as nm,T as rm,D as sm,P as hg,b as am,c as gg,d as xg,e as yg,f as im,g as bg,h as om,S as vg,O as lm,i as cm,j as wg,k as um,l as dm,m as kg,n as _g,o as mm,I as jg,p as Ng,q as fm,r as Sg,s as Eg,t as pm,u as Cg,v as hm,w as Tg,x as gm,y as xm,z as Ag,B as ym,E as Ig,L as bm,F as vm,G as Dg,H as Pg,J as wm,K as Mg,M as Lg}from"./vendor-radix-B8qCKqca.js";import{X as rr,C as ot,M as km,a as Cn,L as yt,R as zt,b as $o,S as Pa,c as Og,A as gs,B as Bo,d as Rg,e as _m,f as xs,g as ys,h as Fg,i as jm,U as zg,j as Qt,k as $g,l as Bg,m as Vg,n as Ug,Z as Nm,T as Wg,o as Sm,p as Em,q as nn,r as bs,s as Ma,H as Yg,t as Hg,u as La,v as Es,K as qg,w as Gg,W as Xg,x as Cm,y as Kg,z as Jg,D as Ji,E as Xl,F as Vo,G as ga,I as Tm,J as Uo,N as Qg,O as Zg,P as ex,Q as Am,V as tx,Y as nx,_ as rx,$ as sx,a0 as ax,a1 as ix,a2 as ox,a3 as lx,a4 as cx,a5 as ux,a6 as dx,a7 as mx,a8 as fx,a9 as px}from"./vendor-icons-BCJfLsiD.js";import{Q as hx,a as gx}from"./vendor-query-Ci1eE3qf.js";import{u as sr,N as cs,O as xx,a as nt,b as Im,L as Ie,c as Wo,d as yx,B as bx,R as vx,e as Pe}from"./vendor-router-BCztDkI0.js";import{c as wx}from"./vendor-supabase-CygC1msk.js";import{s as xa}from"./vendor-crisp-BNPGNxpy.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();const xe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ce=globalThis,Vn="10.59.0";function Oa(){return Ra(Ce),Ce}function Ra(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Vn,t[Vn]=t[Vn]||{}}function Pr(e,t,n=Ce){const r=n.__SENTRY__=n.__SENTRY__||{},a=r[Vn]=r[Vn]||{};return a[e]||(a[e]=t())}const kx=["debug","info","warn","error","log","assert","trace"],_x="Sentry Logger ",ya={};function Mr(e){if(!("console"in Ce))return e();const t=Ce.console,n={},r=Object.keys(ya);r.forEach(a=>{const i=ya[a];n[a]=t[a],t[a]=i});try{return e()}finally{r.forEach(a=>{t[a]=n[a]})}}function jx(){Ho().enabled=!0}function Nx(){Ho().enabled=!1}function Dm(){return Ho().enabled}function Sx(...e){Yo("log",...e)}function Ex(...e){Yo("warn",...e)}function Cx(...e){Yo("error",...e)}function Yo(e,...t){xe&&Dm()&&Mr(()=>{Ce.console[e](`${_x}[${e}]:`,...t)})}function Ho(){return xe?Pr("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const me={enable:jx,disable:Nx,isEnabled:Dm,log:Sx,warn:Ex,error:Cx},Pm=50,Hn="?",Kl=/\(error: (.*)\)/,Jl=/captureMessage|captureException/;function Mm(...e){const t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,a=0)=>{const i=[],o=n.split(`
2`);for(let l=r;l<o.length;l++){let c=o[l];c.length>1024&&(c=c.slice(0,1024));const u=Kl.test(c)?c.replace(Kl,"$1"):c;if(!u.includes("Error: ")){for(const d of t){const m=d(u);if(m){i.push(m);break}}if(i.length>=Pm+a)break}}return Ax(i.slice(a))}}function Tx(e){return Array.isArray(e)?Mm(...e):e}function Ax(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Bs(t).function||"")&&t.pop(),t.reverse(),Jl.test(Bs(t).function||"")&&(t.pop(),Jl.test(Bs(t).function||"")&&t.pop()),t.slice(0,Pm).map(n=>({...n,filename:n.filename||Bs(t).filename,function:n.function||Hn}))}function Bs(e){return e[e.length-1]||{}}const ni="<anonymous>";function Tn(e){try{return!e||typeof e!="function"?ni:e.name||ni}catch{return ni}}function Ql(e){const t=e.exception;if(t){const n=[];
2try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const os={},Zl={};function ar(e,t){return os[e]=os[e]||[],os[e].push(t),()=>{const n=os[e];if(n){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function ir(e,t){if(!Zl[e]){Zl[e]=!0;try{t()}catch(n){xe&&me.error(`Error while instrumenting ${e}`,n)}}}function $t(e,t){const n=e&&os[e];if(n)for(const r of n)try{r(t)}catch(a){xe&&me.error(`Error while triggering instrumentation handler.
3Type: ${e}
4Name: ${Tn(r)}
5Error:`,a)}}let ri=null;function Ix(e){const t="error";ar(t,e),ir(t,Dx)}function Dx(){ri=Ce.onerror,Ce.onerror=function(e,t,n,r,a){return $t("error",{column:r,error:a,line:n,msg:e,url:t}),ri?ri.apply(this,arguments):!1},Ce.onerror.__SENTRY_INSTRUMENTED__=!0}let si=null;function Px(e){const t="unhandledrejection";ar(t,e),ir(t,Mx)}function Mx(){si=Ce.onunhandledrejection,Ce.onunhandledrejection=function(e){return $t("unhandledrejection",e),si?si.apply(this,arguments):!0},Ce.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Lm=Object.prototype.toString;function Fa(e){switch(Lm.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return vr(e,Error)}}function Lr(e,t){return Lm.call(e)===`[object ${t}]`}function Om(e){return Lr(e,"ErrorEvent")}function ec(e){return Lr(e,"DOMError")}function Lx(e){return Lr(e,"DOMException")}function mn(e){return Lr(e,"String")}function qo(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Cs(e){return e===null||qo(e)||typeof e!="object"&&typeof e!="function"}function vs(e){return Lr(e,"Object")}function za(e){return typeof Event<"u"&&vr(e,Event)}function Ox(e){return Lr(e,"RegExp")}function Ts(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function vr(e,t){try{return e instanceof t}catch{return!1}}function Rm(e){return typeof Request<"u"&&vr(e,Request)}function Nt(e,t,n){if(!(t in e))return;const r=e[t];if(typeof r!="function")return;const a=n(r);typeof a=="function"&&Fm(a,r);try{e[t]=a}catch{xe&&me.log(`Failed to replace method "${t}" in object`,e)}}function An(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{xe&&me.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Fm(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,An(e,"__sentry_original__",t)}catch{}}function Go(e){return e.__sentry_original__}function zm(e){if(Fa(e))return{message:e.message,name:e.name,stack:e.stack,...tc(e)};if(za(e)){const{type:t,target:n,currentTarget:r,detail:a}=e;return{type:t,target:n,currentTarget:r,...a?{detail:a}:{},...tc(e)}}return e}function tc(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function Rx(e){const t=Object.keys(zm(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}let lr;function $a(e){if(lr!==void 0)return lr?lr(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=Ce;return t in n&&typeof n[t]=="function"?(lr=n[t],lr(e)):(lr=null,e())}function ba(){return $a(()=>Math.random())}function Or(){return $a(()=>Date.now())}const Fx=Symbol.for("sentry.skipNormalization"),zx=Symbol.for("sentry.overrideNormalizationDepth");function $x(e){return!!e[Fx]}function Bx(e){const t=e[zx];return typeof t=="number"?t:void 0}let Qi;function $m(e){Qi=e}function cn(e,t=100,n=1/0){try{return Zi("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Bm(e,t=3,n=100*1024){const r=cn(e,t);return Wx(r)>n?Bm(e,t-1,n):r}function Zi(e,t,n=1/0,r=1/0,a=Yx()){const[i,o]=a;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const l=Vm(e,t);if(!l.startsWith("[object "))return l;if($x(t))return t;const c=Bx(t),u=c!==void 0?c:n;if(u===0)return l.replace("object ","");if(i(t))return"[Circular ~]";const d=t;if(d&&typeof d.toJSON=="function")try{const g=d.toJSON();return Zi("",g,u-1,r,a)}catch{}const m=Array.isArray(t)?[]:{};let p=0;const f=zm(t);for(const g in f){if(!Object.prototype.hasOwnProperty.call(f,g))continue;if(p>=r){m[g]="[MaxProperties ~]";break}const x=f[g];m[g]=Zi(g,x,u-1,r,a),p++}return o(t),m}function Vm(e,t){try{if(Qi){const r=Qi(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${Tn(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${Vx(t)}]`}catch(n){return`**non-serializable** (${n})`}}function Vx(e){const t=Object.getPrototypeOf(e);return t!=null&&t.constructor?t.constructor.name:"null prototype"}function Ux(e){return~-encodeURI(e).split(/%..|./).length}function Wx(e){return Ux(JSON.stringify(e))}function Yx(){const e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function eo(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function nc(e,t){if(!Array.isArray(e))return"";const n=[];for(let r=0;r<e.length;r++){const a=e[r];Cs(a)?n.push(String(a)):a instanceof Error?n.push(a.message?`${a.name}: ${a.message}`:a.name):n.push(Vm(void 0,a))}return n.join(t)}function us(e,t,n=!1){return mn(e)?Ox(t)?t.test(e):mn(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function As(e,t=[],n=!1){for(const r of t)if(us(e,r,n))return!0;return!1}function Hx(){const e=Ce;return e.crypto||e.msCrypto}let ai;function qx(){return ba()*16}function At(e=Hx()){try{if(e!=null&&e.randomUUID)return $a(()=>e.randomUUID()).replace(/-/g,"")}catch{}return ai||(ai="10000000100040008000"+1e11),ai.replace(/[018]/g,t=>(t^(qx()&15)>>t/4).toString(16))}function Um(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}function zn(e){const{message:t,event_id:n}=e;if(t)return t;const r=Um(e);return r?r.type&&r.value?`${r.type}: ${r.value}
5`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function to(e,t,n){const r=e.exception=e.exception||{},a=r.values=r.values||[],i=a[0]=a[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function Un(e,t){const n=Um(e);if(!n)return;const r={type:"generic",handled:!0},a=n.mechanism;if(n.mechanism={...r,...a,...t},t&&"data"in t){const i={...a==null?void 0:a.data,...t.data};n.mechanism.data=i}}function rc(e){if(Gx(e))return!0;try{An(e,"__sentry_captured__",!0)}catch{}return!1}function Gx(e){try{return e.__sentry_captured__}catch{}}const Wm=1e3;function Is(){return Or()/Wm}function Xx(){const{performance:e}=Ce;if(!(e!=null&&e.now)||!e.timeOrigin)return Is;const t=e.timeOrigin;return()=>(t+$a(()=>e.now()))/Wm}let sc;function fn(){return(sc??(sc=Xx()))()}function Kx(e){const t=fn(),n={sid:At(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Qx(n)};return e&&wr(n,e),n}function wr(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||fn(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:At()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Jx(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),wr(e,n)}function Qx(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Ds(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const r={...e};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=Ds(r[a],t[a],n-1));return r}function ac(){return At()}function Ym(){return At().substring(16)}function Zx(e){try{const t=Ce.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Hm(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}const no="_sentrySpan";function ic(e,t){t?An(e,no,Zx(t)):delete e[no]}function oc(e){return Hm(e[no])}const ey=100;class Zt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ac(),sampleRand:ba()}}clone(){const t=new Zt;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,ic(t,oc(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&wr(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t,r=n instanceof Zt?n.getScopeData():vs(n)?t:void 0,{tags:a,attributes:i,extra:o,user:l,contexts:c,level:u,fingerprint:d=[],propagationContext:m,conversationId:p}=r||{};return this._tags={...this._tags,...a},this._attributes={...this._attributes,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...c},l&&Object.keys(l).length&&(this._user=l),u&&(this._level=u),d.length&&(this._fingerprint=d),m&&(this._propagationContext=m),p&&(this._conversationId=p),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,ic(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ac(),sampleRand:ba()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){var i;const r=typeof n=="number"?n:ey;if(r<=0)return this;const a={timestamp:Is(),...t,message:t.message?eo(t.message,2048):t.message};return this._breadcrumbs.push(a),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(i=this._client)==null||i.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:oc(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ds(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=(n==null?void 0:n.event_id)||At();if(!this._client)return xe&&me.warn("No client configured on scope - will not capture exception!"),r;const a=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:a,...n,event_id:r},this),r}captureMessage(t,n,r){const a=(r==null?void 0:r.event_id)||At();if(!this._client)return xe&&me.warn("No client configured on scope - will not capture message!"),a;const i=(r==null?void 0:r.syntheticException)??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:a},this),a}
5captureEvent(t,n){const r=t.event_id||(n==null?void 0:n.event_id)||At();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(xe&&me.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function ty(){return Pr("defaultCurrentScope",()=>new Zt)}function ny(){return Pr("defaultIsolationScope",()=>new Zt)}const lc=e=>e instanceof Promise&&!e[qm],qm=Symbol("chained PromiseLike"),ry=(e,t,n)=>{const r=e.then(a=>(t(a),a),a=>{throw n(a),a});return lc(r)&&lc(e)?r:sy(e,r)},sy=(e,t)=>{if(!t)return e;let n=!1;for(const r in e){if(r in t)continue;n=!0;const a=e[r];typeof a=="function"?Object.defineProperty(t,r,{value:(...i)=>a.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[r]=a}return n&&Object.assign(t,{[qm]:!0}),t};class ay{constructor(t,n){let r;t?r=t:r=new Zt;let a;n?a=n:a=new Zt,this._stack=[{scope:r}],this._isolationScope=a}withScope(t){const n=this._pushScope();let r;try{r=t(n)}catch(a){throw this._popScope(),a}return Ts(r)?ry(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function kr(){const e=Oa(),t=Ra(e);return t.stack=t.stack||new ay(ty(),ny())}function iy(e){return kr().withScope(e)}function oy(e,t){const n=kr();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function cc(e){return kr().withScope(()=>e(kr().getIsolationScope()))}function ly(){return{withIsolationScope:cc,withScope:iy,withSetScope:oy,withSetIsolationScope:(e,t)=>cc(t),getCurrentScope:()=>kr().getScope(),getIsolationScope:()=>kr().getIsolationScope()}}function Xo(e){const t=Ra(e);return t.acs?t.acs:ly()}function cy(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function uy(e,t){const{value:n,unit:r}=cy(e)?e:{value:e,unit:void 0},a=dy(n),i=r&&typeof r=="string"?{unit:r}:{};if(a)return{...a,...i};if(!t||t==="skip-undefined"&&n===void 0)return;let o="";try{o=JSON.stringify(n)??""}catch{}return{value:o,type:"string",...i}}function uc(e,t=!1){const n={};for(const[r,a]of Object.entries(e??{})){const i=uy(a,t);i&&(n[r]=i)}return n}function dy(e){if(Array.isArray(e))return{value:e,type:"array"};const t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}function gn(){const e=Oa();return Xo(e).getCurrentScope()}function Dn(){const e=Oa();return Xo(e).getIsolationScope()}function my(){return Pr("globalScope",()=>new Zt)}function fy(...e){const t=Oa(),n=Xo(t);if(e.length===2){const[r,a]=e;return r?n.withSetScope(r,a):n.withScope(a)}return n.withScope(e[0])}function ct(){return gn().getClient()}function py(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:a}=t,i={trace_id:n,span_id:a||Ym()};return r&&(i.parent_span_id=r),i}const hy="sentry.source",gy="sentry.sample_rate",xy="sentry.previous_trace_sample_rate",yy="sentry.op",by="sentry.origin",Gm="sentry.profile_id",Xm="sentry.exclusive_time",vy="gen_ai.conversation.id",wy=0,ky=1,_y="_sentryScope",jy="_sentryIsolationScope";function ro(e){const t=e;return{scope:t[_y],isolationScope:Hm(t[jy])}}const dc="sentry-";function Ny(e){const t=Sy(e);if(!t)return;const n=Object.entries(t).reduce((r,[a,i])=>{if(a.startsWith(dc)){const o=a.slice(dc.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function Sy(e){if(!(!e||!mn(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const r=mc(n);return Object.entries(r).forEach(([a,i])=>{t[a]=i}),t},{}):mc(e)}function mc(e){return e.split(",").map(t=>{const n=t.indexOf("=");if(n===-1)return[];const r=t.slice(0,n),a=t.slice(n+1);return[r,a].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}const Ey=/^o(\d+)\./,Cy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Ty(e){return e==="http"||e==="https"}function Ps(e,t=!1){const{host:n,path:r,pass:a,port:i,projectId:o,protocol:l,publicKey:c}=e;return`${l}://${c}${t&&a?`:${a}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Ay(e){const t=Cy.exec(e);if(!t){Mr(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,a="",i="",o="",l=""]=t.slice(1);let c="",u=l;const d=u.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),u=d.pop()),u){const m=u.match(/^\d+/);m&&(u=m[0])}return Km({host:i,pass:a,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Km(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Iy(e){if(!xe)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(me.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Ty(r)?t&&isNaN(parseInt(t,10))?(me.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(me.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(me.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Dy(e){const t=e.match(Ey);return t==null?void 0:t[1]}function Py(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=Dy(n)),r}function My(e){const t=typeof e=="string"?Ay(e):Km(e);if(!(!t||!Iy(t)))return t}function Ly(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const Jm=1;let fc=!1;function Oy(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),a=r?t:Ba(e).parent_span_id,i=ro(e).scope,o=r?(i==null?void 0:i.getPropagationContext().propagationSpanId)||Ym():t;return{parent_span_id:a,span_id:o,trace_id:n}}function Ry(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...a},attributes:i})=>({span_id:t,trace_id:n,sampled:r===Jm,attributes:i,...a}))}function pc(e){return typeof e=="number"?hc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?hc(e.getTime()):fn()}function hc(e){return e>9999999999?e/1e3:e}function Ba(e){if(By(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if($y(e)){const{attributes:r,startTime:a,name:i,endTime:o,status:l,links:c}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:Fy(e),start_timestamp:pc(a),timestamp:pc(o)||void 0,status:Uy(l),op:r[yy],origin:r[by],links:Ry(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Fy(e){var t;return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?(t=e.parentSpanContext)==null?void 0:t.spanId:void 0}function zy(e){var t;return{...e,attributes:uc(e.attributes),links:(t=e.links)==null?void 0:t.map(n=>({...n,attributes:uc(n.attributes)}))}}function $y(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function By(e){return typeof e.getSpanJSON=="function"}function Vy(e){const{traceFlags:t}=e.spanContext();return t===Jm}function Uy(e){if(!(!e||e.code===wy))return e.code===ky?"ok":e.message||"internal_error"}const Wy="_sentryRootSpan",Qm=Yy;function Yy(e){return e[Wy]||e}function gc(){fc||(Mr(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),fc=!0)}function xc(e){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||((n=ct())==null?void 0:n.getOptions());return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function yc(e){me.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function bc(e,t){if(!(t!=null&&t.length))return!1;for(const n of t){if(Gy(n)){if(e.description&&us(e.description,n))return xe&&yc(e),!0;continue}const r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;const a=n.name?e.description&&us(e.description,n.name):!0,i=n.op?e.op&&us(e.op,n.op):!0,o=n.attributes?Object.entries(n.attributes).every(([l,c])=>{var u;return Hy((u=e.attributes)==null?void 0:u[l],c)}):!0;if(a&&i&&o)return xe&&yc(e),!0}return!1}function Hy(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?us(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function qy(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const a of e)a.parent_span_id===r&&(a.parent_span_id=n)}function Gy(e){return typeof e=="string"||e instanceof RegExp}const Xy=Symbol.for("sentry.nonRecordingSpan");function Ky(e){return!!e&&e[Xy]===!0}const Ko="production",Jy="_frozenDsc";function Zm(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},a={environment:n.environment||Ko,release:n.release,public_key:r,trace_id:e,org_id:Py(t)};return t.emit("createDsc",a),a}function ef(e,t){const n=t.getPropagationContext();return n.dsc||Zm(n.traceId,e)}function Qy(e){var g;const t=ct();if(!t)return{};const n=Qm(e),r=Ba(n),a=r.data,i=n.spanContext().traceState,o=(i==null?void 0:i.get("sentry.sample_rate"))??a[gy]??a[xy];
5function l(x){return(typeof o=="number"||typeof o=="string")&&(x.sample_rate=`${o}`),x}const c=n[Jy];if(c)return l(c);if(Ky(n)&&!xc(t.getOptions())){const x=ro(n).scope;if(x)return l({...ef(t,x)})}const u=i==null?void 0:i.get("sentry.dsc"),d=u&&Ny(u);if(d)return l(d);const m=Zm(e.spanContext().traceId,t),p=a[hy]??a["sentry.span.source"],f=r.description;return p!=="url"&&f&&(m.transaction=f),xc()&&(m.sampled=String(Vy(n)),m.sample_rand=(i==null?void 0:i.get("sentry.sample_rand"))??((g=ro(n).scope)==null?void 0:g.getPropagationContext().sampleRand.toString())),l(m),t.emit("createDsc",m,n),m}function Zy(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function Rr(e,t=[]){return[e,t]}function vc(e,t){const[n,r]=e;return[n,[...r,t]]}function so(e,t){const n=e[1];for(const r of n){const a=r[0].type;if(t(r,a))return!0}return!1}function eb(e,t){return so(e,(n,r)=>t.includes(r))}function ao(e){const t=Ra(Ce);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function tb(e){const[t,n]=e;let r=JSON.stringify(t);function a(i){typeof r=="string"?r=typeof i=="string"?r+i:[ao(r),i]:r.push(typeof i=="string"?ao(i):i)}for(const i of n){const[o,l]=i;if(a(`
6${JSON.stringify(o)}
7`),typeof l=="string"||l instanceof Uint8Array)a(l);else{let c;try{c=JSON.stringify(l)}catch{c=JSON.stringify(cn(l))}a(c)}}return typeof r=="string"?r:nb(r)}function nb(e){const t=e.reduce((a,i)=>a+i.length,0),n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}function rb(e){const t=typeof e.data=="string"?ao(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}
7const tf={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function sb(e){return e in tf}function wc(e){return sb(e)?tf[e]:e}function nf(e){if(!(e!=null&&e.sdk))return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function ab(e,t,n,r){var i;const a=(i=e.sdkProcessingMetadata)==null?void 0:i.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Or()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Ps(r)},...a&&{trace:a}}}function ib(e,t){var r,a,i,o;if(!t)return e;const n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...((r=e.sdk)==null?void 0:r.integrations)||[],...t.integrations||[]],packages:[...((a=e.sdk)==null?void 0:a.packages)||[],...t.packages||[]],settings:(i=e.sdk)!=null&&i.settings||t.settings?{...(o=e.sdk)==null?void 0:o.settings,...t.settings}:void 0},e}function ob(e,t,n,r){const a=nf(n),i={sent_at:new Date(Or()).toISOString(),...a&&{sdk:a},...!!r&&t&&{dsn:Ps(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Rr(i,[o])}function lb(e,t,n,r){const a=nf(n),i=e.type&&e.type!=="replay_event"?e.type:"event";ib(e,n==null?void 0:n.sdk);const o=ab(e,a,r,t);return delete e.sdkProcessingMetadata,Rr(o,[[{type:i},e]])}function cb(e){return e.getOptions().traceLifecycle==="stream"}function ub(e,t){const{fingerprint:n,span:r,breadcrumbs:a,sdkProcessingMetadata:i}=t;db(e,t),r&&pb(e,r),hb(e,n),mb(e,a),fb(e,i)}function kc(e,t){const{extra:n,tags:r,attributes:a,user:i,contexts:o,level:l,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:m,attachments:p,propagationContext:f,transactionName:g,span:x}=t;Vr(e,"extra",n),Vr(e,"tags",r),Vr(e,"attributes",a),Vr(e,"user",i),Vr(e,"contexts",o),e.sdkProcessingMetadata=Ds(e.sdkProcessingMetadata,c,2),l&&(e.level=l),g&&(e.transactionName=g),x&&(e.span=x),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),m.length&&(e.eventProcessors=[...e.eventProcessors,...m]),p.length&&(e.attachments=[...e.attachments,...p]),e.propagationContext={...e.propagationContext,...f}}function Vr(e,t,n){e[t]=Ds(e[t],n,1)}function rf(e,t){const n=my().getScopeData();return e&&kc(n,e.getScopeData()),t&&kc(n,t.getScopeData()),n}function db(e,t){const{extra:n,tags:r,user:a,contexts:i,level:o,transactionName:l}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(a).length&&(e.user={...a,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),o&&(e.level=o),l&&e.type!=="transaction"&&(e.transaction=l)}function mb(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function fb(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function pb(e,t){e.contexts={trace:Oy(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Qy(t),...e.sdkProcessingMetadata};const n=Qm(t),r=Ba(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function hb(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function ii(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function gb(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",a=e.includes(";base64,"),i=e.indexOf(",");let o="";if(t&&i!==-1){const l=e.slice(i+1);o=l.length>10?`${l.slice(0,10)}... [truncated]`:l}return`data:${r}${a?",base64":""}${o?`,${o}`:""}`}return e}function sf(e,t){const n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,a])=>{a!=null&&!(r in n)&&(n[r]=a)})}const oi=0,_c=1,jc=2;function Ms(e){return new ws(t=>{t(e)})}function Jo(e){return new ws((t,n)=>{n(e)})}class ws{constructor(t){this._state=oi,this._handlers=[],this._runExecutor(t)}then(t,n){return new ws((r,a)=>{this._handlers.push([!1,i=>
7{if(!t)r(i);else try{r(t(i))}catch(o){a(o)}},i=>{if(!n)a(i);else try{r(n(i))}catch(o){a(o)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new ws((n,r)=>{let a,i;return this.then(o=>{i=!1,a=o,t&&t()},o=>{i=!0,a=o,t&&t()}).then(()=>{if(i){r(a);return}n(a)})})}_executeHandlers(){if(this._state===oi)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===_c&&n[1](this._value),this._state===jc&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(i,o)=>{if(this._state===oi){if(Ts(o)){o.then(r,a);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(_c,i)},a=i=>{n(jc,i)};try{t(r,a)}catch(i){a(i)}}}function xb(e,t,n,r=0){try{const a=io(t,n,e,r);return Ts(a)?a:Ms(a)}catch(a){return Jo(a)}}function io(e,t,n,r){const a=n[r];if(!e||!a)return e;const i=a({...e},t);return xe&&i===null&&me.log(`Event processor "${a.id||"?"}" dropped event`),Ts(i)?i.then(o=>io(o,t,n,r+1)):io(i,t,n,r+1)}let sn,Nc,Sc,wn;function yb(e){const t=Ce._sentryDebugIds,n=Ce._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],a=n?Object.keys(n):[];if(wn&&r.length===Nc&&a.length===Sc)return wn;Nc=r.length,Sc=a.length,wn={},sn||(sn={});const i=(o,l)=>{for(const c of o){const u=l[c],d=sn==null?void 0:sn[c];if(d&&wn&&u)wn[d[0]]=u,sn&&(sn[c]=[d[0],u]);else if(u){const m=e(c);for(let p=m.length-1;p>=0;p--){const f=m[p],g=f==null?void 0:f.filename;if(g&&wn&&sn){wn[g]=u,sn[c]=[g,u];break}}}}};return t&&i(r,t),n&&i(a,n),wn}function bb(e,t,n,r,a,i){const{normalizeDepth:o=3,normalizeMaxBreadth:l=1e3}=e,c={...t,event_id:t.event_id||n.event_id||At(),timestamp:t.timestamp||Is()},u=n.integrations||e.integrations.map(y=>y.name);vb(c,e),_b(c,u),a&&a.emit("applyFrameMetadata",t),t.type===void 0&&wb(c,e.stackParser);const d=Nb(r,n.captureContext);n.mechanism&&Un(c,n.mechanism);const m=a?a.getEventProcessors():[],p=rf(i,d),f=[...n.attachments||[],...p.attachments];f.length&&(n.attachments=f),ub(c,p);const g=[...m,...p.eventProcessors];return(n.data&&n.data.__sentry__===!0?Ms(c):xb(g,c,n)).then(y=>(y&&kb(y),typeof o=="number"&&o>0?jb(y,o,l):y))}function vb(e,t){var l,c;const{environment:n,release:r,dist:a,maxValueLength:i}=t;e.environment=e.environment||n||Ko,!e.release&&r&&(e.release=r),!e.dist&&a&&(e.dist=a);const o=e.request;o!=null&&o.url&&i&&(o.url=eo(o.url,i)),i&&((c=(l=e.exception)==null?void 0:l.values)==null||c.forEach(u=>{u.value&&(u.value=eo(u.value,i))}))}function wb(e,t){var r,a;const n=yb(t);(a=(r=e.exception)==null?void 0:r.values)==null||a.forEach(i=>{var o,l;(l=(o=i.stacktrace)==null?void 0:o.frames)==null||l.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function kb(e){var r,a;const t={};if((a=(r=e.exception)==null?void 0:r.values)==null||a.forEach(i=>{var o,l;(l=(o=i.stacktrace)==null?void 0:o.frames)==null||l.forEach(c=>{c.debug_id&&(c.abs_path?t[c.abs_path]=c.debug_id:c.filename&&(t[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([i,o])=>{n.push({type:"sourcemap",code_file:i,debug_id:o})})}function _b(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function jb(e,t,n){var a,i;if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:cn(o.data,t,n)}}))},...e.user&&{user:cn(e.user,t,n)},...e.contexts&&{contexts:cn(e.contexts,t,n)},...e.extra&&{extra:cn(e.extra,t,n)}};return(a=e.contexts)!=null&&a.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=cn(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(o=>({...o,...o.data&&{data:cn(o.data,t,n)}}))),(i=e.contexts)!=null&&i.flags&&r.contexts&&(r.contexts.flags=cn(e.contexts.flags,3,n)),r}function Nb(e,t){if(!t)return e;const n=e?e.clone():new Zt;return n.update(t),n}function Sb(e){if(e)return Eb(e)?{captureContext:e}:Tb(e)?{captureContext:e}:e}function Eb(e){return e instanceof Zt||typeof e=="function"}const Cb=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Tb(e){return Object.keys(e).some(t=>Cb.includes(t))}function af(e,t){return gn().captureException(e,Sb(t))}function of(e,t){return gn().captureEvent(e,t)}function Ab(e,t){Dn().setContext(e,t)}function Ec(e){const t=Dn(),{user:n}=rf(t,gn()),{userAgent:r}=Ce.navigator||{},a=Kx({user:n,...r&&{userAgent:r},...e}),i=t.getSession();return(i==null?void 0:i.status)==="ok"&&wr(i,{status:"exited"}),lf(),t.setSession(a),a}function lf(){const e=Dn(),n=gn().getSession()||e.getSession();n&&Jx(n),cf(),e.setSession()}function cf(){const e=Dn(),t=ct(),n=e.getSession();n&&t&&t.captureSession(n)}function li(e=!1){if(e){lf();return}cf()}const Ib="7";function Db(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function Pb(e){return`${Db(e)}${e.projectId}/envelope/`}function Mb(e,t){const n={sentry_version:Ib};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}
7function Lb(e,t,n){return t||`${Pb(e)}?${Mb(e,n)}`}const Cc=[];function Ob(e){const t={};return e.forEach(n=>{const{name:r}=n,a=t[r];a&&!a.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function Rb(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(a=>{a.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){const a=n(t);r=Array.isArray(a)?a:[a]}else r=t;return Ob(r)}function Fb(e,t){const n={};return t.forEach(r=>{r!=null&&r.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&uf(e,r,n)}),n}function Tc(e,t){for(const n of t)n!=null&&n.afterAllSetup&&n.afterAllSetup(e)}function uf(e,t,n){if(n[t.name]){xe&&me.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Cc.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Cc.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(a,i)=>r(a,i,e))}if(typeof t.processEvent=="function"){const r=t.processEvent.bind(t),a=Object.assign((i,o)=>r(i,o,e),{id:t.name});e.addEventProcessor(a)}["processSpan","processSegmentSpan"].forEach(r=>{const a=t[r];typeof a=="function"&&e.on(r,i=>a.call(t,i,e))}),xe&&me.log(`Integration installed: ${t.name}`)}function zb(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function $b(){/*! __SENTRY_SDK_SOURCE__ */return"npm"}function Bb(){return!zb()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Qo(){return typeof window<"u"&&(!Bb()||Vb())}function Vb(){const e=Ce.process;return(e==null?void 0:e.type)==="renderer"}function Ub(e,t){const n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Qo()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Wb(e,t,n,r,a){const i={};return t!=null&&t.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ps(r)),Rr(i,[Ub(e,a)])}function oo(e,t){const n=t??Yb(e)??[];if(n.length===0)return;const r=e.getOptions(),a=Wb(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);df().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(a)}function Yb(e){return df().get(e)}function df(){return Pr("clientToLogBufferMap",()=>new WeakMap)}function Hb(e,t){const n=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Qo()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function qb(e,t,n,r,a){const i={};return t!=null&&t.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ps(r)),Rr(i,[Hb(e,a)])}function mf(e,t){const n=t??Gb(e)??[];if(n.length===0)return;const r=e.getOptions(),a=qb(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);ff().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(a)}function Gb(e){return ff().get(e)}function ff(){return Pr("clientToMetricBufferMap",()=>new WeakMap)}function Xb(e){const t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status==="ok"||e.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...e.data},links:e.links};return zy(t)}function Kb(e,t){var i,o,l;if(e.type!=="transaction"||!((i=e.spans)!=null&&i.length)||!((o=e.sdkProcessingMetadata)!=null&&o.hasGenAiSpans)||!t.getOptions().streamGenAiSpans||cb(t))return;const n=[],r=[];for(const c of e.spans)(l=c.op)!=null&&l.startsWith("gen_ai.")?n.push(Xb(c)):r.push(c);if(n.length===0)return;e.spans=r;const a=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Qo()&&{ingest_settings:{infer_ip:a,infer_user_agent:a}},items:n}]}function pf(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const Zo=Symbol.for("SentryBufferFullError");function el(e=100){const t=new Set;function n(){return t.size<e}function r(o){t.delete(o)}function a(o){if(!n())return Jo(Zo);const l=o();return t.add(l),l.then(()=>r(l),()=>r(l)),l}function i(o){if(!t.size)return Ms(!0);const l=Promise.allSettled(Array.from(t)).then(()=>!0);if(!o)return l;const c=[l,new Promise(u=>pf(setTimeout(()=>u(!1),o)))];return Promise.race(c)}return{get $(){return Array.from(t)},add:a,drain:i}}const Jb=60*1e3;function Qb(e,t=Or()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${e}`);return isNaN(r)?Jb:r-t}function Zb(e,t){return e[t]||e.all||0}function ev(e,t,n=Or()){return Zb(e,t)>n}function tv(e,{statusCode:t,headers:n},r=Or()){const a={...e},i=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(i)for(const l of i.trim().split(",")){const[c,u,,,d]=l.split(":",5),m=parseInt(c,10),p=(isNaN(m)?60:m)*1e3;if(!u)a.all=r+p;else for(const f of u.split(";"))f==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(a[f]=r+p):a[f]=r+p}else o?a.all=r+Qb(o,r):t===429&&(a.all=r+60*1e3);return a}const hf=64;function nv(e,t,n=el(e.bufferSize||hf)){let r={};const a=o=>n.drain(o);function i(o){const l=[];
7if(so(o,(m,p)=>{const f=wc(p);ev(r,f)?e.recordDroppedEvent("ratelimit_backoff",f):l.push(m)}),l.length===0)return Promise.resolve({});const c=Rr(o[0],l),u=m=>{if(eb(c,["client_report"])){xe&&me.warn(`Dropping client report. Will not send outcomes (reason: ${m}).`);return}so(c,(p,f)=>{e.recordDroppedEvent(m,wc(f))})},d=()=>t({body:tb(c)}).then(m=>m.statusCode===413?(xe&&me.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),m):(xe&&m.statusCode!==void 0&&(m.statusCode<200||m.statusCode>=300)&&me.warn(`Sentry responded with status code ${m.statusCode} to sent event.`),r=tv(r,m),m),m=>{throw u("network_error"),xe&&me.error("Encountered error running transport request:",m),m});return n.add(d).then(m=>m,m=>{if(m===Zo)return xe&&me.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw m})}return{send:i,flush:a}}function rv(e,t,n){const r=[{type:"client_report"},{timestamp:Is(),discarded_events:e}];return Rr(t?{dsn:t}:{},[r])}function gf(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n!=null&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function sv(e){var c;const{trace_id:t,parent_span_id:n,span_id:r,status:a,origin:i,data:o,op:l}=((c=e.contexts)==null?void 0:c.trace)??{};return{data:o??{},description:e.transaction,op:l,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:a,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:o==null?void 0:o[Gm],exclusive_time:o==null?void 0:o[Xm],measurements:e.measurements,is_segment:!0}}function av(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Gm]:e.profile_id},...e.exclusive_time&&{[Xm]:e.exclusive_time}}}},measurements:e.measurements}}const Vs=["forwarded","-ip","remote-","via","-user"];function iv(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Vs},httpHeaders:{request:{deny:Vs},response:{deny:Vs}},httpBodies:[],queryParams:{deny:Vs},genAI:{inputs:!1,outputs:!1},stackFrameVariables:!0,frameContextLines:7}}const ov={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5};function lv(e){var r,a,i,o;const t=e.dataCollection!=null?ov:iv(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:((r=n.httpHeaders)==null?void 0:r.request)??t.httpHeaders.request,response:((a=n.httpHeaders)==null?void 0:a.response)??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,queryParams:n.queryParams??t.queryParams,genAI:{inputs:((i=n.genAI)==null?void 0:i.inputs)??t.genAI.inputs,outputs:((o=n.genAI)==null?void 0:o.outputs)??t.genAI.outputs},stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}const Ac="Not capturing exception because it's already been captured.",Ic="Discarded session because of missing or non-string release",xf=Symbol.for("SentryInternalError"),yf=Symbol.for("SentryDoNotSendEventError"),cv=5e3;function ra(e){return{message:e,[xf]:!0}}function ci(e){return{message:e,[yf]:!0}}function Dc(e){return!!e&&typeof e=="object"&&xf in e}function Pc(e){return!!e&&typeof e=="object"&&yf in e}function Mc(e,t,n,r,a){let i=0,o,l=!1;e.on(n,()=>{i=0,clearTimeout(o),l=!1}),e.on(t,c=>{if(i+=r(c),i>=8e5)a(e);else if(!l){const u=e.getOptions()._flushInterval??cv;u>0&&(l=!0,o=pf(setTimeout(()=>{a(e)},u)))}}),e.on("flush",()=>{a(e)})}class uv{constructor(t){var r,a,i;if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=el(((r=t.transportOptions)==null?void 0:r.bufferSize)??hf),this._dataCollection=lv(t),t.dsn?this._dsn=My(t.dsn):xe&&me.warn("No DSN provided, client will not send events."),this._dsn){const o=Lb(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:o})}this._options.enableLogs=this._options.enableLogs??((a=this._options._experiments)==null?void 0:a.enableLogs),this._options.enableLogs&&Mc(this,"afterCaptureLog","flushLogs",pv,oo),(this._options.enableMetrics??((i=this._options._experiments)==null?void 0:i.enableMetrics)??!0)&&Mc(this,"afterCaptureMetric","flushMetrics",fv,mf)}captureException(t,n,r){const a=At();if(rc(t))return xe&&me.log(Ac),a;const i={event_id:a,...n};return this._process(()=>this.eventFromException(t,i).then(o=>this._captureEvent(o,i,r)).then(o=>o),"error"),i.event_id}captureMessage(t,n,r,a){const i={event_id:At(),...r},o=qo(t)?t:String(t),l=Cs(t),c=l?this.eventFromMessage(o,n,i):this.eventFromException(t,i);return this._process(()=>c.then(u=>this._captureEvent(u,i,a)),l?"unknown":"error"),i.event_id}captureEvent(t,n,r){const a=At();if(n!=null&&n.originalException&&rc(n.originalException))return xe&&me.log(Ac),a;const i={event_id:a,...n},o=t.sdkProcessingMetadata||{},l=o.capturedSpanScope,c=o.capturedSpanIsolationScope,u=Lc(t.type);return this._process(()=>this._captureEvent(t,i,l||r,c),u),i.event_id}captureSession(t){this.sendSession(t),wr(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;
7if(this.emit("flush"),!n)return!0;const r=await this._isClientDoneProcessing(t),a=await n.flush(t);return r&&a}async close(t){oo(this);const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(t){const n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),uf(this,t,this._integrations),n||Tc(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);const r=Kb(t,this);let a=lb(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])a=vc(a,rb(i));r&&(a=vc(a,r)),this.sendEnvelope(a).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){const{release:n,environment:r=Ko}=this._options;if("aggregates"in t){const i=t.attrs||{};if(!i.release&&!n){xe&&me.warn(Ic);return}i.release=i.release||n,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!n){xe&&me.warn(Ic);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);const a=ob(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(a)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){const a=`${t}:${n}`;xe&&me.log(`Recording outcome: "${a}"${r>1?` (${r} times)`:""}`),this._outcomes[a]=(this._outcomes[a]||0)+r}}on(t,n){const r=this._hooks[t]=this._hooks[t]||new Set,a=(...i)=>n(...i);return r.add(a),()=>{r.delete(a)}}emit(t,...n){const r=this._hooks[t];r&&r.forEach(a=>a(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return xe&&me.error("Error while sending envelope:",n),{}}return xe&&me.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=Fb(this,t),Tc(this,t)}_updateSessionFromEvent(t,n){var c,u;let r=n.level==="fatal",a=!1;const i=(c=n.exception)==null?void 0:c.values;if(i){a=!0,r=!1;for(const d of i)if(((u=d.mechanism)==null?void 0:u.handled)===!1){r=!0;break}}const o=t.status==="ok";(o&&t.errors===0||o&&r)&&(wr(t,{...r&&{status:"crashed"},errors:t.errors||Number(a||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,a){const i=this.getOptions(),o=this.getIntegrationNames();return!n.integrations&&o.length&&(n.integrations=o),this.emit("preprocessEvent",t,n),t.type||a.setLastEventId(t.event_id||n.event_id),bb(i,t,n,r,this,a).then(l=>{var u;if(l===null)return l;this.emit("postprocessEvent",l,n),l.contexts={trace:{...(u=l.contexts)==null?void 0:u.trace,...py(r)},...l.contexts};const c=ef(this,r);return l.sdkProcessingMetadata={dynamicSamplingContext:c,...l.sdkProcessingMetadata},l})}_captureEvent(t,n={},r=gn(),a=Dn()){return xe&&lo(t)&&me.log(`Captured error event \`${gf(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,a).then(i=>i.event_id,i=>{xe&&(Pc(i)?me.log(i.message):Dc(i)?me.warn(i.message):me.warn(i))})}_processEvent(t,n,r,a){const i=this.getOptions(),{sampleRate:o}=i,l=bf(t),c=lo(t),d=`before send for type \`${t.type||"error"}\``,m=typeof o>"u"?void 0:Ly(o);if(c&&typeof m=="number"&&ba()>m)return this.recordDroppedEvent("sample_rate","error"),Jo(ci(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const p=Lc(t.type);return this._prepareEvent(t,n,r,a).then(f=>{var b;if(f===null)throw this.recordDroppedEvent("event_processor",p),ci("An event processor returned `null`, will not send event.");if(((b=n.data)==null?void 0:b.__sentry__)===!0)return f;const x=mv(this,i,f,n);return dv(x,d)}).then(f=>{var b;if(f===null){if(this.recordDroppedEvent("before_send",p),l){const j=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",j)}throw ci(`${d} returned \`null\`, will not send event.`)}const g=r.getSession()||a.getSession();if(c&&g&&this._updateSessionFromEvent(g,f),l){const y=((b=f.sdkProcessingMetadata)==null?void 0:b.spanCountBeforeProcessing)||0,j=f.spans?f.spans.length:0,v=y-j;v>0&&this.recordDroppedEvent("before_send","span",v)}const x=f.transaction_info;if(l&&x&&f.transaction!==t.transaction){const y="custom";f.transaction_info={...x,source:y}}return this.sendEvent(f,n),f}).then(null,f=>{throw Pc(f)||Dc(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),ra(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
8Reason: ${f}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Zo&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{const[a,i]=n.split(":");return{reason:a,category:i,quantity:r}})}_flushOutcomes(){xe&&me.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){xe&&me.log("No outcomes to send");return}if(!this._dsn){xe&&me.log("No dsn provided, will not send outcomes");return}xe&&me.log("Sending outcomes:",t);const n=rv(t,this._options.tunnel&&Ps(this._dsn));this.sendEnvelope(n)}}function Lc(e){return e==="replay_event"?"replay":e||"error"}function dv(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Ts(e))return e.then(r=>{if(!vs(r)&&r!==null)throw ra(n);return r},r=>{throw ra(`${t} rejected with ${r}`)});if(!vs(e)&&e!==null)throw ra(n);return e}function mv(e,t,n,r){const{beforeSend:a,beforeSendTransaction:i,ignoreSpans:o}=t,l=!Zy(t.beforeSendSpan)&&t.beforeSendSpan;let c=n;if(lo(c)&&a)return a(c,r);if(bf(c)){if(l||o){const u=sv(c);if(o!=null&&o.length&&bc({description:u.description,op:u.op,attributes:u.data},o))return null;if(l){const d=l(u);d?c=Ds(n,av(d)):gc()}if(c.spans){const d=[],m=c.spans;for(const f of m){if(o!=null&&o.length&&bc({description:f.description,op:f.op,attributes:f.data},o)){qy(m,f);continue}if(l){const g=l(f);g?d.push(g):(gc(),d.push(f))}else d.push(f)}const p=c.spans.length-d.length;p&&e.recordDroppedEvent("before_send","span",p),c.spans=d}}if(i){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return i(c,r)}}return c}function lo(e){return e.type===void 0}function bf(e){return e.type==="transaction"}function fv(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+vf(e.attributes)}function pv(e){let t=0;return e.message&&(t+=e.message.length*2),t+vf(e.attributes)}function vf(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*Oc(n[0]):Cs(n)?t+=Oc(n):t+=100}),t}function Oc(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function hv(e,t){t.debug===!0&&(xe?me.enable():Mr(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),gn().update(t.initialScope);const r=new e(t);return gv(r),r.init(),r}
vendor: 4,255 bytes, lines 8-15
8function gv(e){gn().setClient(e)}function xv(e){var t;"aggregates"in e?((t=e.attrs)==null?void 0:t.ip_address)===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function wf(e,t,n=[t],r="npm"){const a=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};a.name||(a.name=`sentry.javascript.${t}`,a.packages=n.map(i=>({name:`${r}:@sentry/${i}`,version:Vn})),a.version=Vn)}const yv=100;function qn(e,t){const n=ct(),r=Dn();if(!n)return;const{beforeBreadcrumb:a=null,maxBreadcrumbs:i=yv}=n.getOptions();if(i<=0)return;const l={timestamp:Is(),...e},c=a?Mr(()=>a(l,t)):l;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,t),r.addBreadcrumb(c,i))}let Rc;const bv="FunctionToString",Fc=new WeakMap,vv=()=>({name:bv,setupOnce(){Rc=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Go(this),n=Fc.has(ct())&&t!==void 0?t:this;return Rc.apply(n,e)}}catch{}},setup(e){Fc.set(e,!0)}}),wv=vv,kv=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],_v="EventFilters",jv=(e={})=>{let t;return{name:_v,setup(n){const r=n.getOptions();t=zc(e,r)},processEvent(n,r,a){if(!t){const i=a.getOptions();t=zc(e,i)}return Sv(n,t)?null:n}}},Nv=(e={})=>({...jv(e),name:"InboundFilters"});function zc(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:kv],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Sv(e,t){if(e.type){if(e.type==="transaction"&&Cv(e,t.ignoreTransactions))return xe&&me.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
9Event: ${zn(e)}`),!0}else{if(Ev(e,t.ignoreErrors))return xe&&me.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
10Event: ${zn(e)}`),!0;if(Dv(e))return xe&&me.warn(`Event dropped due to not having an error message, error type or stacktrace.
11Event: ${zn(e)}`),!0;if(Tv(e,t.denyUrls))return xe&&me.warn(`Event dropped due to being matched by \`denyUrls\` option.
12Event: ${zn(e)}.
13Url: ${va(e)}`),!0;if(!Av(e,t.allowUrls))return xe&&me.warn(`Event dropped due to not being matched by \`allowUrls\` option.
14Event: ${zn(e)}.
15Url: ${va(e)}`),!0}return!1}function Ev(e,t){return t!=null&&t.length?gf(e).some(n=>As(n,t)):!1}function Cv(e,t){if(!(t!=null&&t.length))return!1;const n=e.transaction;return n?As(n,t):!1}function Tv(e,t){if(!(t!=null&&t.length))return!1;const n=va(e);return n?As(n,t):!1}function Av(e,t){if(!(t!=null&&t.length))return!0;const n=va(e);return n?As(n,t):!0}function Iv(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function va(e){var t,n;try{const r=[...((t=e.exception)==null?void 0:t.values)??[]].reverse().find(i=>{var o,l,c;return((o=i.mechanism)==null?void 0:o.parent_id)===void 0&&((c=(l=i.stacktrace)==null?void 0:l.frames)==null?void 0:c.length)}),a=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return a?Iv(a):null}catch{return xe&&me.error(`Cannot extract url for event ${zn(e)}`),null}}function Dv(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)!=null&&n.length?!e.message&&!e.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function Pv(e,t,n,r,a,i){var l;if(!((l=a.exception)!=null&&l.values)||!i||!vr(i.originalException,Error))return;const o=a.exception.values.length>0?a.exception.values[a.exception.values.length-1]:void 0;o&&(a.exception.values=co(e,t,r,i.originalException,n,a.exception.values,o,0))}function co(e,t,n,r,a,i,o,l){if(i.length>=n+1)return i;let c=[...i];if(vr(r[a],Error)){$c(o,l,r);const u=e(t,r[a]),d=c.length;Bc(u,a,d,l),c=co(e,t,n,r[a],a,[u,...c],u,d)}
15return kf(r)&&r.errors.forEach((u,d)=>{if(vr(u,Error)){$c(o,l,r);const m=e(t,u),p=c.length;Bc(m,`errors[${d}]`,p,l),c=co(e,t,n,u,a,[m,...c],m,p)}}),c}function kf(e){return Array.isArray(e.errors)}function $c(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...kf(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Bc(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Mv(e){return Fa(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function Vc(e){return Mv(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}const Uc=new Set([]);function Lv(e){const t="console",n=ar(t,e);return ir(t,Ov),n}function Ov(){"console"in Ce&&kx.forEach(function(e){e in Ce.console&&Nt(Ce.console,e,function(t){return ya[e]=t,function(...n){const r=n[0],a=ya[e],i=Uc.size&&typeof r=="string"&&As(r,Uc);i||$t("console",{args:n,level:e}),(!i||xe&&me.isEnabled())&&(a==null||a.apply(Ce.console,n))}})})}function Rv(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const Fv="Dedupe",zv=()=>{let e;return{name:Fv,processEvent(t){if(t.type)return t;try{if(Bv(t,e))return xe&&me.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},$v=zv;function Bv(e,t){return t?!!(Vv(e,t)||Uv(e,t)):!1}function Vv(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!jf(e,t)||!_f(e,t))}function Uv(e,t){const n=Wc(t),r=Wc(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!jf(e,t)||!_f(e,t))}function _f(e,t){let n=Ql(e),r=Ql(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let a=0;a<r.length;a++){const i=r[a],o=n[a];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function jf(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function Wc(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}const Wv="ConversationId",Yv=()=>({name:Wv,setup(e){e.on("spanStart",t=>{const n=gn().getScopeData(),r=Dn().getScopeData(),a=n.conversationId||r.conversationId;if(a){const{op:i,data:o,description:l}=Ba(t);if(!(i!=null&&i.startsWith("gen_ai."))&&!o["ai.operationId"]&&!(l!=null&&l.startsWith("ai.")))return;t.setAttribute(vy,a)}})}}),Hv=Yv;function Nf(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const ks=Ce;function qv(){return"history"in ks&&!!ks.history}function Gv(){if(!("fetch"in ks))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function uo(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Xv(){var n;if(typeof EdgeRuntime=="string")return!0;if(!Gv())return!1;if(uo(ks.fetch))return!0;let e=!1;const t=ks.document;if(t&&typeof t.createElement=="function")try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(e=uo(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){xe&&me.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}function Kv(e,t){const n="fetch",r=ar(n,e);return ir(n,()=>Jv(void 0,t)),r}function Jv(e,t=!1){t&&!Xv()||Nt(Ce,"fetch",function(n){return function(...r){const a=new Error,{method:i,url:o}=Qv(r),l={args:r,fetchData:{method:i,url:o},startTimestamp:fn()*1e3,virtualError:a,headers:Zv(r)};return $t("fetch",{...l}),n.apply(Ce,r).then(async c=>($t("fetch",{...l,endTimestamp:fn()*1e3,response:c}),c),c=>{$t("fetch",{...l,endTimestamp:fn()*1e3,error:c}),Fa(c)&&c.stack===void 0&&(c.stack=a.stack,An(c,"framesToPop",1));const u=ct(),d=(u==null?void 0:u.getOptions().enhanceFetchErrorMessages)??"always";if(d!==!1&&c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const f=new URL(l.fetchData.url).host;d==="always"?c.message=`${c.message} (${f})`:An(c,"__sentry_fetch_url_host__",f)}catch{}throw c})}})}function sa(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Yc(e){return typeof e=="string"?e:e?sa(e,"url")?e.url:e.toString?e.toString():"":""}function Qv(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:Yc(n),method:sa(r,"method")?String(r.method).toUpperCase():Rm(n)&&sa(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Yc(t),method:sa(t,"method")?String(t.method).toUpperCase():"GET"}}function Zv(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Rm(t))return new Headers(t.headers)}catch{}}const Sf=Ce;function tl(){try{return Sf.document.location.href}catch{return""}}function e0(e,t=5){if(!Sf.HTMLElement)return null;let n=e;for(let r=0;r<t;r++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}const Ue=Ce;let mo=0;function Ef(){return mo>0}function t0(){mo++,setTimeout(()=>{mo--}
15)}function _r(e,t={}){function n(a){return typeof a=="function"}if(!n(e))return e;try{if(Object.prototype.hasOwnProperty.call(e,"__sentry_wrapped__")){const i=e.__sentry_wrapped__;return typeof i=="function"?i:e}if(Go(e))return e}catch{return e}const r=function(...a){Ce._sentryWrappedDepth=(Ce._sentryWrappedDepth||0)+1;try{const i=a.map(o=>_r(o,t));return e.apply(this,i)}catch(i){throw t0(),fy(o=>{o.addEventProcessor(l=>(t.mechanism&&(to(l,void 0),Un(l,t.mechanism)),l.extra={...l.extra,arguments:a},l)),af(i)}),i}finally{Ce._sentryWrappedDepth=(Ce._sentryWrappedDepth||0)-1}};try{for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a])}catch{}Fm(r,e),An(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function Hc(){const e=tl(),{referrer:t}=Ue.document||{},{userAgent:n}=Ue.navigator||{},r={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:r}}function nl(e,t){const n=Va(e,t),r={type:i0(t),value:o0(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function n0(e,t,n,r){const a=ct(),i=a==null?void 0:a.getOptions().normalizeDepth,o=m0(t),l={__serialized__:Bm(t,i)};if(o)return{exception:{values:[nl(e,o)]},extra:l};const c={exception:{values:[{type:za(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:u0(t,{isUnhandledRejection:r})}]},extra:l};if(n){const u=Va(e,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function ui(e,t){return{exception:{values:[nl(e,t)]}}}function Va(e,t){const n=t.stacktrace||t.stack||"",r=s0(t),a=a0(t);try{return e(n,r,a)}catch{}return[]}const r0=/Minified React error #\d+;/i;function s0(e){return e&&r0.test(e.message)?1:0}function a0(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Cf(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function i0(e){const t=e==null?void 0:e.name;return!t&&Cf(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function o0(e){const t=e==null?void 0:e.message;return Cf(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Vc(t.error):Vc(e):"No error message"}function l0(e,t,n,r){const a=(n==null?void 0:n.syntheticException)||void 0,i=rl(e,t,a,r);return Un(i),i.level="error",n!=null&&n.event_id&&(i.event_id=n.event_id),Ms(i)}function c0(e,t,n="info",r,a){const i=(r==null?void 0:r.syntheticException)||void 0,o=fo(e,t,i,a);return o.level=n,r!=null&&r.event_id&&(o.event_id=r.event_id),Ms(o)}function rl(e,t,n,r,a){var o,l;let i;if(Om(t)&&t.error)return ui(e,t.error);if(ec(t)||Lx(t)){const c=t;if("stack"in t){i=ui(e,t);const u=(l=(o=i.exception)==null?void 0:o.values)==null?void 0:l[0];if(r&&n&&u&&!u.stacktrace){const d=Va(e,n);d.length&&(u.stacktrace={frames:d},Un(i,{synthetic:!0}))}}else{const u=c.name||(ec(c)?"DOMError":"DOMException"),d=c.message?`${u}: ${c.message}`:u;i=fo(e,d,n,r),to(i,d)}return"code"in c&&(i.tags={...i.tags,"DOMException.code":`${c.code}`}),i}return Fa(t)?ui(e,t):vs(t)||za(t)?(i=n0(e,t,n,a),Un(i,{synthetic:!0}),i):(i=fo(e,t,n,r),to(i,`${t}`),Un(i,{synthetic:!0}),i)}function fo(e,t,n,r){const a={};if(r&&n){const i=Va(e,n);i.length&&(a.exception={values:[{value:t,stacktrace:{frames:i}}]}),Un(a,{synthetic:!0})}if(qo(t)){const{__sentry_template_string__:i,__sentry_template_values__:o}=t;return a.logentry={message:i,params:o},a}return a.message=t,a}function u0(e,{isUnhandledRejection:t}){const n=Rx(e),r=t?"promise rejection":"exception";return Om(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:za(e)?`Event \`${d0(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function d0(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function m0(e){return Object.values(e).find(t=>t instanceof Error)}class f0 extends uv{constructor(t){var d;const n=p0(t),r=Ue.SENTRY_SDK_SOURCE||$b();wf(n,"browser",["browser"],r),super(n);const{userInfo:a}=this.getDataCollectionOptions();(d=n._metadata)!=null&&d.sdk&&(n._metadata.sdk.settings={infer_ip:a?"auto":"never",...n._metadata.sdk.settings});const{sendClientReports:i,enableLogs:o,_experiments:l,enableMetrics:c}=this._options,u=c??(l==null?void 0:l.enableMetrics)??!0;Ue.document&&(i||o||u)&&Ue.document.addEventListener("visibilitychange",()=>{Ue.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),o&&oo(this),u&&mf(this))}),a&&this.on("beforeSendSession",xv)}eventFromException(t,n){return l0(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return c0(this._options.stackParser,t,n,r,this._options.attachStacktrace)}_prepareEvent(t,n,r,a){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r,a)}}function p0(e){var t;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(t=Ue.SENTRY_RELEASE)==null?void 0:t.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const h0=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ft=Ce,g0=80,On={};try{typeof Node<"u"&&(On.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,"parentNode").get),typeof Element<"u"&&(On.tagName=Object.getOwnPropertyDescriptor(Element.prototype,"tagName").get,On.id=Object.getOwnPropertyDescriptor(Element.prototype,"id").get,On.className=Object.getOwnPropertyDescriptor(Element.prototype,"className").get,On.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<"u"&&(On.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset").get)}catch{}function En(e,t,n){const r=On[t];if(r)try{return r.call(e,n)}catch{}const a=e[t];return typeof a=="function"?a.call(e,n):a}function Tf(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,a=[];let i=0,o=0;const l=" > ",c=l.length;let u;const d=Array.isArray(t)?t:t.keyAttrs,m=!Array.isArray(t)&&t.maxStringLength||g0;for(;n&&i++<r&&(u=x0(n,d),!(u==="html"||i>1&&o+a.length*c+u.length>=m));)a.push(u),o+=u.length,n=En(n,"parentNode");return a.reverse().join(l)}catch{return"<unknown>"}}function x0(e,t){const n=[],r=En(e,"tagName");if(!r)return"";if(typeof HTMLElement<"u"&&e instanceof HTMLElement){const i=En(e,"dataset");if(i){if(i.sentryComponent)return i.sentryComponent;if(i.sentryElement)return i.sentryElement}}n.push(r.toLowerCase());const a=t!=null&&t.length?t.filter(i=>En(e,"getAttribute",i)).map(i=>[i,En(e,"getAttribute",i)]):null;
vendor: 4,456 bytes, line 15
15if(a!=null&&a.length)a.forEach(i=>{n.push(`[${i[0]}="${i[1]}"]`)});else{const i=En(e,"id");i&&n.push(`#${i}`);const o=En(e,"className");if(o&&mn(o)){const l=o.split(/\s+/);for(const c of l)n.push(`.${c}`)}}for(const i of["aria-label","type","name","title","alt"]){const o=En(e,"getAttribute",i);o&&n.push(`[${i}="${o}"]`)}return n.join("")}const y0=1e3;let qc,po,ho;function b0(e){const t="dom";ar(t,e),ir(t,v0)}function v0(){if(!ft.document)return;const e=$t.bind(null,"dom"),t=Gc(e,!0);ft.document.addEventListener("click",t,!1),ft.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{var i,o;const a=(i=ft[n])==null?void 0:i.prototype;(o=a==null?void 0:a.hasOwnProperty)!=null&&o.call(a,"addEventListener")&&(Nt(a,"addEventListener",function(l){return function(c,u,d){if(c==="click"||c=="keypress")try{const m=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=m[c]=m[c]||{refCount:0};if(!p.handler){const f=Gc(e);p.handler=f,l.call(this,c,f,d)}p.refCount++}catch{}return l.call(this,c,u,d)}}),Nt(a,"removeEventListener",function(l){return function(c,u,d){if(c==="click"||c=="keypress")try{const m=this.__sentry_instrumentation_handlers__||{},p=m[c];p&&(p.refCount--,p.refCount<=0&&(l.call(this,c,p.handler,d),p.handler=void 0,delete m[c]),Object.keys(m).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return l.call(this,c,u,d)}}))})}function w0(e){if(e.type!==po)return!1;try{if(!e.target||e.target._sentryId!==ho)return!1}catch{}return!0}function k0(e,t){return e!=="keypress"?!1:t!=null&&t.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function Gc(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=_0(n);if(k0(n.type,r))return;An(n,"_sentryCaptured",!0),r&&!r._sentryId&&An(r,"_sentryId",At());const a=n.type==="keypress"?"input":n.type;w0(n)||(e({event:n,name:a,global:t}),po=n.type,ho=r?r._sentryId:void 0),clearTimeout(qc),qc=ft.setTimeout(()=>{ho=void 0,po=void 0},y0)}}function _0(e){try{return e.target}catch{return null}}let Us;function Af(e){const t="history";ar(t,e),ir(t,j0)}function j0(){if(ft.addEventListener("popstate",()=>{const t=ft.location.href,n=Us;if(Us=t,n===t)return;$t("history",{from:n,to:t})}),!qv())return;function e(t){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const a=Us,i=N0(String(r));if(Us=i,a===i)return t.apply(this,n);$t("history",{from:a,to:i})}return t.apply(this,n)}}Nt(ft.history,"pushState",e),Nt(ft.history,"replaceState",e)}function N0(e){try{return new URL(e,ft.location.origin).toString()}catch{return e}}const aa={};function S0(e){const t=aa[e];if(t)return t;let n=ft[e];if(uo(n))return aa[e]=n.bind(ft);const r=ft.document;if(r&&typeof r.createElement=="function")try{const a=r.createElement("iframe");a.hidden=!0,r.head.appendChild(a);const i=a.contentWindow;i!=null&&i[e]&&(n=i[e]),r.head.removeChild(a)}catch(a){h0&&me.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,a)}return n&&(aa[e]=n.bind(ft))}function E0(e){aa[e]=void 0}const ls="__sentry_xhr_v3__";function C0(e){const t="xhr";ar(t,e),ir(t,T0)}function T0(){if(!ft.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){const a=new Error,i=fn()*1e3,o=mn(r[0])?r[0].toUpperCase():void 0,l=A0(r[1]);if(!o||!l)return t.apply(n,r);n[ls]={method:o,url:l,request_headers:{}},o==="POST"&&l.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[ls];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:fn()*1e3,startTimestamp:i,xhr:n,virtualError:a};$t("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,m){return c(),u.apply(d,m)}}):n.addEventListener("readystatechange",c),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,m){const[p,f]=m,g=d[ls];return g&&mn(p)&&mn(f)&&(g.request_headers[p.toLowerCase()]=f),u.apply(d,m)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){const a=n[ls];if(!a)return t.apply(n,r);r[0]!==void 0&&(a.body=r[0]);const i={startTimestamp:fn()*1e3,xhr:n};return $t("xhr",i),t.apply(n,r)}})}function A0(e){if(mn(e))return e;try{return e.toString()}catch{}}function I0(e){if(typeof Element>"u")return!1;try{return e instanceof Element}catch{return!1}}const D0=40;function P0(e,t=S0("fetch")){let n=0,r=0;async function a(i){const o=i.body.length;n+=o,r++;
15const l={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const c=await t(e.url,l);return{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}}catch(c){throw E0("fetch"),c}finally{n-=o,r--}}return nv(e,a,el(e.bufferSize||D0))}const Ua=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,M0=30,L0=50;function go(e,t,n,r){const a={filename:e,function:t==="<anonymous>"?Hn:t,in_app:!0};return n!==void 0&&(a.lineno=n),r!==void 0&&(a.colno=r),a}const O0=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,R0=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,F0=/\((\S*)(?::(\d+))(?::(\d+))\)/,z0=/at (.+?) ?\(data:(.+?),/,$0=e=>{var a;const t=e.match(z0);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=O0.exec(e);if(n){const[,i,o,l]=n;return go(i,Hn,+o,+l)}const r=R0.exec(e);if(r){if(((a=r[2])==null?void 0:a.indexOf("eval"))===0){const c=F0.exec(r[2]);c&&(r[2]=c[1],r[3]=c[2],r[4]=c[3])}const[o,l]=If(r[1]||Hn,r[2]);return go(l,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},B0=[M0,$0],V0=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,U0=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,W0=e=>{const t=V0.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const i=U0.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}let r=t[3],a=t[1]||Hn;return[a,r]=If(a,r),go(r,a,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Y0=[L0,W0],H0=[B0,Y0],q0=Mm(...H0),If=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Hn,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Ws=1024,G0="Breadcrumbs",X0=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:G0,setup(n){t.console&&Lv(Z0(n)),t.dom&&b0(Q0(n,t.dom)),t.xhr&&C0(ew(n)),t.fetch&&Kv(tw(n)),t.history&&Af(nw(n)),t.sentry&&n.on("beforeSendEvent",J0(n))}}},K0=X0;function J0(e){return function(n){ct()===e&&qn({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:zn(n)},{event:n})}}function Q0(e,t){return function(r){if(ct()!==e)return;let a,i,o=typeof t=="object"?t.serializeAttribute:void 0,l=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;l&&l>Ws&&(Ua&&me.warn(`\`dom.maxStringLength\` cannot exceed ${Ws}, but a value of ${l} was configured. Sentry will use ${Ws} instead.`),l=Ws),typeof o=="string"&&(o=[o]);try{const u=r.event,d=rw(u)?u.target:u;a=Tf(d,{keyAttrs:o,maxStringLength:l}),i=e0(d)}catch{a="<unknown>"}if(a.length===0)return;const c={category:`ui.${r.name}`,message:a};i&&(c.data={"ui.component_name":i}),qn(c,{event:r.event,name:r.name,global:r.global})}}function Z0(e){return function(n){if(ct()!==e)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:Rv(n.level),message:nc(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${nc(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;qn(r,{input:n.args,level:n.level})}}function ew(e){return function(n){if(ct()!==e)return;const{startTimestamp:r,endTimestamp:a}=n,i=n.xhr[ls];if(!r||!a||!i)return;const{method:o,url:l,status_code:c,body:u}=i,d={method:o,url:l,status_code:c},m={xhr:n.xhr,input:u,startTimestamp:r,endTimestamp:a},p={category:"xhr",data:d,type:"http",level:Nf(c)};e.emit("beforeOutgoingRequestBreadcrumb",p,m),qn(p,m)}}function tw(e){return function(n){if(ct()!==e)return;const{startTimestamp:r,endTimestamp:a}=n;if(a&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const i={data:n.error,input:n.args,startTimestamp:r,endTimestamp:a},o={category:"fetch",data:n.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,i),qn(o,i)}else{const i=n.response,o={...n.fetchData,status_code:i==null?void 0:i.status},l={input:n.args,response:i,startTimestamp:r,endTimestamp:a},c={category:"fetch",data:o,type:"http",level:Nf(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,l),qn(c,l)}}}function nw(e){return function(n){if(ct()!==e)return;let r=n.from,a=n.to;const i=ii(Ue.location.href);let o=r?ii(r):void 0;const l=ii(a);o!=null&&o.path||(o=i),i.protocol===l.protocol&&i.host===l.host&&(a=l.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),qn({category:"navigation",data:{from:r,to:a}})}}function rw(e){return!!e&&!!e.target}const sw="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDB
15Request,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),aw="BrowserApiErrors",iw=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:aw,setupOnce(){t.setTimeout&&Nt(Ue,"setTimeout",Xc),t.setInterval&&Nt(Ue,"setInterval",Xc),t.requestAnimationFrame&&Nt(Ue,"requestAnimationFrame",lw),t.XMLHttpRequest&&"XMLHttpRequest"in Ue&&Nt(XMLHttpRequest.prototype,"send",cw);const n=t.eventTarget;n&&(Array.isArray(n)?n:sw).forEach(a=>uw(a,t))}}},ow=iw;function Xc(e){return function(...t){const n=t[0];return t[0]=_r(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Tn(e)}`}}),e.apply(this,t)}}function lw(e){return function(t){return e.apply(this,[_r(t,{mechanism:{data:{handler:Tn(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function cw(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(a=>{a in n&&typeof n[a]=="function"&&Nt(n,a,function(i){const o={mechanism:{data:{handler:Tn(i)},handled:!1,type:`auto.browser.browserapierrors.xhr.${a}`}},l=Go(i);return l&&(o.mechanism.data.handler=Tn(l)),_r(i,o)})}),e.apply(this,t)}}function uw(e,t){var a,i;const r=(a=Ue[e])==null?void 0:a.prototype;(i=r==null?void 0:r.hasOwnProperty)!=null&&i.call(r,"addEventListener")&&(Nt(r,"addEventListener",function(o){return function(l,c,u){try{dw(c)&&(c.handleEvent=_r(c.handleEvent,{mechanism:{data:{handler:Tn(c),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&mw(this,l,c),o.apply(this,[l,_r(c,{mechanism:{data:{handler:Tn(c),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),u])}}),Nt(r,"removeEventListener",function(o){return function(l,c,u){try{if(Object.prototype.hasOwnProperty.call(c,"__sentry_wrapped__")){const d=c.__sentry_wrapped__;d&&o.call(this,l,d,u)}}catch{}return o.call(this,l,c,u)}}))}function dw(e){return typeof e.handleEvent=="function"}
15function mw(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const fw=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof Ue.document>"u"){Ua&&me.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ec({ignoreDuration:!0}),li();const n=Dn();let r=n.getUser();n.addScopeListener(a=>{const i=a.getUser();((r==null?void 0:r.id)!==(i==null?void 0:i.id)||(r==null?void 0:r.ip_address)!==(i==null?void 0:i.ip_address))&&(li(),r=i)}),t==="route"&&Af(({from:a,to:i})=>{a!==i&&(Ec({ignoreDuration:!0}),li())})}}},pw="CultureContext",hw=()=>({name:pw,preprocessEvent(e){var n;const t=Kc();t&&(e.contexts={...e.contexts,culture:{...t,...(n=e.contexts)==null?void 0:n.culture}})},processSegmentSpan(e){const t=Kc();t&&sf(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}}),gw=hw;function Kc(){try{const e=Ue.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const xw="GlobalHandlers",yw=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:xw,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(vw(n),Jc("onerror")),t.onunhandledrejection&&(ww(n),Jc("onunhandledrejection"))}}},bw=yw;function vw(e){Ix(t=>{const{stackParser:n,attachStacktrace:r}=Df();if(ct()!==e||Ef())return;const{msg:a,url:i,line:o,column:l,error:c}=t,u=jw(rl(n,c||a,void 0,r,!1),i,o,l);u.level="error",of(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function ww(e){Px(t=>{const{stackParser:n,attachStacktrace:r}=Df();if(ct()!==e||Ef())return;const a=kw(t),i=Cs(a)?_w(a):rl(n,a,void 0,r,!0);i.level="error",of(i,{originalException:a,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function kw(e){if(Cs(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function _w(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function jw(e,t,n,r){const a=e.exception=e.exception||{},i=a.values=a.values||[],o=i[0]=i[0]||{},l=o.stacktrace=o.stacktrace||{},c=l.frames=l.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:Nw(t)??tl(),function:Hn,in_app:!0}),e}function Jc(e){Ua&&me.log(`Global Handler attached: ${e}`)}function Df(){const e=ct();return(e==null?void 0:e.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function Nw(e){if(!(!mn(e)||e.length===0))return e.startsWith("data:")?`<${gb(e,!1)}>`:e}const Sw=()=>({name:"HttpContext",preprocessEvent(e){var r;if(!Ue.navigator&&!Ue.location&&!Ue.document)return;const t=Hc(),n={...t.headers,...(r=e.request)==null?void 0:r.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){if(!Ue.navigator&&!Ue.location&&!Ue.document)return;const t=Hc();sf(e,{"url.full":t.url||void 0,"http.request.header.user_agent":t.headers["User-Agent"],"http.request.header.referer":t.headers.Referer})}}),Ew="cause",Cw=5,Tw="LinkedErrors",Aw=(e={})=>{const t=e.limit||Cw,n=e.key||Ew;return{name:Tw,preprocessEvent(r,a,i){const o=i.getOptions();Pv(nl,o.stackParser,n,t,r,a)}}},Iw=Aw,Dw=/^HTML(\w*)Element$/;function Pf(e){if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(I0(e)){const t=Pw(e);if(Dw.test(t))return`[HTMLElement: ${Tf(e)}]`}}function Pw(e){const t=Object.getPrototypeOf(e);return t!=null&&t.constructor?t.constructor.name:"null prototype"}function Mw(){return Lw()?(Ua&&Mr(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function Lw(){var a;if(typeof Ue.window>"u")return!1;const e=Ue;if(e.nw)return!1;const t=e.chrome||e.browser;if(!((a=t==null?void 0:t.runtime)!=null&&a.id))return!1;const n=tl();return!(Ue===Ue.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function Ow(e){return[Nv(),wv(),Hv(),ow(),K0(),bw(),Iw(),$v(),Sw(),gw(),fw()]}function Rw(e={}){const t=!e.skipBrowserExtensionCheck&&Mw();let n=e.defaultIntegrations==null?Ow():e.defaultIntegrations;const r={...e,enabled:t?!1:e.enabled,stackParser:Tx(e.stackParser||q0),integrations:Rb({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||P0};return $m(Pf),hv(f0,r)}function Fw(e){return vs(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function zw(e){const t={...e};wf(t,"react"),Ab("react",{version:h.version});const n=Rw(t);return $m($w),n}function $w(e){return Fw(e)?"[SyntheticEvent]":Pf(e)}const Bw=1,Vw=1e6;let di=0;function Uw(){return di=(di+1)%Number.MAX_SAFE_INTEGER,di.toString()}const mi=new Map,Qc=e=>{if(mi.has(e))return;const t=setTimeout(()=>{mi.delete(e),ds({type:"REMOVE_TOAST",toastId:e})},Vw);mi.set(e,t)},Ww=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Bw)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;
15return n?Qc(n):e.toasts.forEach(r=>{Qc(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},ia=[];let oa={toasts:[]};function ds(e){oa=Ww(oa,e),ia.forEach(t=>{t(oa)})}function Yw({...e}){const t=Uw(),n=a=>ds({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>ds({type:"DISMISS_TOAST",toastId:t});return ds({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function Wt(){const[e,t]=h.useState(oa);return h.useEffect(()=>(ia.push(t),()=>{const n=ia.indexOf(t);n>-1&&ia.splice(n,1)}),[e]),{...e,toast:Yw,dismiss:n=>ds({type:"DISMISS_TOAST",toastId:n})}}function Mf(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Mf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Lf(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Mf(e))&&(r&&(r+=" "),r+=t);return r}const Zc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eu=Lf,Wa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return eu(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=n==null?void 0:n[u],m=i==null?void 0:i[u];if(d===null)return null;const p=Zc(d)||Zc(m);return a[u][p]}),l=n&&Object.entries(n).reduce((u,d)=>{let[m,p]=d;return p===void 0||(u[m]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:m,className:p,...f}=d;return Object.entries(f).every(g=>{let[x,b]=g;return Array.isArray(b)?b.includes({...i,...l}[x]):{...i,...l}[x]===b})?[...u,m,p]:u},[]);return eu(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},sl="-",Hw=e=>{const t=Gw(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(sl);return l[0]===""&&l.length!==1&&l.shift(),Of(l,t)||qw(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},Of=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?Of(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(sl);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},tu=/^\[(.+)\]$/,qw=e=>{if(tu.test(e)){const t=tu.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Gw=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Kw(Object.entries(e.classGroups),n).forEach(([i,o])=>{xo(o,r,i,t)}),r},xo=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:nu(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(Xw(a)){xo(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{xo(o,nu(t,i),n,r)})})},nu=(e,t)=>{let n=e;return t.split(sl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Xw=e=>e.isThemeGetter,Kw=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,a]}):e,Jw=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},Rf="!",Qw=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,m;for(let b=0;b<l.length;b++){let y=l[b];if(u===0){if(y===a&&(r||l.slice(b,b+i)===t)){c.push(l.slice(d,b)),d=b+i;continue}if(y==="/"){m=b;continue}}y==="["?u++:y==="]"&&u--}const p=c.length===0?l:l.substring(d),f=p.startsWith(Rf),g=f?p.substring(1):p,x=m&&m>d?m-d:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:x}};return n?l=>n({className:l,parseClassName:o}):o},Zw=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},e1=e=>({cache:Jw(e.cacheSize),parseClassName:Qw(e),...Hw(e)}),t1=/\s+/,n1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(t1);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:f}=n(u);let g=!!f,x=r(g?p.substring(0,f):p);if(!x){if(!g){l=u+(l.length>0?" "+l:l);continue}if(x=r(p),!x){l=u+(l.length>0?" "+l:l);continue}g=!1}const b=Zw(d).join(":"),y=m?b+Rf:b,j=y+x;if(i.includes(j))continue;i.push(j);const v=a(x,g);for(let C=0;C<v.length;++C){const T=v[C];i.push(y+T)}l=u+(l.length>0?" "+l:l)}return l};
vendor: 9,192 bytes, line 15
15function r1(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ff(t))&&(r&&(r+=" "),r+=n);return r}const Ff=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ff(e[r]))&&(n&&(n+=" "),n+=t);return n};function s1(e,...t){let n,r,a,i=o;function o(c){const u=t.reduce((d,m)=>m(d),e());return n=e1(u),r=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=n1(c,n);return a(c,d),d}return function(){return i(r1.apply(null,arguments))}}const Ve=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},zf=/^\[(?:([a-z-]+):)?(.+)\]$/i,a1=/^\d+\/\d+$/,i1=new Set(["px","full","screen"]),o1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,c1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,u1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,an=e=>br(e)||i1.has(e)||a1.test(e),kn=e=>Fr(e,"length",b1),br=e=>!!e&&!Number.isNaN(Number(e)),fi=e=>Fr(e,"number",br),Ur=e=>!!e&&Number.isInteger(Number(e)),m1=e=>e.endsWith("%")&&br(e.slice(0,-1)),ke=e=>zf.test(e),_n=e=>o1.test(e),f1=new Set(["length","size","percentage"]),p1=e=>Fr(e,f1,$f),h1=e=>Fr(e,"position",$f),g1=new Set(["image","url"]),x1=e=>Fr(e,g1,w1),y1=e=>Fr(e,"",v1),Wr=()=>!0,Fr=(e,t,n)=>{const r=zf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},b1=e=>l1.test(e)&&!c1.test(e),$f=()=>!1,v1=e=>u1.test(e),w1=e=>d1.test(e),k1=()=>{const e=Ve("colors"),t=Ve("spacing"),n=Ve("blur"),r=Ve("brightness"),a=Ve("borderColor"),i=Ve("borderRadius"),o=Ve("borderSpacing"),l=Ve("borderWidth"),c=Ve("contrast"),u=Ve("grayscale"),d=Ve("hueRotate"),m=Ve("invert"),p=Ve("gap"),f=Ve("gradientColorStops"),g=Ve("gradientColorStopPositions"),x=Ve("inset"),b=Ve("margin"),y=Ve("opacity"),j=Ve("padding"),v=Ve("saturate"),C=Ve("scale"),T=Ve("sepia"),S=Ve("skew"),E=Ve("space"),B=Ve("translate"),P=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",ke,t],_=()=>[ke,t],D=()=>["",an,kn],A=()=>["auto",br,ke],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],O=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",ke],k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[br,ke];return{cacheSize:500,separator:":",theme:{colors:[Wr],spacing:[an,kn],blur:["none","",_n,ke],brightness:H(),borderColor:[e],borderRadius:["none","","full",_n,ke],borderSpacing:_(),borderWidth:D(),contrast:H(),grayscale:F(),hueRotate:H(),invert:F(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[m1,kn],inset:L(),margin:L(),opacity:H(),padding:_(),saturate:H(),scale:H(),sepia:F(),skew:H(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[_n]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...V(),ke]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ur,ke]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Ur,ke]}],"grid-cols":[{"grid-cols":[Wr]}],"col-start-end":[{col:["auto",{span:["full",Ur,ke]},ke]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Wr]}],"row-start-end":[{row:["auto",{span:[Ur,ke]},ke]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ke,t]}],"min-w":[{"min-w":[ke,t,"min","max","fit"]}],"max-w":[{"max-w":[ke,t,"none","full","min","max","fit","prose",{screen:[_n]},_n]}],h:[{h:[ke,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_n,kn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fi]}],"font-family":[{font:[Wr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ke]}],"line-clamp":[{"line-clamp":["none",br,fi]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",an,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",an,kn]}],"underline-offset":[{"underline-offset":["auto",an,ke]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),h1]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",p1]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},x1]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}
15],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...J(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}
vendor: 4,467 bytes, line 15
15],"divide-style":[{divide:J()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[an,ke]}],"outline-w":[{outline:[an,kn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[an,kn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",_n,y1]}],"shadow-color":[{shadow:[Wr]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...O(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":O()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",_n,ke]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[m]}],saturate:[{saturate:[v]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ke]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Ur,ke]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[an,kn,fi]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
15none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},_1=s1(k1);function se(...e){return _1(Lf(e))}const j1=hg,Bf=h.forwardRef(({className:e,...t},n)=>s.jsx(Zd,{ref:n,className:se("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Bf.displayName=Zd.displayName;const N1=Wa("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Vf=h.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(em,{ref:r,className:se(N1({variant:t}),e),...n}));Vf.displayName=em.displayName;const S1=h.forwardRef(({className:e,...t},n)=>s.jsx(tm,{ref:n,className:se("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));S1.displayName=tm.displayName;const Uf=h.forwardRef(({className:e,...t},n)=>s.jsx(nm,{ref:n,className:se("absolute right-2 top-2 rounded-md p-1 text-foreground
15/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(rr,{className:"h-4 w-4"})}));Uf.displayName=nm.displayName;const Wf=h.forwardRef(({className:e,...t},n)=>s.jsx(rm,{ref:n,className:se("text-sm font-semibold",e),...t}));Wf.displayName=rm.displayName;const Yf=h.forwardRef(({className:e,...t},n)=>s.jsx(sm,{ref:n,className:se("text-sm opacity-90",e),...t}));Yf.displayName=sm.displayName;function E1(){const{toasts:e}=Wt();return s.jsxs(j1,{children:[e.map(function({id:t,title:n,description:r,action:a,...i}){return s.jsxs(Vf,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(Wf,{children:n}),r&&s.jsx(Yf,{children:r})]}),a,s.jsx(Uf,{})]},t)}),s.jsx(Bf,{})]})}var ru=["light","dark"],C1="(prefers-color-scheme: dark)",T1=h.createContext(void 0),A1={setTheme:e=>{},themes:[]},I1=()=>{var e;return(e=h.useContext(T1))!=null?e:A1};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,m=a?ru.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",p=(g,x=!1,b=!0)=>{let y=o?o[g]:g,j=x?g+"|| ''":`'${y}'`,v="";return a&&b&&!x&&ru.includes(g)&&(v+=`d.style.colorScheme = '${g}';`),n==="class"?x||y?v+=`c.add(${j})`:v+="null":y&&(v+=`d[s](n,${j})`),v},f=e?`!function(){${d}${p(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${C1}',m=window.matchMedia(t);if(m.media!==t||m.matches){${p("dark")}}else{${p("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${p(o?"x[e]":"e",!0)}}${u?"":"else{"+p(i,!1,!1)+"}"}${m}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${p(o?"x[e]":"e",!0)}}else{${p(i,!1,!1)};}${m}}catch(t){}}();`;return h.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:f}})});var D1=e=>{switch(e){case"success":return L1;case"info":return R1;case"warning":return O1;case"error":return F1;default:return null}},P1=Array(12).fill(0),M1=({visible:e,className:t})=>ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ee.createElement("div",{className:"sonner-spinner"},P1.map((n,r)=>ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),L1=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),O1=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),R1=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),F1=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),z1=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),$1=()=>{let[e,t]=ee.useState(document.hidden);return ee.useEffect(()=>{let n=()=>{t(document.hidden)};
15return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yo=1,B1=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:yo++,i=this.toasts.find(l=>l.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:n}),{...l,...e,id:a,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
15this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,i,o=r.then(async c=>{if(i=["resolve",c],ee.isValidElement(c))a=!1,this.create({id:n,type:"default",message:c});else if(U1(c)&&!c.ok){a=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:u,description:d})}else if(t.success!==void 0){a=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){a=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;a&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||yo++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},gt=new B1,V1=(e,t)=>{let n=(t==null?void 0:t.id)||yo++;return gt.addToast({title:e,...t,id:n}),n},U1=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",W1=V1,Y1=()=>gt.toasts,H1=()=>gt.getActiveToasts();Object.assign(W1,{success:gt.success,info:gt.info,warning:gt.warning,error:gt.error,custom:gt.custom,message:gt.message,promise:gt.promise,dismiss:gt.dismiss,loading:gt.loading},{getHistory:Y1,getToasts:H1});function q1(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}q1(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
15left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
15:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
15--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
16`);function Ys(e){return e.label!==void 0}var G1=3,X1="32px",K1="16px",su=4e3,J1=356,Q1=14,Z1=20,ek=200;function Rt(...e){return e.filter(Boolean).join(" ")}function tk(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var nk=e=>{var t,n,r,a,i,o,l,c,u,d,m;let{invert:p,toast:f,unstyled:g,interacting:x,setHeights:b,visibleToasts:y,heights:j,index:v,toasts:C,expanded:T,removeToast:S,defaultRichColors:E,closeButton:B,style:P,cancelButtonStyle:N,actionButtonStyle:L,className:_="",descriptionClassName:D="",duration:A,position:V,gap:J,loadingIcon:O,expandByDefault:z,classNames:F,icons:k,closeButtonAriaLabel:H="Close toast",pauseWhenPageIsHidden:R}=e,[w,te]=ee.useState(null),[W,U]=ee.useState(null),[K,ie]=ee.useState(!1),[ne,ue]=ee.useState(!1),[pe,X]=ee.useState(!1),[ve,Q]=ee.useState(!1),[ae,q]=ee.useState(!1),[oe,De]=ee.useState(0),[_e,We]=ee.useState(0),at=ee.useRef(f.duration||A||su),rt=ee.useRef(null),tt=ee.useRef(null),Je=v===0,Ge=v+1<=y,I=f.type,Y=f.dismissible!==!1,de=f.className||"",we=f.descriptionClassName||"",je=ee.useMemo(()=>j.findIndex(ye=>ye.toastId===f.id)||0,[j,f.id]),le=ee.useMemo(()=>{var ye;return(ye=f.closeButton)!=null?ye:B},[f.closeButton,B]),Le=ee.useMemo(()=>f.duration||A||su,[f.duration,A]),Se=ee.useRef(0),Xe=ee.useRef(0),it=ee.useRef(0),He=ee.useRef(null),[Et,wt]=V.split("-"),Hl=ee.useMemo(()=>j.reduce((ye,Oe,Ye)=>Ye>=je?ye:ye+Oe.height,0),[j,je]),ql=$1(),cg=f.invert||p,ti=I==="loading";Xe.current=ee.useMemo(()=>je*J+Hl,[je,Hl]),ee.useEffect(()=>{at.current=Le},[Le]),ee.useEffect(()=>{ie(!0)},[]),ee.useEffect(()=>{let ye=tt.current;if(ye){let Oe=ye.getBoundingClientRect().height;return We(Oe),b(Ye=>[{toastId:f.id,height:Oe,position:f.position},...Ye]),()=>b(Ye=>Ye.filter(Mt=>Mt.toastId!==f.id))}},[b,f.id]),ee.useLayoutEffect(()=>{if(!K)return;let ye=tt.current,Oe=ye.style.height;ye.style.height="auto";let Ye=ye.getBoundingClientRect().height;ye.style.height=Oe,We(Ye),b(Mt=>Mt.find(Lt=>Lt.toastId===f.id)?Mt.map(Lt=>Lt.toastId===f.id?{...Lt,height:Ye}:Lt):[{toastId:f.id,height:Ye,position:f.position},...Mt])},[K,f.title,f.description,b,f.id]);let yn=ee.useCallback(()=>{ue(!0),De(Xe.current),b(ye=>
16ye.filter(Oe=>Oe.toastId!==f.id)),setTimeout(()=>{S(f)},ek)},[f,S,b,Xe]);ee.useEffect(()=>{if(f.promise&&I==="loading"||f.duration===1/0||f.type==="loading")return;let ye;return T||x||R&&ql?(()=>{if(it.current<Se.current){let Oe=new Date().getTime()-Se.current;at.current=at.current-Oe}it.current=new Date().getTime()})():at.current!==1/0&&(Se.current=new Date().getTime(),ye=setTimeout(()=>{var Oe;(Oe=f.onAutoClose)==null||Oe.call(f,f),yn()},at.current)),()=>clearTimeout(ye)},[T,x,f,I,R,ql,yn]),ee.useEffect(()=>{f.delete&&yn()},[yn,f.delete]);function ug(){var ye,Oe,Ye;return k!=null&&k.loading?ee.createElement("div",{className:Rt(F==null?void 0:F.loader,(ye=f==null?void 0:f.classNames)==null?void 0:ye.loader,"sonner-loader"),"data-visible":I==="loading"},k.loading):O?ee.createElement("div",{className:Rt(F==null?void 0:F.loader,(Oe=f==null?void 0:f.classNames)==null?void 0:Oe.loader,"sonner-loader"),"data-visible":I==="loading"},O):ee.createElement(M1,{className:Rt(F==null?void 0:F.loader,(Ye=f==null?void 0:f.classNames)==null?void 0:Ye.loader),visible:I==="loading"})}return ee.createElement("li",{tabIndex:0,ref:tt,className:Rt(_,de,F==null?void 0:F.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,F==null?void 0:F.default,F==null?void 0:F[I],(n=f==null?void 0:f.classNames)==null?void 0:n[I]),"data-sonner-toast":"","data-rich-colors":(r=f.richColors)!=null?r:E,"data-styled":!(f.jsx||f.unstyled||g),"data-mounted":K,"data-promise":!!f.promise,"data-swiped":ae,"data-removed":ne,"data-visible":Ge,"data-y-position":Et,"data-x-position":wt,"data-index":v,"data-front":Je,"data-swiping":pe,"data-dismissible":Y,"data-type":I,"data-invert":cg,"data-swipe-out":ve,"data-swipe-direction":W,"data-expanded":!!(T||z&&K),style:{"--index":v,"--toasts-before":v,"--z-index":C.length-v,"--offset":`${ne?oe:Xe.current}px`,"--initial-height":z?"auto":`${_e}px`,...P,...f.style},onDragEnd:()=>{X(!1),te(null),He.current=null},onPointerDown:ye=>{ti||!Y||(rt.current=new Date,De(Xe.current),ye.target.setPointerCapture(ye.pointerId),ye.target.tagName!=="BUTTON"&&(X(!0),He.current={x:ye.clientX,y:ye.clientY}))},onPointerUp:()=>{var ye,Oe,Ye,Mt;if(ve||!Y)return;He.current=null;let Lt=Number(((ye=tt.current)==null?void 0:ye.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),bn=Number(((Oe=tt.current)==null?void 0:Oe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Mn=new Date().getTime()-((Ye=rt.current)==null?void 0:Ye.getTime()),Ot=w==="x"?Lt:bn,vn=Math.abs(Ot)/Mn;if(Math.abs(Ot)>=Z1||vn>.11){De(Xe.current),(Mt=f.onDismiss)==null||Mt.call(f,f),U(w==="x"?Lt>0?"right":"left":bn>0?"down":"up"),yn(),Q(!0),q(!1);return}X(!1),te(null)},onPointerMove:ye=>{var Oe,Ye,Mt,Lt;if(!He.current||!Y||((Oe=window.getSelection())==null?void 0:Oe.toString().length)>0)return;let bn=ye.clientY-He.current.y,Mn=ye.clientX-He.current.x,Ot=(Ye=e.swipeDirections)!=null?Ye:tk(V);!w&&(Math.abs(Mn)>1||Math.abs(bn)>1)&&te(Math.abs(Mn)>Math.abs(bn)?"x":"y");let vn={x:0,y:0};w==="y"?(Ot.includes("top")||Ot.includes("bottom"))&&(Ot.includes("top")&&bn<0||Ot.includes("bottom")&&bn>0)&&(vn.y=bn):w==="x"&&(Ot.includes("left")||Ot.includes("right"))&&(Ot.includes("left")&&Mn<0||Ot.includes("right")&&Mn>0)&&(vn.x=Mn),(Math.abs(vn.x)>0||Math.abs(vn.y)>0)&&q(!0),(Mt=tt.current)==null||Mt.style.setProperty("--swipe-amount-x",`${vn.x}px`),(Lt=tt.current)==null||Lt.style.setProperty("--swipe-amount-y",`${vn.y}px`)}},le&&!f.jsx?ee.createElement("button",{"aria-label":H,"data-disabled":ti,"data-close-button":!0,onClick:ti||!Y?()=>{}:()=>{var ye;yn(),(ye=f.onDismiss)==null||ye.call(f,f)},className:Rt(F==null?void 0:F.closeButton,(a=f==null?void 0:f.classNames)==null?void 0:a.closeButton)},(i=k==null?void 0:k.close)!=null?i:z1):null,f.jsx||h.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:ee.createElement(ee.Fragment,null,I||f.icon||f.promise?ee.createElement("div",{"data-icon":"",className:Rt(F==null?void 0:F.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||ug():null,f.type!=="loading"?f.icon||(k==null?void 0:k[I])||D1(I):null):null,ee.createElement("div",{"data-content":"",className:Rt(F==null?void 0:F.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},ee.createElement("div",{"data-title":"",className:Rt(F==null?void 0:F.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?ee.createElement("div",{"data-description":"",className:Rt(D,we,F==null?void 0:F.description,(u=f==null?void 0:f.classNames)==null?void 0:u.description)},typeof f.description=="function"?f.description():f.description):null),h.isValidElement(f.cancel)?f.cancel:f.cancel&&Ys(f.cancel)?ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||N,onClick:ye=>{var Oe,Ye;Ys(f.cancel)&&Y&&((Ye=(Oe=f.cancel).onClick)==null||Ye.call(Oe,ye),yn())},className:Rt(F==null?void 0:F.cancelButton,(d=f==null?void 0:f.classNames)==null?void 0:d.cancelButton)},f.cancel.label):null,h.isValidElement(f.action)?f.action:f.action&&Ys(f.action)?ee.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||L,onClick:ye=>{var Oe,Ye;Ys(f.action)&&((Ye=(Oe=f.action).onClick)==null||Ye.call(Oe,ye),!ye.defaultPrevented&&yn())},className:Rt(F==null?void 0:F.actionButton,(m=f==null?void 0:f.classNames)==null?void 0:m.actionButton)},f.action.label):null))};function au(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function rk(e,t){let n={};return[e,t].forEach((r,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?K1:X1;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}var sk=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:m,duration:p,style:f,visibleToasts:g=G1,toastOptions:x,dir:b=au(),gap:y=Q1,loadingIcon:j,icons:v,containerAriaLabel:C="Notifications",pauseWhenPageIsHidden:T}=e,[S,E]=ee.useState([]),B=ee.useMemo(()=>Array.from(new Set([r].concat(S.filter(R=>R.position).map(R=>R.position)))),[S,r]),[P,N]=ee.useState([]),[L,_]=ee.useState(!1),[D,A]=ee.useState(!1),[V,J]=ee.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
16k":"light"),O=ee.useRef(null),z=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=ee.useRef(null),k=ee.useRef(!1),H=ee.useCallback(R=>{E(w=>{var te;return(te=w.find(W=>W.id===R.id))!=null&&te.delete||gt.dismiss(R.id),w.filter(({id:W})=>W!==R.id)})},[]);return ee.useEffect(()=>gt.subscribe(R=>{if(R.dismiss){E(w=>w.map(te=>te.id===R.id?{...te,delete:!0}:te));return}setTimeout(()=>{fg.flushSync(()=>{E(w=>{let te=w.findIndex(W=>W.id===R.id);return te!==-1?[...w.slice(0,te),{...w[te],...R},...w.slice(te+1)]:[R,...w]})})})}),[]),ee.useEffect(()=>{if(d!=="system"){J(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?J("dark"):J("light")),typeof window>"u")return;let R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:w})=>{J(w?"dark":"light")})}catch{R.addListener(({matches:te})=>{try{J(te?"dark":"light")}catch(W){console.error(W)}})}},[d]),ee.useEffect(()=>{S.length<=1&&_(!1)},[S]),ee.useEffect(()=>{let R=w=>{var te,W;a.every(U=>w[U]||w.code===U)&&(_(!0),(te=O.current)==null||te.focus()),w.code==="Escape"&&(document.activeElement===O.current||(W=O.current)!=null&&W.contains(document.activeElement))&&_(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[a]),ee.useEffect(()=>{if(O.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,k.current=!1)}},[O.current]),ee.createElement("section",{ref:t,"aria-label":`${C} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},B.map((R,w)=>{var te;let[W,U]=R.split("-");return S.length?ee.createElement("ol",{key:R,dir:b==="auto"?au():b,tabIndex:-1,ref:O,className:l,"data-sonner-toaster":!0,"data-theme":V,"data-y-position":W,"data-lifted":L&&S.length>1&&!i,"data-x-position":U,style:{"--front-toast-height":`${((te=P[0])==null?void 0:te.height)||0}px`,"--width":`${J1}px`,"--gap":`${y}px`,...f,...rk(c,u)},onBlur:K=>{k.current&&!K.currentTarget.contains(K.relatedTarget)&&(k.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||k.current||(k.current=!0,F.current=K.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{D||_(!1)},onDragEnd:()=>_(!1),onPointerDown:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},S.filter(K=>!K.position&&w===0||K.position===R).map((K,ie)=>{var ne,ue;return ee.createElement(nk,{key:K.id,icons:v,index:ie,toast:K,defaultRichColors:m,duration:(ne=x==null?void 0:x.duration)!=null?ne:p,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:n,visibleToasts:g,closeButton:(ue=x==null?void 0:x.closeButton)!=null?ue:o,interacting:D,position:R,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:H,toasts:S.filter(pe=>pe.position==K.position),heights:P.filter(pe=>pe.position==K.position),setHeights:N,expandByDefault:i,gap:y,loadingIcon:j,expanded:L,pauseWhenPageIsHidden:T,swipeDirections:e.swipeDirections})})):null}))});const ak=({...e})=>{const{theme:t="system"}=I1();return s.jsx(sk,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},ik=gg,jr=xg,Nr=yg,Gn=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(am,{ref:r,sideOffset:t,className:se("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
16de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Gn.displayName=am.displayName;function ok(e,t){let n;try{n=JSON.parse(e)}catch{return e}if(n===null||typeof n!="object"||Array.isArray(n))return e;const r=n,a=r.expires_in;if(typeof a!="number"||!Number.isFinite(a)||a<=0||typeof r.expires_at!="number"||!Number.isFinite(t))return e;const i=Math.round(t/1e3)+a;if(i===r.expires_at)return e;try{return JSON.stringify({...r,expires_at:i})}catch{return e}}function lk(e){return{getItem:t=>e.getItem(t),setItem:(t,n)=>e.setItem(t,ok(n,Date.now())),removeItem:t=>e.removeItem(t)}}const ck="https://bocsxhpaswkalhedfnzz.supabase.co",uk="sb_publishable_v5Zeef2HErFcpIoikDEp3g_n6oNgyJu";function dk(){try{return typeof window>"u"||!window.localStorage?void 0:lk(window.localStorage)}catch{return}}const Z=wx(ck,uk,{auth:{persistSession:!0,autoRefreshToken:!0,storage:dk()}}),mk="https://api.viewlink.dev",Xn="2026-07-15",Kn="2026-07-15",al="vl_pending_consent",bo="vl_consent_synced_v2:",fk=15*60*1e3;function Hf(e){try{const t={...e,stashedAt:Date.now()};localStorage.setItem(al,JSON.stringify(t))}catch{}}function Sr(){try{localStorage.removeItem(al)}catch{}}function pk(e){if((e==null?void 0:e.terms_accepted)===!0)return Sr(),{terms_accepted:!0,terms_version:e.terms_version||Xn,privacy_accepted:e.privacy_accepted===!0,privacy_version:e.privacy_version||Kn,marketing_opt_in:e.marketing_opt_in===!0,channel:"web_form"};let t=null;try{t=localStorage.getItem(al)}catch{return null}if(!t)return null;Sr();try{const n=JSON.parse(t);return typeof n.stashedAt!="number"||Date.now()-n.stashedAt>fk?null:{terms_accepted:n.terms_accepted===!0,terms_version:n.terms_version||Xn,privacy_accepted:n.privacy_accepted===!0,privacy_version:n.privacy_version||Kn,marketing_opt_in:n.marketing_opt_in===!0,channel:"oauth"}}catch{return null}}async function qf(e,t){const n={method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(e)};try{const r=await fetch("/api/consent",n);if((r.headers.get("content-type")||"").includes("application/json")&&r.status!==404&&r.status!==502)return r}catch{}return fetch(`${mk}/v1/user/consent`,n)}async function hk(){var i,o;const{data:{session:e}}=await Z.auth.getSession(),t=(i=e==null?void 0:e.user)==null?void 0:i.id,n=e==null?void 0:e.access_token;if(!t||!n)return!1;try{if(localStorage.getItem(bo+t)==="1")return!1}catch{}const r=pk(e.user.user_metadata??{}),a={...r??{terms_accepted:!1,terms_version:Xn,privacy_accepted:!1,privacy_version:Kn,marketing_opt_in:!1,channel:"web_form"},marketing_presented:r!==null};try{const l=await qf(a,n);if(!l.ok)return!1;let c=!1;try{c=((o=await l.json())==null?void 0:o.consent_gate_required)===!0}catch{}if(!c)try{localStorage.setItem(bo+t,"1")}catch{}return c}catch{return!1}}async function gk(e){var a;const{data:{session:t}}=await Z.auth.getSession(),n=(a=t==null?void 0:t.user)==null?void 0:a.id,r=t==null?void 0:t.access_token;if(!n||!r)return!1;try{const i=await qf({terms_accepted:!0,terms_version:Xn,privacy_accepted:!0,privacy_version:Kn,marketing_opt_in:e,marketing_presented:!0,channel:"web_form"},r);if(!i.ok)return!1;const o=await i.json();if((o==null?void 0:o.terms_on_file)!==!0)return!1;try{localStorage.setItem(bo+n,"1")}catch{}return!0}catch{return!1}}const Gf=h.createContext(void 0),xk=({children:e})=>{var j;const[t,n]=h.useState(null),[r,a]=h.useState(null),[i,o]=h.useState(null),[l,c]=h.useState(!1),[u,d]=h.useState(!1),[m,p]=h.useState(!0),f=h.useRef(!1),g=async(v,C=0)=>{try{const{data:{session:T}}=await Z.auth.getSession();if(!(T!=null&&T.access_token)||T.user.id!==v){console.warn("[AuthContext] authchange with no local token — ignoring broadcast for",v),n(null),a(null),o(null),c(!1);return}const{data:S,error:E}=await Z.from("profiles").select("id, email, role, platform, onboarding_complete, execution_path, indicator_added, tradingview_plan_paid, created_at, phone, country, phone_prompt_seen_at").eq("id",v).maybeSingle();if(E)throw E;if(!S){if(C<1)return await new Promise(B=>setTimeout(B,1200)),g(v,C+1);
16console.warn("[AuthContext] session has no matching profile — signing out"),o(null),c(!1),console.trace("[AuthContext] signOut from double-null profile fetch"),await Z.auth.signOut({scope:"local"});return}o(S?{id:S.id,email:S.email,role:S.role,platform:S.platform,onboarding_complete:S.onboarding_complete,execution_path:S.execution_path,indicator_added:S.indicator_added,tradingview_plan_paid:S.tradingview_plan_paid,created_at:S.created_at,phone:S.phone,country:S.country,phone_prompt_seen_at:S.phone_prompt_seen_at}:null),f.current=!0,c(!1)}catch(T){console.error("[AuthContext] fetchProfile failed:",T),c(!0)}},x=async()=>{r&&await g(r.id)};h.useEffect(()=>{const{data:{subscription:v}}=Z.auth.onAuthStateChange(async(C,T)=>{if(console.log("[AuthContext] authchange:",C,"session:",!!T),n(T),a((T==null?void 0:T.user)??null),T!=null&&T.user)$e.identify(T.user.id,{email:T.user.email}),setTimeout(()=>g(T.user.id),0);else{if(!f.current){console.warn("[AuthContext] session absent with no proven session — phantom eviction, ignoring"),$e.reset(),o(null),p(!1);return}f.current=!1,$e.reset(),o(null)}p(!1)});return Z.auth.getSession().then(({data:{session:C}})=>{n(C),a((C==null?void 0:C.user)??null),C!=null&&C.user&&g(C.user.id),p(!1)}),()=>v.unsubscribe()},[]),h.useEffect(()=>{var C;if(!((C=t==null?void 0:t.user)!=null&&C.id)){d(!1);return}let v=!1;return hk().then(T=>{v||d(T)}),()=>{v=!0}},[(j=t==null?void 0:t.user)==null?void 0:j.id]);const b=()=>d(!1),y=async()=>{f.current=!1,await Z.auth.signOut({scope:"local"}),n(null),a(null),o(null)};return s.jsx(Gf.Provider,{value:{session:t,user:r,profile:i,profileError:l,consentRequired:u,clearConsentRequired:b,loading:m,signOut:y,refreshProfile:x},children:e})},be=()=>{const e=h.useContext(Gf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e},yk=["active","lapsing"],bk=["provisioning","installing","configuring"],vk=["lapsed","cancelled"],wk=["destroyed"],kk=20*60*1e3,_k=5*60*1e3;function jk(e,t){if(!e)return!1;const n=Date.parse(e);if(Number.isNaN(n))return!1;const r=t-n;return r>=-_k&&r<=kk}function iu(e){const{vps:t,account:n,symbolCount:r}=e;if(!t||!n)return"not_set_up";const a=(t.status??"").toLowerCase();return wk.includes(a)?"not_set_up":vk.includes(a)?"lapsed":bk.includes(a)?"provisioning":yk.includes(a)?t.contact_lost===!0?"offline":r===null?"unknown":n.broker_connected!==!0?jk(n.repair_hold_at,e.nowMs??Date.now())?"restarting":"awaiting_broker":r===0?"syncing":"ready":"unknown"}const Xf={primary:"unknown",primaryAccountId:null,byAccountId:{},loading:!0},Kf=h.createContext(null),Nk=1e4,ou=3e4;function lu({children:e}){const{user:t}=be(),[n,r]=h.useState(Xf),[a,i]=h.useState(ou),o=h.useRef({}),l=h.useRef(null),c=h.useRef([]),u=h.useCallback(async()=>{if(!t){o.current={},l.current=null,c.current=[],r({primary:"unknown",primaryAccountId:null,byAccountId:{},loading:!1});return}try{const[d,m]=await Promise.all([Z.from("vps_records").select("status, contact_lost, provisioned_at").eq("user_id",t.id).limit(1).maybeSingle(),Z.from("mt5_accounts").select("id, account_label, broker_connected, repair_hold_at, is_active, sort_order").eq("user_id",t.id).eq("is_active",!0).order("sort_order",{ascending:!0})]);d.error||(l.current=d.data?{status:d.data.status,contact_lost:d.data.contact_lost===!0}:null),!m.error&&m.data&&(c.current=m.data.map(v=>({id:v.id,broker_connected:v.broker_connected??null,repair_hold_at:v.repair_hold_at??null,sort_order:v.sort_order??null})));const p=c.current,f=p.map(v=>v.id);if(f.length>0){const v=await Z.from("account_symbols").select("mt5_account_id").in("mt5_account_id",f);if(!v.error&&v.data){const C={};for(const T of f)C[T]=0;for(const T of v.data)C[T.mt5_account_id]=(C[T.mt5_account_id]??0)+1;o.current={...o.current,...C}}}const g=l.current,x={};for(const v of p){const C=v.id in o.current?o.current[v.id]:null;x[v.id]=iu({vps:g,account:{broker_connected:v.broker_connected,repair_hold_at:v.repair_hold_at},symbolCount:C})}const b=p[0]??null,y=(b==null?void 0:b.id)??null,j=b?x[b.id]:iu({vps:g,account:null,symbolCount:null});r({primary:j,primaryAccountId:y,byAccountId:x,loading:!1}),i(j==="syncing"||j==="provisioning"||j==="restarting"?Nk:ou)}catch{r(d=>({...d,loading:!1}))}},[t]);return h.useEffect(()=>{u();const d=setInterval(u,a);return()=>clearInterval(d)},[u,a]),s.jsx(Kf.Provider,{value:n,children:e})}function Jf(){return h.useContext(Kf)??Xf}let cu=!1;function Sk(){if(cu)return;xa.configure("5bcd2a98-acb0-4a01-b717-ff4dcb86acaa"),cu=!0}function Ek(e,t){xa.user.setEmail(e),xa.session.setData({user_id:t})}function il(){xa.session.reset()}function Qf(){try{typeof window<"u"&&window.$crisp&&window.$crisp.push(["do","chat:hide"])}catch{}}function Jn(){try{typeof window<"u"&&window.$crisp&&(window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]))}catch{}}const vo="/onboarding/phone",pi="/setup-guide",Ck="vl_phone_prompt_shown:";function Zf(e){return`${Ck}${e}`}function Tk(e){try{return localStorage.getItem(Zf(e))!==null}catch{return!0}}function Ak(e){try{localStorage.setItem(Zf(e),"1")}catch{}}let wo=!1;function Ik(){return!wo}function Dk(){return wo?!1:(wo=!0,!0)}function Pk(e){return!e||(e.phone??"").trim()!==""?!0:e.phone_prompt_seen_at!=null}function Mk(e){return!e||e.status!=="trialing"?!1:e.cancel_scheduled_at==null}function Lk(e){return typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||e===vo||e.startsWith(`${vo}/`)?pi:e}const Ok="https://api.viewlink.dev";function Rk(e,t,n){return e?t?n?null:"/onboarding/provisioning":"/onboarding/payment":"/onboarding/plan-select"}function uu(e,t,n){return!e||!t||e.forUserId!==t?!1:e.redirect===null||e.forLocationKey===n}const Yt=({children:e,requireOnboarding:t=!0})=>{const{session:n,profile:r,profileError:a,loading:i}=be(),o=sr(),l=o.key,c=h.useRef(l);c.current=l;const[u,d]=h.useState(!1),[m,p]=h.useState(null),[f,g]=h.useState(null),[x,b]=h.useState(!1),[y,j]=h.useState(0),v=()=>{b(!1),p(null),d(!0),j(C=>C+1)};if(h.useEffect(()=>{if(!t){p(_=>_===null?_:null),d(_=>_===!1?_:!1);return}if(!(n!=null&&n.user)||i||r===null)return;const C=n.user.id;if(uu(m,C,l))return;const T=async _=>{if(!Ik()||Pk(r)||Tk(C)||_!==void 0&&_!=="trialing"||!Dk())return;let D=null;
16try{const A=await Z.from("subscriptions").select("status, cancel_scheduled_at").eq("user_id",C).limit(1).maybeSingle();if(A.error)return;D=A.data}catch{return}c.current===l&&Mk(D)&&g({forLocationKey:l})};if(r!=null&&r.onboarding_complete){p({forUserId:C,forLocationKey:l,redirect:null}),T(void 0);return}let S=!1,E=null;const B=3,P=1500,N=(_,D)=>{if(!S){if(_<B){E=setTimeout(()=>L(_+1),P);return}console.warn(`[ProtectedRoute] onboarding resolution unresolved (${D}) after ${B} attempts — showing error/retry screen`),b(!0),d(!1)}},L=async _=>{var D,A,V;if(!S){d(!0);try{const[J,O,z]=await Promise.all([Z.from("license_keys").select("id").eq("user_id",C).eq("is_active",!0).limit(1).maybeSingle(),Z.from("subscriptions").select("id, status").eq("user_id",C).limit(1).maybeSingle(),Z.from("vps_records").select("status").eq("user_id",C).order("provisioned_at",{ascending:!1}).limit(1).maybeSingle()]);if(S)return;if(J.error||O.error||z.error){N(_,"query error");return}const F=!!(J.data||O.data),k=!!(O.data&&["active","trialing"].includes(O.data.status??"")),H=((A=(D=z.data)==null?void 0:D.status)==null?void 0:A.toLowerCase())==="active",R=Rk(F,k,H);R===null&&(fetch(`${Ok}/v1/user/onboarding-complete`,{method:"POST",headers:{Authorization:`Bearer ${n.access_token}`}}).catch(()=>{}),T(((V=O.data)==null?void 0:V.status)??null)),p({forUserId:C,forLocationKey:l,redirect:R}),d(!1)}catch{if(S)return;N(_,"network rejection")}}};return b(!1),L(0),()=>{S=!0,E&&clearTimeout(E),d(!1)}},[n,r,i,t,y,l,m]),a)return s.jsxs("div",{className:"min-h-screen bg-[#0D0F14] flex flex-col items-center justify-center gap-4",children:[s.jsx("p",{className:"text-[#8A92A8] text-sm",children:"Session error. Please refresh."}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 rounded-lg bg-[#4A72FF] text-white text-sm font-medium",children:"Refresh"})]});if(i)return s.jsx("div",{className:"min-h-screen bg-[#0D0F14] flex items-center justify-center",children:s.jsx("div",{className:"w-6 h-6 border-2 border-[#4A72FF] border-t-transparent rounded-full animate-spin"})});if(!n)return s.jsx(cs,{to:"/login",replace:!0});if(t){if(x)return s.jsxs("div",{className:"min-h-screen bg-[#0D0F14] flex flex-col items-center justify-center gap-4 px-6 text-center",children:[s.jsx("p",{className:"text-[#EAEDF5] text-base font-medium",children:"We couldn't load your account."}),s.jsx("p",{className:"text-[#8A92A8] text-sm max-w-xs",children:"Check your connection and try again."}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx("button",{onClick:v,className:"px-4 py-2 rounded-lg bg-[#4A72FF] text-white text-sm font-medium",children:"Try again"}),s.jsx("button",{onClick:()=>Jn(),className:"px-4 py-2 rounded-lg border border-[#252A38] text-[#8A92A8] text-sm font-medium hover:text-[#EAEDF5] transition-colors",children:"Contact support"})]})]});const C=uu(m,n.user.id,l);if(u||!C)return s.jsx("div",{className:"min-h-screen bg-[#0D0F14] flex items-center justify-center",children:s.jsx("div",{className:"w-6 h-6 border-2 border-[#4A72FF] border-t-transparent rounded-full animate-spin"})});if(m&&m.redirect!==null)return s.jsx(cs,{to:m.redirect,replace:!0});if(f&&f.forLocationKey===l)return s.jsx(cs,{to:vo,replace:!0,state:{from:`${o.pathname}${o.search}`}})}return s.jsx(s.Fragment,{children:e})};function ep(){var a;const{session:e,loading:t}=be(),[n,r]=h.useState(null);return h.useEffect(()=>{if(!t){if(!(e!=null&&e.user)){r(!1);return}Z.from("user_roles").select("role").eq("user_id",e.user.id).eq("role","admin").maybeSingle().then(({data:i})=>r(!!i))}},[(a=e==null?void 0:e.user)==null?void 0:a.id,t]),n}const Fk=({children:e})=>{const{session:t,loading:n}=be(),r=ep();return n||r===null?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin"})}):t?r?s.jsx(s.Fragment,{children:e}):s.jsx(cs,{to:"/dashboard",replace:!0}):s.jsx(cs,{to:"/login",replace:!0})},Qn=h.forwardRef(({className:e,...t},n)=>s.jsx(im,{ref:n,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:s.jsx(bg,{className:se("flex items-center justify-center text-current"),children:s.jsx(ot,{className:"h-4 w-4"})})}));Qn.displayName=im.displayName;const zk=Wa("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=h.forwardRef(({className:e,...t},n)=>s.jsx(om,{ref:n,className:se(zk(),e),...t}));ze.displayName=om.displayName;
16const ko=Wa("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),re=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},i)=>{const o=r?vg:"button";return s.jsx(o,{className:se(ko({variant:t,size:n,className:e})),ref:i,...a})});re.displayName="Button";const et="/assets/viewlink-logo-transparent-7Dlo9FHM.png",$k=()=>{const{clearConsentRequired:e,signOut:t}=be(),[n,r]=h.useState(!1),[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,u]=h.useState(""),d=async()=>{if(!n||o)return;if(l(!0),u(""),await gk(a)){e();return}l(!1),u("We could not save that. Please check your connection and try again.")};return s.jsx("div",{className:"min-h-screen bg-[#0D0F14] flex items-center justify-center px-6",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"h-8 mx-auto mb-8"}),s.jsxs("div",{className:"rounded-xl border border-[#252A38] bg-[#12151C] p-7",children:[s.jsx("h1",{className:"text-lg font-semibold text-[#EAEDF5] mb-2",children:"One thing before you continue"}),s.jsx("p",{className:"text-sm text-[#8A92A8] leading-relaxed mb-6",children:"We do not have a record of you accepting our Terms of Service and Privacy Policy. Please review and accept them to carry on to your account."}),c&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-lg px-3 py-2 mb-4",children:c}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"gate-terms",checked:n,onCheckedChange:m=>r(m===!0),className:"mt-0.5"}),s.jsxs(ze,{htmlFor:"gate-terms",className:"text-xs text-[#8A92A8] leading-relaxed cursor-pointer",children:["I agree to the ",s.jsx("a",{href:"/terms.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Terms of Service"})," and ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Privacy Policy"})]})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"gate-marketing",checked:a,onCheckedChange:m=>i(m===!0),className:"mt-0.5"}),s.jsx(ze,{htmlFor:"gate-marketing",className:"text-xs text-[#8A92A8] leading-relaxed cursor-pointer",children:"Send me occasional ViewLink product updates and offers. You can unsubscribe at any time."})]})]}),s.jsx(re,{className:"w-full font-semibold",disabled:!n||o,onClick:d,children:o?"Saving...":"Accept and continue"}),!n&&s.jsx("p",{className:"text-xs text-[#8A92A8] text-center mt-3",children:"Tick the box above to continue."}),s.jsx("button",{type:"button",onClick:()=>void t(),className:"w-full text-xs text-[#8A92A8] hover:text-[#EAEDF5] transition-colors mt-5",children:"Sign out instead"})]})]})})};class Bk extends h.Component{constructor(){super(...arguments);Gl(this,"state",{hasError:!1,message:""})}static getDerivedStateFromError(n){return{hasError:!0,message:n!=null&&n.message?String(n.message):""}}componentDidCatch(n,r){af(n,{contexts:{react:{componentStack:r.componentStack}}}),console.error("ErrorBoundary caught:",n,r.componentStack)}render(){return this.state.hasError?s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",gap:"16px",fontFamily:"sans-serif"},children:[s.jsx("p",{style:{color:"#888"},children:"Something went wrong. Please refresh."}),this.state.message&&s.jsx("p",{style:{color:"#555",fontSize:"12px",fontFamily:"ui-monospace, monospace",maxWidth:"40rem",textAlign:"center",wordBreak:"break-word",margin:0},children:this.state.message}),s.jsx("button",{onClick:()=>window.location.reload(),style:{padding:"8px 20px",borderRadius:"6px",border:"1px solid #444",background:"transparent",color:"#ccc",cursor:"pointer"},children:"Reload"})]}):this.props.children}}const tp="https://cal.com/theo777/meet-the-founder",Vk="https://meet.google.com/zzj-mxnf-tos";function Ee({className:e,...t}){return s.jsx("div",{className:se("animate-pulse rounded-md bg-muted",e),...t})}const Uk={unknown:{tone:"grey",copy:"Checking your connection..."},not_set_up:{tone:"grey",copy:"No server."},provisioning:{tone:"grey",copy:"Setting up your server."},lapsed:{tone:"red",copy:"Your server has ended. Check your billing."},offline:{tone:"grey",copy:"Not connected. Your server isn't reporting in."},awaiting_broker:{tone:"amber",copy:"Waiting for your MT5 broker login."},restarting:{tone:"amber",copy:"Your terminal is restarting. This usually takes a few minutes. You do not need to log in."},syncing:{tone:"amber",copy:"Setting up your symbols. This usually takes about a minute after your MT5 login. If it's been longer than that, contact support."},ready:{tone:"green",copy:"Ready to trade."}},Wk={grey:"text-muted-foreground",amber:"text-warning",red:"text-destructive",green:"text-success"},Yk={grey:"bg-muted-foreground",amber:"bg-warning",red:"bg-destructive",green:"bg-success animate-pulse-connected"};function _o({accountId:e}){const{primary:t,byAccountId:n}=Jf(),r=e?n[e]??"unknown":t,{tone:a,copy:i}=Uk[r];return s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full flex-shrink-0 ${Yk[a]}`}),s.jsx("span",{className:`text-xs font-medium ${Wk[a]}`,children:i})]})}const np=`
17  body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;
18       background:#0D0D0D;color:#fff;
19       font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
20  .vl-wrap{text-align:center;padding:32px;max-width:420px}
21  .vl-ring{width:44px;height:44px;margin:0 auto 28px;border:3px solid #1F2937;border-radius:50%}
22  .vl-ring-spin{border-top-color:#53AEE0;animation:vlspin .9s linear infinite}
23  .vl-ring-err{border-color:#EF4444}
24  .vl-h{margin:0 0 12px;font-size:20px;font-weight:600;letter-spacing:-.01em}
25  .vl-p{margin:0 0 8px;font-size:15px;line-height:1.5;color:#9CA3AF}
26  .vl-p:last-child{margin-bottom:0}
27  /* The other two lines are reassurance. This is the only one asking the reader to
28     DO something, and they are watching a spinner while it happens, so muted grey
29     lets it blend into the waiting text. #fff matches the heading. */
30  .vl-p strong{color:#fff;font-weight:600}
31  @keyframes vlspin{to{transform:rotate(360deg)}}
32  @keyframes vlpulse{0%,100%{opacity:1}50%{opacity:.4}}
33  @media (prefers-reduced-motion:reduce){.vl-ring-spin{animation:vlpulse 1.6s ease-in-out infinite}}
34`,Hk=`<!doctype html><html lang="en"><head><meta charset="utf-8">
35<title>Connecting to MT5 — ViewLink</title>
36<meta name="viewport" content="width=device-width,initial-scale=1">
37<style>${np}</style></head>
38<body><main class="vl-wrap">
39  <div class="vl-ring vl-ring-spin"></div>
40  <h1 class="vl-h">Connecting to MT5</h1>
41  <p class="vl-p">Starting your trading terminal. This can take up to a minute.</p>
42  <p class="vl-p">Please keep this tab open.</p>
43  <p class="vl-p"><strong>Your browser may ask for clipboard access. Allow it, or pasting into the terminal will not work.</strong></p>
44</main></body></html>`;function qk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function hi(e){return`<!doctype html><html lang="en"><head><meta charset="utf-8">
45<title>Couldn't connect to MT5 — ViewLink</title>
46<meta name="viewport" content="width=device-width,initial-scale=1">
47<style>${np}</style></head>
48<body><main class="vl-wrap">
49  <div class="vl-ring vl-ring-err"></div>
50  <h1 class="vl-h">Couldn't connect to MT5</h1>
51  <p class="vl-p">${qk(e)}</p>
52  <p class="vl-p">You can close this tab and try again from your dashboard.</p>
53</main></body></html>`}function Hs(e,t){try{e.document.open(),e.document.write(t),e.document.close()}catch{}}const Gk="https://api.viewlink.dev";function Xk(e){const{session:t}=be(),[n,r]=h.useState(!1),[a,i]=h.useState(null);return{connect:h.useCallback(async()=>{if(!e||!(t!=null&&t.access_token))return;const l=window.open("","_blank");if(!l){$e.capture("mt5_connect_popup_blocked",{account_id:e}),i("Your browser blocked the MT5 tab. Allow pop-ups for this site, then try again.");return}Hs(l,Hk),l.opener=null,r(!0),i(null);try{const c=await fetch(`${Gk}/v1/connect/mt5?account_id=${encodeURIComponent(e)}`,{method:"POST",headers:{Authorization:`Bearer ${t.access_token}`}});if(c.status===401){const m="Your session expired. Please sign in again.";Hs(l,hi(m)),i(m);return}if(!c.ok){const m=await c.json().catch(()=>({})),p=(m==null?void 0:m.detail)||"Could not connect. Please retry.";Hs(l,hi(p)),i(p);return}const{guac_url:u,mt5_state:d}=await c.json();$e.capture("mt5_connect_opened",{account_id:e,mt5_state:d??"unknown"}),l.location.href=u}catch{const c="Network error. Please retry.";Hs(l,hi(c)),i(c)}finally{r(!1)}},[e,t==null?void 0:t.access_token]),connecting:n,connectError:a}}const Kk=1e4,Jk={active:{label:"EA Active",sublabel:"System operational",colorClass:"text-primary",dotClass:"bg-primary animate-pulse-connected",bgStyle:{background:"linear-gradient(90deg, rgba(83,174,224,0.08) 0%, transparent 60%)"},borderStyle:{borderBottom:"1px solid rgba(83,174,224,0.20)"},shadowStyle:{boxShadow:"0 0 12px rgba(83,174,224,0.15)"},textGlow:"0 0 8px rgba(83,174,224,0.65)"},idle:{label:"EA Idle",sublabel:"Waiting for activity",colorClass:"text-warning",dotClass:"bg-warning animate-pulse-connected",bgStyle:{background:"linear-gradient(90deg, rgba(245,158,11,0.08) 0%, transparent 60%)"},borderStyle:{borderBottom:"1px solid rgba(245,158,11,0.20)"},shadowStyle:{boxShadow:"0 0 12px rgba(245,158,11,0.15)"},textGlow:"0 0 8px rgba(245,158,11,0.65)"},disconnected:{label:"EA Disconnected",sublabel:"Check your VPS",colorClass:"text-destructive",dotClass:"bg-destructive",bgStyle:{background:"linear-gradient(90deg, rgba(239,68,68,0.08) 0%, transparent 60%)"},borderStyle:{borderBottom:"1px solid rgba(239,68,68,0.20)"},shadowStyle:{boxShadow:"0 0 12px rgba(239,68,68,0.15)"},textGlow:""},lost_contact:{label:"EA Offline",sublabel:"Lost contact with your VPS. Your trades won't execute until it reconnects",colorClass:"text-destructive",dotClass:"bg-destructive",bgStyle:{background:"linear-gradient(90deg, rgba(239,68,68,0.08) 0%, transparent 60%)"},borderStyle:{borderBottom:"1px solid rgba(239,68,68,0.20)"},shadowStyle:{boxShadow:"0 0 12px rgba(239,68,68,0.15)"},textGlow:""}};function Qk(e){return e==="active"?"active":e==="suspended"||!e?"disconnected":"idle"}function Zk(){const{user:e,session:t}=be(),[n,r]=h.useState(null),[a,i]=h.useState(!1),[o,l]=h.useState(null),[c,u]=h.useState(null),[d,m]=h.useState(null),[p,f]=h.useState(null),[g,x]=h.useState(null),[b,y]=h.useState(!0),[j,v]=h.useState(!1),C=h.useRef(null),T=async()=>{var J,O,z,F,k,H,R,w;if(!e)return;v(!1);const[A,V]=await Promise.all([Z.from("vps_records").select("status, contact_lost").eq("user_id",e.id).limit(1).maybeSingle(),Z.from("mt5_accounts").select("id, broker_connected, broker_identity_synced_at, account_trade_expert, terminal_trade_allowed, mql_trade_allowed").eq("user_id",e.id).eq("is_active",!0).order("sort_order",{ascending:!0}).limit(1).maybeSingle()]);A.error?v(!0):(r(((O=(J=A.data)==null?void 0:J.status)==null?void 0:O.toLowerCase())??null),i(((z=A.data)==null?void 0:z.contact_lost)===!0)),(F=V.data)!=null&&F.id&&l(V.data.id),u(((k=V.data)==null?void 0:k.broker_connected)??null),m(((H=V.data)==null?void 0:H.account_trade_expert)??null),f(((R=V.data)==null?void 0:R.terminal_trade_allowed)??null),x(((w=V.data)==null?void 0:w.mql_trade_allowed)??null),y(!1)};h.useEffect(()=>(T(),C.current=setInterval(T,Kk),()=>{C.current&&clearInterval(C.current)}),[e]);const{connect:S,connecting:E,connectError:B}=Xk(o),P=a?"lost_contact":Qk(n),N=Jk[P],L=n==="active";let _=null;L&&c===!0&&!a&&(d===!1?_="Your broker account has automated trading disabled.":p===!1?_="AutoTrading is turned off in your MT5 terminal.":g===!1&&(_="Automated trading is not permitted for this EA."));const D=!b&&L&&!!o;return b?s.jsx("div",{className:"h-10 w-full flex items-center px-4",children:s.jsx(Ee,{className:"h-4 w-48"})}):s.jsxs("div",{className:"h-10 w-full flex items-center px-4 gap-2",style:{backgroundColor:"#111111",...N.bgStyle,...N.borderStyle,...N.shadowStyle},children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full flex-shrink-0 ${N.dotClass}`}),s.jsx("span",{className:`text-xs font-semibold tracking-widest uppercase ${N.colorClass}`,style:N.textGlow?{textShadow:N.textGlow}:void 0,children:N.label}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",N.sublabel]}),s.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[B&&s.jsx("span",{className:"text-xs text-destructive",children:B}),_&&s.jsx("span",{className:"hidden sm:block text-xs text-amber-400",children:_}),s.jsx(_o,{}),D&&s.jsxs("button",{onClick:S,disabled:E,className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-semibold transition-all disabled:opacity-60",style:{background:"rgba(245,158,11,0.18)",color:"#F59E0B",border:"1px solid rgba(245,158,11,0.40)",boxShadow:E?"none":"0 0 10px rgba(245,158,11,0.25)"},children:[s.jsx(km,{className:"h-3 w-3"}),E?"Connecting…":"Connect to MT5"]}),j&&s.jsx("button",{onClick:T,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Retry"})]})]})}const e_="https://api.viewlink.dev";function rp(){const{session:e}=be(),{toast:t}=Wt(),[n,r]=h.useState(!1);return{reactivate:h.useCallback(async(i="starter")=>{if(e){r(!0);try{$e.capture("billing_reactivate_clicked",{plan:i});const o=await fetch(`${e_}/v1/billing/checkout`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({plan_slug:i})}),l=await o.json();if(o.status===401){t({title:"Your session expired. Please sign in again.",variant:"destructive"}),r(!1);return}if(!o.ok){t({title:"Couldn't start reactivation",description:l.detail||"Please try again in a moment.",variant:"destructive"}),r(!1);return}window.location.href=l.checkout_url}catch{t({title:"Network error",description:"Please check your connection and try again.",variant:"destructive"}),r(!1)}}},[e,t]),reactivating:n}}const t_=["lapsed","cancelled","lapsing"];function n_(){const{user:e}=be(),{reactivate:t,reactivating:n}=rp(),[r,a]=h.useState(!1),[i,o]=h.useState("starter");return h.useEffect(()=>{if(!e)return;let l=!1;return(async()=>{const{data:c}=await Z.from("subscriptions").select("status, plan_config_id").eq("user_id",e.id).limit(1).maybeSingle();if(l)return;const u=t_.includes((c==null?void 0:c.status)??"");if(a(u),u&&(c!=null&&c.plan_config_id)){const{data:d}=await Z.from("plan_configs").select("plan_slug").eq("id",c.plan_config_id).maybeSingle();
53!l&&(d!=null&&d.plan_slug)&&o(d.plan_slug)}})(),()=>{l=!0}},[e]),r?s.jsx("div",{className:"border-b border-destructive/30 bg-destructive/10 px-4 lg:px-6 py-2.5",children:s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsx(Cn,{className:"text-destructive shrink-0",size:16}),s.jsx("span",{className:"text-sm text-foreground",children:"Your account is on hold. Your alerts won't trade until you reactivate."}),s.jsxs("button",{onClick:()=>t(i),disabled:n,className:"ml-auto inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-opacity disabled:opacity-60",children:[n?s.jsx(yt,{size:14,className:"animate-spin"}):s.jsx(zt,{size:14}),"Reactivate"]})]})}):null}const Te={bg:"#0D0D0D",surface:"#111111",border:"#1F2937",accent:"#53AEE0",accentDim:"rgba(83,174,224,0.10)",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"},sp=[{to:"/dashboard",label:"Dashboard",Icon:gs},{to:"/setup-guide",label:"Setup Guide",Icon:Bo},{to:"/trade-log",label:"Trade Log",Icon:Rg},{to:"/settings",label:"Settings",Icon:_m},{to:"/billing",label:"Billing",Icon:xs},{to:"/discord",label:"Discord",Icon:ys},{to:"/broker-partner",label:"Broker partner",Icon:Fg},{to:Vk,label:"Office hours · Tue 21:00 UTC+2",Icon:jm,external:!0},{to:tp,label:"Meet the founder",Icon:zg,external:!0}],r_={"/dashboard":"Dashboard","/setup-guide":"Setup Guide","/trade-log":"Trade Log","/settings":"Settings","/billing":"Billing","/discord":"Community","/broker-partner":"Broker partner","/admin":"Admin"};function du({to:e,label:t,Icon:n,onClick:r,external:a}){return a?s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:r,className:"group flex items-center gap-3 rounded-lg py-2.5 text-sm font-medium transition-all duration-100",style:{background:"transparent",color:Te.textMuted,borderLeft:"2px solid transparent",paddingLeft:"10px",paddingRight:"12px"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(255,255,255,0.04)",i.currentTarget.style.color=Te.textPrimary},onMouseLeave:i=>{i.currentTarget.style.background="transparent",i.currentTarget.style.color=Te.textMuted},children:[s.jsx(n,{size:18}),s.jsx("span",{children:t})]}):s.jsxs(Im,{to:e,onClick:r,className:"group flex items-center gap-3 rounded-lg py-2.5 text-sm font-medium transition-all duration-100",style:({isActive:i})=>({background:i?Te.accentDim:"transparent",color:i?Te.accent:Te.textMuted,borderLeft:i?`2px solid ${Te.accent}`:"2px solid transparent",paddingLeft:"10px",paddingRight:"12px"}),onMouseEnter:i=>{i.currentTarget.classList.contains("active")||(i.currentTarget.style.background="rgba(255,255,255,0.04)",i.currentTarget.style.color=Te.textPrimary)},onMouseLeave:i=>{i.currentTarget.getAttribute("aria-current")==="page"||(i.currentTarget.style.background="transparent",i.currentTarget.style.color=Te.textMuted)},children:[s.jsx(n,{size:18}),s.jsx("span",{children:t})]})}function mu({onClose:e}){var o,l;const{user:t,signOut:n}=be(),r=ep(),a=nt(),i=async()=>{Qf(),il(),await n(),a("/login",{replace:!0}),e==null||e()};return s.jsxs("div",{className:"flex h-full flex-col",style:{background:Te.surface,borderRight:`1px solid ${Te.border}`},children:[s.jsxs("div",{className:"flex h-24 items-center px-4",style:{borderBottom:`1px solid ${Te.border}`},children:[s.jsx("img",{src:et,alt:"ViewLink",className:"h-20 w-auto bg-transparent"}),e&&s.jsx("button",{onClick:e,className:"ml-auto flex h-8 w-8 items-center justify-center rounded-lg transition-colors",style:{color:Te.textMuted},onMouseEnter:c=>c.currentTarget.style.color=Te.textPrimary,onMouseLeave:c=>c.currentTarget.style.color=Te.textMuted,children:s.jsx(rr,{size:18})})]}),s.jsxs("nav",{className:"flex-1 overflow-y-auto px-3 py-4 space-y-0.5",children:[sp.map(c=>s.jsx(du,{...c,onClick:e},c.to)),r===!0&&s.jsx(du,{to:"/admin",label:"Admin",Icon:Pa,onClick:e})]}),s.jsx("div",{style:{borderTop:`1px solid ${Te.border}`}}),s.jsxs("div",{className:"px-3 py-4 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg",style:{background:"rgba(255,255,255,0.03)"},children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold",style:{background:Te.accentDim,color:Te.accent,border:"1px solid rgba(83,174,224,0.25)"},children:((l=(o=t==null?void 0:t.email)==null?void 0:o[0])==null?void 0:l.toUpperCase())??"U"}),s.jsx("span",{className:"truncate text-xs",style:{color:Te.textMuted},title:(t==null?void 0:t.email)??"",children:(t==null?void 0:t.email)??""})]}),s.jsxs("button",{onClick:i,className:"flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-100",style:{color:Te.textMuted,background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(239,68,68,0.08)",c.currentTarget.style.color="#EF4444"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.color=Te.textMuted},children:[s.jsx(Og,{size:18}),s.jsx("span",{children:"Log Out"})]}),s.jsx("div",{className:"flex items-center justify-center gap-3 pt-1",children:[{href:"/privacy.html",label:"Privacy"},{href:"/terms.html",label:"Terms"}].map(({href:c,label:u})=>s.jsx("a",{href:c,className:"text-xs transition-colors duration-100",style:{color:Te.textMuted},onMouseEnter:d=>d.currentTarget.style.color=Te.textPrimary,onMouseLeave:d=>d.currentTarget.style.color=Te.textMuted,children:u},c))})]})]})}function s_({onOpenSidebar:e}){const t=sr();return s.jsxs("nav",{className:"fixed bottom-0 left-0 right-0 z-40 flex items-center justify-around px-2 pb-safe lg:hidden",style:{background:Te.surface,borderTop:`1px solid ${Te.border}`,height:"56px"},children:[sp.slice(0,3).map(({to:n,label:r,Icon:a})=>{const i=t.pathname===n;return s.jsxs(Im,{to:n,className:"flex flex-1 flex-col items-center gap-0.5 py-1.5",style:{color:i?Te.accent:Te.textMuted},children:[s.jsx(a,{size:20}),s.jsx("span",{className:"text-[10px] font-medium",children:r})]},n)}),s.jsxs("button",{onClick:e,className:"flex flex-1 flex-col items-center gap-0.5 py-1.5",style:{color:Te.textMuted},children:[s.jsx($o,{size:20}),s.jsx("span",{className:"text-[10px] font-medium",children:"More"})]})]})}function gi(){const e=sr(),[t,n]=h.useState(!1),r=r_[e.pathname]??(e.pathname.startsWith("/setup-guide")?"Setup Guide":"ViewLink");return s.jsxs("div",{className:"flex min-h-screen",style:{background:Te.bg},children:[s.jsx("aside",{className:"hidden lg:flex lg:flex-col lg:w-60 lg:fixed lg:inset-y-0 lg:z-30",children:s.jsx(mu,{})}),t&&s.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[s.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"},onClick:()=>n(!1)}),s.jsx("div",{className:"absolute inset-y-0 left-0 w-64 shadow-2xl",children:s.jsx(mu,{onClose:()=>n(!1)})})]}),s.jsxs("div",{className:"flex flex-1 flex-col lg:ml-60",children:[s.jsxs("header",{className:"sticky top-0 z-20 flex h-14 items-center gap-3 px-4 lg:px-6",style:{background:Te.bg,borderBottom:`1px solid ${Te.border}`},children:[s.jsx("button",{onClick:()=>n(!0),className:"flex h-8 w-8 items-center justify-center rounded-lg lg:hidden",style:{color:Te.textMuted},children:s.jsx($o,{size:18})}),s.jsx("h1",{className:"text-base font-semibold tracking-tight",style:{color:Te.textPrimary},children:r})]}),s.jsx(n_,{}),s.jsx("div",{className:"sticky top-14 z-10 bg-[#111111]",children:s.jsx(Zk,{})}),s.jsx("main",{className:"flex-1 pb-16 lg:pb-0",children:s.jsx(xx,{})})]}),s.jsx(s_,{onOpenSidebar:()=>n(!0)})]})}const la="vl_cookie_consent";function a_(){const[e,t]=h.useState(!1);h.useEffect(()=>{const a=localStorage.getItem(la);a==="accepted"?$e.opt_in_capturing():a||t(!0)},[]);const n=()=>{localStorage.setItem(la,"accepted"),$e.opt_in_capturing(),t(!1)},r=()=>{localStorage.setItem(la,"rejected"),$e.opt_out_capturing(),t(!1)};return e?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-black/60 backdrop-blur-[2px] animate-fade-in","aria-hidden":"true"}),s.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Cookie consent",className:"fixed inset-x-0 bottom-0 z-50 border-t border-border bg-card px-4 py-5 shadow-2xl animate-fade-up",children:s.jsxs("div",{className:"mx-auto flex max-w-5xl flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"text-sm text-foreground",children:["We use analytics cookies to understand how ViewLink is used and improve the product. You can accept or reject. See our"," ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline-offset-4 hover:underline",children:"Privacy Policy"}),"."]}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(re,{variant:"outline",size:"sm",onClick:r,children:"Reject"}),s.jsx(re,{variant:"default",size:"sm",onClick:n,children:"Accept"})]})]})})]}):null}const i_=()=>{const{session:e}=be(),t=h.useRef(!1);return h.useEffect(()=>{Sk()},[]),h.useEffect(()=>{const n=!!(e!=null&&e.user),r=t.current;if(n){const a=e.user.email,i=e.user.id;a&&i&&Ek(a,i)}else r&&il();t.current=n},[e]),null},pn=_g,o_=kg,ap=h.forwardRef(({className:e,...t},n)=>s.jsx(lm,{ref:n,className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));ap.displayName=lm.displayName;const en=h.forwardRef(({className:e,children:t,hideClose:n=!1,...r},a)=>s.jsxs(o_,{children:[s.jsx(ap,{}),s.jsxs(cm,{ref:a,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
53nded-lg",e),...r,children:[t,!n&&s.jsxs(wg,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(rr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));en.displayName=cm.displayName;const It=({className:e,...t})=>s.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});It.displayName="DialogHeader";const hn=({className:e,...t})=>s.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hn.displayName="DialogFooter";const Dt=h.forwardRef(({className:e,...t},n)=>s.jsx(um,{ref:n,className:se("text-lg font-semibold leading-none tracking-tight",e),...t}));Dt.displayName=um.displayName;const Bt=h.forwardRef(({className:e,...t},n)=>s.jsx(dm,{ref:n,className:se("text-sm text-muted-foreground",e),...t}));Bt.displayName=dm.displayName;const l_=({open:e,countdown:t,onStay:n,onLogoutNow:r,onOpenChange:a})=>s.jsx(pn,{open:e,onOpenChange:a,children:s.jsxs(en,{className:"sm:max-w-md",style:{background:"#13161E",border:"1px solid #252A38",boxShadow:"0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px #252A38"},children:[s.jsxs(It,{children:[s.jsx(Dt,{className:"text-[1.125rem] font-semibold",style:{color:"#EAEDF5"},children:"Still there?"}),s.jsxs(Bt,{className:"text-[0.9375rem]",style:{color:"#8A92A8",lineHeight:1.6},children:["You'll be signed out in"," ",s.jsxs("strong",{style:{color:"#EAEDF5"},children:[t,"s"]})," due to inactivity."]})]}),s.jsxs("div",{className:"flex items-center gap-4 pt-1",children:[s.jsx("button",{onClick:n,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:{background:"#4A72FF",color:"#fff",border:"none"},children:"Stay signed in"}),s.jsx("button",{onClick:r,className:"text-[0.8125rem] transition-colors duration-150",style:{color:"#505770"},onMouseEnter:i=>i.target.style.color="#8A92A8",onMouseLeave:i=>i.target.style.color="#505770",children:"Log out now"})]})]})}),c_=15,ca=60,ip=1e3,u_=60,d_=1e3,m_=(c_*u_-ca)*ip,fu=["mousemove","mousedown","keydown","scroll","touchstart","click"];function f_(e,t){let n;const r=(...a)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...a),t)};return r.cancel=()=>{n&&clearTimeout(n)},r}const p_=()=>{const{session:e,signOut:t}=be(),n=nt(),r=!!e,[a,i]=h.useState(!1),[o,l]=h.useState(ca),c=h.useRef(t);c.current=t;const u=h.useRef(n);u.current=n;const d=h.useRef(()=>{}),m=h.useRef(()=>{}),p=h.useRef(!1);return h.useEffect(()=>{if(!r)return;let f,g;const x=()=>{f&&clearTimeout(f),g&&clearInterval(g)},b=async()=>{x(),p.current=!1,i(!1),Qf(),il();try{await c.current()}finally{u.current("/login?reason=inactive",{replace:!0})}},y=()=>{p.current=!0,i(!0),l(ca);let E=ca;g=setInterval(()=>{E-=1,l(E),E<=0&&(g&&clearInterval(g),b())},ip)},j=()=>{f&&clearTimeout(f),f=setTimeout(y,m_)},v=()=>{p.current||j()},C=()=>{g&&clearInterval(g),p.current=!1,i(!1),j()};d.current=C,m.current=()=>void b();const T=f_(v,d_);fu.forEach(E=>window.addEventListener(E,T,{passive:!0}));const S=()=>{p.current||(document.hidden?x():j())};return document.addEventListener("visibilitychange",S),j(),()=>{T.cancel(),fu.forEach(E=>window.removeEventListener(E,T)),document.removeEventListener("visibilitychange",S),x(),p.current=!1}},[r]),s.jsx(l_,{open:a,countdown:o,onStay:()=>d.current(),onLogoutNow:()=>m.current(),onOpenChange:f=>{f||d.current()}})};function op(e){const{session:t,loading:n}=be(),r=nt();h.useEffect(()=>{n||t&&r(e,{replace:!0})},[n,t,e,r])}const h_="https://login-sa.atfx.com/register?redirect_uri=applyLive&invitationCode=glP9U8i8lw49QvTqONkDXA%3D%3D",g_="Trading financial instruments carries a high level of risk to your capital. You may lose more than your initial investment. Ensure you understand the risks before trading.",x_="ViewLink is an ATFX affiliate, acting as an Introducing Broker. If you open an account through this link, we may receive a payment of $4 to $12 per lot you trade, depending on the instrument. ViewLink does not recommend or endorse any broker. The choice of broker is yours, and ViewLink works the same way whichever one you use.",y_="ViewLink is an ATFX affiliate, acting as an Introducing Broker. If you open an account through this link, we may receive a payment on every lot you trade, at the rates below. ViewLink does not recommend or endorse any broker. The choice of broker is yours, and ViewLink works the same way whichever one you use.",b_="Your ViewLink subscription costs the same either way. This arrangement does not add anything to what you pay us.",v_="This ATFX offer is available to South African residents only.",w_="#0F2C52";function ol({height:e=40}){return s.jsx("span",{className:"inline-flex shrink-0 items-center justify-center rounded-md bg-white",style:{padding:Math.round(e*.3)},children:s.jsx("img",{src:"/atfx-logo.png",alt:"ATFX",style:{height:e,width:"auto",display:"block"}})})}function ll({exact:e=!1}){return s.jsxs("div",{className:"space-y-2 text-xs leading-relaxed",style:{color:"#9
53CA3AF"},children:[s.jsx("p",{children:e?y_:x_}),s.jsx("p",{children:b_}),s.jsx("p",{style:{color:"#D1D5DB"},children:v_}),s.jsx("p",{children:g_})]})}function cl({label:e="Visit ATFX"}){return s.jsxs("a",{href:h_,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg px-3.5 py-2 text-sm font-medium transition-opacity hover:opacity-90",style:{background:w_,color:"#FFFFFF"},children:[e,s.jsx("span",{"aria-hidden":"true",children:"→"})]})}const Yr={bg:"#0D0D0D",surface:"#111111",border:"#1F2937",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"};function k_(){return s.jsx("section",{className:"px-6 py-16",style:{background:Yr.bg},children:s.jsxs("div",{className:"mx-auto max-w-3xl rounded-xl p-5 lg:p-6",style:{background:Yr.surface,border:`1px solid ${Yr.border}`},children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider",style:{color:Yr.textMuted},children:"Broker partner"}),s.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:s.jsx(ol,{height:28})}),s.jsx("p",{className:"mt-4 text-sm leading-relaxed",style:{color:Yr.textPrimary},children:"ViewLink works with any MT5 broker. ATFX is the one broker we have an affiliate arrangement with."}),s.jsx("div",{className:"mt-4",children:s.jsx(ll,{})}),s.jsx("div",{className:"mt-5",children:s.jsx(cl,{})})]})})}const __="/assets/kevin-theo-CMl9XnGY.png",j_="https://api.viewlink.dev",Qe={bg:"#0D0D0D",border:"#1F2937",accent:"#53AEE0",textPrimary:"#FFFFFF",textMuted:"#9CA3AF",danger:"#F87171"};function pu({on:e}){return s.jsx("span",{"aria-hidden":"true",className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded",style:{border:`2px solid ${e?Qe.accent:Qe.border}`,background:e?Qe.accent:"transparent"},children:e&&s.jsx("svg",{viewBox:"0 0 16 16",width:"10",height:"10",fill:"none",children:s.jsx("path",{d:"M13 4L6 12L3 8.5",stroke:Qe.bg,strokeWidth:"2.8",strokeLinecap:"round",strokeLinejoin:"round"})})})}function N_(){const[e,t]=h.useState(""),[n,r]=h.useState(""),[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,m]=h.useState(!1),[p,f]=h.useState(null),g=e.trim().length>0&&a&&!c;async function x(b){if(b.preventDefault(),!!g){u(!0),f(null);try{const y=await fetch(`${j_}/v1/join/overflow`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.trim(),name:n.trim()||null,slot_notifications:a,marketing_consent:o})});if(y.ok){m(!0);return}f(y.status===429?"Too many attempts. Please try again in a minute.":"Something went wrong. Please try again.")}catch{f("Something went wrong. Please try again.")}finally{u(!1)}}}return d?s.jsx("p",{className:"mt-3 text-[13px]",style:{color:Qe.textMuted},children:"Thanks. We have your email and we will be in touch when a spot opens."}):s.jsxs("form",{onSubmit:x,className:"mt-3 text-left",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[s.jsx("input",{type:"email",required:!0,value:e,onChange:b=>t(b.target.value),placeholder:"[email protected]","aria-label":"Email address",className:"min-w-0 flex-1 rounded px-3 py-2 text-[13px] outline-none",style:{background:Qe.bg,border:`1px solid ${Qe.border}`,color:Qe.textPrimary}}),s.jsx("input",{type:"text",value:n,onChange:b=>r(b.target.value),placeholder:"First name (optional)","aria-label":"First name, optional",className:"min-w-0 flex-1 rounded px-3 py-2 text-[13px] outline-none",style:{background:Qe.bg,border:`1px solid ${Qe.border}`,color:Qe.textPrimary}})]}),s.jsxs("label",{className:"mt-3 flex cursor-pointer items-start gap-2.5",children:[s.jsx("input",{type:"checkbox",className:"sr-only",checked:a,onChange:b=>i(b.target.checked)}),s.jsx(pu,{on:a}),s.jsxs("span",{className:"text-[12px] leading-relaxed",style:{color:Qe.textPrimary},children:["Email me when free trial spots open."," ",s.jsx("span",{style:{color:Qe.textMuted},children:"(required)"})]})]}),s.jsxs("label",{className:"mt-2 flex cursor-pointer items-start gap-2.5",children:[s.jsx("input",{type:"checkbox",className:"sr-only",checked:o,onChange:b=>l(b.target.checked)}),s.jsx(pu,{on:o}),s.jsxs("span",{className:"text-[12px] leading-relaxed",style:{color:Qe.textPrimary},children:["Send me occasional product updates and news."," ",s.jsx("span",{style:{color:Qe.textMuted},children:"(optional)"})]})]}),s.jsx("button",{type:"submit",disabled:!g,className:"mt-3 w-full rounded px-4 py-2 text-[13px] font-semibold transition-opacity",style:{background:Qe.accent,color:Qe.bg,opacity:g?1:.45,cursor:g?"pointer":"not-allowed"},children:c?"Submitting...":"Notify me"}),p&&s.jsx("p",{className:"mt-2 text-[12px]",style:{color:Qe.danger},role:"alert",children:p}),s.jsxs("p",{className:"mt-2 text-[11px] leading-relaxed",style:{color:Qe.textMuted},children:["By submitting, you agree to our"," ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",style:{color:Qe.accent},children:"Privacy Policy"}),"."]})]})}const S_="https://api.viewlink.dev";let qs=null;function E_(){return qs||(qs=fetch(`${S_}/v1/signup-survey/spots`).then(e=>e.ok?e.json():null).then(e=>{const t=e==null?void 0:e.spots;return typeof t=="number"&&Number.isFinite(t)?Math.max(0,t):null}).catch(()=>null),qs)}function C_(){const[e,t]=h.useState(null);return h.useEffect(()=>{let n=!0;return E_().then(r=>{n&&t(r)}),()=>{n=!1}},[]),e}const xi={accent:"#53AEE0",textMuted:"#9CA3AF"};function T_({gating:e}){const t=C_(),[n,r]=h.useState(0),a=h.useRef(void 0);return h.useEffect(()=>{if(t===null||t===0)return;const i=1500,o=performance.now(),l=c=>{const u=Math.min((c-o)/i,1),d=1-Math.pow(1-u,3),m=Math.round(d*t);r(p=>p===m?p:m),u<1&&(a.current=requestAnimationFrame(l))};return a.current=requestAnimationFrame(l),()=>{a.current&&cancelAnimationFrame(a.current)}},[t]),e!==!1||t===null?null:t===0?s.jsxs("div",{className:"mt-5 w-full max-w-[400px]",children:[s.jsx("p",{className:"text-[13px]",style:{color:xi.textMuted},children:"Free trial spots are not open right now. You can still subscribe below."}),s.jsx(N_,{})]}):s.jsxs("p",{className:"mt-5 text-[13px]",style:{color:xi.textMuted},children:[s.jsx("span",{className:"inline-block min-w-[2ch] text-right font-semibold tabular-nums",style:{color:xi.accent}
53,children:n.toLocaleString()})," ","free trial ",t===1?"spot":"spots"," left"]})}const A_="https://api.viewlink.dev";function lp(){const[e,t]=h.useState(null);return h.useEffect(()=>{let n=!0;return fetch(`${A_}/v1/billing/config`).then(r=>r.ok?r.json():null).then(r=>{n&&t(!!(r!=null&&r.invite_gating_enabled))}).catch(()=>{n&&t(!1)}),()=>{n=!1}},[]),e}const I_="https://api.viewlink.dev",ua={endsAt:null,name:"",headline:"",badge:"",live:!1};let Gs=null;function yi(e){return typeof e=="string"?e:""}function D_(){return Gs||(Gs=fetch(`${I_}/v1/offer/limited-launch`).then(e=>e.ok?e.json():null).then(e=>{const t=e==null?void 0:e.ends_at;if(!t)return ua;const n=new Date(t);return Number.isNaN(n.getTime())?ua:{endsAt:n,name:yi(e==null?void 0:e.name),headline:yi(e==null?void 0:e.headline),badge:yi(e==null?void 0:e.badge),live:n.getTime()>Date.now()}}).catch(()=>ua),Gs)}function Ya(){const[e,t]=h.useState(ua);return h.useEffect(()=>{let n=!0;return D_().then(r=>{n&&t(r)}),()=>{n=!1}},[]),e}const P_=1e3;function M_(e,t){const n=e.getTime()-t;if(n<=0)return null;const r=Math.floor(n/1e3);return{days:Math.floor(r/86400),hours:Math.floor(r%86400/3600),minutes:Math.floor(r%3600/60),seconds:r%60}}function cp(e){return e.days>0?`${e.days}d ${e.hours}h`:e.hours>0?`${e.hours}h ${e.minutes}m`:`${e.minutes}m ${e.seconds}s`}function L_(e){const t=[];return e.days>0&&t.push(`${e.days}d`),(e.days>0||e.hours>0)&&t.push(`${e.hours}h`),(e.days>0||e.hours>0||e.minutes>0)&&t.push(`${e.minutes}m`),t.push(`${e.seconds}s`),t.join(" ")}function O_(e){return e.toLocaleString(void 0,{day:"numeric",month:"short",hour:"numeric",minute:"2-digit"})}function Ha(e){const[t,n]=h.useState(()=>Date.now());return h.useEffect(()=>{if(!e||e.getTime()<=Date.now())return;const r=setInterval(()=>n(Date.now()),P_);return()=>clearInterval(r)},[e]),e?M_(e,t):null}const Ct={accent:"#53AEE0",accentDim:"rgba(83,174,224,0.10)",accentBorder:"rgba(83,174,224,0.30)",bg:"#0D0D0D",elevated:"#1A1A1A",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"};function Xs({value:e,label:t}){return s.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg text-2xl font-bold tabular-nums sm:h-16 sm:w-16 sm:text-3xl",style:{background:Ct.bg,border:`1px solid ${Ct.accentBorder}`,color:Ct.textPrimary},children:String(e).padStart(2,"0")}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:Ct.textMuted},children:t})]})}function R_(){const{endsAt:e,live:t,name:n,headline:r}=Ya(),a=Ha(e);return!t||!e||!a?null:s.jsxs("div",{className:"mx-auto mb-10 max-w-3xl overflow-hidden rounded-2xl",style:{background:Ct.elevated,border:`1px solid ${Ct.accentBorder}`},children:[s.jsx("div",{className:"flex items-center justify-center px-6 py-3 text-center",style:{background:Ct.accentDim,borderBottom:`1px solid ${Ct.accentBorder}`},children:s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[0.18em]",style:{color:Ct.accent},children:n})}),s.jsxs("div",{className:"flex flex-col items-center px-6 py-7 text-center",children:[r&&s.jsx("p",{className:"mb-6 max-w-[36ch] text-lg font-semibold leading-snug sm:text-xl",style:{color:Ct.textPrimary},children:r}),s.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[0.18em]",style:{color:Ct.textMuted},children:"Discount ends in"}),s.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[s.jsx(Xs,{value:a.days,label:"Days"}),s.jsx(Xs,{value:a.hours,label:"Hrs"}),s.jsx(Xs,{value:a.minutes,label:"Min"}),s.jsx(Xs,{value:a.seconds,label:"Sec"})]}),s.jsxs("p",{className:"mt-5 text-[12px]",style:{color:Ct.textMuted},children:["Closes ",O_(e)," your time."]})]})]})}function F_({fallback:e}){const{endsAt:t,live:n,name:r}=Ya(),a=Ha(t);return!n||!a?s.jsx(s.Fragment,{children:e}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-semibold",children:r}),": ","discount ends in"," ",s.jsx("span",{className:"font-semibold tabular-nums",children:L_(a)})]})}const Zn=e=>typeof e=="number"&&Number.isFinite(e)&&e>0,up=(e,t)=>Zn(e)&&Zn(t)&&t>e;function wa(e,t){return Zn(e)?up(e,t)?`Free for ${e} days. Place your first trade and we make it ${t}.`:`Free for ${e} days.`:null}function jo(e,t){return Zn(e)?up(e,t)?`${e} days free, ${t} if you trade`:`${e} days free`:null}function dp(e){return Zn(e)?`Start my ${e} days free`:null}function z_(e,t){return Zn(e)?`${e}-day free trial. Cancel anytime.`:null}function ka(e){return Zn(e)?e:null}const $_={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_BASE_URL:"https://api.viewlink.dev",VITE_CRISP_WEBSITE_ID:"5bcd2a98-acb0-4a01-b717-ff4dcb86acaa",VITE_DISCORD_CLIENT_ID:"1522946804457537699",VITE_DISCORD_REDIRECT_URI:"https://bocsxhpaswkalhedfnzz.supabase.co/functions/v1/discord-oauth-callback",VITE_KEVIN_LINKEDIN:"https://www.linkedin.com/in/gabriel-kevin-maja",VITE_LANDING_DEMO_VIDEO_URL:"https://pub-280f828cf152489397f9a33ceffdf206.r2.dev/mt5-demo2.mp4",VITE_POSTHOG_HOST:"https://eu.i.posthog.com",VITE_POSTHOG_KEY:"phc_DdV5ot9eEqhV2wYDu7j5iusV8ijAvqR2Gbu5hUmmbPty",VITE_SENTRY_DSN:"https://bcf59b7921257e31ee3397460927db15@o4511610543210496.ingest.de.sentry.io/4511610589347920",VITE_SENTRY_ENVIRONMENT:"production",VITE_SETUP_VIDEO_URL:"https://pub-280f828cf152489397f9a33ceffdf206.r2.dev/mt5-demo2.mp4",VITE_SOCIAL_DISCORD:"https://discord.gg/ZnWSUvxpdN",VITE_SOCIAL_FACEBOOK:"https://www.facebook.com/profile.php?id=61578801262094",VITE_SOCIAL_INSTAGRAM:"https://www.instagram.com/viewlink_official",VITE_SOCIAL_TIKTOK:"https://www.tiktok.com/@viewlink.dev",VITE_SOCIAL_XTWITTER:"https://x.com/view_link10",VITE_SOCIAL_YOUTUBE:"https://www.youtube.com/@viewlink_official",VITE_SUPABASE_PUBLISHABLE_KEY:"sb_publishable_v5Zeef2HErFcpIoikDEp3g_n6oNgyJu",VITE_SUPABASE_URL:"https://bocsxhpaswkalhedfnzz.supabase.co",VITE_THEO_LINKEDIN:"https://www.linkedin.com/in/theodore-maja-9957b81a2"}
53,$={bg:"#0D0D0D",surface:"#111111",elevated:"#1A1A1A",border:"#1F2937",accent:"#53AEE0",accentDim:"rgba(83,174,224,0.10)",accentBorder:"rgba(83,174,224,0.30)",accentGlow:"rgba(83,174,224,0.45)",glowInner:"rgba(83,174,224,0.45)",glowOuter:"rgba(83,174,224,0.22)",glowInnerHover:"rgba(83,174,224,0.70)",glowOuterHover:"rgba(83,174,224,0.38)",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"},B_=`0 0 12px ${$.glowInner}, 0 0 32px ${$.glowOuter}`,V_=`0 0 20px ${$.glowInnerHover}, 0 0 52px ${$.glowOuterHover}`,hu=[{href:"#features",label:"Features"},{href:"#pricing",label:"Pricing"},{href:"#faq",label:"FAQ"},{href:"#about",label:"About"}],gu="mobile-nav-panel",U_=768,W_={sm:"px-5 py-2 text-sm",md:"flex h-11 items-center gap-2 px-7 text-[15px]",lg:"px-10 py-3.5 text-base",card:"w-full py-3 text-sm",cardCompact:"w-full py-2.5 text-sm"};function yr({children:e,size:t="sm",to:n,disabled:r=!1,className:a="",linkClassName:i=""}){if(r)return s.jsx("button",{disabled:!0,className:`w-full cursor-not-allowed rounded-lg py-3 text-sm font-medium ${a}`,style:{background:"transparent",color:$.textMuted,border:`1px solid ${$.border}`,opacity:.55},children:e});const o=s.jsx("button",{className:`cta-glow rounded-lg font-bold active:translate-y-px ${W_[t]} ${a}`,style:{background:$.accent,color:$.bg,border:"none","--cta-glow-rest":B_,"--cta-glow-hover":V_},children:e});return n?s.jsx(Ie,{to:n,className:i,children:o}):o}const Y_="https://pub-280f828cf152489397f9a33ceffdf206.r2.dev/mt5-demo2.mp4";function H_(){return s.jsx("div",{id:"demo-video",className:"relative mx-auto mb-14 overflow-hidden rounded-xl",style:{maxWidth:"660px",border:`1px solid ${$.border}`,boxShadow:`0 0 40px ${$.accentDim}`,background:$.surface},children:s.jsx("video",{src:Y_,muted:!0,playsInline:!0,loop:!0,autoPlay:!0,className:"block w-full",style:{aspectRatio:"1 / 1"},"aria-label":"ViewLink demo: live risk calculations, instant MT5 execution"})})}const cr={YouTube:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})}),Instagram:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z"})}),TikTok:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"})}),XTwitter:()=>
53s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})}),Facebook:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})}),Discord:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057c.002.022.015.04.037.052a19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})}),LinkedIn:()=>s.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})},q_=[{key:"VITE_SOCIAL_YOUTUBE",Icon:cr.YouTube,label:"YouTube",hoverColor:"#FF0000"},{key:"VITE_SOCIAL_INSTAGRAM",Icon:cr.Instagram,label:"Instagram",hoverColor:"#E1306C"},{key:"VITE_SOCIAL_TIKTOK",Icon:cr.TikTok,label:"TikTok",hoverColor:"#FFFFFF"},{key:"VITE_SOCIAL_XTWITTER",Icon:cr.XTwitter,label:"X",hoverColor:"#FFFFFF"},{key:"VITE_SOCIAL_FACEBOOK",Icon:cr.Facebook,label:"Facebook",hoverColor:"#1877F2"},{key:"VITE_SOCIAL_DISCORD",Icon:cr.Discord,label:"Discord",hoverColor:"#5865F2"}],G_=["starter","pro","firm"];function Hr(){const[e,t]=h.useState(null),[n,r]=h.useState(!1);return h.useEffect(()=>{if(!e)return;const a=new IntersectionObserver(([i])=>{i.isIntersecting&&(r(!0),a.disconnect())},{threshold:.12});return a.observe(e),()=>a.disconnect()},[e]),{setRef:t,visible:n}}function ur({children:e}){return s.jsx("p",{className:"mb-3 text-center text-[11px] font-medium uppercase tracking-[0.1em]",style:{color:$.textMuted},children:e})}function dr({children:e,maxWidth:t="720px"}){return s.jsx("h2",{className:"mx-auto mb-10 text-center text-3xl font-semibold md:text-4xl",style:{color:$.textPrimary,maxWidth:t,letterSpacing:"-0.02em",lineHeight:1.2},children:e})}function ul({children:e,accentBorder:t=!1,className:n="",contentClassName:r=""}){const a=h.useRef(null);return h.useEffect(()=>{const i=a.current;if(!i)return;const o=l=>{const c=i.getBoundingClientRect();i.style.setProperty("--glow-x",`${l.clientX-c.left}px`),i.style.setProperty("--glow-y",`${l.clientY-c.top}px`)};return i.addEventListener("mousemove",o),()=>i.removeEventListener("mousemove",o)},[]),s.jsxs("div",{ref:a,className:`group relative h-full rounded-xl ${n}`,style:{padding:"1px",boxShadow:t?`0 0 20px ${$.accentDim}, 0 1px 3px rgba(0,0,0,0.5)`:"0 1px 3px rgba(0,0,0,0.5)"},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-50",style:{background:`radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%),
54            hsl(var(--brand-blue-light)) 0%,
55            hsl(var(--brand-blue)) 30%,
56            hsl(var(--brand-blue-deep)) 60%,
57            transparent 80%)`,filter:"blur(6px)",margin:"-8px",padding:"8px",borderRadius:"inherit"}}),s.jsx("div",{className:`pointer-events-none absolute inset-0 rounded-xl transition-opacity duration-300 ${t?"opacity-60":"opacity-20 group-hover:opacity-60"}`,style:{background:`conic-gradient(
58            from var(--glow-angle, 0deg) at 50% 50%,
59            hsl(var(--brand-blue-light)),
60            hsl(var(--brand-blue)),
61            hsl(var(--brand-blue-deep)),
62            hsl(var(--brand-blue-light))
63          )`,animation:"glow-spin 1.8s linear infinite",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",maskComposite:"exclude",WebkitMaskComposite:"xor",padding:"1px"}}),s.jsx("div",{className:`relative z-10 h-full rounded-xl ${r}`,style:{background:$.surface},children:e})]})}function X_(){const{endsAt:e,live:t}
63=Ya(),n=Ha(e);return!t||!n?null:s.jsxs("p",{className:"mb-2 text-[11px] font-semibold",style:{color:$.accent},children:["Offer ends in ",s.jsx("span",{className:"tabular-nums",children:cp(n)})]})}function K_({plan:e,priceUsd:t,discount:n,currency:r,visible:a,delay:i,ctaTo:o,ctaLabel:l,launchBadge:c=null}){const u=!!e.is_active&&t!=null,d=r==="ZAR"?"R":"$",m=u&&n!=null&&typeof n.amount_usd=="number"&&n.amount_usd>0&&typeof n.reverts_to=="number"&&n.reverts_to>0&&typeof n.duration_months=="number"&&n.duration_months>0,p=[`${e.max_accounts} MT5 account${(e.max_accounts??0)>1?"s":""}`,"Fully managed VPS","MT5 pre-installed","One-click TradingView to MT5"];return s.jsxs(ul,{accentBorder:u,contentClassName:"relative flex h-full flex-col p-7 text-left",className:`${a?"animate-fade-up":"opacity-0"}${u?"":" opacity-90"}`,children:[c&&s.jsx("span",{className:"absolute -top-3 left-7 rounded-full px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{background:$.accent,color:$.bg},children:c}),s.jsx("h3",{className:"mb-5 text-xs font-semibold uppercase tracking-[0.12em]",style:{color:u?$.accent:$.textMuted},children:e.display_name??e.plan_slug}),s.jsx("div",{className:"mb-2 flex items-end gap-1.5",style:{minHeight:46},children:u?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-4xl font-bold leading-none tabular-nums",style:{color:$.textPrimary},children:[d,Math.round(m?n.amount_usd:t)]}),m&&Math.round(t)>Math.round(n.amount_usd)&&s.jsxs("span",{className:"mb-1 text-sm line-through tabular-nums",style:{color:$.textMuted},children:[d,Math.round(t)]}),s.jsx("span",{className:"mb-1 text-sm",style:{color:$.textMuted},children:"/mo"})]}):s.jsx("span",{className:"inline-flex items-center rounded-full px-3 py-1 text-xs font-medium",style:{background:$.elevated,color:$.textMuted,border:`1px solid ${$.border}`},children:"Coming soon"})}),m&&s.jsxs("p",{className:"mb-2 text-[11px] leading-snug",style:{color:$.textMuted},children:["First ",n.duration_months," months, then ",d,Math.round(n.reverts_to),"/mo"]}),u&&c&&s.jsx(X_,{}),s.jsx("p",{className:"mb-6 mt-1 min-h-[30px] text-[11px] leading-snug",style:{color:$.textMuted},children:u?"Discount and any regional pricing applied at checkout. You'll see your final price before you pay.":""}),s.jsx("ul",{className:"mb-7 flex-1 space-y-2.5 text-sm",style:{color:u?$.textPrimary:$.textMuted},children:p.map(f=>s.jsxs("li",{className:"flex items-center gap-2.5",children:[s.jsx(ot,{size:15,strokeWidth:2.75,className:"shrink-0",style:{color:u?$.accent:$.textMuted,opacity:u?1:.55}}),s.jsx("span",{children:f})]},f))}),u?s.jsx(yr,{size:"card",to:o,linkClassName:"mt-auto",children:l}):s.jsx(yr,{disabled:!0,className:"mt-auto",children:"Coming soon"})]})}function xu({t:e,className:t=""}){return s.jsxs(ul,{className:t,contentClassName:"flex h-full flex-col gap-4 p-6",children:[s.jsx("div",{className:"flex gap-0.5",children:Array.from({length:5}).map((n,r)=>s.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16",fill:r<e.rating?"#F59E0B":"none",stroke:r<e.rating?"#F59E0B":"#4B5563",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292z"})},r))}),s.jsxs("p",{className:"flex-1 text-sm leading-relaxed",style:{color:$.textPrimary},children:['"',e.quote,'"']}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",style:{borderTop:`1px solid ${$.border}`},children:[s.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-xs font-semibold",style:{background:$.accentDim,color:$.accent,border:`1px solid ${$.accentBorder}`},children:e.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase()}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",style:{color:$.textPrimary},children:e.name}),s.jsxs("p",{className:"text-xs",style:{color:$.textMuted},children:[e.role," · ",e.location]})]})]})]})}function J_({q:e,a:t,open:n,onToggle:r}){return s.jsxs("div",{style:{borderBottom:`1px solid ${$.border}`},children:[s.jsxs("button",{onClick:r,className:"flex w-full items-center justify-between py-5 text-left text-base font-medium transition-colors duration-150",style:{color:n?$.accent:$.textPrimary,background:"none",border:"none"},children:[s.jsx("span",{children:e}),n?s.jsx(Em,{size:18,style:{color:$.textMuted,flexShrink:0}}):s.jsx(nn,{size:18,style:{color:$.textMuted,flexShrink:0}})]}),n&&s.jsx("p",{className:"pb-5 text-[15px] leading-relaxed",style:{color:$.textMuted},children:t})]})}const Q_=()=>{op("/dashboard");const[e,t]=h.useState([]),[n,r]=h.useState(null),[a,i]=h.useState([]),[o,l]=h.useState(!0),[c,u]=h.useState(null),d=lp(),m="/signup",p=Ya(),[f,g]=h.useState(!1),x=h.useRef(null),b=h.useRef(null),y=()=>{var D,A;const _=(D=x.current)==null?void 0:D.contains(document.activeElement);g(!1),_&&((A=b.current)==null||A.focus())};h.useEffect(()=>{if(!f)return;const _=V=>{V.key==="Escape"&&y()},D=()=>{window.innerWidth>=U_&&y()},A=V=>{var J;(J=x.current)!=null&&J.contains(V.target)||g(!1)};return document.addEventListener("keydown",_),window.addEventListener("resize",D),document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),()=>{document.removeEventListener("keydown",_),window.removeEventListener("resize",D),document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A)}},[f]);const j=Hr(),v=Hr(),C=Hr(),T=Hr(),S=Hr();h.useEffect(()=>{Z.from("plan_configs").select("id, plan_slug, display_name, price_zar, price_usd, max_accounts, vps_ram_gb, is_active").then(({data:_})=>{const D=new Map((_??[]).map(V=>[V.plan_slug,V])),A=G_.map(V=>D.get(V)).filter(V=>!!V);t(A),l(!1)})},[]);const E=z_(n==null?void 0:n.trial_days,n==null?void 0:n.trial_days_extended),B=jo(n==null?void 0:n.trial_days,null);h.useEffect(()=>{fetch("/api/pricing").then(_=>_.ok?_.json():null).then(_=>r(_)).catch(()=>r(null))},[]),h.useEffect(()=>{Z.from("testimonials").select("id, name, location, role, quote, rating").eq("is_published",!0).order("created_at",{ascending:!0}).then(({data:_})=>{i(_??[])})},[]);const P=[{q:"How is ViewLink different from other execution tools?",a:"ViewLink is built for simplicity. No complex syntax, no manual lot size calculations. Set your risk once and ViewLink handles the rest. We host and manage the trading infrastru
63cture for you, so there's no server to run or maintain."},{q:"Do I need a VPS?",a:"No. ViewLink provisions and fully manages the VPS that runs your MT5 connection. You never set one up, log into one, or maintain it."},{q:"Do I need a paid TradingView plan?",a:"No. ViewLink works with the free TradingView plan. No Pro subscription required."},{q:"Does ViewLink make trading decisions for me?",a:"No. ViewLink executes the trades you set up. It never decides what or when to trade. You define the entry, stop loss, and risk; ViewLink handles fast, correct execution on MT5."},{q:"Which brokers are supported?",a:"ViewLink works with any MT5 broker. If your broker runs MT5, ViewLink connects. No specific broker required, and no paid TradingView plan needed."},{q:"Which symbols can I trade?",a:"ViewLink supports 33 instruments across forex, metals, indices, and crypto. Forex majors: EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, USDCAD, NZDUSD. Forex crosses: EURGBP, EURJPY, EURCHF, EURAUD, EURCAD, EURNZD, GBPJPY, GBPCHF, GBPAUD, GBPCAD, GBPNZD, AUDJPY, AUDCHF, AUDCAD, AUDNZD, NZDJPY, NZDCAD, NZDCHF, CADJPY, CADCHF, CHFJPY. Metals: gold (XAUUSD) and silver (XAGUSD). Indices: US tech 100 (NAS100) and Germany 40 (GER40 / DAX). Crypto: Bitcoin (BTCUSD). ViewLink automatically matches your broker's naming for these symbols, so suffix variations like .r, m, or / are handled for you."},{q:"Can I use ViewLink with a prop firm?",a:"ViewLink's execution runs through an EA (Expert Advisor) on MT5. Many major prop firms allow EA-based execution tools, but rules vary by firm and account type. It is the trader's responsibility to confirm that their prop firm permits third-party EA-based execution tools before using ViewLink on a funded account. ViewLink does not accept liability for account violations resulting from a firm's restrictions."},{q:"Is my account safe?",a:"Your broker credentials are never shared with or stored by ViewLink. All trade execution happens inside your own authenticated MT5 session."},{q:"How much will it cost?",a:`You'll find our current plans and prices in the Pricing section above. Founding Members lock in a special early price that isn't available to the public. See "What is Founding Member status?" below for how it works.`},{q:"How do I get started?",a:n!=null&&n.trial_days?`Start your ${n.trial_days}-day free trial from any button on this page, connect your MT5 broker, and you'll be set up in minutes. Founding Members who join now lock in early pricing before we open to the public.`:"Start your free trial from any button on this page, connect your MT5 broker, and you'll be set up in minutes. Founding Members who join now lock in early pricing before we open to the public."},{q:"What is Founding Member status?",a:"Founding Members are everyone who becomes a paying ViewLink subscriber before we open to the public. When your cohort opens, you will receive a personal invite with an early price that is not available anywhere else. You have 7 days from when your invite arrives to lock it in. Once we go public, this offer closes permanently."}];return s.jsxs("div",{className:"min-h-screen",style:{background:$.bg,color:$.textPrimary},children:[s.jsxs(Ie,{to:m,className:"announcement-strip sticky top-0 z-[60] flex h-12 items-center justify-center gap-3 px-4 text-center no-underline",children:[s.jsx("span",{className:"announcement-dot h-2 w-2 shrink-0 rounded-full"}),s.jsx("span",{className:"text-[12px] font-medium leading-tight text-[#111] sm:text-[13px]",children:s.jsx(F_,{fallback:d?"ViewLink is live. Founding access is rolling out.":E??"Cancel anytime."})}),s.jsx("span",{className:"hidden shrink-0 rounded-lg px-4 py-1.5 text-[13px] font-semibold text-white transition-all duration-150 active:translate-y-px sm:inline-flex",style:{background:$.accent},children:d?"Get Access →":"Start Free →"})]}),s.jsxs("nav",{ref:x,className:"sticky top-12 z-50 backdrop-blur-md",style:{background:`${$.bg}E6`,borderBottom:`1px solid ${$.border}`},children:[s.jsxs("div",{className:"flex h-16 items-center justify-between px-4 md:px-6",children:[s.jsx(Ie,{to:"/",className:"flex shrink-0 items-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[96px] w-auto bg-transparent sm:h-[120px] md:h-[160px] lg:h-[240px]"})}),s.jsxs("div",{className:"flex items-center gap-6 md:gap-8",children:[s.jsx("div",{className:"hidden items-center gap-8 md:flex",children:hu.map(({href:_,label:D})=>s.jsx("a",{href:_,className:"text-sm transition-colors duration-150",style:{color:$.textMuted},onMouseEnter:A=>A.target.style.color=$.textPrimary,onMouseLeave:A=>A.target.style.color=$.textMuted,children:D},_))}),s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[s.jsx(Ie,{to:"/login",className:"shrink-0 text-sm transition-colors duration-150",style:{color:$.textMuted},onMouseEnter:_=>_.target.style.color=$.textPrimary,onMouseLeave:_=>_.target.style.color=$.textMuted,children:"Login"}),s.jsx(yr,{size:"sm",to:m,linkClassName:"shrink-0",className:"whitespace-nowrap",children:d?"Get Access →":"Start Free →"}),s.jsx("button",{ref:b,type:"button",onClick:()=>g(_=>!_),"aria-expanded":f,"aria-controls":gu,"aria-label":"Toggle navigation menu",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#53AEE0] focu
63s-visible:ring-offset-2 focus-visible:ring-offset-[#0D0D0D] md:hidden",style:{color:$.textMuted},children:f?s.jsx(rr,{size:22}):s.jsx($o,{size:22})})]})]})]}),f&&s.jsx("div",{id:gu,className:"animate-fade-up flex flex-col px-4 pb-3 md:hidden",style:{borderTop:`1px solid ${$.border}`},children:hu.map(({href:_,label:D})=>s.jsx("a",{href:_,onClick:()=>g(!1),className:"rounded-lg px-2 py-3 text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#53AEE0]",style:{color:$.textMuted},onMouseEnter:A=>A.target.style.color=$.textPrimary,onMouseLeave:A=>A.target.style.color=$.textMuted,children:D},_))})]}),s.jsxs("section",{className:"relative flex min-h-[70vh] flex-col items-center justify-center overflow-hidden px-6 py-16 md:py-24",children:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-[500px]",style:{background:"radial-gradient(35% 80% at 49% 0%, rgba(83,174,224,0.07), transparent)"}}),s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24",style:{background:"linear-gradient(to bottom, transparent, hsl(var(--background)))"}}),s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 hidden -translate-x-[430px] md:block",children:s.jsx("div",{className:"h-full w-px",style:{background:`linear-gradient(to bottom, transparent, ${$.border} 30%, ${$.border} 80%, transparent)`}})}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 hidden translate-x-[430px] md:block",children:s.jsx("div",{className:"h-full w-px",style:{background:`linear-gradient(to bottom, transparent, ${$.border} 30%, ${$.border} 80%, transparent)`}})}),s.jsxs("div",{className:"relative z-10 flex max-w-[860px] flex-col items-center text-center",children:[s.jsxs("h1",{className:"mb-6 font-extrabold leading-[1.1]",style:{fontSize:"clamp(2.25rem, 6vw, 4rem)",letterSpacing:"-0.03em",color:$.textPrimary},children:["Place MT5 trades from your"," ",s.jsx("span",{className:"text-brand-gradient",children:"TradingView"})," chart.",s.jsx("br",{}),s.jsx("span",{className:"animate-text-glow",children:"Instantly."})]}),s.jsx("p",{className:"mb-10 max-w-[540px] text-base leading-relaxed md:text-lg",style:{color:$.textMuted},children:"Set your risk once. Trade straight from TradingView: correct lot size, instant orders, fully hosted."}),s.jsxs("div",{className:"flex flex-col items-center gap-3 sm:flex-row",children:[s.jsxs(yr,{size:"md",to:m,children:[d?"Get Access":"Start Free"," ",s.jsx(Qt,{size:16})]}),s.jsx("a",{href:"#demo-video",children:s.jsx("button",{className:"flex h-11 items-center gap-2 rounded-lg px-7 text-[15px] font-medium transition-all duration-150 active:translate-y-px",style:{background:"transparent",color:$.textPrimary,border:`1px solid ${$.accent}`},onMouseEnter:_=>{_.currentTarget.style.background=$.accentDim,_.currentTarget.style.borderColor=$.accent},onMouseLeave:_=>{_.currentTarget.style.background="transparent",_.currentTarget.style.borderColor=$.accent},children:"See How It Works"})})]}),s.jsx(T_,{gating:d}),s.jsx("div",{className:"mt-8 h-px w-full max-w-[400px]",style:{background:"linear-gradient(to right, transparent, hsl(var(--border)), transparent)"}}),s.jsxs("div",{className:"mx-auto mt-5 flex w-full max-w-[19rem] flex-col items-start gap-4 sm:max-w-none sm:w-auto sm:flex-row sm:items-center sm:gap-8",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx($g,{className:"h-5 w-5 shrink-0 text-primary"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Any TradingView plan"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Including free"})]})]}),s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(Bg,{className:"h-5 w-5 shrink-0 text-primary"}),s.jsx("div",{className:"text-left",children:s.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Any MT5 broker"})})]}),s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(Vg,{className:"h-5 w-5 shrink-0 text-primary"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Desktop only"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Chrome on a computer, not mobile"})]})]})]})]})]}),a.length>0&&s.jsxs("section",{className:"relative overflow-hidden px-6 py-20 md:py-24",style:{background:$.bg},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"What traders are saying"}),s.jsx(dr,{children:"Real traders. Real results."}),a.length<=3?s.jsx("div",{className:`mx-auto grid gap-6 ${a.length===1?"max-w-[480px]":a.length===2?"max-w-[820px] sm:grid-cols-2":"sm:grid-cols-2 lg:grid-cols-3"}`,children:a.map(_=>s.jsx(xu,{t:_},_.id))}):s.jsxs("div",{className:"relative overflow-hidden motion-reduce:overflow-x-auto",children:[s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-12 sm:w-20",style:{background:`linear-gradient(to right, ${$.bg}, transparent)`}}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-12 sm:w-20",style:{background:`linear-gradient(to left, ${$.bg}, transparent)`}}),s.jsx("div",{className:"testimonial-marquee py-1",style:{"--marquee-duration":`${a.length*7}s`},children:[...a,...a].map((_,D)=>s.jsx(xu,{t:_,className:"mr-6 w-[340px] shrink-0"},`${_.id}-${D}`))})]})]})]}),s.jsxs("section",{id:"how-it-works",ref:j.setRef,className:"relative overflow-hidden px-6 py-20 md:py-28",style:{background:$.surface},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"How it works"}),s.jsx(dr,{children:"From your chart to MT5. Instantly."}),s.jsx("div",{className:"mb-14 flex flex-col items-center gap-6 md:flex-row md:items-start md:gap-4",children:[{num:"01",title:"Set up your trade on TradingView",desc:"Mark your entry, stop loss, and take profit on TradingView. Set your risk parameters once. ViewLink handles everything from there."},{num:"02",title:"ViewLink receives it",desc:"ViewLink receives it instantly and reads your saved risk settings."},{num:"03",title:"Trade executes",desc:"The correct lot size is calculated and the order fires on your broker account instantly."}].map((_,D,A)=>s.jsxs("div",{className:"flex flex-col items-center md:flex-1 md:flex-row md:items-start",children:[s.jsxs("div",{className:"text-center md:text-left",children:[s.jsx("span",{className:"text-3xl font-light",style:{color:$.accent},children:_.num}),s.jsx("h3",{className:"mt-2 text-xl font-semibold",style:{color:$.textPrimary},children:_.title}),s.jsx("p",{className:"mt-2 text-[15px] leading-relaxed",style:{color:$.textMuted},children:_.desc})]}),D<A.length-1&&s.jsxs(s.Fragment,{children:[s.jsx(Qt,{className:"mx-4 mt-6 hidden h-5 w-5 shrink-0 md:block",style:{color:$.textMuted}}),s.jsx(Ug,{className:"my-2 h-5 w-5 md:hidden",style:{color:$.textMuted}})]})]},_.num))}),s.jsx(H_,{}),s.jsx("p",{className:"mb-0 text-center text-[13px]",style:{color:$.textMuted},children:"ViewLink in action: live risk calculations, instant MT5 execution."})]})]}),s.jsxs("section",{id:"features",ref:v.setRef,className:"relative overflow-hidden px-6 py-20 md:py-28",style:{background:$.bg},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"What you get"}),s.jsx(dr,{maxWidth:"640px",children:"Built for traders who don't want to think about execution admin."}),s.jsx("div",{className:"grid gap-5 md:grid-cols-2",children:[{Icon:Nm,title:"Instant Execution",desc:"No more switching to MT5 and entering trades by hand. Place your trade straight from your TradingView chart and ViewLink sends it to MT5 in real time: correct lot size, correct stop loss, no manual entry, no costly errors."},{Icon:Wg,title:"Auto Position Sizing",desc:"ViewLink reads your live account balance and risk settings, then calculates the correct lot size for you. Every time. No more sizing by feel."},{Icon:Sm,title:"We Handle the VPS",desc:"ViewLink is fully cloud-hosted. We provision and manage all infrastru
63cture on your behalf. Your trades route through ViewLink's servers 24/7."},{Icon:gs,title:"Trade Management",desc:"Trail your stop loss, move it to breakeven, or close partials. All executed directly on MT5 from TradingView. No manual entry, no switching platforms."}].map((_,D)=>s.jsx(ul,{contentClassName:"p-6",className:v.visible?"animate-fade-up":"opacity-0",children:s.jsxs("div",{style:{animationDelay:`${D*70}ms`,animationFillMode:"both"},children:[s.jsx(_.Icon,{size:32,className:"mb-3",style:{color:$.accent}}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",style:{color:$.textPrimary},children:_.title}),s.jsx("p",{className:"text-[15px] leading-relaxed",style:{color:$.textMuted},children:_.desc})]})},_.title))})]})]}),s.jsxs("section",{id:"pricing",ref:C.setRef,className:"relative overflow-hidden px-6 py-20 md:py-28",style:{background:$.surface},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"Pricing"}),s.jsx(dr,{children:"Simple, transparent pricing."}),s.jsx("p",{className:"mb-10 text-center text-[13px]",style:{color:$.textMuted},children:"Every plan includes a fully managed VPS with MT5 pre-installed."}),s.jsx(R_,{}),o?s.jsx("div",{className:"grid gap-4 md:grid-cols-3 max-w-3xl mx-auto",children:[1,2,3].map(_=>s.jsx("div",{className:"h-72 rounded-xl animate-shimmer",style:{background:$.elevated}},_))}):e.length>0?s.jsx("div",{className:"grid gap-4 md:grid-cols-3 max-w-3xl mx-auto",children:e.map((_,D)=>{const A=_.plan_slug==="starter",V=A?(n==null?void 0:n.price_usd)??_.price_usd??null:_.price_usd??null;return s.jsx(K_,{plan:_,priceUsd:V,discount:A?(n==null?void 0:n.discount)??null:null,currency:(n==null?void 0:n.currency)??"USD",visible:C.visible,delay:D*70,ctaTo:m,ctaLabel:d?"Get Access →":"Start Free →",launchBadge:p.live&&A?p.badge:null},_.id)})}):s.jsxs("div",{className:"max-w-md mx-auto text-center rounded-xl p-8",style:{background:$.surface,border:`1px solid ${$.border}`},children:[s.jsx("p",{style:{color:$.textMuted},children:d?"ViewLink is live and rolling out founding access. Get access to lock in early pricing.":E?`Pricing coming soon. ${E}`:"Pricing coming soon."}),s.jsx(yr,{size:"cardCompact",to:m,className:"mt-6",children:d?"Get Access →":"Start Free →"})]})]})]}),s.jsxs("section",{id:"faq",ref:T.setRef,className:`relative overflow-hidden px-6 py-20 md:py-28 ${T.visible?"animate-fade-up":"opacity-0"}`,style:{background:$.bg},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"FAQ"}),s.jsx(dr,{children:"Common questions."}),s.jsx("div",{className:"mx-auto max-w-[720px]",children:P.map((_,D)=>s.jsx(J_,{q:_.q,a:_.a,open:c===D,onToggle:()=>u(c===D?null:D)},_.q))})]})]}),s.jsxs("section",{id:"about",ref:S.setRef,className:`relative overflow-hidden px-6 py-20 md:py-28 ${S.visible?"animate-fade-up":"opacity-0"}`,style:{background:$.surface},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto max-w-content",children:[s.jsx(ur,{children:"The Team"}),s.jsx(dr,{children:"18 years in markets. Zero tolerance for manual execution errors."}),s.jsx("img",{src:__,alt:"Kevin and Theo",className:"mx-auto mb-10 block w-full",style:{maxWidth:"700px"}}),s.jsxs("div",{className:"mx-auto mb-12 rounded-lg transition-shadow duration-300",style:{maxWidth:"700px",borderLeft:`3px solid ${$.accent}`,padding:"20px 24px",background:"rgba(83, 174, 224, 0.05)",borderRadius:"8px"},onMouseEnter:_=>_.currentTarget.style.boxShadow=`0 0 20px ${$.accentGlow}`,onMouseLeave:_=>_.currentTarget.style.boxShadow="",children:[s.jsx("p",{className:"text-left text-base italic leading-[1.8] md:text-lg",style:{color:"#E5E7EB"},children:'"We put our engineering degrees to work, just not the way anyone expected. We were already trading by then, and between us we have over 18 years of combined market experience. Eventually we both gravitated into data, which only made us more obsessive about the numbers behind our trades.'}),s.jsxs("p",{className:"mt-4 text-left text-base italic leading-[1.8] md:text-lg",style:{color:"#E5E7EB"},children:["But switching between TradingView and MetaTrader to manually calculate lot sizes, checking entr
63ies, double-checking stop losses… we kept introducing human error into a process that's supposed to be precise."," ",s.jsx("span",{className:"font-bold not-italic",style:{color:$.textPrimary},children:'So we built ViewLink. The tool we kept wishing existed."'})]})]}),s.jsx("div",{className:"mt-8 flex items-center justify-center gap-6",children:[{name:"Kevin",url:"https://www.linkedin.com/in/gabriel-kevin-maja"},{name:"Theo",url:"https://www.linkedin.com/in/theodore-maja-9957b81a2"}].map(({name:_,url:D},A)=>s.jsxs("div",{className:"flex items-center gap-6",children:[A>0&&s.jsx("span",{className:"h-5 w-px bg-muted-foreground/40"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"relative inline-block text-lg font-bold",style:{color:$.textPrimary},children:[s.jsx("span",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:"180px",height:"60px",background:"radial-gradient(50% 50% at 50% 50%, rgba(255,255,255,0.07), transparent)",zIndex:0}}),s.jsx("span",{className:"relative z-10",children:_})]}),s.jsx("a",{href:D,target:"_blank",rel:"noopener noreferrer","aria-label":`${_} on LinkedIn`,className:"inline-flex transition-opacity hover:opacity-80",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"#0A66C2","aria-hidden":"true",children:s.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})]})]},_))})]})]}),s.jsx(k_,{}),s.jsxs("section",{className:"relative overflow-hidden px-6 py-28 text-center",style:{background:$.bg},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at 50% 100%, rgba(83,174,224,0.07), transparent 70%)"}}),s.jsxs("div",{className:"relative z-10",children:[s.jsx("h2",{className:"mb-3 text-3xl font-semibold md:text-4xl",style:{color:$.textPrimary},children:"Ready to trade from TradingView?"}),s.jsx("p",{className:"mb-8 text-base",style:{color:$.textMuted},children:d?"ViewLink is live. Get founding access as it rolls out and lock in early pricing.":E??"Cancel anytime."}),s.jsx(yr,{size:"lg",to:m,className:"mx-auto",children:d?"Get Access →":"Start Free →"}),s.jsx("div",{className:"mt-5 flex items-center justify-center gap-6 text-xs",style:{color:$.textMuted},children:d?s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"✦ Founding pricing"}),s.jsx("span",{children:"✦ Rolling out now"})]}):s.jsxs(s.Fragment,{children:[B&&s.jsxs("span",{children:["✦ ",B]}),s.jsx("span",{children:"✦ Cancel anytime"})]})})]})]}),s.jsxs("footer",{className:"relative overflow-hidden",style:{borderTop:`1px solid ${$.border}`,background:$.surface},children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsxs("div",{className:"relative z-10 mx-auto flex max-w-[1200px] flex-col items-center gap-6 px-6 py-10",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent"}),s.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-6",children:[[{href:"#features",label:"Features"},{href:"#pricing",label:"Pricing"},{href:"#faq",label:"FAQ"},{href:"#about",label:"About"}].map(({href:_,label:D})=>s.jsx("a",{href:_,className:"text-sm transition-colors duration-150",style:{color:$.textMuted},onMouseEnter:A=>A.target.style.color=$.textPrimary,onMouseLeave:A=>A.target.style.color=$.textMuted,children:D},_)),s.jsx(Ie,{to:"/login",className:"text-sm transition-colors duration-150",style:{color:$.textMuted},onMouseEnter:_=>_.target.style.color=$.textPrimary,onMouseLeave:_=>_.target.style.color=$.textMuted,children:"Login"})]}),s.jsx("div",{className:"flex items-center gap-5",children:q_.map(({key:_,Icon:D,label:A,hoverColor:V})=>{const J=$_[_];return J?s.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer","aria-label":A,style:{color:$.accent,transition:"color 200ms ease"},onMouseEnter:O=>O.currentTarget.style.color=V,onMouseLeave:O=>O.currentTarget.style.color=$.accent,children:s.jsx(D,{})},A):null})}),s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-6",children:[{href:"/privacy.html",label:"Privacy Policy"},{href:"/terms.html",label:"Terms of Service"},{href:"/paia",label:"PAIA Manual"}].map(({href:_,label:D})=>s.jsx("a",{href:_,className:"text-sm transition-colors duration-150",style:{color:$.textMuted},onMouseEnter:A=>A.target.style.color=$.textPrimary,onMouseLeave:A=>A.target.style.color=$.textMuted,children:D},_))}),s.jsx("p",{className:"text-xs",style:{color:$.textMuted},children:"© 2026 ViewLink. Built for traders."})]})]})]})},M={bg:"#0D0D0D",surface:"#111111",elevated:"#1A1A1A",border:"#1F2937",accent:"#53AEE0",accentDim:"rgba(83,174,224,0.10)",accentBorder:"rgba(83,174,224,0.30)",accentGlow:"rgba(83,174,224,0.45)",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"};function un({children:e,onClick:t,type:n="button",disabled:r=!1,className:a=""}){return s.jsx("button",{type:n,onClick:t,disabled:r,className:`w-full rounded-lg py-3 text-sm font-semibold transition-all duration-150 active:translate-y-
63px ${a}`,style:{background:r?M.elevated:M.accent,color:r?M.textMuted:M.bg,border:r?`1px solid ${M.border}`:"none",cursor:r?"not-allowed":"pointer",opacity:r?.7:1},onMouseEnter:i=>{r||(i.currentTarget.style.boxShadow=`0 0 18px ${M.accentGlow}`)},onMouseLeave:i=>{i.currentTarget.style.boxShadow=""},children:e})}function _t({children:e,className:t=""}){return s.jsx("div",{className:`rounded-xl p-6 ${t}`,style:{background:M.surface,border:`1px solid ${M.border}`,boxShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:e})}function _a({label:e,selected:t,onClick:n,indent:r=!1}){return s.jsxs("button",{type:"button",onClick:n,className:`flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors duration-150 ${r?"ml-4":""}`,style:{background:t?M.accentDim:M.elevated,border:`1px solid ${t?M.accentBorder:M.border}`,color:t?M.textPrimary:M.textMuted,width:r?"calc(100% - 1rem)":"100%"},children:[s.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full",style:{border:`2px solid ${t?M.accent:M.border}`},children:t&&s.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:M.accent}})}),s.jsx("span",{children:e})]})}function Z_({current:e,total:t}){const n=Math.round(e/t*100);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-1 h-1 w-full overflow-hidden rounded-full",style:{background:M.border},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${n}%`,background:M.accent}})}),s.jsxs("p",{className:"mb-5 text-right text-[11px]",style:{color:M.textMuted},children:[n,"% complete"]})]})}const mr="https://api.viewlink.dev",ej="https://discord.gg/ZnWSUvxpdN",yu={foun
63ding:{title:"Your founding slot is ready",body:"You have a founding invite to ViewLink. Claim your slot and set up your account now.",cta:"Claim your slot →"},comp:{title:"Your membership is ready",body:"You have a complimentary ViewLink membership. Claim it and set up your account now.",cta:"Claim your membership →"},beta:{title:"Your beta access is ready",body:"You have beta access to ViewLink. Claim it and set up your account now.",cta:"Claim your access →"},default:{title:"Your spot is ready",body:"You have an open invite to ViewLink. Claim your spot and set up your account now.",cta:"Claim your spot →"}},tj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Ht({children:e}){return s.jsxs("div",{className:"min-h-screen",style:{background:M.bg,color:M.textPrimary},children:[s.jsx("div",{className:"pointer-events-none fixed inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-0 h-[500px]",style:{background:"radial-gradient(35% 80% at 50% 0%, rgba(83,174,224,0.07), transparent)"}}),s.jsxs("div",{className:"relative z-10 mx-auto flex min-h-screen max-w-[560px] flex-col px-5 py-8",children:[s.jsx(Ie,{to:"/",className:"mb-2 flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent"})}),e]})]})}function Ks({count:e}){return e==null||e<=0?null:s.jsxs("p",{className:"mt-4 text-center text-[13px]",style:{color:M.textMuted},children:[s.jsx("span",{className:"font-semibold tabular-nums",style:{color:M.accent},children:e.toLocaleString()})," ","traders already in line for access"]})}function bi(){return s.jsx(_t,{className:"mt-5",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg",style:{background:M.accentDim,border:`1px solid ${M.accentBorder}`},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:M.accent,"aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057c.002.022.015.04.037.052a19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold",style:{color:M.textPrimary},children:"Join the community"}),s.jsx("p",{className:"mt-1 text-[13px] leading-relaxed",style:{color:M.textMuted},children:"Get updates, ask questions, and connect with other traders on Discord."}),s.jsx("a",{href:ej,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-block",children:s.jsx("span",{className:"inline-flex items-center gap-1.5 rounded-lg px-4 py-2 text-[13px] font-semibold",style:{background:M.accentDim,color:M.accent,border:`1px solid ${M.accentBorder}`},children:"Open Discord"})})]})]})})}function vi({label:e,checked:t,onToggle:n,indent:r=!1}){return s.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors duration-150",style:{background:t?M.accentDim:M.elevated,border:`1px solid ${t?M.accentBorder:M.border}`,color:t?M.textPrimary:M.textMuted,marginLeft:r?"1rem":0,width:r?"calc(100% - 1rem)":"100%"},children:[s.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded",style:{border:`2px solid ${t?M.accent:M.border}`,background:t?M.accent:"transparent"},children:t&&s.jsx("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M13 4L6 12L3 8.5",stroke:M.bg,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("span",{children:e})]})}function nj({q:e,value:t,onChange:n}){const[r,a]=h.useState(null),i=h.useMemo(()=>
63new Set(t?t.split(", ").filter(Boolean):[]),[t]),o=u=>!u.sub,l=(u,d)=>{d?n(d.value):u.value!=null&&n(u.value)},c=u=>{const d=new Set(i);d.has(u)?d.delete(u):d.add(u),n([...d].join(", "))};return s.jsxs("div",{children:[s.jsx("p",{className:"mb-3 text-sm font-medium",style:{color:M.textPrimary},children:e.prompt}),s.jsx("div",{className:"space-y-2",children:e.options.map((u,d)=>{const m=o(u);if(e.kind==="multi_progressive"){if(m)return s.jsx(vi,{label:u.label,checked:i.has(u.value),onToggle:()=>c(u.value)},u.label);const f=u.sub.filter(x=>x.value!=="__all__"),g=f.every(x=>i.has(x.value));return s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"px-1 pt-1 text-[13px] font-medium",style:{color:M.textMuted},children:u.label}),f.map(x=>s.jsx(vi,{label:x.label,checked:i.has(x.value),onToggle:()=>c(x.value),indent:!0},x.value)),s.jsx(vi,{label:"All of the above",checked:g,indent:!0,onToggle:()=>{const x=new Set(i);g?f.forEach(b=>x.delete(b.value)):f.forEach(b=>x.add(b.value)),n([...x].join(", "))}})]},u.label)}const p=m?t===u.value:r===d;return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_a,{label:u.label,selected:m?t===u.value:u.sub.some(f=>f.value===t),onClick:()=>{m?(a(null),l(u)):a(r===d?null:d)}}),!m&&(p||u.sub.some(f=>f.value===t))&&s.jsxs("div",{className:"space-y-2",children:[u.sub_prompt&&s.jsx("p",{className:"ml-4 text-[13px]",style:{color:M.textMuted},children:u.sub_prompt}),u.sub.map(f=>s.jsx(_a,{label:f.label,selected:t===f.value,onClick:()=>l(u,f),indent:!0},f.value))]})]},u.label)})})]})}const rj=()=>{const e=nt(),[t]=Wo(),n=(t.get("t")||"").trim(),r=lp(),[a,i]=h.useState("check"),[o,l]=h.useState((t.get("email")||"").trim()),[c,u]=h.useState(null),[d,m]=h.useState(null),[p,f]=h.useState(""),[g,x]=h.useState(null),[b,y]=h.useState({}),[j,v]=h.useState(!1),[C,T]=h.useState(!1),[S,E]=h.useState(null),[B,P]=h.useState(0),[N,L]=h.useState(!1),[_,D]=h.useState(!1),[A,V]=h.useState(!1),[J,O]=h.useState(!1),[z,F]=h.useState(null);h.useEffect(()=>{fetch(`${mr}/v1/join/count`).then(U=>U.ok?U.json():null).then(U=>E((U==null?void 0:U.count)??null)).catch(()=>E(null)),fetch(`${mr}/v1/join/survey`).then(U=>U.ok?U.json():null).then(U=>x(U)).catch(()=>x(null))},[]),h.useEffect(()=>{r===!1&&e("/signup",{replace:!0})},[r,e]),h.useEffect(()=>{const U=n;U&&fetch(`${mr}/v1/join/invite?t=${encodeURIComponent(U)}`).then(K=>K.ok?K.json():null).then(K=>{K!=null&&K.valid&&K.email&&(l(K.email),u(K.offer??null),m(K.discount??null),i(K.door==="member"?"member":"invited"))}).catch(()=>{})},[n]);const k=tj.test(o.trim()),H=p.trim().length>0&&j&&k&&!J,R=async()=>{if(!k){F("Please enter a valid email address.");return}F(null),V(!0);try{const U=await fetch(`${mr}/v1/join/status?email=${encodeURIComponent(o.trim())}`);if(!U.ok)throw new Error(String(U.status));const K=await U.json();u(K.offer??null),m(K.discount??null),K.door==="member"?i("member"):K.door==="invited"?i("invited"):K.door==="on_list"?i("on_list"):i("form")}catch{F("Something went wrong. Please try again.")}finally{V(!1)}},w=async()=>{if(H){F(null),O(!0);try{const U=await fetch(`${mr}/v1/join`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o.trim(),name:p.trim(),slot_notifications:j,marketing_consent:C,survey:{attribution:b.attribution,region:b.region,trading_frequency:b.trading_frequency,current_spend:b.current_spend,instruments:b.instruments}})}),K=await U.json().catch(()=>({}));U.ok&&(K.status==="joined"||K.status==="already_on_list")?K.status==="already_on_list"?i("on_list"):(E(ie=>ie==null?ie:ie+1),i("intro")):U.status===429?F("Too many requests. Please wait a moment and try again."):U.status===400||U.status===422?F("Please check your answers and try again."):F("Something went wrong. Please try again.")}catch{F("Something went wrong. Please try again.")}finally{O(!1)}}},te=async()=>{L(!0);try{await fetch(`${mr}/v1/join/survey-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o.trim(),survey:{attribution:b.attribution,region:b.region,trading_frequency:b.trading_frequency,current_spend:b.current_spend,instruments:b.instruments}})})}catch{}L(!1),D(!0),i("done")},W=()=>z?s.jsx("p",{className:"mt-3 text-center text-[13px]",style:{color:"#F87171"},children:z}):null;if(r!==!0)return s.jsx(Ht,{children:s.jsx("div",{className:"flex flex-1 items-center justify-center"})});if(a==="check")return s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsx("h1",{className:"mb-2 text-center text-2xl font-bold",style:{color:M.textPrimary,letterSpacing:"-0.02em"},children:"ViewLink Founding Access"}),s.jsx("p",{className:"mb-6 text-center text-sm",style:{color:M.textMuted},children:"ViewLink is live. Founding access is rolling out in waves. Enter your email to claim an invite, check your spot, or request access."}),s.jsxs(_t,{children:[s.jsx("label",{className:"mb-2 block text-[13px] font-medium",style:{color:M.textMuted},children:"Email address"}),s.jsx("input",{type:"email",autoComplete:"email",value:o,autoFocus:!0,onChange:U=>l(U.target.value),onKeyDown:U=>U.key==="Enter"&&R(),placeholder:"[email protected]",className:"mb-3 w-full rounded-lg px-4 py-3 text-sm outline-none",style:{background:M.elevated,border:`1px solid ${M.border}`,color:M.textPrimary}}),s.jsx("p",{className:"mb-4 rounded-lg px-3 py-2 text-[12px] leading-relaxed",style:{background:M.accentDim,border:`1px solid ${M.accentBorder}`,color:M.textMuted},children:"Got an invite? Use the same email address your invite link was sent to. That's how we match you to your spot."}),s.jsx(un,{onClick:R,disabled:!k||A,children:A?"Checking...":"Continue →"}),s.jsx(W,{})]}),s.jsx(Ks,{count:S}),s.jsxs("p",{className:"mt-6 text-center text-[13px]",style:{color:M.textMuted},children:["Already have an account?"," ",s.jsx(Ie,{to:"/login",style:{color:M.accent},children:"Log in"})]})]})});if(a==="member")return s.jsx(Ht,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(_t,{children:[s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:M.textPrimary},children:"You already have a ViewLink account"}),s.jsx("p",{className:"mb-5 text-sm leading-relaxed",style:{color:M.textMuted},children:"This email is already registered. Log in to pick up where you left off."}),s.jsx(Ie,{to:"/login",children:s.jsx(un,{children:"Log in →"})})]})})});if(a==="invited"){const U=yu[c??"default"]??yu.default,K=(d==null?void 0:d.discount_amount)??null,ie=K!=null&&K>0?`${parseFloat((K/100).toFixed(2))}%`:null,ne=(d==null?void 0:d.lock_duration_months)??null;return s.jsx(Ht,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(_t,{children:[s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:M.textPrimary},children:U.title}),s.jsx("p",{className:"mb-5 text-sm leading-relaxed",style:{color:M.textMuted},children:U.body}),ie&&s.jsx("div",{className:"mb-5 rounded-lg px-4 py-3",style:{background:M.accentDim,border:`1px solid ${M.accentBorder}`},children:s.jsxs("p",{className:"text-sm leading-relaxed",style:{color:M.textPrimary},children:["Your rate is locked: ",s.jsxs("strong",{children:[ie," off"]}),ne!=null?s.jsxs(s.Fragment,{children:[" for your first ",s.jsx("strong",{children:ne})," billing ",ne===1?"cycle":"cycles","."]}):s.jsx(s.Fragment,{children:" your subscription."})," ","Our thanks for being here early."]})}),s.jsx(Ie,{to:`/signup?claim=1&email=${encodeURIComponent(o)}`+(n?`&t=${encodeURIComponent(n)}`:""),children:s.jsx(un,{children:U.cta})})]})})})}if(a==="on_list")return s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsxs(_t,{children:[s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:M.textPrimary},children:"You are in line for founding access"}),s.jsx("p",{className:"text-sm leading-relaxed",style:{color:M.textMuted},children:"You are all set. We are rolling out access in waves and will email you the moment your spot opens."})]}),s.jsx(bi,{}),s.jsx(Ks,{count:S})]})});if(a==="intro"){const U=!!g&&g.questions.length>0;return s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsxs(_t,{children:[s.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full",style:{background:M.accentDim,border:`1px solid ${M.accentBorder}`},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M20 6L9 17l-5-5",stroke:M.accent,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:M.textPrimary},children:"You are in for founding access"}),s.jsx("p",{className:U?"mb-5 text-sm leading-relaxed":"text-sm leading-relaxed",style:{color:M.textMuted},children:"Check your inbox to confirm. We are rolling out access in waves and will email you the moment your spot opens."}),U&&s.jsxs("div",{className:"rounded-lg p-4",style:{background:M.elevated,border:`1px solid ${M.border}`},children:[s.jsx("p",{className:"text-sm font-semibold",style:{color:M.textPrimary},children:"Help us prioritize your spot"}),s.jsx("p",{className:"mb-3 mt-1 text-[13px] leading-relaxed",style:{color:M.textMuted},children:"A few quick questions, under a minute. It helps us move you up the queue."}),s.jsx(un,{onClick:()=>{P(0),i("survey")},children:"Let's go →"}),s.jsx("button",{type:"button",onClick:()=>i("done"),className:"mt-3 w-full text-center text-[13px]",style:{color:M.textMuted},children:"Skip for now"})]})]}),!U&&s.jsx(bi,{}),s.jsx(Ks,{count:S})]})})}if(a==="survey"){const U=(g==null?void 0:g.questions)??[],K=U.length;if(!g||K===0)return s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsx(_t,{children:s.jsx("p",{className:"text-sm",style:{color:M.textMuted},children:"You are all set."})}),s.jsx("div",{className:"mt-4",children:s.jsx(un,{onClick:()=>i("done"),children:"Continue →"})})]})});const ie=Math.min(B,K-1),ne=U[ie],ue=(b[ne.key]||"").trim().length>0,pe=ie===K-1,X=Math.round((ie+1)/K*100);return s.jsx(Ht,{children:s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"mb-6 text-center text-2xl font-bold",style:{color:M.textPrimary,letterSpacing:"-0.02em"},children:"Help us prioritize your spot"}),s.jsxs(_t,{children:[s.jsx("div",{className:"mb-1 h-1 w-full overflow-hidden rounded-full",style:{background:M.border},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${X}%`,background:M.accent}})}),s.jsxs("p",{className:"mb-5 text-right text-[11px]",style:{color:M.textMuted},children:[X,"% complete"]}),s.jsx(nj,{q:ne,value:b[ne.key]||"",onChange:ve=>y(Q=>({...Q,[ne.key]:ve}))},ne.key),s.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[ie>0&&s.jsx("button",{type:"button",onClick:()=>P(ie-1),className:"rounded-lg px-5 py-3 text-sm font-medium",style:{background:M.elevated,color:M.textMuted,border:`1px solid ${M.border}`},children:"Back"}),s.jsx("div",{className:"flex-1",children:s.jsx(un,{onClick:()=>{pe?te():P(ie+1)},disabled:!ue||N,children:N?"Saving...":pe?"Submit →":"Next →"})})]})]}),s.jsx("button",{type:"button",onClick:()=>i("done"),className:"mt-4 w-full text-center text-[13px]",style:{color:M.textMuted},children:"Skip for now"}),s.jsx("div",{className:"h-10"})]})})}return a==="done"?s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsxs(_t,{children:[s.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full",style:{background:M.accentDim,border:`1px solid ${M.accentBorder}`},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M20 6L9 17l-5-5",stroke:M.accent,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:M.textPrimary},children:_?"Thanks. That helps us prioritize your spot.":"You are all set"}),s.jsx("p",{className:"text-sm leading-relaxed",style:{color:M.textMuted},children:"We are rolling out access in waves and will email you the moment your spot opens. Welcome to ViewLink."})]}),s.jsx(bi,{}),s.jsx(Ks,{count:S})]})}):s.jsx(Ht,{children:s.jsxs("div",{className:"flex flex-1 flex-col justify-center",children:[s.jsx("h1",{className:"mb-2 text-center text-2xl font-bold",style:{color:M.textPrimary,letterSpacing:"-0.02em"},children:"You are almost in"}),s.jsx("p",{className:"mb-6 text-center text-sm",style:{color:M.textMuted},children:"Add your name to lock in your place in the founding-access rollout."}),s.jsxs(_t,{children:[s.jsx("label",{className:"mb-2 block text-[13px] font-medium",style:{color:M.textMuted},children:"Your name"}),s.jsx("input",{type:"text",value:p,onChange:U=>f(U.target.value),placeholder:"Jane Trader",className:"mb-2 w-full rounded-lg px-4 py-3 text-sm outline-none",style:{background:M.elevated,border:`1px solid ${M.border}`,color:M.textPrimary}}),s.jsxs("p",{className:"text-[12px]",style:{color:M.textMuted},children:["Joining as ",s.jsx("span",{style:{color:M.accent},children:o})]})]}),s.jsxs(_t,{className:"mt-5",children:[s.jsxs("button",{type:"button",onClick:()=>v(U=>!U),className:"flex w-full items-start gap-3 text-left",children:[s.jsx("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded",style:{border:`2px solid ${j?M.accent:M.border}`,background:j?M.accent:"transparent"},children:j&&s.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M13 4L6 12L3 8.5",stroke:M.bg,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsxs("span",{className:"text-[13px] leading-relaxed",style:{color:M.textPrimary},children:["Email me when my founding spot opens up."," ",s.jsx("span",{style:{color:M.textMuted},children:"(required to join)"})]})]}),s.jsx("div",{className:"my-4 h-px w-full",style:{background:M.border}}),s.jsxs("button",{type:"button",onClick:()=>T(U=>!U),className:"flex w-full items-start gap-3 text-left",children:[s.jsx("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded",style:{border:`2px solid ${C?M.accent:M.border}`,background:C?M.accent:"transparent"},children:C&&s.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M13 4L6 12L3 8.5",stroke:M.bg,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsxs("span",{className:"text-[13px] leading-relaxed",style:{color:M.textPrimary},children:["Send me occasional product updates and news."," ",s.jsx("span",{style:{color:M.textMuted},children:"(optional)"})]})]})]}),s.jsxs("p",{className:"mt-5 text-center text-[12px] leading-relaxed",style:{color:M.textMuted},children:["By joining, you agree to our"," ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",style:{color:M.accent},children:"Privacy Policy"}),"."]}),s.jsxs("div",{className:"mt-3",children:[s.jsx(un,{onClick:w,disabled:!H,children:J?"Submitting...":"Get Access →"}),s.jsx(W,{})]})]})})}
63,mp="trial_t",dl="vl_trial_invite",sj=15*60*1e3;function wi(e){return`/trial?t=${encodeURIComponent(e)}`}function aj(e){if(e)try{const t={token:e,stashedAt:Date.now()};sessionStorage.setItem(dl,JSON.stringify(t))}catch{}}function ja(){try{sessionStorage.removeItem(dl)}catch{}}function ij(){let e=null;try{e=sessionStorage.getItem(dl)}catch{return null}if(ja(),!e)return null;try{const t=JSON.parse(e);return!(t!=null&&t.token)||typeof t.stashedAt!="number"||Date.now()-t.stashedAt>sj?null:t.token}catch{return null}}const bu="https://api.viewlink.dev",oj=8,lj=6e3,jt={bg:"#0D0D0D",surface:"#111111",elevated:"#1A1A1A",border:"#1F2937",accent:"#53AEE0",accentDim:"rgba(83,174,224,0.10)",accentBorder:"rgba(83,174,224,0.30)",accentGlow:"rgba(83,174,224,0.45)",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"},cj={wrong_account:"wrongAccount",email_unconfirmed:"emailUnconfirmed",window_closed:"windowClosed",token_invalid:"linkBad",claims_closed:"claimsClosed",vps_exists:"error"};function uj(e){if(!e)return null;const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.toLocaleString("en-GB",{month:"long",timeZone:"UTC"});return`${t.getUTCDate()} ${n} ${t.getUTCFullYear()}`}function Ft({children:e}){return s.jsxs("div",{className:"min-h-screen",style:{background:jt.bg,color:jt.textPrimary},children:[s.jsx("div",{className:"pointer-events-none fixed inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-0 h-[500px]",style:{background:"radial-gradient(35% 80% at 50% 0%, rgba(83,174,224,0.07), transparent)"}}),s.jsxs("div",{className:"relative z-10 mx-auto flex min-h-screen max-w-[560px] flex-col px-5 py-8",children:[s.jsx(Ie,{to:"/",className:"mb-2 flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent"})}),e]})]})}function qt({children:e,className:t=""}){return s.jsx("div",{className:`rounded-xl p-6 ${t}`,style:{background:jt.surface,border:`1px solid ${jt.border}`,boxShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:e})}function qr({children:e,onClick:t,disabled:n=!1}){return s.jsx("button",{type:"button",onClick:t,disabled:n,className:"w-full rounded-lg py-3 text-sm font-semibold transition-all duration-150 active:translate-y-px",style:{background:n?jt.elevated:jt.accent,color:n?jt.textMuted:jt.bg,border:n?`1px solid ${jt.border}`:"none",cursor:n?"not-allowed":"pointer",opacity:n?.7:1},onMouseEnter:r=>{n||(r.currentTarget.style.boxShadow=`0 0 18px ${jt.accentGlow}`)},onMouseLeave:r=>{r.currentTarget.style.boxShadow=""},children:e})}function Gt({children:e}){return s.jsx("h1",{className:"mb-2 text-xl font-bold",style:{color:jt.textPrimary},children:e})}function st({children:e,className:t=""}){return s.jsx("p",{className:`text-sm leading-relaxed ${t}`,style:{color:jt.textMuted},children:e})}function ki(){return s.jsx("button",{type:"button",onClick:Jn,className:"mt-4 text-sm font-medium",style:{color:jt.accent},children:"Send us a message"})}const dj=()=>{const e=nt(),[t]=Wo(),{session:n,user:r,loading:a,signOut:i}=be(),[o]=h.useState(()=>{const z=(t.get("t")||"").trim();return z?(ja(),z):ij()||""}),l=o.length>=oj,[c,u]=h.useState(()=>typeof window<"u"&&/[#&](access_token|error)=/.test(window.location.hash)),[d,m]=h.useState(null),p=ka(d==null?void 0:d.trial_days),f=ka(d==null?void 0:d.trial_days_extended),[g,x]=h.useState(!1),[b,y]=h.useState(!1),[j,v]=h.useState(null),[C,T]=h.useState(null),[S,E]=h.useState(!1),[B,P]=h.useState(!1);h.useEffect(()=>{if(!c)return;if(n){u(!1);return}const z=setTimeout(()=>u(!1),lj);return()=>clearTimeout(z)},[c,n]),h.useEffect(()=>{if(!l)return;let z=!1;return(async()=>{try{const F=await fetch(`${bu}/v1/trial/invite?t=${encodeURIComponent(o)}`);if(z)return;if(F.status===422){x(!0);return}if(!F.ok){y(!0);return}const k=await F.json();z||m(k)}catch{z||y(!0)}})(),()=>{z=!0}},[o,l]);const N=h.useMemo(()=>j||(!l||g?"linkBad":b?"error":d?d.valid?d.state==="expired"?"windowClosed":d.state==="claimed"?"alreadyClaimed":a||c&&!n?"loading":n?r!=null&&r.email_confirmed_at?"ready":"emailUnconfirmed":"signedOut":"linkBad":"loading"),[j,l,g,b,d,a,c,n,r]),L=(d==null?void 0:d.email_masked)??"your invited address",_=uj(C??(d==null?void 0:d.trial_expires_at)),D=`/login?next=${encodeURIComponent(`/trial?t=${o}`)}`,A=`/signup?claim=1&${mp}=${encodeURIComponent(o)}`,V=async()=>
63{if(!S){E(!0);try{const z=await fetch(`${bu}/v1/trial/claim`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n==null?void 0:n.access_token}`},body:JSON.stringify({t:o})}),F=await z.json().catch(()=>({}));if(z.ok){if((F==null?void 0:F.status)==="claimed"){e("/dashboard",{replace:!0});return}if((F==null?void 0:F.status)==="already_claimed"){T((F==null?void 0:F.trial_expires_at)??null),v("alreadyClaimed");return}if((F==null?void 0:F.status)==="pending"){v("settingUp");return}v("error");return}const k=F==null?void 0:F.detail,H=k&&typeof k=="object"?k.code:null;v(H&&cj[H]||"error")}catch{v("error")}finally{E(!1)}}},J=()=>e("/dashboard",{replace:!0}),O=async()=>{if(!B){P(!0);try{await i()}catch{}v(null),P(!1)}};return N==="loading"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 items-center justify-center"})}):N==="ready"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Your trial is ready"}),wa(p,f)&&s.jsx(st,{className:"mb-4",children:wa(p,f)}),s.jsx(st,{className:"mb-4",children:"Full access to the product. No card, nothing to cancel, and nothing charges at the end."}),s.jsx(st,{className:"mb-5",children:p?`Your ${p} days start when you press the button below.`:"Your trial starts when you press the button below."}),s.jsx(qr,{onClick:V,disabled:S,children:S?"Starting...":dp(p)??"Start my trial"})]})})}):N==="alreadyClaimed"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Your trial is already running"}),s.jsx(st,{className:"mb-5",children:_?`It runs until ${_}. Nothing more to do here.`:"Nothing more to do here."}),s.jsx(qr,{onClick:J,children:"Go to my dashboard"})]})})}):N==="windowClosed"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"This invite has closed"}),s.jsx(st,{className:"mb-3",children:"The link was good for 7 days and that window has passed. No trial was started and nothing was charged."}),s.jsx(st,{children:p?`If you would still like the ${p} days, send us a message and we will open it again.`:"If you would still like the trial, send us a message and we will open it again."}),s.jsx(ki,{})]})})}):N==="linkBad"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"We could not read this link"}),s.jsx(st,{className:"mb-3",children:"Email apps sometimes break long links. Open the original email and press the link again."}),s.jsx(st,{children:"If it still does not work, send us a message and we will send you a fresh one."}),s.jsx(ki,{})]})})}):N==="signedOut"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Sign in to continue"}),s.jsxs(st,{className:"mb-5",children:["This invite was sent to ",L,". Sign in with that address and you will come straight back here."]}),s.jsx(qr,{onClick:()=>e(D),children:"Sign in"}),s.jsx("button",{type:"button",onClick:()=>e(A),className:"mt-3 w-full text-center text-sm text-muted-foreground underline underline-offset-4 hover:text-foreground transition-colors",children:"I don't have an account yet"})]})})}):N==="wrongAccount"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"This invite belongs to a different account"}),s.jsxs(st,{className:"mb-3",children:["It was sent to ",L,", and you are signed in as ",(r==null?void 0:r.email)??"another address","."]}),s.jsxs(st,{className:"mb-5",children:["Sign out below, then sign back in as ",L," to start the trial."]}),s.jsx(qr,{onClick:O,disabled:B,children:B?"Signing out...":"Sign out"})]})})}):N==="emailUnconfirmed"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Confirm your email first"}),s.jsx(st,{children:"We sent a confirmation link when you signed up. Press it, then come back to this page."})]})})}):N==="claimsClosed"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Not open right now"}),s.jsx(st,{children:"Trials are paused at the moment. Nothing has been used up and your link still works. Try again shortly."})]})})}):N==="settingUp"?s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Setting up your trial"}),s.jsx(st,{className:"mb-3",children:p?`Your ${p} days have started. We are building your machine now, which takes a few minutes.`:"Your trial has started. We are building your machine now, which takes a few minutes."}),s.jsx(st,{className:"mb-5",children:"You do not need to stay on this page. We will email you the moment it is ready."}),s.jsxs("div",{className:"mb-5",children:[s.jsx(st,{className:"mb-2",children:"Want to talk it through? Pick a time that suits you."}),s.jsx("a",{href:tp,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium underline underline-offset-2",style:{color:"#53AEE0"},children:"Book a call with the founder"})]}),s.jsx(qr,{onClick:J,children:"Go to my dashboard"})]})})}):s.jsx(Ft,{children:s.jsx("div",{className:"flex flex-1 flex-col justify-center",children:s.jsxs(qt,{children:[s.jsx(Gt,{children:"Something went wrong"}),s.jsx(st,{className:"mb-3",children:"We could not start your trial. Nothing has been charged and your link is still good."}),s.jsx(st,{children:"Send us a message and we will sort it out."}),s.jsx(ki,{})]})})})},qe=h.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:se("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));qe.displayName="Input";const mj="https://api.viewlink.dev";function vu(){const e=new URLSearchParams(window.location.search).get("next")||"";return e.startsWith("/")&&e[1]!=="/"&&e[1]!=="\\"?e:"/dashboard"}const fj=()=>{const[e,t]=h.useState(""),[n,r]=h.useState(""),[a,i]=h.useState(!1),[o,l]=h.useState(""),[c,u]=h.useState(!1),[d,m]=h.useState(!1),[p,f]=h.useState(!1),[g,x]=h.useState(!1),{toast:b}
63=Wt(),y=nt();h.useEffect(()=>{new URLSearchParams(window.location.search).get("reason")==="inactive"&&b({title:"Signed out",description:"You were signed out due to inactivity."})},[b]),h.useEffect(()=>{fetch(`${mj}/v1/billing/config`).then(C=>C.json()).then(C=>m(!!(C!=null&&C.google_oauth_enabled))).catch(()=>m(!1))},[]);const j=async()=>{if(!p){l("You must agree to the Terms & Privacy Policy.");return}u(!0),l(""),$e.capture("login_attempted",{method:"google"}),Hf({terms_accepted:!0,terms_version:Xn,privacy_accepted:!0,privacy_version:Kn,marketing_opt_in:g,channel:"oauth"});try{const{error:C}=await Z.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}${vu()}`}});C&&(Sr(),l(C.message))}catch(C){Sr(),l(C instanceof Error?C.message:"Google sign-in failed. Please try again.")}u(!1)},v=async C=>{C.preventDefault(),l(""),i(!0),$e.capture("login_attempted",{method:"email"});const{error:T}=await Z.auth.signInWithPassword({email:e,password:n});if(T){l(T.message),i(!1);return}y(vu())};return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm animate-fade-up",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx(Ie,{to:"/",className:"inline-flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent md:h-[160px] lg:h-[240px]"})}),s.jsx("h1",{className:"text-xl font-semibold mt-6 mb-1",children:"Welcome back"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to your ViewLink account"})]}),s.jsxs("form",{onSubmit:v,className:"space-y-5",children:[o&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-lg px-3 py-2",children:o}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"email",className:"text-sm font-medium text-muted-foreground",children:"Email"}),s.jsx(qe,{id:"email",type:"email",autoComplete:"email",value:e,onChange:C=>t(C.target.value),placeholder:"[email protected]",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ze,{htmlFor:"password",className:"text-sm font-medium text-muted-foreground",children:"Password"}),s.jsx(Ie,{to:"/forgot-password",className:"text-xs text-primary hover:underline",children:"Forgot password?"})]}),s.jsx(qe,{id:"password",type:"password",autoComplete:"current-password",value:n,onChange:C=>r(C.target.value),placeholder:"Enter your password",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsx(re,{type:"submit",className:"w-full font-semibold",disabled:a,children:a?"Logging in...":"Log in"}),d&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative my-1",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t border-[#1F2937]"})}),s.jsx("div",{className:"relative flex justify-center text-xs",children:s.jsx("span",{className:"bg-background px-3 text-muted-foreground",children:"or"})})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"login-terms",checked:p,onCheckedChange:C=>f(C===!0),className:"mt-0.5"}),s.jsxs(ze,{htmlFor:"login-terms",className:"text-xs text-muted-foreground leading-relaxed cursor-pointer",children:["I agree to the ",s.jsx("a",{href:"/terms.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Terms of Service"})," and ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Privacy Policy"})]})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"login-marketing",checked:g,onCheckedChange:C=>x(C===!0),className:"mt-0.5"}),s.jsx(ze,{htmlFor:"login-marketing",className:"text-xs text-muted-foreground leading-relaxed cursor-pointer",children:"Send me occasional ViewLink product updates and offers. You can unsubscribe at any time."})]}),s.jsxs("button",{type:"button",onClick:j,disabled:c||!p,title:p?void 0:"Please agree to the Terms of Service and Privacy Policy first.",className:"w-full flex items-center justify-center gap-3 h-10 rounded-md bg-[#1A1A1A] border border-[#1F2937] text-sm font-medium text-foreground hover:border-[#374151] hover:bg-[#222222] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),c?"Redirecting...":"Continue with Google"]}),!p&&s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Tick the box above to agree to the Terms of Service and Privacy Policy, then continue with Google."})]})]}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["Don't have an account?"," ",s.jsx(Ie,{to:"/signup",className:"text-primary hover:underline font-medium",children:"Sign up"})]})]})})},fp="https://api.viewlink.dev";async function pj(e,t){try{const n=await fetch(`${fp}/v1/join/claim-confirm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({t:e,email:t})});if(!n.ok)return!1;const r=await n.json();return(r==null?void 0:r.confirmed)===!0}catch{return!1}}const hj=()=>
63{const[e]=Wo(),t=(e.get("email")||"").trim(),n=e.get("claim")==="1"&&t!=="",a=e.get("claim")==="1"?(e.get("t")||"").trim():"",i=(e.get(mp)||"").trim();op(i?wi(i):"/dashboard");const[o,l]=h.useState(""),[c,u]=h.useState(()=>n?t:""),[d,m]=h.useState(""),[p,f]=h.useState(""),[g,x]=h.useState(!1),[b,y]=h.useState(!1),[j,v]=h.useState(!1),[C,T]=h.useState(""),[S,E]=h.useState(!1),[B,P]=h.useState(!1),[N,L]=h.useState(!1),[_,D]=h.useState(!1),[A,V]=h.useState(0),{toast:J}=Wt(),O=nt();h.useEffect(()=>{if(A<=0)return;const H=setTimeout(()=>V(R=>R-1),1e3);return()=>clearTimeout(H)},[A]),h.useEffect(()=>{fetch(`${fp}/v1/billing/config`).then(H=>H.json()).then(H=>{P(!!(H!=null&&H.google_oauth_enabled))}).catch(()=>P(!1))},[O,e]);const z=async()=>{if(!g){T("You must agree to the Terms & Privacy Policy.");return}E(!0),$e.capture("signup_attempted",{method:"google"}),Hf({terms_accepted:!0,terms_version:Xn,privacy_accepted:!0,privacy_version:Kn,marketing_opt_in:b,channel:"oauth"}),i&&aj(i);try{const{error:H}=await Z.auth.signInWithOAuth({provider:"google",options:{redirectTo:i?`${window.location.origin}${wi(i)}`:`${window.location.origin}/onboarding/plan-select`}});H&&(Sr(),ja(),T(H.message))}catch(H){Sr(),ja(),T(H instanceof Error?H.message:"Google sign-in failed. Please try again.")}E(!1)},F=async H=>{if(H.preventDefault(),T(""),!o.trim()){T("Full name is required.");return}if(d.length<8){T("Password must be at least 8 characters.");return}if(d!==p){T("Passwords don't match.");return}if(!g){T("You must agree to the Terms & Privacy Policy.");return}v(!0),$e.capture("signup_attempted",{method:"email"});const{data:R,error:w}=await Z.auth.signUp({email:c,password:d,options:{emailRedirectTo:`${window.location.origin}/`,data:{full_name:o.trim(),terms_accepted:!0,terms_version:Xn,privacy_accepted:!0,privacy_version:Kn,marketing_opt_in:b}}});if(v(!1),w){T(w.message);return}if(R.session){if(i){O(wi(i));return}J({title:"Account created",description:"Redirecting to plan selection..."}),O("/onboarding/plan-select");return}if(a){if(v(!0),await pj(a,c)){const{data:W,error:U}=await Z.auth.signInWithPassword({email:c,password:d});if(!U&&(W!=null&&W.session)){$e.capture("signup_claim_autoconfirmed"),v(!1),J({title:"Account created",description:"Redirecting to plan selection..."}),O("/onboarding/plan-select");return}}$e.capture("signup_claim_autoconfirm_fell_back"),v(!1)}$e.capture("signup_email_confirmation_sent"),L(!0),V(30)},k=async()=>{if(A>0||_)return;D(!0);const{error:H}=await Z.auth.resend({type:"signup",email:c,options:{emailRedirectTo:`${window.location.origin}/`}});D(!1),V(30),J(H?{title:"Couldn't resend",description:H.message,variant:"destructive"}:{title:"Email resent",description:"Check your inbox again."})};return N?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm animate-fade-up text-center",children:[s.jsx(Ie,{to:"/",className:"inline-flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto bg-transparent md:h-[80px] lg:h-[100px]"})}),s.jsx("div",{className:"w-12 h-12 rounded-full bg-success/10 flex items-center justify-center mx-auto mt-6 mb-4",children:s.jsx("span",{className:"text-success text-xl",children:"✉"})}),s.jsx("h1",{className:"text-xl font-semibold mb-1",children:"Check your email"}),s.jsxs("p",{className:`text-sm text-muted-foreground ${i?"mb-3":"mb-6"}`,children:["We've sent a confirmation link to"," ",s.jsx("span",{className:"text-foreground font-medium",children:c}),". Click it to confirm your ViewLink account and continue setup."]}),i&&s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Your free trial is saved against this address. Confirm your email and it will be waiting for you."}),s.jsx(re,{type:"button",variant:"outline",className:"w-full font-semibold",onClick:k,disabled:_||A>0,children:_?"Resending...":A>0?`Resend email (${A}s)`:"Resend email"}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["Already confirmed?"," ",s.jsx(Ie,{to:"/login",className:"text-primary hover:underline font-medium",children:"Log in"})]})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm animate-fade-up",children:[s.jsxs("div",{className:"text-center mb-4",children:[s.jsx(Ie,{to:"/",className:"inline-flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto bg-transparent md:h-[80px] lg:h-[100px]"})}),s.jsx("h1",{className:"text-xl font-semibold mt-6 mb-1",children:"Create your account"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Set up once. Trade from TradingView instantly."})]}),s.jsxs("form",{onSubmit:F,className:"space-y-5",children:[C&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-lg px-3 py-2",children:C}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"full-name",className:"text-sm font-medium text-muted-foreground",children:"Full name"}),s.jsx(qe,{id:"full-name",type:"text",autoComplete:"name",value:o,onChange:H=>l(H.target.value),placeholder:"Your full name",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"email",className:"text-sm font-medium text-muted-foreground",children:"Email"}),s.jsx(qe,{id:"email",type:"email",autoComplete:"email",value:c,onChange:H=>u(H.target.value),placeholder:"[email protected]",required:!0,readOnly:n,"aria-readonly":n||void 0,className:n?"bg-muted border-border-default cursor-default focus:border-border-default":"bg-input border-border-default focus:border-border-focus"}),n&&s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"This is the email your founding invite was sent to. Need to use a different one? Reply to your invite and we'll sort it."})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"password",className:"text-sm font-medium text-muted-foreground",children:"Password"}),s.jsx(qe,{id:"password",type:"password",autoComplete:"new-password",value:d,onChange:H=>m(H.target.value),placeholder:"Min. 8 characters",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"confirm-password",className:"text-sm font-medium text-muted-foreground",children:"Confirm password"}),s.jsx(qe,{id:"confirm-password",type:"password",autoComplete:"new-password",value:p,onChange:H=>f(H.target.value),placeholder:"Re-enter password",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"terms",checked:g,onCheckedChange:H=>x(H===!0),className:"mt-0.5"}),s.jsxs(ze,{htmlFor:"terms",className:"text-xs text-muted-foreground leading-relaxed cursor-pointer",children:["I agree to the ",s.jsx("a",{href:"/terms.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Terms of Service"})," and ",s.jsx("a",{href:"/privacy.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Privacy Policy"})]})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Qn,{id:"marketing",checked:b,onCheckedChange:H=>y(H===!0),className:"mt-0.5"}),s.jsx(ze,{htmlFor:"marketing",className:"text-xs text-muted-foreground leading-relaxed cursor-pointer",children:"Send me occasional ViewLink product updates and offers. You can unsubscribe at any time."})]}),s.jsx(re,{type:"submit",className:"w-full font-semibold",disabled:j||!g,title:g?void 0:"Please agree to the Terms of Service to continue.",children:j?"Creating account...":"Create account"}),B&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative my-1",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t border-[#1F2937]"})}),s.jsx("div",{className:"relative flex justify-center text-xs",children:s.jsx("span",{className:"bg-background px-3 text-muted-foreground",children:"or"})})]}),s.jsxs("button",{type:"button",onClick:z,disabled:S||!g,title:g?void 0:"Please agree to the Terms of Service and Privacy Policy first.",className:"w-full flex items-center justify-center gap-3 h-10 rounded-md bg-[#1A1A1A] border border-[#1F2937] text-sm font-medium text-foreground hover:border-[#374151] hover:bg-[#222222] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),S?"Redirecting...":"Continue with Google"]}),!g&&s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Tick the box above to agree to the Terms of Service and Privacy Policy, then continue with Google."})]})]}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["Already have an account?"," ",s.jsx(Ie,{to:"/login",className:"text-primary hover:underline font-medium",children:"Log in"})]})]})})},gj=()=>{const[e,t]=h.useState(""),[n,r]=h.useState(!1),[a,i]=h.useState(!1),[o,l]=h.useState(""),{toast:c}=Wt(),u=async d=>{d.preventDefault(),l(""),r(!0);const{error:m}=await Z.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/reset-password`});if(r(!1),m){l(m.message);return}i(!0),c({title:"Email sent",description:"Check your inbox for a password reset link."})};return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm animate-fade-up",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx(Ie,{to:"/",className:"inline-flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent md:h-[160px] lg:h-[240px]"})}),s.jsx("h1",{className:"text-xl font-semibold mt-6 mb-1",children:"Reset your password"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a?"Check your email for a reset link.":"Enter your email and we'll send you a reset link."})]}),a?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-success/10 flex items-center justify-center mx-auto mb-4",children:s.jsx("span",{className:"text-success text-xl",children:"✓"})}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["We've sent a password reset link to ",s.jsx("span",{className:"text-foreground font-medium",children:e})]})]}):s.jsxs("form",{onSubmit:u,className:"space-y-5",children:[o&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-lg px-3 py-2",children:o}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"email",className:"text-sm font-medium text-muted-foreground",children:"Email"}),s.jsx(qe,{id:"email",type:"email",autoComplete:"email",value:e,onCh
63ange:d=>t(d.target.value),placeholder:"[email protected]",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsx(re,{type:"submit",className:"w-full font-semibold",disabled:n,children:n?"Sending...":"Send reset link"})]}),s.jsx("div",{className:"text-center mt-6",children:s.jsxs(Ie,{to:"/login",className:"text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",children:[s.jsx(bs,{className:"w-3 h-3"})," Back to login"]})})]})})},xj=()=>{const[e,t]=h.useState(""),[n,r]=h.useState(""),[a,i]=h.useState(!1),[o,l]=h.useState(""),[c,u]=h.useState(!1),{toast:d}=Wt(),m=nt();h.useEffect(()=>{const{data:{subscription:f}}=Z.auth.onAuthStateChange(g=>{g==="PASSWORD_RECOVERY"&&u(!0)});return Z.auth.getSession().then(({data:{session:g}})=>{g&&u(!0)}),()=>f.unsubscribe()},[]);const p=async f=>{if(f.preventDefault(),l(""),e.length<8){l("Password must be at least 8 characters.");return}if(e!==n){l("Passwords don't match.");return}i(!0);const{error:g}=await Z.auth.updateUser({password:e});if(i(!1),g){l(g.message);return}d({title:"Password updated",description:"You can now log in with your new password."}),await Z.auth.signOut(),m("/login")};return c?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm animate-fade-up",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx(Ie,{to:"/",className:"inline-flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent md:h-[160px] lg:h-[240px]"})}),s.jsx("h1",{className:"text-xl font-semibold mt-6 mb-1",children:"Set new password"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a new password for your account"})]}),s.jsxs("form",{onSubmit:p,className:"space-y-5",children:[o&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-lg px-3 py-2",children:o}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"password",className:"text-sm font-medium text-muted-foreground",children:"New password"}),s.jsx(qe,{id:"password",type:"password",autoComplete:"new-password",value:e,onChange:f=>t(f.target.value),placeholder:"Min. 8 characters",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{htmlFor:"confirm-password",className:"text-sm font-medium text-muted-foreground",children:"Confirm password"}),s.jsx(qe,{id:"confirm-password",type:"password",autoComplete:"new-password",value:n,onChange:f=>r(f.target.value),placeholder:"Re-enter password",required:!0,className:"bg-input border-border-default focus:border-border-focus"})]}),s.jsx(re,{type:"submit",className:"w-full font-semibold",disabled:a,children:a?"Updating...":"Update password"})]})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verifying reset link..."})})})},yj=()=>{const{session:e}=be(),t=nt(),[n,r]=h.useState(null);return h.useEffect(()=>{const a=d=>{const m=new URLSearchParams(d.startsWith("#")?d.slice(1):d);return{code:m.get("error_code")||m.get("error"),desc:m.get("error_description")}},i=a(window.location.search),o=a(window.location.hash),l=i.code||o.code,c=i.desc||o.desc;if(l){r(c?decodeURIComponent(c.replace(/\+/g," ")):l);return}if(e){t("/dashboard",{replace:!0});return}const u=setTimeout(()=>t("/login",{replace:!0}),6e3);return()=>clearTimeout(u)},[e,t]),n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Confirmation link problem"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:n}),s.jsx(Ie,{to:"/signup",className:"text-primary hover:underline font-medium text-sm",children:"Back to sign up"})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent roun
63ded-full animate-spin mx-auto mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Confirming your email…"})]})})},bj=()=>{const e=nt(),[t,n]=h.useState(!1),[r,a]=h.useState(!1),{tokenHash:i,type:o,next:l}=h.useMemo(()=>{const u=new URLSearchParams(window.location.search);return{tokenHash:u.get("token_hash"),type:u.get("type")??null,next:u.get("next")}},[]),c=async()=>{if(!i||!o){a(!0);return}n(!0);const{error:u}=await Z.auth.verifyOtp({type:o,token_hash:i});if(u){n(!1),a(!0);return}if(o==="recovery"){e("/reset-password",{replace:!0});return}const d=l&&l.startsWith("/")?l:"/";e(d,{replace:!0})};return r?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"This link has expired"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"For your security, confirmation links can only be used once and expire after a short time. Request a new one to continue."}),s.jsx(Ie,{to:o==="recovery"?"/forgot-password":"/signup",className:"text-primary hover:underline font-medium text-sm",children:o==="recovery"?"Request a new reset link":"Request a new link"})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center animate-fade-up",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:o==="recovery"?"Reset your password":"Confirm your email"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:o==="recovery"?"Click below to continue and set a new password.":"Click below to confirm your email address and continue."}),s.jsx(re,{type:"button",onClick:c,disabled:t,className:"w-full font-semibold",children:t?"Confirming…":"Continue"})]})})},vj=()=>{const e=sr();return h.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),s.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),s.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},wj=Wa("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ms({className:e,variant:t,...n}){return s.jsx("div",{className:se(wj({variant:t}),e),...n})}const ml=({currentStep:e,totalSteps:t,labels:n})=>s.jsxs("div",{className:"mb-6 sm:mb-10",children:[s.jsx("div",{className:"flex items-center justify-center gap-2 pointer-events-none select-none",role:"img","aria-label":`Step ${e} of ${t}`,children:Array.from({length:t},(r,a)=>{const i=a+1,o=i<e,l=i===e;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[s.jsx("div",{className:se("w-8 h-8 rounded-full flex items-center justify-center text-xs font-semibold transition-all duration-150",o&&"bg-primary text-primary-foreground",l&&"bg-primary text-primary-foreground ring-2 ring-primary/30 ring-offset-2 ring-offset-background",!o&&!l&&"bg-muted text-muted-foreground border border-border"),children:o?s.jsx(ot,{size:14}):i}),(n==null?void 0:n[a])&&s.jsx("span",{className:se("text-xs font-medium whitespace-nowrap",l?"text-foreground":"text-muted-foreground"),children:n[a]})]}),i<t&&s.jsx("div",{className:se("w-12 h-px mb-5",o?"bg-primary":"bg-border")})]},i)})}),s.jsxs("p",{className:"mt-3 text-center text-xs text-muted-foreground select-none",children:["Step ",e," of ",t]})]}),_s=({children:e,className:t,accentBorder:n=!1,onClick:r})=>s.jsxs("div",{onClick:r,className:se("group relative rounded-xl p-6 transition-all duration-150","bg-card border","shadow-[0_1px_3px_rgba(0,0,0,0.4),0_0_0_1px_hsl(var(--border))]","hover:shadow-[0_4px_16px_rgba(0,0,0,0.5),0_0_0_1px_hsl(var(--border-default))]",n?"border-primary hover:shadow-[0_0_24px_rgba(77,77,255,0.3),0_4px_16px_rgba(0,0,0,0.5)]":"border-border hover:border-[hsl(var(--border-default))]",r&&"curs
63or-pointer",t),children:[s.jsx("div",{className:se("pointer-events-none absolute inset-0 rounded-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",n?"shadow-[inset_0_0_20px_rgba(77,77,255,0.06)]":"shadow-[inset_0_0_20px_rgba(77,77,255,0.04)]")}),s.jsx("div",{className:"relative z-10",children:e})]}),kj="https://api.viewlink.dev";function _j(){const{session:e}=be(),[t,n]=h.useState(null);if(h.useEffect(()=>{if(!(e!=null&&e.access_token))return;let i=!1;return fetch(`${kj}/v1/voucher/me`,{headers:{Authorization:`Bearer ${e.access_token}`}}).then(o=>o.ok?o.json():null).then(o=>{i||n((o==null?void 0:o.voucher)??null)}).catch(()=>{}),()=>{i=!0}},[e]),!t||t.discount_amount==null)return null;const r=`${parseFloat((t.discount_amount/100).toFixed(2))}%`,a=t.lock_duration_months;return s.jsx("div",{className:"mx-auto mb-8 max-w-md rounded-lg border border-primary/25 bg-primary/10 px-4 py-3 text-center",children:s.jsx("p",{className:"text-[0.875rem] text-foreground leading-relaxed",children:a!=null?s.jsxs(s.Fragment,{children:["Your founding rate is locked: ",s.jsxs("strong",{children:[r," off"]})," for your first"," ",s.jsx("strong",{children:a})," billing cycles. Our thanks for backing ViewLink this early."]}):s.jsxs(s.Fragment,{children:["Your founding rate is locked: ",s.jsxs("strong",{children:[r," off"]})," your subscription. Our thanks for backing ViewLink this early."]})})})}const jj="https://api.viewlink.dev";function pp(e){const{session:t}=be(),[n,r]=h.useState({trialDays:null,discountPercent:null}),[a,i]=h.useState(!0);return h.useEffect(()=>{if(!(t!=null&&t.access_token)||!e)return;let o=!1;return i(!0),fetch(`${jj}/v1/billing/trial-preview?plan_slug=${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${t.access_token}`}}).then(l=>l.ok?l.json():null).then(l=>{o||(r({trialDays:typeof(l==null?void 0:l.trial_days)=="number"?l.trial_days:null,discountPercent:typeof(l==null?void 0:l.discount_percent)=="number"?l.discount_percent:null}),i(!1))}).catch(()=>{o||(r({trialDays:null,discountPercent:null}),i(!1))}),()=>{o=!0}},[t,e]),{...n,loading:a}}function Nj({planSlug:e}){const{trialDays:t,loading:n}=pp(e);return n||t==null||t<=0?null:s.jsxs("p",{className:"mx-auto mb-6 max-w-md text-center text-[0.875rem] font-medium text-primary",children:[t,"-day free trial. Cancel any time."]})}const Sj="https://api.viewlink.dev",Ej=[{icon:Ma,label:"Dedicated VPS provisioned for you"},{icon:Pa,label:"MT5 pre-installed and configured"},{icon:Yg,label:"Priority support and monitoring"}],Cj={starter:"Single account traders",pro:"Multi-account traders",firm:"Firms & power users"},Tj=["starter","pro","firm"],Aj=["active","trialing"],Ij=()=>{var b;const e=nt(),{user:t}=be(),[n,r]=h.useState(null),[a,i]=h.useState([]),[o,l]=h.useState(!0),[c,u]=h.useState(null),[d,m]=h.useState(!1);if(h.useEffect(()=>{$e.capture("onboarding_plan_select_viewed")},[]),h.useEffect(()=>{if(!t)return;const y=async()=>{const{data:v,error:C}=await Z.from("subscriptions").select("status").eq("user_id",t.id).limit(1).maybeSingle();if(C){console.error("PlanSelect: subscription guard read failed",C),m(!0),l(!1);return}if(v&&Aj.includes(v.status??"")){e("/dashboard",{replace:!0});return}try{const{data:{session:T}}=await Z.auth.getSession(),S=await fetch(`${Sj}/v1/signup-survey`,{headers:{Authorization:`Bearer ${(T==null?void 0:T.access_token)??""}`}});if(S.ok){const E=await S.json();if((E==null?void 0:E.destination)==="survey"){e("/onboarding/questions",{replace:!0});return}const B=new URLSearchParams(window.location.search).get("trial")==="skip";if(((E==null?void 0:E.destination)==="trial_offer"||(E==null?void 0:E.destination)==="trial_claim")&&!B){e("/onboarding/trial-offer",{replace:!0});return}if((E==null?void 0:E.destination)==="waitlist"&&!B){e("/onboarding/waitlist",{replace:!0});return}}}catch{}await j()},j=async()=>{const{data:v,error:C}=await Z.from("plan_configs").select("id, plan_slug, display_name, price_usd, max_accounts, vps_ram_gb, is_active");if(C)u("Failed to load plans. Please refresh."),console.error(C);else{const T=new Map((v??[]).map(E=>
63[E.plan_slug,E])),S=Tj.map(E=>T.get(E)).filter(E=>!!E);i(S)}l(!1)};y()},[t,e]),o)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(yt,{className:"animate-spin text-primary",size:32})});if(d)return s.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center gap-4 px-6 text-center",children:[s.jsx("p",{className:"text-base font-medium text-foreground",children:"We couldn't load your account."}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-xs",children:"Check your connection and try again."}),s.jsx(re,{onClick:()=>window.location.reload(),className:"font-semibold mt-1",children:"Try again"})]});const p=a.find(y=>y.id===n)??null,f=((b=a.find(y=>y.is_active))==null?void 0:b.plan_slug)??null,g=p?`Continue with ${p.display_name}`:"Select a plan to continue",x=()=>e("/onboarding/payment",{state:{plan_config_id:n}});return s.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center px-6 pt-8 pb-28 sm:py-12 animate-fade-up",children:[s.jsxs("div",{className:"w-full max-w-4xl",children:[s.jsx(ml,{currentStep:1,totalSteps:3}),s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground text-center mb-2 mt-6 sm:mt-8",children:"Choose Your Plan"}),s.jsx("p",{className:"text-[0.875rem] text-muted-foreground text-center mb-6 sm:mb-10 max-w-md mx-auto",children:"Every plan includes a fully managed, dedicated VPS with MetaTrader 5 pre-installed."}),s.jsx(_j,{}),s.jsx(Nj,{planSlug:f}),s.jsx("div",{className:"flex flex-wrap justify-center gap-x-6 gap-y-1.5 mb-6 sm:mb-10",children:Ej.map(y=>s.jsxs("div",{className:"flex items-center gap-2 text-[0.8125rem] text-muted-foreground",children:[s.jsx(y.icon,{size:15,className:"text-primary"}),y.label]},y.label))}),c&&s.jsx("p",{className:"text-center text-destructive text-[0.875rem] mb-6",children:c}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-8",children:a.map(y=>{const j=!y.is_active,v=y.plan_slug==="pro"&&!j,C=n===y.id;return s.jsx(_s,{accentBorder:v,onClick:j?void 0:()=>{r(y.id),$e.capture("onboarding_plan_selected",{plan:y.plan_slug})},className:[j?"opacity-60 cursor-not-allowed":"",C?"ring-2 ring-primary ring-offset-2 ring-offset-background":""].join(" ").trim(),children:s.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[j?s.jsx(ms,{className:"bg-muted text-muted-foreground border-border text-[0.75rem] font-semibold uppercase tracking-[0.08em]",children:"Coming Soon"}):v?s.jsx(ms,{className:"bg-primary/10 text-primary border-primary/30 text-[0.75rem] font-semibold uppercase tracking-[0.08em]",children:"Most Popular"}):null,s.jsx("h3",{className:"text-[1.125rem] font-semibold text-foreground",children:y.display_name}),s.jsx("div",{children:j?s.jsx("span",{className:"text-base font-semibold text-muted-foreground",children:"Coming soon"}):s.jsx("span",{className:"text-base font-semibold text-muted-foreground",children:"Price shown at checkout"})}),s.jsxs("div",{className:"space-y-1 text-[0.8125rem] text-muted-foreground",children:[s.jsxs("p",{children:[y.max_accounts," MT5 Account",(y.max_accounts??0)>1?"s":""]}),s.jsxs("p",{children:[y.vps_ram_gb," GB RAM"]}),s.jsx("p",{className:"text-[0.75rem] italic",children:Cj[y.plan_slug]??""})]}),C&&s.jsxs("div",{className:"flex items-center gap-1.5 text-primary text-[0.8125rem] font-medium",children:[s.jsx(ot,{size:14})," Selected"]})]})},y.id)})}),s.jsx("div",{className:"hidden sm:flex justify-center",children:s.jsxs(re,{onClick:x,disabled:!n,className:"rounded-lg font-medium gap-2 px-8",children:[g," ",s.jsx(Qt,{size:16})]})})]}),s.jsx("div",{className:"sm:hidden fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background/95 backdrop-blur-sm px-6 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]",children:s.jsxs(re,{onClick:x,disabled:!n,className:"w-full h-12 rounded-lg font-medium gap-2",children:[g," ",s.jsx(Qt,{size:16})]})})]})};function fl(){return s.jsxs("div",{className:"mb-6 flex items-start gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-4",children:[s.jsx(km,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-400","aria-hidden":"true"}),s.jsxs("div",{className:"text-sm leading-relaxed",children:[s.jsx("p",{className:"font-medium text-amber-200",children:"Set up on a computer, not a phone."}),s.jsx("p",{className:"mt-1 text-amber-100/70",children:"ViewLink runs as a Chrome extension on TradingView, and mobile browsers cannot install extensions. Connecting MT5 to your broker needs a computer too. Open this guide on a desktop or laptop with Chrome. Once setup is done your trades run on your VPS around the clock, so you do not need to keep a computer on to trade."})]})]})}const _i="https://api.viewlink.dev",wu=e=>e==="trial_offer"?"/onboarding/trial-offer":e==="waitlist"?"/onboarding/waitlist":"/onboarding/plan-select";function Dj({children:e}){return s.jsxs("div",{className:"min-h-screen",style:{background:M.bg,color:M.textPrimary},children:[s.jsx("div",{className:"pointer-events-none fixed inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-0 h-[500px]",style:{background:"radial-gradient(35% 80% at 50% 0%, rgba(83,174,224,0.07), transparent)"}}),s.jsxs("div",{className:"relative z-10 mx-auto flex min-h-screen max-w-[560px] flex-col px-5 py-8",children:[s.jsx("div",{className:"mb-2 flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent"})}),e]})]})}const Pj=()=>{const e=nt(),{session:t}=be(),[n,r]=h.useState(null),[a,i]=h.useState({}),[o,l]=h.useState({}),[c,u]=h.useState(0),[d,m]=h.useState(!1),[p,f]=h.useState(null),g=h.useMemo(()=>({Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`}),[t]);h.useEffect(()=>{if(!t)return;let P=!1;return(async()=>{try{const L=await fetch(`${_i}/v1/signup-survey`,{headers:g});if(!L.ok)throw new Error("status");const _=await L.json();if(P)return;if(_.destination!=="survey"){e(wu(_.destination),{replace:!0});return}const D=await fetch(`${_i}/v1/signup-survey/schema`,{headers:g});if(!D.ok)throw new Error("schema");const A=await D.json();P||r(A.questions??[])}catch{P||e("/onboarding/plan-select",{replace:!0})}})(),()=>{P=!0}},[t,g,e]);const x=(P,N)=>i(L=>{const _={...L,[P]:N};
63return n==null||n.forEach(D=>{D.followup&&D.key===P&&!D.followup.trigger_values.includes(N)&&delete _[D.followup.key]}),_}),b=P=>{var L;if(!a[P.key])return!1;const N=P.followup;if(N&&N.trigger_values.includes(a[P.key])){if(!a[N.key])return!1;if(N.free_text_required&&a[N.key]===N.free_text_on)return!!((L=o[N.free_text_key])!=null&&L.trim())}return!0},y=async()=>{if(!d){m(!0),f(null);try{const P=await fetch(`${_i}/v1/signup-survey`,{method:"POST",headers:{"Content-Type":"application/json",...g},body:JSON.stringify({...a,...o})});if(!P.ok)throw new Error(String(P.status));const N=await P.json();e(wu(N.destination),{replace:!0})}catch{f("Something went wrong. Please try again."),m(!1)}}};if(!n)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:M.bg},children:s.jsx(yt,{className:"h-6 w-6 animate-spin",style:{color:M.textMuted}})});const j=n.length,v=Math.min(c,j-1),C=n[v],T=C.followup,S=!!T&&T.trigger_values.includes(a[C.key]??""),E=v===j-1,B=b(C)&&!d;return s.jsx(Dj,{children:s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"mb-6 text-center text-2xl font-bold",style:{color:M.textPrimary,letterSpacing:"-0.02em"},children:"A few quick questions"}),s.jsx(fl,{}),s.jsxs(_t,{children:[s.jsx(Z_,{current:v+1,total:j}),s.jsx("p",{className:"mb-3 text-sm font-medium",style:{color:M.textPrimary},children:C.prompt}),s.jsx("div",{className:"space-y-2",children:C.options.map(P=>s.jsxs("div",{className:"space-y-2",children:[s.jsx(_a,{label:P.label,selected:a[C.key]===P.value,onClick:()=>x(C.key,P.value)}),S&&T&&a[C.key]===P.value&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"ml-4 text-[13px]",style:{color:M.textMuted},children:T.prompt}),T.options.map(N=>s.jsx(_a,{label:N.label,selected:a[T.key]===N.value,onClick:()=>x(T.key,N.value),indent:!0},N.value)),a[T.key]===T.free_text_on&&s.jsx("input",{type:"text",maxLength:100,value:o[T.free_text_key]??"",onChange:N=>l(L=>({...L,[T.free_text_key]:N.target.value})),placeholder:"Which firm?",className:"ml-4 rounded-lg px-4 py-3 text-sm outline-none",style:{width:"calc(100% - 1rem)",background:M.elevated,border:`1px solid ${M.border}`,color:M.textPrimary}}),s.jsx("p",{className:"ml-4 pt-1 text-[13px] leading-relaxed",style:{color:M.textMuted},children:T.warning})]})]},P.value))}),p&&s.jsx("p",{className:"mt-4 text-[13px]",style:{color:"#F87171"},role:"alert",children:p}),s.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[v>0&&s.jsx("button",{type:"button",onClick:()=>u(v-1),className:"rounded-lg px-5 py-3 text-sm font-medium",style:{background:M.elevated,color:M.textMuted,border:`1px solid ${M.border}`},children:"Back"}),s.jsx("div",{className:"flex-1",children:s.jsx(un,{onClick:()=>{E?y():u(v+1)},disabled:!B,children:d?"Saving...":E?"Submit →":"Next →"})})]})]}),s.jsx("div",{className:"h-10"})]})})},ku="https://api.viewlink.dev",Mj=["Full access to the product","No card required","Your own VPS with MT5 pre-installed"],Lj={trial_offer:"You qualify for a free trial",trial_claim:"Your free trial is ready"},Oj={trial_claim:"You were invited to try ViewLink free. No card needed. Start it below.",trial_offer:"Based on your answers, you can try ViewLink free. No card needed."},Rj=()=>{const e=nt(),{session:t}=be(),[n,r]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState("trial_claim"),[c,u]=h.useState(null),[d,m]=h.useState(null);h.useEffect(()=>{if(!t)return;let f=!1;return fetch(`${ku}/v1/signup-survey`,{headers:{Authorization:`Bearer ${t.access_token}`}}).then(g=>g.ok?g.json():null).then(g=>{if(!(f||!g)){if(u(ka(g.trial_days)),m(ka(g.trial_days_extended)),g.destination==="survey"){e("/onboarding/questions",{replace:!0});return}if(g.destination==="trial_offer"||g.destination==="trial_claim"){l(g.destination);return}if(g.destination==="waitlist"){e("/onboarding/waitlist",{replace:!0});return}e("/onboarding/plan-select",{replace:!0})}}).catch(()=>{}),()=>{f=!0}},[t,e]);const p=async()=>{var f,g;if(!n){r(!0),i(null);try{const x=await fetch(`${ku}/v1/trial/claim`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`},body:JSON.stringify({})}),b=await x.json().catch(()=>({}));if(x.ok){e("/onboarding/provisioning",{replace:!0});return}const y=(f=b==null?void 0:b.detail)==null?void 0:f.code;if(y==="no_capacity")i("Free trials are fully booked right now. You can still subscribe below.");else if(y==="not_qualified"){e("/onboarding/plan-select",{replace:!0});return}else i(y==="email_unconfirmed"?"Please verify your email address first, then try again.":((g=b==null?void 0:b.detail)==null?void 0:g.message)??"Could not start your trial. Please try again.")}catch{i("Could not start your trial. Please try again.")}r(!1)}};return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:Lj[o]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:Oj[o]}),wa(c,d)&&s.jsx("p",{className:"text-sm font-medium text-primary",children:wa(c,d)})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.jsxs(_s,{className:"p-6 flex flex-col gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Hg,{className:"h-4 w-4 text-primary"}),s.jsx("span",{className:"text-xs font-medium uppercase tracking-[0.08em] text-primary",children:"Free trial"})]}),s.jsx("h2",{className:"text-lg font-semibold",children:jo(c,d)?`${jo(c,d)}, no card`:"No card required"})]}),s.jsx("ul",{className:"space-y-2 flex-1",children:Mj.map(f=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[s.jsx(ot,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"}),s.jsx("span",{children:f})]},f))}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your workspace shuts down when the trial ends unless you subscribe."}),s.jsx("button",{type:"button",onClick:p,disabled:n,className:"w-full px-4 py-2.5 rounded-lg bg-primary text-primary-foreground text-sm font-semibold transition-opacity disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:n?s.jsxs(s.Fragment,{children:[s.jsx(yt,{className:"h-4 w-4 animate-spin"})," Starting…"]}):s.jsxs(s.Fragment,{children:["Start free trial ",s.jsx(Qt,{className:"h-4 w-4"})]})})]}),s.jsxs(_s,{className:"p-6 flex flex-col gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Subscribe"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Skip the trial"})]}),s.jsx("p",{className:"text-sm text-muted-foreground flex-1",children:"Go straight to a plan and keep your workspace for as long as you need it. Founding rates apply at checkout."}),s.jsx("button",{type:"button",onClick:()=>e("/onboarding/plan-select?trial=skip"),className:"w-full px-4 py-2.5 rounded-lg border border-border text-sm font-semibold hover:bg-muted transition-colors",children:"See plans"})]})]}),a&&s.jsx("p",{className:"text-sm text-center text-destructive",role:"alert",children:a})]})})},_u="https://api.viewlink.dev",Fj=()=>{const e=nt(),{session:t}=be(),[n,r]=h.useState("loading"),[a,i]=h.useState(null),[o,l]=h.useState(!1),[c,u]=h.useState(null);h.useEffect(()=>{if(!t)return;let m=!1;return fetch(`${_u}/v1/signup-survey`,{headers:{Authorization:`Bearer ${t.access_token}`}}).then(p=>p.ok?p.json():null).then(p=>{if(!m){if(!p||p.destination==="waitlist"){i(typeof(p==null?void 0:p.qualified)=="boolean"&&p.qual
63ified&&(p==null?void 0:p.trial_open)!==!1?!0:typeof(p==null?void 0:p.qualified)=="boolean"?!1:null),r("asking");return}if(p.destination==="survey"){e("/onboarding/questions",{replace:!0});return}if(p.destination==="trial_offer"||p.destination==="trial_claim"){e("/onboarding/trial-offer",{replace:!0});return}e("/onboarding/plan-select",{replace:!0})}}).catch(()=>{m||r("asking")}),()=>{m=!0}},[t,e]);const d=async()=>{if(!o){l(!0),u(null);try{const m=await fetch(`${_u}/v1/signup-survey/waitlist`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`},body:JSON.stringify({notify:!0})});if(!m.ok)throw new Error(String(m.status));r("enrolled")}catch{u("We could not save your place. Please try again."),l(!1)}}};return n==="loading"?s.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:M.bg},children:s.jsx(yt,{className:"h-6 w-6 animate-spin",style:{color:M.textMuted}})}):s.jsxs("div",{className:"min-h-screen",style:{background:M.bg,color:M.textPrimary},children:[s.jsx("div",{className:"pointer-events-none fixed inset-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),s.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-0 h-[500px]",style:{background:"radial-gradient(35% 80% at 50% 0%, rgba(83,174,224,0.07), transparent)"}}),s.jsxs("div",{className:"relative z-10 mx-auto flex min-h-screen max-w-[560px] flex-col px-5 py-8",children:[s.jsx("div",{className:"mb-2 flex justify-center",children:s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[120px] w-auto bg-transparent"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"mb-6 text-center text-2xl font-bold",style:{color:M.textPrimary,letterSpacing:"-0.02em"},children:n==="enrolled"?"You're on the list":"Every machine is busy"}),s.jsxs(_t,{children:[n==="asking"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm leading-relaxed",style:{color:M.textPrimary},children:a===!0?"Your answers qualified you for a free trial, but every trial machine is running right now.":"Every server we have is running right now, so we can't set up a new one today."}),s.jsx("p",{className:"mt-3 text-sm leading-relaxed",style:{color:M.textMuted},children:"We can hold your place and email you the moment one frees up, and nothing else changes about your account."}),c&&s.jsx("p",{className:"mt-4 text-[13px]",style:{color:"#F87171"},role:"alert",children:c}),s.jsx("div",{className:"mt-5",children:s.jsx(un,{onClick:d,disabled:o,children:o?"Saving...":"Email me when a spot opens →"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm leading-relaxed",style:{color:M.textPrimary},children:a===!0?"We've saved your place. As soon as a machine frees up we'll email you an invite at the address on your account.":"We've saved your place. As soon as we have capacity again we'll email you at the address on your account."}),s.jsx("p",{className:"mt-3 text-sm leading-relaxed",style:{color:M.textMuted},children:"You don't need to do anything else, and you won't lose your place by closing this page."})]}),s.jsx("div",{className:"mt-5 border-t pt-5",style:{borderColor:M.border},children:s.jsx("p",{className:"text-sm leading-relaxed",style:{color:M.textMuted},children:"This applies to paid plans too. We're not taking new servers on until capacity frees up, so there's nothing to buy your way past."})})]})]})]})]})},ju="https://api.viewlink.dev",zj=e=>{const t="Checkout unavailable. Please try again.";if(typeof e=="string"&&e.trim())return e;if(Array.isArray(e)){const n=e.find(r=>r&&typeof r.msg=="string");return(n==null?void 0:n.msg)||t}if(e&&typeof e=="object"){const n=e.message;if(typeof n=="string"&&n.trim())return n}return t},$j=()=>{var T;const e=nt(),t=sr(),{session:n}=be(),r=(T=t.state)==null?void 0:T.plan_config_id,[a,i]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState(!0),[d,m]=h.useState(!1),[p,f]=h.useState(null);h.useEffect(()=>{$e.capture("onboarding_payment_viewed")},[]),h.useEffect(()=>{if(!r){e("/onboarding/plan-select",{replace:!0});return}(async()=>{const{data:E,error:B}=await Z.from("plan_configs").select("id, plan_slug, display_name, price_usd, max_accounts, vps_ram_gb").eq("id",r).single();B||!E?f("Could not load plan details."):i(E),u(!1)})()},[r,e]),h.useEffect(()=>{if(!(n!=null&&n.access_token))return;let S=!1;return fetch(`${ju}/v1/voucher/me`,{headers:{Authorization:`Bearer ${n.access_token}`}}).then(E=>E.ok?E.json():null).then(E=>{S||l((E==null?void 0:E.voucher)??null)}
63).catch(()=>{}),()=>{S=!0}},[n]);const{trialDays:g,loading:x}=pp(a==null?void 0:a.plan_slug),b=async()=>{if(!(!n||!a)){m(!0),f(null);try{const S=await fetch(`${ju}/v1/billing/checkout`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.access_token}`},body:JSON.stringify({plan_slug:a.plan_slug})}),E=await S.json();if(S.status===401){f("Your session expired. Please sign in again."),m(!1);return}if(!S.ok){f(zj(E==null?void 0:E.detail)),m(!1);return}$e.capture("onboarding_checkout_initiated",{plan:a.plan_slug}),window.location.href=E.checkout_url}catch(S){console.error("Checkout error:",S),f("Network error. Please try again."),m(!1)}}};if(c)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(yt,{className:"animate-spin text-primary",size:32})});if(!a)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx("p",{className:"text-destructive",children:"Plan not found."})});const y=(o==null?void 0:o.discount_amount)??null,j=y!=null&&y>0?`${parseFloat((y/100).toFixed(2))}% off`:null,v=(o==null?void 0:o.lock_duration_months)??null,C=!x&&typeof g=="number"&&g>0;return s.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center px-6 py-12 animate-fade-up",children:s.jsxs("div",{className:"w-full max-w-md 
63space-y-8",children:[s.jsx(ml,{currentStep:2,totalSteps:3}),s.jsxs("div",{className:"text-center space-y-2 mt-8",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:"Complete Payment"}),s.jsx("p",{className:"text-[0.875rem] text-muted-foreground",children:"Review your plan and confirm to proceed."})]}),s.jsxs(_s,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(xs,{size:20,className:"text-primary"})}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[0.875rem] font-semibold text-foreground",children:[a.display_name," Plan"]}),s.jsxs("p",{className:"text-[0.8125rem] text-muted-foreground",children:[a.max_accounts," MT5 Account",(a.max_accounts??0)>1?"s":""," · ",a.vps_ram_gb," GB RAM · Billed monthly"]})]})]}),j?s.jsxs("div",{className:"flex justify-between items-baseline border-t border-border pt-4",children:[s.jsx("span",{className:"text-[0.875rem] text-muted-foreground",children:"Your discount"}),s.jsxs("div",{className:"text-right",children:[s.jsx("span",{className:"text-xl font-bold font-mono text-foreground",children:j}),s.jsxs("div",{className:"text-[0.75rem] text-muted-foreground mt-0.5",children:[v!=null?`For your first ${v} ${v===1?"cycle":"cycles"}. `:"","You'll see your price on the billing page."]})]})]}):s.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 border-t border-border pt-4",children:[s.jsx("span",{className:"text-[0.875rem] text-muted-foreground",children:"Monthly total"}),s.jsx("span",{className:"text-[0.875rem] text-foreground",children:"Shown on the billing page"})]})]}),C?s.jsxs("div",{className:"space-y-2 text-center",children:[s.jsxs("p",{className:"text-[0.9375rem] font-semibold text-foreground",children:["Your ",g,"-day free trial"]}),s.jsx("p",{className:"text-[0.8125rem] text-foreground",children:"You will not be charged today."}),s.jsxs("p",{className:"text-[0.8125rem] text-foreground",children:["We take your card details now so your subscription is ready to go. Nothing is charged until your ",g,"-day trial ends."]}),s.jsx("p",{className:"text-[0.75rem] text-muted-foreground leading-relaxed",children:"Cancel any time before then from your billing page and you will not be charged. Your subscription then renews automatically each cycle until you cancel. Payments and refunds are handled by Dodo Payments, our billing provider. You will see the refund policy at checkout."})]}):s.jsxs("div",{className:"space-y-2 text-center",children:[s.jsx("p",{className:"text-[0.9375rem] font-semibold text-foreground",children:"Your subscription"}),s.jsx("p",{className:"text-[0.75rem] text-muted-foreground leading-relaxed",children:"Your card will be charged today, and renews automatically each cycle until you cancel. Cancel any time from your billing page. Payments and refunds are handled by Dodo Payments, our billing provider. You will see the refund policy at checkout."})]}),p&&s.jsx("p",{className:"text-destructive text-[0.875rem] text-center",children:p}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(re,{variant:"outline",onClick:()=>e("/onboarding/plan-select"),className:"rounded-lg border-[hsl(var(--border-default))] gap-2",disabled:d,children:[s.jsx(bs,{size:15})," Back"]}),s.jsx(re,{onClick:b,disabled:d,className:"flex-1 rounded-lg font-medium gap-2",children:d?s.jsxs(s.Fragment,{children:[s.jsx(yt,{size:16,className:"animate-spin"})," Processing…"]}):s.jsxs(s.Fragment,{children:[C?dp(g):"Continue to checkout"," ",s.jsx(Qt,{size:16})]})})]}),s.jsx("p",{className:"text-[0.75rem] text-muted-foreground text-center -mt-4",children:C?"No charge today. Your exact price is shown on the next page before you enter any card details.":"Your exact price is shown on the next page before you enter any card details."})]})})},Bj="https://api.viewlink.dev",Vj=3e3,Uj=20,Wj=6e4,Nu="We couldn't confirm your payment. No charge may have been made. Please try again, or contact support if you think you were charged.",Yj="We couldn't confirm your payment in time. If you were charged, contact support and we'll sort it out straight away. Don't pay twice.",Hj=()=>{const e=nt(),{session:t}=be(),[n,r]=h.useState("checking"),[a,i]=h.useState(Nu),[o,l]=h.useState(0),c=h.useRef(0),u=h.useRef(Date.now()),d=h.useRef(t);d.current=t;const m=!!t;return h.useEffect(()=>{if(!m)return;let p=!1,f=null;const g=()=>{f&&(clearTimeout(f),f=null)},x=y=>{g(),!p&&(i(y),r("failed"))},b=async()=>{var T;if(p)return;c.current+=1,l(c.current);let y=null,j=null;try{const S=(T=d.current)==null?void 0:T.access_token,E=await fetch(`${Bj}/v1/billing/checkout-verdict`,{headers:{Authorization:`Bearer ${S}`}});if(E.status===401){g(),p||r("sessionExpired");return}if(E.ok){const B=await E.json();y=(B==null?void 0:B.state)??null,j=(B==null?void 0:B.message)??null}}catch{}if(p)return;if(y==="succeeded"){g(),e("/onboarding/provisioning",{replace:!0});return}if(y==="failed"){x(j||Nu);return}const v=c.current>=Uj,C=Date.now()-u.current>=Wj;if(v||C){x(Yj);return}f=setTimeout(b,Vj)};return b(),()=>{p=!0,g()}},[m,e]),n==="failed"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Payment not completed"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:a}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(re,{type:"button",onClick:()=>e("/onboarding/plan-select",{replace:!0}),className:"w-full font-semibold",children:"Try again"}),s.jsx("button",{type:"button",onClick:Jn,className:"text-primary hover:underline font-medium text-sm",children:"Contact support"})]})]})}):n==="sessionExpired"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Your session expired"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Please sign in again. If you were charged, contact support and we'll sort it out straight away — don't pay twice."}),s.jsx("button",{type:"button",onClick:Jn,className:"text-primary hover:underline font-medium text-sm",children:"Contact support"})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center animate-fade-up",children:[s.jsx("img",{src:et,alt:"ViewLink",className:"block h-[60px] w-auto mx-auto mb-6 bg-transparent"}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Confirming your payment"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This only takes a moment. Please don't close this page or pay again."}),s.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6 text-sm text-muted-foreground",children:[s.jsx(yt,{size:15,className:"animate-spin text-primary"}),s.jsx("span",{children:"Checking with your bank…"})]}),!1]})})},hp=h.forwardRef(({className:e,value:t,...n},r)=>s.jsx(mm,{ref:r,className:se("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:s.jsx(jg,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));hp.displayName=mm.displayName;const Xt={surface:"#111111",border:"#1F2937",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"},qj="vl_atfx_setup_dismissed_";function gp(e){return e?`${qj}${e}`:null}function Gj(e){const t=gp(e);if(!t)return!1;try{return window.localStorage.getItem(t)==="1"}catch{return!1}}function Xj(){const{user:e}=be(),[t,n]=h.useState(()=>Gj(e==null?void 0:e.id)),r=()=>{n(!0);const a=gp(e==null?void 0:e.id);if(a)try{window.localStorage.setItem(a,"1")}catch{}};return t?null:s.jsxs("div",{className:"relative mt-6 rounded-xl p-4 text-left lg:p-5",style:{background:Xt.surface,border:`1px solid ${Xt.border}`},children:[s.jsx("button",{onClick:r,"aria-label":"Dismiss",className:"absolute right-3 top-3 flex h-7 w-7 items-center justify-center rounded-lg transition-colors",style:{color:Xt.textMuted},onMouseEnter:a=>a.currentTarget.style.color=Xt.textPrimary,onMouseLeave:a=>a.currentTarget.style.color=Xt.textMuted,children:s.jsx(rr,{size:16})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pr-8",children:[s.jsx(ol,{height:28}),s.jsx("h3",{className:"text-sm font-semibold",style:{color:Xt.textPrimary},children:"Do you have an MT5 account yet?"})]}),s.jsx("p",{className:"mt-3 text-sm leading-relaxed",style:{color:Xt.textMuted},children:"You will need one to connect. ATFX is the one broker we have an affiliate arrangement with."}),s.jsx("div",{className:"mt-3",children:s.jsx(ll,{})}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[s.jsx(cl,{}),s.jsx("button",{onClick:r,className:"text-sm transition-colors",style:{color:Xt.textMuted},onMouseEnter:a=>a.currentTarget.style.color=Xt.textPrimary,onMouseLeave:a=>a.currentTarget.style.color=Xt.textMuted,children:"I already have one"})]})]})}const Kj=1e4,Jj=120,Qj=20*6e4,Zj=new Set(["provisioning_failed"]),eN={provisioning:{label:"Provisioning server…",index:0},installing:{label:"Installing MT5…",index:1},configuring:{label:"Configuring your account…",index:2},active:{label:"Ready ✅",index:3}},tN=["Provisioning server…","Installing MT5…","Configuring your account…","Ready ✅"],Gr=[{Icon:Ma,heading:"Your server is being built",body:"Our competitors ask you to source your own server, set up the softw
63are yourself, and configure everything manually before you can place a single trade. ViewLink handles every step for you. By the time you finish this onboarding, your server is live."},{Icon:Gg,heading:"No code required",body:"Our competitors require you to write out your own trade commands by hand. One mistake and nothing executes. ViewLink generates everything from its own proprietary indicator. No coding knowledge needed."},{Icon:Pa,heading:"Your server, not ours",body:"You get a dedicated server. Your trades never share infrastructure with another trader: no delays, no interference when someone else is trading at the same time."},{Icon:Sm,heading:"Always connected, even when your PC is off",body:"Keeping a local PC running 24/5 costs electricity, risks crashes, and can drop your MT5 connection during a power outage. Your ViewLink server runs in the cloud, so your MT5 stays connected and your open trades keep being managed even when your computer is off."},{Icon:Nm,heading:"Real-time execution",body:"From your click on the TradingView chart to the order landing on MT5, ViewLink processes your trade on managed infrastructure in the cloud. No middleman, no copy-paste, no manual order entry."},{Icon:Xg,heading:"We handle the maintenance",body:"Software updates, server restarts, security renewals, infrastructure monitoring: ViewLink manages all of it silently in the background. You'll never log into a server or run a command."},{Icon:Cm,heading:"Your broker login stays yours",body:"ViewLink never sees or stores your broker password. You log into MT5 once through a secure browser session on your own server, and your credentials never touch our systems. Your account stays entirely under your control."}],nN=()=>{const[e,t]=h.useState(0),[n,r]=h.useState(!0),a=h.useRef(null),i=m=>{m!==e&&(r(!1),setTimeout(()=>{t(m),r(!0)},300))},o=()=>{r(!1),setTimeout(()=>{t(m=>(m+1)%Gr.length),r(!0)},300)};h.useEffect(()=>(a.current=setInterval(o,17e3),()=>{a.current&&clearInterval(a.current)}),[]);const l=m=>{a.current&&clearInterval(a.current),i(m),a.current=setInterval(o,17e3)},c=m=>{const p=(e+m+Gr.length)%Gr.length;l(p)},u=Gr[e],{Icon:d}=u;return s.jsxs("div",{className:"w-full space-y-4",children:[s.jsx("div",{className:"min-h-[220px]",children:s.jsxs("div",{className:"rounded-xl p-6 relative",style:{background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:"3px solid #4A72FF",opacity:n?1:0,transition:"opacity 300ms ease"},children:[s.jsx("div",{className:"absolute top-5 right-5",children:s.jsx(d,{size:28,color:"#4A72FF",strokeWidth:1.5})}),s.jsx("h3",{className:"text-[1.0625rem] pr-10 mb-3 leading-snug",style:{color:"#EAEDF5",fontWeight:700},children:u.heading}),s.jsx("p",{className:"text-[0.875rem]",style:{color:"#8A92A8",lineHeight:1.7},children:u.body})]})}),s.jsxs("div",{className:"flex items-center justify-center gap-3",children:[s.jsx("button",{onClick:()=>c(-1),"aria-label":"Previous card",className:"flex items-center justify-center w-7 h-7 rounded-full transition-colors duration-200 hover:bg-[#1C2030]",style:{color:"#8A92A8"},children:s.jsx(La,{size:18})}),s.jsx("div",{className:"flex items-center justify-center gap-2",children:Gr.map((m,p)=>s.jsx("button",{onClick:()=>l(p),"aria-label":`Go to card ${p+1}`,className:"w-2 h-2 rounded-full transition-colors duration-200",style:{background:p===e?"#4A72FF":"#333A52"}},p))}),s.jsx("button",{onClick:()=>c(1),"aria-label":"Next card",className:"flex items-center justify-center w-7 h-7 rounded-full transition-colors duration-200 hover:bg-[#1C2030]",style:{color:"#8A92A8"},children:s.jsx(Es,{size:18})})]})]})},rN=()=>s.jsx("div",{className:"w-full",children:s.jsxs("div",{className:"rounded-xl p-6 relative",style:{background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:"3px solid #4A72FF"},children:[s.jsx("div",{className:"absolute top-5 right-5",children:s.jsx(qg,{size:28,color:"#4A72FF",strokeWidth:1.5})}),s.jsx("h3",{className:"text-[1.0625rem] pr-10 mb-3 leading-snug",style:{color:"#EAEDF5",fontWeight:700},children:"Have these three ready"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-[0.875rem]",style:{color:"#8A92A8",lineHeight:1.7}
63,children:"Your MT5 account number, your MT5 password, and your trade server. Your broker sent all three when you opened the account."}),s.jsx("p",{className:"text-[0.875rem]",style:{color:"#8A92A8",lineHeight:1.7},children:"This is the login for the MetaTrader 5 terminal, not the one you use on your broker's website. They are different, and the website details will not work."}),s.jsx("p",{className:"text-[0.875rem]",style:{color:"#8A92A8",lineHeight:1.7},children:"If your broker gave you two passwords, you want the trading one. The investor password logs in perfectly and cannot place a trade."})]})]})}),sN=()=>{const e=nt(),{user:t}=be(),[n,r]=h.useState(0),[a,i]=h.useState(!1);h.useState(!1);const[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,m]=h.useState("unknown"),p=h.useRef(null),f=h.useRef(0),g=h.useRef(Date.now()),x=()=>{p.current&&(clearInterval(p.current),p.current=null)},b=async()=>{if(!t)return;f.current+=1;try{const{data:C,error:T}=await Z.from("vps_records").select("status").eq("user_id",t.id).order("provisioned_at",{ascending:!1}).limit(1).maybeSingle();if(T)console.error("Provisioning: vps_records poll failed",T);else if(C!=null&&C.status){if(Zj.has(C.status)){console.error("Provisioning: build failed — status =",C.status),x(),u(!0);return}const S=eN[C.status];if(S&&(r(S.index),C.status==="active")){i(!0),x();return}}}catch(C){console.error("Provisioning: vps_records poll threw",C)}const j=f.current>=Jj,v=Date.now()-g.current>=Qj;(j||v)&&(x(),l(!0))};h.useEffect(()=>{$e.capture("onboarding_provisioning_viewed")},[]),h.useEffect(()=>{if(!t)return;let j=!1;return(async()=>{try{const{data:v,error:C}=await Z.from("subscriptions").select("provider_subscription_id").eq("user_id",t.id).limit(1).maybeSingle();if(j)return;if(C||!v){console.error("Provisioning: subscription context read failed",C);return}m(v.provider_subscription_id?"paid":"card_free")}catch(v){j||console.error("Provisioning: subscription context threw",v)}})(),()=>{j=!0}},[t]),h.useEffect(()=>(x(),b(),p.current=setInterval(b,Kj),()=>{x()}),[t]);const y=a?100:Math.min(20+n*27,90);return c?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-6",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Your server couldn't be set up"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:d==="paid"?s.jsx(s.Fragment,{children:"Your payment went through and your subscription is active — this is a problem on our side, not with your card. We've been alerted and we're on it. Get in touch and we'll sort it out for you; please don't pay again."}):d==="card_free"?s.jsx(s.Fragment,{children:"Nothing has been charged and there's no card on file — your trial is claimed and this is a problem on our side. We've been alerted and we're on it. Get in touch and we'll sort it out for you."}):s.jsx(s.Fragment,{children:"This is a problem on our side, not something you did. We've been alerted and we're on it. Get in touch and we'll sort it out for you."})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(re,{type:"button",onClick:Jn,className:"w-full font-semibold",children:"Contact support"}),s.jsx("button",{type:"button",onClick:()=>e("/dashboard"),className:"text-primary hover:underline font-medium text-sm",children:"Go to dashboard"})]})]})}):o?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-6",children:s.jsxs("div",{className:"text-center max-w-sm",children:[s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"This is taking longer than expected"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Your server is normally ready in 10–15 minutes and we've passed that.",d==="paid"?" Your payment is safe and your server may still be finishing":d==="card_free"?" Nothing has been charged and your server may still be finishing":" Your server may still be finishing"," ","but we can't confirm it from here, so please get in touch and we'll check it for you right away."]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(re,{type:"button",onClick:Jn,className:"w-full font-semibold",children:"Contact support"}),s.jsx("button",{type:"button",onClick:()=>
63e("/dashboard"),className:"text-primary hover:underline font-medium text-sm",children:"Go to dashboard"})]})]})}):s.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center px-6 py-12 animate-fade-up",children:s.jsxs("div",{className:"w-full max-w-md space-y-8 text-center",children:[s.jsx(ml,{currentStep:3,totalSteps:3}),s.jsxs("div",{className:"space-y-2 mt-8",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:a?"Your VPS is ready":"Your VPS is being set up"}),s.jsx("p",{className:"text-[0.875rem] text-muted-foreground",children:a?"You're all set. Continue to your setup guide to finish connecting.":"This usually takes 10–15 minutes. Sit back: we're handling everything."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(hp,{value:y,className:"h-2"}),s.jsx("div",{className:"space-y-2",children:tN.map((j,v)=>{const C=v<n,T=v===n;return v>n?null:s.jsxs("div",{className:"flex items-center justify-center gap-2 text-[0.875rem]",children:[C?s.jsx(ot,{size:15,className:"text-[hsl(var(--success))]"}):T&&!a?s.jsx(yt,{size:15,className:"animate-spin text-primary"}):s.jsx(ot,{size:15,className:"text-[hsl(var(--success))]"}),s.jsx("span",{className:C||a?"text-foreground":"text-muted-foreground",children:j})]},v)})}),!a&&s.jsx("p",{className:"text-[0.8125rem] text-center",style:{color:"#505770"},children:"You don't have to stay on this screen. Your server will keep building. Come back anytime to check progress."}),!a&&s.jsx(Xj,{})]}),!a&&s.jsx(nN,{}),!a&&s.jsx(rN,{}),a&&s.jsxs(re,{onClick:()=>e("/onboarding/phone"),className:"rounded-lg font-medium gap-2 animate-fade-up",children:["Continue ",s.jsx(Qt,{size:16})]}),!1]})})},No=[{code:"ZA",name:"South Africa",dial:"27",sample:"82 123 4567"},{code:"NG",name:"Nigeria",dial:"234",sample:"802 123 4567"},{code:"KE",name:"Kenya",dial:"254",sample:"712 123456"},{code:"GH",name:"Ghana",dial:"233",sample:"24 123 4567"},{code:"ZW",name:"Zimbabwe",dial:"263",sample:"77 123 4567"},{code:"ZM",name:"Zambia",dial:"260",sample:"97 123 4567"},{code:"BW",name:"Botswana",dial:"267",sample:"71 123 456"},{code:"NA",name:"Namibia",dial:"264",sample:"81 123 4567"},{code:"MZ",name:"Mozambique",dial:"258",sample:"82 123 4567"},{code:"TZ",name:"Tanzania",dial:"255",sample:"712 123 456"},{code:"UG",name:"Uganda",dial:"256",sample:"712 345 678"},{code:"EG",name:"Egypt",dial:"20",sample:"100 123 4567"},{code:"MA",name:"Morocco",dial:"212",sample:"650 123456"},{code:"GB",name:"United Kingdom",dial:"44",sample:"7400 123456"},{code:"IE",name:"Ireland",dial:"353",sample:"85 123 4567"},{code:"US",name:"United States",dial:"1",sample:"201 555 0123"},{code:"CA",name:"Canada",dial:"1",sample:"506 234 5678"},{code:"DE",name:"Germany",dial:"49",sample:"151 23456789"},{code:"FR",name:"France",dial:"33",sample:"6 12 34 56 78"},{code:"NL",name:"Netherlands",dial:"31",sample:"6 12345678"},{code:"ES",name:"Spain",dial:"34",sample:"612 34 56 78"},{code:"IT",name:"Italy",dial:"39",sample:"312 345 6789"},{code:"PT",name:"Portugal",dial:"351",sample:"912 345 678"},{code:"PL",name:"Poland",dial:"48",sample:"512 345 678"},{code:"SE",name:"Sweden",dial:"46",sample:"70 123 45 67"},{code:"NO",name:"Norway",dial:"47",sample:"406 12 345"},{code:"DK",name:"Denmark",dial:"45",sample:"32 12 34 56"},{code:"CH",name:"Switzerland",dial:"41",sample:"78 123 45 67"},{code:"TR",name:"Türkiye",dial:"90",sample:"501 234 5678"},{code:"AE",name:"United Arab Emirates",dial:"971",sample:"50 123 4567"},{code:"IN",name:"India",dial:"91",sample:"81234 56789"},{code:"PK",name:"Pakistan",dial:"92",sample:"301 2345678"},{code:"PH",name:"Philippines",dial:"63",sample:"905 123 4567"},{code:"ID",name:"Indonesia",dial:"62",sample:"812 345 678"},{code:"MY",name:"Malaysia",dial:"60",sample:"12 345 6789"},{code:"SG",name:"Singapore",dial:"65",sample:"8123 4567"},{code:"AU",name:"Australia",dial:"61",sample:"412 345 678"},{code:"NZ",name:"New Zealand",dial:"64",sample:"21 123 4567"},{code:"BR",name:"Brazil",dial:"55",sample:"11 96123 4567"},{code:"MX",name:"Mexico",dial:"52",sample:"222 123 4567"},{code:"AR",name:"Argentina",dial:"54",sample:"11 2345 6789"},{code:"CO",name:"Colombia",dial:"57",sample:"321 1234567"}],aN="ZA";function Su(e){return No.find(n=>n.code===(e??"").trim().toUpperCase())??No.find(n=>n.code===aN)}function iN(e,t){const n=(t??"").replace(/\D/g,"");return n?`+${e}${n}`:""}const Eu="https://api.viewlink.dev",oN=()=>{var C;const e=nt(),t=sr(),{session:n,profile:r,refreshProfile:a}=be(),i=Lk((C=t.state)==null?void 0:C.from),[o,l]=h.useState(""),[c,u]=h.useState(""),[d,m]=h.useState(!1),p=h.useRef(!1),f=h.useRef(!1),g=()=>{f.current||(f.current=!0,e(i,{replace:!0}))},x=h.useMemo(()=>({"Content-Type":"application/json",Authorization:`Bearer ${(n==null?void 0:n.access_token)??""}`}),[n]),b=!!((r==null?void 0:r.phone)??"").trim();h.useEffect(()=>{if(r){if(b){g();return}l(T=>T||Su(r.country).code)}},[r,b,e,i]),h.useEffect(()=>{!n||!r||b||p.current||(p.current=!0,Ak(String(r.id)),fetch(`${Eu}/v1/user/phone`,{method:"POST",headers:x,body:JSON.stringify({phone:null})}).catch(()=>{}))},[n,r,b,x]);const y=Su(o),j=iN(y.dial,c),v=async()=>
63{if(!j){g();return}m(!0);try{await fetch(`${Eu}/v1/user/phone`,{method:"POST",headers:x,body:JSON.stringify({phone:j})}),await a()}catch{}g()};return!r||b?null:s.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center px-6 py-12 animate-fade-up",children:s.jsxs("div",{className:"w-full max-w-md space-y-8",children:[s.jsxs("div",{className:"space-y-2 text-center",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:"Before you set up MT5"}),s.jsx("p",{className:"text-[0.875rem] text-muted-foreground",children:"Phone number (optional). We will not spam you. We only use this to reach out if we can see you are stuck."})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{"aria-label":"Country",value:y.code,onChange:T=>l(T.target.value),className:"h-10 shrink-0 rounded-md border border-input bg-background px-3 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:No.map(T=>s.jsxs("option",{value:T.code,children:[T.code," +",T.dial]},`${T.code}-${T.dial}`))}),s.jsx(qe,{type:"tel",inputMode:"tel","aria-label":"Phone number",autoComplete:"tel-national",maxLength:24,placeholder:y.sample,value:c,onChange:T=>u(T.target.value),className:"flex-1"})]}),s.jsx("p",{className:"h-4 text-[0.8125rem] text-muted-foreground","data-testid":"phone-preview",children:j?`We will save this as ${j}`:""})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(re,{type:"button",onClick:v,disabled:d,className:"w-full rounded-lg font-medium gap-2",children:[d?"Saving…":"Continue"," ",s.jsx(Qt,{size:16})]}),s.jsx("button",{type:"button",onClick:g,className:"mx-auto block text-sm font-medium text-muted-foreground hover:text-foreground hover:underline",children:"Skip"})]})]})})};function he(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function bt(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function dt(e,t){const n=he(e);return isNaN(t)?bt(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Pt(e,t){const n=he(e);if(isNaN(t))return bt(e,NaN);if(!t)return n;const r=n.getDate(),a=bt(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const i=a.getDate();return r>=i?a:(n.setFullYear(a.getFullYear(),a.getMonth(),r),n)}const pl=6048e5,lN=864e5,Js=43200,Cu=1440;let cN={};function zr(){return cN}function tn(e,t){var l,c,u,d;const n=zr(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=he(e),i=a.getDay(),o=(i<r?7:0)+i-r;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function er(e){return tn(e,{weekStartsOn:1})}function xp(e){const t=he(e),n=t.getFullYear(),r=bt(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=er(r),i=bt(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=er(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function In(e){const t=he(e);return t.setHours(0,0,0,0),t}function Er(e){const t=he(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Jt(e,t){const n=In(e),r=In(t),a=+n-Er(n),i=+r-Er(r);return Math.round((a-i)/lN)}function uN(e){const t=xp(e),n=bt(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),er(n)}function So(e,t){const n=t*7;return dt(e,n)}function dN(e,t){return Pt(e,t*12)}function mN(e){let t;return e.forEach(function(n){const r=he(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function fN(e){let t;return e.forEach(n=>{const r=he(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function da(e,t){const n=he(e),r=he(t),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function pN(e){return bt(e,Date.now())}function xt(e,t){const n=In(e),r=In(t);return+n==+r}function hl(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}
63function hN(e){if(!hl(e)&&typeof e!="number")return!1;const t=he(e);return!isNaN(Number(t))}function Cr(e,t){const n=he(e),r=he(t),a=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return a*12+i}function gN(e,t,n){const r=tn(e,n),a=tn(t,n),i=+r-Er(r),o=+a-Er(a);return Math.round((i-o)/pl)}function xN(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function yN(e,t){return+he(e)-+he(t)}function gl(e){const t=he(e);return t.setHours(23,59,59,999),t}function qa(e){const t=he(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function bN(e){const t=he(e);return+gl(t)==+qa(t)}function vN(e,t){const n=he(e),r=he(t),a=da(n,r),i=Math.abs(Cr(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*i);let l=da(n,r)===-a;bN(he(e))&&i===1&&da(e,r)===1&&(l=!1),o=a*(i-Number(l))}return o===0?0:o}function wN(e,t,n){const r=yN(e,t)/1e3;return xN(n==null?void 0:n.roundingMethod)(r)}function pt(e){const t=he(e);return t.setDate(1),t.setHours(0,0,0,0),t}function yp(e){const t=he(e),n=bt(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function xl(e,t){var l,c,u,d;const n=zr(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=he(e),i=a.getDay(),o=(i<r?-7:0)+6-(i-r);return a.setDate(a.getDate()+o),a.setHours(23,59,59,999),a}function bp(e){return xl(e,{weekStartsOn:1})}const kN={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},_N=(e,t,n)=>{let r;const a=kN[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function ji(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const jN={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},NN={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SN={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},EN={date:ji({formats:jN,defaultWidth:"full"}),time:ji({formats:NN,defaultWidth:"full"}),dateTime:ji({formats:SN,defaultWidth:"full"})},CN={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},TN=(e,t,n,r)=>CN[e];function Xr(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}
vendor: 11,464 bytes, line 63
63const AN={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},IN={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},DN={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},PN={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},MN={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},LN={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ON=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},RN={ordinalNumber:ON,era:Xr({values:AN,defaultWidth:"wide"}),quarter:Xr({values:IN,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Xr({values:DN,defaultWidth:"wide"}),day:Xr({values:PN,defaultWidth:"wide"}),dayPeriod:Xr({values:MN,defaultWidth:"wide",formattingValues:LN,defaultFormattingWidth:"wide"})};function Kr(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?zN(l,m=>m.test(o)):FN(l,m=>m.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function FN(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function zN(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function $N(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const BN=/^(\d+)(th|st|nd|rd)?/i,VN=/\d+/i,UN={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},WN={any:[/^b/i,/^(a|c)/i]},YN={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},HN={any:[/1/i,/2/i,/3/i,/4/i]},qN={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},GN={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},XN={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},KN={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},JN={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},QN={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZN={ordinalNumber:$N({matchPattern:BN,parsePattern:VN,valueCallback:e=>parseInt(e,10)}),era:Kr({matchPatterns:UN,defaultMatchWidth:"wide",parsePatterns:WN,defaultParseWidth:"any"}),quarter:Kr({matchPatterns:YN,defaultMatchWidth:"wide",parsePatterns:HN,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Kr({matchPatterns:qN,defaultMatchWidth:"wide",parsePatterns:GN,defaultParseWidth:"any"}),day:Kr({matchPatterns:XN,defaultMatchWidth:"wide",parsePatterns:KN,defaultParseWidth:"any"}),dayPeriod:Kr({matchPatterns:JN,defaultMatchWidth:"any",parsePatterns:QN,defaultParseWidth:"any"})},yl={code:"en-US",formatDistance:_N,formatLong:EN,formatRelative:TN,localize:RN,match:ZN,options:{weekStartsOn:0,firstWeekContainsDate:1}};function eS(e){const t=he(e);return Jt(t,yp(t))+1}function vp(e){const t=he(e),n=+er(t)-+uN(t);return Math.round(n/pl)+1}function wp(e,t){var d,m,p,f;const n=he(e),r=n.getFullYear(),a=zr(),i=(t==null?void 0:t.firstWeekContainsDate)??((m=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((f=(p=a.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??1,o=bt(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=tn(o,t),c=bt(e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=tn(c,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function tS(e,t){var l,c,u,d;const n=zr(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=wp(e,t),i=bt(e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),tn(i,t)}function kp(e,t){const n=he(e),r=+tn(n,t)-+tS(n,t);return Math.round(r/pl)+1}function Me(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const jn={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Me(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Me(n+1,2)},d(e,t){return Me(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Me(e.getHours()%12||12,t.length)},H(e,t){return Me(e.getHours(),t.length)},m(e,t){return Me(e.getMinutes(),t.length)},s(e,t){return Me(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return Me(a,t.length)}},fr={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Tu={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return jn.y(e,t)},Y:function(e,t,n,r){const a=wp(e,r),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return Me(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Me(i,t.length)},R:function(e,t){const n=xp(e);return Me(n,t.length)},u:function(e,t){const n=e.getFullYear();return Me(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Me(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Me(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return jn.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Me(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=kp(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Me(a,t.length)},I:function(e,t,n){const r=vp(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Me(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):jn.d(e,t)},D:function(e,t,n){const r=eS(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Me(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Me(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Me(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return Me(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=fr.noon:r===0?a=fr.midnight:a=r/12>
vendor: 4,693 bytes, line 63
63=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=fr.evening:r>=12?a=fr.afternoon:r>=4?a=fr.morning:a=fr.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return jn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):jn.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Me(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Me(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):jn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):jn.s(e,t)},S:function(e,t){return jn.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Iu(r);case"XXXX":case"XX":return Rn(r);case"XXXXX":case"XXX":default:return Rn(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Iu(r);case"xxxx":case"xx":return Rn(r);case"xxxxx":case"xxx":default:return Rn(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(r,":");case"OOOO":default:return"GMT"+Rn(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(r,":");case"zzzz":default:return"GMT"+Rn(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Me(r,t.length)},T:function(e,t,n){const r=e.getTime();return Me(r,t.length)}};function Au(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+Me(i,2)}function Iu(e,t){return e%60===0?(e>0?"-":"+")+Me(Math.abs(e)/60,2):Rn(e,t)}function Rn(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Me(Math.trunc(r/60),2),i=Me(r%60,2);return n+a+t+i}const Du=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},_p=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},nS=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return Du(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",Du(r,t)).replace("{{time}}",_p(a,t))},rS={p:_p,P:nS},sS=/^D+$/,aS=/^Y+$/,iS=["D","DD","YY","YYYY"];function oS(e){return sS.test(e)}function lS(e){return aS.test(e)}function cS(e,t,n){const r=uS(e,t,n);if(console.warn(r),iS.includes(e))throw new RangeError(r)}function uS(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const dS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,mS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,fS=/^'([^]*?)'?$/,pS=/''/g,hS=/[a-zA-Z]/;function Ke(e,t,n){var d,m,p,f,g,x,b,y;const r=zr(),a=(n==null?void 0:n.locale)??r.locale??yl,i=(n==null?void 0:n.firstWeekContainsDate)??((m=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??r.firstWeekContainsDate??((f=(p=r.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((x=(g=n==null?void 0:n.locale)==null?void 0:g.options)==null?void 0:x.weekStartsOn)??r.weekStartsOn??((y=(b=r.locale)==null?void 0:b.options)==null?void 0:y.weekStartsOn)??0,l=he(e);if(!hN(l))throw new RangeError("Invalid time value");let c=t.match(mS).map(j=>{const v=j[0];if(v==="p"||v==="P"){const C=rS[v];return C(j,a.formatLong)}return j}).join("").match(dS).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const v=j[0];if(v==="'")return{isToken:!1,value:gS(j)};if(Tu[v])return{isToken:!0,value:j};
63if(v.match(hS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");return{isToken:!1,value:j}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(j=>{if(!j.isToken)return j.value;const v=j.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&lS(v)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&oS(v))&&cS(v,t,String(e));const C=Tu[v[0]];return C(l,v,a.localize,u)}).join("")}function gS(e){const t=e.match(fS);return t?t[1].replace(pS,"'"):e}function xS(e,t,n){const r=zr(),a=(n==null?void 0:n.locale)??r.locale??yl,i=2520,o=da(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let c,u;o>0?(c=he(t),u=he(e)):(c=he(e),u=he(t));const d=wN(u,c),m=(Er(u)-Er(c))/1e3,p=Math.round((d-m)/60);let f;if(p<2)return n!=null&&n.includeSeconds?d<5?a.formatDistance("lessThanXSeconds",5,l):d<10?a.formatDistance("lessThanXSeconds",10,l):d<20?a.formatDistance("lessThanXSeconds",20,l):d<40?a.formatDistance("halfAMinute",0,l):d<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):p===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",p,l);if(p<45)return a.formatDistance("xMinutes",p,l);if(p<90)return a.formatDistance("aboutXHours",1,l);if(p<Cu){const g=Math.round(p/60);return a.formatDistance("aboutXHours",g,l)}else{if(p<i)return a.formatDistance("xDays",1,l);if(p<Js){const g=Math.round(p/Cu);return a.formatDistance("xDays",g,l)}else if(p<Js*2)return f=Math.round(p/Js),a.formatDistance("aboutXMonths",f,l)}if(f=vN(u,c),f<12){const g=Math.round(p/Js);return a.formatDistance("xMonths",g,l)}else{const g=f%12,x=Math.trunc(f/12);return g<3?a.formatDistance("aboutXYears",x,l):g<9?a.formatDistance("overXYears",x,l):a.formatDistance("almostXYears",x+1,l)}}function jp(e,t){return xS(e,pN(e),t)}function yS(e){const t=he(e),n=t.getFullYear(),r=t.getMonth(),a=bt(e,0);return a.setFullYear(n,r+1,0),a.setHours(0,0,0,0),a.getDate()}function bS(e){return Math.trunc(+he(e)/1e3)}function vS(e){const t=he(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function wS(e,t){return gN(vS(e),pt(e),t)+1}function Eo(e,t){const n=he(e),r=he(t);return n.getTime()>r.getTime()}function Np(e,t){const n=he(e),r=he(t);return+n<+r}function bl(e,t){const n=he(e),r=he(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function kS(e,t){const n=he(e),r=he(t);return n.getFullYear()===r.getFullYear()}function Wn(e,t){return dt(e,-t)}function Ni(e,t){const n=he(e),r=n.getFullYear(),a=n.getDate(),i=bt(e,0);i.setFullYear(r,t,15),i.setHours(0,0,0,0);const o=yS(i);return n.setMonth(t,Math.min(a,o)),n}function Pu(e,t){const n=he(e);return isNaN(+n)?bt(e,NaN):(n.setFullYear(t),n)}function _S(e,t){return Pt(e,-t)}function jS(){var u;const{user:e}=be(),[t,n]=h.useState({tradesToday:null,successRate:null,activeSince:null,plan:null}),[r,a]=h.useState(!0),[i,o]=h.useState(!1),l=async()=>{if(e){o(!1),a(!0);try{const{data:d}=await Z.from("license_keys").select("license_key, created_at, plan_config_id").eq("user_id",e.id).limit(1).maybeSingle();if(!d){n({tradesToday:0,successRate:null,activeSince:null,plan:null}),a(!1);return}const m=d.license_key;let p=null;if(d.plan_config_id){const{data:C}=await Z.from("plan_configs").select("display_name").eq("id",d.plan_config_id).single();p=(C==null?void 0:C.display_name)??null}const f=new Date;f.setHours(0,0,0,0);const{count:g}=await Z.from("trade_events").select("id",{count:"exact",head:!0}).eq("license_key",m).eq("event_type","EXECUTED").gte("timestamp",f.toISOString()),x=new Date;x.setDate(x.getDate()-30);const{count:b}=await Z.from("trade_events").select("id",{count:"exact",head:!0}).eq("license_key",m).eq("event_type","EXECUTED").gte("timestamp",x.toISOString()),{count:y}=await Z.from("trade_events").select("id",{count:"exact",head:!0}).eq("license_key",m).eq("event_type","EXECUTION_FAILED").gte("timestamp",x.toISOString()),j=(b??0)+(y??0),v=j>0?Math.round((b??0)/j*100):null;n({tradesToday:g??0,successRate:v,activeSince:d.created_at?Ke(new Date(d.created_at),"dd MMM yyyy"):null,plan:p})}catch{o(!0)}a(!1)}};h.useEffect(()=>{l()},[e]);const c=[{label:"Trades Today",value:((u=t.tradesToday)==null?void 0:u.toString())??"—",icon:gs},{label:"Success Rate",value:t.successRate!==null?`${t.successRate}%`:"—",icon:Kg},{label:"Active Since",value:t.activeSince??"—",icon:jm},{label:"Plan",value:t.plan??"—",icon:xs}];return i?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load stats."}),s.jsx("button",{onClick:l,className:"mt-2 text-xs text-primary hover:underline",children:"Retry"})]}):s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:c.map((d,m)=>s.jsx("div",{className:"stat-card-glow rounded-lg p-6 animate-fade-up",style:{animationDelay:`${m*60}ms`,animationFillMode:"backwards"},children:r?s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ee,{className:"h-4 w-24"}),s.jsx(Ee,{className:"h-7 w-16"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-widest text-muted-foreground",children:d.label}),s.jsx(d.icon,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsx("p",{className:"text-2xl font-semibold tracking-tight text-foreground font-mono",children:d.value})]})},d.label))})}function NS(){var e;return((e=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(t=>t.type==="timeZoneName"))==null?void 0:e.value)??""}function Tr(e,t){const n=NS();return`${Ke(new Date(e),t)}${n?` ${n}`:""}`}const SS=["ACCOUNT_DISCONNECTED","ACCOUNT_RECONNECTED","ACCOUNT_AUTH_FAILED","ACCOUNT_CREDENTIALS_WIPED","WATCHDOG_HALT","WATCH
63DOG_SIGKILL"],Sp=`(${SS.join(",")})`,ES={EXECUTED:100,EXECUTION_FAILED:100,EXPIRED:90,RATE_LIMIT_EXCEEDED:90,IDEMPOTENCY_DUPLICATE:80,LICENSE_INVALID:80,SPREAD_TOO_HIGH:70,QUEUED:50,EA_POLLED:45,CLAMP_APPLIED:20,PIP_CONVERSION_MARKET:20,MANUAL_TRIGGER:10,WEBHOOK_RECEIVED:10,LICENSE_VALID:5,IDEMPOTENCY_OK:5};function Mu(e){return ES[e]??1}function pr(e){return e?new Date(e).getTime():0}function dn(e,t){if(e&&typeof e=="object"&&!Array.isArray(e)){const n=e[t];return n!=null?String(n):void 0}}function Ep(e){const t=new Map;for(const r of e){if(r.alert_id==null)continue;const a=t.get(r.alert_id);a?a.push(r):t.set(r.alert_id,[r])}const n=[];for(const[r,a]of t){a.sort((u,d)=>pr(u.timestamp)-pr(d.timestamp));let i=a[0];for(const u of a){const d=Mu(u.event_type),m=Mu(i.event_type);(d>m||d===m&&pr(u.timestamp)>=pr(i.timestamp))&&(i=u)}let o,l,c;for(const u of a)o=o??dn(u.detail,"symbol"),l=l??dn(u.detail,"direction"),c===void 0&&u.account_id!=null&&(c=u.account_id);n.push({alertId:r,events:a,status:i.event_type,headlineEvent:i,firstTimestamp:a[0].timestamp,lastTimestamp:a[a.length-1].timestamp,symbol:o,direction:l,accountId:c})}return n.sort((r,a)=>pr(a.firstTimestamp)-pr(r.firstTimestamp)),n}const CS={PIP_STOP_CANNOT_RESOLVE:"Couldn't calculate the pip-distance stop. Try setting an absolute price instead.",NO_SL_FOR_PERCENT_SIZING:"Risk-based sizing needs a stop loss to calculate lot size.",NO_SIZING_VALUE:"No sizing value provided for the selected method.",AMBIGUOUS_SIZING:"Multiple sizing values provided. Set only one.",NO_SYMBOL_MAPPING:"We couldn't find this symbol on your broker. Contact support to request it.",AMBIGUOUS_SYMBOL:"Multiple matching symbols on your broker. Contact support to resolve.",SYMBOL_CATALOGUE_NOT_SYNCED:"Your broker symbols haven't synced yet. Try again in a moment.",SYMBOL_CATALOGUE_STALE:"Your broker symbol list is out of date. Restarting your VPS should refresh it."},Na="Trade couldn't be executed. Contact support if this persists.";function TS(e){return e?CS[e]??Na:Na}const AS={"-1":"This trade never reached MetaTrader. Your EA looks disconnected, or the instruction expired before it could run. Check that your VPS is online and connected to your broker.",1001:"The instruction expired before it reached your broker. Try again.",1002:"Spread was too high at the moment of execution, so the trade was skipped.",1003:"The market is closed for this symbol right now.",1004:"Your broker refused this trade for margin. That usually means an open position is already using it — check what you have running before you assume the account is short.",1005:"This trade was not placed. The lot size worked out below your broker's minimum, and ViewLink does not round up because that would risk more than you asked for.",1006:"Not enough margin to open this trade.",1007:"Price moved beyond your slippage tolerance before the order could fill.",1008:"The position to modify or close could not be found.",1009:"This trade was not placed. Your stop loss or take profit was not valid for this order, either because it sits on the wrong side of your entry price or because it is closer to price than your broker's minimum distance allows.",1010:"The pending order price is invalid for your broker.",1011:"ViewLink couldn't get a live price for this symbol in time. Confirm it's tradeable on your broker and try again."};function Cp(e){const t=dn(e,"error");if(t)return TS(t);const n=dn(e,"error_code");return n&&n!=="0"?AS[n]??Na:Na}const Lu={EXECUTED:{cls:"text-success bg-success/10",glow:"0 0 6px rgba(34,197,94,0.35)"},EXECUTION_FAILED:{cls:"text-destructive bg-destructive/10",glow:"0 0 6px rgba(239,68,68,0.35)"},QUEUED:{cls:"text-primary bg-primary/10",glow:"0 0 6px rgba(83,174,224,0.35)"},EA_POLLED:{cls:"text-info bg-info/10",glow:"0 0 6px rgba(56,189,248,0.3)"},EXPIRED:{cls:"text-warning bg-warning/10",glow:"0 0 6px rgba(245,158,11,0.35)"},SPREAD_TOO_HIGH:{cls:"text-destructive bg-destructive/10",glow:"0 0 6px rgba(239,68,68,0.35)"},RATE_LIMIT_EXCEEDED:{cls:"text-destructive bg-destructive/10",glow:"0 0 6px rgba(239,68,68,0.35)"},IDEMPOTENCY_DUPLICATE:{cls:"text-warning bg-warning/10",glow:"0 0 6px rgba(245,158,11,0.35)"},WEBHOOK_RECEIVED:{cls:"text-info bg-info/10",glow:"0 0 6px rgba(56,189,248,0.3)"}
63,MANUAL_TRIGGER:{cls:"text-info bg-info/10",glow:"0 0 6px rgba(56,189,248,0.3)"},IDEMPOTENCY_OK:{cls:"text-neutral bg-neutral/10",glow:""},LICENSE_VALID:{cls:"text-success bg-success/10",glow:"0 0 6px rgba(34,197,94,0.35)"},LICENSE_INVALID:{cls:"text-destructive bg-destructive/10",glow:"0 0 6px rgba(239,68,68,0.35)"}},Ou={cls:"text-neutral bg-neutral/10",glow:""},IS=10,DS=200;function PS(){const{user:e}=be(),[t,n]=h.useState([]),[r,a]=h.useState(!0),[i,o]=h.useState(!1),[l,c]=h.useState(null),u=async()=>{if(!e)return;o(!1),a(!0);const{data:d}=await Z.from("license_keys").select("license_key").eq("user_id",e.id).limit(1).maybeSingle();if(!d){n([]),a(!1);return}const{data:m,error:p}=await Z.from("trade_events").select("id, timestamp, alert_id, event_type, detail, account_id").eq("license_key",d.license_key).not("event_type","in",Sp).order("timestamp",{ascending:!1}).limit(DS);if(p)o(!0);else{const f=Ep(m??[]);n(f.slice(0,IS))}a(!1)};return h.useEffect(()=>{u()},[e]),i?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load activity."}),s.jsx("button",{onClick:u,className:"mt-2 text-xs text-primary hover:underline",children:"Retry"})]}):s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Recent Activity"}),s.jsx(Ie,{to:"/trade-log",className:"text-xs text-primary hover:underline",children:"View full log →"})]}),s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_1fr] gap-2 px-4 py-2 bg-muted text-xs font-medium uppercase tracking-widest text-muted-foreground border-b border-border-default",children:[s.jsx("span",{}),s.jsx("span",{children:"Time"}),s.jsx("span",{children:"Alert ID"}),s.jsx("span",{children:"Symbol"}),s.jsx("span",{children:"Dir"}),s.jsx("span",{children:"Status"})]}),r?s.jsx("div",{className:"space-y-0",children:Array.from({length:5}).map((d,m)=>s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_1fr] gap-2 px-4 py-3 border-b border-border",children:[s.jsx(Ee,{className:"h-4 w-4"}),s.jsx(Ee,{className:"h-4 w-20"}),s.jsx(Ee,{className:"h-4 w-24"}),s.jsx(Ee,{className:"h-4 w-16"}),s.jsx(Ee,{className:"h-4 w-10"}),s.jsx(Ee,{className:"h-4 w-20"})]},m))}):t.length===0?s.jsx("div",{className:"px-4 py-12 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No trades yet. Trigger a signal from the ViewLink extension on your TradingView chart to get started."})}):t.map(d=>{const m=l===d.alertId,p=d.symbol??"—",f=d.direction,{cls:g,glow:x}=Lu[d.status]??Ou,b=d.status==="EXECUTION_FAILED";return s.jsxs("div",{children:[s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_1fr] gap-2 px-4 py-3 border-b border-border hover:bg-muted/50 cursor-pointer transition-colors duration-100",onClick:()=>c(m?null:d.alertId),children:[s.jsx("span",{className:"flex items-center",children:m?s.jsx(nn,{className:"h-3.5 w-3.5 text-muted-foreground"}):s.jsx(Es,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-xs text-muted-foreground truncate",title:d.firstTimestamp?Tr(d.firstTimestamp,"dd MMM yyyy HH:mm:ss"):void 0,children:d.firstTimestamp?jp(new Date(d.firstTimestamp),{addSuffix:!0}):"—"}),s.jsxs("span",{className:"text-xs font-mono text-foreground truncate",title:d.alertId,children:[d.alertId.slice(0,12),"…"]}),s.jsx("span",{className:"text-xs text-foreground",children:p}),s.jsx("span",{children:f?s.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-widest ${f==="BUY"?"text-success bg-success/10":"text-destructive bg-destructive/10"}`,children:f}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),s.jsx("span",{children:s.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-widest ${g}
63`,style:x?{boxShadow:x}:void 0,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${g.split(" ")[0].replace("text-","bg-")}`}),d.status.replace(/_/g," ")]})})]}),m&&s.jsxs("div",{className:"px-6 py-4 border-b border-border bg-muted/30 border-l-2 border-l-primary space-y-3",children:[b&&s.jsx("p",{className:"text-xs text-destructive",children:Cp(d.headlineEvent.detail)}),s.jsx("ol",{className:"space-y-1.5",children:d.events.map(y=>{const j=Lu[y.event_type]??Ou;return s.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded-full font-semibold uppercase tracking-widest ${j.cls}`,children:y.event_type.replace(/_/g," ")}),s.jsx("span",{className:"text-muted-foreground font-mono",children:y.timestamp?Tr(y.timestamp,"HH:mm:ss"):"—"}),dn(y.detail,"executed_price")&&s.jsxs("span",{className:"text-muted-foreground",children:["@ ",dn(y.detail,"executed_price"),dn(y.detail,"lot_size")?` · ${dn(y.detail,"lot_size")} lots`:""]})]},y.id)})})]})]},d.alertId)})]})}function MS(){const{user:e}=be(),[t,n]=h.useState(null),[r,a]=h.useState(null),[i,o]=h.useState(!0),[l,c]=h.useState(!1),u=async()=>{if(!e)return;c(!1),o(!0);const{data:d,error:m}=await Z.from("mt5_accounts").select("risk_percent, broker_company").eq("user_id",e.id).eq("is_active",!0).order("sort_order",{ascending:!0}).limit(1).maybeSingle();if(m){c(!0),o(!1);return}a((d==null?void 0:d.risk_percent)!==null&&(d==null?void 0:d.risk_percent)!==void 0?Number(d.risk_percent):null),n(typeof(d==null?void 0:d.broker_company)=="string"&&d.broker_company.trim()?d.broker_company.trim():null),o(!1)};return h.useEffect(()=>{u()},[e]),l?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-6",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings."}),s.jsx("button",{onClick:u,className:"mt-2 text-xs text-primary hover:underline",children:"Retry"})]}):s.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Quick Settings"}),s.jsxs(Ie,{to:"/settings",className:"flex items-center gap-1.5 text-xs text-primary hover:underline",children:[s.jsx(_m,{className:"h-3.5 w-3.5"}),"Edit Settings"]})]}),i?s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ee,{className:"h-4 w-32"}),s.jsx(Ee,{className:"h-4 w-24"})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Broker"}),s.jsx("span",{className:t?"text-foreground font-medium":"text-muted-foreground",children:t??"Not connected"})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Risk %"}),s.jsx("span",{className:"text-foreground font-mono font-medium",children:r!==null?`${r}%`:"—"})]})]})]})}const LS=1e4,OS={active:{label:"Active",className:"text-primary bg-primary/10",dotClass:"bg-primary animate-pulse-connected"},provisioning:{label:"Provisioning",className:"text-warning bg-warning/10",dotClass:"bg-warning animate-pulse-connected"},installing:{label:"Installing",className:"text-warning bg-warning/10",dotClass:"bg-warning animate-pulse-connected"},configuring:{label:"Configuring",className:"text-warning bg-warning/10",dotClass:"bg-warning animate-pulse-connected"},suspended:{label:"Suspended",className:"text-destructive bg-destructive/10",dotClass:"bg-destructive"}};function RS(){const{user:e}=be(),[t,n]=h.useState(null),[r,a]=h.useState(!0),[i,o]=h.useState(!1),l=h.useRef(null),c=async()=>{var p;if(!e)return;o(!1);const{data:d,error:m}=await Z.from("vps_records").select("status").eq("user_id",e.id).limit(1).maybeSingle();m?o(!0):n(((p=d==null?void 0:d.status)==null?void 0:p.toLowerCase())??null),a(!1)};if(h.useEffect(()=>(c(),l.current=setInterval(c,LS),()=>{l.current&&clearInterval(l.current)}),[e]),i)return s.jsxs("div",{className:"rounded-lg border border-border bg-card p-6",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load VPS status."}),s.jsx("button",{onClick:c,className:"mt-2 text-xs text-primary hover:underline",children:"Retry"})]});const u=OS[t??""]??{label:"No VPS",className:"text-neutral-400 bg-neutral-400/10",dotClass:"bg-neutral-400"};return s.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"VPS 
63Status"})]}),r?s.jsx(Ee,{className:"h-6 w-20"}):s.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold uppercase tracking-widest ${u.className}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${u.dotClass}`}),u.label]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["To connect to MT5, use the"," ",s.jsx("span",{className:"text-amber-400 font-medium",children:"Connect to MT5"})," ","button in the status bar above."]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Having VPS issues?"," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"Contact support"})]})]})}function FS(e,t,n){return e>=1?"trading":t!=null?"connected_never_traded":n!=null?"provisioned_never_connected":"not_provisioned"}function Tp(){const{user:e}=be(),{primary:t}=Jf(),[n,r]=h.useState("not_provisioned"),[a,i]=h.useState(!0),[o,l]=h.useState(null),[c,u]=h.useState(0),[d,m]=h.useState(null),[p,f]=h.useState(null),[g,x]=h.useState(0),b=h.useRef(null),y=h.useCallback(()=>x(v=>v+1),[]);return h.useEffect(()=>{if(!e){b.current=null,r("not_provisioned"),l(null),u(0),m(null),f(null),i(!1);return}let v=!1;return b.current!==e.id&&i(!0),(async()=>{const{data:T}=await Z.from("license_keys").select("license_key").eq("user_id",e.id).eq("is_active",!0).limit(1).maybeSingle(),S=(T==null?void 0:T.license_key)??null,{data:E}=await Z.from("vps_records").select("provisioned_at").eq("user_id",e.id).limit(1).maybeSingle(),B=(E==null?void 0:E.provisioned_at)??null;let P=null;try{const{data:L,error:_}=await Z.from("mt5_accounts").select("broker_first_connected_at").eq("user_id",e.id).eq("is_active",!0).order("sort_order",{ascending:!0}).limit(1).maybeSingle();if(_)throw _;P=(L==null?void 0:L.broker_first_connected_at)??null}catch{P=null}let N=0;if(S){const{count:L}=await Z.from("trade_events").select("id",{count:"exact",head:!0}).eq("license_key",S).eq("event_type","EXECUTED");N=L??0}v||(l(S),m(B),f(P),u(N),r(FS(N,P,B)),b.current=e.id,i(!1))})(),()=>{v=!0}},[e,g]),{stage:n==="connected_never_traded"&&t==="syncing"?"provisioned_never_connected":n,loading:a,licenseKey:o,executedCount:c,provisionedAt:d,brokerFirstConnectedAt:p,refetch:y}}const Si=({checked:e,animate:t,label:n})=>s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",style:{background:e?"#22C55E":"transparent",border:e?"none":"2px solid #333A52",transition:t?"background 150ms ease, transform 150ms ease":void 0,transform:e&&t?"scale(1)":void 0,animation:e&&t?"check-pop 150ms ease both":void 0},children:e&&s.jsx(ot,{size:16,color:"#fff",strokeWidth:2.5})}),s.jsx("span",{className:"text-[0.9375rem]",style:{color:e?"#EAEDF5":"#8A92A8"},children:n})]}),zS=()=>{const{profile:e}=be(),{stage:t,loading:n,refetch:r}=Tp(),a=h.useRef(null);if(h.useEffect(()=>{if(t==="trading"){a.current&&(clearInterval(a.current),a.current=null);return}return a.current||(a.current=setInterval(r,1e4)),()=>{a.current&&(clearInterval(a.current),a.current=null)}},[t,r]),!e||!e.onboarding_complete||n||t==="trading")return null;const i=t!=="not_provisioned",o=t==="connected_never_traded";return s.jsxs("div",{className:"rounded-xl p-6 space-y-5",style:{background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:"3px solid #4A72FF"},children:[s.jsx("h2",{className:"text-[1rem] font-semibold",style:{color:"#EAEDF5"},children:"Getting started"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(Si,{checked:i,animate:!1,label:"Server provisioned"}),s.jsx(Si,{checked:o,animate:!1,label:"Connection tested"}),s.jsx(Si,{checked:!1,animate:!0,label:"First trade executed"})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",style:{borderTop:"1px solid #252A38"},children:[s.jsx(Bo,{size:18,color:"#53AEE0",strokeWidth:2,className:"flex-shrink-0"}),s.jsxs("span",{className:"text-[0.875rem]",style:{color:"#8A92A8"},children:["Haven't placed a trade yet?"," ",s.jsx(Ie,{to:"/setup-guide",className:"font-medium hover:underline",style:{color:"#53AEE0"},children:"Follow the setup guide"})]})]})]})};function Ap(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const r={weekday:"short",day:"numeric",month:"short",...t?{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}:{}},a={};try{for(const i of new Intl.DateTimeFormat("en-US",r).formatToParts(n))a[i.type]=i.value}catch{return null}return!a.weekday||!a.day||!a.month||t&&(!a.hour||!a.minute)?null:{weekday:a.weekday,day:a.day,month:a.month,hour:a.hour??"",minute:a.minute??""}}function $S(e){if(!e)return null;const t=Ap(e,!0);return t?`${t.weekday} ${t.day} ${t.month}, ${t.hour}:${t.minute}`:null}function Ip(e){if(!e)return null;const t=Ap(e,!1);return t?`${t.weekday} ${t.day} ${t.month}`:null}
63function Dp(e,t=Date.now()){if(!e)return!1;const n=new Date(e).getTime();return Number.isNaN(n)?!0:n<=t}const BS="Two steps to your first trade from the chart.",VS="Connect your broker, then send one order to see it work. Do both by ",US=" and your trial becomes 14 days. Weekends don't count against the clock.",WS="One step to your first trade from the chart.",YS="Send a single order and watch it reach MT5. Do it by ",HS=" and your trial becomes 14 days. Weekends don't count against the clock.",qS="That's it working.",GS="Your order went from the chart to MT5. Your trial now runs to ",XS="Your broker rejected that order. The bridge still did its job: the instruction reached MT5 and came back. Your trial now runs to ",KS=". Nothing to pay and nothing to click.",Ru=e=>({background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:`3px solid ${e}`}),Fu=({children:e})=>s.jsx("h2",{className:"text-[1rem] font-semibold",style:{color:"#EAEDF5"},children:e}),zu=({children:e})=>s.jsx("p",{className:"text-[0.9375rem] leading-relaxed",style:{color:"#8A92A8"},children:e}),$u=({children:e})=>s.jsx("span",{style:{color:"#C9D1E4",fontWeight:600},children:e}),JS=({iso:e})=>{const t=h.useMemo(()=>{if(!e)return null;const r=new Date(e);return Number.isNaN(r.getTime())?null:r},[e]),n=Ha(t);return n?s.jsxs("span",{style:{color:"#8A92A8"},children:[" — ",cp(n)," left"]}):null},Pp=({state:e,status:t})=>{if(!e)return null;if(e==="granted_filled"||e==="granted_rejected"){const a=Ip((t==null?void 0:t.new_trial_end)??null);return a?s.jsxs("div",{className:"rounded-xl p-6 space-y-4",style:Ru("#22C55E"),children:[s.jsx(Fu,{children:qS}),s.jsxs(zu,{children:[e==="granted_rejected"?XS:GS,s.jsx($u,{children:a}),KS]})]}):null}const n=$S((t==null?void 0:t.window_deadline)??null);if(!n)return null;const r=e==="connect_broker";return s.jsxs("div",{className:"rounded-xl p-6 space-y-4",style:Ru("#4A72FF"),children:[s.jsx(Fu,{children:r?BS:WS}),s.jsxs(zu,{children:[r?VS:YS,s.jsx($u,{children:n}),s.jsx(JS,{iso:t==null?void 0:t.window_deadline}),r?US:HS]})]})},Ei="https://api.viewlink.dev",QS="viewlink_survey_done_",Ci=e=>`${QS}${e}`,ZS=["TikTok","Instagram","YouTube","X (Twitter)","Forex forum","Friend or word of mouth","Other"],eE=[{label:"Under 1 year",value:"0-1"},{label:"2–3 years",value:"2-3"},{label:"3–5 years",value:"3-5"},{label:"5+ years",value:"5+"}],Bu=e=>`flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-sm font-medium border transition-colors ${e?"bg-primary border-primary text-primary-foreground":"bg-transparent border-border text-muted-foreground hover:text-foreground"}`;function tE(){const{user:e,session:t}=be(),[n,r]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState(!1),[d,m]=h.useState(!1);h.useEffect(()=>{if(!e)return;let b=!1;return(async()=>{try{const j=await fetch(`${Ei}/v1/signup-survey`,{headers:{Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`}});if(j.ok){const v=await j.json();b||m(!!(v!=null&&v.enabled))}}catch{}try{if(localStorage.getItem(Ci(e.id))==="1")return}catch{}try{const j=await fetch(`${Ei}/v1/user/survey`,{headers:{Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`}});if(j.ok){const v=await j.json();if(v!=null&&v.completed){try{localStorage.setItem(Ci(e.id),"1")}catch{}return}}}catch{}b||r(!0)})(),()=>{b=!0}},[e,t]);const p=()=>{if(e)try{localStorage.setItem(Ci(e.id),"1")}catch{}},f=()=>{p(),r(!1)},g=d?!!o:!!a,x=async()=>{if(!(!g||!e)){u(!0);try{await fetch(`${Ei}/v1/user/survey`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`},body:JSON.stringify({referral_source:d?null:a,trading_experience_years:o})})}catch{}p(),u(!1),r(!1)}};return s.jsx(pn,{open:n,onOpenChange:b=>{b||f()},children:s.jsxs(en,{className:"sm:max-w-md",children:[s.jsxs(It,{children:[s.jsx(Dt,{children:"One quick question"}),s.jsx(Bt,{children:"Takes 5 seconds and helps us build the right things next."})]}),s.jsxs("div",{className:"space-y-5 py-2",children:[!d&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"How did you hear about ViewLink?"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ZS.map(b=>{const y=a===b;return s.jsxs("button",{type:"button",onClick:()=>i(b),className:Bu(y),children:[b,y&&s.jsx(ot,{size:13,strokeWidth:2.5})]},b)})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"How long have you been trading?"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:eE.map(({label:b,value:y})=>{const j=o===y;return s.jsxs("button",{type:"button",onClick:()=>l(y),className:Bu(j),children:[b,j&&s.jsx(ot,{size:13,strokeWidth:2.5})]},y)})})]})]}),s.jsxs(hn,{className:"flex-row justify-end gap-2 sm:gap-2",children:[s.jsx("button",{type:"button",onClick:f,className:"px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Maybe later"}),s.jsx("button",{type:"button",onClick:x,disabled:!g||c,className:"px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold transition-opacity disabled:opacity-40 disabled:cursor-not-allowed",children:c?"Saving…":"Submit"})]})]})})}const nE="https://api.viewlink.dev",rE=5;function sE(){const{user:e,session:t}=be(),{licenseKey:n,executedCount:r,loading:a}=Tp(),[i,o]=h.useState(null),[l,c]=h.useState(!1),[u,d]=h.useState("ask"),[m,p]=h.useState(0),[f,g]=h.useState(""),[x,b]=h.useState(""),[y,j]=h.useState(""),[v,C]=h.useState(""),[T,S]=h.useState(!1);h.useEffect(()=>{if(!e||a)return;let _=!1;return(async()=>{const{data:A}=await Z.from("user_review_state").select("status, snooze_until, snooze_at_trade_count").eq("user_id",e.id).limit(1).maybeSingle();if(_)return;const V=A==null?void 0:A.status;if(V==="submitted"||V==="declined"){o(!1);return}if(!n){o(!1);return}const J=r;if(J<rE){o(!1);return}const{data:O}=await Z.from("trade_events").select("event_type").eq("license_key",n).in("event_type",["EXECUTED","EXECUTION_FAILED"]).order("timestamp",{ascending:!1}).limit(1).maybeSingle();if(!_){if((O==null?void 0:O.event_type)==="EXECUTION_FAILED"){o(!1);return}if(V==="snoozed"){const z=A!=null&&A.snooze_until?new Date(A.snooze_until):null,F=z?z.getTime()>Date.now():!1,k=(A==null?void 0:A.snooze_at_trade_count)??0;if(F||J<=k){o(!1);return}}o(!0),c(!0)}})(),()=>{_=!0}},[e,a,n,r]);const E=async _=>fetch(`${nE}/v1/review/action`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(t==null?void 0:t.access_token)??""}`},body:JSON.stringify(_)}),B=async()=>{c(!1);try{await E({action:"snooze"})}catch{}},P=async()=>{c(!1);try{await E({action:"decline"})}catch{}},N=async()=>{c(!1);try{await E({action:"snooze",reason:"negative"})}catch{}Jn()},L=async()=>
63{if(!(m<1||m>5||!f.trim())){S(!0);try{if(!(await E({action:"submit",rating:m,quote:f.trim(),name:x.trim(),location:y.trim(),role:v.trim()})).ok){S(!1);return}}catch{S(!1);return}S(!1),c(!1)}};return i!==!0?null:s.jsx(pn,{open:l,onOpenChange:_=>{_||c(!1)},children:s.jsxs(en,{className:"sm:max-w-md",children:[u==="ask"&&s.jsxs(s.Fragment,{children:[s.jsxs(It,{children:[s.jsx(Dt,{children:"Enjoying ViewLink?"}),s.jsx(Bt,{children:"You've been trading with ViewLink for a bit. Mind sharing a quick review?"})]}),s.jsxs(hn,{className:"flex-row justify-end gap-2 sm:gap-2",children:[s.jsx("button",{type:"button",onClick:P,className:"px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"No thanks"}),s.jsx("button",{type:"button",onClick:B,className:"px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Maybe later"}),s.jsx("button",{type:"button",onClick:()=>d("sentiment"),className:"px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold transition-opacity hover:opacity-90",children:"Sure"})]})]}),u==="sentiment"&&s.jsxs(s.Fragment,{children:[s.jsxs(It,{children:[s.jsx(Dt,{children:"How's ViewLink working out for you?"}),s.jsx(Bt,{children:"Be honest. It helps us know whether to celebrate or dig in."})]}),s.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[s.jsx("button",{type:"button",onClick:()=>d("form"),className:"w-full px-4 py-3 rounded-lg border border-border bg-transparent text-foreground text-sm font-medium hover:border-primary hover:text-primary transition-colors text-left",children:"Great, I'm happy with it"}),s.jsx("button",{type:"button",onClick:N,className:"w-full px-4 py-3 rounded-lg border border-border bg-transparent text-foreground text-sm font-medium hover:border-primary hover:text-primary transition-colors text-left",children:"Not great, I'm having issues"})]})]}),u==="form"&&s.jsxs(s.Fragment,{children:[s.jsxs(It,{children:[s.jsx(Dt,{children:"Leave a review"}),s.jsx(Bt,{children:"Thanks! A published review helps other traders find us."})]}),s.jsxs("div",{className:"space-y-5 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"Rating"}),s.jsx("div",{className:"flex gap-1.5",children:[1,2,3,4,5].map(_=>s.jsx("button",{type:"button",onClick:()=>p(_),"aria-label":`${_} star${_>1?"s":""}`,className:"p-0.5 transition-transform hover:scale-110",children:s.jsx(Jg,{size:26,strokeWidth:1.5,className:_<=m?"fill-primary text-primary":"text-muted-foreground"})},_))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"Your review"}),s.jsx("textarea",{value:f,onChange:_=>g(_.target.value),rows:3,placeholder:"What do you like about ViewLink?",className:"w-full rounded-lg bg-card border border-border px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary transition-colors resize-none"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"Which best describes you?"}),s.jsxs("select",{value:v,onChange:_=>C(_.target.value),className:"w-full rounded-lg bg-card border border-border px-3 py-2 text-sm text-foreground focus:outline-none focus:border-primary transition-colors",children:[s.jsx("option",{value:"",children:"Optional"}),s.jsx("option",{value:"Prop firm trader",children:"Prop firm trader"}),s.jsx("option",{value:"Retail trader",children:"Retail trader"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"Name"}),s.jsx("input",{value:x,onChange:_=>b(_.target.value),placeholder:"Optional",className:"w-full rounded-lg bg-card border border-border px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary transition-colors"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-[0.08em]",children:"Location"}),s.jsx("input",{value:y,onChange:_=>j(_.target.value),placeholder:"Optional",className:"w-full rounded-lg bg-card border border-border px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary transition-colors"})]})]})]}),s.jsxs(hn,{className:"flex-row justify-end gap-2 sm:gap-2",children:[s.jsx("button",{type:"button",onClick:()=>c(!1),className:"px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),s.jsx("button",{type:"button",onClick:L,disabled:m<1||!f.trim()||T,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold transition-opacity disabled:opacity-40 disabled:cursor-not-allowed",children:T?"Sending…":s.jsxs(s.Fragment,{children:[s.jsx(ot,{size:14,strokeWidth:2.5})," Submit review"]})})]})]})]})})}const aE="https://api.viewlink.dev",iE=1e4;function oE(e,t=Date.now()){return e?e.extension_granted?e.last_outcome_rejected?"granted_rejected":"granted_filled":!e.window_deadline||Dp(e.window_deadline,t)?
63null:e.broker_connected?"place_trade":"connect_broker":null}function lE(e){return!e||!e.extension_granted?!1:Ip(e.new_trial_end)!==null}function cE(e,t="visible",n=Date.now()){return t==="hidden"?!1:e?e.extension_granted||!e.window_deadline?!1:!Dp(e.window_deadline,n):!0}function Mp(){const{user:e,session:t}=be(),[n,r]=h.useState(null),[a,i]=h.useState(!0),[o,l]=h.useState(0),c=h.useRef(null),u=h.useCallback(()=>l(b=>b+1),[]);h.useEffect(()=>{if(!e||!(t!=null&&t.access_token)){c.current=null,r(null),i(!1);return}let b=!1;return c.current!==e.id&&i(!0),(async()=>{let y=null;try{const j=await fetch(`${aE}/v1/trial/extension-status`,{headers:{Authorization:`Bearer ${t.access_token}`}});if(j.ok){const v=await j.json();y={window_deadline:(v==null?void 0:v.window_deadline)??null,broker_connected:(v==null?void 0:v.broker_connected)===!0,extension_granted:(v==null?void 0:v.extension_granted)===!0,new_trial_end:(v==null?void 0:v.new_trial_end)??null,last_outcome_rejected:(v==null?void 0:v.last_outcome_rejected)===!0}}}catch{y=null}b||(r(y),c.current=e.id,i(!1))})(),()=>{b=!0}},[e,t==null?void 0:t.access_token,o]);const[d,m]=h.useState(()=>typeof document>"u"?"visible":document.visibilityState);h.useEffect(()=>{if(typeof document>"u")return;const b=()=>m(document.visibilityState);return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[]);const p=h.useRef(!1);h.useEffect(()=>{if(d==="hidden"){p.current=!0;return}p.current&&(p.current=!1,u())},[d,u]);const f=cE(n,d);h.useEffect(()=>{if(!f)return;const b=setInterval(u,iE);return()=>clearInterval(b)},[f,u]);const g=oE(n),x=lE(n);return{state:g,status:n,loading:a,replacesChecklist:x,refetch:u}}const uE=()=>{const{state:e,status:t,loading:n,replacesChecklist:r}=Mp(),a=!n&&!r;return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tE,{}),s.jsx(sE,{}),s.jsxs("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8 space-y-8 animate-fade-up",children:[s.jsx(Pp,{state:e,status:t}),a&&s.jsx(zS,{}),s.jsx(jS,{}),s.jsx(PS,{}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(MS,{}),s.jsx(RS,{})]})]})]})},dE={background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:"3px solid #4A72FF",transition:"opacity 300ms ease"},mE=({n:e,done:t})=>s.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0 text-xs font-bold",style:{background:t?"#4A72FF":"rgba(74,114,255,0.12)",border:`1px solid ${t?"#4A72FF":"#333A52"}`,color:t?"#fff":"#4A72FF"},children:t?s.jsx(ot,{size:13,strokeWidth:2.5}):e}),fE=({number:e,heading:t,body:n,locked:r,done:a,ackLabel:i,onAck:o,footer:l,total:c})=>s.jsxs("div",{className:"rounded-xl p-6 space-y-4",style:{...dE,opacity:r?.5:1},children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(mE,{n:e,done:a}),s.jsxs("div",{className:"pt-0.5",children:[c&&s.jsxs("p",{className:"text-[0.6875rem] font-semibold uppercase tracking-[0.12em] mb-1",style:{color:"#4A72FF"},children:["Step ",e," of ",c]}),s.jsx("h3",{className:"text-[1.0625rem] font-semibold leading-snug",style:{color:"#EAEDF5"},children:t})]})]}),s.jsx("div",{className:"text-[0.875rem] space-y-4",style:{color:"#8A92A8",lineHeight:1.7},children:n}),l&&s.jsx("div",{children:l}),!a&&s.jsx("button",{onClick:o,disabled:r,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:{background:r?"transparent":"#4A72FF",border:r?"1px solid #333A52":"none",color:r?"#505770":"#fff",cursor:r?"not-allowed":"pointer"},children:i}),a&&s.jsxs("div",{className:"flex items-center gap-2 text-[0.875rem]",style:{color:"#22C55E"},children:[s.jsx(ot,{size:15}),"Done"]})]});function pE({demoId:e,aspectRatio:t,title:n}){const[r,a]=h.useState(!1);return!e||!e.trim()?s.jsx("div",{style:{position:"relative",width:"100%",aspectRatio:String(t),padding:"40px 0"},children:s.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px",background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38"},children:s.jsx("span",{style:{color:"#8A92A8",fontSize:"0.875rem"},children:"Walkthrough video coming soon"})})}):s.jsxs("div",{style:{position:"relative",boxSizing:"content-box",maxHeight:"80vh",width:"100%",aspectRatio:String(t),padding:"40px 0"},children:[!r&&s.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",borderRadius:"8px",background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38"},children:[s.jsx("div",{className:"animate-spin",style:{width:"24px",height:"24px",border:"2px s
63olid #4A72FF",borderTopColor:"transparent",borderRadius:"50%"}}),s.jsx("span",{style:{color:"#8A92A8",fontSize:"0.875rem"},children:"Demo loading…"})]}),s.jsx("iframe",{src:`https://app.supademo.com/embed/${e}?embed_v=2&utm_source=embed`,loading:"lazy",title:n,allow:"clipboard-write",frameBorder:"0",allowFullScreen:!0,onLoad:()=>a(!0),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:r?1:0,transition:"opacity 200ms ease"}})]})}const Lp="vl_setup_progress",Jr=[{id:"step-1",number:1,title:"Install & Configure the Chrome Extension",description:"The ViewLink extension reads your TradingView chart and sends trades to MT5. Install it from the Chrome Web Store, then pin it to your toolbar and paste in your license key (found in Settings → Integration). You only do this once, and it takes about a minute.",demoId:"cmrjpylip0do2qmmwehsr9u3p",aspectRatio:1.53,warning:null,warningExtra:null,success:null,bodyExtra:null},{id:"step-2",number:2,title:"Add the ViewLink Indicator",description:"Open any TradingView chart and add the ViewLink Connector indicator. This is what reads your entry, SL, and TP lines.",demoId:"cmri3vly31n0mqm3ze9zw8dvn",aspectRatio:1.86,warning:null,warningExtra:null,success:null,bodyExtra:null},{id:"step-3",number:3,title:"Connect MT5",description:"Log in to your broker account inside MT5 on your VPS. Once connected, your dashboard shows MT5 Connected in green. Until this is done, no trades can execute.",demoId:"cmrjl0x0y06ylqmmw3lqksb02",aspectRatio:1.6,warning:"This is the most critical step. Without MT5 connected, every trade will fail silently.",warningExtra:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-amber-400",children:"If the login is rejected, try the MetaTrader 5 app on your phone with the same details. If it works there, your credentials are correct and we will sort out the rest. If it does not, the details need checking with your broker."}),s.jsxs("p",{className:"text-xs text-amber-400",children:["Still stuck?"," ",s.jsx(Ie,{to:"/discord",className:"underline hover:opacity-80",children:"Join our Discord"})," ","and we will help you through it."]})]}),success:null,bodyExtra:s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"There are three details, not two."})," ",'Account number, password, and the trade server. The server is a name your broker sets, usually their name followed by Live, Real or Demo and often a number. It is in the same email as the other two. MT5 says "Invalid account" for a wrong number, a wrong password and a wrong server alike, so it will not tell you which one it is.']}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Adding your broker first is not optional."})," ","The walkthrough opens with it for a reason: your server starts with an empty broker list, so until you go to"," ",s.jsx("span",{className:"text-foreground",children:"File"})," then"," ",s.jsx("span",{className:"text-foreground",children:"Open an Account"})," and select your broker, typing the server name into the login box does nothing at all — no error, no reaction. MetaQuotes-Demo is the one exception; it is built in. The full steps are in"," ",s.jsx(Ie,{to:"/setup-guide/docs/d1-connect-your-mt5",className:"text-primary underline hover:opacity-80",children:"Connect Your MT5"}),"."]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Your MT5 login is not your broker website login."})," ","Your broker issues a separate account number and password for the terminal itself. If you are using the details you log in to their website with, MT5 will reject them."]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Do not use the investor password."})," ","Some brokers issue two. The investor password is read only. It logs in successfully and cannot place a single trade, which makes it one of the hardest problems to spot."]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Paste your details in rather than typing them."})," ","Copy your password first and paste it into the login field, where you can see it. Read it, confirm it arrived correctly, then cut it and paste it into the password field."]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"The
63n copy your account number and paste that straight into the login field."}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"If you do type by hand, note that the keyboard inside the terminal is QWERTY. On any other layout the letters that arrive are not the letters you pressed."}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Worth two minutes before you start:"," ",s.jsx("a",{href:"/gotchas",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:opacity-80",children:"setup gotchas"}),"."]})]})},{id:"step-4",number:4,title:"Dashboard Settings",description:"Set your Sizing method and Risk value before your first live trade. Without these, trades are rejected. Takes 2 minutes.",demoId:"cmq8c5kpp1ohwqml6dabkel0d",aspectRatio:1.43,warning:null,warningExtra:null,success:null,bodyExtra:null},{id:"step-5",number:5,title:"How to take your first trade",description:"Send one test order from TradingView and watch it appear in MT5. Set it as a limit order far from the current price so it sits pending and cannot fill, then cancel it once you see it. Nothing executes.",demoId:"cmub1lizw2b1pqm4xz7eha6ue",aspectRatio:1.6,warning:null,warningExtra:null,success:"Nothing will execute. You are sending a limit order priced well away from the market, so it lands in MT5 as a pending order, proves the chain works, and you cancel it. No position is opened and no money is at risk.",bodyExtra:null}];function hE(){try{const e=JSON.parse(localStorage.getItem(Lp)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}function gE(){const e=nt(),[t,n]=h.useState(hE),{state:r,status:a}=Mp(),i=t.length>=Jr.length,o=l=>{const c=Array.from(new Set([...t,l]));n(c),localStorage.setItem(Lp,JSON.stringify(c))};return s.jsx("div",{className:"min-h-screen bg-background py-8 px-4 sm:px-8",children:s.jsxs("div",{className:"max-w-2xl mx-auto",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-1",children:"Get ViewLink working in under 10 minutes"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete each step to start executing trades from TradingView."}),s.jsxs(Ie,{to:"/setup-guide/docs",className:"inline-flex items-center gap-2 mt-3 text-sm text-primary hover:opacity-80 transition-opacity",children:[s.jsx(Bo,{className:"w-4 h-4"}),"Prefer to read? Browse the full documentation →"]})]}),s.jsx(fl,{}),r&&s.jsx("div",{className:"mb-8",children:s.jsx(Pp,{state:r,status:a})}),s.jsxs("div",{className:"mb-8",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-2",children:[s.jsxs("span",{children:[t.length," of ",Jr.length," steps complete"]}),i&&s.jsx("span",{className:"text-green-400",children:"All done!"})]}),s.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500",style:{width:`${t.length/Jr.length*100}%`}})})]}),s.jsx("div",{className:"space-y-10",children:Jr.map((l,c)=>{const u=t.includes(l.id);return s.jsxs("div",{children:[c>0&&s.jsx("div",{className:"h-px bg-border/50 mb-10","aria-hidden":"true"}),s.jsx(fE,{number:l.number,total:Jr.length,heading:l.title,locked:!1,done:u,ackLabel:"Mark as done",onAck:()=>o(l.id),body:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:l.description}),l.bodyExtra,l.warning&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-amber-500/10 border border-amber-500/20 px-3 py-2.5",children:[s.jsx(Ji,{className:"w-4 h-4 text-amber-400 shrink-0 mt-0.5"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-amber-400",children:l.warning}),l.warningExtra]})]}),l.success&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-green-500/10 border border-green-500/20 px-3 py-2.5",children:[s.jsx(Xl,{className:"w-4 h-4 text-green-400 shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-green-400",children:l.success})]}),s.jsx(pE,{demoId:l.demoId,aspectRatio:l.aspectRatio,title:l.title})]})})]},l.id)})}),i&&s.jsxs("div",{className:"mt-6 rounded-lg bg-green-500/10 border border-green-500/20 px-4 py-4 flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Xl,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"You're all set!"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"ViewLink is ready to execute your trades."})]})]}),s.jsx("button",{onClick:()=>
63e("/dashboard"),className:"text-sm text-primary hover:opacity-80 font-medium whitespace-nowrap",children:"Go to Dashboard →"})]})]})})}const xE=`## D1 — Connect Your MT5
64
65**This is the single most important step after your VPS is provisioned.** If you skip it, every trade will fail silently — the extension sends the signal, but MT5 has nothing to execute it.
66
67**Before you start:** Your VPS must be in Active status (shown in the top bar of your ViewLink dashboard). If it still says Provisioning or Idle, wait a few minutes and refresh.
68
69**Worth two minutes first:** [setup gotchas](/gotchas). Everything on that page has caught a real ViewLink user.
70
71**Step 1 — Open your VPS**
72
73On your ViewLink dashboard, click the **Connect to MT5** button in the top status bar. This opens your VPS desktop in a new browser tab via Guacamole (a browser-based remote desktop). You'll see a Windows-style desktop with MetaTrader 5 already installed and running.
74
75**Step 2 — Add your broker (do this first)**
76
77You must add your broker account **before** you try to log in. If you skip this step and go straight to login, MT5 will show you an empty server list and you won't be able to connect.
78
79Inside MT5 on the VPS:
80
811. Click **File** in the top menu bar → **Open an Account**
822. In the search box, type your broker name (e.g. **ATFX**, **HFM**, **Exness**, or **XM**)
833. Select your broker from the results list
844. Choose **Connect an existing account** → click **Next**
85
86**Step 3 — Log in to your trading account**
87
881. Click **File** again → **Login to Trade Account**
892. Enter your **account number** and **password**
903. In the **Server** dropdown, select the correct server for your broker:
91
92| Broker | Demo server | Live server |
93| --- | --- | --- |
94| ATFX | ATFXGM-Demo | ATFXGM-Live (or your specific live server) |
95| HFM | HFM-Demo3 | HFM-Live (or your specific live server) |
96| Exness | Exness-Trial | Exness-Real (or region-specific) |
97| XM | XMGlobal-Demo | XMGlobal-Real (or region-specific) |
981. Click **OK**
99
100**Step 4 — Confirm the connection**
101
102After a few seconds you should see a green connection light in the bottom-right corner of MT5, and your account balance visible in the toolbar at the top.
103
104**Step 5 — Check your ViewLink dashboard**
105
106Switch back to your ViewLink tab. Within 30 seconds, the status bar should update from "Login to your MT5 to start trading" to **MT5 Connected** with a green indicator. If it still shows disconnected after 1 minute, click **Reconnect** to refresh.
107
108**Troubleshooting**
109
110| Symptom | Likely cause | Fix |
111| --- | --- | --- |
112| Server dropdown is empty when logging in | Broker wasn't added first | Go back to File → Open an Account and add your broker |
113| Connection light stays red | Wrong server name selected | Try another server variant (e.g. HFM-Live2 instead of HFM-Live) |
114| Dashboard still shows Disconnected after 2+ min | EA not reporting yet | Click Reconnect in the ViewLink status bar |
115| trade_allowed = false in logs | Account has zero balance | Top up your trading account — normal broker behaviour on zero-balance accounts |
116| MT5 asks for password on every restart | Account not saved | Check "Save password" when logging in |
117
118## D2 — Required Settings Before Your First Trade
119
120Before you execute any trade through ViewLink, you must set two things in your account settings. Without them, every trade will be rejected.
121
122**Required:**
123
1241. **Sizing method** — how ViewLink calculates your position size
1252. **Risk value** — the number that sizing method uses
126
127**Where to find these settings**
128
1291. Go to **Settings** (left sidebar)
1302. Scroll to the **MT5 Accounts** section
1313. Find your account in the list
1324. Click **Trading defaults — [your account name]** to expand the panel
1335. The **Sizing** section is at the top — always open by default
134
135**Step 1 — Choose your Sizing method**
136
137| Option | What it does |
138| --- | --- |
139| Percent Balance (% of balance) | Risks a percentage of your total account balance per trade |
140| Percent Equity (% of equity) | Risks a percentage of your current equity (includes open P&L) |
141| Fixed Lot | Sends a fixed lot size regardless of account size |
142| Fixed Cash (account currency) | Risks a fixed monetary amount per trade |
143
144For most traders starting out, **Percent Balance** is the safest choice: it scales position size as your balance changes.
145
146**Step 2 — Set your risk value**
147
148| Sizing method | Field to fill in | Example |
149| --- | --- | --- |
150| Percent Balance | Risk per trade (%) | 1.0 = risk 1% of balance |
151| Percent Equity | Risk per trade (%) | 1.0 = risk 1% of equity |
152| Fixed Lot | Lot size | 0.10 = 0.1 lots per trade |
153| Fixed Cash | Risk per trade ($) | 50 = risk $50 per trade |
154
155Fields that don't apply to your chosen sizing method will be greyed out.
156
157**Step 3 — Save**
158
159Click **Save defaults** at the bottom of the Trading defaults panel. You'll see a "Settings saved" confirmation.
160
161**What happens if you skip this**
162
163- **Sizing method not set** → trade rejected: "No sizing value provided for the selected method"
164- **Risk value blank** → trade rejected: "Risk-based sizing needs a stop loss to calculate lot size"
165
166These errors show in your Trade Log under EXECUTION FAILED.
167
168## D3 — Where Settings Come From (Priority Model)
169
170ViewLink uses a two-layer system for trade settings. Understanding this prevents confusion about why a trade fired with different values than you expected.
171
172**The two layers**
173
174| Layer | Where you set it | Applies to |
175| --- | --- | --- |
176| Dashboard defaults | Settings → MT5 Accounts → Trading defaults | Every trade from this account, as the fallback |
177| Indicator (per-chart) | ViewLink Connector indicator inputs on TradingView | Overrides the dashboard for that specific trade only |
178
179**The rule: if the indicator has a value, it wins. If the indicator field is left at 0, ViewLink falls back to your Dashboard default.**
180
181**A worked example**
182
183Say your Dashboard default has Risk per trade = 1%.
184
185- Trade from a chart where the indicator's risk input is **0** → ViewLink uses **1%** from your dashboard
186- Trade from a chart where the indicator's risk input is **2%** → ViewLink uses **2%** for that trade only
187- Your dashboard default is unchanged — the next trade from a different chart still uses 1%
188
189This lets you run multiple strategies with different risk levels from one account, without touching your dashboard each time.
190
191**Which fields follow this rule**
192
193| Field | Dashboard default | Indicator override |
194| --- | --- | --- |
195| Sizing method | Set once for the account | Override per chart |
196| Risk per trade (%) | Your standard risk | Override for higher/lower-conviction setups |
197| Stop-loss (pips) | Default SL distance | Overridden by dragged SL line |
198| Take-profit (pips) | Default TP distance | Overridden by dragged TP line |
199| Trailing stop (pips) | Default trail | Override per chart/strategy |
200| Breakeven trigger | Default BE rule | Override per chart/strategy |
201| Max spread (pips) | Spread guard for all trades | Override per instrument |
202
203**The "0 means use my default" rule**
204
205In the ViewLink indicator, **0 always means "not set — use my dashboard default."** If you want a feature off, set it to 0 in the indicator and leave it blank in the dashboard. The only exceptions are the toggle-gated fields (Max spread, Max slippage, Breakeven offset) which have explicit enable/disable switches.
206
207**In practice:** Set your standard defaults once in Settings → MT5 Accounts → Trading defaults. Use the indicator inputs to customise individual charts. If a trade fires with unexpected values, check the indicator inputs on that chart first — they take priority.
208
209## D4 — Executing a Trade
210
211**Before you execute your first trade, make sure:**
212
213- MT5 is connected (status bar shows "MT5 Connected" with green indicator)
214- You've set your Sizing method and risk value in Settings → MT5 Accounts → Trading defaults
215- The ViewLink Connector indicator is on your chart
216- The ViewLink Chrome extension is installed and your license key is saved
217
218**Step 1 — Set up your trade levels on the chart**
219
220In TradingView, drag the following horizontal lines to your desired prices:
221
222- **Entry line** — where you want to enter the trade
223- **SL (Stop-Loss) line** — your stop-loss price (required for Percent Balance/Equity sizing)
224- **TP (Take-Profit) line** — your take-profit price (optional)
225
226The indicator reads these line positions in real time. You'll see the Entry, SL, and TP values update in the ViewLink extension popup as you drag the lines.
227
228**Step 2 — Open the ViewLink extension popup**
229
230Click the ViewLink icon in your Chrome toolbar. The popup will show:
231
232- Symbol (e.g. EURUSD)
233- Entry price
234- SL and TP prices
235- R:R ratio (e.g. 1 : 2.5)
236
237If it shows "Waiting for indicator…", the ViewLink Connector indicator is not on the active chart — add it first.
238
239**Step 3 — Choose your trade direction and order type**
240
241| Setting | Options | When to use |
242| --- | --- | --- |
243| Side | Buy / Sell | Direction of your trade |
244| Type | Market | Execute immediately at the best available price |
245| Type | Limit | Pending order — fills when price reaches your entry from the opposite direction |
246| Type | Stop | Pending order — fills when price breaks through your entry level |
247
248For most trades, **Buy Market** or **Sell Market** is what you want. Use Limit/Stop only if you're placing a pending order.
249
250**Step 4 — Click EXECUTE**
251
252The button turns to "Sending to MT5…" while the signal is in transit. Within a few seconds, the popup shows the result:
253
254- **Success** — the trade was placed. You'll see it appear in MT5 and in your ViewLink Trade Log.
255- **Failed** — a reason is shown (e.g. "No stop-loss provided for risk-based sizing"). Fix the issue and try again.
256
257**Step 5 — Verify in the Trade Log**
258
259Go to **Trade Log** in your ViewLink sidebar. The most recent row should show **EXECUTED** with your trade details. Click the row to expand and see the exact lot size, fill price, SL, TP, and broker symbol used.
260
261**Notes on Market orders**
262
263When using Market order type, the entry line position is ignored — the trade fills at whatever price MT5 receives it at (live market price). The SL and TP lines are still read and sent as price levels.
264
265**Notes on Limit/Stop orders**
266
267Your entry line position is sent as the pending order price. MT5 places the order and it waits in the order book until price reaches that level. You can see it in MT5's "Trade" tab as an open pending order.
268
269## D5 — Trade Statuses & Error Messages
270
271Every trade that goes through ViewLink is logged in the Trade Log with a status. Here's what each status means and what to do about it.
272
273**Status reference**
274
275| Status | Colour | What it means |
276| --- | --- | --- |
277| EXECUTED | Green | Trade was placed in MT5 successfully |
278| EXECUTION FAILED | Red | Trade signal reached ViewLink but couldn't be placed — see reason in expanded row |
279| QUEUED | Blue | Signal received; waiting for the EA to pick it up |
280| EXPIRED | Grey | Signal timed out before the EA processed it |
281| SPREAD_TOO_HIGH | Amber | Live spread exceeded your Max spread guard at the time of execution |
282| IDEMPOTENCY_DUPLICATE | Grey | Same signal was sent twice — second one was discarded to prevent duplicate trades |
283| RATE_LIMIT_EXCEEDED | Grey | Too many signals sent in a short window — the excess were dropped |
284
285**EXECUTION FAILED — error messages**
286
287When a trade shows EXECUTION FAILED, expand the row to see the specific reason. Common errors:
288
289| Error message | What it means | Fix |
290| --- | --- | --- |
291| Risk-based sizing needs a stop loss to calculate lot size | You're using % sizing but no SL was provided | Make sure the SL line is set on the chart before executing |
292| No sizing value provided for the selected method | A sizing method is selected but the value field is blank | Go to Settings → Trading defaults and enter your risk value |
293| Sizing method not configured | No sizing method is set for this account | Go to Settings → Trading defaults and select a Sizing method |
294| Ambiguous sizing — multiple sizing fields set | Both lot size and % risk have values at the same time | Clear all sizing fields in the indicator except the one you want to use |
295| We couldn't find this symbol on your broker | TradingView symbol doesn't map to a broker symbol | Contact support with the symbol name + broker — mapping added within 24h |
296| Ambiguous symbol — multiple broker symbols matched | Your broker has multiple variants of the same symbol | Contact support to configure the correct symbol mapping |
297| Symbol catalogue not yet synced | EA just connected and hasn't sent its symbol list yet | Wait 30 seconds and try again — or open MT5 in the VPS to confirm the EA is running |
298| Symbol catalogue is stale | Symbol list hasn't updated recently | Reconnect MT5 from the ViewLink status bar, then try again |
299| Trade couldn't be executed. Contact support if this persists. | An unexpected backend error | Try again once; if it keeps happening, contact support |
300
301**EXPIRED — what causes it and what to do**
302
303EXPIRED means the trade signal was valid when it was sent, but the EA didn't acknowledge it before the Alert freshness (TTL) timer ran out. Most common causes:
304
305- The EA was briefly disconnected (MT5 closed, VPS restarted, network drop)
306- The Alert freshness setting is very short (less than 10 seconds) and execution was slightly delayed
307
308**Fix:** Check your EA status in the ViewLink dashboard. If it's showing Disconnected or Idle, open your VPS and verify MT5 is running with the EA attached to a chart.
309
310**SPREAD_TOO_HIGH — what to do**
311
312Your Max spread guard rejected the trade because the live spread was wider than your limit. Options:
313
314- Wait for the spread to narrow (common during news events, market open/close)
315- Raise your Max spread limit in Settings → Trading defaults → Execution Guards
316- Toggle off the Max spread guard for instruments where you don't need it
317
318**Using Trade Log filters**
319
320The Trade Log has filters at the top. You can filter by:
321
322- **Status** — show only EXECUTION FAILED, only EXECUTED, etc.
323- **Date range** — narrow to a specific period
324- **Account** — if you have multiple MT5 accounts
325
326Click any row to expand it and see full trade details: lot size, fill price, broker symbol, SL, TP, and the exact error message if it failed.
327
328## D6 — Supported Instruments
329
330ViewLink supports the following instrument categories. If you try to execute a trade on an unsupported or unmapped symbol, the trade will fail with a "symbol not found" error.
331
332**Supported categories**
333
334| Category | Examples |
335| --- | --- |
336| Forex majors | EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, USDCAD, NZDUSD |
337| Forex minors | EURGBP, EURJPY, GBPJPY, AUDJPY, CADJPY, CHFJPY, and others |
338| Metals | Gold (XAUUSD), Silver (XAGUSD) |
339| Crypto | BTCUSD |
340| Indices | US100 (Nasdaq) |
341
342**Symbol mapping between TradingView and your broker**
343
344TradingView uses standardised symbol names (e.g. XAUUSD for gold). Your broker may use a different name for the same instrument (e.g. GOLD, GOLDm, XAUUSDm).
345
346ViewLink handles this mapping for you for supported brokers. When your MT5 connects for the first time, the EA sends the full symbol catalogue from your broker to ViewLink. The system matches TradingView symbols to broker symbols behind the scenes.
347
348If a symbol match fails, you'll see this in your Trade Log: "We couldn't find this symbol on your broker."
349
350Contact support with the symbol name and your broker — the mapping can usually be added within 24 hours.
351
352**Instruments not currently supported**
353
354The following will not execute and will return an EXECUTION FAILED event in your Trade Log:
355
356- Individual stocks / equities
357- Futures contracts
358- Options
359- Commodities other than gold and silver (e.g. oil, wheat)
360- Crypto pairs other than BTCUSD
361
362**Checking if your symbol is supported**
363
364The easiest way to check: execute a test trade on a demo account. If the symbol is mapped, it will execute. If not, you'll see the mapping error in the Trade Log immediately — no money is at risk from a failed mapping.
365
366## D7 — Installing & Connecting the Chrome Extension
367
368The ViewLink Chrome extension is what reads your TradingView indicator and sends trade signals to MT5. It takes about 2 minutes to set up.
369
370**Step 1 — Install from the Chrome Web Store**
371
3721. Open Chrome and go to the ViewLink listing in the Chrome Web Store
3732. Click **Add to Chrome**
3743. Click **Add extension** in the confirmation popup
375
376The ViewLink icon will appear in your Chrome toolbar. If you don't see it, it may be hidden — proceed to Step 2.
377
378**Step 2 — Pin the extension**
379
380To keep the ViewLink icon always visible in your toolbar:
381
3821. Click the **puzzle piece icon** in the top-right of Chrome — this opens the extensions panel
3832. Find **ViewLink** in the list
3843. Click the **pin icon** next to it
385
386The ViewLink icon will now always appear in your toolbar, one click away when you're ready to trade.
387
388**Step 3 — Enter your license key**
389
390The first time you click the ViewLink icon, the extension opens its Settings screen for you.
391
3921. In the **License Key** field, enter your ViewLink license key
393    - You can copy this from your ViewLink dashboard → Settings → Integration → License Key
3942. Leave **Backend URL** blank (it defaults to the ViewLink server)
3953. Click **Save**
396
397The header will show "License ✓" in green when your key is accepted.
398
399**Step 4 — Connect to TradingView**
400
4011. Open TradingView and navigate to any chart that has the ViewLink Connector indicator on it
4022. Click the ViewLink icon in your Chrome toolbar
4033. The popup should show your indicator values (symbol, Entry, SL, TP) and the status should show **Connected**
404
405If it shows "Waiting for indicator…", make sure the ViewLink Connector indicator is visible on the active chart.
406
407**Troubleshooting**
408
409| Symptom | Fix |
410| --- | --- |
411| Extension icon not visible | Click the puzzle piece icon and pin ViewLink |
412| "No license" shown in red | Open extension settings (gear icon in popup) and enter your license key |
413| "Waiting for indicator…" on every chart | Add the ViewLink Connector indicator to the chart |
414| Extension shows values but EXECUTE fails | Check that MT5 is connected in your ViewLink dashboard first |
415| Extension loses my license key | This shouldn't happen — keys persist in Chrome storage. Try re-entering the key |
416
417**Important notes**
418
419- The extension works on any TradingView plan — free or paid
420- Your license key is stored securely in Chrome's local storage and never synced to other devices
421- The extension only activates on TradingView tabs — it has no access to any other websites
422- You only need to enter your license key once — it persists across browser restarts
423
424## D8 — Indicator Settings Reference
425
426The ViewLink Connector indicator on your TradingView chart has a set of inputs that let you override your dashboard defaults on a per-chart or per-trade basis.
427
428**Key rule:** Setting any field to **0** means "not set — use my dashboard default." A real value overrides the dashboard for that chart. See D3 (Where Settings Come From) for the full priority model.
429
430**Sizing**
431
432These fields control how ViewLink calculates your lot size for trades from this chart. Leave all at 0 to use your dashboard's Sizing method and Risk value.
433
434| Field | What it does |
435| --- | --- |
436| Sizing method | Overrides your dashboard sizing method for this chart. Options: Percent Balance, Percent Equity, Fixed Lot, Fixed Cash |
437| Risk per trade (%) | Your risk per trade as a % of balance or equity. Active when Sizing method is Percent Balance or Percent Equity |
438| Lot size | Fixed lot size for this chart. Active when Sizing method is Fixed Lot |
439| Risk per trade (cash) | Fixed cash amount to risk per trade in your account currency. Active when Sizing method is Fixed Cash |
440| Lot ceiling (safety) | A hard maximum lot size cap. ViewLink will never exceed this regardless of calculated size. Leave blank for no ceiling |
441
442**Stops & Targets**
443
444Default stop and take-profit distances. In practice, these are usually set by dragging the SL/TP lines on the chart — the indicator reads those positions directly.
445
446| Field | What it does |
447| --- | --- |
448| Default stop-loss (pips) | Your default SL distance. Overridden by the dragged SL line when present |
449| Default take-profit (pips) | Your default TP distance. Leave blank if you manage exits manually |
450
451**Trade Management**
452
453Trade management features. All default to off (0). Set values here to apply them to every trade from this chart.
454
455| Field | What it does |
456| --- | --- |
457| Trailing-stop distance (pips) | Activates a trailing stop at this pip distance behind price |
458| Trail trigger (pips) | How many pips in profit before the trail starts. 0 = trail immediately from entry |
459| Breakeven trigger (pips) | Move stop to breakeven after this many pips of profit |
460| Breakeven trigger (R:R) | Move stop to breakeven at this reward-to-risk multiple. Requires a stop on the trade |
461| Breakeven offset (pips) | Pips locked in above entry when breakeven triggers (e.g. 1 pip to cover spread). Toggle on to activate; off = disabled |
462| Partial close (%) | Percentage of the position to scale out when the partial close trigger fires |
463| Partial close trigger (pips) | Pips of profit at which the partial close fires |
464| Partial close trigger (R:R) | R:R multiple at which the partial close fires |
465
466Note: Breakeven trigger (pips) and Breakeven trigger (R:R) are separate triggers — set one or the other, not both.
467
468**Execution Guards**
469
470Safety checks before a trade is placed. All are disabled by default.
471
472| Field | What it does |
473| --- | --- |
474| Max spread (pips) | ViewLink skips the trade if the live spread is wider than this value. Toggle on to activate; off = no spread check. 0 does NOT mean "allow zero spread" — it means disabled. Always use the toggle to enable it, then set your limit |
475| Max slippage (points) | Maximum price slippage acceptable on a fill. Toggle on to set a limit; off = ViewLink uses a safe default |
476| Alert freshness (seconds) | How long a trade signal stays valid. Signals older than this are discarded as stale |
477
478**Identity**
479
480| Field | What it does |
481| --- | --- |
482| Magic number | The identifier ViewLink stamps on trades from this chart so MT5 can distinguish them from manual trades or other strategies. If you run multiple strategies, set a unique magic number per chart. If left at 0, your dashboard account default is used |
483
484**Fields not shown in the indicator**
485
486These are per-trade values that don't make sense as saved defaults: SL price, TP price, Breakeven price (exact price is only meaningful for one trade — set by dragging lines on the chart), and Partial close volume (closing a fixed lot depends on the current position size so it can only be set per trade).
487
488**A note on toggle-gated fields**
489
490Max spread, Max slippage, and Breakeven offset each have an enable/disable toggle. When toggled off, the field sends a special "disabled" signal to ViewLink — this is different from leaving it at 0. Toggle off = explicitly disabled. Toggle on, value = 0 = enabled with zero tolerance (which would block all trades). Always use the toggle to enable these fields before setting a value.
491
492## D9 — FAQ & Glossary
493
494**"Nothing happened when I clicked Execute"**
495
496Check these in order:
497
4981. Is MT5 connected? The ViewLink status bar must show "MT5 Connected" (green). If not, connect first — see D1.
4992. Is the EA Active? The status bar shows EA Active (blue), EA Idle (amber), or EA Disconnected (red). If disconnected, open your VPS and check MT5 is running.
5003. Did a result appear in the extension? The popup shows either a success or a specific failure reason. If it shows "Waiting for indicator…", the indicator isn't on the active chart.
5014. Check the Trade Log for a recent EXECUTION FAILED or EXPIRED event — the expanded row shows the exact reason.
502
503**"Why did my lot size come out different than expected?"**
504
505Common reasons:
506
507- Your Sizing method uses % risk, and the lot size changes based on your SL distance. A tighter SL = larger lot (same $ risk spread over fewer pips). A wider SL = smaller lot. This is correct behaviour.
508- Your balance or equity changed. Percent Balance/Equity sizing recalculates every trade from your live balance.
509- The indicator overrode your dashboard. If you have risk or lot values set in the indicator inputs on that chart, those take priority. See D3.
510- A Lot ceiling is set. If you have a Lot ceiling (safety) configured in Trading defaults, the calculated lot was capped there.
511
512**"My trade shows QUEUED but never executes"**
513
514QUEUED means ViewLink received your signal and is waiting for the EA to pick it up. If it stays QUEUED for more than 30 seconds:
515
516- Check your EA status in the ViewLink dashboard (EA Active = connected; EA Idle/Disconnected = not communicating)
517- Open your VPS and verify MT5 is running and the EA is attached to a chart
518- If MT5 crashed or was closed, restart it in the VPS
519
520**"The extension shows 'Chart symbol changed since you read the indicator'"**
521
522This appears when you read the indicator on one symbol, then switched to a different chart before clicking Execute. ViewLink detects the mismatch to prevent you accidentally sending a trade on the wrong instrument. Fix: click **← Read again** in the extension popup to re-read the current chart.
523
524**"I'm getting 'Spread too high' errors constantly"**
525
526Your Max spread guard is set lower than the live spread on that instrument. Common causes: trading during a high-spread period (news events, market open/close, thin liquidity), or your Max spread limit is too tight for the instrument. Fix: go to Settings → Trading defaults → Execution Guards → Max spread and either raise the limit or toggle it off for instruments where you don't need spread protection.
527
528**"Do I need a paid TradingView plan?"**
529
530No. ViewLink works on all TradingView plans including the free tier. The extension reads directly from the TradingView Data Window, which is available on every plan.
531
532**"Can I run multiple MT5 accounts?"**
533
534Your plan determines how many MT5 accounts you can connect. Each account gets its own Trading defaults panel in Settings. The extension always sends signals to your active account.
535
536**"What's the difference between Limit and Stop orders?"**
537
538Both are pending orders — they sit in MT5 waiting for price to reach your entry level. Limit order: you expect price to reverse from your entry level (buy below market expecting a bounce; sell above market expecting a pullback). Stop order: you expect price to continue through your entry level (buy above market expecting breakout; sell below market expecting breakdown). For Market orders, the entry line is ignored — the trade executes at whatever price MT5 receives it at.
539
540**Glossary**
541
542| Term | Meaning |
543| --- | --- |
544| EA (Expert Advisor) | The ViewLink Bridge EA running inside MT5 on your VPS. It receives trade instructions from the backend and places orders in MT5 |
545| VPS (Virtual Private Server) | A cloud-hosted Windows server provisioned by ViewLink. It runs MT5 24/7 so your account stays connected and your open trades keep being managed even when your computer is off |
546| Guacamole | The browser-based remote desktop ViewLink uses to give you access to your VPS. Opens when you click "Connect to MT5" |
547| License key | Your unique key that authenticates the ViewLink extension with the backend. Found in Settings → Integration. Keep it private |
548| Magic number | A number stamped on every trade placed by the EA. Used to identify which trades came from ViewLink vs. manual trading in MT5 |
549| Alert freshness (TTL) | Time-to-live for a trade signal. Signals older than this are expired and not executed |
550| Sizing method | How ViewLink calculates your lot size: Percent Balance, Percent Equity, Fixed Lot, or Fixed Cash |
551| R:R (Risk:Reward) | The ratio of potential loss to potential gain on a trade. Shown in the extension popup as e.g. "1 : 2.5" |
552| Symbol mapping | The translation between TradingView symbol names (e.g. XAUUSD) and your broker's symbol names (e.g. GOLD, GOLDm) |
553| EXECUTED | Trade was placed in MT5 successfully |
554| EXECUTION FAILED | Trade signal reached ViewLink but couldn't be placed in MT5. See the reason in the Trade Log row |
555| QUEUED | Signal received, waiting for the EA |
556| EXPIRED | Signal timed out before the EA processed it |
557| Dashboard defaults | Your saved Trading defaults in Settings → MT5 Accounts → Trading defaults. The fallback when the indicator doesn't specify a value |
558| Indicator override | A value set in the ViewLink Connector indicator on a specific chart. Takes priority over dashboard defaults for that trade |
559
560## D10 — How to Take Your First Trade
561
562Once your setup is complete, placing your first trade takes about a minute. Confirm the prerequisites first, then fire the signal.
563
564**Before you trade, confirm:**
565
566- MT5 shows **Connected** (green) on your dashboard. If it does not, no trade can execute (see D1).
567- Your **Sizing method** and **Risk** are set in Settings → MT5 Accounts → Trading defaults, or on the indicator itself (see D2, D3).
568- The ViewLink Connector indicator is on your chart and the extension is pinned with your license key (see D7, D8).
569
570**Placing the trade:**
571
5721. Open the chart for the instrument you want to trade in TradingView.
5732. Set your entry, stop loss, and take profit on the ViewLink Connector indicator by dragging the lines, or let a market order use the live price.
5743. Open the ViewLink extension popup and review the direction, order type, and sizing it has read from the chart.
5754. Click **Execute**. The popup shows the status as it moves from Queued to Executed.
5765. Open the Trade Log on your dashboard to see the fill, ticket number, and lot size.
577
578If the trade shows **EXECUTION FAILED**, open the Trade Log row for the reason (see D5). The most common cause on a first trade is MT5 not being connected to your broker, or a sizing value not being set.
579
580## D11 — Known Limitations
581
582**Getting into a trade still needs you at the chart.** ViewLink automates what happens once a position is open — stop-loss, take-profit, break-even, trailing, and partial close all run without you watching. It does not open a trade on its own. Firing the entry itself is still a manual step: you (or an alert you're watching) click Execute in the extension popup. There's no unattended, walk-away-and-it-enters-for-you mode today.
583
584**Pending orders you move on the chart.** If you drag a pending entry after placing it, break-even and partial-close levels are measured from where the order was first placed, not from where it finally fills. On a large move this can shift where those levels land. If precision matters on a trade, set the entry where you want it before the order is live rather than dragging it after.
585`,yE=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),bE=e=>{const n=(e.split(`
586`).map(r=>r.trim()).find(r=>r&&!r.startsWith("|")&&!r.startsWith("#"))??"").replace(/[*_`#>]/g,"").trim();return n.length>150?`${n.slice(0,150).trimEnd()}…`:n};function vE(){return xE.split(/^## /m).map(e=>
586e.trim()).filter(Boolean).map(e=>{const t=e.indexOf(`
587`),n=(t===-1?e:e.slice(0,t)).trim(),r=(t===-1?"":e.slice(t+1)).trim(),a=n.indexOf("—"),i=a===-1?"":n.slice(0,a).trim(),o=a===-1?n:n.slice(a+1).trim();return{code:i,title:o,fullTitle:n,slug:yE(n),body:r,summary:bE(r)}})}const Bn=vE(),wE=e=>Bn.find(t=>t.slug===e);function kE(){const[e,t]=h.useState(""),n=h.useMemo(()=>{const r=e.trim().toLowerCase();return r?Bn.filter(a=>`${a.fullTitle} ${a.body}`.toLowerCase().includes(r)):Bn},[e]);return s.jsx("div",{className:"min-h-screen bg-background py-8 px-4 sm:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs(Ie,{to:"/setup-guide",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(bs,{className:"w-4 h-4"}),"Back to Setup Guide"]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-1",children:"Documentation"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse the full written reference. Pick a topic to read the details."})]}),s.jsx(fl,{}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx(Vo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx("input",{type:"text",value:e,onChange:r=>t(r.target.value),placeholder:"Search the docs…",className:"w-full rounded-lg border border-border bg-card/50 pl-10 pr-3 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})]}),n.length===0?s.jsxs("p",{className:"text-sm text-muted-foreground",children:["No topics match “",e,"”."]}):s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.map(r=>s.jsxs(Ie,{to:`/setup-guide/docs/${r.slug}`,className:"group rounded-lg border border-border bg-card/50 p-5 transition-colors hover:border-primary/50",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[r.code&&s.jsx("span",{className:"text-[0.6875rem] font-semibold px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20",children:r.code}),s.jsx("h2",{className:"text-sm font-semibold text-foreground",children:r.title})]}),s.jsx(Qt,{className:"w-4 h-4 text-muted-foreground shrink-0 transition-transform group-hover:translate-x-0.5 group-hover:text-primary"})]}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:r.summary})]},r.slug))})]})})}function _E(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SE={};function Vu(e,t){return(SE.jsx?NE:jE).test(e)}const EE=/[ \t\n\f\r]/g;function CE(e){return typeof e=="object"?e.type==="text"?Uu(e.value):!1:Uu(e)}function Uu(e){return e.replace(EE,"")===""}class Ls{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ls.prototype.normal={};Ls.prototype.property={};Ls.prototype.space=void 0;function Op(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Ls(n,r,t)}function Co(e){return e.toLowerCase()}class vt{constructor(t,n){this.attribute=n,this.property=t}}vt.prototype.attribute="";vt.prototype.booleanish=!1;vt.prototype.boolean=!1;vt.prototype.commaOrSpaceSeparated=!1;vt.prototype.commaSeparated=!1;vt.prototype.defined=!1;vt.prototype.mustUseProperty=!1;vt.prototype.number=!1;vt.prototype.overloadedBoolean=!1;vt.prototype.property="";vt.prototype.spaceSeparated=!1;vt.prototype.space=void 0;let TE=0;const ge=or(),Ze=or(),To=or(),G=or(),Re=or(),Yn=or(),kt=or();function or(){return 2**++TE}const Ao=Object.freeze(Object.defineProperty({__proto__:null,boolean:ge,booleanish:Ze,commaOrSpaceSeparated:kt,commaSeparated:Yn,number:G,overloadedBoolean:To,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),Ti=Object.keys(Ao);class vl extends vt{constructor(t,n,r,a){let i=-1;
vendor: 4,308 bytes, line 587
587if(super(t,n),Wu(this,"space",a),typeof r=="number")for(;++i<Ti.length;){const o=Ti[i];Wu(this,Ti[i],(r&Ao[o])===Ao[o])}}}vl.prototype.defined=!0;function Wu(e,t,n){n&&(e[t]=n)}function $r(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new vl(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Co(r)]=r,n[Co(i.attribute)]=r}return new Ls(t,n,e.space)}const Rp=$r({properties:{ariaActiveDescendant:null,ariaAtomic:Ze,ariaAutoComplete:null,ariaBusy:Ze,ariaChecked:Ze,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Re,ariaCurrent:null,ariaDescribedBy:Re,ariaDetails:null,ariaDisabled:Ze,ariaDropEffect:Re,ariaErrorMessage:null,ariaExpanded:Ze,ariaFlowTo:Re,ariaGrabbed:Ze,ariaHasPopup:null,ariaHidden:Ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Re,ariaLevel:G,ariaLive:null,ariaModal:Ze,ariaMultiLine:Ze,ariaMultiSelectable:Ze,ariaOrientation:null,ariaOwns:Re,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:Ze,ariaReadOnly:Ze,ariaRelevant:null,ariaRequired:Ze,ariaRoleDescription:Re,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:Ze,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Fp(e,t){return t in e?e[t]:t}function zp(e,t){return Fp(e,t.toLowerCase())}const AE=$r({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Yn,acceptCharset:Re,accessKey:Re,action:null,allow:null,allowFullScreen:ge,allowPaymentRequest:ge,allowUserMedia:ge,alpha:ge,alt:null,as:null,async:ge,autoCapitalize:null,autoComplete:Re,autoFocus:ge,autoPlay:ge,blocking:Re,capture:null,charSet:null,checked:ge,cite:null,className:Re,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:Ze,controls:ge,controlsList:Re,coords:G|Yn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ge,defer:ge,dir:null,dirName:null,disabled:ge,download:To,draggable:Ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ge,formTarget:null,headers:Re,height:G,hidden:To,high:G,href:null,hrefLang:null,htmlFor:Re,httpEquiv:Re,id:null,imageSizes:null,imageSrcSet:null,inert:ge,inputMode:null,integrity:null,is:null,isMap:ge,itemId:null,itemProp:Re,itemRef:Re,itemScope:ge,itemType:Re,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ge,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:ge,muted:ge,name:null,nonce:null,noModule:ge,noValidate:ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ge,optimum:G,pattern:null,ping:Re,placeholder:null,playsInl
587ine:ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ge,referrerPolicy:null,rel:Re,required:ge,reversed:ge,rows:G,rowSpan:G,sandbox:Re,scope:null,scoped:ge,seamless:ge,selected:ge,shadowRootClonable:ge,shadowRootCustomElementRegistry:ge,shadowRootDelegatesFocus:ge,shadowRootMode:null,shadowRootSerializable:ge,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:Ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:ge,useMap:null,value:Ze,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Re,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ge,declare:ge,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:ge,noHref:ge,noShade:ge,noWrap:ge,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:Ze,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ge,disablePictureInPicture:ge,disableRemotePlayback:ge,exportParts:Yn,part:Re,prefix:null,property:null,results:G,security:null,unselectable:null},space:"html",transform:zp}),IE=$r({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
587-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:kt,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Re,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Yn,g2:Yn,glyphName:Yn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:kt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 5,208 bytes, lines 587-588
587Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Re,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kt,rev:kt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kt,requiredFeatures:kt,requiredFonts:kt,requiredFormats:kt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:kt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kt,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fp}),$p=$r({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Bp=$r({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zp}),Vp=$r({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),DE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},PE=/[A-Z]/g,Yu=/-[a-z]/g,ME=/^data[-\w.:]+$/i;function LE(e,t){const n=Co(t);let r=t,a=vt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ME.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Yu,RE);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Yu.test(i)){let o=i.replace(PE,OE);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=vl}return new a(r,t)}function OE(e){return"-"+e.toLowerCase()}function RE(e){return e.charAt(1).toUpperCase()}const FE=Op([Rp,AE,$p,Bp,Vp],"html"),wl=Op([Rp,IE,$p,Bp,Vp],"svg");function zE(e){return e.join(" ").trim()}var kl={},Hu=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,$E=/\n/g,BE=/^\s*/,VE=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,UE=/^:\s*/,WE=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,YE=/^[;\s]*/,HE=/^\s+|\s+$/g,qE=`
588`,qu="/",Gu="*",$n="",GE="comment",XE="declaration";function KE(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function a(g){var x=g.match($E);x&&(n+=x.length);var b=g.lastIndexOf(qE);r=~b?g.length-b:r+g.length}function i(){var g={line:n,column:r};return function(x){return x.position=new o(g),u(),x}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var x=new Error(t.source+":"+n+":"+r+": "+g);if(x.reason=g,x.filename=t.source,x.line=n,x.column=r,x.source=e,!t.silent)throw x}function c(g){var x=g.exec(e);if(x){var b=x[0];return a(b),e=e.slice(b.length),x}}function u(){c(BE)}function d(g){var x;for(g=g||[];x=m();)x!==!1&&g.push(x);return g}function m(){var g=i();if(!(qu!=e.charAt(0)||Gu!=e.charAt(1))){for(var x=2;$n!=e.charAt(x)&&(Gu!=e.charAt(x)||qu!=e.charAt(x+1));)++x;if(x+=2,$n===e.charAt(x-1))return l("End of comment missing");var b=e.slice(2,x-2);return r+=2,a(b),e=e.slice(x),r+=2,g({type:GE,comment:b})}}function p(){var g=i(),x=c(VE);if(x){if(m(),!c(UE))return l("property missing ':'");var b=c(WE),y=g({type:XE,property:Xu(x[0].replace(Hu,$n)),value:b?Xu(b[0].replace(Hu,$n)):$n});return c(YE),y}}function f(){var g=[];d(g);for(var x;x=p();)x!==!1&&(g.push(x),d(g));return g}return u(),f()}function Xu(e){return e?e.replace(HE,$n):$n}
vendor: 3,708 bytes, line 588
588var JE=KE,QE=ha&&ha.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kl,"__esModule",{value:!0});kl.default=e2;const ZE=QE(JE);function e2(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,ZE.default)(e),a=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;a?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var Ga={};Object.defineProperty(Ga,"__esModule",{value:!0});Ga.camelCase=void 0;var t2=/^--[a-zA-Z0-9_-]+$/,n2=/-([a-z])/g,r2=/^[^-]+$/,s2=/^-(webkit|moz|ms|o|khtml)-/,a2=/^-(ms)-/,i2=function(e){return!e||r2.test(e)||t2.test(e)},o2=function(e,t){return t.toUpperCase()},Ku=function(e,t){return"".concat(t,"-")},l2=function(e,t){return t===void 0&&(t={}),i2(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(a2,Ku):e=e.replace(s2,Ku),e.replace(n2,o2))};Ga.camelCase=l2;var c2=ha&&ha.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},u2=c2(kl),d2=Ga;function Io(e,t){var n={};return!e||typeof e!="string"||(0,u2.default)(e,function(r,a){r&&a&&(n[(0,d2.camelCase)(r,t)]=a)}),n}Io.default=Io;var m2=Io;const f2=Qd(m2),Up=Wp("end"),_l=Wp("start");function Wp(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function p2(e){const t=_l(e),n=Up(e);if(t&&n)return{start:t,end:n}}function fs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ju(e.position):"start"in e||"end"in e?Ju(e):"line"in e||"column"in e?Do(e):""}function Do(e){return Qu(e&&e.line)+":"+Qu(e&&e.column)}function Ju(e){return Do(e&&e.start)+"-"+Do(e&&e.end)}function Qu(e){return e&&typeof e=="number"?e:1}class ut extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=fs(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ut.prototype.file="";ut.prototype.name="";ut.prototype.reason="";ut.prototype.message="";ut.prototype.stack="";ut.prototype.column=void 0;ut.prototype.line=void 0;ut.prototype.ancestors=void 0;ut.prototype.cause=void 0;ut.prototype.fatal=void 0;ut.prototype.place=void 0;ut.prototype.ruleId=void 0;ut.prototype.source=void 0;const jl={}.hasOwnProperty,h2=new Map,g2=/[A-Z]/g,x2=new Set(["table","tbody","thead","tfoot","tr"]),y2=new Set(["td","th"]),Yp="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function b2(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=E2(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 10,529 bytes, line 588
588if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=S2(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?wl:FE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Hp(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Hp(e,t,n){if(t.type==="element")return v2(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return w2(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _2(e,t,n);if(t.type==="mdxjsEsm")return k2(e,t);if(t.type==="root")return j2(e,t,n);if(t.type==="text")return N2(e,t)}function v2(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=wl,e.schema=a),e.ancestors.push(t);const i=Gp(e,t.tagName,!1),o=C2(e,t);let l=Sl(e,t);return x2.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!CE(c):!0})),qp(e,o,i,t),Nl(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function w2(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}js(e,t.position)}function k2(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);js(e,t.position)}function _2(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=wl,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Gp(e,t.name,!0),o=T2(e,t),l=Sl(e,t);return qp(e,o,i,t),Nl(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function j2(e,t,n){const r={};return Nl(r,Sl(e,t)),e.create(t,e.Fragment,r,n)}function N2(e,t){return t.value}function qp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Nl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function S2(e,t,n){return r;function r(a,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function E2(e,t){return n;function n(r,a,i,o){const l=Array.isArray(i.children),c=_l(r);return t(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function C2(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&jl.call(t.properties,a)){const i=A2(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&y2.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function T2(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else js(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else js(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function Sl(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:h2;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=a.get(c)||0;o=c+"-"+u,a.set(c,u+1)}}const l=Hp(e,i,o);l!==void 0&&n.push(l)}return n}function A2(e,t,n){const r=LE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_E(n):zE(n)),r.property==="style"){let a=typeof n=="object"?n:I2(e,String(n));return e.stylePropertyNameCase==="css"&&(a=D2(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?DE[r.property]||r.property:r.attribute,n]}}function I2(e,t){try{return f2(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new ut("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Yp+"#cannot-parse-style-attribute",a}}function Gp(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const l=Vu(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=Vu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return jl.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);js(e)}function js(e,t){const n=new ut("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Yp+"#cannot-handle-mdx-estrees-without-createevaluater",n}function D2(e){const t={};let n;for(n in e)jl.call(e,n)&&(t[P2(n)]=e[n]);return t}function P2(e){let t=e.replace(g2,M2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function M2(e){return"-"+e.toLowerCase()}const Ai={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},L2={};function El(e,t){const n=L2,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Xp(e,r,a)}function Xp(e,t,n){if(O2(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Zu(e.children,t,n)}return Array.isArray(e)?Zu(e,t,n):""}function Zu(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Xp(e[a],t,n);return r.join("")}function O2(e){return!!(e&&typeof e=="object")}const ed=document.createElement("i");function Cl(e){const t="&"+e+";";ed.innerHTML=t;const n=ed.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function St(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Tt(e,t){return e.length>0?(St(e,e.length,0,t),e):t}const td={}.hasOwnProperty;function Kp(e){const t={};let n=-1;for(;++n<e.length;)R2(t,e[n]);return t}function R2(e,t){let n;for(n in t){const a=(td.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){td.call(a,o)||(a[o]=[]);const l=i[o];F2(a[o],Array.isArray(l)?l:l?[l]:[])}}}function F2(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);St(e,0,0,r)}function Jp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Vt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mt=Pn(/[A-Za-z]/),lt=Pn(/[\dA-Za-z]/),z2=Pn(/[#-'*+\--9=?A-Z^-~]/);function Sa(e){return e!==null&&(e<32||e===127)}const Po=Pn(/\d/),$2=Pn(/[\dA-Fa-f]/),B2=Pn(/[!-/:-@[-`{-~]/);function ce(e){return e!==null&&e<-2}function Fe(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const Xa=Pn(new RegExp("\\p{P}|\\p{S}","u")),tr=Pn(/\s/);function Pn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Br(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&lt(e.charCodeAt(n+1))&&lt(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Ae(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ne(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ne(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const V2={tokenize:U2};function U2(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ae(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ce(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const W2={tokenize:Y2},nd={tokenize:H2};function Y2(e){const t=this,n=[];let r=0,a,i,o;return l;function l(v){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,c,u)(v)}return u(v)}function c(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&j();const C=t.events.length;let T=C,S;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){S=t.events[T][1].end;break}y(r);let E=C;for(;E<t.events.length;)t.events[E][1].end={...S},E++;return St(t.events,T+1,0,t.events.slice(C)),t.events.length=E,u(v)}return l(v)}function u(v){if(r===n.length){if(!a)return p(v);if(a.currentConstruct&&a.currentConstruct.concrete)return g(v);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nd,d,m)(v)}function d(v){return a&&j(),y(r),p(v)}function m(v){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(v)}function p(v){return t.containerState={},e.attempt(nd,f,g)(v)}function f(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function g(v){if(v===null){a&&j(),y(0),e.consume(v);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),x(v)}function x(v){if(v===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(v);return}return ce(v)?(e.consume(v),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(v),x)}function b(v,C){const T=t.sliceStream(v);
vendor: 10,252 bytes, line 588
588if(C&&T.push(null),v.previous=i,i&&(i.next=v),i=v,a.defineSkip(v.start),a.write(T),t.parser.lazy[v.start.line]){let S=a.events.length;for(;S--;)if(a.events[S][1].start.offset<o&&(!a.events[S][1].end||a.events[S][1].end.offset>o))return;const E=t.events.length;let B=E,P,N;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(P){N=t.events[B][1].end;break}P=!0}for(y(r),S=E;S<t.events.length;)t.events[S][1].end={...N},S++;St(t.events,B+1,0,t.events.slice(E)),t.events.length=S}}function y(v){let C=n.length;for(;C-- >v;){const T=n[C];t.containerState=T[1],T[0].exit.call(t,e)}n.length=v}function j(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function H2(e,t,n){return Ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ar(e){if(e===null||Fe(e)||tr(e))return 1;if(Xa(e))return 2}function Ka(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Mo={name:"attention",resolveAll:q2,tokenize:G2};function q2(e,t){let n=-1,r,a,i,o,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},p={...e[n][1].start};rd(m,-c),rd(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Tt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Tt(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Tt(u,Ka(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Tt(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Tt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,St(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function G2(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ar(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Ar(c),m=!d||d===2&&a||n.includes(c),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!p)),u._close=!!(i===42?p:p&&(d||!m)),t(c)}}function rd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const X2={name:"autolink",tokenize:K2};function K2(e,t,n){let r=0;return a;function a(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return mt(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||lt(f)?(r=1,l(f)):u(f)}function l(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||lt(f))&&r++<32?(e.consume(f),l):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Sa(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):z2(f)?(e.consume(f),u):n(f)}function d(f){return lt(f)?m(f):n(f)}function m(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||lt(f))&&r++<63){const g=f===45?p:m;return e.consume(f),g}return n(f)}}const Os={partial:!0,tokenize:J2};function J2(e,t,n){return r;function r(i){return Ne(i)?Ae(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ce(i)?t(i):n(i)}}const Qp={continuation:{tokenize:Z2},exit:eC,name:"blockQuote",tokenize:Q2};function Q2(e,t,n){const r=this;return a;function a(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ne(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Z2(e,t,n){const r=this;return a;function a(o){return Ne(o)?Ae(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Qp,t,n)(o)}}function eC(e){e.exit("blockQuote")}const Zp={name:"characterEscape",tokenize:tC};function tC(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return B2(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const eh={name:"characterReference",tokenize:nC};function nC(e,t,n){const r=this;let a=0,i,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=lt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=$2,d):(e.enter("characterReferenceValue"),i=7,o=Po,d(m))}function d(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return o===lt&&!Cl(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&a++<i?(e.consume(m),d):n(m)}}const sd={partial:!0,tokenize:sC},ad={concrete:!0,name:"codeFenced",tokenize:rC};function rC(e,t,n){const r=this,a={partial:!0,tokenize:T};let i=0,o=0,l;return c;function c(S){return u(S)}function u(S){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===l?(o++,e.consume(S),d):o<3?n(S):(e.exit("codeFencedFenceSequence"),Ne(S)?Ae(e,m,"whitespace")(S):m(S))}function m(S){return S===null||ce(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(sd,x,C)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||ce(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(S)):Ne(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ae(e,f,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),p)}function f(S){return S===null||ce(S)?m(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||ce(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(S)):S===96&&S===l?n(S):(e.consume(S),g)}function x(S){return e.attempt(a,C,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return i>0&&Ne(S)?Ae(e,j,"linePrefix",i+1)(S):j(S)}function j(S){return S===null||ce(S)?e.check(sd,x,C)(S):(e.enter("codeFlowValue"),v(S))}function v(S){return S===null||ce(S)?(e.exit("codeFlowValue"),j(S)):(e.consume(S),v)}function C(S){return e.exit("codeFenced"),t(S)}function T(S,E,B){let P=0;return N;function N(V){return S.enter("lineEnding"),S.consume(V),S.exit("lineEnding"),L}function L(V){return S.enter("codeFencedFence"),Ne(V)?Ae(S,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):_(V)}function _(V){return V===l?(S.enter("codeFencedFenceSequence"),D(V)):B(V)}function D(V){return V===l?(P++,S.consume(V),D):P>=o?(S.exit("codeFencedFenceSequence"),Ne(V)?Ae(S,A,"whitespace")(V):A(V)):B(V)}function A(V){return V===null||ce(V)?(S.exit("codeFencedFence"),E(V)):B(V)}}}function sC(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Ii={name:"codeIndented",tokenize:iC},aC={partial:!0,tokenize:oC};function iC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ae(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):ce(u)?e.attempt(aC,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ce(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function oC(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):Ae(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):ce(o)?a(o):n(o)}}const lC={name:"codeText",previous:uC,resolve:cC,tokenize:dC};function cC(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function uC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dC(e,t,n){let r=0,a,i;return o;
vendor: 6,005 bytes, line 588
588function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),r++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):ce(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ce(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class mC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Qr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qr(this.left,n.reverse())}}}function Qr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function th(e){const t={};let n=-1,r,a,i,o,l,c,u;const d=new mC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,fC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},l=d.slice(a,n),l.unshift(r),d.splice(a,n-a+1,l))}}return St(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function fC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,m,p=-1,f=n,g=0,x=0;const b=[x];for(;f;){for(;e.get(++a)[1]!==f;);i.push(a),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),m&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=f,f=f.next}for(f=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(x=p+1,b.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):b.pop(),p=b.length;p--;){const y=l.slice(b[p],b[p+1]),j=i.pop();c.push([j,j+y.length-1]),e.splice(j,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const pC={resolve:gC,tokenize:xC},hC={partial:!0,tokenize:yC};function gC(e){return th(e),e}function xC(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):ce(l)?e.check(hC,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function yC(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ae(e,i,"linePrefix")}function i(o){if(o===null||ce(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function nh(e,t,n,r,a,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return m;function m(y){return y===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||Sa(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||ce(y)?n(y):(e.consume(y),y===92?g:f)}function g(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function x(y){return!d&&(y===null||y===41||Fe(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,x):y===41?(e.consume(y),d--,x):y===null||y===32||y===40||Sa(y)?n(y):(e.consume(y),y===92?b:x)}
vendor: 16,133 bytes, line 588
588function b(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function rh(e,t,n,r,a,i){const o=this;let l=0,c;return u;function u(f){return e.enter(r),e.enter(a),e.consume(f),e.exit(a),e.enter(i),d}function d(f){return l>999||f===null||f===91||f===93&&!c||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(a),e.consume(f),e.exit(a),e.exit(r),t):ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(f))}function m(f){return f===null||f===91||f===93||ce(f)||l++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!Ne(f)),f===92?p:m)}function p(f){return f===91||f===92||f===93?(e.consume(f),l++,m):m(f)}}function sh(e,t,n,r,a,i){let o;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ae(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===o||p===null||ce(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:d)}function m(p){return p===o||p===92?(e.consume(p),d):d(p)}}function ps(e,t){let n;return r;function r(a){return ce(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ne(a)?Ae(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const bC={name:"definition",tokenize:wC},vC={partial:!0,tokenize:kC};function wC(e,t,n){const r=this;let a;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return rh.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return a=Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Fe(f)?ps(e,u)(f):u(f)}function u(f){return nh(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(vC,m,m)(f)}function m(f){return Ne(f)?Ae(e,p,"whitespace")(f):p(f)}function p(f){return f===null||ce(f)?(e.exit("definition"),r.parser.defined.push(a),t(f)):n(f)}}function kC(e,t,n){return r;function r(l){return Fe(l)?ps(e,a)(l):n(l)}function a(l){return sh(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ne(l)?Ae(e,o,"whitespace")(l):o(l)}function o(l){return l===null||ce(l)?t(l):n(l)}}const _C={name:"hardBreakEscape",tokenize:jC};function jC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ce(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const NC={name:"headingAtx",resolve:SC,tokenize:EC};function SC(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},St(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function EC(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Fe(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||ce(d)?(e.exit("atxHeading"),t(d)):Ne(d)?Ae(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Fe(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const CC=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],id=["pre","script","style","textarea"],TC={concrete:!0,name:"htmlFlow",resolveTo:DC,tokenize:PC},AC={partial:!0,tokenize:LC},IC={partial:!0,tokenize:MC};function DC(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function PC(e,t,n){const r=this;let a,i,o,l,c;return u;function u(w){return d(w)}function d(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),m}function m(w){return w===33?(e.consume(w),p):w===47?(e.consume(w),i=!0,x):w===63?(e.consume(w),a=3,r.interrupt?t:k):mt(w)?(e.consume(w),o=String.fromCharCode(w),b):n(w)}function p(w){return w===45?(e.consume(w),a=2,f):w===91?(e.consume(w),a=5,l=0,g):mt(w)?(e.consume(w),a=4,r.interrupt?t:k):n(w)}function f(w){return w===45?(e.consume(w),r.interrupt?t:k):n(w)}function g(w){const te="CDATA[";return w===te.charCodeAt(l++)?(e.consume(w),l===te.length?r.interrupt?t:_:g):n(w)}function x(w){return mt(w)?(e.consume(w),o=String.fromCharCode(w),b):n(w)}function b(w){if(w===null||w===47||w===62||Fe(w)){const te=w===47,W=o.toLowerCase();return!te&&!i&&id.includes(W)?(a=1,r.interrupt?t(w):_(w)):CC.includes(o.toLowerCase())?(a=6,te?(e.consume(w),y):r.interrupt?t(w):_(w)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(w):i?j(w):v(w))}return w===45||lt(w)?(e.consume(w),o+=String.fromCharCode(w),b):n(w)}function y(w){return w===62?(e.consume(w),r.interrupt?t:_):n(w)}function j(w){return Ne(w)?(e.consume(w),j):N(w)}function v(w){return w===47?(e.consume(w),N):w===58||w===95||mt(w)?(e.consume(w),C):Ne(w)?(e.consume(w),v):N(w)}function C(w){return w===45||w===46||w===58||w===95||lt(w)?(e.consume(w),C):T(w)}function T(w){return w===61?(e.consume(w),S):Ne(w)?(e.consume(w),T):v(w)}function S(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),c=w,E):Ne(w)?(e.consume(w),S):B(w)}function E(w){return w===c?(e.consume(w),c=null,P):w===null||ce(w)?n(w):(e.consume(w),E)}function B(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||Fe(w)?T(w):(e.consume(w),B)}function P(w){return w===47||w===62||Ne(w)?v(w):n(w)}function N(w){return w===62?(e.consume(w),L):n(w)}function L(w){return w===null||ce(w)?_(w):Ne(w)?(e.consume(w),L):n(w)}function _(w){return w===45&&a===2?(e.consume(w),J):w===60&&a===1?(e.consume(w),O):w===62&&a===4?(e.consume(w),H):w===63&&a===3?(e.consume(w),k):w===93&&a===5?(e.consume(w),F):ce(w)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(AC,R,D)(w)):w===null||ce(w)?(e.exit("htmlFlowData"),D(w)):(e.consume(w),_)}function D(w){return e.check(IC,A,R)(w)}function A(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),V}function V(w){return w===null||ce(w)?D(w):(e.enter("htmlFlowData"),_(w))}function J(w){return w===45?(e.consume(w),k):_(w)}function O(w){return w===47?(e.consume(w),o="",z):_(w)}function z(w){if(w===62){const te=o.toLowerCase();return id.includes(te)?(e.consume(w),H):_(w)}return mt(w)&&o.length<8?(e.consume(w),o+=String.fromCharCode(w),z):_(w)}function F(w){return w===93?(e.consume(w),k):_(w)}function k(w){return w===62?(e.consume(w),H):w===45&&a===2?(e.consume(w),k):_(w)}function H(w){return w===null||ce(w)?(e.exit("htmlFlowData"),R(w)):(e.consume(w),H)}function R(w){return e.exit("htmlFlow"),t(w)}}function MC(e,t,n){const r=this;return a;function a(o){return ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function LC(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Os,t,n)}}const OC={name:"htmlText",tokenize:RC};function RC(e,t,n){const r=this;let a,i,o;return l;function l(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),T):k===63?(e.consume(k),v):mt(k)?(e.consume(k),B):n(k)}function u(k){return k===45?(e.consume(k),d):k===91?(e.consume(k),i=0,g):mt(k)?(e.consume(k),j):n(k)}function d(k){return k===45?(e.consume(k),f):n(k)}function m(k){return k===null?n(k):k===45?(e.consume(k),p):ce(k)?(o=m,O(k)):(e.consume(k),m)}function p(k){return k===45?(e.consume(k),f):m(k)}function f(k){return k===62?J(k):k===45?p(k):m(k)}function g(k){const H="CDATA[";return k===H.charCodeAt(i++)?(e.consume(k),i===H.length?x:g):n(k)}function x(k){return k===null?n(k):k===93?(e.consume(k),b):ce(k)?(o=x,O(k)):(e.consume(k),x)}function b(k){return k===93?(e.consume(k),y):x(k)}function y(k){return k===62?J(k):k===93?(e.consume(k),y):x(k)}function j(k){return k===null||k===62?J(k):ce(k)?(o=j,O(k)):(e.consume(k),j)}function v(k){return k===null?n(k):k===63?(e.consume(k),C):ce(k)?(o=v,O(k)):(e.consume(k),v)}function C(k){return k===62?J(k):v(k)}function T(k){return mt(k)?(e.consume(k),S):n(k)}function S(k){return k===45||lt(k)?(e.consume(k),S):E(k)}function E(k){return ce(k)?(o=E,O(k)):Ne(k)?(e.consume(k),E):J(k)}function B(k){return k===45||lt(k)?(e.consume(k),B):k===47||k===62||Fe(k)?P(k):n(k)}function P(k){return k===47?(e.consume(k),J):k===58||k===95||mt(k)?(e.consume(k),N):ce(k)?(o=P,O(k)):Ne(k)?(e.consume(k),P):J(k)}function N(k){return k===45||k===46||k===58||k===95||lt(k)?(e.consume(k),N):L(k)}function L(k){return k===61?(e.consume(k),_):ce(k)?(o=L,O(k)):Ne(k)?(e.consume(k),L):P(k)}function _(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),a=k,D):ce(k)?(o=_,O(k)):Ne(k)?(e.consume(k),_):(e.consume(k),A)}function D(k){return k===a?(e.consume(k),a=void 0,V):k===null?n(k):ce(k)?(o=D,O(k)):(e.consume(k),D)}function A(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||Fe(k)?P(k):(e.consume(k),A)}function V(k){return k===47||k===62||Fe(k)?P(k):n(k)}function J(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function O(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),z}function z(k){return Ne(k)?Ae(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):F(k)}function F(k){return e.enter("htmlTextData"),o(k)}}const Tl={name:"labelEnd",resolveAll:BC,resolveTo:VC,tokenize:UC},FC={tokenize:WC},zC={tokenize:YC},$C={tokenize:HC};function BC(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&St(e,0,e.length,n),e}function VC(e,t){let n=e.length,r=0,a,i,o,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Tt(l,e.slice(i+1,i+r+3)),l=Tt(l,[["enter",d,t]]),l=Tt(l,Ka(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Tt(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Tt(l,e.slice(o+1)),l=Tt(l,[["exit",c,t]]),St(e,i,e.length,l),e}function UC(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return l;function l(p){return i?i._inactive?m(p):(o=r.parser.defined.includes(Vt(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(FC,d,o?d:m)(p):p===91?e.attempt(zC,d,o?u:m)(p):o?d(p):m(p)}function u(p){return e.attempt($C,d,m)(p)}function d(p){return t(p)}function m(p){return i._balanced=!0,n(p)}}function WC(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Fe(m)?ps(e,i)(m):i(m)}function i(m){return m===41?d(m):nh(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return Fe(m)?ps(e,c)(m):d(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?sh(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return Fe(m)?ps(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function YC(e,t,n){const r=this;return a;function a(l){return rh.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function HC(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const qC={name:"labelStartImage",resolveAll:Tl.resolveAll,tokenize:GC};function GC(e,t,n){const r=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const XC={name:"labelStartLink",resolveAll:Tl.resolveAll,tokenize:KC};function KC(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Di={name:"lineEnding",tokenize:JC};function JC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ae(e,t,"linePrefix")}}const ma={name:"thematicBreak",tokenize:QC};function QC(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,l(u)}function l(u){return u===a?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||ce(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ne(u)?Ae(e,l,"whitespace")(u):l(u))}}const ht={continuation:{tokenize:nT},exit:sT,name:"list",tokenize:tT},ZC={partial:!0,tokenize:aT},eT={partial:!0,tokenize:rT};function tT(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Po(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(ma,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return Po(f)&&++o<10?(e.consume(f),c):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Os,r.interrupt?n:d,e.attempt(ZC,p,m))}
vendor: 5,359 bytes, line 588
588function d(f){return r.containerState.initialBlankLine=!0,i++,p(f)}function m(f){return Ne(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function nT(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Os,a,i);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ae(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ne(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(eT,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ae(e,e.attempt(ht,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function rT(e,t,n){const r=this;return Ae(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function sT(e){e.exit(this.containerState.type)}function aT(e,t,n){const r=this;return Ae(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!Ne(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const od={name:"setextUnderline",resolveTo:iT,tokenize:oT};function iT(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function oT(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===a?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ne(u)?Ae(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ce(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const lT={tokenize:cT};function cT(e){const t=this,n=e.attempt(Os,r,e.attempt(this.parser.constructs.flowInitial,a,Ae(e,e.attempt(this.parser.constructs.flow,a,e.attempt(pC,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const uT={resolveAll:ih()},dT=ah("string"),mT=ah("text");function ah(e){return{resolveAll:ih(e==="text"?fT:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const m=a[d];let p=-1;if(m)for(;++p<m.length;){const f=m[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function ih(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function fT(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,l=0,c;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const pT={42:ht,43:ht,45:ht,48:ht,49:ht,50:ht,51:ht,52:ht,53:ht,54:ht,55:ht,56:ht,57:ht,62:Qp},hT={91:bC},gT={[-2]:Ii,[-1]:Ii,32:Ii},xT={35:NC,42:ma,45:[od,ma],60:TC,61:od,95:ma,96:ad,126:ad},yT={38:eh,92:Zp},bT={[-5]:Di,[-4]:Di,[-3]:Di,33:qC,38:eh,42:Mo,60:[X2,OC],91:XC,92:[_C,Zp],93:Tl,95:Mo,96:lC},vT={null:[Mo,uT]},wT={null:[42,95]},kT={null:[]},_T=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wT,contentInitial:hT,disable:kT,document:pT,flow:xT,flowInitial:gT,insideSpan:vT,string:yT,text:bT},Symbol.toStringTag,{value:"Module"}));function jT(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,c
vendor: 14,578 bytes, lines 588-590
588olumn:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:E(T),check:E(S),consume:j,enter:v,exit:C,interrupt:E(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:m};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function m(L){return o=Tt(o,L),b(),o[o.length-1]!==null?[]:(B(t,0),u.events=Ka(i,u.events,u),u.events)}function p(L,_){return ST(f(L),_)}function f(L){return NT(o,L)}function g(){const{_bufferIndex:L,_index:_,line:D,column:A,offset:V}=r;return{_bufferIndex:L,_index:_,line:D,column:A,offset:V}}function x(L){a[L.line]=L.column,N()}function b(){let L;for(;r._index<o.length;){const _=o[r._index];if(typeof _=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<_.length;)y(_.charCodeAt(r._bufferIndex));else y(_)}}function y(L){d=d(L)}function j(L){ce(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,N()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function v(L,_){const D=_||{};return D.type=L,D.start=g(),u.events.push(["enter",D,u]),l.push(D),D}function C(L){const _=l.pop();return _.end=g(),u.events.push(["exit",_,u]),_}function T(L,_){B(L,_.from)}function S(L,_){_.restore()}function E(L,_){return D;function D(A,V,J){let O,z,F,k;return Array.isArray(A)?R(A):"tokenize"in A?R([A]):H(A);function H(U){return K;function K(ie){const ne=ie!==null&&U[ie],ue=ie!==null&&U.null,pe=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return R(pe)(ie)}}function R(U){return O=U,z=0,U.length===0?J:w(U[z])}function w(U){return K;function K(ie){return k=P(),F=U,U.partial||(u.currentConstruct=U),U.name&&u.parser.constructs.disable.null.includes(U.name)?W():U.tokenize.call(_?Object.assign(Object.create(u),_):u,c,te,W)(ie)}}function te(U){return L(F,k),V}function W(U){return k.restore(),++z<O.length?w(O[z]):J}}}function B(L,_){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&St(u.events,_,u.events.length-_,L.resolve(u.events.slice(_),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function P(){const L=g(),_=u.previous,D=u.currentConstruct,A=u.events.length,V=Array.from(l);return{from:A,restore:J};function J(){r=L,u.previous=_,u.currentConstruct=D,u.events.length=A,l=V,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function NT(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function ST(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
589`;break}case-3:{o=`\r
590`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function ET(e){const r={constructs:Kp([_T,...(e||{}).extensions||[]]),content:a(V2),defined:[],document:a(W2),flow:a(lT),lazy:{},string:a(dT),text:a(mT)};return r;function a(i){return o;function o(l){return jT(r,i,l)}}}function CT(e){for(;!th(e););return e}const ld=/[\0\t\n\r]/g;function TT(){let e=1,t="",n=!0,r;return a;function a(i,o,l){const c=[];let u,d,m,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(ld.lastIndex=m,u=ld.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.slice(m);break}if(f===10&&m===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),m<p&&(c.push(i.slice(m,p)),e+=p-m),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}m=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const AT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IT(e){return e.replace(AT,DT)}function DT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Jp(n.slice(i?2:1),i?16:10)}return Cl(n)||e}const oh={}.hasOwnProperty;function PT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),MT(n)(CT(ET(n).document().write(TT()(e,t,!0))))}function MT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(_e),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(ae),blockQuote:i(ue),characterEscape:P,characterReference:P,codeFenced:i(pe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(pe,o),codeText:i(X,o),codeTextData:P,data:P,codeFlowValue:P,definition:i(ve),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Q),hardBreakEscape:i(q),hardBreakTrailing:i(q),htmlFlow:i(oe,o),htmlFlowData:P,htmlText:i(oe,o),htmlTextData:P,image:i(De),label:o,link:i(_e),listItem:i(at),listItemValue:p,listOrdered:i(We,m),listUnordered:i(We),paragraph:i(rt),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ae),strong:i(tt),thematicBreak:i(Ge)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:ne,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:U,characterReference:K,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:c(y),codeText:c(V),codeTextData:N,data:N,definition:c(),definitionDestinationString:C,definitionLabelString:j,definitionTitleString:v,emphasis:c(),hardBreakEscape:c(_),hardBreakTrailing:c(_),htmlFlow:c(D),htmlFlowData:N,htmlText:c(A),htmlTextData:N,image:c(O),label:F,labelText:z,lineEnding:L,link:c(J),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:k,resourceTitleString:H,resource:R,setextHeading:c(B),setextHeadingLineSequence:E,setextHeadingText:S,strong:c(),thematicBreak:c()}};lh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(I){let Y={type:"root",children:[]};const de={stack:[Y],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},we=[];let je=-1;for(;++je<I.length;)if(I[je][1].type==="listOrdered"||I[je][1].type==="listUnordered")if(I[je][0]==="enter")we.push(je);else{const le=we.pop();je=a(I,le,je)}for(je=-1;++je<I.length;){const le=t[I[je][0]];oh.call(le,I[je][1].type)&&le[I[je][1].type].call(Object.assign({sliceSerialize:I[je][2].sliceSerialize},de),I[je][1])}if(de.tokenStack.length>0){const le=de.tokenStack[de.tokenStack.length-1];(le[1]||cd).call(de,void 0,le[0])}for(Y.position={start:Nn(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:Nn(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)Y=t.transforms[je](Y)||Y;return Y}function a(I,Y,de){let we=Y-1,je=-1,le=!1,Le,Se,Xe,it;for(;++we<=de;){const He=I[we];switch(He[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{He[0]==="enter"?je++:je--,it=void 0;break}case"lineEndingBlank":{He[0]==="enter"&&(Le&&!it&&!je&&!Xe&&(Xe=we),it=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:it=void 0}if(!je&&He[0]==="enter"&&He[1].type==="listItemPrefix"||je===-1&&He[0]==="exit"&&(He[1].type==="listUnordered"||He[1].type==="listOrdered")){if(Le){let Et=we;for(Se=void 0;Et--;){const wt=I[Et];if(wt[1].type==="lineEnding"||wt[1].type==="lineEndingBlank"){if(wt[0]==="exit")continue;Se&&(I[Se][1].type="lineEndingBlank",le=!0),wt[1].type="lineEnding",Se=Et}else if(!(wt[1].type==="linePrefix"||wt[1].type==="blockQuotePrefix"||wt[1].type==="blockQuotePrefixWhitespace"||wt[1].type==="blockQuoteMarker"||wt[1].type==="listItemIndent"))break}Xe&&(!Se||Xe<Se)&&(Le._spread=!0),Le.end=Object.assign({},Se?I[Se][1].start:He[1].end),I.splice(Se||we,0,["exit",Le,He[2]]),we++,de++}if(He[1].type==="listItemPrefix"){const Et={type:"listItem",_spread:!1,start:Object.assign({},He[1].start),end:void 0};Le=Et,I.splice(we,0,["enter",Et,He[2]]),we++,de++,Xe=void 0,it=!0}}}return I[Y][1]._spread=le,de}function i(I,Y){return de;function de(we){l.call(this,I(we),we),Y&&Y.call(this,we)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(I,Y,de){this.stack[this.stack.length-1].children.push(I),this.stack.push(I),this.tokenStack.push([Y,de||void 0]),I.position={start:Nn(Y.start),end:void 0}}function c(I){return Y;function Y(de){I&&I.call(this,de),u.call(this,de)}}function u(I,Y){const de=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==I.type&&(Y?Y.call(this,I,we[0]):(we[1]||cd).call(this,I,we[0]));else throw new Error("Cannot close `"+I.type+"` ("+fs({start:I.start,end:I.end})+"): it’s not open");de.position.end=Nn(I.end)}function d(){return El(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(I){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(I),10),this.data.expectingFirstListItemValue=void 0}}function f(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=I}function g(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=I}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I.replace(/(\r?\n|\r)$/g,"")}function j(I){const Y=this.resume(),de=this.stack[this.stack.length-1];de.label=Y,de.identifier=Vt(this.sliceSerialize(I)).toLowerCase()}function v(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.title=I}function C(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.url=I}function T(I){const Y=this.stack[this.stack.length-1];if(!Y.depth){const de=this.sliceSerialize(I).length;Y.depth=de}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function E(I){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(I).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function P(I){const de=this.stack[this.stack.length-1].children;let we=de[de.length-1];(!we||we.type!=="text")&&(we=Je(),we.position={start:Nn(I.start),end:void 0},de.push(we)),this.stack.push(we)}function N(I){const Y=this.stack.pop();Y.value+=this.sliceSerialize(I),Y.position.end=Nn(I.end)}function L(I){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const de=Y.children[Y.children.length-1];de.position.end=Nn(I.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(P.call(this,I),N.call(this,I))}function _(){this.data.atHardBreak=!0}function D(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function A(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function V(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function J(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=Y,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function O(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=Y,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function z(I){const Y=this.sliceSerialize(I),de=this.stack[this.stack.length-2];de.label=IT(Y),de.identifier=Vt(Y).toLowerCase()}function F(){const I=this.stack[this.stack.length-1],Y=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){const we=I.children;de.children=we}else de.alt=Y}function k(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.url=I}function H(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.title=I}function R(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function te(I){const Y=this.resume(),de=this.stack[this.stack.length-1];de.label=Y,de.identifier=Vt(this.sliceSerialize(I)).toLowerCase(),this.data.referenceType="full"}function W(I){this.data.characterReferenceType=I.type}function U(I){const Y=this.sliceSerialize(I),de=this.data.characterReferenceType;let we;de?(we=Jp(Y,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=Cl(Y);const je=this.stack[this.stack.length-1];je.value+=we}function K(I){const Y=this.stack.pop();Y.position.end=Nn(I.end)}function ie(I){N.call(this,I);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(I)}function ne(I){N.call(this,I);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(I)}function ue(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function X(){return{type:"inlineCode",value:""}}function ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Q(){return{type:"emphasis",children:[]}}function ae(){return{type:"heading",depth:0,children:[]}}function q(){return{type:"break"}}function oe(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function _e(){return{type:"link",title:null,url:"",children:[]}}function We(I){return{type:"list",ordered:I.type==="listOrdered",start:null,spread:I._spread,children:[]}}function at(I){return{type:"listItem",spread:I._spread,checked:null,children:[]}}function rt(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function Je(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function Nn(e){return{line:e.line,column:e.column,offset:e.offset}}function lh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?lh(e,r):LT(e,r)}}function LT(e,t){let n;for(n in t)if(oh.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function cd(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+fs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+fs({start:t.start,end:t.end}
vendor: 4,516 bytes, lines 590-594
590)+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+fs({start:t.start,end:t.end})+") is still open")}function OT(e){const t=this;t.parser=n;function n(r){return PT(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function RT(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function FT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
591`}]}function zT(e,t){const n=t.value?t.value+`
592`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function $T(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Br(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function UT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function WT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ch(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=r:a.push({type:"text",value:r}),a}function YT(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ch(e,t);const a={src:Br(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function HT(e,t){const n={src:Br(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function qT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function GT(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ch(e,t);const a={href:Br(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function XT(e,t){const n={href:Br(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function KT(e,t,n){const r=e.all(t),a=n?JT(n):uh(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let m;d&&d.type==="element"&&d.tagName==="p"?m=d:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(a||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
593`}),d.type==="element"&&d.tagName==="p"&&!a?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
594`});const u={type:"element",tagName:"li",properties:i,children:o};
vendor: 3,230 bytes, line 594
594return e.patch(t,u),e.applyData(t,u)}function JT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=uh(n[r])}return t}function uh(e){const t=e.spread;return t??e.children.length>1}function QT(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const o=r[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function ZT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function e5(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function t5(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function n5(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=_l(t.children[1]),c=Up(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function r5(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const m=t.children[c],p={},f=o?o[c]:void 0;f&&(p.align=f);let g={type:"element",tagName:i,properties:p,children:[]};m&&(g.children=e.all(m),e.patch(m,g),g=e.applyData(m,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function s5(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ud=9,dd=32;function a5(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(md(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(md(t.slice(a),a>0,!1)),i.join("")}function md(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===ud||i===dd;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===ud||i===dd;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function i5(e,t){const n={type:"text",value:a5(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function o5(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const l5={blockquote:RT,break:FT,code:zT,delete:$T,emphasis:BT,footnoteReference:VT,heading:UT,html:WT,imageReference:YT,image:HT,inlineCode:qT,linkReference:GT,link:XT,listItem:KT,list:QT,paragraph:ZT,root:e5,strong:t5,table:n5,tableCell:s5,tableRow:r5,text:i5,thematicBreak:o5,toml:Qs,yaml:Qs,definition:Qs,footnoteDefinition:Qs};function Qs(){}const dh=-1,Ja=0,hs=1,Ea=2,Al=3,Il=4,Dl=5,Pl=6,mh=7,fh=8,c5=typeof self=="object"?self:globalThis,fd=(e,t)=>
vendor: 4,493 bytes, line 594
594{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new c5[e](t)},u5=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,o]=t[a];switch(i){case Ja:case dh:return n(o,a);case hs:{const l=n([],a);for(const c of o)l.push(r(c));return l}case Ea:{const l=n({},a);for(const[c,u]of o)l[r(c)]=r(u);return l}case Al:return n(new Date(o),a);case Il:{const{source:l,flags:c}=o;return n(new RegExp(l,c),a)}case Dl:{const l=n(new Map,a);for(const[c,u]of o)l.set(r(c),r(u));return l}case Pl:{const l=n(new Set,a);for(const c of o)l.add(r(c));return l}case mh:{const{name:l,message:c}=o;return n(fd(l,c),a)}case fh:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(fd(i,o),a)};return r},pd=e=>u5(new Map,e)(0),hr="",{toString:d5}={},{keys:m5}=Object,Zr=e=>{const t=typeof e;if(t!=="object"||!e)return[Ja,t];const n=d5.call(e).slice(8,-1);switch(n){case"Array":return[hs,hr];case"Object":return[Ea,hr];case"Date":return[Al,hr];case"RegExp":return[Il,hr];case"Map":return[Dl,hr];case"Set":return[Pl,hr];case"DataView":return[hs,n]}return n.includes("Array")?[hs,n]:n.includes("Error")?[mh,n]:[Ea,n]},Zs=([e,t])=>e===Ja&&(t==="function"||t==="symbol"),f5=(e,t,n,r)=>{const a=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Zr(o);switch(l){case Ja:{let d=o;switch(c){case"bigint":l=fh,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([dh],o)}return a([l,d],o)}case hs:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),a([c,[...p]],o)}const d=[],m=a([l,d],o);for(const p of o)d.push(i(p));return m}case Ea:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],m=a([l,d],o);for(const p of m5(o))(e||!Zs(Zr(o[p])))&&d.push([i(p),i(o[p])]);return m}case Al:return a([l,o.toISOString()],o);case Il:{const{source:d,flags:m}=o;return a([l,{source:d,flags:m}],o)}case Dl:{const d=[],m=a([l,d],o);for(const[p,f]of o)(e||!(Zs(Zr(p))||Zs(Zr(f))))&&d.push([i(p),i(f)]);return m}case Pl:{const d=[],m=a([l,d],o);for(const p of o)(e||!Zs(Zr(p)))&&d.push(i(p));return m}}const{message:u}=o;return a([l,{name:c,message:u}],o)};return i},hd=(e,{json:t,lossy:n}={})=>{const r=[];return f5(!(t||n),!!t,new Map,r)(e),r},Ca=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pd(hd(e,t)):structuredClone(e):(e,t)=>pd(hd(e,t));function p5(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function h5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function g5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||p5,r=e.options.footnoteBackLabel||h5,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),m=String(u.identifier).toUpperCase(),p=Br(m.toLowerCase());let f=0;const g=[],x=e.footnoteCounts.get(m);for(;x!==void 0&&++f<=x;){g.length>0&&g.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,f);typeof j=="string"&&(j={type:"text",value:j}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const j=b.children[b.children.length-1];j&&j.type==="text"?j.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ca(o),id:"footnote-label"},children:[{type:"text",value:a}]}
vendor: 20,217 bytes, lines 594-600
594,{type:"text",value:`
595`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
596`}]}}const Qa=function(e){if(e==null)return v5;if(typeof e=="function")return Za(e);if(typeof e=="object")return Array.isArray(e)?x5(e):y5(e);if(typeof e=="string")return b5(e);throw new Error("Expected function, string, or object as test")};function x5(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Qa(e[n]);return Za(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function y5(e){const t=e;return Za(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function b5(e){return Za(t);function t(n){return n&&n.type===e}}function Za(e){return t;function t(n,r,a){return!!(w5(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function v5(){return!0}function w5(e){return e!==null&&typeof e=="object"&&"type"in e}const ph=[],k5=!0,Lo=!1,_5="skip";function hh(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=Qa(a),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const f=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=ph,g,x,b;if((!t||i(c,u,d[d.length-1]||void 0))&&(f=j5(n(c,d)),f[0]===Lo))return f;if("children"in c&&c.children){const y=c;if(y.children&&f[0]!==_5)for(x=(r?y.children.length:-1)+o,b=d.concat(y);x>-1&&x<y.children.length;){const j=y.children[x];if(g=l(j,x,b)(),g[0]===Lo)return g;x=typeof g[1]=="number"?g[1]:x+o}}return f}}}function j5(e){return Array.isArray(e)?e:typeof e=="number"?[k5,e]:e==null?ph:[e]}function Ml(e,t,n,r){let a,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,a=n):(i=t,o=n,a=r),hh(e,i,l,a);function l(c,u){const d=u[u.length-1],m=d?d.children.indexOf(c):void 0;return o(c,m,d)}}const Oo={}.hasOwnProperty,N5={};function S5(e,t){const n=t||N5,r=new Map,a=new Map,i=new Map,o={...l5,...n.handlers},l={all:u,applyData:C5,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:E5,wrap:A5};return Ml(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const m=d.type==="definition"?r:a,p=String(d.identifier).toUpperCase();m.has(p)||m.set(p,d)}}),l;function c(d,m){const p=d.type,f=l.handlers[p];if(Oo.call(l.handlers,p)&&f)return f(l,d,m);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in d){const{children:x,...b}=d,y=Ca(b);return y.children=l.all(d),y}return Ca(d)}return(l.options.unknownHandler||T5)(l,d,m)}function u(d){const m=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const g=l.one(p[f],d);if(g){if(f&&p[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=gd(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=gd(x.value))}Array.isArray(g)?m.push(...g):m.push(g)}}}return m}}function E5(e,t){e.position&&(t.position=p2(e))}function C5(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Ca(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function T5(e,t){const n=t.data||{},r="value"in t&&!(Oo.call(n,"hProperties")||Oo.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function A5(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
597`});++r<e.length;)r&&n.push({type:"text",value:`
598`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
599`}),n}function gd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xd(e,t){const n=S5(e,t),r=n.one(e,void 0),a=g5(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
600`},a),i}function I5(e,t){return e&&"run"in e?async function(n,r){const a=xd(n,{file:r,...t});await e.run(a,r)}:function(n,r){return xd(n,{file:r,...e||t})}}function yd(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,gh=Object.prototype.toString,bd=Object.defineProperty,vd=Object.getOwnPropertyDescriptor,wd=function(t){return typeof Array.isArray=="function"?Array.isArray(t):gh.call(t)==="[object Array]"},kd=function(t){if(!t||gh.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},_d=function(t,n){bd&&n.name==="__proto__"?bd(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},jd=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(vd)return vd(t,n).value}else return;return t[n]},D5=function e(){var t,n,r,a,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=jd(l,n),a=jd(t,n),l!==a&&(d&&a&&(kd(a)||(i=wd(a)))?(i?(i=!1,o=r&&wd(r)?r:[]):o=r&&kd(r)?r:{},_d(l,{name:n,newValue:e(d,o,a)})):typeof a<"u"&&_d(l,{name:n,newValue:a}));return l};const Pi=Qd(D5);function Ro(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function P5(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...u){const d=e[++i];let m=-1;if(c){o(c);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?M5(d,l)(...u):o(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function M5(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return a(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){n||(n=!0,t(o,...l))}function i(o){a(null,o)}}const Kt={basename:L5,dirname:O5,extname:R5,join:F5,sep:"/"};function L5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rs(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(r=a):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function O5(e){if(Rs(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function R5(e){Rs(e);let t=e.length,n=-1,r=0,a=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function F5(...e){let t=-1,n;for(;++t<e.length;)Rs(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":z5(n)}function z5(e){Rs(e);const t=e.codePointAt(0)===47;let n=$5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function $5(e,t){let n="",r=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",r=0,a=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),r=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Rs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const B5={cwd:V5};function V5(){return"/"}function Fo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function U5(e){if(typeof e=="string")e=new URL(e);else if(!Fo(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return W5(e)}function W5(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Mi=["history","path","basename","stem","extname","dirname"];class xh{constructor(t){let n;t?Fo(t)?n={path:t}:typeof t=="string"||Y5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":B5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mi.length;){const i=Mi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Mi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Kt.basename(this.path):void 0}set basename(t){Oi(t,"basename"),Li(t,"basename"),this.path=Kt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Kt.dirname(this.path):void 0}set dirname(t){Nd(this.basename,"dirname"),this.path=Kt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Kt.extname(this.path):void 0}set extname(t){if(Li(t,"extname"),Nd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fo(t)&&(t=U5(t)),Oi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Kt.basename(this.path,this.extname):void 0}set stem(t){Oi(t,"stem"),Li(t,"stem"),this.path=Kt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ut(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Li(e,t){if(e&&e.includes(Kt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Kt.sep+"`")}function Oi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Nd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Y5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const H5=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},q5={}.hasOwnProperty;class Ll extends H5{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=P5()}copy(){const t=new Ll;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Pi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(zi("data",this.frozen),this.namespace[t]=n,this):q5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(zi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ea(t),r=this.parser||this.Parser;return Ri("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ri("process",this.parser||this.Parser),Fi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=ea(t),c=r.parse(l);r.run(c,l,function(d,m,p){if(d||!m||!p)return u(d);const f=m,g=r.stringify(f,p);K5(g)?p.value=g:p.result=g,u(d,p)});function u(d,m){d||!m?o(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Ri("processSync",this.parser||this.Parser),Fi("processSync",this.compiler||this.Compiler),this.process(t,a),Ed("processSync","process",n),r;function a(i,o){n=!0,yd(i),r=o}}run(t,n,r){Sd(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=ea(n);a.run(t,c,u);function u(d,m,p){const f=m||t;d?l(d):o?o(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Ed("runSync","run",r),a;function i(o,l){yd(o),a=l,r=!0}}stringify(t,n){this.freeze();const r=ea(n),a=this.compiler||this.Compiler;return Fi("stringify",a),Sd(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(zi("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;c(d,m)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(a.settings=Pi(!0,a.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[f,...g]=d;const x=r[p][1];Ro(x)&&Ro(f)&&(f=Pi(!0,x,f)),r[p]=[u,f,...g]}}}}const G5=new Ll().freeze();function Ri(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zi(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sd(e){if(!Ro(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ed(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ea(e){return X5(e)?e:new xh(e)}function X5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function K5(e){return typeof e=="string"||J5(e)}function J5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Q5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Cd=[],Td={allowDangerousHtml:!0},Z5=/^(https?|ircs?|mailto|xmpp)$/i,eA=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function tA(e){const t=nA(e),n=rA(e);return sA(t.runSync(t.parse(n),n),e)}function nA(e){const t=e.rehypePlugins||Cd,n=e.remarkPlugins||Cd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Td}:Td;return G5().use(OT).use(n).use(I5,r).use(t)}function rA(e){const t=e.children||"",n=new xh;return typeof t=="string"&&(n.value=t),n}function sA(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||aA;for(const d of eA)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Q5+d.id,void 0);return Ml(e,u),b2(e,{Fragment:s.Fragment,components:a,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,m,p){if(d.type==="raw"&&p&&typeof m=="number")return o?p.children.splice(m,1):p.children[m]={type:"text",value:d.value},m;if(d.type==="element"){let f;for(f in Ai)if(Object.hasOwn(Ai,f)&&Object.hasOwn(d.properties,f)){const g=d.properties[f],x=Ai[f];(x===null||x.includes(d.tagName))&&(d.properties[f]=c(String(g||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!f&&r&&typeof m=="number"&&(f=!r(d,m,p)),f&&p&&typeof m=="number")return l&&d.children?p.children.splice(m,1,...d.children):p.children.splice(m,1),m}}}function aA(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||Z5.test(e.slice(0,t))?e:""}function Ad(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function iA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function oA(e,t,n){const a=Qa((n||{}).ignore||[]),i=lA(t);let o=-1;for(;++o<i.length;)hh(e,"text",l);function l(u,d){let m=-1,p;for(;++m<d.length;){const f=d[m],g=p?p.children:void 0;if(a(f,g?g.indexOf(f):void 0,p))return;p=f}if(p)return c(u,d)}function c(u,d){const m=d[d.length-1],p=i[o][0],f=i[o][1];let g=0;const b=m.children.indexOf(u);let y=!1,j=[];p.lastIndex=0;let v=p.exec(u.value);for(;v;){const C=v.index,T={index:v.index,input:v.input,stack:[...d,u]};let S=f(...v,T);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?p.lastIndex=C+1:(g!==C&&j.push({type:"text",value:u.value.slice(g,C)}),Array.isArray(S)?j.push(...S):S&&j.push(S),g=C+v[0].length,y=!0),!p.global)break;v=p.exec(u.value)}return y?(g<u.value.length&&j.push({type:"text",value:u.value.slice(g)}),m.children.splice(b,1,...j)):j=[u],b+j.length}}function lA(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([cA(a[0]),uA(a[1])])}return t}function cA(e){return typeof e=="string"?new RegExp(iA(e),"g"):e}function uA(e){return typeof e=="function"?e:function(){return e}}const $i="phrasing",Bi=["autolink","link","image","label"];
vendor: 6,200 bytes, lines 600-602
600function dA(){return{transforms:[yA],enter:{literalAutolink:fA,literalAutolinkEmail:Vi,literalAutolinkHttp:Vi,literalAutolinkWww:Vi},exit:{literalAutolink:xA,literalAutolinkEmail:gA,literalAutolinkHttp:pA,literalAutolinkWww:hA}}}function mA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$i,notInConstruct:Bi},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$i,notInConstruct:Bi},{character:":",before:"[ps]",after:"\\/",inConstruct:$i,notInConstruct:Bi}]}}function fA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vi(e){this.config.enter.autolinkProtocol.call(this,e)}function pA(e){this.config.exit.autolinkProtocol.call(this,e)}function hA(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function gA(e){this.config.exit.autolinkEmail.call(this,e)}function xA(e){this.exit(e)}function yA(e){oA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),vA]],{ignore:["link","linkReference"]})}function bA(e,t,n,r,a){let i="";if(!yh(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!wA(n)))return!1;const o=kA(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function vA(e,t,n,r){return!yh(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function wA(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function kA(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=Ad(e,"(");let i=Ad(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function yh(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||tr(n)||Xa(n))&&(!t||n!==47)}bh.peek=IA;function _A(){this.buffer()}function jA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function NA(){this.buffer()}function SA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function EA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CA(e){this.exit(e)}function TA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function AA(e){this.exit(e)}function IA(){return"["}function bh(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=a.move("]"),i}function DA(){return{enter:{gfmFootnoteCallString:_A,gfmFootnoteCall:jA,gfmFootnoteDefinitionLabelString:NA,gfmFootnoteDefinition:SA},exit:{gfmFootnoteCallString:EA,gfmFootnoteCall:CA,gfmFootnoteDefinitionLabelString:TA,gfmFootnoteDefinition:AA}}}function PA(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:bh},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
601`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?vh:MA))),u(),c}}function MA(e,t,n){return t===0?e:vh(e,t,n)}function vh(e,t,n){return(n?"":"    ")+e}const LA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];wh.peek=$A;function OA(){return{canContainEols:["delete"],enter:{strikethrough:FA},exit:{strikethrough:zA}}}function RA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:LA}],handlers:{delete:wh}}}function FA(e){this.enter({type:"delete",children:[]},e)}function zA(e){this.exit(e)}function wh(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function $A(){return"~"}function BA(e){return e.length}function VA(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||BA,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const x=[],b=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const j=UA(e[d][y]);if(n.alignDelimiters!==!1){const v=a(j);b[y]=v,(c[y]===void 0||v>c[y])&&(c[y]=v)}x.push(j)}o[d]=x,l[d]=b}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<u;)i[m]=Id(r[m]);else{const x=Id(r);for(;++m<u;)i[m]=x}m=-1;const p=[],f=[];for(;++m<u;){const x=i[m];let b="",y="";x===99?(b=":",y=":"):x===108?b=":":x===114&&(y=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[m]-b.length-y.length);const v=b+"-".repeat(j)+y;n.alignDelimiters!==!1&&(j=b.length+j+y.length,j>c[m]&&(c[m]=j),f[m]=j),p[m]=v}o.splice(1,0,p),l.splice(1,0,f),d=-1;const g=[];for(;++d<o.length;){const x=o[d],b=l[d];m=-1;const y=[];for(;++m<u;){const j=x[m]||"";let v="",C="";if(n.alignDelimiters!==!1){const T=c[m]-(b[m]||0),S=i[m];S===114?v=" ".repeat(T):S===99?T%2?(v=" ".repeat(T/2+.5),C=" ".repeat(T/2-.5)):(v=" ".repeat(T/2),C=v):C=" ".repeat(T)}n.delimiterStart!==!1&&!m&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||m)&&y.push(" "),n.alignDelimiters!==!1&&y.push(v),y.push(j),n.alignDelimiters!==!1&&y.push(C),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||m!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
602`)}function UA(e){return e==null?"":String(e)}function Id(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function WA(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),YA);return a(),o}function YA(e,t,n){return">"+(n?"":" ")+e}
vendor: 14,940 bytes, lines 602-615
602function HA(e,t){return Dd(e,t.inConstruct,!0)&&!Dd(e,t.notInConstruct,!1)}function Dd(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Pd(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
603`&&HA(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
604`}function qA(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>o&&(o=i):i=1,a=r+t.length,r=n.indexOf(t,a);return o}function GA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function XA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function KA(e,t,n,r){const a=XA(n),i=e.value||"",o=a==="`"?"GraveAccent":"Tilde";if(GA(e,n)){const m=n.enter("codeIndented"),p=n.indentLines(i,JA);return m(),p}const l=n.createTracker(r),c=a.repeat(Math.max(qA(i,a)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const m=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
605`,encode:["`"],...l.current()})),m()}return d+=l.move(`
606`),i&&(d+=l.move(i+`
607`)),d+=l.move(c),u(),d}function JA(e,t,n){return(n?"":"    ")+e}function Ol(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function QA(e,t,n,r){const a=Ol(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
608`,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),o(),u}function ZA(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ns(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ta(e,t,n){const r=Ar(e),a=Ar(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}kh.peek=e4;function kh(e,t,n,r){const a=ZA(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const u=c.charCodeAt(0),d=Ta(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=Ns(u)+c.slice(1));const m=c.charCodeAt(c.length-1),p=Ta(r.after.charCodeAt(0),m,a);p.inside&&(c=c.slice(0,-1)+Ns(m));const f=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+f}function e4(e,t,n){return n.options.emphasis||"*"}function t4(e,t){let n=!1;return Ml(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Lo}),!!((!e.depth||e.depth<3)&&El(e)&&(t.options.setext||n))}function n4(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(t4(e,n)){const d=n.enter("headingSetext"),m=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
609`,after:`
610`});return m(),d(),p+`
611`+(a===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
612`))+1))}const o="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
613`,...i.current()});return/^[\t ]/.test(u)&&(u=Ns(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}_h.peek=r4;function _h(e){return e.value||""}function r4(){return"<"}jh.peek=s4;function jh(e,t,n,r){const a=Ol(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),u+=c.move(")"),o(),u}function s4(){return"!"}Nh.peek=a4;function Nh(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),a==="full"||!u||u!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function a4(){return"!"}Sh.peek=i4;function Sh(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return a+r+a}function i4(){return"`"}function Eh(e,t){const n=El(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ch.peek=o4;function Ch(e,t,n,r){const a=Ol(n),i=a==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(Eh(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let m=o.move("<");return m+=o.move(n.containerPhrasing(e,{before:m,after:">",...o.current()})),m+=o.move(">"),l(),n.stack=d,m}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+a),u+=o.move(n.safe(e.title,{before:u,after:a,...o.current()})),u+=o.move(a),c()),u+=o.move(")"),l(),u}function o4(e,t,n){return Eh(e,n)?"<":"["}Th.peek=l4;function Th(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),a==="full"||!u||u!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function l4(){return"["}function Rl(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function c4(e){const t=Rl(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function u4(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ah(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function d4(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?u4(n):Rl(n);const l=e.ordered?o==="."?")":".":c4(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Ah(n)===o&&d){let m=-1;for(;++m<e.children.length;){const p=e.children[m];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,a(),u}function m4(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function f4(e,t,n,r){const a=m4(n);let i=n.bulletCurrent||Rl(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(m,p,f){return p?(f?"":" ".repeat(o))+m:(f?i:i+" ".repeat(o-i.length))+m}}function p4(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),a(),o}const h4=Qa(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function g4(e,t,n,r){return(e.children.some(function(o){return h4(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function x4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ih.peek=y4;function Ih(e,t,n,r){const a=x4(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(a+a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const u=c.charCodeAt(0),d=Ta(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=Ns(u)+c.slice(1));const m=c.charCodeAt(c.length-1),p=Ta(r.after.charCodeAt(0),m,a);p.inside&&(c=c.slice(0,-1)+Ns(m));const f=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+f}function y4(e,t,n){return n.options.strong||"*"}function b4(e,t,n,r){return n.safe(e.value,r)}function v4(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function w4(e,t,n){const r=(Ah(n)+(n.options.ruleSpaces?" ":"")).repeat(v4(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Dh={blockquote:WA,break:Pd,code:KA,definition:QA,emphasis:kh,hardBreak:Pd,heading:n4,html:_h,image:jh,imageReference:Nh,inlineCode:Sh,link:Ch,linkReference:Th,list:d4,listItem:f4,paragraph:p4,root:g4,strong:Ih,text:b4,thematicBreak:w4};function k4(){return{enter:{table:_4,tableData:Md,tableHeader:Md,tableRow:N4},exit:{codeText:S4,table:j4,tableData:Ui,tableHeader:Ui,tableRow:Ui}}}function _4(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function j4(e){this.exit(e),this.data.inTable=void 0}function N4(e){this.enter({type:"tableRow",children:[]},e)}function Ui(e){this.exit(e)}function Md(e){this.enter({type:"tableCell",children:[]},e)}function S4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,E4));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function E4(e,t){return t==="|"?t:e}function C4(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
614`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:c,tableRow:l}};function o(f,g,x,b){return u(d(f,x,b),f.align)}function l(f,g,x,b){const y=m(f,x,b),j=u([y]);return j.slice(0,j.indexOf(`
615`))}function c(f,g,x,b){const y=x.enter("tableCell"),j=x.enter("phrasing"),v=x.containerPhrasing(f,{...b,before:i,after:i});return j(),y(),v}function u(f,g){return VA(f,{align:g,alignDelimiters:r,padding:n,stringLength:a})}function d(f,g,x){const b=f.children;let y=-1;const j=[],v=g.enter("table");for(;++y<b.length;)j[y]=m(b[y],g,x);return v(),j}function m(f,g,x){const b=f.children;let y=-1;const j=[],v=g.enter("tableRow");for(;++y<b.length;)j[y]=c(b[y],f,g,x);return v(),j}function p(f,g,x){let b=Dh.inlineCode(f,g,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function T4(){return{exit:{taskListCheckValueChecked:Ld,taskListCheckValueUnchecked:Ld,paragraph:I4}}}function A4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:D4}}}function Ld(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function I4(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,o;for(;++i<a.length;){const l=a[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function D4(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=Dh.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function P4(){return[dA(),DA(),OA(),k4(),T4()]}
vendor: 9,343 bytes, line 615
615function M4(e){return{extensions:[mA(),PA(e),RA(),C4(e),A4()]}}const L4={tokenize:B4,partial:!0},Ph={tokenize:V4,partial:!0},Mh={tokenize:U4,partial:!0},Lh={tokenize:W4,partial:!0},O4={tokenize:Y4,partial:!0},Oh={name:"wwwAutolink",tokenize:z4,previous:Fh},Rh={name:"protocolAutolink",tokenize:$4,previous:zh},xn={name:"emailAutolink",tokenize:F4,previous:$h},rn={};function R4(){return{text:rn}}let Ln=48;for(;Ln<123;)rn[Ln]=xn,Ln++,Ln===58?Ln=65:Ln===91&&(Ln=97);rn[43]=xn;rn[45]=xn;rn[46]=xn;rn[95]=xn;rn[72]=[xn,Rh];rn[104]=[xn,Rh];rn[87]=[xn,Oh];rn[119]=[xn,Oh];function F4(e,t,n){const r=this;let a,i;return o;function o(m){return!zo(m)||!$h.call(r,r.previous)||Fl(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return zo(m)?(e.consume(m),l):m===64?(e.consume(m),c):n(m)}function c(m){return m===46?e.check(O4,d,u)(m):m===45||m===95||lt(m)?(i=!0,e.consume(m),c):d(m)}function u(m){return e.consume(m),a=!0,c}function d(m){return i&&a&&mt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function z4(e,t,n){const r=this;return a;function a(o){return o!==87&&o!==119||!Fh.call(r,r.previous)||Fl(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(L4,e.attempt(Ph,e.attempt(Mh,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function $4(e,t,n){const r=this;let a="",i=!1;return o;function o(m){return(m===72||m===104)&&zh.call(r,r.previous)&&!Fl(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),l):n(m)}function l(m){if(mt(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const p=a.toLowerCase();if(p==="http"||p==="https")return e.consume(m),c}return n(m)}function c(m){return m===47?(e.consume(m),i?u:(i=!0,c)):n(m)}function u(m){return m===null||Sa(m)||Fe(m)||tr(m)||Xa(m)?n(m):e.attempt(Ph,e.attempt(Mh,d),n)(m)}function d(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function B4(e,t,n){let r=0;return a;function a(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),a):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function V4(e,t,n){let r,a,i;return o;function o(u){return u===46||u===95?e.check(Lh,c,l)(u):u===null||Fe(u)||tr(u)||u!==45&&Xa(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(a=r,r=void 0),e.consume(u),o}function c(u){return a||r||!i?n(u):t(u)}}function U4(e,t){let n=0,r=0;return a;function a(o){return o===40?(n++,e.consume(o),a):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Lh,t,i)(o):o===null||Fe(o)||tr(o)?t(o):(e.consume(o),a)}function i(o){return o===41&&r++,e.consume(o),a}}function W4(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),a):l===60||l===null||Fe(l)||tr(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||Fe(l)||tr(l)?t(l):r(l)}function i(l){return mt(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):mt(l)?(e.consume(l),o):n(l)}}function Y4(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return lt(i)?n(i):t(i)}}function Fh(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fe(e)}function zh(e){return!mt(e)}function $h(e){return!(e===47||zo(e))}function zo(e){return e===43||e===45||e===46||e===95||lt(e)}function Fl(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const H4={tokenize:eI,partial:!0};function q4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:J4,continuation:{tokenize:Q4},exit:Z4}},text:{91:{name:"gfmFootnoteCall",tokenize:K4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:G4,resolveTo:X4}}}}function G4(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Vt(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function X4(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function K4(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(m){if(i>999||m===93&&!o||m===null||m===91||Fe(m))return n(m);if(m===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return a.includes(Vt(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Fe(m)||(o=!0),i++,e.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(e.consume(m),i++,u):u(m)}}function J4(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Fe(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=Vt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Fe(g)||(l=!0),o++,e.consume(g),g===92?m:d}function m(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function p(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),a.includes(i)||a.push(i),Ae(e,f,"gfmFootnoteDefinitionWhitespace")):n(g)}function f(g){return t(g)}}function Q4(e,t,n){return e.check(Os,t,e.attempt(H4,t,n))}function Z4(e){e.exit("gfmFootnoteDefinition")}function eI(e,t,n){const r=this;return Ae(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function tI(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},m={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",m,l]],f=l.parser.constructs.insideSpan.null;f&&St(p,p.length,0,Ka(f,o.slice(u+1,c),l)),St(p,p.length,0,[["exit",m,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),St(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,d=this.events;let m=0;return p;function p(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),f(g))}function f(g){const x=Ar(u);if(g===126)return m>1?c(g):(o.consume(g),m++,f);
vendor: 6,565 bytes, line 615
615if(m<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),y=Ar(g);return b._open=!y||y===2&&!!x,b._close=!x||x===2&&!!y,l(g)}}}class nI{constructor(){this.map=[]}add(t,n,r){rI(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function rI(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function sI(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function aI(){return{flow:{null:{name:"table",tokenize:iI,resolveAll:oI}}}}function iI(e,t,n){const r=this;let a=0,i=0,o;return l;function l(N){let L=r.events.length-1;for(;L>-1;){const A=r.events[L][1].type;if(A==="lineEnding"||A==="linePrefix")L--;else break}const _=L>-1?r.events[L][1].type:null,D=_==="tableHead"||_==="tableRow"?S:c;return D===S&&r.parser.lazy[r.now().line]?n(N):D(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(o=!0,i+=1),d(N)}function d(N){return N===null?n(N):ce(N)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),f):n(N):Ne(N)?Ae(e,d,"whitespace")(N):(i+=1,o&&(o=!1,a+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),m(N)))}function m(N){return N===null||N===124||Fe(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?p:m)}function p(N){return N===92||N===124?(e.consume(N),m):m(N)}function f(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,Ne(N)?Ae(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?b(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),x):T(N)}function x(N){return Ne(N)?Ae(e,b,"whitespace")(N):b(N)}function b(N){return N===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):N===45?(i+=1,y(N)):N===null||ce(N)?C(N):T(N)}function y(N){return N===45?(e.enter("tableDelimiterFiller"),j(N)):T(N)}function j(N){return N===45?(e.consume(N),j):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(N))}function v(N){return Ne(N)?Ae(e,C,"whitespace")(N):C(N)}function C(N){return N===124?g(N):N===null||ce(N)?!o||a!==i?T(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):T(N)}function T(N){return n(N)}function S(N){return e.enter("tableRow"),E(N)}function E(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),E):N===null||ce(N)?(e.exit("tableRow"),t(N)):Ne(N)?Ae(e,E,"whitespace")(N):(e.enter("data"),B(N))}function B(N){return N===null||N===124||Fe(N)?(e.exit("data"),E(N)):(e.consume(N),N===92?P:B)}function P(N){return N===92||N===124?(e.consume(N),B):B(N)}}function oI(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,m;const p=new nI;for(;++n<e.length;){const f=e[n],g=f[1];f[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(Od(p,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,m=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",d,t]])),a=g.type==="tableDelimiterRow"?2:d?3:1):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],m=ta(p,t,i,a,void 0,m),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],m=ta(p,t,i,a,void 0,m)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],m=ta(p,t,i,a,n,m)):o[1]!==0&&(m=ta(p,t,o,a,n,m)),a=0):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Od(p,t,c,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=sI(t.events,n))}return e}function ta(e,t,n,r,a,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},xr(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=xr(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=xr(t.events,n[2]),d=xr(t.events,n[3]),m={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return a!==void 0&&(i.end=Object.assign({},xr(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function Od(e,t,n,r,a){const i=[],o=xr(t.events,n);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function xr(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const lI={name:"tasklistCheck",tokenize:uI};function cI(){return{text:{91:lI}}}function uI(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Fe(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return ce(c)?t(c):Ne(c)?e.check({tokenize:dI},t,n)(c):n(c)}}
615function dI(e,t,n){return Ae(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function mI(e){return Kp([R4(),q4(),tI(e),aI(),cI()])}const fI={};function pI(e){const t=this,n=e||fI,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(mI(n)),i.push(P4()),o.push(M4(n))}const hI=`prose prose-invert max-w-none
616  prose-h3:text-base prose-h3:font-semibold prose-h3:text-foreground prose-h3:mt-8 prose-h3:mb-3
617  prose-p:text-muted-foreground prose-p:leading-relaxed
618  prose-li:text-muted-foreground
619  prose-strong:text-foreground
620  prose-a:text-primary
621  prose-table:text-sm
622  prose-th:text-foreground
623  prose-td:text-muted-foreground
624  prose-code:text-foreground prose-code:before:content-none prose-code:after:content-none`;function gI(){const{slug:e=""}=yx(),t=wE(e);if(!t)return s.jsx("div",{className:"min-h-screen bg-background py-8 px-4 sm:px-8",children:s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"That topic doesn’t exist."}),s.jsx(Ie,{to:"/setup-guide/docs",className:"text-sm text-primary hover:opacity-80",children:"← Back to Documentation"})]})});const n=Bn.findIndex(i=>i.slug===e),r=n>0?Bn[n-1]:null,a=n<Bn.length-1?Bn[n+1]:null;return s.jsx("div",{className:"min-h-screen bg-background py-8 px-4 sm:px-8",children:s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs(Ie,{to:"/setup-guide/docs",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(bs,{className:"w-4 h-4"}),"All topics"]}),s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.code&&s.jsx("span",{className:"text-xs font-semibold px-2 py-1 rounded bg-primary/10 text-primary border border-primary/20",children:t.code}),s.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t.title})]}),s.jsx("article",{className:hI,children:s.jsx(tA,{remarkPlugins:[pI],children:t.body})}),s.jsxs("div",{className:"mt-12 grid grid-cols-2 gap-4 border-t border-border pt-6",children:[r?s.jsxs(Ie,{to:`/setup-guide/docs/${r.slug}`,className:"group rounded-lg border border-border bg-card/50 p-4 transition-colors hover:border-primary/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-1",children:[s.jsx(bs,{className:"w-3.5 h-3.5"}),"Previous"]}),s.jsx("p",{className:"text-sm font-medium text-foreground group-hover:text-primary transition-colors",children:r.title})]}):s.jsx("span",{}),a?s.jsxs(Ie,{to:`/setup-guide/docs/${a.slug}`,className:"group rounded-lg border border-border bg-card/50 p-4 text-right transition-colors hover:border-primary/50",children:[s.jsxs("div",{className:"flex items-center justify-end gap-1.5 text-xs text-muted-foreground mb-1",children:["Next",s.jsx(Qt,{className:"w-3.5 h-3.5"})]}),s.jsx("p",{className:"text-sm font-medium text-foreground group-hover:text-primary transition-colors",children:a.title})]}):s.jsx("span",{})]})]})})}const Ir=Sg,Dr=Eg,nr=h.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>s.jsx(Ng,{children:s.jsx(fm,{ref:a,align:t,sideOffset:n,className:se("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));nr.displayName=fm.displayName;var fe=function(){return fe=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},fe.apply(this,arguments)};function xI(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function Bh(e,t,n){for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function Fs(e){return e.mode==="multiple"}function zs(e){return e.mode==="range"}function ei(e){return e.mode==="single"}var yI={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rd
624p-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function bI(e,t){return Ke(e,"LLLL y",t)}function vI(e,t){return Ke(e,"d",t)}function wI(e,t){return Ke(e,"LLLL",t)}function kI(e){return"".concat(e)}function _I(e,t){return Ke(e,"cccccc",t)}function jI(e,t){return Ke(e,"yyyy",t)}var NI=Object.freeze({__proto__:null,formatCaption:bI,formatDay:vI,formatMonthCaption:wI,formatWeekNumber:kI,formatWeekdayName:_I,formatYearCaption:jI}),SI=function(e,t,n){return Ke(e,"do MMMM (EEEE)",n)},EI=function(){return"Month: "},CI=function(){return"Go to next month"},TI=function(){return"Go to previous month"},AI=function(e,t){return Ke(e,"cccc",t)},II=function(e){return"Week n. ".concat(e)},DI=function(){return"Year: "},PI=Object.freeze({__proto__:null,labelDay:SI,labelMonthDropdown:EI,labelNext:CI,labelPrevious:TI,labelWeekNumber:II,labelWeekday:AI,labelYearDropdown:DI});function MI(){var e="buttons",t=yI,n=yl,r={},a={},i=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:NI,labels:PI,locale:n,modifiersClassNames:r,modifiers:a,numberOfMonths:i,styles:o,today:l,mode:"default"}}function LI(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,a=e.toMonth,i=e.fromDate,o=e.toDate;return r?i=pt(r):t&&(i=new Date(t,0,1)),a?o=qa(a):n&&(o=new Date(n,11,31)),{fromDate:i?In(i):void 0,toDate:o?In(o):void 0}}var Vh=h.createContext(void 0);function OI(e){var t,n=e.initialProps,r=MI(),a=LI(n),i=a.fromDate,o=a.toDate,l=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(ei(n)||Fs(n)||zs(n))&&(c=n.onSelect);var u=fe(fe(fe({},r),n),{captionLayout:l,classNames:fe(fe({},r.classNames),n.classNames),components:fe({},n.components),formatters:fe(fe({},r.formatters),n.formatters),fromDate:i,labels:fe(fe({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:fe(fe({},r.modifiers),n.modifiers),modifiersClassNames:fe(fe({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:fe(fe({},r.styles),n.styles),toDate:o});return s.jsx(Vh.Provider,{value:u,children:e.children})}function Be(){var e=h.useContext(Vh);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function Uh(e){var t=Be(),n=t.locale,r=t.classNames,a=t.styles,i=t.formatters.formatCaption;return s.jsx("div",{className:r.caption_label,style:a.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function RI(e){return s.jsx("svg",fe({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:s.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Wh(e){var t,n,r=e.onChange,a=e.value,i=e.children,o=e.caption,l=e.className,c=e.style,u=Be(),d=(n=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:RI;return s.jsxs("div",{className:l,style:c,children:[s.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),s.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:a,onChange:r,children:i}),s.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,s.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function FI(e){var t,n=Be(),r=n.fromDate,a=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,u=n.components,d=n.labels.labelMonthDropdown;if(!r)return s.jsx(s.Fragment,{});if(!a)return s.jsx(s.Fragment,{});var m=[];
624if(kS(r,a))for(var p=pt(r),f=r.getMonth();f<=a.getMonth();f++)m.push(Ni(p,f));else for(var p=pt(new Date),f=0;f<=11;f++)m.push(Ni(p,f));var g=function(b){var y=Number(b.target.value),j=Ni(pt(e.displayMonth),y);e.onChange(j)},x=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:Wh;return s.jsx(x,{name:"months","aria-label":d(),className:c.dropdown_month,style:i.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:m.map(function(b){return s.jsx("option",{value:b.getMonth(),children:l(b,{locale:o})},b.getMonth())})})}function zI(e){var t,n=e.displayMonth,r=Be(),a=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,c=r.classNames,u=r.components,d=r.formatters.formatYearCaption,m=r.labels.labelYearDropdown,p=[];if(!a)return s.jsx(s.Fragment,{});if(!i)return s.jsx(s.Fragment,{});for(var f=a.getFullYear(),g=i.getFullYear(),x=f;x<=g;x++)p.push(Pu(yp(new Date),x));var b=function(j){var v=Pu(pt(n),Number(j.target.value));e.onChange(v)},y=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:Wh;return s.jsx(y,{name:"years","aria-label":m(),className:c.dropdown_year,style:l.dropdown_year,onChange:b,value:n.getFullYear(),caption:d(n,{locale:o}),children:p.map(function(j){return s.jsx("option",{value:j.getFullYear(),children:d(j,{locale:o})},j.getFullYear())})})}function $I(e,t){var n=h.useState(e),r=n[0],a=n[1],i=t===void 0?r:t;return[i,a]}function BI(e){var t=e.month,n=e.defaultMonth,r=e.today,a=t||n||r||new Date,i=e.toDate,o=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(i&&Cr(i,a)<0){var u=-1*(c-1);a=Pt(i,u)}return o&&Cr(a,o)<0&&(a=o),pt(a)}function VI(){var e=Be(),t=BI(e),n=$I(t,e.month),r=n[0],a=n[1],i=function(o){var l;if(!e.disableNavigation){var c=pt(o);a(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[r,i]}function UI(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,a=pt(e),i=pt(Pt(a,r)),o=Cr(i,a),l=[],c=0;c<o;c++){var u=Pt(a,c);l.push(u)}return n&&(l=l.reverse()),l}function WI(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=r?i:1,l=pt(e);if(!n)return Pt(l,o);var c=Cr(n,e);if(!(c<i))return Pt(l,o)}}function YI(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=r?i:1,l=pt(e);if(!n)return Pt(l,-o);var c=Cr(l,n);if(!(c<=0))return Pt(l,-o)}}var Yh=h.createContext(void 0);function HI(e){var t=Be(),n=VI(),r=n[0],a=n[1],i=UI(r,t),o=WI(r,t),l=YI(r,t),c=function(m){return i.some(function(p){return bl(m,p)})},u=function(m,p){c(m)||(p&&Np(m,p)?a(Pt(m,1+t.numberOfMonths*-1)):a(m))},d={currentMonth:r,displayMonths:i,goToMonth:a,goToDate:u,previousMonth:l,nextMonth:o,isDateDisplayed:c};return s.jsx(Yh.Provider,{value:d,children:e.children})}function $s(){var e=h.useContext(Yh);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Rd(e){var t,n=Be(),r=n.classNames,a=n.styles,i=n.components,o=$s().goToMonth,l=function(d){o(Pt(d,e.displayIndex?-e.dis
624playIndex:0))},c=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:Uh,u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth});return s.jsxs("div",{className:r.caption_dropdowns,style:a.caption_dropdowns,children:[s.jsx("div",{className:r.vhidden,children:u}),s.jsx(FI,{onChange:l,displayMonth:e.displayMonth}),s.jsx(zI,{onChange:l,displayMonth:e.displayMonth})]})}function qI(e){return s.jsx("svg",fe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function GI(e){return s.jsx("svg",fe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Aa=h.forwardRef(function(e,t){var n=Be(),r=n.classNames,a=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var o=i.join(" "),l=fe(fe({},a.button_reset),a.button);return e.style&&Object.assign(l,e.style),s.jsx("button",fe({},e,{ref:t,type:"button",className:o,style:l}))});function XI(e){var t,n,r=Be(),a=r.dir,i=r.locale,o=r.classNames,l=r.styles,c=r.labels,u=c.labelPrevious,d=c.labelNext,m=r.components;if(!e.nextMonth&&!e.previousMonth)return s.jsx(s.Fragment,{});var p=u(e.previousMonth,{locale:i}),f=[o.nav_button,o.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:i}),x=[o.nav_button,o.nav_button_next].join(" "),b=(t=m==null?void 0:m.IconRight)!==null&&t!==void 0?t:GI,y=(n=m==null?void 0:m.IconLeft)!==null&&n!==void 0?n:qI;return s.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&s.jsx(Aa,{name:"previous-month","aria-label":p,className:f,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:a==="rtl"?s.jsx(b,{className:o.nav_icon,style:l.nav_icon}):s.jsx(y,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&s.jsx(Aa,{name:"next-month","aria-label":g,className:x,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:a==="rtl"?s.jsx(y,{className:o.nav_icon,style:l.nav_icon}):s.jsx(b,{className:o.nav_icon,style:l.nav_icon})})]})}function Fd(e){var t=Be().numberOfMonths,n=$s(),r=n.previousMonth,a=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(g){return bl(e.displayMonth,g)}),c=l===0,u=l===o.length-1,d=t>1&&(c||!u),m=t>1&&(u||!c),p=function(){r&&i(r)},f=function(){a&&i(a)};return s.jsx(XI,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:m,nextMonth:a,previousMonth:r,onPreviousClick:p,onNextClick:f})}function KI(e){var t,n=Be(),r=n.classNames,a=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:Uh,u;return a?u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=s.jsx(Rd,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=s.jsxs(s.Fragment,{children:[s.jsx(Rd,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(Fd,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=s.jsxs(s.Fragment,{children:[s.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(Fd,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:r.caption,style:i.caption,children:u})}function JI(e){var t=Be(),n=t.footer,r=t.styles,a=t.classNames.tfoot;return n?s.jsx("tfoot",{className:a,style:r.tfoot,children:s.jsx("tr",{children:s.jsx("td",{colSpan:8,children:n})})}):s.jsx(s.Fragment,{})}
624function QI(e,t,n){for(var r=n?er(new Date):tn(new Date,{locale:e,weekStartsOn:t}),a=[],i=0;i<7;i++){var o=dt(r,i);a.push(o)}return a}function ZI(){var e=Be(),t=e.classNames,n=e.styles,r=e.showWeekNumber,a=e.locale,i=e.weekStartsOn,o=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=QI(a,i,o);return s.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&s.jsx("td",{style:n.head_cell,className:t.head_cell}),u.map(function(d,m){return s.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":c(d,{locale:a}),children:l(d,{locale:a})},m)})]})}function e3(){var e,t=Be(),n=t.classNames,r=t.styles,a=t.components,i=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:ZI;return s.jsx("thead",{style:r.head,className:n.head,children:s.jsx(i,{})})}function t3(e){var t=Be(),n=t.locale,r=t.formatters.formatDay;return s.jsx(s.Fragment,{children:r(e.date,{locale:n})})}var zl=h.createContext(void 0);function n3(e){if(!Fs(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return s.jsx(zl.Provider,{value:t,children:e.children})}return s.jsx(r3,{initialProps:e.initialProps,children:e.children})}function r3(e){var t=e.initialProps,n=e.children,r=t.selected,a=t.min,i=t.max,o=function(u,d,m){var p,f;(p=t.onDayClick)===null||p===void 0||p.call(t,u,d,m);var g=!!(d.selected&&a&&(r==null?void 0:r.length)===a);if(!g){var x=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!x){var b=r?Bh([],r):[];if(d.selected){var y=b.findIndex(function(j){return xt(u,j)});b.splice(y,1)}else b.push(u);(f=t.onSelect)===null||f===void 0||f.call(t,b,u,d,m)}}},l={disabled:[]};r&&l.disabled.push(function(u){var d=i&&r.length>i-1,m=r.some(function(p){return xt(p,u)});return!!(d&&!m)});var c={selected:r,onDayClick:o,modifiers:l};return s.jsx(zl.Provider,{value:c,children:n})}function $l(){var e=h.useContext(zl);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function s3(e,t){var n=t||{},r=n.from,a=n.to;return r&&a?xt(a,e)&&xt(r,e)?void 0:xt(a,e)?{from:a,to:void 0}:xt(r,e)?void 0:Eo(r,e)?{from:e,to:a}:{from:r,to:e}:a?Eo(e,a)?{from:a,to:e}:{from:e,to:a}:r?Np(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var Bl=h.createContext(void 0);function a3(e){if(!zs(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(Bl.Provider,{value:t,children:e.children})}return s.jsx(i3,{initialProps:e.initialProps,children:e.children})}function i3(e){var t=e.initialProps,n=e.children,r=t.selected,a=r||{},i=a.from,o=a.to,l=t.min,c=t.max,u=function(f,g,x){var b,y;(b=t.onDayClick)===null||b===void 0||b.call(t,f,g,x);var j=s3(f,r);(y=t.onSelect)===null||y===void 0||y.call(t,j,f,g,x)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],xt(i,o)||(d.range_middle=[{after:i,before:o}])):d.range_end=[i]):o&&(d.range_start=[o],d.range_end=[o]),l&&(i&&!o&&d.disabled.push({after:Wn(i,l-1),before:dt(i,l-1)}),i&&o&&d.disabled.push({after:i,before:dt(i,l-1)}),!i&&o&&d.disabled.push({after:Wn(o,l-1),before:dt(o,l-1)})),c){if(i&&!o&&(d.disabled.push({before:dt(i,-c+1)}),d.disabled.push({after:dt(i,c-1)})),i&&o){var m=Jt(o,i)+1,p=c-m;d.disabled.push({before:Wn(i,p)}),d.disabled.push({after:dt(o,p)})}!i&&o&&(d.disabled.push({before:dt(o,-c+1)}),d.disabled.push({after:dt(o,c-1)}))}return s.jsx(Bl.Provider,{value:{selected:r,onDayClick:u,modifiers:d},children:n})}function Vl(){var e=h.useContext(Bl);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function pa(e){return Array.isArray(e)?Bh([],e):e!==void 0?[e]:[]}function o3(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],a=n[1];t[r]=pa(a)}),t}var Ut;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Ut||(Ut={}));var l3=Ut.Selected,on=Ut.Disabled,c3=Ut.Hidden,u3=Ut.Today,Wi=Ut.RangeEnd,Yi=Ut.RangeMiddle,Hi=Ut.RangeStart,d3=Ut.Outside;function m3(e,t,n){var r,a=(r={}
624,r[l3]=pa(e.selected),r[on]=pa(e.disabled),r[c3]=pa(e.hidden),r[u3]=[e.today],r[Wi]=[],r[Yi]=[],r[Hi]=[],r[d3]=[],r);return e.fromDate&&a[on].push({before:e.fromDate}),e.toDate&&a[on].push({after:e.toDate}),Fs(e)?a[on]=a[on].concat(t.modifiers[on]):zs(e)&&(a[on]=a[on].concat(n.modifiers[on]),a[Hi]=n.modifiers[Hi],a[Yi]=n.modifiers[Yi],a[Wi]=n.modifiers[Wi]),a}var Hh=h.createContext(void 0);function f3(e){var t=Be(),n=$l(),r=Vl(),a=m3(t,n,r),i=o3(t.modifiers),o=fe(fe({},a),i);return s.jsx(Hh.Provider,{value:o,children:e.children})}function qh(){var e=h.useContext(Hh);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function p3(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function h3(e){return!!(e&&typeof e=="object"&&"from"in e)}function g3(e){return!!(e&&typeof e=="object"&&"after"in e)}function x3(e){return!!(e&&typeof e=="object"&&"before"in e)}function y3(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function b3(e,t){var n,r=t.from,a=t.to;if(r&&a){var i=Jt(a,r)<0;i&&(n=[a,r],r=n[0],a=n[1]);var o=Jt(e,r)>=0&&Jt(a,e)>=0;return o}return a?xt(a,e):r?xt(r,e):!1}function v3(e){return hl(e)}function w3(e){return Array.isArray(e)&&e.every(hl)}function k3(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(v3(n))return xt(e,n);if(w3(n))return n.includes(e);if(h3(n))return b3(e,n);if(y3(n))return n.dayOfWeek.includes(e.getDay());if(p3(n)){var r=Jt(n.before,e),a=Jt(n.after,e),i=r>0,o=a<0,l=Eo(n.before,n.after);return l?o&&i:i||o}return g3(n)?Jt(e,n.after)>0:x3(n)?Jt(n.before,e)>0:typeof n=="function"?n(e):!1})}function Ul(e,t,n){var r=Object.keys(t).reduce(function(i,o){var l=t[o];return k3(e,l)&&i.push(o),i},[]),a={};return r.forEach(function(i){return a[i]=!0}),n&&!bl(e,n)&&(a.outside=!0),a}function _3(e,t){for(var n=pt(e[0]),r=qa(e[e.length-1]),a,i,o=n;o<=r;){var l=Ul(o,t),c=!l.disabled&&!l.hidden;if(!c){o=dt(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),a||(a=o),o=dt(o,1)}return i||a}var j3=365;function Gh(e,t){var n=t.moveBy,r=t.direction,a=t.context,i=t.modifiers,o=t.retry,l=o===void 0?{count:0,lastFocused:e}:o,c=a.weekStartsOn,u=a.fromDate,d=a.toDate,m=a.locale,p={day:dt,week:So,month:Pt,year:dN,startOfWeek:function(b){return a.ISOWeek?er(b):tn(b,{locale:m,weekStartsOn:c})},endOfWeek:function(b){return a.ISOWeek?bp(b):xl(b,{locale:m,weekStartsOn:c})}},f=p[n](e,r==="after"?1:-1);r==="before"&&u?f=mN([u,f]):r==="after"&&d&&(f=fN([d,f]));var g=!0;if(i){var x=Ul(f,i);g=!x.disabled&&!x.hidden}return g?f:l.count>j3?l.lastFocused:Gh(f,{moveBy:n,direction:r,context:a,modifiers:i,retry:fe(fe({},l),{count:l.count+1})})}var Xh=h.createContext(void 0);function N3(e){var t=$s(),n=qh(),r=h.useState(),a=r[0],i=r[1],o=h.useState(),l=o[0],c=o[1],u=_3(t.displayMonths,n),d=a??(l&&t.isDateDisplayed(l))?l:u,m=function(){c(a),i(void 0)},p=function(b){i(b)},f=Be(),g=function(b,y){if(a){var j=Gh(a,{moveBy:b,direction:y,context:f,modifiers:n});xt(a,j)||(t.goToDate(j,a),p(j))}},x={focusedDay:a,focusTarget:d,blur:m,focus:p,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return s.jsx(Xh.Provider,{value:x,children:e.children})}function Wl(){var e=h.useContext(Xh);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function S3(e,t){var n=qh(),r=Ul(e,n,t);return r}var Yl=h.createContext(void 0);function E3(e){if(!ei(e.initialProps)){var t={selected:void 0};return s.jsx(Yl.Provider,{value:t,children:e.children})}return s.jsx(C3,{initialProps:e.initialProps,children:e.children})}function C3(e){var t=e.initialProps,n=e.children,r=function(i,o,l){var c,u,d;
624if((c=t.onDayClick)===null||c===void 0||c.call(t,i,o,l),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,i,o,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,i,i,o,l)},a={selected:t.selected,onDayClick:r};return s.jsx(Yl.Provider,{value:a,children:n})}function Kh(){var e=h.useContext(Yl);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function T3(e,t){var n=Be(),r=Kh(),a=$l(),i=Vl(),o=Wl(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,m=o.blur,p=o.focus,f=o.focusMonthBefore,g=o.focusMonthAfter,x=o.focusYearBefore,b=o.focusYearAfter,y=o.focusStartOfWeek,j=o.focusEndOfWeek,v=function(O){var z,F,k,H;ei(n)?(z=r.onDayClick)===null||z===void 0||z.call(r,e,t,O):Fs(n)?(F=a.onDayClick)===null||F===void 0||F.call(a,e,t,O):zs(n)?(k=i.onDayClick)===null||k===void 0||k.call(i,e,t,O):(H=n.onDayClick)===null||H===void 0||H.call(n,e,t,O)},C=function(O){var z;p(e),(z=n.onDayFocus)===null||z===void 0||z.call(n,e,t,O)},T=function(O){var z;m(),(z=n.onDayBlur)===null||z===void 0||z.call(n,e,t,O)},S=function(O){var z;(z=n.onDayMouseEnter)===null||z===void 0||z.call(n,e,t,O)},E=function(O){var z;(z=n.onDayMouseLeave)===null||z===void 0||z.call(n,e,t,O)},B=function(O){var z;(z=n.onDayPointerEnter)===null||z===void 0||z.call(n,e,t,O)},P=function(O){var z;(z=n.onDayPointerLeave)===null||z===void 0||z.call(n,e,t,O)},N=function(O){var z;(z=n.onDayTouchCancel)===null||z===void 0||z.call(n,e,t,O)},L=function(O){var z;(z=n.onDayTouchEnd)===null||z===void 0||z.call(n,e,t,O)},_=function(O){var z;(z=n.onDayTouchMove)===null||z===void 0||z.call(n,e,t,O)},D=function(O){var z;(z=n.onDayTouchStart)===null||z===void 0||z.call(n,e,t,O)},A=function(O){var z;(z=n.onDayKeyUp)===null||z===void 0||z.call(n,e,t,O)},V=function(O){var z;switch(O.key){case"ArrowLeft":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":O.preventDefault(),O.stopPropagation(),u();break;case"ArrowUp":O.preventDefault(),O.stopPropagation(),d();break;case"PageUp":O.preventDefault(),O.stopPropagation(),O.shiftKey?x():f();break;case"PageDown":O.preventDefault(),O.stopPropagation(),O.shiftKey?b():g();break;case"Home":O.preventDefault(),O.stopPropagation(),y();break;case"End":O.preventDefault(),O.stopPropagation(),j();break}(z=n.onDayKeyDown)===null||z===void 0||z.call(n,e,t,O)},J={onClick:v,onFocus:C,onBlur:T,onKeyDown:V,onKeyUp:A,onMouseEnter:S,onMouseLeave:E,onPointerEnter:B,onPointerLeave:P,onTouchCancel:N,onTouchEnd:L,onTouchMove:_,onTouchStart:D};return J}function A3(){var e=Be(),t=Kh(),n=$l(),r=Vl(),a=ei(e)?t.selected:Fs(e)?n.selected:zs(e)?r.selected:void 0;return a}function I3(e){return Object.values(Ut).includes(e)}function D3(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var a=e.modifiersClassNames[r];if(a)n.push(a);else if(I3(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function P3(e,t){var n=fe({},e.styles.day);return Object.keys(t).forEach(function(r){var a;n=fe(fe({},n),(a=e.modifiersStyles)===null||a===void 0?void 0:a[r])}),n}function M3(e,t,n){var r,a,i,o=Be(),l=Wl(),c=S3(e,t),u=T3(e,c),d=A3(),m=!!(o.onDayCl
624ick||o.mode!=="default");h.useEffect(function(){var S;c.outside||l.focusedDay&&m&&xt(l.focusedDay,e)&&((S=n.current)===null||S===void 0||S.focus())},[l.focusedDay,e,n,m,c.outside]);var p=D3(o,c).join(" "),f=P3(o,c),g=!!(c.outside&&!o.showOutsideDays||c.hidden),x=(i=(a=o.components)===null||a===void 0?void 0:a.DayContent)!==null&&i!==void 0?i:t3,b=s.jsx(x,{date:e,displayMonth:t,activeModifiers:c}),y={style:f,className:p,children:b,role:"gridcell"},j=l.focusTarget&&xt(l.focusTarget,e)&&!c.outside,v=l.focusedDay&&xt(l.focusedDay,e),C=fe(fe(fe({},y),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=v||j?0:-1,r)),u),T={isButton:m,isHidden:g,activeModifiers:c,selectedDays:d,buttonProps:C,divProps:y};return T}function L3(e){var t=h.useRef(null),n=M3(e.date,e.displayMonth,t);return n.isHidden?s.jsx("div",{role:"gridcell"}):n.isButton?s.jsx(Aa,fe({name:"day",ref:t},n.buttonProps)):s.jsx("div",fe({},n.divProps))}function O3(e){var t=e.number,n=e.dates,r=Be(),a=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,u=r.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!a)return s.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var m=c(Number(t),{locale:l}),p=function(f){a(t,n,f)};return s.jsx(Aa,{name:"week-number","aria-label":m,className:o.weeknumber,style:i.weeknumber,onClick:p,children:d})}function R3(e){var t,n,r=Be(),a=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:L3,u=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:O3,d;return o&&(d=s.jsx("td",{className:i.cell,style:a.cell,children:s.jsx(u,{number:e.weekNumber,dates:e.dates})})),s.jsxs("tr",{className:i.row,style:a.row,children:[d,e.dates.map(function(m){return s.jsx("td",{className:i.cell,style:a.cell,role:"presentation",children:s.jsx(c,{displayMonth:e.displayMonth,date:m})},bS(m))})]})}function zd(e,t,n){for(var r=n!=null&&n.ISOWeek?bp(t):xl(t,n),a=n!=null&&n.ISOWeek?er(e):tn(e,n
624),i=Jt(r,a),o=[],l=0;l<=i;l++)o.push(dt(a,l));var c=o.reduce(function(u,d){var m=n!=null&&n.ISOWeek?vp(d):kp(d,n),p=u.find(function(f){return f.weekNumber===m});return p?(p.dates.push(d),u):(u.push({weekNumber:m,dates:[d]}),u)},[]);return c}function F3(e,t){var n=zd(pt(e),qa(e),t);if(t!=null&&t.useFixedWeeks){var r=wS(e,t);if(r<6){var a=n[n.length-1],i=a.dates[a.dates.length-1],o=So(i,6-r),l=zd(So(i,1),o,t);n.push.apply(n,l)}}return n}function z3(e){var t,n,r,a=Be(),i=a.locale,o=a.classNames,l=a.styles,c=a.hideHead,u=a.fixedWeeks,d=a.components,m=a.weekStartsOn,p=a.firstWeekContainsDate,f=a.ISOWeek,g=F3(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:f,locale:i,weekStartsOn:m,firstWeekContainsDate:p}),x=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:e3,b=(n=d==null?void 0:d.Row)!==null&&n!==void 0?n:R3,y=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:JI;return s.jsxs("table",{id:e.id,className:o.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&s.jsx(x,{}),s.jsx("tbody",{className:o.tbody,style:l.tbody,children:g.map(function(j){return s.jsx(b,{displayMonth:e.displayMonth,dates:j.dates,weekNumber:j.weekNumber},j.weekNumber)})}),s.jsx(y,{displayMonth:e.displayMonth})]})}function $3(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var B3=$3()?h.useLayoutEffect:h.useEffect,qi=!1,V3=0;function $d(){return"react-day-picker-".concat(++V3)}function U3(e){var t,n=e??(qi?$d():null),r=h.useState(n),a=r[0],i=r[1];return B3(function(){a===null&&i($d())},[]),h.useEffect(function(){qi===!1&&(qi=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function W3(e){var t,n,r=Be(),a=r.dir,i=r.classNames,o=r.styles,l=r.components,c=$s().displayMonths,u=U3(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,m=[i.month],p=o.month,f=e.displayIndex===0,g=e.displayIndex===c.length-1,x=!f&&!g;a==="rtl"&&(t=[f,g],g=t[0],f=t[1]),f&&(m.push(i.caption_start),p=fe(fe({},p),o.caption_start)),g&&(m.push(i.caption_end),p=fe(fe({},p),o.caption_end)),x&&(m.push(i.caption_between),p=fe(fe({},p),o.caption_between));var b=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:KI;return s.jsxs("div",{className:m.join(" "),style:p,children:[s.jsx(b,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(z3,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function Y3(e){var t=Be(),n=t.classNames,r=t.styles;return s.jsx("div",{className:n.months,style:r.months,children:e.children})}function H3(e){var t,n,r=e.initialProps,a=Be(),i=Wl(),o=$s(),l=h.useState(!1),c=l[0],u=l[1];h.useEffect(function(){a.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),u(!0)))},[a.initialFocus,c,i.focus,i.focusTarget,i]);var d=[a.classNames.root,a.className];a.numberOfMonths>1&&d.push(a.classNames.multiple_months),a.showWeekNumber&&d.push(a.classNames.with_weeknumber);var m=fe(fe({},a.styles.root),a.style),p=Object.keys(r).filter(function(g){return g.startsWith("data-")}).reduce(function(g,x){var b;return fe(fe({},g),(b={},b[x]=r[x],b))},{}),f=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:Y3;return s.jsx("div",fe({className:d.join(" "),style:m,dir:a.dir,id:a.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:s.jsx(f,{children:o.displayMonths.map(function(g,x){return s.jsx(W3,{displayIndex:x,displayMonth:g},x)})})}))}function q3(e){var t=e.children,n=xI(e,["children"]);return s.jsx(OI,{initialProps:n,children:s.jsx(HI,{children:s.jsx(E3,{initialProps:n,children:s.jsx(n3,{initialProps:n,children:s.jsx(a3,{initialProps:n,children:s.jsx(f3,{children:s.jsx(N3,{children:t})})})})})})})}function G3(e){return s.jsx(q3,fe({},e,{children:s.jsx(H3,{initialProps:e})}))}function Ss({className:e,classNames:t,showOutsideDays:n=!0,...r}){return s.jsx(G3,{showOutsideDays:n,className:se("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",n
624av_button:se(ko({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:se(ko({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...a})=>s.jsx(La,{className:"h-4 w-4"}),IconRight:({...a})=>s.jsx(Es,{className:"h-4 w-4"})},...r})}Ss.displayName="Calendar";const es=25,X3=1e3,K3=["EXECUTED","EXECUTION_FAILED","EXPIRED","IDEMPOTENCY_DUPLICATE","RATE_LIMIT_EXCEEDED"],Bd={EXECUTED:{text:"text-success",bg:"bg-success/10",dot:"bg-success"},EXECUTION_FAILED:{text:"text-destructive",bg:"bg-destructive/10",dot:"bg-destructive"},LICENSE_INVALID:{text:"text-destructive",bg:"bg-destructive/10",dot:"bg-destructive"},QUEUED:{text:"text-info",bg:"bg-info/10",dot:"bg-info"},EA_POLLED:{text:"text-info",bg:"bg-info/10",dot:"bg-info"},MANUAL_TRIGGER:{text:"text-info",bg:"bg-info/10",dot:"bg-info"},EXPIRED:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},SPREAD_TOO_HIGH:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},RATE_LIMIT_EXCEEDED:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},IDEMPOTENCY_DUPLICATE:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},WEBHOOK_RECEIVED:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"},IDEMPOTENCY_OK:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"},LICENSE_VALID:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"}},Vd={text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"};function Ud({label:e,options:t,selected:n,onChange:r}){const[a,i]=h.useState(!1),o=l=>{r(n.includes(l)?n.filter(c=>c!==l):[...n,l])};return s.jsxs(Ir,{open:a,onOpenChange:i,children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[140px] justify-between text-xs font-normal border-border-default bg-input text-foreground",children:[n.length===0?e:`${n.length} selected`,s.jsx(nn,{className:"ml-1 h-3 w-3 opacity-50"})]})}),s.jsx(nr,{className:"w-52 p-1",align:"start",children:t.map(l=>s.jsxs("button",{onClick:()=>o(l),className:se("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors",n.includes(l)?"bg-primary/10 text-primary":"text-foreground hover:bg-muted"),children:[s.jsx("span",{className:se("h-3.5 w-3.5 rounded-sm border border-border-default flex items-center justify-center",n.includes(l)&&"bg-primary border-primary"),children:n.includes(l)&&s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"text-primary-foreground",children:s.jsx("path",{d:"M2 5l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})})}),l]},l))})]})}const J3=[{key:"lot_size",label:"Lot Size"},{key:"executed_price",label:"Executed Price"},{key:"sl",label:"SL"},{key:"tp",label:"TP"},{key:"broker_symbol",label:"Broker Symbol"},{key:"symbol",label:"Symbol"},{key:"direction",label:"Direction"}];function Q3({detail:e}){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=J3.map(r=>{const a=t[r.key];return a==null?{label:r.label,value:null}:{label:r.label,value:String(a)}}).filter(r=>r.value!==null);return n.length===0?null:s.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1",children:n.map(r=>s.jsxs("div",{className:"contents",children:[s.jsx("dt",{className:"text-[11px] text-muted-foreground font-mono uppercase tracking-widest",children:r.label}),s.jsx("dd",{className:"text-[13px] text-foreground font-mono",children:r.value})]},r.label))})}function Z3(){const{user:e}=be(),[t,n]=h.useState(null),[r,a]=h.useState(!0),[i,o]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[m,p]=h.useState(null),[f,g]=h.useState({}),[x,b]=h.useState(Wn(new Date,7)),[y,j]=h.useState(new Date),[v,C]=h.useState([]),[T,S]=h.useState([]),[E,B]=h.useState(""),[P,N]=h.useState(0),[L,_]=h.useState([]);h.useEffect(()=>{if(!e)return;(async()=>{a(!0);const[w,te]=await Promise.all([Z.from("license_keys").select("license_key").eq("user_id",e.id).limit(1).maybeSingle(),Z.from("mt5_accounts").select("id, account_label").eq("user_id",e.id)]);if(w.data&&n(w.data.license_key),te.data){const W={};te.data.forEach(U=>{W[U.id]=U.account_label}),g(W)}if(w.data){const{data:W}=await Z.from("trade_events").select("detail").eq("license_key",w.data.license_key);if(W){const U=new Set;W.forEach(K=>{const ie=dn(K.detail,"symbol");ie&&U.add(ie)}),_(Array.from(U).sort())}}a(!1)})()},[e]);const D=h.useCallback(async()=>
624{if(!t){o([]),c(!1);return}d(!1),c(!0);let R=Z.from("trade_events").select("id, timestamp, alert_id, event_type, detail, account_id").eq("license_key",t).not("event_type","in",Sp).gte("timestamp",In(x).toISOString()).lte("timestamp",gl(y).toISOString()).order("timestamp",{ascending:!1}).limit(X3);E.trim()&&(R=R.ilike("alert_id",`%${E.trim()}%`));const{data:w,error:te}=await R;if(te){d(!0),c(!1);return}o(Ep(w??[])),c(!1)},[t,x,y,E]);h.useEffect(()=>{r||D()},[D,r]),h.useEffect(()=>{N(0)},[x,y,v,T,E]);const A=h.useMemo(()=>i.filter(R=>!(T.length>0&&!T.includes(R.status)||v.length>0&&!(R.symbol&&v.includes(R.symbol)))),[i,T,v]),V=A.length,J=Math.ceil(V/es),O=A.slice(P*es,(P+1)*es),z=()=>{b(Wn(new Date,7)),j(new Date),C([]),S([]),B(""),N(0)},F=v.length>0||T.length>0||E.trim()!=="",k=V===0?0:P*es+1,H=Math.min((P+1)*es,V);return s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8 space-y-6 animate-fade-up",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:"Trade Log"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-4",children:[s.jsxs(Ir,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[130px] justify-start text-xs font-normal border-border-default bg-input",children:[s.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5 text-muted-foreground"}),Ke(x,"dd MMM yyyy")]})}),s.jsx(nr,{className:"w-auto p-0",align:"start",children:s.jsx(Ss,{mode:"single",selected:x,onSelect:R=>R&&b(R),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"to"}),s.jsxs(Ir,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[130px] justify-start text-xs font-normal border-border-default bg-input",children:[s.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5 text-muted-foreground"}),Ke(y,"dd MMM yyyy")]})}),s.jsx(nr,{className:"w-auto p-0",align:"start",children:s.jsx(Ss,{mode:"single",selected:y,onSelect:R=>R&&j(R),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),s.jsx(Ud,{label:"Symbol",options:L,selected:v,onChange:C}),s.jsx(Ud,{label:"Status",options:[...K3],selected:T,onChange:S}),s.jsxs("div",{className:"relative",children:[s.jsx(Vo,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),s.jsx(qe,{placeholder:"Alert ID...",value:E,onChange:R=>B(R.target.value),className:"h-9 w-[160px] pl-8 text-xs border-border-default bg-input"})]}),F&&s.jsxs("button",{onClick:z,className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[s.jsx(rr,{className:"h-3 w-3"})," Clear filters"]})]}),s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_80px_100px_32px] gap-2 px-4 py-2 bg-muted text-[0.75rem] font-medium uppercase tracking-[0.08em] text-muted-foreground border-b border-border-default",children:[s.jsx("span",{}),s.jsx("span",{children:"Timestamp"}),s.jsx("span",{children:"Alert ID"}),s.jsx("span",{children:"Status"}),s.jsx("span",{children:"Symbol"}),s.jsx("span",{children:"Direction"}),s.jsx("span",{children:"Account"}),s.jsx("span",{})]}),l||r?s.jsx("div",{children:Array.from({length:8}).map((R,w)=>s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_80px_100px_32px] gap-2 px-4 py-3 border-b border-border",children:[s.jsx(Ee,{className:"h-4 w-4"}),s.jsx(Ee,{className:"h-4 w-28"}),s.jsx(Ee,{className:"h-4 w-24"}),s.jsx(Ee,{className:"h-4 w-20"}),s.jsx(Ee,{className:"h-4 w-14"}),s.jsx(Ee,{className:"h-4 w-10"}),s.jsx(Ee,{className:"h-4 w-16"}),s.jsx("span",{})]},w))}):u?s.jsxs("div",{className:"px-4 py-12 text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load trade events."}),s.jsxs(re,{variant:"ghost",size:"sm",onClick:D,className:"mt-2 text-xs text-primary",children:[s.jsx(zt,{className:"mr-1 h-3 w-3"})," Retry"]})]}):O.length===0?s.jsx("div",{className:"px-4 py-16 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No trades match your filters. Try adjusting the date range."})}):O.map(R=>{const w=m===R.alertId,te=R.symbol??"—",W=R.direction,U=Bd[R.status]??Vd,K=R.accountId?f[R.accountId]??"—":"—",ie=R.status==="EXECUTION_FAILED";return s.jsxs("div",{children:[s.jsxs("div",{className:"grid grid-cols-[32px_1fr_1fr_1fr_80px_80px_100px_32px] gap-2 px-4 py-3 border-b border-border hover:bg-muted/50 cursor-pointer transition-colors duration-100",onClick:()=>p(w?null:R.alertId),children:[s.jsx("span",{className:"flex items-center",children:w?s.jsx(nn,{className:"h-3.5 w-3.5 text-muted-foreground"}):s.jsx(Es,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-xs text-muted-foreground truncate",children:R.firstTimestamp?Tr(R.firstTimestamp,"dd MMM yyyy HH:mm:ss"):"—"}),s.jsx("span",{className:"text-xs font-mono text-foreground truncate",title:R.alertId,children:R.alertId.length>16?`${R.alertId.slice(0,16)}…`:R.alertId}
624),s.jsx("span",{children:s.jsxs("span",{className:se("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-[0.08em]",U.text,U.bg),children:[s.jsx("span",{className:se("h-1.5 w-1.5 rounded-full",U.dot)}),R.status.replace(/_/g," ")]})}),s.jsx("span",{className:"text-xs text-foreground",children:te}),s.jsx("span",{children:W?s.jsx("span",{className:se("inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-[0.08em]",W==="BUY"?"text-success bg-success/10":"text-destructive bg-destructive/10"),children:W}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),s.jsx("span",{className:"text-xs text-foreground truncate",children:K}),s.jsx("span",{})]}),w&&s.jsxs("div",{className:"px-6 py-4 border-b border-border bg-[rgba(28,32,48,0.5)] border-l-2 border-l-primary space-y-4",children:[ie&&s.jsx("p",{className:"text-[13px] text-destructive",children:Cp(R.headlineEvent.detail)}),s.jsx("ol",{className:"space-y-1.5",children:R.events.map(ne=>{const ue=Bd[ne.event_type]??Vd;return s.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[s.jsxs("span",{className:se("inline-flex items-center gap-1.5 px-1.5 py-0.5 rounded-full font-semibold uppercase tracking-[0.08em]",ue.text,ue.bg),children:[s.jsx("span",{className:se("h-1.5 w-1.5 rounded-full",ue.dot)}),ne.event_type.replace(/_/g," ")]}),s.jsx("span",{className:"text-muted-foreground font-mono",children:ne.timestamp?Tr(ne.timestamp,"dd MMM HH:mm:ss"):"—"})]},ne.id)})}),s.jsx(Q3,{detail:R.headlineEvent.detail})]})]},R.alertId)})]}),!l&&!u&&V>0&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Showing ",k,"–",H," of ",V," trades"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(re,{variant:"outline",size:"sm",disabled:P===0,onClick:()=>N(R=>R-1),className:"h-8 text-xs border-border-default",children:[s.jsx(La,{className:"mr-1 h-3 w-3"})," Previous"]}),s.jsxs(re,{variant:"outline",size:"sm",disabled:P>=J-1,onClick:()=>N(R=>R+1),className:"h-8 text-xs border-border-default",children:["Next ",s.jsx(Tm,{className:"ml-1 h-3 w-3"})]})]})]})]})})}const Ia=h.forwardRef(({className:e,...t},n)=>s.jsx(pm,{className:se("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-neutral-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:s.jsx(Cg,{className:se("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ia.displayName=pm.displayName;const eD=Mg,tD=Lg,Jh=h.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(hm,{ref:r,className:se("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
624ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(Tg,{asChild:!0,children:s.jsx(nn,{className:"h-4 w-4 opacity-50"})})]}));Jh.displayName=hm.displayName;const Qh=h.forwardRef(({className:e,...t},n)=>s.jsx(gm,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Em,{className:"h-4 w-4"})}));Qh.displayName=gm.displayName;const Zh=h.forwardRef(({className:e,...t},n)=>s.jsx(xm,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(nn,{className:"h-4 w-4"})}));Zh.displayName=xm.displayName;const eg=h.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>s.jsx(Ag,{children:s.jsxs(ym,{ref:a,className:se("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(Qh,{}),s.jsx(Ig,{className:se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(Zh,{})]})}));eg.displayName=ym.displayName;const nD=h.forwardRef(({className:e,...t},n)=>s.jsx(bm,{ref:n,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));nD.displayName=bm.displayName;const tg=h.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(vm,{ref:r,className:se("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Dg,{children:s.jsx(ot,{className:"h-4 w-4"})})}),s.jsx(Pg,{children:t})]}));tg.displayName=vm.displayName;const rD=h.forwardRef(({className:e,...t},n)=>s.jsx(wm,{ref:n,className:se("-mx-1 my-1 h-px bg-muted",e),...t}));rD.displayName=wm.displayName;function sD({label:e,tooltip:t,value:n,onChange:r,min:a,max:i,step:o,placeholder:l,integer:c,disabled:u}){const d=m=>{const p=m.target.value;if(p===""){r(null);return}const f=c?parseInt(p,10):parseFloat(p);if(Number.isNaN(f)){r(null);return}if(f===0){r(null);return}r(f)};return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ze,{className:"text-[0.8125rem] text-muted-foreground",children:e}),s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground/60 hover:text-muted-foreground transition-colors",tabIndex:-1,"aria-label":`Help: ${e}`,children:s.jsx(Uo,{size:13})})}),s.jsx(Gn,{side:"top",className:"max-w-xs text-xs leading-snug",children:t})]})]}),s.jsx(qe,{type:"number",min:a,max:i,step:o,value:n==null?"":String(n),onChange:d,placeholder:l??"Not set",disabled:u,className:`bg-input border-border ${u?"opacity-50":""}`})]})}function aD({label:e,tooltip:t,value:n,onChange:r,min:a,max:i,step:o,integer:l}){const c=n!=null,u=m=>{r(m?0:null)},d=m=>{const p=m.target.value;if(p===""){r(null);return}const f=l?parseInt(p,10):parseFloat(p);Number.isNaN(f)||r(f)};return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ze,{className:"text-[0.8125rem] text-muted-foreground",children:e}),s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground
624/60 hover:text-muted-foreground transition-colors",tabIndex:-1,"aria-label":`Help: ${e}`,children:s.jsx(Uo,{size:13})})}),s.jsx(Gn,{side:"top",className:"max-w-xs text-xs leading-snug",children:t})]})]}),s.jsx(Ia,{checked:c,onCheckedChange:u})]}),s.jsx(qe,{type:"number",min:a,max:i,step:o,value:c?String(n):"",onChange:d,disabled:!c,placeholder:c?"":"Disabled",className:`bg-input border-border ${c?"":"opacity-50"}`})]})}function iD({title:e,children:t,alwaysOpen:n,defaultOpen:r}){const[a,i]=h.useState(!!r),o=n||a;return s.jsxs("div",{className:"rounded-lg border border-border bg-popover/30",children:[n?s.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:s.jsx("h3",{className:"text-sm font-semibold text-foreground tracking-tight",children:e})}):s.jsxs("button",{type:"button",onClick:()=>i(l=>!l),className:"w-full flex items-center justify-between px-4 py-3 border-b border-border/60 hover:bg-popover/50 transition-colors","aria-expanded":o,children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground tracking-tight",children:e}),s.jsx(nn,{size:16,className:`text-muted-foreground transition-transform ${o?"rotate-180":""}`})]}),o&&s.jsx("div",{className:"p-4 grid gap-4 sm:grid-cols-2",children:t})]})}const Wd="When a partial close fires — by pips of profit or by reward-to-risk; the indicator overrides it per trade.",oD=[{value:"percent_balance",label:"Percent Balance (% of balance)"},{value:"fixed_lot",label:"Fixed Lot"},{value:"fixed_cash",label:"Fixed Cash (account currency)"},{value:"percent_equity",label:"Percent Equity (% of equity)"}],Gi=[{name:"volume_type",column:"volume_type",section:"sizing",kind:"select",sentinel_class:"first_group",label:"Sizing method",tooltip:"How ViewLink sizes your trades by default — % of balance, % of equity, fixed lots, or a fixed cash amount in your account currency; the indicator overrides this for an individual trade.",options:oD},{name:"risk_percent",column:"risk_percent",section:"sizing",kind:"number",sentinel_class:"first_group",label:"Risk per trade (%)",tooltip:"Your default risk per trade — the ViewLink indicator overrides this on individual trades.",min:0,step:.1,placeholder:"e.g. 1.0",active_for_volume_types:["percent_balance","percent_equity"]},{name:"lot_size",column:"lot_size",section:"sizing",kind:"number",sentinel_class:"first_group",label:"Lot size",tooltip:"Your default fixed lot size, used only when you size by fixed lots — the indicator overrides it per trade, and your lot ceiling (set below) caps it if you have one.",min:0,step:.01,placeholder:"e.g. 0.10",active_for_volume_types:["fixed_lot"]},{name:"cash_risk",column:"dollar_risk",section:"sizing",kind:"number",sentinel_class:"first_group",label:"Cash risk",tooltip:"The default amount you risk per trade, in your account's deposit currency — the indicator overrides it per trade.",min:0,step:1,placeholder:"e.g. 100",active_for_volume_types:["fixed_cash"]},{name:"max_lots_ceiling",column:"max_lots_ceiling",section:"sizing",kind:"number",sentinel_class:"first_group",label:"Lot ceiling (safety)",tooltip:"A hard safety ceiling on calculated lot size — set this yourself as a safety backstop; leave blank for no ceiling.",min:0,step:.01,placeholder:"e.g. 1.0"},{name:"sl_pips",column:"sl_pips",section:"stops_targets",kind:"number",sentinel_class:"first_group",label:"Default stop-loss (pips)",tooltip:"Your usual stop-loss distance in pips, applied to every trade — the ViewLink indicator overrides it per trade.",min:0,step:.1},{name:"tp_pips",column:"tp_pips",section:"stops_targets",kind:"number",sentinel_class:"first_group",label:"Default take-profit (pips)",tooltip:"An optional default take-profit distance — leave it blank if you manage exits by hand; the indicator overrides it per trade.",min:0,step:.1},{name:"trail_pips",column:"trail_pips",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Trailing-stop distance (pips)",tooltip:"Your default trailing-stop distance — leave it blank for no trailing; the indicator overrides it per trade.",min:0,step:.1},{name:"trail_trigger",column:"trail_trigger",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Trail trigger (pips)",tooltip:"How far in profit, in pips, before the trail starts — blank means it trails immediately; the indicator overrides it per trade.",min:0,step:.1},{name:"be_trigger_pips",column:"be_trigger_pips",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Breakeven trigger (pips)",tooltip:"Move your stop to breakeven after this many pips of profit — leave blank for no breakeven; the indicator overrides it per trade.",min:0,step:.1},{name:"be_trigger_rr",column:"be_trigger_rr",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Breakeven trigger (R:R)",tooltip:"Move your stop to breakeven at this reward-to-risk multiple — needs a stop on the trade; the indicator overrides it per trade.",min:0,step:.1,placeholder:"e.g. 1 (moves at 1:1)"},{name:"be_offset",column:"be_offset",section:"trade_management",kind:"number",sentinel_class:"toggle_gated",label:"Breakeven offset (pips)",tooltip:"Pips locked in above entry when breakeven triggers — defaults to 1 to cover spread and commission; the indicator overrides it per trade.",step:.1},{name:"partial_close_pct",column:"partial_close_pct",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Partial close (%)",tooltip:"The portion of a position to scale out by default — the indicator overrides it per trade.",min:0,max:100,step:1,placeholder:"e.g. 50"},{name:"partial_close_trigger_pips",column:"partial_close_trigger_pips",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Partial close trigger (pips)",tooltip:Wd,min:0,step:.1,placeholder:"e.g. 20",requires_column:"partial_close_pct",inactive_placeholder:"Set a partial close % first"},{name:"partial_close_trigger_rr",column:"partial_close_trigger_rr",section:"trade_management",kind:"number",sentinel_class:"first_group",label:"Partial close trigger (R:R)",tooltip:Wd,min:0,step:.1,placeholder:"e.g. 2 (closes at 1:2)",requires_column:"partial_close_pct",inactive_placeholder:"Set a partial close % first"},{name:"max_spread",column:"max_spread",section:"execution_guards",kind:"number",sentinel_class:"toggle_gated",label:"Max spread (pips)",tooltip:"Skip a trade when the spread is wider than this — the ViewLink indicator can override it for an individual trade.",min:0,step:.1},{name:"slippage",column:"slippage",section:"execution_guards",kind:"integer",sentinel_class:"toggle_gated",label:"Max slippage (points)",tooltip:"The maximum price slippage you will accept on a fill — the indicator can override it per trade; ViewLink uses a safe default if you leave it blank.",min:0,step:1},{name:"ttl",column:"ttl",section:"execution_guards",kind:"integer",sentinel_class:"first_group",label:"Alert freshness (seconds)",tooltip:"How many seconds an alert stays valid before ViewLink discards it as stale — lower it if you only want very fresh fills.",min:0,step:1},{name:"magic_number",column:"magic_number",section:"identity",kind:"integer",sentinel_class:"first_group",label:"Magic number",tooltip:"The identifier ViewLink stamps on your trades so MT5 can tell them apart — set a per-strategy value in the indicator on each chart if you run several strategies; otherwise this account default is used.",min:0,step:1}],lD={sizing:"Sizing",stops_targets:"Stops & Targets",trade_management:"Trade Management",execution_guards:"Execution Guards",identity:"Identity"};function cD(e){return e?{USD:"$",EUR:"€",GBP:"£",ZAR:"R",AUD:"A$",CAD:"C$",NZD:"NZ$",JPY:"¥",CHF:"CHF"}[e.toUpperCase()]??e.toUpperCase():""}function uD(e){return e?`Risk per trade (${cD(e)})`:"Cash risk (account currency)"}const dD=["sl_price, tp_price, be_trigger_price — an exact price is only meaningful for one trade; set these per trade in the ViewLink indicator (drag the line, or the BE-price input).","partial_close_vol — closing a fixed lot amount depends on the position size, so it is a per-trade value, not a saved default.",'comment_prefix — fixed as "Vie
624wLink" at launch; not user-editable.'],mD=["id","account_currency","volume_type","risk_percent","lot_size","dollar_risk","max_lots_ceiling","sl_pips","tp_pips","trail_pips","trail_trigger","be_trigger_pips","be_trigger_rr","be_offset","partial_close_pct","partial_close_trigger_pips","partial_close_trigger_rr","max_spread","slippage","ttl","magic_number"].join(", ");function fD({accountId:e,accountLabel:t}){const{toast:n}=Wt(),[r,a]=h.useState(!1),[i,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(null),[m,p]=h.useState(null),[f,g]=h.useState(null),x=h.useCallback(async()=>{o(!0),d(null);try{const E=await Z.from("mt5_accounts").select(mD).eq("id",e).maybeSingle();if(E.error)throw E.error;const B=E.data??null;p(B),g(B?{...B}:null)}catch(E){const B=E instanceof Error?E.message:"Failed to load settings";d(B)}finally{o(!1)}},[e]);h.useEffect(()=>{r&&m===null&&!i&&x()},[r,m,i,x]);const b=(E,B)=>{g(P=>P&&{...P,[E]:B})},y=async()=>{if(!f)return;c(!0);const E={};for(const P of Gi)E[P.column]=f[P.column]??null;const{error:B}=await Z.from("mt5_accounts").update(E).eq("id",e);if(c(!1),B){n({title:"Error saving",description:B.message,variant:"destructive"});return}p({...f}),n({title:"Settings saved"})},j=()=>{m&&g({...m})},v=!!m&&!!f&&Gi.some(E=>(m[E.column]??null)!==(f[E.column]??null)),C=(f==null?void 0:f.account_currency)??null,T=E=>{var D;const B=(f==null?void 0:f.volume_type)??"percent_balance",P=E.active_for_volume_types!==void 0&&!E.active_for_volume_types.includes(B),N=E.requires_column!==void 0&&((f==null?void 0:f[E.requires_column])??null)===null;if(E.kind==="select"&&E.name==="volume_type")return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ze,{className:"text-[0.8125rem] text-muted-foreground",children:E.label}),s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground/60 hover:text-muted-foreground",tabIndex:-1,"aria-label":`Help: ${E.label}`,children:s.jsx(Uo,{size:13})})}),s.jsx(Gn,{side:"top",className:"max-w-xs text-xs leading-snug",children:E.tooltip})]})]}),s.jsxs(eD,{value:(f==null?void 0:f.volume_type)??"percent_balance",onValueChange:A=>b("volume_type",A),children:[s.jsx(Jh,{className:"bg-input border-border",children:s.jsx(tD,{})}),s.jsx(eg,{children:(D=E.options)==null?void 0:D.map(A=>s.jsx(tg,{value:A.value,children:A.label},A.value))})]})]},E.name);const L=E.name==="cash_risk"?uD(C):E.label,_=(f==null?void 0:f[E.column])??null;return E.sentinel_class==="toggle_gated"?s.jsx(aD,{label:L,tooltip:E.tooltip,value:_,onChange:A=>b(E.column,A),min:E.min,max:E.max,step:E.step,integer:E.kind==="integer"},E.name):s.jsx(sD,{label:L,tooltip:E.tooltip,value:_,onChange:A=>b(E.column,A),min:E.min,max:E.max,step:E.step,placeholder:N&&E.inactive_placeholder?E.inactive_placeholder:E.placeholder,integer:E.kind==="integer",disabled:P||N},E.name)},S=["sizing","stops_targets","trade_management","execution_guards","identity"];return s.jsxs("div",{className:"rounded-lg border border-border bg-popover/40",children:[s.jsxs("button",{type:"button",onClick:()=>a(E=>!E),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-popover/60 transition-colors","aria-expanded":r,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{size:16,className:`text-muted-foreground transition-transform ${r?"rotate-180":"-rotate-90"}`}),s.jsxs("span",{className:"text-sm font-medium text-foreground",children:["Trading defaults: ",t]})]}),s.jsx("span",{className:`text-[0.6875rem] uppercase tracking-widest ${r?"text-muted-foreground":"text-primary"}`,children:r?"Editing":"Click to edit"})]}),r&&s.jsxs("div",{className:"border-t border-border/60 p-4 space-y-4",children:[i&&s.jsx("div",{className:"space-y-3",children:[...Array(3)].map((E,B)=>s.jsx(Ee,{className:"h-24 w-full rounded-lg"},B))}),u&&s.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive flex items-center justify-between",children:[s.jsx("span",{children:u}),s.jsxs(re,{variant:"outline",size:"sm",onClick:x,children:[s.jsx(zt,{size:13,className:"mr-1.5"})," Retry"]})]}),!i&&!u&&f&&s.jsxs(s.Fragment,{children:[S.map(E=>s.jsx(iD,{title:lD[E],alwaysOpen:E==="sizing",defaultOpen:!1,children:Gi.filter(
624B=>B.section===E).map(T)},E)),s.jsxs("div",{className:"rounded-lg border border-border/60 bg-popover/30 p-3 space-y-1.5",children:[s.jsx("p",{className:"text-[0.6875rem] uppercase tracking-widest text-muted-foreground",children:"Not shown here"}),dD.map(E=>s.jsx("p",{className:"text-[0.75rem] leading-snug text-muted-foreground",children:E},E))]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:j,disabled:!v||l,children:"Reset"}),s.jsxs(re,{size:"sm",onClick:y,disabled:!v||l,children:[s.jsx(Qg,{size:14,className:"mr-1.5"}),l?"Saving…":"Save defaults"]})]})]})]})]})}var pD=Object.defineProperty,hD=Object.defineProperties,gD=Object.getOwnPropertyDescriptors,Da=Object.getOwnPropertySymbols,ng=Object.prototype.hasOwnProperty,rg=Object.prototype.propertyIsEnumerable,Yd=(e,t,n)=>t in e?pD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xD=(e,t)=>{for(var n in t||(t={}))ng.call(t,n)&&Yd(e,n,t[n]);if(Da)for(var n of Da(t))rg.call(t,n)&&Yd(e,n,t[n]);return e},yD=(e,t)=>hD(e,gD(t)),bD=(e,t)=>{var n={};for(var r in e)ng.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Da)for(var r of Da(e))t.indexOf(r)<0&&rg.call(e,r)&&(n[r]=e[r]);return n};function vD(e){let t=setTimeout(e,0),n=setTimeout(e,10),r=setTimeout(e,50);return[t,n,r]}function wD(e){let t=h.useRef();return h.useEffect(()=>{t.current=e}),t.current}var kD=18,sg=40,_D=`${sg}px`,jD=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function ND({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,u]=h.useState(!1),d=h.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&a&&o,[a,o,n]),m=h.useCallback(()=>{let p=e.current,f=t.current;if(!p||!f||c||n==="none")return;let g=p,x=g.getBoundingClientRect().left+g.offsetWidth,b=g.getBoundingClientRect().top+g.offsetHeight/2,y=x-kD,j=b;document.querySelectorAll(jD).length===0&&document.elementFromPoint(y,j)===p||(i(!0),u(!0))},[e,t,c,n]);return h.useEffect(()=>{let p=e.current;if(!p||n==="none")return;function f(){let x=window.innerWidth-p.getBoundingClientRect().right;l(x>=sg)}f();let g=setInterval(f,1e3);return()=>{clearInterval(g)}},[e,n]),h.useEffect(()=>{let p=r||document.activeElement===t.current;if(n==="none"||!p)return;let f=setTimeout(m,0),g=setTimeout(m,2e3),x=setTimeout(m,5e3),b=setTimeout(()=>{u(!0)},6e3);return()=>{clearTimeout(f),clearTimeout(g),clearTimeout(x),clearTimeout(b)}},[t,r,n,m]),{hasPWMBadge:a,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:_D}}var ag=h.createContext({}),ig=h.forwardRef((e,t)=>{var n=e,{value:r,onChange:a,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:u="numeric",onComplete:d,pushPasswordManagerStrategy:m="increase-width",pasteTransformer:p,containerClassName:f,noScriptCSSFallback:g=SD,render:x,children:b}=n,y=bD(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),j,v,C,T,S;let[E,B]=h.useState(typeof y.defaultValue=="string"?y.defaultValue:""),P=r??E,N=wD(P),L=h.useCallback(Q=>{a==null||a(Q),B(Q)},[a]),_=h.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),D=h.useRef(null),A=h.useRef(null),V=h.useRef({value:P,onChange:L,isIOS:typeof window<"u"&&((v=(j=window==null?void 0:window.CSS)==null?void 0:j.supports)==null?void 0:v.call(j,"-webkit-touch-callout","none"))}),J=h.useRef({prev:[(C=D.current)==null?void 0:C.selectionStart,(T=D.current)==null?void 0:T.selectionEnd,(S=D.current)==null?void 0:S.selectionDirection]});h.useImperativeHandle(t,()=>D.current,[]),h.useEffect(()=>{let Q=D.current,ae=A.current;if(!Q||!ae)return;V.current.value!==Q.value&&V.current.onChange(Q.value),J.current.prev=[Q.selectionStart,Q.selectionEnd,Q.selectionDirection];function q(){if(document.activeElement!==Q){R(null),te(null);return}let _e=Q.selectionStart,We=Q.selectionEnd,at=Q.selectionDirection,rt=Q.maxLength,tt=Q.value,Je=J.current.prev,Ge=-1,I=-1,Y;if(tt.length!==0&&_e!==null&&We!==null){let le=_e===We,Le=_e===tt.length&&tt.length<rt;if(le&&!Le){let Se=_e;if(Se===0)Ge=0,I=1,Y="forward";else if(Se===rt)Ge=Se-1,I=Se,Y="backward";else if(rt>1&&tt.length>1){let Xe=0;if(Je[0]!==null&&Je[1]!==null){Y=Se<Je[1]?"backward":"forward";let it=Je[0]===Je[1]&&Je[0]<rt;Y==="backward"&&!it&&(Xe=-1)}Ge=Xe+Se,I=Xe+Se+1}}Ge!==-1&&I!==-1&&Ge!==I&&D.current.setSelectionRange(Ge,I,Y)}
624let de=Ge!==-1?Ge:_e,we=I!==-1?I:We,je=Y??at;R(de),te(we),J.current.prev=[de,we,je]}if(document.addEventListener("selectionchange",q,{capture:!0}),q(),document.activeElement===Q&&k(!0),!document.getElementById("input-otp-style")){let _e=document.createElement("style");if(_e.id="input-otp-style",document.head.appendChild(_e),_e.sheet){let We="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";ts(_e.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),ts(_e.sheet,`[data-input-otp]:autofill { ${We} }`),ts(_e.sheet,`[data-input-otp]:-webkit-autofill { ${We} }`),ts(_e.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),ts(_e.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let oe=()=>{ae&&ae.style.setProperty("--root-height",`${Q.clientHeight}px`)};oe();let De=new ResizeObserver(oe);return De.observe(Q),()=>{document.removeEventListener("selectionchange",q,{capture:!0}),De.disconnect()}},[]);let[O,z]=h.useState(!1),[F,k]=h.useState(!1),[H,R]=h.useState(null),[w,te]=h.useState(null);h.useEffect(()=>{vD(()=>{var Q,ae,q,oe;(Q=D.current)==null||Q.dispatchEvent(new Event("input"));let De=(ae=D.current)==null?void 0:ae.selectionStart,_e=(q=D.current)==null?void 0:q.selectionEnd,We=(oe=D.current)==null?void 0:oe.selectionDirection;De!==null&&_e!==null&&(R(De),te(_e),J.current.prev=[De,_e,We])})},[P,F]),h.useEffect(()=>{N!==void 0&&P!==N&&N.length<i&&P.length===i&&(d==null||d(P))},[i,d,N,P]);let W=ND({containerRef:A,inputRef:D,pushPasswordManagerStrategy:m,isFocused:F}),U=h.useCallback(Q=>{let ae=Q.currentTarget.value.slice(0,i);if(ae.length>0&&_&&!_.test(ae)){Q.preventDefault();return}typeof N=="string"&&ae.length<N.length&&document.dispatchEvent(new Event("selectionchange")),L(ae)},[i,L,N,_]),K=h.useCallback(()=>{var Q;if(D.current){let ae=Math.min(D.current.value.length,i-1),q=D.current.value.length;(Q=D.current)==null||Q.setSelectionRange(ae,q),R(ae),te(q)}k(!0)},[i]),ie=h.useCallback(Q=>{var ae,q;let oe=D.current;if(!p&&(!V.current.isIOS||!Q.clipboardData||!oe))return;let De=Q.clipboardData.getData("text/plain"),_e=p?p(De):De;Q.preventDefault();let We=(ae=D.current)==null?void 0:ae.selectionStart,at=(q=D.current)==null?void 0:q.selectionEnd,rt=(We!==at?P.slice(0,We)+_e+P.slice(at):P.slice(0,We)+_e+P.slice(We)).slice(0,i);if(rt.length>0&&_&&!_.test(rt))return;oe.value=rt,L(rt);let tt=Math.min(rt.length,i-1),Je=rt.length;oe.setSelectionRange(tt,Je),R(tt),te(Je)},[i,L,_,P]),ne=h.useMemo(()=>({position:"relative",cursor:y.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[y.disabled]),ue=h.useMemo(()=>({position:"absolute",inset:0,width:W.willPushPWMBadge?`calc(100% + ${W.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:W.willPushPWMBadge?`inset(0 ${W.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[W.PWM_BADGE_SPACE_WIDTH,W.willPushPWMBadge,o]),pe=h.useMemo(()=>h.createElement("input",yD(xD({autoComplete:y.autoComplete||"one-time-code"},y),{"data-input-otp":!0,"data-input-otp-placeholder-shown":P.length===0||void 0,"data-input-otp-mss":H,"data-input-otp-mse":w,inputMode:u,pattern:_==null?void 0:_.source,"aria-placeholder":c,style:ue,maxLength:i,value:P,ref:D,onPaste:Q=>{var ae;ie(Q),(ae=y.onPaste)==null||ae.call(y,Q)},onChange:U,onMouseOver:Q=>{var ae;z(!0),(ae=y.onMouseOver)==null||ae.call(y,Q)},onMouseLeave:Q=>{var ae;z(!1),(ae=y.onMouseLeave)==null||ae.call(y,Q)},onFocus:Q=>{var ae;K(),(ae=y.onFocus)==null||ae.call(y,Q)},onBlur:Q=>{var ae;k(!1),(ae=y.onBlur)==null||ae.call(y,Q)}})),[U,K,ie,u,ue,i,w,H,y,_==null?void 0:_.source,P]),X=h.useMemo(()=>({slots:Array.from({length:i}).map((Q,ae)=>{var q;let oe=F&&H!==null&&w!==null&&(H===w&&ae===H||ae>=H&&ae<w),De=P[ae]!==void 0?P[ae]:null,_e=P[0]!==void 0?null:(q=c==null?void 0:c[ae])!=null?q:null;return{char:De,placeholderChar:_e,isActive:oe,hasFakeCaret:oe&&De===null}}),isFocused:F,isHovering:!y.disabled&&O}),[F,O,i,w,H,y.disabled,P]),ve=h.useMemo(()=>x?x(X):h.createElement(ag.Provider,{value:X},b),[b,X,x]);return h.createElement(h.Fragment,null,g!==null&&h.createElement("noscript",null,h.createElement("style",null,g)),h.createElement("div",{ref:A,"data-input-otp-container":!0,style:ne,className:f},ve,h.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},pe)))});ig.displayName="Input";function ts(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var SD=`
625[data-input-otp] {
626  --nojs-bg: white !important;
627  --nojs-fg: black !important;
628
629  background-color: var(--nojs-bg) !important;
630  color: var(--nojs-fg) !important;
631  caret-color: var(--nojs-fg) !important;
632  letter-spacing: .25em !important;
633  text-align: center !important;
634  border: 1px solid var(--nojs-fg) !important;
635  border-radius: 4px !important;
636  width: 100% !important;
637}
638@media (prefers-color-scheme: dark) {
639  [data-input-otp] {
640    --nojs-bg: black !important;
641    --nojs-fg: white !important;
642  }
643}`,ED="^\\d+$";const og=h.forwardRef(({className:e,containerClassName:t,...n},r)=>s.jsx(ig,{ref:r,containerClassName:se("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:se("disabled:cursor-not-allowed",e),...n}));og.displayName="InputOTP";const lg=h.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:se("flex items-center",e),...t}));
643lg.displayName="InputOTPGroup";const Fn=h.forwardRef(({index:e,className:t,...n},r)=>{const a=h.useContext(ag),{char:i,hasFakeCaret:o,isActive:l}=a.slots[e];return s.jsxs("div",{ref:r,className:se("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...n,children:[i,o&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:s.jsx("div",{className:"animate-caret-blink h-4 w-px bg-foreground duration-1000"})})]})});Fn.displayName="InputOTPSlot";const CD=h.forwardRef(({...e},t)=>s.jsx("div",{ref:t,role:"separator",...e,children:s.jsx(Zg,{})}));CD.displayName="InputOTPSeparator";const ns="https://api.viewlink.dev";function TD(e){try{return Ke(new Date(e),"d MMM yyyy")}catch{return"—"}}function AD(e){try{return`${jp(new Date(e))} ago`}catch{return"—"}}async function Xi(e,t){try{const n=await e.json();if(n&&typeof n.detail=="string")return n.detail}catch{}return t}class rs extends Error{constructor(){super("session expired"),this.name="SessionExpiredError"}}function ID(){var ae;const{session:e}=be(),{toast:t}=Wt(),[n,r]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(!1),[c,u]=h.useState(!1),[d,m]=h.useState(!1),[p,f]=h.useState(!1),[g,x]=h.useState(null),[b,y]=h.useState(null),[j,v]=h.useState(null),[C,T]=h.useState(0),[S,E]=h.useState(!1),B=h.useRef(null),[P,N]=h.useState("idle"),[L,_]=h.useState(""),[D,A]=h.useState(null),[V,J]=h.useState(!1),[O,z]=h.useState(!1),[F,k]=h.useState(null),[H,R]=h.useState(!1),w=h.useCallback(()=>e!=null&&e.access_token?{Authorization:`Bearer ${e.access_token}`}:{},[e]),te=h.useCallback(async q=>{var at;const oe=await q(w());if(oe.status!==401)return oe;const{data:De,error:_e}=await Z.auth.refreshSession(),We=(at=De==null?void 0:De.session)==null?void 0:at.access_token;if(_e||!We)throw console.warn("[DevicesSection] token refresh failed — session expired"),new rs;return q({Authorization:`Bearer ${We}`})},[w]),W=h.useCallback(async()=>{if(e!=null&&e.access_token){i(!0),l(!1),u(!1);try{const q=await te(De=>fetch(`${ns}/v1/devices/`,{headers:De}));if(!q.ok)throw new Error(`HTTP ${q.status}`);const oe=await q.json();r(Array.isArray(oe)?oe:[])}catch(q){q instanceof rs?u(!0):(console.error("[DevicesSection] fetchDevices failed:",q),l(!0))}finally{i(!1)}}},[e,te]);h.useEffect(()=>{W()},[W]),h.useEffect(()=>{if(j===null)return;const q=()=>{T(Math.max(0,Math.ceil((j-Date.now())/1e3)))};return q(),B.current=setInterval(q,1e3),()=>{B.current&&clearInterval(B.current),B.current=null}},[j]);const U=async q=>{const oe=await te(_e=>fetch(`${ns}/v1/devices/enroll-code`,{method:"POST",headers:{..._e,"Content-Type":"application/json"},body:JSON.stringify(q!==void 0?{email_code:q}:{})}));if(!oe.ok){const _e=new Error(`HTTP ${oe.status}`);throw _e.status=oe.status,_e.detail=await Xi(oe,`HTTP ${oe.status}`),_e}const De=await oe.json();x(De.enroll_code),v(Date.now()+De.expires_in*1e3),N("pairing")},K=async()=>{if(e!=null&&e.access_token){m(!0),f(!0),y(null),x(null),v(null),E(!1),_(""),A(null),N("idle");try{const q=await te(De=>fetch(`${ns}/v1/devices/enroll-code/request`,{method:"POST",headers:De}));if(q.status===429){y("Too many requests. Please try again in a minute.");return}if(q.status===403){y(await Xi(q,"We couldn't start device pairing for this account."));return}if(!q.ok)throw new Error(`HTTP ${q.status}`);if((await q.json()).factor_required===!1){await U();return}N("awaitingEmailCode")}catch(q){q instanceof rs?y("Your session expired. Please sign in again."):(console.error("[DevicesSection] start enrollment failed:",q),y("Could not start device pairing. Please try again."))}finally{f(!1)}}},ie=async()=>{if(!(!(e!=null&&e.access_token)||!L.trim())){J(!0),A(null);try{await U(L.trim())}catch(q){if(q instanceof rs)A("Your session expired. Please sign in again.");else{const oe=q;oe.status===429?(A(oe.detail||"Too many attempts. Request a new code."),_("")):oe.status===401?A(oe.detail||"Incorrect or expired code."):(console.error("[DevicesSection] submit email code failed:",q),A("Something went wrong. Please try again."))}}finally{J(!1)}}},ne=async()=>
643{if(e!=null&&e.access_token){z(!0),A(null);try{const q=await te(oe=>fetch(`${ns}/v1/devices/enroll-code/request`,{method:"POST",headers:oe}));if(q.status===429){A("Too many requests. Please try again in a minute.");return}if(q.status===403){A(await Xi(q,"We couldn't resend the code."));return}if(!q.ok)throw new Error(`HTTP ${q.status}`);_(""),t({title:"New code sent"})}catch(q){q instanceof rs?A("Your session expired. Please sign in again."):(console.error("[DevicesSection] resend code failed:",q),A("Could not resend the code. Please try again."))}finally{z(!1)}}},ue=async()=>{if(g)try{await navigator.clipboard.writeText(g),E(!0),t({title:"Code copied to clipboard"}),setTimeout(()=>E(!1),1500)}catch{t({title:"Could not copy",variant:"destructive"})}},pe=()=>{m(!1),v(null),x(null),y(null),N("idle"),_(""),A(null)},X=async()=>{if(!(!F||!(e!=null&&e.access_token))){R(!0);try{const q=await fetch(`${ns}/v1/devices/${encodeURIComponent(F.device_id)}/revoke`,{method:"POST",headers:w()});if(q.status===404){t({title:"Device not found",variant:"destructive"}),k(null),await W();return}if(!q.ok)throw new Error(`HTTP ${q.status}`);t({title:"Device revoked"}),k(null),await W()}catch(q){console.error("[DevicesSection] revoke failed:",q),t({title:"Could not revoke device",variant:"destructive"})}finally{R(!1)}}},ve=j!==null&&C<=0,Q=`${Math.floor(C/60)}:${String(C%60).padStart(2,"0")}`;return s.jsxs(s.Fragment,{children:[a?s.jsx("div",{className:"space-y-3",children:[...Array(2)].map((q,oe)=>s.jsx(Ee,{className:"h-16 w-full rounded-lg"},oe))}):c?s.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-5 text-center",children:[s.jsx(Cn,{className:"mx-auto mb-2 text-destructive",size:20}),s.jsx("p",{className:"text-sm text-destructive",children:"Your session expired. Please sign in again."})]}):o?s.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-5 text-center",children:[s.jsx(Cn,{className:"mx-auto mb-2 text-destructive",size:20}),s.jsx("p",{className:"text-sm text-destructive mb-3",children:"Failed to load devices."}),s.jsxs(re,{variant:"outline",size:"sm",onClick:W,children:[s.jsx(zt,{size:14,className:"mr-1.5"})," Retry"]})]}):n.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No devices yet."}):s.jsx("div",{className:"space-y-3",children:n.map(q=>{const oe=q.status==="active";return s.jsx("div",{className:`rounded-lg border border-border bg-popover/50 p-4 ${oe?"":"opacity-60"}`,children:s.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:q.device_label}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Added ",TD(q.created_at)," ·"," ",q.last_used_at?`last used ${AD(q.last_used_at)}`:"Never used"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${oe?"bg-success animate-pulse-connected":"bg-muted-foreground"}`}),s.jsx("span",{className:`text-[0.6875rem] font-semibold tracking-widest uppercase ${oe?"text-success":"text-muted-foreground"}`,children:oe?"Active":"Revoked"})]})]}),oe&&s.jsx(re,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>k(q),"aria-label":"Revoke device",children:s.jsx(ex,{size:14})})]})},q.device_id)})}),s.jsx("div",{className:"mt-4",children:s.jsxs(re,{variant:"outline",size:"sm",onClick:K,disabled:!(e!=null&&e.access_token),children:[s.jsx(Am,{size:14,className:"mr-1.5"})," Add a device"]})}),s.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Generate a pairing code, then enter it in the ViewLink browser extension to link this device."}),s.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-lg border p-3 text-xs leading-relaxed",style:{borderColor:"rgba(245,158,11,0.35)",backgroundColor:"rgba(245,158,11,0.06)",color:"#F59E0B"},children:[s.jsx(Ji,{size:14,className:"mt-0.5 shrink-0"}),s.jsx("span",{children:"Only pair devices you own and trust, and don't share your pairing code with anyone. If a device is ever lost or stolen, revoke it here straight away. Once revoked, the device will no longer be trusted."})]}),s.jsx(pn,{open:d,onOpenChange:q=>{q||pe()},children:s.jsxs(en,{children:[s.jsxs(It,{children:[s.jsx(Dt,{children:P==="awaitingEmailCode"?"Verify it's you":"Pair a new device"}),s.jsx(Bt,{children:P==="awaitingEmailCode"?"Enter the code we emailed you to continue."
643:"Enter this code in the ViewLink extension within 10 minutes."})]}),s.jsx("div",{className:"py-4 text-center",children:p?s.jsx(Ee,{className:"mx-auto h-12 w-48"}):b?s.jsxs("div",{className:"space-y-3",children:[s.jsx(Cn,{className:"mx-auto text-destructive",size:22}),s.jsx("p",{className:"text-sm text-destructive",children:b}),s.jsxs(re,{variant:"outline",size:"sm",onClick:K,children:[s.jsx(zt,{size:14,className:"mr-1.5"})," Try again"]})]}):P==="awaitingEmailCode"?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["We emailed a verification code to"," ",s.jsx("span",{className:"font-medium text-foreground",children:((ae=e==null?void 0:e.user)==null?void 0:ae.email)||"your account email"}),". Enter it to continue."]}),s.jsx("div",{className:"flex justify-center",children:s.jsx(og,{maxLength:6,value:L,pattern:ED,inputMode:"numeric",autoComplete:"one-time-code",autoFocus:!0,"aria-label":"Email verification code",onChange:q=>{_(q),D&&A(null)},onComplete:()=>{V||ie()},children:s.jsxs(lg,{children:[s.jsx(Fn,{index:0}),s.jsx(Fn,{index:1}),s.jsx(Fn,{index:2}),s.jsx(Fn,{index:3}),s.jsx(Fn,{index:4}),s.jsx(Fn,{index:5})]})})}),D&&s.jsx("p",{className:"text-sm text-destructive",children:D}),s.jsxs("div",{className:"space-y-2.5 pt-1",children:[s.jsx(re,{className:"w-full",onClick:ie,disabled:V||L.trim().length<6,children:V?"Verifying…":"Continue"}),s.jsxs("button",{type:"button",onClick:ne,disabled:O,className:"mx-auto flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",children:[s.jsx(zt,{size:12}),O?"Sending…":"Resend code"]})]})]}):g?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-center gap-3",children:[s.jsx("code",{className:"font-mono text-3xl font-semibold tracking-[0.3em] text-foreground",children:g}),s.jsx(re,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:ue,"aria-label":"Copy code",children:S?s.jsx(ot,{size:16,className:"text-[hsl(var(--success))]"}):s.jsx(tx,{size:16})})]}),ve?s.jsx("p",{className:"text-sm text-destructive",children:"Code expired. Generate a new one."}):s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Expires in"," ",s.jsx("span",{className:"font-medium text-foreground",children:Q})]}),ve&&s.jsxs(re,{variant:"outline",size:"sm",onClick:K,children:[s.jsx(zt,{size:14,className:"mr-1.5"})," Generate new code"]})]}):null}),s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border p-3 text-xs leading-relaxed text-muted-foreground",style:{borderColor:"rgba(245,158,11,0.35)",backgroundColor:"rgba(245,158,11,0.06)"},children:[s.jsx(Ji,{size:14,className:"mt-0.5 shrink-0",style:{color:"#F59E0B"}}),s.jsx("span",{children:"Pair only your own device and don't share your pairing code with anyone. If it is ever lost or stolen, revoke it here immediately, a revoked device will no longer be trusted."})]}),s.jsx(hn,{children:s.jsx(re,{variant:"ghost",onClick:pe,children:"Done"})})]})}),s.jsx(pn,{open:!!F,onOpenChange:q=>{q||k(null)},children:s.jsxs(en,{children:[s.jsxs(It,{children:[s.jsx(Dt,{className:"text-destructive",children:"Revoke device"}),s.jsx(Bt,{children:F?`"${F.device_label}" will no longer be trusted. This cannot be undone.`:""})]}),s.jsxs(hn,{children:[s.jsx(re,{variant:"ghost",onClick:()=>k(null),children:"Cancel"}),s.jsx(re,{variant:"destructive",onClick:X,disabled:H,children:H?"Revoking…":"Revoke Device"})]})]})})]})}function ss({icon:e,title:t,children:n}){return s.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-sm animate-fade-up",children:[s.jsxs("div",{className:"flex items-center gap-2.5 mb-6",children:[s.jsx(e,{size:18,className:"text-muted-foreground"}),s.jsx("h2",{className:"text-[1.375rem] font-semibold tracking-tight text-foreground",children:t})]}),n]})}function DD(){const{user:e}=be(),{toast:t}=Wt(),[n,r]=h.useState(!0),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState(null),[d,m]=h.useState(null),[p,f]=h.useState([]),[g,x]=h.useState(null),[b,y]=h.useState(""),[j,v]=h.useState(!1),[C,T]=h.useState(""),[S,E]=h.useState(""),[B,P]=h.useState(""),[N,L]=h.useState(!1),[_,D]=h.useState([]),[A,V]=h.useState(!1),J=h.useCallback(async()=>{var W;if(e){r(!0),i(null);
643try{const[U,K,ie,ne,ue]=await Promise.all([Z.from("profiles").select("email").eq("id",e.id).single(),Z.from("license_keys").select("license_key, webhook_secret, max_accounts, created_at").eq("user_id",e.id).eq("is_active",!0).limit(1).maybeSingle(),Z.from("vps_records").select("status").eq("user_id",e.id).limit(1).maybeSingle(),Z.from("mt5_accounts").select("id, account_label, broker_company, is_active, risk_percent").eq("user_id",e.id).order("sort_order",{ascending:!0}),Z.from("notification_preferences").select("id, event_type, channel, is_enabled").eq("user_id",e.id).in("event_type",["EXECUTION_FAILED","EA_DISCONNECTED"]).eq("channel","email")]);if(U.error)throw U.error;l(U.data),u(K.data??null),m(((W=ie.data)==null?void 0:W.status)??null),f(ne.data??[]),D(ue.data??[])}catch(U){i(U.message??"Failed to load settings")}finally{r(!1)}}},[e==null?void 0:e.id]);h.useEffect(()=>{J()},[J]);const O=W=>{x(W.id),y(W.account_label)},z=async()=>{if(!g)return;const{error:W}=await Z.from("mt5_accounts").update({account_label:b}).eq("id",g);W?t({title:"Error updating account",description:W.message,variant:"destructive"}):(t({title:"Account updated"}),x(null),J())},F=async()=>{if(S!==B){t({title:"Passwords do not match",variant:"destructive"});return}if(S.length<8){t({title:"Password must be at least 8 characters",variant:"destructive"});return}L(!0);const{error:W}=await Z.auth.updateUser({password:S});L(!1),W?t({title:"Error changing password",description:W.message,variant:"destructive"}):(t({title:"Password updated"}),v(!1),T(""),E(""),P(""))},k=async W=>{V(!0);const{error:U}=await Z.from("notification_preferences").update({is_enabled:!W.is_enabled}).eq("id",W.id);V(!1),U?t({title:"Error updating notification",variant:"destructive"}):D(K=>K.map(ie=>ie.id===W.id?{...ie,is_enabled:!ie.is_enabled}:ie))};if(n)return s.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8 space-y-8",children:[s.jsx(Ee,{className:"h-8 w-48"}),[...Array(5)].map((W,U)=>s.jsx(Ee,{className:"h-48 w-full rounded-xl"},U))]});if(a)return s.jsx("div",{className:"max-w-4xl mx-auto px-4 py-8",children:s.jsxs("div",{className:"rounded-xl border border-destructive/30 bg-destructive/5 p-6 text-center",children:[s.jsx(Cn,{className:"mx-auto mb-3 text-destructive",size:24}),s.jsx("p",{className:"text-sm text-destructive mb-4",children:a}),s.jsxs(re,{variant:"outline",size:"sm",onClick:J,children:[s.jsx(zt,{size:14,className:"mr-1.5"})," Retry"]})]})});const H=_.find(W=>W.event_type==="EXECUTION_FAILED"),R=_.find(W=>W.event_type==="EA_DISCONNECTED"),w=(c==null?void 0:c.max_accounts)??1,te=p.length>=w;return s.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8 space-y-8",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-tight text-foreground",children:"Settings"}),s.jsx(ss,{icon:nx,title:"Integration",children:c?s.jsx("div",{className:"space-y-5",children:s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[0.8125rem] font-medium text-muted-foreground",children:"Connection Status"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(_o,{})})]})}):s.jsx("p",{className:"text-sm text-muted-foreground",children:"No active license found. Complete onboarding to get started."})}),s.jsxs(ss,{icon:Ma,title:"MT5 Accounts",children:[p.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No accounts configured yet."}):s.jsx("div",{className:"space-y-3",children:p.map(W=>{const U=g===W.id;return s.jsxs("div",{className:"rounded-lg border border-border bg-popover/50 p-4",children:[U?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ze,{className:"text-xs text-muted-foreground",children:"Label"}),s.jsx(qe,{value:b,onChange:K=>y(K.target.value),className:"bg-input border-border h-9 text-sm"})]}),s.jsx("p",{className:"text-[0.6875rem] text-muted-foreground",children:'Your broker is detected from your MT5 login. Risk %, lot size, stops, trade management and all other trading defaults are in "Trading defaults" below.'}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>x(null),children:"Cancel"}),s.jsx(re,{size:"sm",onClick:z,children:"Save"})]})]}):s.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:W.account_label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:W.broker_company??"Not connected"})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${W.is_active?"bg-success animate-pulse-connected":"bg-destructive"}`}),s.jsx("span",{className:`text-[0.6875rem] font-semibold tracking-widest uppercase ${W.is_active?"text-success":"text-destructive"}`,children:W.is_active?"Active":"Inactive"})]}),s.jsx(_o,{accountId:W.id})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(re,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>O(W),children:s.jsx(rx,{size:14})})})]}),!U&&s.jsx("div",{className:"mt-3",children:s.jsx(fD,{accountId:W.id,accountLabel:W.account_label})})]},W.id)})}),s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("span",{children:s.jsxs(re,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Am,{size:14,className:"mr-1.5"})," Add Account"]})})}),s.jsx(Gn,{children:te?"Upgrade your plan to add more accounts":"Coming soon. Account provisioning is handled server-side"})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," / ",w," accounts"]})]}),s.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Accounts are configured on your VPS for you. No manual setup required."})]}),s.jsx(ss,{icon:sx,title:"Devices",children:s.jsx(ID,{})}),s.jsx(ss,{icon:ax,title:"Account",children:s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{className:"text-[0.8125rem] text-muted-foreground",children:"Email"}),s.jsx(qe,{value:(o==null?void 0:o.email)??"",readOnly:!0,className:"bg-input border-border opacity-60"})]}),s.jsx("div",{className:"flex flex-wrap gap-3",children:s.jsxs(re,{variant:"outline",size:"sm",onClick:()=>v(!0),children:[s.jsx(Cm,{size:14,className:"mr-1.5"})," Change Password"]})})]})}),s.jsx(ss,{icon:ix,title:"Notifications",children:s.jsxs("div",{className:"space-y-4",children:[H&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ze,{className:"text-sm text-foreground",children:"Email me when a trade fails"}),s.jsx(Ia,{checked:H.is_enabled??!1,onCheckedChange:()=>k(H),disabled:A})]}),R&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ze,{className:"text-sm text-foreground",children:"Email me when my connection drops for > 5 minutes"}),s.jsx(Ia,{checked:R.is_enabled??!1,onCheckedChange:()=>k(R),disabled:A})]}),!H&&!R&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"No notification preferences configured."})]})}),s.jsx(pn,{open:j,onOpenChange:v,children:s.jsxs(en,{children:[s.jsxs(It,{children:[s.jsx(Dt,{children:"Change Password"}),s.jsx(Bt,{children:"Enter a new password for your account."})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{className:"text-sm text-muted-foreground",children:"Current Password"}),s.jsx(qe,{type:"password",autoComplete:"current-password",value:C,onChange:W=>T(W.target.value),className:"bg-input border-border"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{className:"text-sm text-muted-foreground",children:"New Password"}),s.jsx(qe,{type:"password",autoComplete:"new-password",value:S,onChange:W=>E(W.target.value),className:"bg-input border-border"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{className:"text-sm text-muted-foreground",children:"Confirm New Password"}
643),s.jsx(qe,{type:"password",autoComplete:"new-password",value:B,onChange:W=>P(W.target.value),className:"bg-input border-border"})]})]}),s.jsxs(hn,{children:[s.jsx(re,{variant:"ghost",onClick:()=>v(!1),children:"Cancel"}),s.jsx(re,{onClick:F,disabled:N,children:N?"Updating…":"Update Password"})]})]})})]})}const as="https://api.viewlink.dev",Hd={starter:0,pro:1,firm:2},PD=["Too expensive","Missing features","Switching to competitor","No longer need","Too complex","Prefer not to say","Other"],MD=({label:e,selected:t,onSelect:n})=>s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-4 py-2 rounded-full text-[0.875rem] font-medium border transition-all duration-[120ms]",style:t?{background:"#4A72FF",borderColor:"#4A72FF",color:"#FFFFFF"}:{background:"#13161E",borderColor:"#333A52",color:"#8A92A8"},children:[e,t&&s.jsx(ot,{size:13,strokeWidth:2.5})]}),LD=({discountBps:e,lockMonths:t,onKeep:n,onContinue:r})=>{const a=parseFloat((e/100).toFixed(2)),i=t!=null&&t>0,o=i?"rate":"membership";return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"rounded-lg p-5 space-y-2",style:{background:"rgba(74,114,255,0.08)",border:"1px solid rgba(74,114,255,0.20)",borderLeft:"3px solid #4A72FF"},children:[s.jsx("p",{className:"text-[0.9375rem] font-semibold",style:{color:"#EAEDF5"},children:i?"You'll lose your locked rate":"You'll lose your complimentary membership"}),s.jsx("p",{className:"text-[0.875rem]",style:{color:"#8A92A8",lineHeight:1.6},children:i?s.jsxs(s.Fragment,{children:["Your rate of ",s.jsxs("strong",{style:{color:"#EAEDF5"},children:[a,"% off"]})," for your first"," ",s.jsx("strong",{style:{color:"#EAEDF5"},children:t})," billing"," ",t===1?"cycle":"cycles"," is a one-time offer we can't reissue. If you cancel now you give it up, and coming back later means paying the standard price."]}):s.jsx(s.Fragment,{children:"Your complimentary membership is a one-time offer we can't reissue. If you cancel now you give it up, and coming back later means paying the standard price."})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:{background:"#4A72FF",color:"#fff",border:"none"},children:["Keep my ",o]}),s.jsx("button",{onClick:r,className:"text-[0.8125rem] transition-colors duration-150",style:{color:"#505770"},onMouseEnter:l=>l.target.style.color="#8A92A8",onMouseLeave:l=>l.target.style.color="#505770",children:"Continue to cancel"})]})]})},OD=({tradeCount:e,reason:t,setReason:n,onContinue:r,isTrial:a,detail:i,setDetail:o})=>{const l=!!t;return s.jsxs("div",{className:"space-y-5",children:[a&&s.jsxs("div",{className:"rounded-lg px-4 py-3 space-y-1.5",style:{background:"rgba(240, 180, 41, 0.06)",border:"1px solid rgba(240, 180, 41, 0.22)",borderLeft:"3px solid #F0B429"},children:[s.jsx("p",{className:"text-[0.875rem] font-semibold",style:{color:"#F0B429"},children:"You keep your trial until it was due to end"}),s.jsx("p",{className:"text-[0.8125rem]",style:{color:"#8A92A8",lineHeight:1.6},children:"Cancelling stops your trial turning into a paid subscription. You keep full access to ViewLink until your original trial end date, and you won't be charged."})]}),s.jsx("p",{className:"text-[0.9375rem]",style:{color:"#8A92A8",lineHeight:1.6},children:e===null?s.jsx("span",{className:"inline-block w-24 h-4 rounded bg-[#252A38] animate-pulse"}):e===0?"You haven't placed any trades through ViewLink yet this month.":s.jsxs(s.Fragment,{children:["You've placed"," ",s.jsx("strong",{style:{color:"#EAEDF5"},children:e})," ",e===1?"trade":"trades"," through ViewLink this month."]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-[0.8125rem] font-medium uppercase tracking-[0.08em]",style:{color:"#505770"},children:"Why are you leaving?"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:PD.map(c=>s.jsx(MD,{label:c,selected:t===c,onSelect:()=>n(c)},c))})]}),t==="Other"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{htmlFor:"exit-reason-detail",className:"block text-[0.8125rem]",style:{color:"#8A92A8"},children:["What made you leave? ",s.jsx("span",{style:{color:"#505770"},children:"(optional)"})]}),s.jsx("textarea",{id:"exit-reason-detail",value:i,onChange:c=>o(c.target.value),maxLength:500,rows:3,placeholder:"Anything you'd like us to know",className:"w-full rounded-lg px-3 py-2 text-[0.875rem] resize-none focus:outline-none",style:{background:"#13161E",border:"1px solid #252A38",color:"#EAEDF5"}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("button",{onClick:r,disabled:!l,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:l?{background:"#4A72FF",color:"#fff",border:"none"}:{background:"transparent",color:"#505770",border:"1px solid #333A52",opacity:.5,cursor:"not-allowed"},children:"Continue →"}),!l&&s.jsx("p",{className:"text-[0.8125rem]",style:{color:"#505770"},children:"Pick a reason above to continue."})]})]})},RD=({lowerPlan:e,downgradingTo:t,onDowngrade:n,onCancel:r})=>s.jsxs("div",{className:"space-y-5",children:[s.jsx("p",{className:"text-[0.9375rem]",style:{color:"#8A92A8"},children:"Would a lower plan work instead?"}),s.jsxs("div",{className:"rounded-xl p-6 space-y-4",style:{background:"linear-gradient(135deg, #13161E 0%, #1C2030 100%)",border:"1px solid #252A38",borderLeft:"3px solid #4A72FF"},children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[1rem] font-semibold",style:{color:"#EAEDF5"},children:e.display_name}),s.jsxs("p",{className:"text-[0.875rem]",style:{color:"#8A92A8"},children:["R",e.price_zar,"/mo · ",e.max_accounts," MT5 account",(e.max_accounts??0)>1?"s":""]})]}),s.jsx("button",{onClick:()=>n(e.id),disabled:!!t,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:{background:"#4A72FF",color:"#fff",border:"none"},children:t?s.jsx(yt,{size:14,className:"animate-spin"}):`Switch to ${e.display_name}`})]}),s.jsx("button",{onClick:r,disabled:!!t,className:"block text-[0.8125rem] transition-colors duration-150",style:{color:"#505770"},onMouseEnter:a=>a.target.style.color="#8A92A8",onMouseLeave:a=>a.target.style.color="#505770",children:"No thanks, cancel anyway"})]}
643),FD=({renewalDate:e,cancelling:t,confirmationMessage:n,cancelError:r,onClose:a})=>s.jsx("div",{className:"space-y-5",children:t?s.jsxs("div",{className:"flex items-center gap-3 py-4",children:[s.jsx(yt,{size:18,className:"animate-spin",style:{color:"#4A72FF"}}),s.jsx("span",{className:"text-[0.875rem]",style:{color:"#8A92A8"},children:"Processing cancellation..."})]}):s.jsxs(s.Fragment,{children:[r?s.jsx("p",{className:"text-[0.9375rem]",style:{color:"#F87171",lineHeight:1.7},children:r}):s.jsx("p",{className:"text-[0.9375rem]",style:{color:"#8A92A8",lineHeight:1.7},children:n??"Your cancellation request has been processed."}),s.jsx("button",{onClick:a,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-[0.875rem] font-semibold transition-all duration-150",style:{background:"transparent",color:"#EAEDF5",border:"1px solid #333A52"},children:"Close"})]})}),zD=({open:e,onClose:t,currentPlanSlug:n,currentPeriodEnd:r,subscriptionStatus:a,subscriptionCreatedAt:i,allPlans:o,subscriptionId:l})=>{const{session:c,user:u}=be(),{toast:d}=Wt(),[m,p]=h.useState(1),[f,g]=h.useState(null),[x,b]=h.useState(!1),[y,j]=h.useState(null),[v,C]=h.useState(""),[T,S]=h.useState(null),[E,B]=h.useState(null),[P,N]=h.useState(!1),[L,_]=h.useState(null),[D,A]=h.useState(null),V=h.useRef(null),J=h.useRef(!1),O=h.useRef(null);h.useEffect(()=>{e&&(p(1),j(null),C(""),S(null),B(null),N(!1),_(null),A(null),g(null),b(!1),V.current=null,J.current=!1)},[e]),h.useEffect(()=>{if(!e)return;let ne=!1;return(async()=>{try{const ue=await fetch(`${as}/v1/voucher/me`,{headers:{Authorization:`Bearer ${c==null?void 0:c.access_token}`}}),pe=ue.ok?await ue.json():null,X=(pe==null?void 0:pe.voucher)??null;if(ne)return;g(X),p(X&&(X.discount_amount??0)>0?0:1)}catch{ne||p(1)}finally{ne||b(!0)}})(),()=>{ne=!0}},[e,c]),h.useEffect(()=>{if(!e||!u)return;(async()=>{const{data:ue}=await Z.from("license_keys").select("license_key").eq("user_id",u.id).eq("is_active",!0).limit(1).maybeSingle();if(!ue)return;O.current=ue.license_key;let pe;a==="trialing"&&i?pe=new Date(i).toISOString():r?pe=_S(new Date(r),1).toISOString():pe=pt(new Date).toISOString();const{count:X}=await Z.from("trade_events").select("id",{count:"exact",head:!0}).eq("license_key",ue.license_key).eq("event_type","EXECUTED").gte("timestamp",pe);S(X??0)})()},[e,u,r,a,i]);const z=Hd[n??""]??-1,F=z>0?o.find(ne=>(Hd[ne.plan_slug]??-1)===z-1)??null:null,k=r?Ke(new Date(r),"dd MMMM yyyy"):null,H=ne=>{V.current||(V.current=(async()=>{try{const pe=await(await fetch(`${as}/v1/billing/exit-survey`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c==null?void 0:c.access_token}`},body:JSON.stringify({exit_reason:ne,...v.trim()?{exit_reason_detail:v.trim()}:{},plan_at_cancellation:n,total_trades_executed:T})})).json().catch(()=>({}));return(pe==null?void 0:pe.id)??null}catch(ue){return console.error("[CancelModal] exit survey save failed:",ue),null}})())},R=ne=>{const ue=V.current;!ue||J.current||(J.current=!0,(async()=>{try{const pe=await ue;if(!pe)return;await fetch(`${as}/v1/billing/exit-survey`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c==null?void 0:c.access_token}`},body:JSON.stringify({survey_id:pe,outcome:ne})})}catch(pe){console.error("[CancelModal] exit survey outcome failed:",pe)}})())},w=()=>{R("abandoned"),t()},te=ne=>{j(ne),ne!=="Other"&&C("")},W=()=>{y&&H(y),!F||z<=0?U():p(2)},U=async()=>{N(!0),A(null),p(3);try{const ne=await fetch(`${as}/v1/billing/cancel`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c==null?void 0:c.access_token}`},body:JSON.stringify({subscription_id:l,...y?{exit_reason:y}:{},...y==="Other"&&v.trim()?{exit_reason_detail:v.trim()}:{}})});if(!ne.ok){const pe=await ne.json().catch(()=>({}));throw new Error(pe.detail||`HTTP ${ne.status}`)}const ue=await ne.json().catch(()=>({}));ue.message&&_(ue.message),R("cancelled")}catch(ne){console.error("[CancelModal] cancel failed:",ne),A(ne instanceof Error&&ne.message&&!/^HTTP \d+$/.test(ne.message)?ne.message:"We couldn't cancel your subscription. Please try again or c
643ontact support."),d({title:"Cancellation failed",description:"Please try again or contact support.",variant:"destructive"})}N(!1)},K=async ne=>{B(ne);try{const ue=await fetch(`${as}/v1/billing/downgrade`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c==null?void 0:c.access_token}`},body:JSON.stringify({subscription_id:l,plan_config_id:ne})});if(!ue.ok){const pe=await ue.json().catch(()=>({}));throw new Error(pe.detail||`HTTP ${ue.status}`)}R("downgraded"),B(null),w(),d({title:"Plan changed",description:"Your new plan takes effect at the next billing cycle."})}catch(ue){console.error("[CancelModal] downgrade failed:",ue),B(null),d({title:"Downgrade failed",description:"Please try again or contact support.",variant:"destructive"})}},ie={0:"Before you go",1:"Why are you leaving?",2:"Would a lower plan work instead?",3:D?"Cancellation failed":"Cancellation"};return s.jsx(pn,{open:e,onOpenChange:ne=>!ne&&w(),children:s.jsxs(en,{className:"sm:max-w-md",style:{background:"#13161E",border:"1px solid #252A38",boxShadow:"0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px #252A38"},children:[s.jsx(It,{children:s.jsx("div",{className:"flex items-center justify-between",children:s.jsx(Dt,{className:"text-[1.125rem] font-semibold",style:{color:"#EAEDF5"},children:ie[m]})})}),x?s.jsxs(s.Fragment,{children:[m===0&&f&&s.jsx(LD,{discountBps:f.discount_amount??0,lockMonths:f.lock_duration_months,onKeep:w,onContinue:()=>p(1)}),m===1&&s.jsx(OD,{tradeCount:T,reason:y,setReason:te,onContinue:W,isTrial:a==="trialing",detail:v,setDetail:C}),m===2&&F&&s.jsx(RD,{lowerPlan:F,downgradingTo:E,onDowngrade:K,onCancel:U}),m===3&&s.jsx(FD,{renewalDate:k,cancelling:P,confirmationMessage:L,cancelError:D,onClose:w})]}):s.jsxs("div",{className:"flex items-center gap-3 py-6",children:[s.jsx(yt,{size:18,className:"animate-spin",style:{color:"#4A72FF"}}),s.jsx("span",{className:"text-[0.875rem]",style:{color:"#8A92A8"},children:"Loading…"})]})]})})},$D="https://api.viewlink.dev";function Ki(e,t){return t==="USD"?`$${e.toFixed(2)}`:`${t} ${e.toFixed(2)}`}function BD(){const{session:e}=be(),[t,n]=h.useState(null),[r,a]=h.useState(!0),[i,o]=h.useState(0);h.useEffect(()=>{if(!e)return;let c=!1;return a(!0),fetch(`${$D}/v1/billing/current-price`,{headers:{Authorization:`Bearer ${e.access_token}`}}).then(u=>u.ok?u.json():null).then(u=>{c||(n(u),a(!1))}).catch(()=>{c||(n(null),a(!1))}),()=>{c=!0}},[e,i]);const l=h.useCallback(()=>o(c=>c+1),[]);return{price:t,loading:r,refetch:l}}function VD(e){switch(e){case"active":return{label:"Active",className:"bg-success/10 text-success border-success/30"};case"trialing":return{label:"Free Trial",className:"bg-success/10 text-success border-success/30"};case"grace_period":return{label:"Grace Period",className:"bg-warning/10 text-warning border-warning/30"};case"lapsed":case"cancelled":case"lapsing":return{label:"Lapsed",className:"bg-destructive/10 text-destructive border-destructive/30"};default:return{label:e??"Unknown",className:"bg-neutral/10 text-neutral border-neutral/30"}}}const is={starter:0,pro:1,firm:2},qd=!1,Gd="Plan changes aren't available yet.",Xd="https://api.viewlink.dev";function UD(){var je;const{user:e,session:t}=be(),{toast:n}=Wt(),{reactivate:r,reactivating:a}=rp(),{price:i,loading:o,refetch:l}=BD(),[c,u]=h.useState(!0),[d,m]=h.useState(null),[p,f]=h.useState(null),[g,x]=h.useState(null),[b,y]=h.useState([]),[j,v]=h.useState(null),[C,T]=h.useState(!1),[S,E]=h.useState(null),[B,P]=h.useState([]),[N,L]=h.useState(!0),[_,D]=h.useState(!1),[A,V]=h.useState(!1),[J,O]=h.useState(!1),[z,F]=h.useState(!1),[k,H]=h.useState(null),[R,w]=h.useState(!1),te=h.useCallback(async()=>{var le,Le;if(e){u(!0),m(null);try{const[Se,Xe,it]=await Promise.all([Z.from("subscriptions").select("id, status, current_period_end, created_at, provider, provider_subscription_id, plan_config_id").eq("user_id",e.id).limit(1).maybeSingle(),Z.from("plan_configs").select("id, plan_slug, display_name, price_zar, price_usd, max_accounts, vps_ram_gb").eq("is_active",!0).order("price_zar",{ascending:!0}),Z.from("license_keys").select("expires_at").eq("user_id",e.id).eq("is_active",!0).limit(1).maybeSingle()]);if(Se.error)throw Se.error;if(Xe.error)throw Xe.error;it.error&&console.error("[Billing] licence expiry read failed:",it.error),v(((le=it.data)==null?void 0:le.expires_at)??null),f(Se.data);const He=Xe.data??[];if(y(He.filter(Et=>Et.plan_slug in is)),(Le=Se.data)!=null&&Le.plan_config_id){const Et=He.find(wt=>wt.id===Se.data.plan_config_id);x(Et??null)}}catch(Se){m(Se.message??"Failed to load billing data")}finally{u(!1)}}},[e]);h.useEffect(()=>{te()},[te]);const W=h.useCallback(async()=>
643{if(t!=null&&t.access_token){L(!0),D(!1);try{const le=await fetch(`${Xd}/v1/billing/payments`,{headers:{Authorization:`Bearer ${t.access_token}`}});if(!le.ok)throw new Error(`HTTP ${le.status}`);const Le=await le.json();if(Le.error)throw new Error(Le.error);P(Le.payments??[])}catch(le){console.error("[Billing] payment history load failed:",le),D(!0),P([])}finally{L(!1)}}},[t==null?void 0:t.access_token]);h.useEffect(()=>{W()},[W]);const U=(i==null?void 0:i.next_charge_date)??(p==null?void 0:p.current_period_end)??null,K=U?Ke(new Date(U),"dd MMMM yyyy"):"—",ie=(p==null?void 0:p.status)==="trialing"&&!(p!=null&&p.provider_subscription_id),ne=j?Ke(new Date(j),"dd MMMM yyyy"):"—",ue=(i==null?void 0:i.currency)??"—",pe=!!i&&i.amount!=null&&i.currency!=null,X=pe?Ki(i.amount,i.currency):null,ve=pe?i.discount??null:null,Q=ve?Ki(ve.amount,i.currency):null,ae=ve?Ki(ve.reverts_to,i.currency):null,q=ve?[ve.percent_off!=null?`${ve.percent_off}% off`:"Discount applied",ve.duration_months!=null?`your first ${ve.duration_months} months`:null].filter(Boolean).join(" "):null,oe=(g==null?void 0:g.plan_slug)??"",De=is[oe]??-1;!!(oe in is)&&b.some(le=>(is[le.plan_slug]??-1)>De);const We=!qd,at=Gd,rt=!qd,tt=Gd,Je=["lapsed","cancelled","lapsing"].includes((p==null?void 0:p.status)??""),Ge=!Je&&!!(i!=null&&i.cancel_scheduled),I=i!=null&&i.access_ends_at?Ke(new Date(i.access_ends_at),"dd MMMM yyyy"):K,Y=Ge?{label:"Cancelling",className:"bg-warning/10 text-warning border-warning/30"}:VD(p==null?void 0:p.status),de=ie&&!Ge&&!!g,we=async()=>{if(!(!t||!g)){T(!0),E(null);try{const le=await fetch(`${Xd}/v1/billing/checkout`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify({plan_slug:g.plan_slug})}),Le=await le.json().catch(()=>({}));if(le.status===401){E("Your session expired. Please sign in again."),T(!1);return}if(!le.ok){E(Le.detail||"Checkout unavailable. Please try again."),T(!1);return}$e.capture("billing_subscribe_clicked",{plan:g.plan_slug}),window.location.href=Le.checkout_url}catch(le){console.error("[Billing] checkout failed:",le),E("Network error. Please try again."),T(!1)}}};return c?s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8 space-y-6",children:[s.jsx(Ee,{className:"h-8 w-32"}),s.jsx(Ee,{className:"h-56 w-full rounded-xl"}),s.jsx(Ee,{className:"h-48 w-full rounded-xl"})]})}):d?s.jsx("div",{className:"min-h-screen bg-background",children:s.jsx("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8",children:s.jsxs("div",{className:"rounded-xl border border-destructive/30 bg-destructive/5 p-6 text-center",children:[s.jsx(Cn,{className:"mx-auto mb-3 text-destructive",size:24}),s.jsx("p",{className:"text-sm text-destructive mb-4",children:d}),s.jsxs(re,{variant:"outline",size:"sm",onClick:te,children:[s.jsx(zt,{size:14,className:"mr-1.5"})," Retry"]})]})})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsxs("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8 space-y-6 animate-fade-up",children:[s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:"Billing"}),Je&&s.jsx("div",{className:"rounded-xl border border-destructive/30 bg-destructive/5 p-6",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Cn,{className:"text-destructive shrink-0 mt-0.5",size:20}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:"Your account is on hold"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4 max-w-2xl",children:"Your subscription has lapsed, so your alerts won't trade until you reactivate. Your login, history, and settings are all still here. Reactivating takes a moment."}),s.jsx(re,{onClick:()=>r((g==null?void 0:g.plan_slug)??"starter"),disabled:a,className:"gap-2",children:a?s.jsxs(s.Fragment,{children:[s.jsx(yt,{size:15,className:"animate-spin"})," Processing…"]}):s.jsxs(s.Fragment,{children:[s.jsx(zt,{size:15})," Reactivate my account"]})})]})]})}),Ge&&s.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/5 p-6",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Cn,{className:"text-warning shrink-0 mt-0.5",size:20}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:ie?"Your trial won't convert":"Your subscription is cancelled"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:ie?s.jsxs(s.Fragment,{children:["You won't be charged. You keep full access to ViewLink until"," ",s.jsx("span",{className:"font-medium text-foreground",children:I}),", when your trial ends and your workspace shuts down. You can subscribe any time before then to keep it."]}):s.jsxs(s.Fragment,{children:["You won't be charged again. You keep full access to ViewLink until"," ",s.jsx("span",{className:"font-medium text-foreground",children:I}),", after which your account goes on hold and your alerts stop trading. You can reactivate then to pick up right where you left off."]})})]})]})}),s.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 shadow-[0_1px_3px_rgba(0,0,0,0.4),0_0_0_1px_hsl(var(--border))]",children:[s.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[s.jsx(xs,{size:18,className:"text-muted-foreground"}),s.jsx("h2",{className:"text-[1.375rem] font-semibold tracking-tight text-foreground",children:"Current Plan"})]}),!p||!g?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No active subscription found."}):s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[0.75rem] uppercase tracking-[0.08em] text-muted-foreground font-medium mb-1",children:"Plan"}),s.jsx("p",{className:"text-lg font-semibold text-foreground",children:g.display_name}),s.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:o?s.jsx("span",{className:"text-muted-foreground
643/60",children:"…"}):Q?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"line-through text-muted-foreground/60 mr-2",children:X}),s.jsx("span",{className:"text-foreground font-semibold",children:Q}),s.jsx("span",{className:"text-muted-foreground/60",children:"/mo"})]}):X?s.jsxs(s.Fragment,{children:[X,s.jsx("span",{className:"text-muted-foreground/60",children:"/mo"})]}):s.jsx("span",{className:"text-muted-foreground",children:"Pricing coming soon"})}),!o&&ve&&s.jsxs("p",{className:"text-xs text-success mt-1",children:[q,ve.duration_months!=null&&ae?`, then ${ae}/mo.`:"."]}),!o&&!Je&&!Ge&&(i==null?void 0:i.is_trial)&&X&&s.jsx("p",{className:"text-xs text-success mt-1",children:ie?`Free trial, no card on file${j?`, ends ${ne}`:""}`:`Free trial${U?`: first charge on ${K}`:""}`}),!o&&(i==null?void 0:i.source)==="list"&&X&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Final price, including any discount and regional pricing, is confirmed at checkout."})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[0.75rem] uppercase tracking-[0.08em] text-muted-foreground font-medium mb-1",children:"MT5 Accounts"}),s.jsx("p",{className:"text-lg font-semibold text-foreground",children:g.max_accounts})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[0.75rem] uppercase tracking-[0.08em] text-muted-foreground font-medium mb-1",children:Je?"Renewal":Ge?"Access Until":ie?"Trial ends":"Next Renewal"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:Je?"No upcoming charge":Ge?I:ie?ne:K})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[0.75rem] uppercase tracking-[0.08em] text-muted-foreground font-medium mb-1",children:"Status"}),s.jsxs(ms,{variant:"outline",className:`text-[0.75rem] font-semibold uppercase tracking-[0.08em] ${Y.className}`,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full mr-1.5 ${Ge?"bg-warning":p.status==="active"||p.status==="trialing"?"bg-success":p.status==="grace_period"?"bg-warning":"bg-destructive"}`}),Y.label]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[0.75rem] uppercase tracking-[0.08em] text-muted-foreground font-medium mb-1",children:"Currency"}),s.jsx("p",{className:"text-sm text-foreground",children:ue})]})]}),de&&s.jsxs("div",{className:"mt-6 pt-5 border-t border-border",children:[s.jsx(re,{onClick:we,disabled:C,className:"gap-2",children:C?s.jsxs(s.Fragment,{children:[s.jsx(yt,{size:15,className:"animate-spin"})," Redirecting…"]}):s.jsxs(s.Fragment,{children:[s.jsx(xs,{size:15})," Keep ViewLink after your trial"]})}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2 max-w-xl",children:"Add a payment method so your alerts keep trading when your trial ends. You'll see the exact price and any trial terms before you pay."}),S&&s.jsx("p",{className:"text-xs text-destructive mt-2",children:S})]})]}),p&&g&&!Je&&!Ge&&s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("span",{children:s.jsxs(re,{variant:"outline",onClick:()=>{$e.capture("billing_upgrade_clicked"),V(!0),H(null),w(!1)},disabled:We,className:"gap-2",children:[s.jsx(ox,{size:15})," Upgrade"]})})}),s.jsx(Gn,{children:at})]}),s.jsxs(jr,{children:[s.jsx(Nr,{asChild:!0,children:s.jsx("span",{children:s.jsxs(re,{variant:"outline",onClick:()=>O(!0),disabled:rt,className:"gap-2",children:[s.jsx(lx,{size:15})," Downgrade"]})})}),s.jsx(Gn,{children:tt})]}),ie?s.jsx("p",{className:"text-sm text-muted-foreground self-center",children:"Your trial ends on its own. Nothing will be charged and there is no card on file."}):s.jsxs(re,{variant:"outline",onClick:()=>{$e.capture("billing_cancel_clicked"),F(!0)},className:"gap-2 text-destructive border-destructive/40 hover:border-destructive hover:bg-destructive/10",children:[s.jsx(cx,{size:15})," Cancel Plan"]})]}),s.jsxs("div",{className:"rounded-xl border border-border bg-card shadow-[0_1px_3px_rgba(0,0,0,0.4),0_0_0_1px_hsl(var(--border))]",children:[s.jsx("div",{className:"flex items-center gap-2.5 p-6 pb-0 mb-4",children:s.jsx("h2",{className:"text-[1.375rem] font-semibold tracking-tight text-foreground",children:"Payment History"})}),s.jsxs("div",{className:"overflow-hidden rounded-b-xl",children:[s.jsxs("div",{className:"grid grid-cols-5 ga
643p-2 px-6 py-2 bg-muted text-[0.75rem] font-medium uppercase tracking-[0.08em] text-muted-foreground border-b border-border-default",children:[s.jsx("span",{children:"Date"}),s.jsx("span",{children:"Amount"}),s.jsx("span",{children:"Currency"}),s.jsx("span",{children:"Plan"}),s.jsx("span",{children:"Status"})]}),N?s.jsx("div",{className:"px-6 py-16 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading payments…"})}):_?s.jsx("div",{className:"px-6 py-16 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Couldn't load your payment history. Your payments are unaffected, please refresh, or contact support if this persists."})}):B.length===0?s.jsx("div",{className:"px-6 py-16 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No payments yet. Your first charge will appear here."})}):B.map((le,Le)=>{const Se=le.status==="succeeded";return s.jsxs("div",{className:"grid grid-cols-5 gap-2 px-6 py-3 text-sm border-b border-border last:border-0 hover:bg-muted/50 transition-colors duration-100",children:[s.jsx("span",{className:"text-foreground",children:le.processed_at?Ke(new Date(le.processed_at),"dd MMM yyyy"):"—"}),s.jsx("span",{className:"font-mono text-foreground",children:le.amount.toFixed(2)}),s.jsx("span",{className:"text-muted-foreground",children:le.currency??"—"}),s.jsx("span",{className:"text-foreground",children:(g==null?void 0:g.display_name)??"—"}),s.jsx("span",{children:s.jsxs(ms,{variant:"outline",className:`text-[0.75rem] font-semibold uppercase tracking-[0.08em] ${Se?"bg-success/10 text-success border-success/30":"bg-destructive/10 text-destructive border-destructive/30"}`,children:[s.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full mr-1.5 ${Se?"bg-success":"bg-destructive"}`}),Se?"Paid":"Failed"]})})]},le.payment_id??Le)})]})]})]}),s.jsx(pn,{open:A,onOpenChange:V,children:s.jsxs(en,{className:"sm:max-w-3xl bg-popover border-border-default shadow-[0_16px_48px_rgba(0,0,0,0.6),0_0_0_1px_hsl(var(--border-default))]",children:[s.jsxs(It,{children:[s.jsx(Dt,{className:"text-[1.375rem] font-semibold",children:R?"Confirm Upgrade":"Choose a Plan"}),s.jsx(Bt,{className:"text-muted-foreground text-sm",children:R?`You are upgrading to the ${(je=b.find(le=>le.id===k))==null?void 0:je.display_name} plan.`:"Select a plan to upgrade to. Your current plan is highlighted."})]}),R?s.jsx("div",{className:"py-6 text-center space-y-3",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan changes aren't connected yet. This will be enabled when Pro and Firm launch."})}):s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 py-4",children:b.map(le=>{const Le=le.id===(g==null?void 0:g.id),Se=k===le.id,it=(is[le.plan_slug]??-1)<=De;return s.jsx(_s,{accentBorder:Le,onClick:()=>!it&&H(le.id),className:`${Se?"ring-2 ring-primary ring-offset-2 ring-offset-background":""} ${it&&!Le?"opacity-40 cursor-not-allowed":""}`,children:s.jsxs("div",{className:"flex flex-col items-center text-center space-y-2",children:[Le&&s.jsx(ms,{className:"bg-primary/10 text-primary border-primary/30 text-[0.75rem] font-semibold uppercase tracking-[0.08em]",children:"Current Plan"}),s.jsx("h3",{className:"text-[1.125rem] font-semibold text-foreground",children:le.display_name}),s.jsx("div",{children:le.price_zar==null?s.jsx("span",{className:"text-base font-semibold text-muted-foreground",children:"Coming soon"}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-2xl font-bold font-mono text-foreground",children:["R",le.price_zar]}),s.jsx("span",{className:"text-[0.8125rem] text-muted-foreground",children:"/mo"})]})}),s.jsxs("div",{className:"space-y-1 text-[0.8125rem] text-muted-foreground",children:[s.jsxs("p",{children:[le.max_accounts," MT5 Account",(le.max_accounts??0)>1?"s":""]}),s.jsxs("p",{children:[le.vps_ram_gb," GB RAM"]})]}),Se&&s.jsxs("div",{className:"flex items-center gap-1.5 text-primary text-[0.8125rem] font-medium",children:[s.jsx(ot,{size:14})," Selected"]})]})},le.id)})}),s.jsx(hn,{children:R?s.jsxs(s.Fragment,{children:[s.jsx(re,{variant:"outline",onClick:()=>w(!1),children:"Back"}),s.jsx(re,{onClick:()=>{n({title:"Upgrade requested",description:"Payment processing will be connected in a future phase."}),V(!1)},children:"Confirm Upgrade"})]}):s.jsx(re,{onClick:()=>w(!0),disabled:!k,children:"Continue"})})]})}),s.jsx(pn,{open:J,onOpenChange:O,children:s.jsxs(en,{className:"sm:max-w-md bg-popover border-border-default shadow-[0_16px_48px_rgba(0,0,0,0.6),0_0_0_1px_hsl(var(--border-default))]",children:[s.jsxs(It,{children:[s.jsx(Dt,{className:"text-[1.375rem] font-semibold",children:"Downgrade Plan"}),s.jsxs(Bt,{className:"text-sm text-muted-foreground",children:["Your current plan remains active until ",K,". Downgrade takes effect on your next billing cycle."]})]}),s.jsxs(hn,{className:"gap-2 sm:gap-0",children:[s.jsx(re,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),s.jsx(re,{variant:"outline",className:"text-destructive border-destructive/40 hover:border-destructive hover:bg-destructive/10",onClick:()=>{n({title:"Downgrade requested",description:"This will take effect on your next billing cycle."}),O(!1)},children:"Confirm Downgrade"})]})]})}),s.jsx(zD,{open:z,onClose:()=>{F(!1),te(),l()},currentPlanSlug:(g==null?void 0:g.plan_slug)??null,currentPeriodEnd:(p==null?void 0:p.current_period_end)??null,subscriptionStatus:(p==null?void 0:p.status)??null,subscriptionCreatedAt:(p==null?void 0:p.created_at)??null,allPlans:b,subscriptionId:(p==null?void 0:p.id)??null})]})}const WD=["identify","guilds.join"];function YD(){const e="1522946804457537699".trim(),t="https://bocsxhpaswkalhedfnzz.supabase.co/functions/v1/discord-oauth-callback".trim();return!e||!t?null:{clientId:e,redirectUri:t}}function HD(e,t=YD()){if(!t)return null;const n=(e??"").trim();return n?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:t.clientId,redirect_uri:t.redirectUri,response_type:"code",scope:WD.join(" "),state:n}).toString()}`:null}const Sn={surface:"#111111",border:"#1F2937",accent:"#53AEE0",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"},Kd="#5865F2";function qD(){const{user:e}=be(),t=HD(e==null?void 0:e.id);return s.jsx("div",{className:"mx-auto w-full max-w-2xl px-4 py-8 lg:px-6",children:s.jsxs("div",{className:"rounded-xl p-5 lg:p-6",style:{background:Sn.surface,border:`1px solid ${Sn.border}`},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg",style:{background:"rgba(88,101,242,0.12)",color:Kd},children:s.jsx(ys,{size:20})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",style:{color:Sn.textPrimary},children:"Community"}),s.jsx("p",{className:"text-sm",style:{color:Sn.textMuted},children:"Join the ViewLink Discord"})]})]}),s.jsx("p",{className:"mt-5 text-sm leading-relaxed",style:{color:Sn.textMuted},children:"Ask questions, report problems, and see what other members are running. Connecting from this page links your Discord account to your ViewLink account, so we know 
643who you are when you post."}),t?s.jsxs(s.Fragment,{children:[s.jsxs("a",{href:t,className:"mt-6 inline-flex items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium text-white transition-opacity hover:opacity-90",style:{background:Kd},children:[s.jsx(ys,{size:16}),"Connect Discord"]}),s.jsx("p",{className:"mt-3 text-xs",style:{color:Sn.textMuted},children:"Discord will ask you to approve access to your username and to let us add you to the ViewLink server. We never see your password and we cannot read your messages."})]}):s.jsxs("p",{className:"mt-6 flex items-start gap-2 rounded-lg p-3 text-xs leading-relaxed",style:{background:"rgba(255,255,255,0.03)",border:`1px solid ${Sn.border}`,color:Sn.textMuted},children:[s.jsx(ux,{size:14,className:"mt-0.5 shrink-0"}),s.jsx("span",{children:"Discord sign-in is not available just yet. It is being switched on, and nothing is wrong with your account."})]})]})})}const ln={surface:"#111111",border:"#1F2937",textPrimary:"#FFFFFF",textMuted:"#9CA3AF"};function GD(){return s.jsxs("div",{className:"mx-auto w-full max-w-2xl px-4 py-8 lg:px-6",children:[s.jsxs("div",{className:"rounded-xl p-5 lg:p-6",style:{background:ln.surface,border:`1px solid ${ln.border}`},children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsx(ol,{height:36}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",style:{color:ln.textPrimary},children:"Broker partner"}),s.jsx("p",{className:"text-sm",style:{color:ln.textMuted},children:"Affiliate arrangement, Introducing Broker"})]})]}),s.jsx("p",{className:"mt-5 text-sm leading-relaxed",style:{color:ln.textMuted},children:"ViewLink works with any MT5 broker. ATFX is the one broker we have an affiliate arrangement with."}),s.jsx("div",{className:"mt-5",children:s.jsx(ll,{})}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(cl,{}),s.jsxs("a",{href:"/terms.html",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm transition-colors",style:{color:ln.textMuted},onMouseEnter:e=>e.currentTarget.style.color=ln.textPrimary,onMouseLeave:e=>e.currentTarget.style.color=ln.textMuted,children:["Read the full terms",s.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),s.jsxs("p",{className:"mt-4 flex items-start gap-2 text-xs leading-relaxed",style:{color:ln.textMuted},children:[s.jsx(dx,{size:14,className:"mt-0.5 shrink-0"}),s.jsx("span",{children:"Your existing broker keeps working exactly as it does now. Nothing on this page changes how ViewLink executes your trades."})]})]})}const gr=50,XD=["WEBHOOK_RECEIVED","IDEMPOTENCY_OK","IDEMPOTENCY_DUPLICATE","RATE_LIMIT_EXCEEDED","LICENSE_VALID","LICENSE_INVALID","QUEUED","EA_POLLED","EXECUTED","EXECUTION_FAILED","SPREAD_TOO_HIGH","EXPIRED"],KD={EXECUTED:{text:"text-success",bg:"bg-success/10",dot:"bg-success"},EXECUTION_FAILED:{text:"text-destructive",bg:"bg-destructive/10",dot:"bg-destructive"},LICENSE_INVALID:{text:"text-destructive",bg:"bg-destructive/10",dot:"bg-destructive"},QUEUED:{text:"text-info",bg:"bg-info/10",dot:"bg-info"},EA_POLLED:{text:"text-info",bg:"bg-info/10",dot:"bg-info"},EXPIRED:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},SPREAD_TOO_HIGH:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},RATE_LIMIT_EXCEEDED:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},IDEMPOTENCY_DUPLICATE:{text:"text-warning",bg:"bg-warning/10",dot:"bg-warning"},WEBHOOK_RECEIVED:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"},IDEMPOTENCY_OK:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"},LICENSE_VALID:{text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"}},JD={text:"text-neutral",bg:"bg-neutral/10",dot:"bg-neutral"},na=[{group:["WEBHOOK_RECEIVED"],label:"WEBHOOK RECEIVED",preFanout:!0},{group:["IDEMPOTENCY_OK","IDEMPOTENCY_DUPLICATE","RATE_LIMIT_EXCEEDED"],label:"IDEMPOTENCY",preFanout:!0},{group:["LICENSE_VALID","LICENSE_INVALID"],label:"LICENSE CHECK",preFanout:!0},{group:["QUEUED"],label:"QUEUED",preFanout:!1},{group:["EA_POLLED"],label:"EA POLLED",preFanout:!1},{group:["EXECUTED","EXECUTION_FAILED","SPREAD_TOO_HIGH","EXPIRED"],label:"EXECUTION",preFanout:!1}],QD=new Set(["LICENSE_INVALID","IDEMPOTENCY_DUPLICATE","RATE_LIMIT_EXCEEDED","EXECUTION_FAILED","SPREAD_TOO_HIGH","EXPIRED"]);function Jd(e,t){if(e&&typeof e=="object"&&!Array.isArray(e)){const n=e[t];return n!=null?String(n):void 0}}function ZD(e,t){const n=["Timestamp","License Key","Alert ID","Account","Event Type","Detail"],r=e.map(c=>[c.timestamp?Ke(new Date(c.timestamp),"yyyy-MM-dd HH:mm:ss"):"",c.license_key,c.alert_id??"",c.account_id?t[c.account_id]??c.account_id:"",c.event_type,c.detail?JSON.stringify(c.detail):""]),a=[n,...r].map(c=>c.map(u=>`"${String(u).replace(/"/g,'""')}"`).join(",")).join(`
644`),i=new Blob([a],{type:"text/csv"}),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=`viewlink-events-${Ke(new Date,"yyyy-MM-dd-HHmmss")}.csv`,l.click(),URL.revokeObjectURL(o)}function eP({label:e,options:t,selected:n,onChange:r}){const[a,i]=h.useState(!1),o=l=>r(n.includes(l)?n.filter(c=>c!==l):[...n,l]);return s.jsxs(Ir,{open:a,onOpenChange:i,children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[140px] justify-between text-xs font-normal border-border-default bg-input text-foreground",children:[n.length===0?e:`${n.length} selected`,s.jsx(nn,{className:"ml-1 h-3 w-3 opacity-50"})]})}),s.jsx(nr,{className:"w-56 p-1 max-h-72 overflow-y-auto",align:"start",children:t.map(l=>s.jsxs("button",{onClick:()=>o(l),className:se("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors",n.includes(l)?"bg-primary/10 text-primary":"text-foreground hover:bg-muted"),children:[s.jsx("span",{className:se("h-3.5 w-3.5 rounded-sm border border-border-default flex items-center justify-center shrink-0",n.includes(l)&&"bg-primary border-primary"),children:n.includes(l)&&s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"text-primary-foreground",children:s.jsx("path",{d:"M2 5l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})})}
644),l.replace(/_/g," ")]},l))})]})}function tP({detail:e}){return!e||typeof e!="object"||Array.isArray(e)?s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:"No detail data"}):s.jsx("pre",{className:"text-[13px] text-foreground font-mono whitespace-pre-wrap break-all",children:JSON.stringify(e,null,2)})}function nP({status:e,label:t,event:n,isLast:r}){const a=e==="passed"?"bg-success border-success/30":e==="failed"?"bg-destructive border-destructive/30":"bg-muted-foreground/20 border-border",i=e==="passed"?"text-success":e==="failed"?"text-destructive":"text-muted-foreground/35",o=e==="failed"&&n?Jd(n.detail,"error_code")??Jd(n.detail,"reason")??null:null;return s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsxs("div",{className:"relative group/node",children:[s.jsx("div",{className:se("h-[10px] w-[10px] rounded-full border mt-[3px] shrink-0",a,n&&"cursor-default")}),n&&n.detail&&s.jsx("div",{className:"absolute left-5 top-0 z-50 hidden group-hover/node:block w-72 rounded-md border border-border bg-[#13161E] p-3 shadow-xl pointer-events-none",children:s.jsx("pre",{className:"text-[11px] font-mono text-foreground whitespace-pre-wrap break-all leading-relaxed",children:JSON.stringify(n.detail,null,2)})})]}),!r&&s.jsx("div",{className:"w-px flex-1 min-h-[28px] bg-border/60 mt-0.5"})]}),s.jsxs("div",{className:"min-w-0 pb-2",children:[s.jsx("div",{className:se("text-[10px] font-mono font-semibold uppercase tracking-[0.1em]",i),children:t}),(n==null?void 0:n.event_type)&&s.jsx("div",{className:"text-[9px] font-mono text-muted-foreground/60 uppercase tracking-wide mt-px",children:n.event_type.replace(/_/g," ")}),(n==null?void 0:n.timestamp)&&s.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:Tr(n.timestamp,"HH:mm:ss")}),o&&s.jsx("div",{className:"mt-0.5 text-[10px] font-mono text-destructive font-semibold",children:o}),e==="skipped"&&!n&&s.jsx("div",{className:"text-[9px] font-mono text-muted-foreground/35 mt-px",children:"—"})]})]})}function rP({alertId:e,events:t,accountMap:n}){const r=t.filter(c=>na.filter(u=>u.preFanout).some(u=>u.group.includes(c.event_type))),a=t.filter(c=>na.filter(u=>!u.preFanout).some(u=>u.group.includes(c.event_type))),i=h.useMemo(()=>{const c=new Set,u=[];return a.forEach(d=>{d.account_id&&!c.has(d.account_id)&&(c.add(d.account_id),u.push(d.account_id))}),u},[a]),o=i.length>0?i:["__shared__"];function l(c,u){const m=(c.preFanout?r:u==="__shared__"?a:a.filter(p=>p.account_id===u)).find(p=>c.group.includes(p.event_type));return m?{status:QD.has(m.event_type)?"failed":"passed",event:m}:{status:"skipped",event:null}}return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"text-sm text-muted-foreground",children:["Alert trail for"," ",s.jsx("span",{className:"font-mono text-foreground",children:e}),i.length>0&&s.jsxs("span",{className:"ml-2 text-muted-foreground/60",children:["· ",i.length," account",i.length!==1?"s":""]})]}),s.jsx("div",{className:"rounded-lg border border-border bg-card overflow-x-auto",children:s.jsx("div",{className:"grid p-6 gap-8",style:{gridTemplateColumns:`repeat(${o.length}, minmax(180px, 1fr))`},children:o.map(c=>{const u=c==="__shared__",d=u?"Pipeline":n[c]??"Unknown";return s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"mb-5 pb-3 border-b border-border/50",children:[s.jsx("div",{className:"text-xs font-semibold text-foreground truncate",children:d}),!u&&s.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground truncate mt-0.5",title:c,children:[c.slice(0,8),"…"]})]}),s.jsx("div",{children:na.map((m,p)=>{const{status:f,event:g}=l(m,c);return s.jsx(nP,{status:f,label:m.label,event:g,isLast:p===na.length-1},m.label)})})]},c)})})})]})}function sP(){const[e,t]=h.useState([]),[n,r]=h.useState(!0),[a,i]=h.useState(null);h.useEffect(()=>{Z.from("testimonials").select("id, name, location, role, quote, rating, is_published, created_at").order("created_at",{ascending:!1}).then(({data:l})=>{t(l??[]),r(!1)})},[]);async function o(l,c){i(l);const{error:u}=await Z.from("testimonials").update({is_published:!c}).eq("id",l);u||t(d=>d.map(m=>m.id===l?{...m,is_published:!c}:m)),i(null)}return n?s.jsx("div",{className:"rounded-lg border border-border bg-card p-8 space-y-3",children:[0,1,2].map(l=>s.jsx(Ee,{className:"h-14 w-full"},l))}):e.length===0?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-16 text-center",children:[s.jsx(ys,{className:"mx-auto h-12 w-12 text-muted-foreground
644/40 mb-4"}),s.jsx("h2",{className:"text-lg font-medium text-foreground mb-1",children:"No testimonials yet"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Insert rows directly in the Supabase dashboard, they'll appear here for review."})]}):s.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[s.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Name"}),s.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wide hidden md:table-cell",children:"Role / Location"}),s.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wide hidden lg:table-cell",children:"Quote"}),s.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground uppercase tracking-wide w-20",children:"Rating"}),s.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground uppercase tracking-wide w-28",children:"Published"})]})}),s.jsx("tbody",{className:"divide-y divide-border",children:e.map(l=>s.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[s.jsx("td",{className:"px-4 py-3 font-medium text-foreground whitespace-nowrap",children:l.name}),s.jsxs("td",{className:"px-4 py-3 text-muted-foreground hidden md:table-cell",children:[s.jsx("span",{className:"block text-xs",children:l.role}),s.jsx("span",{className:"block text-xs opacity-70",children:l.location})]}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground hidden lg:table-cell max-w-sm",children:s.jsxs("span",{className:"line-clamp-2 text-xs",children:['"',l.quote,'"']})}),s.jsx("td",{className:"px-4 py-3 text-center",children:s.jsxs("span",{className:"text-warning font-mono text-xs",children:["★".repeat(l.rating),"☆".repeat(5-l.rating)]})}),s.jsx("td",{className:"px-4 py-3 text-center",children:s.jsx("button",{disabled:a===l.id,onClick:()=>o(l.id,l.is_published),className:se("relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none disabled:opacity-50",l.is_published?"bg-success":"bg-muted"),"aria-label":l.is_published?"Unpublish":"Publish",children:s.jsx("span",{className:se("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",l.is_published?"translate-x-4":"translate-x-0")})})})]},l.id))})]})})}function aP(){const[e,t]=h.useState("events"),[n,r]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,u]=h.useState(Wn(new Date,7)),[d,m]=h.useState(new Date),[p,f]=h.useState([]),[g,x]=h.useState("table"),[b,y]=h.useState([]),[j,v]=h.useState(0),[C,T]=h.useState(!1),[S,E]=h.useState(!1),[B,P]=h.useState(!1),[N,L]=h.useState(0),[_,D]=h.useState(null),[A,V]=h.useState([]),[J,O]=h.useState(!1),[z,F]=h.useState(null),[k,H]=h.useState({}),R=h.useCallback(async X=>{const ve=[...new Set(X)].filter(Boolean);if(ve.length===0)return;const{data:Q}=await Z.from("mt5_accounts").select("id, account_label").in("id",ve);Q&&H(ae=>{const q={...ae};return Q.forEach(oe=>{q[oe.id]=oe.account_label}),q})},[]),w=h.useCallback(async X=>{F(X),O(!0);const{data:ve}=await Z.from("trade_events").select("id, timestamp, alert_id, event_type, detail, account_id, license_key").eq("alert_id",X).order("timestamp",{ascending:!0}),Q=ve??[];V(Q),O(!1);const ae=Q.map(q=>q.account_id).filter(Boolean);R(ae)},[R]),te=h.useCallback((X,ve)=>{let Q=Z.from("trade_events").select("id, timestamp, alert_id, event_type, detail, account_id, license_key",{count:"exact"}).gte("timestamp",In(c).toISOString()).lte("timestamp",gl(d).toISOString()).order("timestamp",{ascending:!1}).range(X,ve);return n.trim()&&(Q=Q.ilike("license_key",`%${n.trim()}%`)),a.trim()&&(Q=Q.ilike("alert_id",`%${a.trim()}%`)),o.trim()&&(Q=Q.ilike("account_id",`%${o.trim()}%`)),p.length>0&&(Q=Q.in("event_type",p)),Q},[n,a,o,c,d,p]),W=h.useCallback(async()=>
644{P(!0),E(!1),T(!0),L(0),D(null),x(a.trim()?"trail":"table");const{data:X,count:ve,error:Q}=await te(0,gr-1);if(Q){E(!0),T(!1);return}const ae=X??[];y(ae),v(ve??0),T(!1);const q=ae.map(oe=>oe.account_id).filter(Boolean);R(q),a.trim()?w(a.trim()):(F(null),V([]))},[te,a,R,w]),U=h.useCallback(async X=>{T(!0),E(!1);const{data:ve,count:Q,error:ae}=await te(X*gr,(X+1)*gr-1);if(ae){E(!0),T(!1);return}y(ve??[]),v(Q??0),L(X),T(!1);const q=(ve??[]).map(oe=>oe.account_id).filter(Boolean);R(q)},[te,R]),K=()=>{r(""),i(""),l(""),u(Wn(new Date,7)),m(new Date),f([]),L(0),P(!1),y([]),F(null),V([]),x("table")},ie=Math.ceil(j/gr),ne=j===0?0:N*gr+1,ue=Math.min((N+1)*gr,j),pe=g==="trail"?A:b;return s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-12 py-8 space-y-6 animate-fade-up",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pa,{className:"h-6 w-6 text-primary shrink-0"}),s.jsx("h1",{className:"text-[1.75rem] font-semibold tracking-[-0.02em] text-foreground",children:"Admin"})]}),s.jsxs("div",{className:"flex items-center gap-0 border-b border-border",children:[s.jsxs("button",{onClick:()=>t("events"),className:se("flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium transition-colors border-b-2 -mb-px",e==="events"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[s.jsx(gs,{className:"h-3.5 w-3.5"}),"Event Explorer"]}),s.jsxs("button",{onClick:()=>t("testimonials"),className:se("flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium transition-colors border-b-2 -mb-px",e==="testimonials"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[s.jsx(ys,{className:"h-3.5 w-3.5"}),"Testimonials"]})]}),e==="testimonials"&&s.jsx(sP,{}),e==="events"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"sticky top-0 z-10 flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-4 shadow-md",children:[s.jsx(qe,{placeholder:"lk_...",value:n,onChange:X=>r(X.target.value),onKeyDown:X=>X.key==="Enter"&&W(),className:"h-9 w-[160px] text-xs font-mono border-border-default bg-input"}),s.jsx(qe,{placeholder:"alert_...",value:a,onChange:X=>i(X.target.value),onKeyDown:X=>X.key==="Enter"&&W(),className:"h-9 w-[160px] text-xs font-mono border-border-default bg-input"}),s.jsx(qe,{placeholder:"Account label or ID",value:o,onChange:X=>l(X.target.value),onKeyDown:X=>X.key==="Enter"&&W(),className:"h-9 w-[160px] text-xs border-border-default bg-input"}),s.jsxs(Ir,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[130px] justify-start text-xs font-normal border-border-default bg-input",children:[s.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5 text-muted-foreground"}),Ke(c,"dd MMM yyyy")]})}),s.jsx(nr,{className:"w-auto p-0",align:"start",children:s.jsx(Ss,{mode:"single",selected:c,onSelect:X=>X&&u(X),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"to"}),s.jsxs(Ir,{children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(re,{variant:"outline",className:"h-9 min-w-[130px] justify-start text-xs font-normal border-border-default bg-input",children:[s.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5 text-muted-foreground"}),Ke(d,"dd MMM yyyy")]})}),s.jsx(nr,{className:"w-auto p-0",align:"start",children:s.jsx(Ss,{mode:"single",selected:d,onSelect:X=>X&&m(X),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),s.jsx(eP,{label:"Event Type",options:XD,selected:p,onChange:f}),s.jsxs(re,{size:"sm",className:"h-9",onClick:W,children:[s.jsx(Vo,{className:"mr-1.5 h-3.5 w-3.5"})," Search"]}),s.jsxs(re,{variant:"ghost",size:"sm",className:"h-9 text-xs",onClick:K,children:[s.jsx(rr,{className:"mr-1 h-3 w-3"})," Clear"]}),B&&pe.length>0&&s.jsxs(re,{variant:"ghost",size:"sm",onClick:()=>ZD(pe,k),className:"ml-auto h-9 text-xs border border-border-default text-foreground",children:[s.jsx(mx,{className:"mr-1.5 h-3 w-3"})," Export CSV"]})]}),B?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-0 border-b border-border",children:[s.jsxs("button",{onClick:()=>x("trail"),className:se("flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium transition-colors border-b-2 -mb-px",g==="trail"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[s.jsx(fx,{className:"h-3.5 w-3.5"}),"Alert Trail"]}),s.jsxs("button",{onClick:()=>x("table"),className:se("flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium transition-colors border-b-2 -mb-px",g==="table"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[s.jsx(px,{className:"h-3.5 w-3.5"}),"Event Table"]})]}),g==="trail"&&s.jsx(s.Fragment,{children:z?J?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8",children:[s.jsx(Ee,{className:"h-4 w-56 mb-6"}),s.jsx("div",{className:"grid grid-cols-3 gap-8",children:[0,1,2].map(X=>s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ee,{className:"h-4 w-28"}),Array.from({length:6}).map((ve,Q)=>s.jsx(Ee,{className:"h-7 w-full"},Q))]},X))})]}):A.length===0?s.jsx("div",{className:"rounded-lg border border-border bg-card p-12 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No events found for this alert."})}):s.jsx(rP,{alertId:z,events:A,accountMap:k}):s.jsx("div",{className:"rounded-lg border border-border bg-card p-12 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter an Alert ID in the filter bar and search to view the pipeline trail."})})}),g==="table"&&s.jsxs(s.Fragment,{children:[C?s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_140px_140px_130px_170px_36px] gap-2 px-4 py-2 bg-muted text-[0.7rem] font-medium uppercase tracking-[0.08em] text-muted-foreground border-b border-border-default",children:[s.jsx("span",{children:"Timestamp"}),s.jsx("span",{children:"License Key"}),s.jsx("span",{children:"Alert ID"}),s.jsx("span",{children:"Account"}),s.jsx("span",{children:"Event Type"}),s.jsx("span",{})]}),Array.from({length:8}).map((X,ve)=>s.jsxs("div",{className:"grid grid-cols-[1fr_140px_140px_130px_170px_36px] gap-2 px-4 py-3 border-b border-border",children:[s.jsx(Ee,{className:"h-4 w-36"}),s.jsx(Ee,{className:"h-4 w-24"}),s.jsx(Ee,{className:"h-4 w-24"}),s.jsx(Ee,{className:"h-4 w-20"}),s.jsx(Ee,{className:"h-4 w-28"}),s.jsx("span",{})]},ve))]}):S?s.jsxs("div",{className:"rounded-lg border border-border bg-card px-4 py-12 text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load events."}),s.jsxs(re,{variant:"ghost",size:"sm",onClick:W,className:"mt-2 text-xs text-primary",children:[s.jsx(zt,{className:"mr-1 h-3 w-3"})," Retry"]})]}):b.length===0?s.jsx("div",{className:"rounded-lg border border-border bg-card px-4 py-16 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No events match your filters."})}):s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_140px_140px_130px_170px_36px] gap-2 px-4 py-2 bg-muted text-[0.7rem] font-medium uppercase tracking-[0.08em] text-muted-foreground border-b border-border-default",children:[s.jsx("span",{children:"Timestamp"}),s.jsx("span",{children:"License Key"}),s.jsx("span",{children:"Alert ID"}),s.jsx("span",{children:"Account"}),s.jsx("span",{children:"Event Type"}),s.jsx("span",{})]}),b.map(X=>{const ve=_===X.id,Q=KD[X.event_type]??JD,ae=X.account_id?k[X.account_id]??`${X.account_id.slice(0,8)}…`:"—";return s.jsxs("div",{children:[s.jsxs("div",{className:"grid grid-cols-[1fr_140px_140px_130px_170px_36px] gap-2 px-4 py-3 border-b border-border hover:bg-muted/50 cursor-pointer transition-colors duration-100",onClick:()=>D(ve?null:X.id),children:[s.jsx("span",{className:"text-xs text-muted-foreground truncate",children:X.timestamp?Tr(X.timestamp,"dd MMM yyyy HH:mm:ss"):"—"}),s.jsx("span",{className:"text-xs font-mono text-foreground truncate",title:X.license_key,children:X.license_key.length>14?`${X.license_key.slice(0,14)}…`:X.license_key}),s.jsx("button",{className:"text-xs font-mono text-primary hover:underline truncate text-left",title:X.alert_id?`View trail for ${X.alert_id}`:"Health event, not a trade. No alert trail.",disabled:!X.alert_id,onClick:q=>{q.stopPropagation(),X.alert_id&&(x("trail"),w(X.alert_id))},children:X.alert_id?X.alert_id.length>14?`${X.alert_id.slice(0,14)}…`:X.alert_id:"—"}),s.jsx("span",{className:"text-xs font-mono text-foreground truncate",title:X.account_id??"",children:ae}
644),s.jsx("span",{children:s.jsxs("span",{className:se("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-[0.08em]",Q.text,Q.bg),children:[s.jsx("span",{className:se("h-1.5 w-1.5 rounded-full shrink-0",Q.dot)}),X.event_type.replace(/_/g," ")]})}),s.jsx("span",{className:"flex items-center justify-end",children:ve?s.jsx(nn,{className:"h-3.5 w-3.5 text-muted-foreground"}):s.jsx(Es,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),ve&&s.jsx("div",{className:"px-6 py-4 border-b border-border bg-[rgba(28,32,48,0.5)] border-l-2 border-l-primary",children:s.jsx(tP,{detail:X.detail})})]},X.id)})]}),!C&&!S&&j>0&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Showing ",ne,"–",ue," of ",j," events"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(re,{variant:"outline",size:"sm",disabled:N===0,onClick:()=>U(N-1),className:"h-8 text-xs border-border-default",children:[s.jsx(La,{className:"mr-1 h-3 w-3"})," Previous"]}),s.jsxs(re,{variant:"outline",size:"sm",disabled:N>=ie-1,onClick:()=>U(N+1),className:"h-8 text-xs border-border-default",children:["Next ",s.jsx(Tm,{className:"ml-1 h-3 w-3"})]})]})]})]})]}):s.jsxs("div",{className:"rounded-lg border border-border bg-card p-16 text-center",children:[s.jsx(gs,{className:"mx-auto h-12 w-12 text-muted-foreground/40 mb-4"}),s.jsx("h2",{className:"text-lg font-medium text-foreground mb-1",children:"Search for an event trail"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter a license key, alert ID, or date range to start exploring."})]})]})]})})}const iP=new hx;function oP(){const e=sr();return h.useEffect(()=>{let t=window.location.href;try{const n=new URL(t);n.searchParams.delete("secret"),n.searchParams.delete("key"),t=n.toString()}catch{}$e.capture("$pageview",{$current_url:t})},[e.pathname]),null}function lP({children:e}){const{consentRequired:t}=be();return t?s.jsx($k,{}):s.jsx(s.Fragment,{children:e})}const cP=()=>s.jsx(Bk,{children:s.jsx(gx,{client:iP,children:s.jsxs(ik,{children:[s.jsx(E1,{}),s.jsx(ak,{}),s.jsx(bx,{children:s.jsxs(xk,{children:[s.jsx(oP,{}),s.jsx(i_,{}),s.jsx(p_,{}),s.jsx(a_,{}),s.jsx(lP,{children:s.jsxs(vx,{children:[s.jsx(Pe,{path:"/",element:s.jsx(Q_,{})}),s.jsx(Pe,{path:"/join",element:s.jsx(rj,{})}),s.jsx(Pe,{path:"/trial",element:s.jsx(dj,{})}),s.jsx(Pe,{path:"/login",element:s.jsx(fj,{})}),s.jsx(Pe,{path:"/signup",element:s.jsx(hj,{})}),s.jsx(Pe,{path:"/forgot-password",element:s.jsx(gj,{})}),s.jsx(Pe,{path:"/reset-password",element:s.jsx(xj,{})}),s.jsx(Pe,{path:"/auth/callback",element:s.jsx(yj,{})}),s.jsx(Pe,{path:"/auth/confirm",element:s.jsx(bj,{})}),s.jsx(Pe,{path:"/onboarding/questions",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(Pj,{})})}),s.jsx(Pe,{path:"/onboarding/trial-offer",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(Rj,{})})}),s.jsx(Pe,{path:"/onboarding/waitlist",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(Fj,{})})}),s.jsx(Pe,{path:"/onboarding/plan-select",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(Ij,{})})}),s.jsx(Pe,{path:"/onboarding/payment",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx($j,{})})}),s.jsx(Pe,{path:"/onboarding/checkout-return",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(Hj,{})})}),s.jsx(Pe,{path:"/onboarding/provisioning",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(sN,{})})}),s.jsx(Pe,{path:"/onboarding/phone",element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(oN,{})})}),s.jsxs(Pe,{element:s.jsx(Yt,{children:s.jsx(lu,{children:s.jsx(gi,{})})}),children:[s.jsx(Pe,{path:"/dashboard",element:s.jsx(uE,{})}),s.jsx(Pe,{path:"/setup-guide",element:s.jsx(gE,{})}),s.jsx(Pe,{path:"/setup-guide/docs",element:s.jsx(kE,{})}),s.jsx(Pe,{path:"/setup-guide/docs/:slug",element:s.jsx(gI,{})}),s.jsx(Pe,{path:"/trade-log",element:s.jsx(Z3,{})}),s.jsx(Pe,{path:"/settings",element:s.jsx(DD,{})}),s.jsx(Pe,{path:"/billing",element:s.jsx(UD,{})}),s.jsx(Pe,{path:"/broker-partner",element:s.jsx(GD,{})})]}
644),s.jsx(Pe,{element:s.jsx(Yt,{requireOnboarding:!1,children:s.jsx(lu,{children:s.jsx(gi,{})})}),children:s.jsx(Pe,{path:"/discord",element:s.jsx(qD,{})})}),s.jsx(Pe,{element:s.jsx(Fk,{children:s.jsx(gi,{})}),children:s.jsx(Pe,{path:"/admin",element:s.jsx(aP,{})})}),s.jsx(Pe,{path:"*",element:s.jsx(vj,{})})]})}),!1]})})]})})}),uP="https://bcf59b7921257e31ee3397460927db15@o4511610543210496.ingest.de.sentry.io/4511610589347920";zw({dsn:uP,environment:"production",tracesSampleRate:0,sendDefaultPii:!1});const dP=localStorage.getItem(la);$e.init("phc_DdV5ot9eEqhV2wYDu7j5iusV8ijAvqR2Gbu5hUmmbPty",{api_host:"https://eu.i.posthog.com",ip:!1,persistence:"localStorage",opt_out_capturing_by_default:dP!=="accepted",sanitize_properties:e=>{if(e.$current_url)try{const t=new URL(e.$current_url);t.searchParams.delete("secret"),t.searchParams.delete("key"),e.$current_url=t.toString()}catch{}return e}});pg(document.getElementById("root")).render(s.jsx(cP,{}));

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.