@vellumai/web 0.10.12-dev.202607250309.e24b258 → 0.10.12-dev.202607250654.d09ff97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{c as t,i as n}from"./local-settings-C-dW2vkq.js";import{o as r,r as i}from"./device-settings-DXp9L4iB.js";import{t as a}from"./capture-error-Bj8_eutd.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-Dy5001j6.js";import{m as c,t as l,u}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as d}from"./QueryClientProvider-CMu7CkQU.js";import{t as f}from"./useQuery-Bz-fbQ-m.js";import{t as p}from"./useMutation-CXGTrp4W.js";import{t as m}from"./jsx-runtime-D3ZM-ToX.js";import{t as h}from"./card-DRIctGVs.js";import{t as g}from"./createLucideIcon-CAM1RhH8.js";import{t as _}from"./bell-Ct4a9v6Y.js";import{t as v}from"./check-sC49_hjU.js";import{t as y}from"./chevron-down-B5A-0g8A.js";import{t as b}from"./circle-alert-DVCpoZrc.js";import{t as x}from"./circle-check-CjGnAahM.js";import{o as S}from"./list-row-B1wPb2Au.js";import{t as C}from"./hard-drive-DWFPKcXI.js";import{t as w}from"./heart-789ajxtB.js";import{t as T}from"./loader-circle-XREx3i4W.js";import{t as E}from"./monitor-B1y28fS1.js";import{t as D}from"./moon-BJzODLTY.js";import{_ as O,a as k,b as A,c as j,d as M,f as N,n as P,o as F,s as I,x as ee,y as te}from"./use-ios-app-nudge-DMRPSgrQ.js";import{t as ne}from"./refresh-cw-DzPnoeCh.js";import{t as L}from"./rotate-ccw-BjzeX7qz.js";import{t as R}from"./smartphone-mDNwm_ss.js";import{t as re}from"./sparkles-Ccrj7hxd.js";import{t as ie}from"./sun-Dw0t1n1O.js";import{t as ae}from"./triangle-alert-CQfiAg_t.js";import{t as oe}from"./x-JBAsSOmg.js";import{t as z}from"./notice-BMK7xqUw.js";import{t as se}from"./progress-bar-C_T5_pf2.js";import{M as ce,N as le,i as ue,j as de,n as fe}from"./src-D89CNeuT.js";import{t as pe}from"./tag-NXcyiTkK.js";import{t as B}from"./input-hw3el2GJ.js";import{t as me}from"./toggle-lfnhEAcN.js";import{t as V}from"./modal-BR4CUFBd.js";import{n as H}from"./toast-LgLp4obE.js";import{t as he}from"./confirm-dialog-UYFm4osC.js";import{t as ge}from"./dropdown-BCfnSdIZ.js";import{E as _e,O as ve,S as ye,c as be,d as xe,f as Se,g as Ce,h as we,i as Te,nt as Ee,r as De,x as Oe}from"./local-mode-Ckii2tmN.js";import{t as U}from"./is-electron-m5eeGBnd.js";import{n as ke}from"./resolved-assistants-store-C-PdxK8f.js";import{r as Ae,t as je}from"./semver-BpijV4FQ.js";import{r as Me}from"./utils-CnB60ZJN.js";import{n as Ne,r as W,t as Pe}from"./api-errors-CFiCT7Ap.js";import{D as Fe,S as Ie,T as Le,a as Re,b as ze,g as Be,h as Ve,k as He,n as Ue,u as We,v as Ge,y as Ke}from"./auth-store-D0-gDCVn.js";import{t as G}from"./client.gen-CV05d-kw.js";import{C as qe,H as Je,Ht as Ye,M as Xe,T as Ze,X as Qe,Z as $e,j as et}from"./sdk.gen-BIu1DgTs.js";import{a as tt,o as nt}from"./api-XwdNiVE9.js";import{u as K}from"./routes-vE-2hncW.js";import{i as rt,r as it,t as at}from"./use-platform-gate-DasAkNrC.js";import{i as ot,o as st}from"./platform-detection-CMiRPRCq.js";import{t as q}from"./client-feature-flag-store-c2ESRWJ1.js";import{t as ct}from"./hard-navigate-DZlpL1No.js";import{A as lt,At as ut,D as dt,E as ft,Ft as pt,It as mt,Lt as ht,N as gt,Nt as _t,O as vt,P as yt,Pt as bt,Rt as xt,T as St,Tt as Ct,c as wt,j as Tt,k as Et,kt as Dt,lt as Ot,st as kt,v as At,w as jt}from"./react-query.gen-Mwd5l-vZ.js";import{t as Mt}from"./assistant-feature-flag-store-ltLrn6Vo.js";import{t as Nt}from"./pointer-RLpjGG7A.js";import{n as Pt,t as Ft}from"./retire-confirm-dialog-CECcqSgD.js";import{a as It,i as Lt,r as Rt,s as zt}from"./local-runtime-upgrade-DVJhAIrC.js";import{t as Bt}from"./proxy-RtD8704m.js";import{t as Vt}from"./AnimatePresence-3WpfAWHe.js";import{t as Ht}from"./use-reduced-motion-Se97jRQ-.js";import{t as J}from"./platform-login-notice-8cae1DoH.js";import{t as Ut}from"./use-active-assistant-id-CXhDyK7y.js";import{t as Wt}from"./use-copy-to-clipboard-O2AZwhGa.js";import{t as Y}from"./detail-card-BMRGmkia.js";import{t as Gt}from"./app-info-CkOfr4nP.js";import{t as Kt}from"./environment-store-Dk9rAKWX.js";import{a as qt,i as Jt,n as Yt,r as Xt}from"./machine-sizes-DEz3ocd0.js";import{a as Zt,i as Qt,n as $t,r as en,t as tn}from"./assistant-status-panel-D3DgDcV3.js";import{t as nn}from"./settings-divider-B_aH89AY.js";var rn=g(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),an=g(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),on=g(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),X=e(o(),1),Z=m();function sn(){let e=q.use.velvet(),{theme:t,setThemePreference:n}=M(),r=[{value:`system`,label:`System`,icon:(0,Z.jsx)(E,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Z.jsx)(ie,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Z.jsx)(D,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Z.jsx)(w,{className:`h-4 w-4`})}]:[]];return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Theme`}),(0,Z.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Z.jsx)(de,{ariaLabel:`Theme`,value:t,onChange:n,items:r})})]})}var cn=Ve,ln=`Please choose a different handle.`;async function un(e,t){let{data:n,error:r,response:i}=await Xe({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:W(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=ze(r,`handle`,cn.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=ze(r,`handle`,ln);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:W(r,i,`Failed to save handle.`)}}async function dn(e,t,n){let{data:r,error:i,response:a}=await qe({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Ne(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new Pe(a.status,a.status===429?`Too many checks — try again in a moment.`:W(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function fn(e){return/\d{2,}$/.test(e)}var pn=300,mn=1400;function hn({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:c,fieldId:l}){let[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(`idle`),[y,x]=(0,X.useState)(null),S=Ht(),C=(0,X.useRef)(null),w=(0,X.useMemo)(()=>u.trim().toLowerCase(),[u]),E=w===e.toLowerCase();(0,X.useEffect)(()=>{if(E||w.length===0){h(!1),C.current?.abort();return}let e=new AbortController;C.current?.abort(),C.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(w,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||x(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},pn);return()=>{window.clearTimeout(t),e.abort()}},[w,E,i]);let D=(()=>{if(y)return y;if(f&&!f.available){let e=f.code;return f.message??(e?cn[e]:`Please choose a different handle.`)}return null})(),O=D?n:E?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!E&&!m&&f?.available!==!1&&g!==`saving`,A=(0,X.useCallback)(async()=>{if(!k)return;_(`saving`),x(null);let e=await a(w);if(e.kind===`ok`){_(`saved`),o(e.data),H.success(c),window.setTimeout(()=>_(`idle`),mn);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),x(e.message),H.error(e.message)},[k,w,o,a,c]),j=(()=>{if(E&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Z.jsx)(Vt,{mode:`wait`,initial:!1,children:(0,Z.jsxs)(Bt.span,{initial:S?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:S?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Z.jsx)(v,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Z.jsx)(b,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(B,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),x(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:D??void 0,helperText:O??void 0,"aria-invalid":!!D,fullWidth:!0,"data-testid":`${l}-input`}),(!E||g!==`idle`)&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(s,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function gn({initial:e,onSaved:t}){let n=Ue.use.refreshSession(),r=fn(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,X.useCallback)(async e=>await Ke({username:e}),[]),a=(0,X.useCallback)((e,t)=>Be(e,t),[]),o=(0,X.useCallback)(e=>{t(e),n()},[t,n]);return(0,Z.jsx)(hn,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function _n({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...wt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,X.useCallback)(async t=>await un(e.id,t),[e.id]),s=(0,X.useCallback)((t,n)=>dn(e.id,t,n),[e.id]);return i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(B,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Z.jsx)(l,{to:`${K.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Z.jsx)(hn,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function vn(){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-3 w-72 animate-pulse rounded bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-60 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-7 w-16 animate-pulse rounded-md bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function yn(){return(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function bn({assistant:e,showHandles:t=!0,children:n}={}){let r=Ue.use.user?.()?.email??null;return(0,Z.jsx)(Y,{title:`Profile`,subtitle:`Manage your account details and preferences.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[r&&(0,Z.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Z.jsx)(B,{label:`Email`,value:r,disabled:!0,readOnly:!0})}),t&&(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(yn,{}),(0,Z.jsx)(xn,{assistant:e})]}),n!=null&&(0,Z.jsxs)(Z.Fragment,{children:[(r||t)&&(0,Z.jsx)(yn,{}),n]})]})})}function xn({assistant:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a=Ht(),[o,s]=(0,X.useState)(e??null);return(0,X.useEffect)(()=>{s(e??null)},[e]),(0,X.useEffect)(()=>{let e=!1;return Ge().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Z.jsxs)(Bt.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Z.jsx)(gn,{initial:t,onSaved:n}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(_n,{assistant:o,onSaved:s})]})]}):(0,Z.jsx)(vn,{})}var Sn=At({query:{hosting:`platform`}});function Cn(){let e=Ut(),t=f(Sn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Z.jsx)(Y,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(E,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Z.jsx)(pe,{tone:`warning`,children:t.status})]})})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:n?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Z.jsx)(v,{className:`h-4 w-4`}),`Active`]}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{He(t.id),H.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var wn=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function Tn(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function En({assistantId:e}){let t=d(),n=Kt.use.isNonProduction(),r=(0,X.useMemo)(()=>wn.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(lt({path:{id:e}})),c=(0,X.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,X.useState)(null),p=l??c,m=l!==null,h=ut({onSuccess:()=>{H.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:Tt({path:{id:e}})})},onError:()=>{H.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Z.jsx)(s,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,Tn(p)]})]}),m&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(s,{variant:`primary`,leftIcon:h.isPending?(0,Z.jsx)(T,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function Dn(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var On=3e3;function kn({version:e,assistantId:t}){let{onTap:n,message:r}=Qt(t);return(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Z.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function An({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=Mt.use.rollbackEnabled(),a=q.use.previewChannel(),o=d(),c=Lt(n,a),l=c===`preview`,[u,m]=(0,X.useState)(!1),h=(0,X.useRef)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),H.success(b?`Rollback complete — assistant is healthy.`:`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):On;f({...vt({path:{id:e}}),refetchInterval:u?e=>w(e.state.data?.current_release_version):!1});let{data:E,isLoading:D}=f(Ct({query:{channel:c}})),O=E?.find(e=>e.is_stable!==!1)??E?.[0],k=g??O?.version??null,A=(0,X.useMemo)(()=>{if(!i||!k||!t)return!1;let e=Ae(k),n=Ae(t);return!e||!n?!1:je(e,n)<0},[i,k,t]),j=(0,X.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Ae(k),n=Ae(t);if(!e||!n)return k!==t;let r=je(e,n);return i?r!==0:r>0},[i,k,t]),M=p({mutationFn:async t=>{let{data:n}=await Qe({path:{id:e},body:t,throwOnError:!0});return n}}),N=p({mutationFn:async t=>{let{data:n}=await Je({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(kn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:j?A?`Rollback to`:`Update to`:`Selected`}),(0,Z.jsx)(`span`,{className:`block min-w-0`,children:D?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(T,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):E&&E.length>0?i?(0,Z.jsx)(ge,{value:k??``,onChange:e=>_(e===O?.version?null:e),disabled:u||M.isPending||N.isPending,options:E.map(e=>({value:e.version,label:Dn(e,t,O?.version)}))}):(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?Dn(O,t,O.version):`—`}):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:A?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:M.isPending||N.isPending||u?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ne,{}),onClick:()=>y(!0),disabled:!j||M.isPending||N.isPending||u||D||!E?.length,children:u?b?`Rolling back...`:`Updating...`:A?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Z.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!j&&t&&k&&!D&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Z.jsx)(he,{open:v,title:A?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:A?`Rollback to version ${k??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${k??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${k??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:A?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=g??void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,H.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){H.warning(e.detail);return}h.current=e.version??t??null,H.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(A),m(!0),o.invalidateQueries({queryKey:Et({path:{id:e}})})}catch{H.error(A?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function jn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),{data:c,isLoading:l}=f(Ct({query:{stable:!0,limit:100}})),u=(0,X.useMemo)(()=>Rt(c),[c]),d=u?.version,p=t?It(t,d):!!d,m=zt({assistantId:e,targetVersion:d});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(kn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?Dn(u,t,d):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ne,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Z.jsx)(he,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),H.success(`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){H.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function Mn(){let e=rt({platformHostedOnly:!0}),t=it(),n=Ue.use.user()?.id??null,r=Ue.use.logout(),[i,a]=(0,X.useState)(!1),o=_t({onSuccess:async()=>{H.success(`Account deletion requested. You will be logged out shortly.`),We(n),await r(),ct(K.account.login)},onError:()=>{H.error(`Failed to request account deletion. Please try again.`)}}),c=e===`full`&&t;return(0,X.useEffect)(()=>{c&&i&&a(!1)},[c,i]),e===`gated`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Delete Account`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently delete your account and all associated data.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:e===`disabled`?(0,Z.jsx)(J,{children:`Log in to the Vellum platform to delete your account.`}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||c,className:`self-start`,children:`Delete My Account`}),c&&(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Z.jsx)(he,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(c){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function Nn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Z.jsx)(Y,{title:e,subtitle:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Z.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Z.jsx)(s,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function Pn(){return st()?(0,Z.jsx)(Nn,{title:`Get the iOS App`,subtitle:`The Vellum iOS app gives you a native experience.`,benefits:[{icon:_,text:`Push notifications`},{icon:rn,text:`Biometric login`},{icon:on,text:`Native haptics`},{icon:R,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Z.jsx)(R,{size:16}),onAction:()=>{k(),P()}}):null}var Fn=`0.10.0`;function In(){return Me(Fn)}var Ln=[`login.tailscale.com`,`tailscale.com`,`www.tailscale.com`,`ngrok.com`,`dashboard.ngrok.com`,`dash.cloudflare.com`,`cloudflare.com`,`www.cloudflare.com`];function Rn(e){let t;try{t=new URL(e).hostname}catch{return!1}return Ln.includes(t)}function zn(e){let t;try{t=new URL(e).hostname}catch{return null}return Ln.includes(t)?t.includes(`tailscale`)?`Tailscale`:t.includes(`ngrok`)?`ngrok`:t.includes(`cloudflare`)?`Cloudflare`:null:null}function Bn(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`[::1]`||/^127(?:\.\d{1,3}){3}$/.test(t)}catch{return!1}}function Vn(e){let t=new URL(e);t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`assistant`);return r>=0&&n.splice(r),t.pathname=n.length?`/${n.join(`/`)}`:`/`,t.toString().replace(/\/+$/,``)}function Hn(e){let t;try{t=Vn(e)}catch{return{ok:!1,reason:`unparseable`}}return Bn(t)?{ok:!1,reason:`loopback`}:Rn(t)?{ok:!1,reason:`service-website`}:new URL(t).protocol===`https:`?{ok:!0,url:t}:{ok:!1,reason:`non-https`}}function Un(e){let t=new URL(e.verificationUri);return t.hash=new URLSearchParams({device_code:e.deviceCode}).toString(),t.toString()}function Wn(e,t){switch(e){case`unparseable`:return`Enter a valid URL, e.g. https://your-assistant.ts.net.`;case`loopback`:return`This is a loopback address other devices can't reach. Enter the assistant's public https URL.`;case`non-https`:return`The URL must use https so your devices can connect securely.`;case`service-website`:return`This is ${t&&zn(t)||`the tunnel provider`}'s website, not your assistant's address. Run \`vellum tunnel\` on the host to get one.`}}var Gn=`/v1/remote-web/pairing-challenge`,Kn=`/v1/remote-web/pairing-verification`,qn="If a scan can't connect, enable remote web access on the host with `vellum flags set web-remote-ingress true`, then generate a new code.",Jn=class extends Error{hint;constructor(e,t){super(e),this.name=`PairDeviceError`,this.hint=t}};function Yn(){if(typeof window>`u`)return null;let e=be(),t=Te(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function Xn(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}async function Zn(e,t,n){let r;try{r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?e:new Jn(`Couldn't reach the assistant. Make sure it's running and try again.`)}let i=await r.json().catch(()=>null);if(!r.ok)throw new Jn(Xn(i)??`Pairing failed (HTTP ${r.status}).`,qn);if(typeof i!=`object`||!i)throw new Jn(`The assistant returned an unexpected response.`);return i}async function Qn(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await Zn(`${t}${Gn}`,{publicBaseUrl:n},r);return await Zn(`${t}${Kn}`,{userCode:i.userCode},r),{pairUrl:Un(i),expiresAt:i.expiresAt}}var $n=Object.defineProperty,er=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,rr=(e,t,n)=>t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ir=(e,t)=>{for(var n in t||={})tr.call(t,n)&&rr(e,n,t[n]);if(er)for(var n of er(t))nr.call(t,n)&&rr(e,n,t[n]);return e},ar=(e,t)=>{var n={};for(var r in e)tr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&er)for(var r of er(e))t.indexOf(r)<0&&nr.call(e,r)&&(n[r]=e[r]);return n},or;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(or||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(or||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(or||={});var Q=or,sr={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},cr=128,lr=`L`,ur=`#FFFFFF`,dr=`#000000`,fr=!1,pr=1,mr=4,hr=0,gr=.1;function _r(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function vr(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function yr(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*gr),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function br(e,t){return t==null?e?mr:hr:Math.max(Math.floor(t),0)}function xr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=X.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Q.QrSegment.makeSegments(t)),e),[]);return Q.QrCode.encodeSegments(r,sr[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=X.useMemo(()=>{let e=c.getModules(),t=br(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:yr(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Sr=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Cr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=cr,level:a=lr,bgColor:o=ur,fgColor:s=dr,includeMargin:c=fr,minVersion:l=pr,boostLevel:u,marginSize:d,imageSettings:f}=n,p=ar(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=ar(p,[`style`]),g=f?.src,_=X.useRef(null),v=X.useRef(null),y=X.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=X.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=xr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});X.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=vr(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Sr?t.fill(new Path2D(_r(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),X.useEffect(()=>{x(!1)},[g]);let E=ir({height:i,width:i},m),D=null;return g!=null&&(D=X.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement(`canvas`,ir({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Cr.displayName=`QRCodeCanvas`;var wr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=cr,level:a=lr,bgColor:o=ur,fgColor:s=dr,includeMargin:c=fr,minVersion:l=pr,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=ar(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=xr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=vr(g,v.excavation)),b=X.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=_r(y,h);return X.createElement(`svg`,ir({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&X.createElement(`title`,null,d),X.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),X.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});wr.displayName=`QRCodeSVG`;function Tr(e){if(!Number.isFinite(e)||e<=0)return`Single-use.`;let t=Math.ceil(e/1e3);return`Expires in ${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)} · single-use.`}function Er({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){return n?(0,Z.jsx)(z,{tone:`warning`,title:`This pairing code expired.`,children:`Generate a new code to pair a device.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Z.jsx)(wr,{value:e,size:192,level:`M`,title:`Device pairing QR code`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Z.jsx)(v,{}):(0,Z.jsx)(S,{}),onClick:()=>i(e),children:r?`Copied`:`Copy`})]}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:Tr(t)})]})}var Dr=`vellum:pair-device:public-base-url`;function Or(e){let t=e?.trim();if(t)return{url:t,source:`tunnel`};let r=n(Dr,``).trim();return r?{url:r,source:`stored`}:{url:``,source:`none`}}function kr(e,n,r){let[i]=(0,X.useState)(()=>Or(r)),[o,s]=(0,X.useState)(i.url),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)({kind:`idle`}),[f,p]=(0,X.useState)(()=>Date.now()),m=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>m.current?.abort(),[]),(0,X.useEffect)(()=>{if(u.kind!==`ready`)return;p(Date.now());let e=setInterval(()=>p(Date.now()),1e3);return()=>clearInterval(e)},[u]);let h=(0,X.useCallback)(e=>{s(e),l(null)},[]),g=(0,X.useCallback)(()=>{if(!e)return;let r=o.trim(),i=Hn(r);if(!i.ok){l(Wn(i.reason,r));return}if(l(null),!n){d({kind:`error`,message:`Remote web access is disabled on this assistant, so a scanned code couldn't connect.`,hint:qn});return}m.current?.abort();let s=new AbortController;m.current=s,d({kind:`minting`}),(async()=>{try{let n=await Qn({base:e,publicBaseUrl:i.url,signal:s.signal});if(s.signal.aborted)return;t(Dr,i.url),d({kind:`ready`,pairUrl:n.pairUrl,expiresAtMs:Date.parse(n.expiresAt)})}catch(e){if(s.signal.aborted)return;if(e instanceof Jn){d({kind:`error`,message:e.message,hint:e.hint});return}a(e,{context:`pair-device-mint`}),d({kind:`error`,message:`Something went wrong while generating the code.`})}})()},[e,o,n]),_=u.kind===`ready`?Math.max(0,u.expiresAtMs-f):0,v=u.kind===`ready`&&_<=0;return{publicBaseUrl:o,setPublicBaseUrl:h,prefillSource:i.source,inputError:c,phase:u,remainingMs:_,expired:v,generate:g}}function Ar(){let e=Yn(),t=In(),n=Mt.use.hasHydrated(),r=Mt.use.webRemoteIngress(),i=kr(e?.base??null,r,e?.ingressUrl??null),{copy:a,copied:o}=Wt();if(!e||!t)return null;let{phase:c}=i,l=c.kind===`minting`,u=c.kind===`ready`,d=i.prefillSource===`tunnel`,f=i.prefillSource===`none`&&i.publicBaseUrl.trim()===``,p=n?l?`Generating…`:u?`Generate new code`:`Generate pairing QR`:`Loading…`,m=()=>{n&&i.generate()};return(0,Z.jsx)(Y,{title:`Pair a device`,subtitle:`Scan with another device's camera — or open the link on it — to use ${e.assistantName??`this assistant`} there.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f&&(0,Z.jsx)(z,{tone:`info`,title:`No tunnel detected`,children:"On this computer, run `vellum tunnel --provider tailscale` (or another provider) — its address appears here."}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(B,{label:`Public URL`,fullWidth:!0,placeholder:`https://your-assistant.ts.net`,helperText:d?"This address comes from `vellum tunnel` on this computer. Edit it if your devices reach this assistant at a different URL.":`The https address your devices can reach this assistant at (your Tailscale URL, or another tunnel's).`,value:i.publicBaseUrl,errorText:i.inputError??void 0,disabled:l,onChange:e=>i.setPublicBaseUrl(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())}}),(0,Z.jsx)(s,{variant:`primary`,className:`self-start`,disabled:!n||l||i.publicBaseUrl.trim()===``,onClick:m,children:p})]}),c.kind===`error`&&(0,Z.jsx)(z,{tone:`error`,title:c.message,children:c.hint}),u&&(0,Z.jsx)(Er,{pairUrl:c.pairUrl,remainingMs:i.remainingMs,expired:i.expired,copied:o,onCopy:a})]})})}async function jr(){if(!U())return[];let e=window.vellum;return e?.hotkeys?e.hotkeys.get():[]}async function Mr(e,t){if(!U())return;let n=window.vellum;n?.hotkeys&&await n.hotkeys.set(e,t)}function Nr(e){if(!U())return()=>{};let t=window.vellum;return t?.hotkeys?t.hotkeys.onChange(e):()=>{}}var Pr={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},Fr=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),Ir=e=>{let t=e.code;return Fr.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:Pr[t]??null},Lr=e=>{let t=Ir(e);if(t===null)return null;let n=[];return e.metaKey&&n.push(`CmdOrCtrl`),e.ctrlKey&&n.push(`Control`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),[...n,t].join(`+`)},Rr=(e,t,n)=>n===``?null:e.find(e=>e.key!==t&&e.accelerator===n)??null,zr=[{scope:`global`,title:`Global shortcuts`,description:`Work anywhere, even when Vellum is in the background.`},{scope:`menu`,title:`App shortcuts`,description:`Work while a Vellum window is focused.`}];function Br({hotkey:e,recording:t,conflictLabel:n,onStartRecording:r,onCancelRecording:i,onReset:a,onRemove:o}){let c=e.accelerator===``,l=e.override!==null;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Z.jsxs)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:[`Already used by `,n]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Recording… press a shortcut, or Esc to cancel`}):c?(0,Z.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`Disabled`}):(0,Z.jsx)(fe,{accelerator:e.accelerator}),t?(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:i,children:`Cancel`}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,onClick:r,"aria-label":`Record shortcut for ${e.label}`,children:`Record`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!l,leftIcon:(0,Z.jsx)(L,{className:`h-3.5 w-3.5`}),onClick:a,"aria-label":`Reset ${e.label} to default`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:c,leftIcon:(0,Z.jsx)(oe,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":`Remove ${e.label} binding`})]})]})}function Vr(){let[e,t]=(0,X.useState)([]),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),o=(0,X.useCallback)(()=>{jr().then(t)},[]);(0,X.useEffect)(()=>(o(),Nr(t)),[o]);let s=(0,X.useCallback)(()=>{r(null),a(null)},[]);(0,X.useEffect)(()=>{if(n===null)return;let t=t=>{if(t.preventDefault(),t.stopPropagation(),t.code===`Escape`){s();return}let r=Lr(t);if(r===null)return;let i=Rr(e,n,r);if(i!==null){a({key:n,label:i.label});return}Mr(n,r).then(o),s()};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[n,e,o,s]);let c=(0,X.useCallback)(e=>{a(null),r(e)},[]),l=(0,X.useCallback)(t=>{let n=Rr(e,t,e.find(e=>e.key===t)?.defaultAccelerator??``);if(n!==null){r(null),a({key:t,label:n.label});return}s(),Mr(t,null).then(o)},[e,o,s]),u=(0,X.useCallback)(e=>{s(),Mr(e,``).then(o)},[o,s]),d=(0,X.useMemo)(()=>zr.map(t=>({...t,commands:e.filter(e=>e.rebindable&&e.scope===t.scope)})).filter(e=>e.commands.length>0),[e]);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[i!==null&&(0,Z.jsxs)(z,{tone:`warning`,children:[`That shortcut is already used by `,i.label,`.`,` `,n===null?`Remove or change that binding before resetting.`:`Pick a different combination, or press Esc to cancel.`]}),d.map(e=>(0,Z.jsxs)(h,{bordered:!0,children:[(0,Z.jsxs)(`div`,{className:`mb-2`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-emphasised text-[var(--content-default)]`,children:e.title}),(0,Z.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Z.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Z.jsx)(Br,{hotkey:e,recording:n===e.key,conflictLabel:i!==null&&i.key===e.key?i.label:null,onStartRecording:()=>c(e.key),onCancelRecording:s,onReset:()=>l(e.key),onRemove:()=>u(e.key)},e.key))})]},e.scope))]})}async function Hr(){if(!U())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function Ur(e){if(!U())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function Wr(){let e=F.useValue();if(Nt())return null;let t=ot()?`Cmd`:`Ctrl`;return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Composer`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(me,{checked:e,onChange:F.save,label:`Send with ${t}+Enter`,helperText:`When enabled, Enter inserts a new line and ${t}+Enter sends.`})})]})}function Gr(){let[e,t]=(0,X.useState)(!1);(0,X.useEffect)(()=>{Hr().then(t)},[]);let n=async e=>{t(e);try{await Ur(e)}catch{t(!e)}};return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Launch at Login`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Automatically start Vellum when you log in to your Mac.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(me,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})]})}function Kr({open:e,onClose:t}){return(0,Z.jsx)(V.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Z.jsxs)(V.Content,{size:`lg`,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{children:`Preferences`}),(0,Z.jsx)(V.Description,{children:`Customize shortcuts and how Vellum behaves on this device.`})]}),(0,Z.jsx)(V.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[U()&&(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Keyboard Shortcuts`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Customize the shortcuts for Vellum's commands.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(Vr,{})})]}),(0,Z.jsx)(Wr,{}),U()&&(0,Z.jsx)(Gr,{})]})})]})})}function qr(e){return e===`preview`?`preview`:`stable`}function Jr(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Yr(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function Xr(e){return e.filter(e=>e.ready_to_use)}function Zr(e){return e?.feature_enabled===!1}function Qr({assistantId:e,onComplete:t}){let n=q.use.previewChannel(),r=d(),[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,m]=(0,X.useState)(`restore_backup`),[h,g]=(0,X.useState)(``),_=ft({path:{assistant_id:e}}),v=dt({path:{assistant_id:e}}),b=Et({path:{id:e}}),{data:x,isLoading:S,isError:C}=f({..._,enabled:n,retry:!1}),w=x?.preview_backups??[],E=(0,X.useMemo)(()=>Xr(w),[w]),D=E[0],O=E.find(e=>e.snapshot_name===h)??D,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:b}),t?.()},A=p(jt()),j=p(St()),M=qr(x?.current_channel),N=A.isPending||j.isPending,P=N||Zr(x)||!x?.latest_preview_release,F=u===`restore_backup`&&!O;if((0,X.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let I=x?.standard_upgrade_available??!1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Z.jsxs)(ue.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Z.jsxs)(ue.Trigger,{className:`group justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),x&&(0,Z.jsx)(pe,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Z.jsx)(y,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Z.jsx)(ue.Content,{children:(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[S&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Z.jsx)(z,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),x&&(0,Z.jsxs)(Z.Fragment,{children:[Zr(x)&&(0,Z.jsx)(z,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Z.jsx)($r,{status:x,isChangingChannel:N,optInDisabled:P,onOptIn:()=>s(!0)}):(0,Z.jsx)(ei,{status:x,isChangingChannel:N,onOptOut:()=>{let e=D;g(e?.snapshot_name??``),m(e?`restore_backup`:I?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Z.jsx)(ni,{open:o,isPending:A.isPending,previewVersion:x?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});H.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){H.error(W(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Z.jsx)(ri,{open:c,backups:E,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:F,standardUpgradeAvailable:I,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!F)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});H.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){H.error(W(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function $r({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(ti,{status:e}),!e.latest_preview_release&&(0,Z.jsx)(z,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ee,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function ei({status:e,isChangingChannel:t,onOptOut:n}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(ti,{status:e}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(L,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function ti({status:e}){return(0,Z.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function ni({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Z.jsx)(V.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Z.jsxs)(V.Content,{size:`md`,hideCloseButton:t,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{icon:ae,children:`Opt in to Preview`}),(0,Z.jsx)(V.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Z.jsx)(V.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(z,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Z.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Z.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Z.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Z.jsxs)(V.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Z.jsx)(s,{variant:`primary`,disabled:t,leftIcon:t?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ee,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function ri({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Z.jsx)(V.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Z.jsxs)(V.Content,{size:`md`,hideCloseButton:i,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{icon:ae,children:`Switch back to Stable`}),(0,Z.jsx)(V.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Z.jsx)(V.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(le,{value:n,onValueChange:c,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Z.jsx)(ce,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Z.jsx)(ce,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Z.jsx)(ge,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${Yr(e)} - ${Jr(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Z.jsx)(z,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Z.jsx)(z,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Z.jsxs)(V.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Z.jsx)(s,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ne,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}var ii=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function ai(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&ii.has(e.error)?`That size isn't available on your plan.`:W(e,void 0,t)}function oi({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=u(),c=f(Ot()),d=c.data,p=!e.is_local,m=d?.plan_id===`pro`,h=f({...kt(),enabled:m}),g=e.machine_size||`small`,_=Xt(h.data?.max_machine_tier??null),v=(0,X.useMemo)(()=>Jt(_,g,(0,Z.jsx)(pe,{tone:`positive`,children:`Current`})),[_,g]),y=h.data?.selected_storage_gib??null,[b,x]=(0,X.useState)(!1),S=_.length>0?_[_.length-1]:null,[w,E]=(0,X.useState)(null),D=w??S??g,[O,k]=(0,X.useState)(!1),[A,j]=(0,X.useState)(null),M=Dt({onSuccess:(e,n)=>{H.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),j(null),E(null),x(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{j(ai(e,`Failed to resize assistant. Please try again.`))}});if(c.isError&&d==null)return(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(z,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let N=m&&_.includes(D)&&D!==g?D:null,P=m&&y!=null&&!0,F=m&&_.length>0&&qt(g)<qt(_[_.length-1]),I=M.isPending||r,ee=y==null?t?.disk?.totalMb??null:y*1024,te=t?.disk&&ee!=null?{value:t.disk.usedMb,max:ee,caption:`${tn(t.disk.usedMb)} of ${tn(ee)}`}:null,L=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,R=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${tn(t.memory.currentMb)} of ${tn(t.memory.maxMb)}`}:null,ie=p?m?P?(0,Z.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(re,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:I,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>k(!0),children:`Resize`}):null,ae=p?m?F?(0,Z.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(re,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:I,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>k(!0),children:`Resize`}):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Z.jsx)(T,{className:`animate-spin`}):(0,Z.jsx)(ne,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),ie]}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),te?(0,Z.jsx)(Zt,{value:te.value,max:te.max,caption:te.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(T,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(an,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Z.jsx)(pe,{tone:`neutral`,children:Yt[g]})]}),ae]}),(0,Z.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),L?(0,Z.jsx)(Zt,{value:L.value,max:L.max,caption:L.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(T,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),R?(0,Z.jsx)(Zt,{value:R.value,max:R.max,caption:R.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(T,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Z.jsx)(V.Root,{open:O,onOpenChange:e=>{e||k(!1)},children:(0,Z.jsxs)(V.Content,{size:`sm`,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{children:`Upgrade your plan`}),(0,Z.jsx)(V.Description,{children:`Move to a higher plan for more power, more storage, and a larger credit bundle.`})]}),(0,Z.jsxs)(V.Footer,{children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>k(!1),children:`Cancel`}),(0,Z.jsx)(s,{onClick:()=>{k(!1),o(K.plans)},children:`Upgrade`})]})]})}),(0,Z.jsx)(V.Root,{open:b,onOpenChange:e=>{e||(x(!1),E(null),j(null))},children:(0,Z.jsxs)(V.Content,{size:`sm`,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{icon:an,children:`Resize Assistant`}),(0,Z.jsx)(V.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Z.jsx)(V.Body,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_.length===0?(0,Z.jsx)(z,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Z.jsx)(ge,{options:v,value:D,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),P?(0,Z.jsx)(z,{tone:`info`,children:`Storage will be expanded to ${y} GB.`}):(0,Z.jsx)(z,{tone:`neutral`,children:`Storage will not change.`}),A&&(0,Z.jsx)(z,{tone:`error`,children:A})]})}),(0,Z.jsxs)(V.Footer,{className:`items-center justify-between`,children:[(0,Z.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Z.jsx)(l,{to:K.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>x(!1),children:`Upgrade plan`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>{x(!1),E(null),j(null)},children:`Cancel`}),(0,Z.jsx)(s,{disabled:N==null&&!P||I,leftIcon:I?(0,Z.jsx)(T,{className:`animate-spin`}):void 0,onClick:()=>{j(null);let t={};N!=null&&(t.machine_size=N),P&&y!=null&&(t.storage_gib=y),M.mutate({path:{id:e.id},body:t})},children:A?`Retry`:`Apply`})]})]})]})})]})}function si({assistantId:e}){let t=u(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Z.jsx)(Ft,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await Pt(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}H.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}function ci(){let e=A(),t=O.useValue();return te(e)?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Show tips`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Occasional tips in the sidebar that highlight features you haven't tried yet.`})]}),(0,Z.jsx)(me,{checked:t,onChange:t=>{O.save(t),t||N(`settings`,`dont_show_again`,e)},"aria-label":`Show tips`})]}):null}var li=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function ui(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...li].sort()}function di(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function fi(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function pi(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function mi({value:e,onChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useMemo)(()=>ui().map(e=>di(e)).filter(e=>e!==null),[]);(0,X.useEffect)(()=>{let e=window.setTimeout(()=>{a(n.trim().toLowerCase())},200);return()=>window.clearTimeout(e)},[n]),(0,X.useEffect)(()=>{if(!o)return;let e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]);let d=(0,X.useMemo)(()=>i?u.filter(e=>e.city.toLowerCase().includes(i)||e.region.toLowerCase().includes(i)||e.offsetLabel.toLowerCase().includes(i)||e.identifier.toLowerCase().includes(i)):u,[u,i]),f=(0,X.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]),p=e=>{t(e),r(``),s(!1),l.current?.blur()};return(0,Z.jsxs)(`div`,{ref:c,className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Z.jsxs)(`div`,{className:`relative w-full md:max-w-[280px]`,children:[(0,Z.jsx)(B,{ref:l,type:`text`,value:n,placeholder:f||`Search city or country...`,onChange:e=>{r(e.target.value),s(!0)},onFocus:()=>s(!0),onKeyDown:e=>{e.key===`Escape`&&(r(``),s(!1),l.current?.blur())},fullWidth:!0}),o&&d.length>0&&(0,Z.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] overflow-y-auto rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,children:d.slice(0,200).map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(t.identifier),className:`flex w-full cursor-pointer items-center justify-between gap-3 px-3 py-2 text-left text-body-medium-lighter transition-colors ${t.identifier===e?`bg-[var(--surface-active)] text-[var(--content-default)]`:`text-[var(--content-default)] hover:bg-[var(--surface-active)]`}`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-default`,children:t.city}),t.region&&(0,Z.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:t.region})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(`span`,{children:fi(t.identifier)}),(0,Z.jsx)(`span`,{children:t.offsetLabel})]})]},t.identifier))})]})]}),(0,Z.jsx)(nn,{}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:pi(e)})]})]})}function hi(){let e=ke.use.activeAssistantId(),[t,n]=(0,X.useState)(()=>i(`timezone`,``)),o=(0,X.useRef)(e);(0,X.useEffect)(()=>{o.current=e},[e]);let s=(0,X.useRef)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=o.current;if(!t){c.current=null;return}s.current=!0,c.current=null,G.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{a(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,X.useEffect)(()=>{l.current=u}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Timezone`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Used when displaying times and scheduling reminders.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(0,Z.jsx)(mi,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})]})}var gi=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function _i(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function vi(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function yi(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function bi(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:_i(t),windowEnd:_i(n)}}function xi({assistantId:e}){let t=d(),{data:n,isLoading:r,isError:i}=f(gt({path:{id:e}})),a=(0,X.useMemo)(()=>bi(n),[n]),[o,c]=(0,X.useState)(null),l=o??a,u=o!==null,m=(0,X.useMemo)(()=>yi(),[]),[h,g]=(0,X.useState)(null),_=h??l.daysOfMonth.join(`, `),v=p({mutationFn:async t=>{let{data:n}=await $e({path:{id:e},body:t,throwOnError:!0});return n}}),y=e=>{c(t=>({...t??a,...e}))},b=e=>{y({daysOfWeek:l.daysOfWeek.includes(e)?l.daysOfWeek.filter(t=>t!==e):[...l.daysOfWeek,e].sort((e,t)=>e-t)})},x=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return r?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):i?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(me,{checked:l.enabled,onChange:e=>y({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),l.enabled&&(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,Z.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Z.jsx)(de,{ariaLabel:`Frequency`,value:l.frequency,onChange:e=>{e!==`monthly`&&g(null),y({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),l.frequency===`weekly`&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:gi.map(([e,t])=>(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,active:l.daysOfWeek.includes(t),onClick:()=>b(t),children:e},t))})]}),l.frequency===`monthly`&&(0,Z.jsx)(B,{label:`Day(s) of month`,type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=x(e.target.value);y({daysOfMonth:t}),g(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,m?` (${m})`:``]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(B,{type:`time`,value:l.windowStart,onChange:e=>y({windowStart:e.target.value})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,Z.jsx)(B,{type:`time`,value:l.windowEnd,onChange:e=>y({windowEnd:e.target.value})})]})]})]}),(0,Z.jsx)(s,{variant:`primary`,leftIcon:v.isPending?(0,Z.jsx)(T,{className:`animate-spin`}):void 0,onClick:async()=>{let n=l.frequency===`monthly`&&h!==null?x(h):l.daysOfMonth;try{await v.mutateAsync({enabled:l.enabled,timezone:`UTC`,schedule:{frequency:l.frequency,days_of_week:l.frequency===`weekly`?l.daysOfWeek:[],days_of_month:l.frequency===`monthly`?n:[],window:{start:vi(l.windowStart),end:vi(l.windowEnd)}}}),H.success(`Auto-update policy saved.`),c(null),g(null),t.invalidateQueries({queryKey:yt({path:{id:e}})})}catch{H.error(`Failed to save policy. Please try again.`)}},disabled:v.isPending||!u,children:`Save policy`})]})}function Si({assistantId:e,open:t,onClose:n}){return(0,Z.jsx)(V.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(V.Content,{size:`md`,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{children:`Update Window`}),(0,Z.jsx)(V.Description,{children:`Configure when automatic updates are applied.`})]}),(0,Z.jsx)(V.Body,{children:(0,Z.jsx)(xi,{assistantId:e})})]})})}function Ci(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function wi({open:e,onOpenChange:t}){let n=d(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(!1),f=(0,X.useRef)(e),p=()=>n.invalidateQueries({queryKey:xt()}),m=e=>{Ye({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=bt({onSuccess:e=>{if(!f.current){m(e.factor_id);return}i(e)},onError:e=>{let n=Ci(e);n===`no_workos_account`?H.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?H.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?H.error(`An authenticator app is already set up. Remove it before adding another.`):H.error(`Failed to start setup. Please try again.`),t(!1)}}),g=mt({onSuccess:e=>{e.valid?(u.current=!0,H.success(`Two-factor authentication is on.`),p(),t(!1)):l(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=Ci(e);if(n===`challenge_already_verified`){u.current=!0,H.success(`Two-factor authentication is on.`),p(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){r&&m(r.factor_id),i(null),o(``),l(`This setup session expired. Scan the new QR code and try again.`),h.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){l(`Too many attempts. Wait a minute and try again.`);return}l(`Couldn't verify the code. Wait a moment and try again.`)}});(0,X.useEffect)(()=>{f.current=e,e&&(u.current=!1,i(null),o(``),l(null),h.mutate({}))},[e]);let _=e=>{!e&&g.isPending||(!e&&r&&!u.current&&m(r.factor_id),t(e))},v=()=>{r&&navigator.clipboard.writeText(r.secret).then(()=>H.success(`Setup key copied.`)).catch(()=>H.error(`Couldn't copy the setup key.`))},y=()=>{!r||a.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:r.challenge_id,code:a}}))};return(0,Z.jsx)(V.Root,{open:e,onOpenChange:_,children:(0,Z.jsxs)(V.Content,{size:`sm`,children:[(0,Z.jsxs)(V.Header,{children:[(0,Z.jsx)(V.Title,{children:`Set up authenticator app`}),(0,Z.jsx)(V.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,Z.jsx)(V.Body,{children:r===null?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(T,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Z.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,Z.jsx)(`img`,{src:r.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:v,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Z.jsx)(`span`,{className:`break-all text-left`,children:r.secret}),(0,Z.jsx)(S,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,Z.jsx)(B,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Z.jsxs)(V.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>_(!1),disabled:g.isPending,children:`Cancel`}),(0,Z.jsx)(s,{onClick:y,disabled:r===null||a.length!==6||g.isPending,children:g.isPending?`Verifying…`:`Verify`})]})]})})}function Ti(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Ei(){let e=d(),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null),a=f({...ht()}),o=a.data??[],c=()=>e.invalidateQueries({queryKey:xt()}),l=pt({onSuccess:()=>{H.success(`Authenticator app removed.`),c()},onError:e=>{if(Ci(e)===`factor_not_found`){c();return}H.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.isPending?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):a.isError?(0,Z.jsxs)(z,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,Z.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void a.refetch(),children:`Try again`})]}):o.length===0?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:o.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(R,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,Z.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${Ti(e.created_at)}`:``]})]})]}),(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>i(e),disabled:l.isPending,children:`Remove`})]},e.id))}),!a.isPending&&!a.isError&&o.length===0&&(0,Z.jsx)(s,{onClick:()=>n(!0),className:`self-start`,children:`Add authenticator app`}),(0,Z.jsx)(wi,{open:t,onOpenChange:n}),(0,Z.jsx)(he,{open:r!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{r&&l.mutate({path:{id:r.id}}),i(null)},onCancel:()=>i(null)})]})}var $=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Di=`local`,Oi=`docker`,ki=`vellum`;function Ai(e){switch((e??``).toLowerCase()){case Di:return`local`;case Oi:return`docker`;case ki:return`managed`;default:return`other`}}function ji(e){let t=Ai(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Mi(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Ni(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function Pi(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function Fi(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Ii(e){let t=Te(e);if(!t)throw new $(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Li(e,t){let n=await _e(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function Ri(e,t){let n=Ii(e),r=await Li(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new $(`export_failed`,`Export failed (HTTP ${i.status}).`);return Fi(i,t)}async function zi(e,t){let n=Ii(e),r=await Li(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new $(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await Hi(i);if(a&&a.success===!1)throw new $(`import_failed`,a.error??`Import reported failure`)}async function Bi(e,t){let{data:n,response:r}=await G.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new $(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new $(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function Vi(e,t){let{data:n,response:r}=await G.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new $(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new $(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function Hi(e){try{return await e.json()}catch{return null}}var Ui=new Set([500,502,503,504]),Wi=3,Gi=e=>new Promise(t=>setTimeout(t,e));async function Ki(e,t=new Set){for(let n=0;n<=Wi;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<Wi&&Ui.has(o)&&!t.has(o)){await Gi(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new $(`unknown`,`Unexpected retry loop exit`)}async function qi(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await Ki(()=>G.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new $(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new $(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function Ji(e,t){let{status:n,data:r,error:i}=await Ki(()=>G.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Pi(i);if(e)throw new $(`version_mismatch`,e)}if(n!==200&&n!==201)throw new $(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function Yi(e,t,n){for(let r=0;r<=Wi;r++){let i=await Xi(e,t,n);if(r<Wi&&Ui.has(i)){await Gi(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new $(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function Xi(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new $(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new $(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function Zi(e,t){for(let n=0;n<=Wi;n++){let r=await fetch(e,{method:`GET`});if(n<Wi&&Ui.has(r.status)){await Gi(2**n*1e3),t?.(0);continue}if(!r.ok)throw new $(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Fi(r,t)}throw new $(`import_failed`,`Unexpected retry loop exit`)}async function Qi(e){let{status:t,data:n,error:r}=await Ki(()=>G.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function $i(e){let{status:t,data:n}=await Ki(()=>G.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new $(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var ea=5e3,ta=36e5,na=5*6e4,ra=30,ia=e=>new Promise(t=>setTimeout(t,e));function aa(){let e=u(),t=be(),n=ji(t?.cloud),[r,i]=(0,X.useState)({kind:`idle`}),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,X.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,X.useCallback)(async()=>{if(!(!t||!n)){l.current={id:t.assistantId,kind:Ai(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await oa(t,d,f,c);else if(n===`local`)await sa(t,d,f,c);else throw new $(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof $||e instanceof Error?e.message:`Teleport failed.`}`}),a(e,{context:`teleport-execute`}),await la(c.current,l.current,`teleport-execute-cleanup`),c.current=null}}},[t,n,d,f]),m=(0,X.useCallback)(()=>s(!0),[]),h=(0,X.useCallback)(()=>s(!1),[]),g=(0,X.useCallback)(()=>{s(!1),p()},[p]),_=(0,X.useCallback)(()=>{c.current=null,l.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:o,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,X.useCallback)(()=>{let t=c.current,n=l.current;t&&(async()=>{try{let e=Ue.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Ie(t.id,{onError:e=>a(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),a(e,{context:`teleport-confirm-switch`});return}n&&Pt(n.id).then(e=>{e.ok||a(Error(e.error),{context:`teleport-retire-source`})}),_(),e(K.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,X.useCallback)(()=>{let e=c.current,t=l.current;c.current=null,l.current=null,i({kind:`idle`}),la(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function oa(e,t,n,r){t(`Exporting assistant data...`);let i=await Ri(e,n);t(`Resolving organization...`);let a=await da();t(`Checking for existing assistant...`);let o=(await Ze({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new $(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await qi(e.resources?.runtimeVersion);await Yi(s.url,i,n),t(`Setting up cloud assistant...`);let c=await nt(void 0,`create`);if(!c.ok)throw new $(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new $(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await Oe({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:Ee(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await ye(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await fa(l),t(`Importing data to cloud...`);let u=await Qi(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new $(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new $(`import_failed`,`Import accepted but no job ID returned.`);await pa(e)}else{let e=u.body;if(e&&e.success===!1)throw new $(`import_failed`,e.error??`Import reported failure.`)}}async function sa(e,t,n,r){t(`Preparing export...`);let i=await qi(await ua(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await Bi(e.assistantId,i.url);await ma(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await ha();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await ca(o,s);if(!c)throw new $(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await Ji(i.bundleKey,c);t(`Downloading data...`);let u=await Zi(l,n);t(`Importing data...`),await _a(o,u),await ye(e.assistantId)}async function ca(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Gt())?.version??void 0}async function la(e,t,n){if(e?.createdFresh){let t=await Pt(e.id);t.ok||a(Error(t.error),{context:n})}t&&await ye(t.id)}async function ua(e){let t=await tt(e);return t.ok?t.data.version??void 0:void 0}async function da(){let e=Fe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Fe.getState().organizations,n=Le();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new $(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new $(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return Fe.getState().setCurrentOrganizationId(r),r}async function fa(e){let t=Date.now();for(;Date.now()-t<na;){let{data:t,response:n}=await et({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await ia(ea)}}async function pa(e){let t=Date.now();for(;Date.now()-t<ta;){await ia(ea);let t=await $i(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new $(`import_failed`,t.error??`Import job failed`)}throw new $(`import_failed`,`Import timed out after 60 minutes.`)}async function ma(e,t){let n=Date.now();for(;Date.now()-n<ta;)if(await ia(ea),await Vi(e,t)===`complete`)return;throw new $(`export_timed_out`,`Export timed out.`)}async function ha(){let e=await ve(void 0,void 0);if(!e.ok)throw new $(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await Ce();let t=e.assistantId?De().find(t=>t.assistantId===e.assistantId):ga();if(!t)throw new $(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function ga(){return De().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function _a(e,t){let n;for(let r=0;r<ra;r++)try{await zi(e,t);return}catch(e){n=e,await ia(1e3)}throw n instanceof Error?n:new $(`import_failed`,`Import failed.`)}function va(){let e=aa(),{destination:t,phase:n}=e;return t?(0,Z.jsxs)(Y,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Ni(t)}),(0,Z.jsx)(s,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:Mi(t)})]}),n.kind===`transferring`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Z.jsx)(T,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Z.jsx)(se,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Z.jsx)(z,{tone:`success`,icon:(0,Z.jsx)(x,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Z.jsx)(z,{tone:`error`,title:n.error,actions:(0,Z.jsx)(s,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Z.jsx)(he,{open:e.confirmOpen,title:Mi(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function ya(){let{assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}=$t(),o=q.use.multiPlatformAssistant(),l=q.use.teleport(),d=q.use.accountMfa(),f=Mt.use.settingsSleepPolicy(),p=Re(),m=u(),h=rt(),g=rt({platformHostedOnly:!0}),_=at(),v=j({assistantId:e?.id??null,enabled:g===`full`&&_}),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,w]=c();(0,X.useEffect)(()=>{if(C.get(`preferences`)!==`open`)return;let e=new URLSearchParams(C);e.delete(`preferences`),w(e,{replace:!0}),S(!0)},[C,w]);let T=e?.is_local&&!Se()?null:e,E=be(),D=Se()&&!!e&&!!E&&xe(E),O=D,k=D&&!we(),A=g===`full`&&!!T||k&&!!e;(0,X.useEffect)(()=>{!e||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[e]);let M=t?.version??e?.current_release_version??null,N=(h===`full`||O)&&!!T||h===`disabled`&&!O,P=g!==`gated`,F=U()||!Nt();return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[v.status&&v.mode!==`inactive`&&(0,Z.jsx)(I,{status:v.status,mode:v.mode,isAcknowledging:v.isAcknowledging,acknowledgeError:v.acknowledgeError?.message??null,onAcknowledge:()=>void v.acknowledge(),onReviewWorkspaceData:()=>void m(`${K.workspace}?sort=size`),onUpgradeStorage:g===`full`?()=>void m(K.plans):null}),(0,Z.jsxs)(bn,{assistant:_?T:null,showHandles:p&&h===`full`,children:[(0,Z.jsx)(hi,{}),d&&h!==`gated`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Two-Factor Authentication`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Require a code from an authenticator app when you sign in.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:h===`disabled`?(0,Z.jsx)(J,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,Z.jsx)(Ei,{})})]})]})]}),(0,Z.jsx)(Y,{title:`Version`,subtitle:`Manage your assistant's software version and updates.`,accessory:g===`full`&&T?(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>b(!0),children:`Update Window`}):void 0,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g===`full`&&T&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(An,{assistantId:T.id,currentVersion:M,releaseChannel:T.release_channel,onUpgradeComplete:()=>{i()}}),(0,Z.jsx)(Qr,{assistantId:T.id,onComplete:()=>{i()}})]}),k&&e&&(0,Z.jsx)(jn,{assistantId:e.id,currentVersion:M,onUpgradeComplete:()=>{i()}}),!A&&e&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(en,{version:M,loading:n&&!e.current_release_version,assistantId:e.id??null})]}),g===`disabled`&&!k&&(0,Z.jsx)(J,{children:`Log in to the Vellum platform to manage software updates.`})]})}),g===`full`&&T&&(0,Z.jsx)(Si,{assistantId:T.id,open:y,onClose:()=>b(!1)}),g===`full`&&e&&(0,Z.jsx)(oi,{assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}),g===`disabled`&&(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(J,{children:`Log in to the Vellum platform to manage compute resources.`})}),(0,Z.jsx)(Y,{title:`Preferences`,subtitle:`Customize how Vellum looks and behaves on this device.`,accessory:F?(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>S(!0),children:`Customize`}):void 0,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsx)(ci,{})]})}),F&&(0,Z.jsx)(Kr,{open:x,onClose:()=>S(!1)}),l&&U()&&(0,Z.jsx)(va,{}),(0,Z.jsx)(Pn,{}),(0,Z.jsx)(Ar,{}),g===`full`&&T&&f&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(En,{assistantId:T.id})}),g===`disabled`&&f&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(J,{children:`Log in to the Vellum platform to manage sleep policy.`})}),o&&(0,Z.jsx)(Cn,{}),(N||P)&&(0,Z.jsx)(Y,{variant:`danger`,title:`Danger Zone`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[N&&(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Retire Assistant`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently retire this assistant and delete all associated data.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(h===`full`||O)&&T?(0,Z.jsx)(si,{assistantId:T.id}):(0,Z.jsx)(J,{children:`Log in to the Vellum platform to retire this assistant.`})})]}),N&&P&&(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(Mn,{})]})})]})}export{ya as GeneralPage};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/build.umd-DlzJAHJ4.js","assets/chunk-jRWAZmH_.js","assets/esm-DBsjWTS3.js","assets/preload-helper-Cv2QeVDK.js","assets/dist-BwAT3VYQ.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-jRWAZmH_.js";import{i as n,r,s as i}from"./device-settings-DXp9L4iB.js";import{$ as a,A as o,At as s,B as c,C as l,Ct as u,D as d,Dt as f,E as p,Et as m,F as h,Ft as g,G as _,H as v,I as y,It as b,J as x,K as ee,L as te,M as ne,Mt as re,N as ie,Nt as ae,O as oe,Ot as se,P as ce,Pt as le,Q as ue,R as S,S as C,St as de,T as fe,Tt as pe,U as me,V as w,X as T,Y as he,Z as ge,_ as _e,_t as ve,a as ye,at as be,b as xe,bt as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as Ne,j as Pe,jt as Fe,k as Ie,kt as Le,l as Re,lt as ze,mt as Be,nt as Ve,ot as He,p as Ue,pt as We,q as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,v as $e,vt as et,w as tt,wt as nt,x as rt,xt as it,y as at,yt as ot,z as st}from"./capture-error-Bj8_eutd.js";import{c as ct,d as lt,l as ut,o as dt,r as ft,s as E,u as pt}from"./document-viewer-container-C9xsTewm.js";import{o as mt}from"./stream-watchdog-BafbDdX9.js";import{t as ht}from"./react-BFJW0bSv.js";import{F as gt,r as _t}from"./button-Dy5001j6.js";import{t as vt}from"./preload-helper-Cv2QeVDK.js";import{i as yt}from"./chunk-5KNZJZUH-Bsoom5--.js";import{A as bt,C as xt,D as St,N as Ct,S as wt,_ as Tt,b as Et,c as Dt,g as Ot,h as kt,s as D,t as At,u as jt,x as Mt}from"./QueryClientProvider-CMu7CkQU.js";import{f as Nt}from"./useQuery-Bz-fbQ-m.js";import{n as Pt}from"./useInfiniteQuery-Dk8q0n49.js";import{n as Ft}from"./useMutation-CXGTrp4W.js";import{t as It}from"./jsx-runtime-D3ZM-ToX.js";import{a as Lt,i as Rt,r as zt,t as Bt}from"./routes-HkLBPlvB.js";import{t as Vt}from"./src-D89CNeuT.js";import{t as Ht}from"./toast-LgLp4obE.js";import{$ as Ut,et as Wt,f as Gt,g as Kt,h as qt,m as Jt,rt as Yt,st as Xt}from"./local-mode-Ckii2tmN.js";import{t as Zt}from"./is-electron-m5eeGBnd.js";import{n as Qt}from"./resolved-assistants-store-C-PdxK8f.js";import{Ur as $t}from"./sdk.gen-BVAVE6A_.js";import{i as en,t as tn}from"./api-errors-CFiCT7Ap.js";import{D as nn,E as rn,H as an,M as on,P as sn,T as cn,V as ln,_ as un,a as dn,d as fn,j as pn,m as mn,n as hn,t as gn,w as _n}from"./auth-store-D0-gDCVn.js";import{t as vn}from"./client.gen-CV05d-kw.js";import{c as yn}from"./api-XwdNiVE9.js";import{D as bn,b as xn,u as Sn,x as Cn,y as wn}from"./native-biometric-CntdlaL-.js";import{i as Tn,t as En}from"./dist-BwAT3VYQ.js";import{u as Dn}from"./routes-vE-2hncW.js";import{t as On}from"./onboarding-store-DutUn1E3.js";import{r as kn}from"./prefs-BZnS5vR_.js";import{n as An}from"./platform-detection-CMiRPRCq.js";import{n as jn}from"./client-identity-BS5mQsaQ.js";import{t as Mn}from"./hard-navigate-DZlpL1No.js";import{C as Nn}from"./sdk.gen-DPKrJeho.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Pn(e,t,n){if(!(typeof window>`u`))try{localStorage.getItem(e)===t&&localStorage.setItem(e,n)}catch{}}function Fn(e){if(!(typeof window>`u`))try{localStorage.removeItem(e)}catch{}}function O(e,t){if(!(typeof window>`u`))try{let n=localStorage.getItem(e);if(n===null)return;localStorage.getItem(t)===null&&localStorage.setItem(t,n),localStorage.getItem(t)!==null&&localStorage.removeItem(e)}catch{}}function In(e,t){if(!(typeof window>`u`))try{let n=[];for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i&&i.startsWith(e)){let r=i.slice(e.length);n.push([i,t+r])}}for(let[e,t]of n)O(e,t)}catch{}}function Ln(e){let t=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);r&&r.startsWith(e)&&t.push(r)}for(let e of t)localStorage.removeItem(e)}function Rn(){if(typeof window>`u`)return;let e=`vellum:selectedAssistantId`,t=`vellum:local:selectedAssistantId`,n=`vellum:currentAssistantId:`;try{if(localStorage.getItem(e)===null){let r=localStorage.getItem(t);if(r===null&&(r=zn(n)),r===null){let e=null;for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(n)&&(e===null||r<e)&&(e=r)}e!==null&&(r=localStorage.getItem(e))}r&&localStorage.setItem(e,r)}localStorage.removeItem(t),Ln(n)}catch{}}function zn(e){let t=null;try{t=sessionStorage.getItem(`vellum_active_organization_id`)}catch{return null}return t?localStorage.getItem(`${e}${t}`):null}function Bn(){if(!(typeof window>`u`)){if(O(`assistantSidebarCollapsed`,`vellum:sidebar:collapsed`),O(`assistantSidebarWidth`,`vellum:sidebar:width`),O(`voice:permissionPrimerSeen`,`vellum:voice:permissionPrimerSeen`),O(`voice:ttsProvider`,`vellum:voice:ttsProvider`),O(`voice:sttProvider`,`vellum:voice:sttProvider`),O(`voice:activationKey`,`vellum:voice:activationKey`),O(`integrations.bannerDismissed`,`vellum:integrations:bannerDismissed`),O(`onboarding.tosAccepted`,`vellum:onboarding:tosAccepted`),O(`onboarding.aiDataConsent`,`vellum:onboarding:aiDataConsent`),Fn(`onboarding.completed`),Fn(`vellum:onboarding:completed`),O(`onboarding.selectedVersion`,`vellum:onboarding:selectedVersion`),O(`vellum:skillsTabTipDismissed`,`vellum:skills:tipDismissed`),O(`vellum_image_gen_mode`,`vellum:ai:imageGenMode`),O(`vellum_image_gen_model`,`vellum:ai:imageGenModel`),localStorage.getItem(`vellum:ai:imageGenProvider`)===null){let e=localStorage.getItem(`vellum:ai:imageGenMode`);e===`managed`?localStorage.setItem(`vellum:ai:imageGenProvider`,`vellum`):e===`your-own`&&localStorage.setItem(`vellum:ai:imageGenProvider`,`gemini`)}O(`vellum_web_search_mode`,`vellum:ai:webSearchMode`),O(`vellum_web_search_provider`,`vellum:ai:webSearchProvider`),O(`vellum_email_mode`,`vellum:ai:emailMode`),O(`vellum_email_byo_provider`,`vellum:ai:emailByoProvider`),O(`vellum_gemini_key`,`vellum:ai:geminiKey`),O(`vellum_perplexity_key`,`vellum:ai:perplexityKey`),O(`vellum_brave_key`,`vellum:ai:braveKey`),O(`vellum_tavily_key`,`vellum:ai:tavilyKey`),O(`vellumDebug.flags.impersonateAssistantVersion`,`vellum:debug:impersonateAssistantVersion`),O(`gw:token`,`vellum:gw:token`),O(`gw:expiresAt`,`vellum:gw:expiresAt`),O(`gw:tokenSource`,`vellum:gw:tokenSource`),O(`local:lockfile`,`vellum:local:lockfile`),O(`local:selectedAssistantId`,`vellum:local:selectedAssistantId`),In(`voice:ttsApiKey:`,`vellum:voice:ttsApiKey:`),In(`voice:ttsVoiceId:`,`vellum:voice:ttsVoiceId:`),In(`voice:sttApiKey:`,`vellum:voice:sttApiKey:`),In(`ff:client:`,`vellum:ff:`),In(`disk-pressure-warning-dismissed-`,`vellum:diskPressureDismissed:`),In(`vellum_current_assistant_id__`,`vellum:currentAssistantId:`),Rn(),Pn(`vellum:skills:tipDismissed`,`1`,`true`),Fn(`app.githubNudge.starred`),Fn(`app.githubNudge.bannerDismissed`),Fn(`app.githubNudge.bannerDismissedAt`),Fn(`app.discordNudge.joined`),Fn(`app.discordNudge.bannerDismissed`),Fn(`app.discordNudge.firstSeenAt`),Fn(`app.nudgeLegacy.cleaned`)}}n(),Bn();var Vn={},Hn={};function Un(e,t){return Vn[e]=Vn[e]||[],Vn[e].push(t),()=>{let n=Vn[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function Wn(e,t){if(!Hn[e]){Hn[e]=!0;try{t()}catch(t){b&&s.error(`Error while instrumenting ${e}`,t)}}}function Gn(e,t){let n=e&&Vn[e];if(n)for(let r of n)try{r(t)}catch(t){b&&s.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${m(r)}\nError:`,t)}}var Kn=null;function qn(e){let t=`error`;Un(t,e),Wn(t,Jn)}function Jn(){Kn=g.onerror,g.onerror=function(e,t,n,r,i){return Gn(`error`,{column:r,error:i,line:n,msg:e,url:t}),Kn?Kn.apply(this,arguments):!1},g.onerror.__SENTRY_INSTRUMENTED__=!0}var Yn=null;function Xn(e){let t=`unhandledrejection`;Un(t,e),Wn(t,Zn)}function Zn(){Yn=g.onunhandledrejection,g.onunhandledrejection=function(e){return Gn(`unhandledrejection`,e),Yn?Yn.apply(this,arguments):!0},g.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Qn(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let 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 $n(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function er(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}var tr=[];function nr(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function rr(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return nr(r)}function ir(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&or(e,t,n)}),n}function ar(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function or(e,t,n){if(n[t.name]){b&&s.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!tr.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),tr.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),b&&s.log(`Integration installed: ${t.name}`)}function sr(e){return e}function cr(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function lr(){return`npm`}function ur(){return!cr()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function dr(){return typeof window<`u`&&(!ur()||fr())}function fr(){return g.process?.type===`renderer`}function pr(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...dr()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function mr(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=ce(r)),at(a,[pr(e,i)])}function hr(e,t){let n=t??gr(e)??[];if(n.length===0)return;let r=e.getOptions(),i=mr(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);_r().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function gr(e){return _r().get(e)}function _r(){return re(`clientToLogBufferMap`,()=>new WeakMap)}function vr(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...dr()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function yr(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=ce(r)),at(a,[vr(e,i)])}function br(e,t){let n=t??xr(e)??[];if(n.length===0)return;let r=e.getOptions(),i=yr(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);Sr().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function xr(e){return Sr().get(e)}function Sr(){return re(`clientToMetricBufferMap`,()=>new WeakMap)}function Cr(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}var wr=Symbol.for(`SentryBufferFullError`);function Tr(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Ee(wr);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Ue(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Cr(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var Er=60*1e3;function Dr(e,t=Ve()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?Er:r-t}function Or(e,t){return e[t]||e.all||0}function kr(e,t,n=Ve()){return Or(e,t)>n}function Ar(e,{statusCode:t,headers:n},r=Ve()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Dr(o,r):t===429&&(i.all=r+60*1e3);return i}function jr(e,t,n=Tr(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(C(i,(t,n)=>{let i=rt(n);kr(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=at(i[0],a),c=t=>{if(xe(o,[`client_report`])){b&&s.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}C(o,(n,r)=>{e.recordDroppedEvent(t,rt(r))})};return n.add(()=>t({body:l(o)}).then(e=>e.statusCode===413?(b&&s.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),c(`send_error`),e):(b&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&s.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Ar(r,e),e),e=>{throw c(`network_error`),b&&s.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===wr)return b&&s.error(`Skipped sending event because buffer is full.`),c(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Mr(e,t,n){let r=[{type:`client_report`},{timestamp:n||Ge(),discarded_events:e}];return at(t?{dsn:t}:{},[r])}function Nr(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Pr(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[S],exclusive_time:o?.[te],measurements:e.measurements,is_segment:!0}}function Fr(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&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var Ir=`Not capturing exception because it's already been captured.`,Lr=`Discarded session because of missing or non-string release`,Rr=Symbol.for(`SentryInternalError`),zr=Symbol.for(`SentryDoNotSendEventError`),Br=5e3;function Vr(e){return{message:e,[Rr]:!0}}function Hr(e){return{message:e,[zr]:!0}}function Ur(e){return!!e&&typeof e==`object`&&Rr in e}function Wr(e){return!!e&&typeof e==`object`&&zr in e}function Gr(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Cr(setTimeout(()=>{i(e)},Br)))}),e.on(`flush`,()=>{i(e)})}var Kr=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Tr(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=h(e.dsn):b&&s.warn(`No DSN provided, client will not send events.`),this._dsn){let t=lt(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&Gr(this,`afterCaptureLog`,`flushLogs`,$r,hr),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Gr(this,`afterCaptureMetric`,`flushMetrics`,Qr,br)}captureException(e,t,n){let r=a();if(ge(e))return b&&s.log(Ir),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:a(),...n},o=et(e)?e:String(e),s=Se(e),c=s?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this._process(()=>c.then(e=>this._captureEvent(e,i,r)),s?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=a();if(t?.originalException&&ge(t.originalException))return b&&s.log(Ir),r;let i={event_id:r,...t},o=e.sdkProcessingMetadata||{},c=o.capturedSpanScope,l=o.capturedSpanIsolationScope,u=qr(e.type);return this._process(()=>this._captureEvent(e,i,c||n,l),u),i.event_id}captureSession(e){this.sendSession(e),ee(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){hr(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),or(this,e,this._integrations),t||ar(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Ae(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=_e(n,$e(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=oe}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){b&&s.warn(Lr);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){b&&s.warn(Lr);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Oe(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;b&&s.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return b&&s.error(`Error while sending envelope:`,e),{}}return b&&s.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=ir(this,e),ar(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(ee(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ce(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...me(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:d(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=c(),r=v()){return b&&Xr(e)&&s.log(`Captured error event \`${Nr(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{b&&(Wr(e)?s.log(e.message):Ur(e)?s.warn(e.message):s.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Zr(e),s=Xr(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ie(a);if(s&&typeof l==`number`&&Ke()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Ee(Hr(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=qr(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Hr("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Jr(Yr(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Hr(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Wr(e)||Ur(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Vr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===wr&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){b&&s.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){b&&s.log(`No outcomes to send`);return}if(!this._dsn){b&&s.log(`No dsn provided, will not send outcomes`);return}b&&s.log(`Sending outcomes:`,e);let t=Mr(e,this._options.tunnel&&ce(this._dsn));this.sendEnvelope(t)}};function qr(e){return e===`replay_event`?`replay`:e||`error`}function Jr(e,t){let n=`${t} must return \`null\` or a valid event.`;if(u(e))return e.then(e=>{if(!ot(e)&&e!==null)throw Vr(n);return e},e=>{throw Vr(`${t} rejected with ${e}`)});if(!ot(e)&&e!==null)throw Vr(n);return e}function Yr(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:s}=t,c=!p(t.beforeSendSpan)&&t.beforeSendSpan,l=n;if(Xr(l)&&i)return i(l,r);if(Zr(l)){if(c||s){let t=Pr(l);if(s?.length&&o({description:t.description,op:t.op,attributes:t.data},s))return null;if(c){let e=c(t);e?l=_(n,Fr(e)):Pe()}if(l.spans){let t=[],n=l.spans;for(let e of n){if(s?.length&&o({description:e.description,op:e.op,attributes:e.data},s)){Ie(n,e);continue}if(c){let n=c(e);n?t.push(n):(Pe(),t.push(e))}else t.push(e)}let r=l.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),l.spans=t}}if(a){if(l.spans){let e=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(l,r)}}return l}function Xr(e){return e.type===void 0}function Zr(e){return e.type===`transaction`}function Qr(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+ei(e.attributes)}function $r(e){let t=0;return e.message&&(t+=e.message.length*2),t+ei(e.attributes)}function ei(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*ti(e[0]):Se(e)?t+=ti(e):t+=100}),t}function ti(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function ni(e,t){return e(t.stack||``,1)}function ri(e){return Be(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function ii(e){return ri(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function ai(e,t){let n={type:t.name||t.constructor.name,value:ii(t)},r=ni(e,t);return r.length&&(n.stacktrace={frames:r}),n}function oi(e,t){t.debug===!0&&(b?s.enable():Le(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),c().update(t.initialScope);let n=new e(t);return si(n),n.init(),n}function si(e){c().setClient(e)}function ci(e){`aggregates`in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:`{{auto}}`}):e.ipAddress===void 0&&(e.ipAddress=`{{auto}}`)}function li(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:le})),i.version=le)}var ui,di=`FunctionToString`,fi=new WeakMap,pi=sr((()=>({name:di,setupOnce(){ui=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Je(this),n=fi.has(st())&&t!==void 0?t:this;return ui.apply(n,e)}}catch{}},setup(e){fi.set(e,!0)}}))),mi=[/^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$/],hi=`EventFilters`,gi=sr((e={})=>{let t;return{name:hi,setup(n){t=vi(e,n.getOptions())},processEvent(n,r,i){return t||=vi(e,i.getOptions()),yi(n,t)?null:n}}}),_i=sr(((e={})=>({...gi(e),name:`InboundFilters`})));function vi(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:mi],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function yi(e,t){if(!e.type){if(bi(e,t.ignoreErrors))return b&&s.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${ue(e)}`),!0;if(Ei(e))return b&&s.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${ue(e)}`),!0;if(Si(e,t.denyUrls))return b&&s.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${ue(e)}.\nUrl: ${Ti(e)}`),!0;if(!Ci(e,t.allowUrls))return b&&s.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${ue(e)}.\nUrl: ${Ti(e)}`),!0}else if(e.type===`transaction`&&xi(e,t.ignoreTransactions))return b&&s.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${ue(e)}`),!0;return!1}function bi(e,t){return t?.length?Nr(e).some(e=>Xe(e,t)):!1}function xi(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Xe(n,t):!1}function Si(e,t){if(!t?.length)return!1;let n=Ti(e);return n?Xe(n,t):!1}function Ci(e,t){if(!t?.length)return!0;let n=Ti(e);return n?Xe(n,t):!0}function wi(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Ti(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?wi(t):null}catch{return b&&s.error(`Cannot extract url for event ${ue(e)}`),null}}function Ei(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Di(e,t,n,r,i,a){if(!i.exception?.values||!a||!ve(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Oi(e,t,r,a.originalException,n,i.exception.values,o,0))}function Oi(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(ve(r[i],Error)){Ai(o,s,r);let a=e(t,r[i]),l=c.length;ji(a,i,l,s),c=Oi(e,t,n,r[i],i,[a,...c],a,l)}return ki(r)&&r.errors.forEach((a,l)=>{if(ve(a,Error)){Ai(o,s,r);let u=e(t,a),d=c.length;ji(u,`errors[${l}]`,d,s),c=Oi(e,t,n,a,i,[u,...c],u,d)}}),c}function ki(e){return Array.isArray(e.errors)}function Ai(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...ki(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function ji(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}var Mi=`cause`,Ni=5,Pi=`LinkedErrors`,Fi=sr(((e={})=>{let t=e.limit||Ni,n=e.key||Mi;return{name:Pi,preprocessEvent(e,r,i){Di(ai,i.getOptions().stackParser,n,t,e,r)}}}));function Ii(e){let t=`console`,n=Un(t,e);return Wn(t,Li),n}function Li(){`console`in g&&se.forEach(function(e){e in g.console&&He(g.console,e,function(t){return Fe[e]=t,function(...t){Gn(`console`,{args:t,level:e}),Fe[e]?.apply(g.console,t)}})})}function Ri(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var zi=`Dedupe`,Bi=sr((()=>{let e;return{name:zi,processEvent(t){if(t.type)return t;try{if(Vi(t,e))return b&&s.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Vi(e,t){return t?!!(Hi(e,t)||k(e,t)):!1}function Hi(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Ui(e,t)||!A(e,t))}function k(e,t){let n=Wi(t),r=Wi(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Ui(e,t)||!A(e,t))}function A(e,t){let n=pe(e),r=pe(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Ui(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 Wi(e){return e.exception?.values?.[0]}function Gi(e,t){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r===`.`?e.splice(t,1):r===`..`?(e.splice(t,1),n++):n&&(e.splice(t,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}var Ki=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function qi(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Ki.exec(t);return n?n.slice(1):[]}function Ji(...e){let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:`/`;i&&(t=`${i}/${t}`,n=i.charAt(0)===`/`)}return t=Gi(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function Yi(e){let t=0;for(;t<e.length&&e[t]===``;t++);let n=e.length-1;for(;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}function Xi(e,t){e=Ji(e).slice(1),t=Ji(t).slice(1);let n=Yi(e.split(`/`)),r=Yi(t.split(`/`)),i=Math.min(n.length,r.length),a=i;for(let e=0;e<i;e++)if(n[e]!==r[e]){a=e;break}let o=[];for(let e=a;e<n.length;e++)o.push(`..`);return o=o.concat(r.slice(a)),o.join(`/`)}function Zi(e,t){let n=qi(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var Qi=`RewriteFrames`,$i=sr((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in g&&!!g.window,i=e.iteratee||ea({isBrowser:r,root:t,prefix:n});function a(e){try{return{...e,exception:{...e.exception,values:e.exception.values.map(e=>({...e,...e.stacktrace&&{stacktrace:o(e.stacktrace)}}))}}}catch{return e}}function o(e){return{...e,frames:e?.frames?.map(e=>i(e))}}return{name:Qi,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function ea({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes(`\\`)&&!r.filename.includes(`/`),a=/^\//.test(r.filename);if(e){if(t){let e=r.filename;e.indexOf(t)===0&&(r.filename=e.replace(t,n))}}else if(i||a){let e=i?r.filename.replace(/^[a-zA-Z]:/,``).replace(/\\/g,`/`):r.filename;r.filename=`${n}${t?Xi(t,e):Zi(e)}`}return r}}var ta=`ConversationId`,na=sr((()=>({name:ta,setup(e){e.on(`spanStart`,e=>{let t=c().getScopeData(),n=v().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=ne(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(y,r)}})}})));function ra(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}var ia=g;function aa(){return`history`in ia&&!!ia.history}function oa(){if(!(`fetch`in ia))return!1;try{return new Headers,new Request(`data:,`),new Response,!0}catch{return!1}}function sa(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function ca(){if(typeof EdgeRuntime==`string`)return!0;if(!oa())return!1;if(sa(ia.fetch))return!0;let e=!1,t=ia.document;if(t&&typeof t.createElement==`function`)try{let n=t.createElement(`iframe`);n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=sa(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){b&&s.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return e}function la(e,t){let n=`fetch`,r=Un(n,e);return Wn(n,()=>ua(void 0,t)),r}function ua(e,t=!1){t&&!ca()||He(g,`fetch`,function(t){return function(...n){let r=Error(),{method:i,url:a}=pa(n),o={args:n,fetchData:{method:i,url:a},startTimestamp:x()*1e3,virtualError:r,headers:ma(n)};return e||Gn(`fetch`,{...o}),t.apply(g,n).then(async t=>(e?e(t):Gn(`fetch`,{...o,endTimestamp:x()*1e3,response:t}),t),e=>{Gn(`fetch`,{...o,endTimestamp:x()*1e3,error:e}),Be(e)&&e.stack===void 0&&(e.stack=r.stack,Ne(e,`framesToPop`,1));let t=st()?.getOptions().enhanceFetchErrorMessages??`always`;if(t!==!1&&e instanceof TypeError&&(e.message===`Failed to fetch`||e.message===`Load failed`||e.message===`NetworkError when attempting to fetch resource.`))try{let n=new URL(o.fetchData.url).host;t===`always`?e.message=`${e.message} (${n})`:Ne(e,`__sentry_fetch_url_host__`,n)}catch{}throw e})}})}function da(e,t){return!!e&&typeof e==`object`&&!!e[t]}function fa(e){return typeof e==`string`?e:e?da(e,`url`)?e.url:e.toString?e.toString():``:``}function pa(e){if(e.length===0)return{method:`GET`,url:``};if(e.length===2){let[t,n]=e;return{url:fa(t),method:da(n,`method`)?String(n.method).toUpperCase():it(t)&&da(t,`method`)?String(t.method).toUpperCase():`GET`}}let t=e[0];return{url:fa(t),method:da(t,`method`)?String(t.method).toUpperCase():`GET`}}function ma(e){let[t,n]=e;try{if(typeof n==`object`&&n&&`headers`in n&&n.headers)return new Headers(n.headers);if(it(t))return new Headers(t.headers)}catch{}}function j(e,t){let n=_a(e,t),r={type:Sa(t),value:Ca(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function ha(e,t,n,r){let i=st()?.getOptions().normalizeDepth,a=Aa(t),o={__serialized__:fe(t,i)};if(a)return{exception:{values:[j(e,a)]},extra:o};let s={exception:{values:[{type:ke(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:Oa(t,{isUnhandledRejection:r})}]},extra:o};if(n){let t=_a(e,n);t.length&&(s.exception.values[0].stacktrace={frames:t})}return s}function ga(e,t){return{exception:{values:[j(e,t)]}}}function _a(e,t){let n=t.stacktrace||t.stack||``,r=ya(t),i=ba(t);try{return e(n,r,i)}catch{}return[]}var va=/Minified React error #\d+;/i;function ya(e){return e&&va.test(e.message)?1:0}function ba(e){return typeof e.framesToPop==`number`?e.framesToPop:0}function xa(e){return typeof WebAssembly<`u`&&WebAssembly.Exception!==void 0?e instanceof WebAssembly.Exception:!1}function Sa(e){let t=e?.name;return!t&&xa(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:`WebAssembly.Exception`:t}function Ca(e){let t=e?.message;return xa(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:`wasm exception`:t?t.error&&typeof t.error.message==`string`?ii(t.error):ii(e):`No error message`}function wa(e,t,n,r){let i=Ea(e,t,n?.syntheticException||void 0,r);return he(i),i.level=`error`,n?.event_id&&(i.event_id=n.event_id),Ue(i)}function Ta(e,t,n=`info`,r,i){let a=Da(e,t,r?.syntheticException||void 0,i);return a.level=n,r?.event_id&&(a.event_id=r.event_id),Ue(a)}function Ea(e,t,n,r,i){let a;if(je(t)&&t.error)return ga(e,t.error);if(De(t)||We(t)){let i=t;if(`stack`in t)a=ga(e,t);else{let t=i.name||(De(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=Da(e,o,n,r),T(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return Be(t)?ga(e,t):ot(t)||ke(t)?(a=ha(e,t,n,i),he(a,{synthetic:!0}),a):(a=Da(e,t,n,r),T(a,`${t}`,void 0),he(a,{synthetic:!0}),a)}function Da(e,t,n,r){let i={};if(r&&n){let r=_a(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),he(i,{synthetic:!0})}if(et(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Oa(e,{isUnhandledRejection:t}){let n=be(e),r=t?`promise rejection`:`exception`;return je(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:ke(e)?`Event \`${ka(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function ka(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Aa(e){return Object.values(e).find(e=>e instanceof Error)}var ja=class extends Kr{constructor(e){let t=Ma(e);li(t,`browser`,[`browser`],E.SENTRY_SDK_SOURCE||lr()),t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:t.sendDefaultPii?`auto`:`never`,...t._metadata.sdk.settings}),super(t);let{sendDefaultPii:n,sendClientReports:r,enableLogs:i,_experiments:a,enableMetrics:o}=this._options,s=o??a?.enableMetrics??!0;E.document&&(r||i||s)&&E.document.addEventListener(`visibilitychange`,()=>{E.document.visibilityState===`hidden`&&(r&&this._flushOutcomes(),i&&hr(this),s&&br(this))}),n&&this.on(`beforeSendSession`,ci)}eventFromException(e,t){return wa(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return Ta(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n,r)}};function Ma(e){return{release:typeof __SENTRY_RELEASE__==`string`?__SENTRY_RELEASE__:E.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var Na=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Pa=g,Fa=1e3,Ia,La,Ra;function za(e){Un(`dom`,e),Wn(`dom`,Ba)}function Ba(){if(!Pa.document)return;let e=Gn.bind(null,`dom`),t=Ua(e,!0);Pa.document.addEventListener(`click`,t,!1),Pa.document.addEventListener(`keypress`,t,!1),[`EventTarget`,`Node`].forEach(t=>{let n=Pa[t]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(He(n,`addEventListener`,function(t){return function(n,r,i){if(n===`click`||n==`keypress`)try{let r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=r[n]=r[n]||{refCount:0};if(!a.handler){let r=Ua(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),He(n,`removeEventListener`,function(e){return function(t,n,r){if(t===`click`||t==`keypress`)try{let n=this.__sentry_instrumentation_handlers__||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),Object.keys(n).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function Va(e){if(e.type!==La)return!1;try{if(!e.target||e.target._sentryId!==Ra)return!1}catch{}return!0}function Ha(e,t){return e===`keypress`?t?.tagName?!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable):!0:!1}function Ua(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=Wa(n);if(Ha(n.type,r))return;Ne(n,`_sentryCaptured`,!0),r&&!r._sentryId&&Ne(r,`_sentryId`,a());let i=n.type===`keypress`?`input`:n.type;Va(n)||(e({event:n,name:i,global:t}),La=n.type,Ra=r?r._sentryId:void 0),clearTimeout(Ia),Ia=Pa.setTimeout(()=>{Ra=void 0,La=void 0},Fa)}}function Wa(e){try{return e.target}catch{return null}}var Ga;function Ka(e){let t=`history`;Un(t,e),Wn(t,qa)}function qa(){if(Pa.addEventListener(`popstate`,()=>{let e=Pa.location.href,t=Ga;Ga=e,t!==e&&Gn(`history`,{from:t,to:e})}),!aa())return;function e(e){return function(...t){let n=t.length>2?t[2]:void 0;if(n){let r=Ga,i=Ja(String(n));if(Ga=i,r===i)return e.apply(this,t);Gn(`history`,{from:r,to:i})}return e.apply(this,t)}}He(Pa.history,`pushState`,e),He(Pa.history,`replaceState`,e)}function Ja(e){try{return new URL(e,Pa.location.origin).toString()}catch{return e}}var Ya={};function Xa(e){let t=Ya[e];if(t)return t;let n=Pa[e];if(sa(n))return Ya[e]=n.bind(Pa);let r=Pa.document;if(r&&typeof r.createElement==`function`)try{let t=r.createElement(`iframe`);t.hidden=!0,r.head.appendChild(t);let i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Na&&s.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n&&(Ya[e]=n.bind(Pa))}function Za(e){Ya[e]=void 0}var Qa=`__sentry_xhr_v3__`;function $a(e){Un(`xhr`,e),Wn(`xhr`,eo)}function eo(){if(!Pa.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){let r=Error(),i=x()*1e3,a=de(n[0])?n[0].toUpperCase():void 0,o=to(n[1]);if(!a||!o)return e.apply(t,n);t[Qa]={method:a,url:o,request_headers:{}},a===`POST`&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);let s=()=>{let e=t[Qa];if(e&&t.readyState===4){try{e.status_code=t.status}catch{}Gn(`xhr`,{endTimestamp:x()*1e3,startTimestamp:i,xhr:t,virtualError:r})}};return`onreadystatechange`in t&&typeof t.onreadystatechange==`function`?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(e,t,n){return s(),e.apply(t,n)}}):t.addEventListener(`readystatechange`,s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){let[r,i]=n,a=t[Qa];return a&&de(r)&&de(i)&&(a.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){let r=t[Qa];return r?(n[0]!==void 0&&(r.body=n[0]),Gn(`xhr`,{startTimestamp:x()*1e3,xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function to(e){if(de(e))return e;try{return e.toString()}catch{}}var no=40;function ro(e,t=Xa(`fetch`)){let n=0,r=0;async function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`strict-origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let n=await t(e.url,o);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get(`X-Sentry-Rate-Limits`),"retry-after":n.headers.get(`Retry-After`)}}}catch(e){throw Za(`fetch`),e}finally{n-=a,r--}}return jr(e,i,Tr(e.bufferSize||no))}var io=30,ao=50;function oo(e,t,n,r){let i={filename:e,function:t===`<anonymous>`?`?`:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var so=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,co=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lo=/\((\S*)(?::(\d+))(?::(\d+))\)/,uo=/at (.+?) ?\(data:(.+?),/,fo=[io,e=>{let t=e.match(uo);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=so.exec(e);if(n){let[,e,t,r]=n;return oo(e,`?`,+t,+r)}let r=co.exec(e);if(r){if(r[2]?.indexOf(`eval`)===0){let e=lo.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,t]=go(r[1]||`?`,r[2]);return oo(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],po=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,mo=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ho=nt(fo,[ao,e=>{let t=po.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=mo.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||`?`;return[n,e]=go(n,e),oo(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),go=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},_o=1024,M=`Breadcrumbs`,vo=sr(((e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:M,setup(e){t.console&&Ii(P(e)),t.dom&&za(N(e,t.dom)),t.xhr&&$a(F(e)),t.fetch&&la(bo(e)),t.history&&Ka(xo(e)),t.sentry&&e.on(`beforeSendEvent`,yo(e))}}}));function yo(e){return function(t){st()===e&&mt({category:`sentry.${t.type===`transaction`?`transaction`:`event`}`,event_id:t.event_id,level:t.level,message:ue(t)},{event:t})}}function N(e,t){return function(n){if(st()!==e)return;let r,i,a=typeof t==`object`?t.serializeAttribute:void 0,o=typeof t==`object`&&typeof t.maxStringLength==`number`?t.maxStringLength:void 0;o&&o>_o&&(dt&&s.warn(`\`dom.maxStringLength\` cannot exceed ${_o}, but a value of ${o} was configured. Sentry will use ${_o} instead.`),o=_o),typeof a==`string`&&(a=[a]);try{let e=n.event,t=So(e)?e.target:e;r=we(t,{keyAttrs:a,maxStringLength:o}),i=ze(t)}catch{r=`<unknown>`}if(r.length===0)return;let c={category:`ui.${n.name}`,message:r};i&&(c.data={"ui.component_name":i}),mt(c,{event:n.event,name:n.name,global:n.global})}}function P(e){return function(t){if(st()!==e)return;let n={category:`console`,data:{arguments:t.args,logger:`console`},level:Ri(t.level),message:Te(t.args,` `)};if(t.level===`assert`)if(t.args[0]===!1)n.message=`Assertion failed: ${Te(t.args.slice(1),` `)||`console.assert`}`,n.data.arguments=t.args.slice(1);else return;mt(n,{input:t.args,level:t.level})}}function F(e){return function(t){if(st()!==e)return;let{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Qa];if(!n||!r||!i)return;let{method:a,url:o,status_code:s,body:c}=i,l={method:a,url:o,status_code:s},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:`xhr`,data:l,type:`http`,level:ra(s)};e.emit(`beforeOutgoingRequestBreadcrumb`,d,u),mt(d,u)}}function bo(e){return function(t){if(st()!==e)return;let{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method===`POST`))if(t.error){let i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:`fetch`,data:t.fetchData,level:`error`,type:`http`};e.emit(`beforeOutgoingRequestBreadcrumb`,a,i),mt(a,i)}else{let i=t.response,a={...t.fetchData,status_code:i?.status},o={input:t.args,response:i,startTimestamp:n,endTimestamp:r},s={category:`fetch`,data:a,type:`http`,level:ra(a.status_code)};e.emit(`beforeOutgoingRequestBreadcrumb`,s,o),mt(s,o)}}}function xo(e){return function(t){if(st()!==e)return;let n=t.from,r=t.to,i=Qn(E.location.href),a=n?Qn(n):void 0,o=Qn(r);a?.path||(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),mt({category:`navigation`,data:{from:n,to:r}})}}function So(e){return!!e&&!!e.target}var Co=`EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload`.split(`,`),wo=`BrowserApiErrors`,To=sr(((e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:wo,setupOnce(){t.setTimeout&&He(E,`setTimeout`,Eo),t.setInterval&&He(E,`setInterval`,Eo),t.requestAnimationFrame&&He(E,`requestAnimationFrame`,I),t.XMLHttpRequest&&`XMLHttpRequest`in E&&He(XMLHttpRequest.prototype,`send`,Do);let e=t.eventTarget;e&&(Array.isArray(e)?e:Co).forEach(e=>Oo(e,t))}}}));function Eo(e){return function(...t){let n=t[0];return t[0]=pt(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${m(e)}`}}),e.apply(this,t)}}function I(e){return function(t){return e.apply(this,[pt(t,{mechanism:{data:{handler:m(e)},handled:!1,type:`auto.browser.browserapierrors.requestAnimationFrame`}})])}}function Do(e){return function(...t){let n=this;return[`onload`,`onerror`,`onprogress`,`onreadystatechange`].forEach(e=>{e in n&&typeof n[e]==`function`&&He(n,e,function(t){let n={mechanism:{data:{handler:m(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Je(t);return r&&(n.mechanism.data.handler=m(r)),pt(t,n)})}),e.apply(this,t)}}function Oo(e,t){let n=E[e]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(He(n,`addEventListener`,function(n){return function(r,i,a){try{ko(i)&&(i.handleEvent=pt(i.handleEvent,{mechanism:{data:{handler:m(i),target:e},handled:!1,type:`auto.browser.browserapierrors.handleEvent`}}))}catch{}return t.unregisterOriginalCallbacks&&Ao(this,r,i),n.apply(this,[r,pt(i,{mechanism:{data:{handler:m(i),target:e},handled:!1,type:`auto.browser.browserapierrors.addEventListener`}}),a])}}),He(n,`removeEventListener`,function(e){return function(t,n,r){try{let i=n.__sentry_wrapped__;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}function ko(e){return typeof e.handleEvent==`function`}function Ao(e,t,n){e&&typeof e==`object`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`&&e.removeEventListener(t,n)}var jo=sr((e={})=>{let t=e.lifecycle??`route`;return{name:`BrowserSession`,setupOnce(){if(E.document===void 0){dt&&s.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ze({ignoreDuration:!0}),qe();let e=v(),n=e.getUser();e.addScopeListener(e=>{let t=e.getUser();(n?.id!==t?.id||n?.ip_address!==t?.ip_address)&&(qe(),n=t)}),t===`route`&&Ka(({from:e,to:t})=>{e!==t&&(Ze({ignoreDuration:!0}),qe())})}}}),Mo=`CultureContext`,No=sr((()=>({name:Mo,preprocessEvent(e){let t=Po();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){let t=Po();t&&er(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})));function Po(){try{let e=E.Intl;if(!e)return;let t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}var Fo=`GlobalHandlers`,L=sr(((e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:Fo,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(Io(e),Vo(`onerror`)),t.onunhandledrejection&&(Lo(e),Vo(`onunhandledrejection`))}}}));function Io(e){qn(t=>{let{stackParser:n,attachStacktrace:r}=Ho();if(st()!==e||ut())return;let{msg:i,url:a,line:o,column:s,error:c}=t,l=Bo(Ea(n,c||i,void 0,r,!1),a,o,s);l.level=`error`,Me(l,{originalException:c,mechanism:{handled:!1,type:`auto.browser.global_handlers.onerror`}})})}function Lo(e){Xn(t=>{let{stackParser:n,attachStacktrace:r}=Ho();if(st()!==e||ut())return;let i=Ro(t),a=Se(i)?zo(i):Ea(n,i,void 0,r,!0);a.level=`error`,Me(a,{originalException:i,mechanism:{handled:!1,type:`auto.browser.global_handlers.onunhandledrejection`}})})}function Ro(e){if(Se(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 zo(e){return{exception:{values:[{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function Bo(e,t,n,r){let i=e.exception=e.exception||{},a=i.values=i.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},c=s.frames=s.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:Uo(t)??Qe(),function:`?`,in_app:!0}),e}function Vo(e){dt&&s.log(`Global Handler attached: ${e}`)}function Ho(){return st()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function Uo(e){if(!(!de(e)||e.length===0))return e.startsWith(`data:`)?`<${$n(e,!1)}>`:e}var Wo=sr(()=>({name:`HttpContext`,preprocessEvent(e){if(!E.navigator&&!E.location&&!E.document)return;let t=ct(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){if(!E.navigator&&!E.location&&!E.document)return;let t=ct();er(e,{"url.full":t.url||void 0,"http.request.header.user_agent":t.headers[`User-Agent`],"http.request.header.referer":t.headers.Referer})}})),Go=`cause`,Ko=5,qo=`LinkedErrors`,Jo=sr(((e={})=>{let t=e.limit||Ko,n=e.key||Go;return{name:qo,preprocessEvent(e,r,i){Di(j,i.getOptions().stackParser,n,t,e,r)}}}));function Yo(){return Xo()?(dt&&Le(()=>{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 Xo(){if(E.window===void 0)return!1;let e=E;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let t=Qe();return!(E===E.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(t))}function Zo(e){return[_i(),pi(),na(),To(),vo(),L(),Jo(),Bi(),Wo(),No(),jo()]}function Qo(e={}){let t=!e.skipBrowserExtensionCheck&&Yo(),n=e.defaultIntegrations==null?Zo():e.defaultIntegrations;return oi(ja,{...e,enabled:t?!1:e.enabled,stackParser:f(e.stackParser||ho),integrations:rr({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||ro})}var $o=e(ht());function es(e){let t={...e};return li(t,`react`),Re(`react`,{version:$o.version}),Qo(t)}var ts=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ns=t(((e,t)=>{t.exports=ts()})),rs=t((e=>{var t=ns(),n=ht(),r=gt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.iterator;function se(e){return typeof e!=`object`||!e?null:(e=oe&&e[oe]||e[`@@iterator`],typeof e==`function`?e:null)}var ce=Symbol.for(`react.client.reference`);function le(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case ee:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,S=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function w(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function T(e,t){pe++,fe[pe]=e.current,e.current=t}var he=me(null),ge=me(null),_e=me(null),ve=me(null);function ye(e,t){switch(T(_e,t),T(ge,e),T(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(he),T(he,e)}function be(){w(he),w(ge),w(_e)}function xe(e){e.memoizedState!==null&&T(ve,e);var t=he.current,n=Hd(t,e.type);t!==n&&(T(ge,e),T(he,n))}function Se(e){ge.current===e&&(w(he),w(ge)),ve.current===e&&(w(ve),Qf._currentValue=de)}var Ce,we;function Te(e){if(Ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ce=t&&t[1]||``,we=-1<e.stack.indexOf(`
2
+ import{o as e,t}from"./chunk-jRWAZmH_.js";import{i as n,r,s as i}from"./device-settings-DXp9L4iB.js";import{$ as a,A as o,At as s,B as c,C as l,Ct as u,D as d,Dt as f,E as p,Et as m,F as h,Ft as g,G as _,H as v,I as y,It as b,J as x,K as ee,L as te,M as ne,Mt as re,N as ie,Nt as ae,O as oe,Ot as se,P as ce,Pt as le,Q as ue,R as S,S as C,St as de,T as fe,Tt as pe,U as me,V as w,X as T,Y as he,Z as ge,_ as _e,_t as ve,a as ye,at as be,b as xe,bt as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as Ne,j as Pe,jt as Fe,k as Ie,kt as Le,l as Re,lt as ze,mt as Be,nt as Ve,ot as He,p as Ue,pt as We,q as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,v as $e,vt as et,w as tt,wt as nt,x as rt,xt as it,y as at,yt as ot,z as st}from"./capture-error-Bj8_eutd.js";import{c as ct,d as lt,l as ut,o as dt,r as ft,s as E,u as pt}from"./document-viewer-container-C9xsTewm.js";import{o as mt}from"./stream-watchdog-BafbDdX9.js";import{t as ht}from"./react-BFJW0bSv.js";import{F as gt,r as _t}from"./button-Dy5001j6.js";import{t as vt}from"./preload-helper-Cv2QeVDK.js";import{i as yt}from"./chunk-5KNZJZUH-Bsoom5--.js";import{A as bt,C as xt,D as St,N as Ct,S as wt,_ as Tt,b as Et,c as Dt,g as Ot,h as kt,s as D,t as At,u as jt,x as Mt}from"./QueryClientProvider-CMu7CkQU.js";import{f as Nt}from"./useQuery-Bz-fbQ-m.js";import{n as Pt}from"./useInfiniteQuery-Dk8q0n49.js";import{n as Ft}from"./useMutation-CXGTrp4W.js";import{t as It}from"./jsx-runtime-D3ZM-ToX.js";import{a as Lt,i as Rt,r as zt,t as Bt}from"./routes-DZue-W2n.js";import{t as Vt}from"./src-D89CNeuT.js";import{t as Ht}from"./toast-LgLp4obE.js";import{$ as Ut,et as Wt,f as Gt,g as Kt,h as qt,m as Jt,rt as Yt,st as Xt}from"./local-mode-Ckii2tmN.js";import{t as Zt}from"./is-electron-m5eeGBnd.js";import{n as Qt}from"./resolved-assistants-store-C-PdxK8f.js";import{Ur as $t}from"./sdk.gen-BVAVE6A_.js";import{i as en,t as tn}from"./api-errors-CFiCT7Ap.js";import{D as nn,E as rn,H as an,M as on,P as sn,T as cn,V as ln,_ as un,a as dn,d as fn,j as pn,m as mn,n as hn,t as gn,w as _n}from"./auth-store-D0-gDCVn.js";import{t as vn}from"./client.gen-CV05d-kw.js";import{c as yn}from"./api-XwdNiVE9.js";import{D as bn,b as xn,u as Sn,x as Cn,y as wn}from"./native-biometric-CntdlaL-.js";import{i as Tn,t as En}from"./dist-BwAT3VYQ.js";import{u as Dn}from"./routes-vE-2hncW.js";import{t as On}from"./onboarding-store-DutUn1E3.js";import{r as kn}from"./prefs-BZnS5vR_.js";import{n as An}from"./platform-detection-CMiRPRCq.js";import{n as jn}from"./client-identity-BS5mQsaQ.js";import{t as Mn}from"./hard-navigate-DZlpL1No.js";import{C as Nn}from"./sdk.gen-DPKrJeho.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Pn(e,t,n){if(!(typeof window>`u`))try{localStorage.getItem(e)===t&&localStorage.setItem(e,n)}catch{}}function Fn(e){if(!(typeof window>`u`))try{localStorage.removeItem(e)}catch{}}function O(e,t){if(!(typeof window>`u`))try{let n=localStorage.getItem(e);if(n===null)return;localStorage.getItem(t)===null&&localStorage.setItem(t,n),localStorage.getItem(t)!==null&&localStorage.removeItem(e)}catch{}}function In(e,t){if(!(typeof window>`u`))try{let n=[];for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i&&i.startsWith(e)){let r=i.slice(e.length);n.push([i,t+r])}}for(let[e,t]of n)O(e,t)}catch{}}function Ln(e){let t=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);r&&r.startsWith(e)&&t.push(r)}for(let e of t)localStorage.removeItem(e)}function Rn(){if(typeof window>`u`)return;let e=`vellum:selectedAssistantId`,t=`vellum:local:selectedAssistantId`,n=`vellum:currentAssistantId:`;try{if(localStorage.getItem(e)===null){let r=localStorage.getItem(t);if(r===null&&(r=zn(n)),r===null){let e=null;for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(n)&&(e===null||r<e)&&(e=r)}e!==null&&(r=localStorage.getItem(e))}r&&localStorage.setItem(e,r)}localStorage.removeItem(t),Ln(n)}catch{}}function zn(e){let t=null;try{t=sessionStorage.getItem(`vellum_active_organization_id`)}catch{return null}return t?localStorage.getItem(`${e}${t}`):null}function Bn(){if(!(typeof window>`u`)){if(O(`assistantSidebarCollapsed`,`vellum:sidebar:collapsed`),O(`assistantSidebarWidth`,`vellum:sidebar:width`),O(`voice:permissionPrimerSeen`,`vellum:voice:permissionPrimerSeen`),O(`voice:ttsProvider`,`vellum:voice:ttsProvider`),O(`voice:sttProvider`,`vellum:voice:sttProvider`),O(`voice:activationKey`,`vellum:voice:activationKey`),O(`integrations.bannerDismissed`,`vellum:integrations:bannerDismissed`),O(`onboarding.tosAccepted`,`vellum:onboarding:tosAccepted`),O(`onboarding.aiDataConsent`,`vellum:onboarding:aiDataConsent`),Fn(`onboarding.completed`),Fn(`vellum:onboarding:completed`),O(`onboarding.selectedVersion`,`vellum:onboarding:selectedVersion`),O(`vellum:skillsTabTipDismissed`,`vellum:skills:tipDismissed`),O(`vellum_image_gen_mode`,`vellum:ai:imageGenMode`),O(`vellum_image_gen_model`,`vellum:ai:imageGenModel`),localStorage.getItem(`vellum:ai:imageGenProvider`)===null){let e=localStorage.getItem(`vellum:ai:imageGenMode`);e===`managed`?localStorage.setItem(`vellum:ai:imageGenProvider`,`vellum`):e===`your-own`&&localStorage.setItem(`vellum:ai:imageGenProvider`,`gemini`)}O(`vellum_web_search_mode`,`vellum:ai:webSearchMode`),O(`vellum_web_search_provider`,`vellum:ai:webSearchProvider`),O(`vellum_email_mode`,`vellum:ai:emailMode`),O(`vellum_email_byo_provider`,`vellum:ai:emailByoProvider`),O(`vellum_gemini_key`,`vellum:ai:geminiKey`),O(`vellum_perplexity_key`,`vellum:ai:perplexityKey`),O(`vellum_brave_key`,`vellum:ai:braveKey`),O(`vellum_tavily_key`,`vellum:ai:tavilyKey`),O(`vellumDebug.flags.impersonateAssistantVersion`,`vellum:debug:impersonateAssistantVersion`),O(`gw:token`,`vellum:gw:token`),O(`gw:expiresAt`,`vellum:gw:expiresAt`),O(`gw:tokenSource`,`vellum:gw:tokenSource`),O(`local:lockfile`,`vellum:local:lockfile`),O(`local:selectedAssistantId`,`vellum:local:selectedAssistantId`),In(`voice:ttsApiKey:`,`vellum:voice:ttsApiKey:`),In(`voice:ttsVoiceId:`,`vellum:voice:ttsVoiceId:`),In(`voice:sttApiKey:`,`vellum:voice:sttApiKey:`),In(`ff:client:`,`vellum:ff:`),In(`disk-pressure-warning-dismissed-`,`vellum:diskPressureDismissed:`),In(`vellum_current_assistant_id__`,`vellum:currentAssistantId:`),Rn(),Pn(`vellum:skills:tipDismissed`,`1`,`true`),Fn(`app.githubNudge.starred`),Fn(`app.githubNudge.bannerDismissed`),Fn(`app.githubNudge.bannerDismissedAt`),Fn(`app.discordNudge.joined`),Fn(`app.discordNudge.bannerDismissed`),Fn(`app.discordNudge.firstSeenAt`),Fn(`app.nudgeLegacy.cleaned`)}}n(),Bn();var Vn={},Hn={};function Un(e,t){return Vn[e]=Vn[e]||[],Vn[e].push(t),()=>{let n=Vn[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function Wn(e,t){if(!Hn[e]){Hn[e]=!0;try{t()}catch(t){b&&s.error(`Error while instrumenting ${e}`,t)}}}function Gn(e,t){let n=e&&Vn[e];if(n)for(let r of n)try{r(t)}catch(t){b&&s.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${m(r)}\nError:`,t)}}var Kn=null;function qn(e){let t=`error`;Un(t,e),Wn(t,Jn)}function Jn(){Kn=g.onerror,g.onerror=function(e,t,n,r,i){return Gn(`error`,{column:r,error:i,line:n,msg:e,url:t}),Kn?Kn.apply(this,arguments):!1},g.onerror.__SENTRY_INSTRUMENTED__=!0}var Yn=null;function Xn(e){let t=`unhandledrejection`;Un(t,e),Wn(t,Zn)}function Zn(){Yn=g.onunhandledrejection,g.onunhandledrejection=function(e){return Gn(`unhandledrejection`,e),Yn?Yn.apply(this,arguments):!0},g.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Qn(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let 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 $n(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function er(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}var tr=[];function nr(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function rr(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return nr(r)}function ir(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&or(e,t,n)}),n}function ar(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function or(e,t,n){if(n[t.name]){b&&s.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!tr.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),tr.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),b&&s.log(`Integration installed: ${t.name}`)}function sr(e){return e}function cr(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function lr(){return`npm`}function ur(){return!cr()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function dr(){return typeof window<`u`&&(!ur()||fr())}function fr(){return g.process?.type===`renderer`}function pr(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...dr()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function mr(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=ce(r)),at(a,[pr(e,i)])}function hr(e,t){let n=t??gr(e)??[];if(n.length===0)return;let r=e.getOptions(),i=mr(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);_r().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function gr(e){return _r().get(e)}function _r(){return re(`clientToLogBufferMap`,()=>new WeakMap)}function vr(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...dr()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function yr(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=ce(r)),at(a,[vr(e,i)])}function br(e,t){let n=t??xr(e)??[];if(n.length===0)return;let r=e.getOptions(),i=yr(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);Sr().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function xr(e){return Sr().get(e)}function Sr(){return re(`clientToMetricBufferMap`,()=>new WeakMap)}function Cr(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}var wr=Symbol.for(`SentryBufferFullError`);function Tr(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Ee(wr);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Ue(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Cr(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var Er=60*1e3;function Dr(e,t=Ve()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?Er:r-t}function Or(e,t){return e[t]||e.all||0}function kr(e,t,n=Ve()){return Or(e,t)>n}function Ar(e,{statusCode:t,headers:n},r=Ve()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Dr(o,r):t===429&&(i.all=r+60*1e3);return i}function jr(e,t,n=Tr(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(C(i,(t,n)=>{let i=rt(n);kr(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=at(i[0],a),c=t=>{if(xe(o,[`client_report`])){b&&s.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}C(o,(n,r)=>{e.recordDroppedEvent(t,rt(r))})};return n.add(()=>t({body:l(o)}).then(e=>e.statusCode===413?(b&&s.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),c(`send_error`),e):(b&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&s.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Ar(r,e),e),e=>{throw c(`network_error`),b&&s.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===wr)return b&&s.error(`Skipped sending event because buffer is full.`),c(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Mr(e,t,n){let r=[{type:`client_report`},{timestamp:n||Ge(),discarded_events:e}];return at(t?{dsn:t}:{},[r])}function Nr(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Pr(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[S],exclusive_time:o?.[te],measurements:e.measurements,is_segment:!0}}function Fr(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&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var Ir=`Not capturing exception because it's already been captured.`,Lr=`Discarded session because of missing or non-string release`,Rr=Symbol.for(`SentryInternalError`),zr=Symbol.for(`SentryDoNotSendEventError`),Br=5e3;function Vr(e){return{message:e,[Rr]:!0}}function Hr(e){return{message:e,[zr]:!0}}function Ur(e){return!!e&&typeof e==`object`&&Rr in e}function Wr(e){return!!e&&typeof e==`object`&&zr in e}function Gr(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Cr(setTimeout(()=>{i(e)},Br)))}),e.on(`flush`,()=>{i(e)})}var Kr=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Tr(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=h(e.dsn):b&&s.warn(`No DSN provided, client will not send events.`),this._dsn){let t=lt(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&Gr(this,`afterCaptureLog`,`flushLogs`,$r,hr),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Gr(this,`afterCaptureMetric`,`flushMetrics`,Qr,br)}captureException(e,t,n){let r=a();if(ge(e))return b&&s.log(Ir),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:a(),...n},o=et(e)?e:String(e),s=Se(e),c=s?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this._process(()=>c.then(e=>this._captureEvent(e,i,r)),s?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=a();if(t?.originalException&&ge(t.originalException))return b&&s.log(Ir),r;let i={event_id:r,...t},o=e.sdkProcessingMetadata||{},c=o.capturedSpanScope,l=o.capturedSpanIsolationScope,u=qr(e.type);return this._process(()=>this._captureEvent(e,i,c||n,l),u),i.event_id}captureSession(e){this.sendSession(e),ee(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){hr(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),or(this,e,this._integrations),t||ar(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Ae(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=_e(n,$e(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=oe}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){b&&s.warn(Lr);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){b&&s.warn(Lr);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Oe(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;b&&s.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return b&&s.error(`Error while sending envelope:`,e),{}}return b&&s.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=ir(this,e),ar(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(ee(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ce(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...me(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:d(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=c(),r=v()){return b&&Xr(e)&&s.log(`Captured error event \`${Nr(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{b&&(Wr(e)?s.log(e.message):Ur(e)?s.warn(e.message):s.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Zr(e),s=Xr(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ie(a);if(s&&typeof l==`number`&&Ke()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Ee(Hr(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=qr(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Hr("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Jr(Yr(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Hr(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Wr(e)||Ur(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Vr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===wr&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){b&&s.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){b&&s.log(`No outcomes to send`);return}if(!this._dsn){b&&s.log(`No dsn provided, will not send outcomes`);return}b&&s.log(`Sending outcomes:`,e);let t=Mr(e,this._options.tunnel&&ce(this._dsn));this.sendEnvelope(t)}};function qr(e){return e===`replay_event`?`replay`:e||`error`}function Jr(e,t){let n=`${t} must return \`null\` or a valid event.`;if(u(e))return e.then(e=>{if(!ot(e)&&e!==null)throw Vr(n);return e},e=>{throw Vr(`${t} rejected with ${e}`)});if(!ot(e)&&e!==null)throw Vr(n);return e}function Yr(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:s}=t,c=!p(t.beforeSendSpan)&&t.beforeSendSpan,l=n;if(Xr(l)&&i)return i(l,r);if(Zr(l)){if(c||s){let t=Pr(l);if(s?.length&&o({description:t.description,op:t.op,attributes:t.data},s))return null;if(c){let e=c(t);e?l=_(n,Fr(e)):Pe()}if(l.spans){let t=[],n=l.spans;for(let e of n){if(s?.length&&o({description:e.description,op:e.op,attributes:e.data},s)){Ie(n,e);continue}if(c){let n=c(e);n?t.push(n):(Pe(),t.push(e))}else t.push(e)}let r=l.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),l.spans=t}}if(a){if(l.spans){let e=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(l,r)}}return l}function Xr(e){return e.type===void 0}function Zr(e){return e.type===`transaction`}function Qr(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+ei(e.attributes)}function $r(e){let t=0;return e.message&&(t+=e.message.length*2),t+ei(e.attributes)}function ei(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*ti(e[0]):Se(e)?t+=ti(e):t+=100}),t}function ti(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function ni(e,t){return e(t.stack||``,1)}function ri(e){return Be(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function ii(e){return ri(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function ai(e,t){let n={type:t.name||t.constructor.name,value:ii(t)},r=ni(e,t);return r.length&&(n.stacktrace={frames:r}),n}function oi(e,t){t.debug===!0&&(b?s.enable():Le(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),c().update(t.initialScope);let n=new e(t);return si(n),n.init(),n}function si(e){c().setClient(e)}function ci(e){`aggregates`in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:`{{auto}}`}):e.ipAddress===void 0&&(e.ipAddress=`{{auto}}`)}function li(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:le})),i.version=le)}var ui,di=`FunctionToString`,fi=new WeakMap,pi=sr((()=>({name:di,setupOnce(){ui=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Je(this),n=fi.has(st())&&t!==void 0?t:this;return ui.apply(n,e)}}catch{}},setup(e){fi.set(e,!0)}}))),mi=[/^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$/],hi=`EventFilters`,gi=sr((e={})=>{let t;return{name:hi,setup(n){t=vi(e,n.getOptions())},processEvent(n,r,i){return t||=vi(e,i.getOptions()),yi(n,t)?null:n}}}),_i=sr(((e={})=>({...gi(e),name:`InboundFilters`})));function vi(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:mi],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function yi(e,t){if(!e.type){if(bi(e,t.ignoreErrors))return b&&s.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${ue(e)}`),!0;if(Ei(e))return b&&s.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${ue(e)}`),!0;if(Si(e,t.denyUrls))return b&&s.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${ue(e)}.\nUrl: ${Ti(e)}`),!0;if(!Ci(e,t.allowUrls))return b&&s.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${ue(e)}.\nUrl: ${Ti(e)}`),!0}else if(e.type===`transaction`&&xi(e,t.ignoreTransactions))return b&&s.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${ue(e)}`),!0;return!1}function bi(e,t){return t?.length?Nr(e).some(e=>Xe(e,t)):!1}function xi(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Xe(n,t):!1}function Si(e,t){if(!t?.length)return!1;let n=Ti(e);return n?Xe(n,t):!1}function Ci(e,t){if(!t?.length)return!0;let n=Ti(e);return n?Xe(n,t):!0}function wi(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Ti(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?wi(t):null}catch{return b&&s.error(`Cannot extract url for event ${ue(e)}`),null}}function Ei(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Di(e,t,n,r,i,a){if(!i.exception?.values||!a||!ve(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Oi(e,t,r,a.originalException,n,i.exception.values,o,0))}function Oi(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(ve(r[i],Error)){Ai(o,s,r);let a=e(t,r[i]),l=c.length;ji(a,i,l,s),c=Oi(e,t,n,r[i],i,[a,...c],a,l)}return ki(r)&&r.errors.forEach((a,l)=>{if(ve(a,Error)){Ai(o,s,r);let u=e(t,a),d=c.length;ji(u,`errors[${l}]`,d,s),c=Oi(e,t,n,a,i,[u,...c],u,d)}}),c}function ki(e){return Array.isArray(e.errors)}function Ai(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...ki(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function ji(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}var Mi=`cause`,Ni=5,Pi=`LinkedErrors`,Fi=sr(((e={})=>{let t=e.limit||Ni,n=e.key||Mi;return{name:Pi,preprocessEvent(e,r,i){Di(ai,i.getOptions().stackParser,n,t,e,r)}}}));function Ii(e){let t=`console`,n=Un(t,e);return Wn(t,Li),n}function Li(){`console`in g&&se.forEach(function(e){e in g.console&&He(g.console,e,function(t){return Fe[e]=t,function(...t){Gn(`console`,{args:t,level:e}),Fe[e]?.apply(g.console,t)}})})}function Ri(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var zi=`Dedupe`,Bi=sr((()=>{let e;return{name:zi,processEvent(t){if(t.type)return t;try{if(Vi(t,e))return b&&s.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Vi(e,t){return t?!!(Hi(e,t)||k(e,t)):!1}function Hi(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Ui(e,t)||!A(e,t))}function k(e,t){let n=Wi(t),r=Wi(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Ui(e,t)||!A(e,t))}function A(e,t){let n=pe(e),r=pe(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Ui(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 Wi(e){return e.exception?.values?.[0]}function Gi(e,t){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r===`.`?e.splice(t,1):r===`..`?(e.splice(t,1),n++):n&&(e.splice(t,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}var Ki=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function qi(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Ki.exec(t);return n?n.slice(1):[]}function Ji(...e){let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:`/`;i&&(t=`${i}/${t}`,n=i.charAt(0)===`/`)}return t=Gi(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function Yi(e){let t=0;for(;t<e.length&&e[t]===``;t++);let n=e.length-1;for(;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}function Xi(e,t){e=Ji(e).slice(1),t=Ji(t).slice(1);let n=Yi(e.split(`/`)),r=Yi(t.split(`/`)),i=Math.min(n.length,r.length),a=i;for(let e=0;e<i;e++)if(n[e]!==r[e]){a=e;break}let o=[];for(let e=a;e<n.length;e++)o.push(`..`);return o=o.concat(r.slice(a)),o.join(`/`)}function Zi(e,t){let n=qi(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var Qi=`RewriteFrames`,$i=sr((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in g&&!!g.window,i=e.iteratee||ea({isBrowser:r,root:t,prefix:n});function a(e){try{return{...e,exception:{...e.exception,values:e.exception.values.map(e=>({...e,...e.stacktrace&&{stacktrace:o(e.stacktrace)}}))}}}catch{return e}}function o(e){return{...e,frames:e?.frames?.map(e=>i(e))}}return{name:Qi,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function ea({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes(`\\`)&&!r.filename.includes(`/`),a=/^\//.test(r.filename);if(e){if(t){let e=r.filename;e.indexOf(t)===0&&(r.filename=e.replace(t,n))}}else if(i||a){let e=i?r.filename.replace(/^[a-zA-Z]:/,``).replace(/\\/g,`/`):r.filename;r.filename=`${n}${t?Xi(t,e):Zi(e)}`}return r}}var ta=`ConversationId`,na=sr((()=>({name:ta,setup(e){e.on(`spanStart`,e=>{let t=c().getScopeData(),n=v().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=ne(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(y,r)}})}})));function ra(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}var ia=g;function aa(){return`history`in ia&&!!ia.history}function oa(){if(!(`fetch`in ia))return!1;try{return new Headers,new Request(`data:,`),new Response,!0}catch{return!1}}function sa(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function ca(){if(typeof EdgeRuntime==`string`)return!0;if(!oa())return!1;if(sa(ia.fetch))return!0;let e=!1,t=ia.document;if(t&&typeof t.createElement==`function`)try{let n=t.createElement(`iframe`);n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=sa(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){b&&s.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return e}function la(e,t){let n=`fetch`,r=Un(n,e);return Wn(n,()=>ua(void 0,t)),r}function ua(e,t=!1){t&&!ca()||He(g,`fetch`,function(t){return function(...n){let r=Error(),{method:i,url:a}=pa(n),o={args:n,fetchData:{method:i,url:a},startTimestamp:x()*1e3,virtualError:r,headers:ma(n)};return e||Gn(`fetch`,{...o}),t.apply(g,n).then(async t=>(e?e(t):Gn(`fetch`,{...o,endTimestamp:x()*1e3,response:t}),t),e=>{Gn(`fetch`,{...o,endTimestamp:x()*1e3,error:e}),Be(e)&&e.stack===void 0&&(e.stack=r.stack,Ne(e,`framesToPop`,1));let t=st()?.getOptions().enhanceFetchErrorMessages??`always`;if(t!==!1&&e instanceof TypeError&&(e.message===`Failed to fetch`||e.message===`Load failed`||e.message===`NetworkError when attempting to fetch resource.`))try{let n=new URL(o.fetchData.url).host;t===`always`?e.message=`${e.message} (${n})`:Ne(e,`__sentry_fetch_url_host__`,n)}catch{}throw e})}})}function da(e,t){return!!e&&typeof e==`object`&&!!e[t]}function fa(e){return typeof e==`string`?e:e?da(e,`url`)?e.url:e.toString?e.toString():``:``}function pa(e){if(e.length===0)return{method:`GET`,url:``};if(e.length===2){let[t,n]=e;return{url:fa(t),method:da(n,`method`)?String(n.method).toUpperCase():it(t)&&da(t,`method`)?String(t.method).toUpperCase():`GET`}}let t=e[0];return{url:fa(t),method:da(t,`method`)?String(t.method).toUpperCase():`GET`}}function ma(e){let[t,n]=e;try{if(typeof n==`object`&&n&&`headers`in n&&n.headers)return new Headers(n.headers);if(it(t))return new Headers(t.headers)}catch{}}function j(e,t){let n=_a(e,t),r={type:Sa(t),value:Ca(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function ha(e,t,n,r){let i=st()?.getOptions().normalizeDepth,a=Aa(t),o={__serialized__:fe(t,i)};if(a)return{exception:{values:[j(e,a)]},extra:o};let s={exception:{values:[{type:ke(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:Oa(t,{isUnhandledRejection:r})}]},extra:o};if(n){let t=_a(e,n);t.length&&(s.exception.values[0].stacktrace={frames:t})}return s}function ga(e,t){return{exception:{values:[j(e,t)]}}}function _a(e,t){let n=t.stacktrace||t.stack||``,r=ya(t),i=ba(t);try{return e(n,r,i)}catch{}return[]}var va=/Minified React error #\d+;/i;function ya(e){return e&&va.test(e.message)?1:0}function ba(e){return typeof e.framesToPop==`number`?e.framesToPop:0}function xa(e){return typeof WebAssembly<`u`&&WebAssembly.Exception!==void 0?e instanceof WebAssembly.Exception:!1}function Sa(e){let t=e?.name;return!t&&xa(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:`WebAssembly.Exception`:t}function Ca(e){let t=e?.message;return xa(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:`wasm exception`:t?t.error&&typeof t.error.message==`string`?ii(t.error):ii(e):`No error message`}function wa(e,t,n,r){let i=Ea(e,t,n?.syntheticException||void 0,r);return he(i),i.level=`error`,n?.event_id&&(i.event_id=n.event_id),Ue(i)}function Ta(e,t,n=`info`,r,i){let a=Da(e,t,r?.syntheticException||void 0,i);return a.level=n,r?.event_id&&(a.event_id=r.event_id),Ue(a)}function Ea(e,t,n,r,i){let a;if(je(t)&&t.error)return ga(e,t.error);if(De(t)||We(t)){let i=t;if(`stack`in t)a=ga(e,t);else{let t=i.name||(De(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=Da(e,o,n,r),T(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return Be(t)?ga(e,t):ot(t)||ke(t)?(a=ha(e,t,n,i),he(a,{synthetic:!0}),a):(a=Da(e,t,n,r),T(a,`${t}`,void 0),he(a,{synthetic:!0}),a)}function Da(e,t,n,r){let i={};if(r&&n){let r=_a(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),he(i,{synthetic:!0})}if(et(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Oa(e,{isUnhandledRejection:t}){let n=be(e),r=t?`promise rejection`:`exception`;return je(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:ke(e)?`Event \`${ka(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function ka(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Aa(e){return Object.values(e).find(e=>e instanceof Error)}var ja=class extends Kr{constructor(e){let t=Ma(e);li(t,`browser`,[`browser`],E.SENTRY_SDK_SOURCE||lr()),t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:t.sendDefaultPii?`auto`:`never`,...t._metadata.sdk.settings}),super(t);let{sendDefaultPii:n,sendClientReports:r,enableLogs:i,_experiments:a,enableMetrics:o}=this._options,s=o??a?.enableMetrics??!0;E.document&&(r||i||s)&&E.document.addEventListener(`visibilitychange`,()=>{E.document.visibilityState===`hidden`&&(r&&this._flushOutcomes(),i&&hr(this),s&&br(this))}),n&&this.on(`beforeSendSession`,ci)}eventFromException(e,t){return wa(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return Ta(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n,r)}};function Ma(e){return{release:typeof __SENTRY_RELEASE__==`string`?__SENTRY_RELEASE__:E.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var Na=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Pa=g,Fa=1e3,Ia,La,Ra;function za(e){Un(`dom`,e),Wn(`dom`,Ba)}function Ba(){if(!Pa.document)return;let e=Gn.bind(null,`dom`),t=Ua(e,!0);Pa.document.addEventListener(`click`,t,!1),Pa.document.addEventListener(`keypress`,t,!1),[`EventTarget`,`Node`].forEach(t=>{let n=Pa[t]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(He(n,`addEventListener`,function(t){return function(n,r,i){if(n===`click`||n==`keypress`)try{let r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=r[n]=r[n]||{refCount:0};if(!a.handler){let r=Ua(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),He(n,`removeEventListener`,function(e){return function(t,n,r){if(t===`click`||t==`keypress`)try{let n=this.__sentry_instrumentation_handlers__||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),Object.keys(n).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function Va(e){if(e.type!==La)return!1;try{if(!e.target||e.target._sentryId!==Ra)return!1}catch{}return!0}function Ha(e,t){return e===`keypress`?t?.tagName?!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable):!0:!1}function Ua(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=Wa(n);if(Ha(n.type,r))return;Ne(n,`_sentryCaptured`,!0),r&&!r._sentryId&&Ne(r,`_sentryId`,a());let i=n.type===`keypress`?`input`:n.type;Va(n)||(e({event:n,name:i,global:t}),La=n.type,Ra=r?r._sentryId:void 0),clearTimeout(Ia),Ia=Pa.setTimeout(()=>{Ra=void 0,La=void 0},Fa)}}function Wa(e){try{return e.target}catch{return null}}var Ga;function Ka(e){let t=`history`;Un(t,e),Wn(t,qa)}function qa(){if(Pa.addEventListener(`popstate`,()=>{let e=Pa.location.href,t=Ga;Ga=e,t!==e&&Gn(`history`,{from:t,to:e})}),!aa())return;function e(e){return function(...t){let n=t.length>2?t[2]:void 0;if(n){let r=Ga,i=Ja(String(n));if(Ga=i,r===i)return e.apply(this,t);Gn(`history`,{from:r,to:i})}return e.apply(this,t)}}He(Pa.history,`pushState`,e),He(Pa.history,`replaceState`,e)}function Ja(e){try{return new URL(e,Pa.location.origin).toString()}catch{return e}}var Ya={};function Xa(e){let t=Ya[e];if(t)return t;let n=Pa[e];if(sa(n))return Ya[e]=n.bind(Pa);let r=Pa.document;if(r&&typeof r.createElement==`function`)try{let t=r.createElement(`iframe`);t.hidden=!0,r.head.appendChild(t);let i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Na&&s.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n&&(Ya[e]=n.bind(Pa))}function Za(e){Ya[e]=void 0}var Qa=`__sentry_xhr_v3__`;function $a(e){Un(`xhr`,e),Wn(`xhr`,eo)}function eo(){if(!Pa.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){let r=Error(),i=x()*1e3,a=de(n[0])?n[0].toUpperCase():void 0,o=to(n[1]);if(!a||!o)return e.apply(t,n);t[Qa]={method:a,url:o,request_headers:{}},a===`POST`&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);let s=()=>{let e=t[Qa];if(e&&t.readyState===4){try{e.status_code=t.status}catch{}Gn(`xhr`,{endTimestamp:x()*1e3,startTimestamp:i,xhr:t,virtualError:r})}};return`onreadystatechange`in t&&typeof t.onreadystatechange==`function`?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(e,t,n){return s(),e.apply(t,n)}}):t.addEventListener(`readystatechange`,s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){let[r,i]=n,a=t[Qa];return a&&de(r)&&de(i)&&(a.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){let r=t[Qa];return r?(n[0]!==void 0&&(r.body=n[0]),Gn(`xhr`,{startTimestamp:x()*1e3,xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function to(e){if(de(e))return e;try{return e.toString()}catch{}}var no=40;function ro(e,t=Xa(`fetch`)){let n=0,r=0;async function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`strict-origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let n=await t(e.url,o);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get(`X-Sentry-Rate-Limits`),"retry-after":n.headers.get(`Retry-After`)}}}catch(e){throw Za(`fetch`),e}finally{n-=a,r--}}return jr(e,i,Tr(e.bufferSize||no))}var io=30,ao=50;function oo(e,t,n,r){let i={filename:e,function:t===`<anonymous>`?`?`:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var so=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,co=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lo=/\((\S*)(?::(\d+))(?::(\d+))\)/,uo=/at (.+?) ?\(data:(.+?),/,fo=[io,e=>{let t=e.match(uo);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=so.exec(e);if(n){let[,e,t,r]=n;return oo(e,`?`,+t,+r)}let r=co.exec(e);if(r){if(r[2]?.indexOf(`eval`)===0){let e=lo.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,t]=go(r[1]||`?`,r[2]);return oo(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],po=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,mo=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ho=nt(fo,[ao,e=>{let t=po.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=mo.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||`?`;return[n,e]=go(n,e),oo(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),go=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},_o=1024,M=`Breadcrumbs`,vo=sr(((e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:M,setup(e){t.console&&Ii(P(e)),t.dom&&za(N(e,t.dom)),t.xhr&&$a(F(e)),t.fetch&&la(bo(e)),t.history&&Ka(xo(e)),t.sentry&&e.on(`beforeSendEvent`,yo(e))}}}));function yo(e){return function(t){st()===e&&mt({category:`sentry.${t.type===`transaction`?`transaction`:`event`}`,event_id:t.event_id,level:t.level,message:ue(t)},{event:t})}}function N(e,t){return function(n){if(st()!==e)return;let r,i,a=typeof t==`object`?t.serializeAttribute:void 0,o=typeof t==`object`&&typeof t.maxStringLength==`number`?t.maxStringLength:void 0;o&&o>_o&&(dt&&s.warn(`\`dom.maxStringLength\` cannot exceed ${_o}, but a value of ${o} was configured. Sentry will use ${_o} instead.`),o=_o),typeof a==`string`&&(a=[a]);try{let e=n.event,t=So(e)?e.target:e;r=we(t,{keyAttrs:a,maxStringLength:o}),i=ze(t)}catch{r=`<unknown>`}if(r.length===0)return;let c={category:`ui.${n.name}`,message:r};i&&(c.data={"ui.component_name":i}),mt(c,{event:n.event,name:n.name,global:n.global})}}function P(e){return function(t){if(st()!==e)return;let n={category:`console`,data:{arguments:t.args,logger:`console`},level:Ri(t.level),message:Te(t.args,` `)};if(t.level===`assert`)if(t.args[0]===!1)n.message=`Assertion failed: ${Te(t.args.slice(1),` `)||`console.assert`}`,n.data.arguments=t.args.slice(1);else return;mt(n,{input:t.args,level:t.level})}}function F(e){return function(t){if(st()!==e)return;let{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Qa];if(!n||!r||!i)return;let{method:a,url:o,status_code:s,body:c}=i,l={method:a,url:o,status_code:s},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:`xhr`,data:l,type:`http`,level:ra(s)};e.emit(`beforeOutgoingRequestBreadcrumb`,d,u),mt(d,u)}}function bo(e){return function(t){if(st()!==e)return;let{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method===`POST`))if(t.error){let i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:`fetch`,data:t.fetchData,level:`error`,type:`http`};e.emit(`beforeOutgoingRequestBreadcrumb`,a,i),mt(a,i)}else{let i=t.response,a={...t.fetchData,status_code:i?.status},o={input:t.args,response:i,startTimestamp:n,endTimestamp:r},s={category:`fetch`,data:a,type:`http`,level:ra(a.status_code)};e.emit(`beforeOutgoingRequestBreadcrumb`,s,o),mt(s,o)}}}function xo(e){return function(t){if(st()!==e)return;let n=t.from,r=t.to,i=Qn(E.location.href),a=n?Qn(n):void 0,o=Qn(r);a?.path||(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),mt({category:`navigation`,data:{from:n,to:r}})}}function So(e){return!!e&&!!e.target}var Co=`EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload`.split(`,`),wo=`BrowserApiErrors`,To=sr(((e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:wo,setupOnce(){t.setTimeout&&He(E,`setTimeout`,Eo),t.setInterval&&He(E,`setInterval`,Eo),t.requestAnimationFrame&&He(E,`requestAnimationFrame`,I),t.XMLHttpRequest&&`XMLHttpRequest`in E&&He(XMLHttpRequest.prototype,`send`,Do);let e=t.eventTarget;e&&(Array.isArray(e)?e:Co).forEach(e=>Oo(e,t))}}}));function Eo(e){return function(...t){let n=t[0];return t[0]=pt(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${m(e)}`}}),e.apply(this,t)}}function I(e){return function(t){return e.apply(this,[pt(t,{mechanism:{data:{handler:m(e)},handled:!1,type:`auto.browser.browserapierrors.requestAnimationFrame`}})])}}function Do(e){return function(...t){let n=this;return[`onload`,`onerror`,`onprogress`,`onreadystatechange`].forEach(e=>{e in n&&typeof n[e]==`function`&&He(n,e,function(t){let n={mechanism:{data:{handler:m(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Je(t);return r&&(n.mechanism.data.handler=m(r)),pt(t,n)})}),e.apply(this,t)}}function Oo(e,t){let n=E[e]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(He(n,`addEventListener`,function(n){return function(r,i,a){try{ko(i)&&(i.handleEvent=pt(i.handleEvent,{mechanism:{data:{handler:m(i),target:e},handled:!1,type:`auto.browser.browserapierrors.handleEvent`}}))}catch{}return t.unregisterOriginalCallbacks&&Ao(this,r,i),n.apply(this,[r,pt(i,{mechanism:{data:{handler:m(i),target:e},handled:!1,type:`auto.browser.browserapierrors.addEventListener`}}),a])}}),He(n,`removeEventListener`,function(e){return function(t,n,r){try{let i=n.__sentry_wrapped__;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}function ko(e){return typeof e.handleEvent==`function`}function Ao(e,t,n){e&&typeof e==`object`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`&&e.removeEventListener(t,n)}var jo=sr((e={})=>{let t=e.lifecycle??`route`;return{name:`BrowserSession`,setupOnce(){if(E.document===void 0){dt&&s.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ze({ignoreDuration:!0}),qe();let e=v(),n=e.getUser();e.addScopeListener(e=>{let t=e.getUser();(n?.id!==t?.id||n?.ip_address!==t?.ip_address)&&(qe(),n=t)}),t===`route`&&Ka(({from:e,to:t})=>{e!==t&&(Ze({ignoreDuration:!0}),qe())})}}}),Mo=`CultureContext`,No=sr((()=>({name:Mo,preprocessEvent(e){let t=Po();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){let t=Po();t&&er(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})));function Po(){try{let e=E.Intl;if(!e)return;let t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}var Fo=`GlobalHandlers`,L=sr(((e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:Fo,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(Io(e),Vo(`onerror`)),t.onunhandledrejection&&(Lo(e),Vo(`onunhandledrejection`))}}}));function Io(e){qn(t=>{let{stackParser:n,attachStacktrace:r}=Ho();if(st()!==e||ut())return;let{msg:i,url:a,line:o,column:s,error:c}=t,l=Bo(Ea(n,c||i,void 0,r,!1),a,o,s);l.level=`error`,Me(l,{originalException:c,mechanism:{handled:!1,type:`auto.browser.global_handlers.onerror`}})})}function Lo(e){Xn(t=>{let{stackParser:n,attachStacktrace:r}=Ho();if(st()!==e||ut())return;let i=Ro(t),a=Se(i)?zo(i):Ea(n,i,void 0,r,!0);a.level=`error`,Me(a,{originalException:i,mechanism:{handled:!1,type:`auto.browser.global_handlers.onunhandledrejection`}})})}function Ro(e){if(Se(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 zo(e){return{exception:{values:[{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function Bo(e,t,n,r){let i=e.exception=e.exception||{},a=i.values=i.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},c=s.frames=s.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:Uo(t)??Qe(),function:`?`,in_app:!0}),e}function Vo(e){dt&&s.log(`Global Handler attached: ${e}`)}function Ho(){return st()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function Uo(e){if(!(!de(e)||e.length===0))return e.startsWith(`data:`)?`<${$n(e,!1)}>`:e}var Wo=sr(()=>({name:`HttpContext`,preprocessEvent(e){if(!E.navigator&&!E.location&&!E.document)return;let t=ct(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){if(!E.navigator&&!E.location&&!E.document)return;let t=ct();er(e,{"url.full":t.url||void 0,"http.request.header.user_agent":t.headers[`User-Agent`],"http.request.header.referer":t.headers.Referer})}})),Go=`cause`,Ko=5,qo=`LinkedErrors`,Jo=sr(((e={})=>{let t=e.limit||Ko,n=e.key||Go;return{name:qo,preprocessEvent(e,r,i){Di(j,i.getOptions().stackParser,n,t,e,r)}}}));function Yo(){return Xo()?(dt&&Le(()=>{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 Xo(){if(E.window===void 0)return!1;let e=E;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let t=Qe();return!(E===E.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(t))}function Zo(e){return[_i(),pi(),na(),To(),vo(),L(),Jo(),Bi(),Wo(),No(),jo()]}function Qo(e={}){let t=!e.skipBrowserExtensionCheck&&Yo(),n=e.defaultIntegrations==null?Zo():e.defaultIntegrations;return oi(ja,{...e,enabled:t?!1:e.enabled,stackParser:f(e.stackParser||ho),integrations:rr({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||ro})}var $o=e(ht());function es(e){let t={...e};return li(t,`react`),Re(`react`,{version:$o.version}),Qo(t)}var ts=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ns=t(((e,t)=>{t.exports=ts()})),rs=t((e=>{var t=ns(),n=ht(),r=gt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.iterator;function se(e){return typeof e!=`object`||!e?null:(e=oe&&e[oe]||e[`@@iterator`],typeof e==`function`?e:null)}var ce=Symbol.for(`react.client.reference`);function le(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case ee:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,S=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function w(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function T(e,t){pe++,fe[pe]=e.current,e.current=t}var he=me(null),ge=me(null),_e=me(null),ve=me(null);function ye(e,t){switch(T(_e,t),T(ge,e),T(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(he),T(he,e)}function be(){w(he),w(ge),w(_e)}function xe(e){e.memoizedState!==null&&T(ve,e);var t=he.current,n=Hd(t,e.type);t!==n&&(T(ge,e),T(he,n))}function Se(e){ge.current===e&&(w(he),w(ge)),ve.current===e&&(w(ve),Qf._currentValue=de)}var Ce,we;function Te(e){if(Ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ce=t&&t[1]||``,we=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Ce+e+we}var Ee=!1;function De(e,t){if(!e||Ee)return``;Ee=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`