PageSourceSearch

https://surething.io/_next/static/chunks/7303.6883c38eed74935f.js

js surething.io collected 2026-10-04 10:58:17 UTC 113,957 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b5e4c9c5-69f2-44eb-82b0-55041dcd62f6",e._sentryDebugIdIdentifier="sentry-dbid-b5e4c9c5-69f2-44eb-82b0-55041dcd62f6")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7303],{24560:(e,t,s)=>{s.d(t,{D:()=>c,N:()=>d});var a=s(507620),n=(e,t,s,a,n,l,r,i)=>{let o=document.documentElement,c=["light","dark"];function d(t){var s;(Array.isArray(e)?e:[e]).forEach(e=>{let s="class"===e,a=s&&l?n.map(e=>l[e]||e):n;s?(o.classList.remove(...a),o.classList.add(l&&l[t]?l[t]:t)):o.setAttribute(e,t)}),s=t,i&&c.includes(s)&&(o.style.colorScheme=s)}if(a)d(a);else try{let e=localStorage.getItem(t)||s,a=r&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;d(a)}catch(e){}},l=["light","dark"],r="(prefers-color-scheme: dark)",i=a.createContext(void 0),o={setTheme:e=>{},themes:[]},c=()=>{var e;return null!=(e=a.useContext(i))?e:o},d=e=>a.useContext(i)?a.createElement(a.Fragment,null,e.children):a.createElement(m,{...e}),u=["light","dark"],m=e=>{let{forcedTheme:t,disableTransitionOnChange:s=!1,enableSystem:n=!0,enableColorScheme:o=!0,storageKey:c="theme",themes:d=u,defaultTheme:m=n?"system":"light",attribute:p="data-theme",value:b,children:y,nonce:v,scriptProps:j}=e,[N,w]=a.useState(()=>f(c,m)),[_,C]=a.useState(()=>"system"===N?g():N),A=b?Object.values(b):d,k=a.useCallback(e=>{let t=e;if(!t)return;"system"===e&&n&&(t=g());let a=b?b[t]:t,r=s?h(v):null,i=document.documentElement,c=e=>{"class"===e?(i.classList.remove(...A),a&&i.classList.add(a)):e.startsWith("data-")&&(a?i.setAttribute(e,a):i.removeAttribute(e))};if(Array.isArray(p)?p.forEach(c):c(p),o){let e=l.includes(m)?m:null,s=l.includes(t)?t:e;i.style.colorScheme=s}null==r||r()},[v]),E=a.useCallback(e=>{let t="function"==typeof e?e(N):e;w(t);try{localStorage.setItem(c,t)}catch(e){}},[N]),T=a.useCallback(e=>{C(g(e)),"system"===N&&n&&!t&&k("system")},[N,t]);a.useEffect(()=>{let e=window.matchMedia(r);return e.addListener(T),T(e),()=>e.removeListener(T)},[T]),a.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?w(e.newValue):E(m))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),a.useEffect(()=>{k(null!=t?t:N)},[t,N]);let S=a.useMemo(()=>({theme:N,setTheme:E,forcedTheme:t,resolvedTheme:"system"===N?_:N,themes:n?[...d,"system"]:d,systemTheme:n?_:void 0}),[N,E,t,_,n,d]);return a.createElement(i.Provider,{value:S},a.createElement(x,{forcedTheme:t,storageKey:c,attribute:p,enableSystem:n,enableColorScheme:o,defaultTheme:m,value:b,themes:d,nonce:v,scriptProps:j}),y)},x=a.memo(e=>{let{forcedTheme:t,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:c,themes:d,nonce:u,scriptProps:m}=e,x=JSON.stringify([l,s,o,t,d,c,r,i]).slice(1,-1);return a.createElement("script",{...m,suppressHydrationWarning:!0,nonce:"",dangerouslySetInnerHTML:{__html:"(".concat(n.toString(),")(").concat(x,")")}})}),f=(e,t)=>{let s;try{s=localStorage.getItem(e)||void 0}catch(e){}return s||t},h=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||(e=window.matchMedia(r)),e.matches?"dark":"light")},44048:(e,t,s)=>{s.d(t,{D:()=>a});function a(e){var t;if(!e)return null;let s=e.match(/^\/p\/([^/]+)/);return null!=(t=null==s?void 0:s[1])?t:null}},209850:(e,t,s)=>{s.d(t,{bL:()=>N,zi:()=>w});var a=s(507620),n=s(447231),l=s(361715),r=s(418107),i=s(154111),o=s(46357),c=s(564185),d=s(260421),u=s(454568),m="Switch",[x,f]=(0,r.A)(m),[h,g]=x(m),p=a.forwardRef((e,t)=>{let{__scopeSwitch:s,name:r,checked:o,defaultChecked:c,required:x,disabled:f,value:g="on",onCheckedChange:p,form:b,...y}=e,[N,w]=a.useState(null),_=(0,l.s)(t,e=>w(e)),C=a.useRef(!1),A=!N||b||!!N.closest("form"),[k,E]=(0,i.i)({prop:o,defaultProp:null!=c&&c,onChange:p,caller:m});return(0,u.jsxs)(h,{scope:s,checked:k,disabled:f,children:[(0,u.jsx)(d.sG.button,{type:"button",role:"switch","aria-checked":k,"aria-required":x,"data-state":j(k),"data-disabled":f?"":void 0,disabled:f,value:g,...y,ref:_,onClick:(0,n.mK)(e.onClick,e=>{E(e=>!e),A&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}
1),A&&(0,u.jsx)(v,{control:N,bubbles:!C.current,name:r,value:g,checked:k,required:x,disabled:f,form:b,style:{transform:"translateX(-100%)"}})]})});p.displayName=m;var b="SwitchThumb",y=a.forwardRef((e,t)=>{let{__scopeSwitch:s,...a}=e,n=g(b,s);return(0,u.jsx)(d.sG.span,{"data-state":j(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:t})});y.displayName=b;var v=a.forwardRef((e,t)=>{let{__scopeSwitch:s,control:n,checked:r,bubbles:i=!0,...d}=e,m=a.useRef(null),x=(0,l.s)(m,t),f=(0,o.Z)(r),h=(0,c.X)(n);return a.useEffect(()=>{let e=m.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(f!==r&&t){let s=new Event("click",{bubbles:i});t.call(e,r),e.dispatchEvent(s)}},[f,r,i]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:x,style:{...d.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function j(e){return e?"checked":"unchecked"}v.displayName="SwitchBubbleInput";var N=p,w=y},232930:(e,t,s)=>{s.d(t,{d:()=>r});var a=s(454568),n=s(209850),l=s(860079);function r(e){let{className:t,...s}=e;return(0,a.jsx)(n.bL,{"data-slot":"switch",className:(0,l.cn)("peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",t),...s,children:(0,a.jsx)(n.zi,{"data-slot":"switch-thumb",className:(0,l.cn)("pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}},242269:(e,t,s)=>{s.d(t,{w:()=>c});var a=s(454568),n=s(1344),l=s(418116),r=s(507620),i=s(612690),o=s(480494);function c(e){let{tier:t,currentTier:s,onConfirm:c,onCancel:d,surface:u}=e,{track:m}=(0,i.s)(),x=(0,r.useRef)(!1),f=(0,r.useRef)(null),h=t?(0,o.De)(t):null;if((0,r.useEffect)(()=>{var e,a;if(!t){f.current=null;return}f.current!==t&&(f.current=t,x.current=!1,m("routines_model_tier_confirm_shown",{tier:t,previous_tier:s,surface:u,credit_multiplier:null!=(e=(0,o.De)(t))?e:1,confirm_kind:null!=(a=(0,o.zh)(t))?a:"cost"}))},[s,u,t,m]),!t)return null;
1let g=n.AG[t],p=n.AG[o.sp].label,b=(0,o.zh)(t);return(0,a.jsx)(l.Lt,{open:!0,onOpenChange:e=>{e||x.current||(m("routines_model_tier_confirm_cancelled",{tier:t,previous_tier:s,surface:u,confirm_kind:null!=b?b:"cost"}),d())},children:(0,a.jsxs)(l.EO,{className:"max-w-[460px]",children:[(0,a.jsxs)(l.wd,{children:[(0,a.jsxs)(l.r7,{className:"text-xl",children:["Run every execution on ",g.label,"?"]}),(0,a.jsx)(l.$v,{asChild:!0,className:"!text-[15px] !text-foreground",children:(0,a.jsxs)("ul",{className:"mt-1.5 list-disc space-y-1.5 pl-[1.15em] leading-relaxed marker:text-gray-8",children:[null!==h&&(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:(0,o.En)(h)})," the credits of"," ",o.yC]}),"capability"===b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("li",{children:"Fits simple, repetitive work — fetch, filter, short summaries"}),(0,a.jsx)("li",{children:"Weaker at judgment, multi-step work, nuanced writing"}),(0,a.jsx)("li",{children:"Check the first few runs before relying on it"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("li",{children:"Fits work that needs deeper reasoning every run"}),(0,a.jsx)("li",{children:"Overkill for simple fetch-and-summarize routines"}),(0,a.jsxs)("li",{children:["Worth it only if ",p," runs are actually falling short"]})]})]})})]}),(0,a.jsxs)(l.ck,{children:[(0,a.jsx)(l.Zr,{className:"h-10 rounded-lg px-5 text-sm",children:"Cancel"}),(0,a.jsx)(l.Rx,{className:"h-10 rounded-lg px-5 text-sm",onClick:()=>{x.current=!0,c(t)},children:"Confirm"})]})]})})}},455791:(e,t,s)=>{s.d(t,{_i:()=>r,aS:()=>l,vR:()=>n});var a=s(923775);function n(){return(0,a.EL)()}async function l(e,t){let s=(0,a.m6)();if(!s)return!1;try{var n;let a=null!=(n=null==t?void 0:t.body)?n:"",l=null==t?void 0:t.url;return await s.showNotification(e,a,l)}catch(e){return console.debug("[electron-bridge] Failed to show notification:",e),!1}}function r(e){let t=(0,a.m6)();return(null==t?void 0:t.onNotificationNavigate)?t.onNotificationNavigate(e):null}},466180:(e,t,s)=>{s.d(t,{m:()=>l});var a=s(867576);let n="Something went wrong. Please try again.";function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"login";if(429===e.status||"TOO_MANY_REQUESTS"===e.code)return"Too many attempts. Please wait a minute and try again.";switch(e.code){case"EMAIL_LOGIN_DISABLED":return"Email sign-in is not available right now. Please continue with Google or Apple.";case"DISPOSABLE_EMAIL":return"Temporary email addresses can't be used. Please use a permanent address.";case"EMAIL_ALIAS_TAKEN":return"An account already uses this mailbox. Sign in with the address you signed up with.";case"INVALID_EMAIL_OR_PASSWORD":return"That password is incorrect.";case"INVALID_PASSWORD":return"change_password"===t?"Your current password is incorrect.":"That password is incorrect.";case"PASSWORD_TOO_SHORT":case"PASSWORD_TOO_WEAK":return"".concat(a.Nn,".");case"PASSWORD_TOO_LONG":return"That password is too long.";case"INVALID_OTP":return"That code is not right. Check the email and try again.";case"OTP_EXPIRED":return"That code has expired. Request a new one.";case"TOO_MANY_ATTEMPTS":return"Too many wrong codes. Request a new one.";case"INVALID_EMAIL":return"Enter a valid email address.";case"CREDENTIAL_ACCOUNT_NOT_FOUND":return"change_password"===t?"This account has no password yet.":n;default:return e.message||n}}},493632:(e,t,s)=>{s.d(t,{CR:()=>m,LU:()=>d,Ru:()=>i,SE:()=>l,WU:()=>u,bk:()=>r,ec:()=>x,fP:()=>o,kL:()=>c});var a=s(611649);async function n(e){try{var t;return(t=await e()).error?{ok:!1,error:{code:t.error.code,status:t.error.status,message:t.error.message}}:{ok:!0,data:t.data}}catch(e){return{ok:!1,error:{message:e instanceof Error?e.message:void 0}}}}function l(e){return n(()=>a.y.$fetch("/email-login/status",{method:"POST",body:{email:e}}))}function r(e,t){return n(()=>a.y.signUp.email({email:e,password:t,name:function(e){var t;let s=null==(t=e.split("@")[0])?void 0:t.trim();return s&&s.length>0?s:"there"}(e)}))}function i(e,t){return n(()=>a.y.signIn.email({email:e,password:t}))}function o(e,t){return n(()=>a.y.emailOtp.verifyEmail({email:e,otp:t}))}function c(e){return n(()=>a.y.emailOtp.sendVerificationOtp({email:e,type:"email-verification"}))}function d(e){return n(()=>a.y.forgetPassword.emailOtp({email:e}))}function u(e,t,s){return n(()=>a.y.emailOtp.resetPassword({email:e,otp:t,password:s}))}function m(){return n(async()=>{var e;let t=await a.y.listAccounts();return t.error?{data:null,error:t.error}:{data:(null!=(e=t.data)?e:[]).map(e=>e.providerId),error:null}})}function x(e,t){return n(()=>a.y.changePassword({currentPassword:e,newPassword:t,revokeOtherSessions:!0}))}},690550:(e,t,s)=>{s.d(t,{KO:()=>n,dL:()=>i,hH:()=>l,mT:()=>r});var a=s(455791);function n(){return!!(0,a.vR)()||"Notification"in window}function l(){return n()?Notification.permission:"denied"}async function r(){if(!n())return"denied";if("default"!==Notification.permission)return Notification.permission;try{return await Notification.requestPermission()}catch(e){return new Promise(e=>{Notification.requestPermission(t=>{e(t)})})}}function i(e,t){if("undefined"!=typeof document&&"visible"===document.visibilityState)return!1;if((0,a.vR)())return(0,a.aS)(e,{body:null==t?void 0:t.body}),!0;if(!n()||"granted"!==Notification.permission)return!1;try{var s;let a=new Notification(e,{body:null==t?void 0:t.body,icon:(null==t?void 0:t.icon)||"/fav
1icon.ico",tag:null==t?void 0:t.tag,requireInteraction:null!=(s=null==t?void 0:t.requireInteraction)&&s});return a.onclick=()=>{var e;window.focus(),a.close(),null==t||null==(e=t.onClick)||e.call(t)},setTimeout(()=>{a.close()},5e3),!0}catch(e){return!1}}},724779:(e,t,s)=>{s.d(t,{H:()=>i});var a=s(454568),n=s(1344),l=s(200826),r=s(480494);function i(e){var t;let{tier:s,className:i}=e,o=(0,r.CL)(s);if(o===r.sp)return null;let c=(0,r.De)(o),d=n.AG[o].label,u=(null!=c?c:1)>(null!=(t=(0,r.De)(r.sp))?t:1),m=null===c?null:(0,r.En)(c);return(0,a.jsxs)("span",{"data-slot":"routine-model-tier-badge",title:m?"Every run of this routine is set to ".concat(d," — ").concat(m," the credits of ").concat(r.yC,"."):"Every run of this routine is set to ".concat(d,"."),className:(0,l.cn)("inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 font-medium text-[11px] leading-4",u?"bg-amber-3 text-amber-11":"bg-gray-3 text-gray-11",i),children:[d,m&&(0,a.jsx)("span",{className:"tabular-nums opacity-80",children:m})]})}},857373:(e,t,s)=>{s.d(t,{Ac:()=>b,B4:()=>j,Oh:()=>g,Q7:()=>p,Qi:()=>h,Ql:()=>v,nD:()=>N,xJ:()=>w});var a=s(811971),n=s(264942),l=s(873004),r=s(39562),i=s(711798),o=s(292191),c=s(657006),d=s(986622),u=s(435703);let m=[d.BP.SCHEDULE,d.BP.EMAIL,d.BP.CALENDAR],x=new Set(c.sA);function f(e){return!(!m.includes(e.filter_group)||e.task_status&&x.has(e.task_status))}function h(e){return e.filter(f)}function g(e,t){return h(e).filter(e=>e.agent_id===t)}function p(e){return[...e].sort((e,t)=>("paused"===e.task_status)-("paused"===t.task_status))}let b=[{value:d.BP.SCHEDULE,label:"Schedule",Icon:a.V},{value:d.BP.EMAIL,label:"Email",Icon:n.s},{value:d.BP.CALENDAR,label:"Calendar",Icon:l.m}],y={[d.BP.ALL]:r.C,[d.BP.SCHEDULE]:a.V,[d.BP.EMAIL]:n.s,[d.BP.CALENDAR]:l.m,[d.BP.CHAT]:i.c,[d.BP.OTHERS]:o.T};function v(e){return e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:1})}function j(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e)}function N(e){var t;return null!=(t=y[e])?t:r.C}function w(e){if(!e)return"";if("cron"===e.type&&e.expression){var t,s=(0,u.G)(e.expression);if(s.startsWith("Every "))return"checks every".concat(s.slice(5));if("Hourly"===s)return"runs hourly";if(s.startsWith("Hourly at "))return"runs hourly at ".concat(s.slice(10));if(s.startsWith("Daily "))return"runs daily at ".concat(s.slice(6));if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/.test(s)){let e=s.indexOf(" ");if(e>0)return"runs every ".concat(s.slice(0,e)," at ").concat(s.slice(e+1))}return s.startsWith("Day ")?"runs on ".concat(s.replace(","," at")):"runs ".concat(s)}if("event"===e.type){let s=null!=(t=e.event_type)?t:"";return s.toLowerCase().includes("email")?"watches your inbox":s?"fires on ".concat(s.replace(/[._]/g," ")):"fires when triggered"}if("delay"===e.type&&e.scheduled_at){let t=new Date(e.scheduled_at),s=new Date,a=t.toDateString()===s.toDateString(),n=new Date(s);n.setDate(n.getDate()+1);let l=t.toDateString()===n.toDateString(),r=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});if(a)return"runs once today at ".concat(r);if(l)return"runs once tomorrow at ".concat(r);let i=t.toLocaleDateString(void 0,{month:"short",day:"numeric"});return"runs once on ".concat(i," at ").concat(r)}if("delay"===e.type&&e.delay){let t=1===e.delay.value&&e.delay.unit.endsWith("s")?e.delay.unit.slice(0,-1):e.delay.unit;return"runs once in ".concat(e.delay.value," ").concat(t)}return"delay"===e.type?"runs once":"event"===e.type?"fires when triggered":""}},867576:(e,t,s)=>{s.d(t,{Nn:()=>a,Oj:()=>i});let a="Password must be at least 12 characters and include letters, numbers and symbols",n=RegExp("\\p{L}","u"),l=RegExp("\\p{N}","u"),r=RegExp("[^\\p{L}\\p{N}]","u");function i(e){return e.length<12?"too_short":e.length>128?"too_long":n.test(e)?l.test(e)?r.test(e)?null:"missing_symbol":"missing_number":"missing_letter"}},902751:(e,t,s)=>{s.r(t),s.d(t,{SettingsModalContainer:()=>si});var a,n,l=s(454568),r=s(653613),i=s(847454);function o(e){if(e)return e.replace(RegExp("[\\p{L}\\p{N}]","gu"),"*")}var c=s(899620),d=s(969027),u=s(104869),m=s(727736),x=s(507620),f=s(77517),h=s(867305),g=s(612690),p=s(793819),b=s(23804),y=s(79105);let v=(0,y.h)("AuthStorageCleanup");var j=s(956706),N=s(748501),w=s(564050),_=s(676164),C=s(387846),A=s(221642),k=s(787585),E=s(418116);function T(e){let{open:t,onOpenChange:s,planId:a,onGoToBilling:n}=e;return(0,l.jsx)(E.Lt,{open:t,onOpenChange:s,children:(0,l.jsxs)(E.EO,{className:"max-w-[460px]",children:[(0,l.jsxs)(E.wd,{children:[(0,l.jsx)(E.r7,{className:"text-xl",children:"Cancel your subscription first"}),(0,l.jsxs)(E.$v,{className:"!text-base leading-relaxed !text-foreground",children:[a?"You still have an active ".concat(a.toUpperCase()," subscription."):"You still have an active subscription."," ","Please cancel it in Billing before deleting your account."]})]}),(0,l.jsxs)(E.ck,{children:[(0,l.jsx)(E.Zr,{className:"h-10 rounded-lg px-5 text-sm",children:"Not now"}),(0,l.jsx)(E.Rx,{onClick:n,className:"h-10 rounded-lg px-5 text-sm",children:"Go to Billing"})]})]})})}function S(e){let{open:t,onOpenChange:s,planId:a,remainingDays:n,currentPeriodEnd:r,isConfirming:i,onConfirmDelete:o}=e,c=function(e,t){let s=t?function(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch(t){return e}}(t):null;return"number"==typeof e&&e>0&&s?" for another ".concat(e," day").concat(1===e?"":"s"," (until ").concat(s,")"):"number"==typeof e&&e>0?" for another ".concat(e," day").concat(1===e?"":"s"):s?" until ".concat(s):""}(n,r),d=a?a.toUpperCase():"your";return(0,l.jsx)(E.Lt,{open:t,onOpenChange:s,children:(0,l.jsxs)(E.EO,{className:"max-w-[460px]",children:[(0,l.jsxs)(E.wd,{children:[(0,l.jsx)(E.r7,{className:"text-xl",children:"Delete account before period ends?"}),(0,l.jsxs)(E.$v,{className:"!text-base leading-relaxed !text-foreground",children:["Your ",d," subscription is canceled and still active",c,". Deleting your account now will end access immediately, and the remaining time will not be refunded."]})]}),(0,l.jsxs)(E.ck,{children:[(0,l.jsx)(E.Zr,{disabled:i,className:"h-10 rounded-lg px-5 text-sm",children:"Keep until period ends"}),(0,l.jsx)(E.Rx,{onClick:o,disabled:i,className:"h-10 rounded-lg bg-red-9 px-5 text-sm text-white hover:bg-red-10",children:i?"Deleting...":"Delete anyway"})]})]})})}var L=s(66420),P=s(252518),I=s(491050),R=s(419396),D=s(640580),O=s(232930),U=s(720380),F=s(231421),M=s(784825),z=s(881562),B=s(17560),G=s(498304),V=s(233938),K=s(200826);function $(e){let{open:t,onOpenChange:s,planName:a,periodEndIso:n,topupBalance:r,autoRechargeEnabled:i,onConfirm:o,isConfirming:c}=e,d=n?new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"}):null;return(0,l.jsx)(V.lG,{open:t,onOpenChange:s,children:(0,l.jsxs)(V.Cf,{className:"max-w-md p-0 gap-0 overflow-hidden",children:[(0,l.jsxs)(V.c7,{className:"px-6 pt-6 pb-2",children:[(0,l.jsxs)(V.L3,{className:"font-serif text-2xl",children:["Cancel your ",a," subscription?"]}
1),(0,l.jsx)("p",{className:"text-[13px] text-foreground/60",children:"Here's what happens to your account:"})]}),(0,l.jsxs)("ul",{className:"flex flex-col gap-3 px-6 py-4",children:[(0,l.jsx)(q,{kind:"kept",title:d?"".concat(a," access continues until ").concat(d):"".concat(a," access continues until period end"),description:"You'll keep all features until then"}),r>0&&(0,l.jsx)(q,{kind:"kept",title:"".concat(r.toLocaleString()," Add-on credit").concat(1===r?"":"s"," stay valid"),description:"Use them anytime, even after cancellation"}),i&&(0,l.jsx)(q,{kind:"lost",title:"Auto Recharge will be turned off",description:"No more automatic charges"}),(0,l.jsx)(q,{kind:"lost",title:"Can't top up add-on credits until you re-subscribe",description:"Existing balance still usable"})]}),(0,l.jsxs)(V.Es,{className:"border-t border-gray-4 px-6 py-4 gap-2",children:[(0,l.jsx)(I.$n,{type:"button",onClick:()=>s(!1),disabled:c,className:"rounded-full",children:"Keep my plan"}),(0,l.jsx)(I.$n,{type:"button",variant:"outline",onClick:o,disabled:c,className:"rounded-full border-red-7 text-red-11 hover:bg-red-2 hover:text-red-12",children:c?"Canceling...":"Cancel anyway"})]})]})})}function q(e){let{kind:t,title:s,description:a}=e,n="kept"===t?B.S:G.u;return(0,l.jsxs)("li",{className:"flex items-start gap-3",children:[(0,l.jsx)(n,{weight:"bold",className:(0,K.cn)("mt-0.5 size-4 shrink-0","kept"===t?"text-green-11":"text-red-11"),"aria-hidden":!0}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-foreground",children:s}),(0,l.jsx)("p",{className:"text-[13px] text-foreground/60",children:a})]})]})}var H=s(34629),Y=s(223240);function W(e){let{action:t,pending:s,onAction:a}=e,n=s&&null===t.storeUrl;return(0,l.jsx)("section",{"data-slot":"payment-failed-banner",children:(0,l.jsx)("div",{className:"rounded-xl border border-gray-4 bg-card px-4 py-3",children:(0,l.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,l.jsx)(Y.M,{weight:"fill",className:"mt-0.5 size-5 shrink-0 text-red-11"}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-foreground",children:"Payment failed"}),(0,l.jsx)("p",{className:"text-[13px] text-foreground/70",children:t.message}),t.notes.length>0&&(0,l.jsx)("ul",{className:"mt-2.5 flex flex-col gap-3",children:t.notes.map(e=>(0,l.jsxs)("li",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-[13px] font-medium text-foreground",children:e.lead}),(0,l.jsx)("span",{className:"text-[13px] text-foreground/70",children:e.text})]},e.lead))}),t.ctaLabel&&(0,l.jsx)("div",{className:"pt-3",children:(0,l.jsx)(I.$n,{type:"button",variant:"outline",size:"sm",onClick:a,disabled:n,children:n?"Opening...":t.ctaLabel})})]})]})})})}var Q=s(485724),X=s(285524);let Z=!1;function J(e){let{planId:t,status:s}=e,{track:a}=(0,g.s)();return(0,x.useEffect)(()=>{Z||(Z=!0,a("payment_processing_notice_viewed",{surface:"billing_tab",plan_id:t,subscription_status:"unpaid"===s?"unpaid":"past_due"}))},[t,s,a]),(0,l.jsx)("section",{"data-slot":"payment-processing-banner",children:(0,l.jsx)("div",{className:"rounded-xl border border-gray-4 bg-card px-4 py-3",children:(0,l.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,l.jsx)(X.m,{weight:"fill",className:"mt-0.5 size-5 shrink-0 text-slate-11"}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-foreground",children:"Payment processing"}),(0,l.jsx)("p",{className:"text-[13px] text-foreground/70",children:Q.dG})]})]})})})}var ee=s(40687),et=s(396632),es=s(599740);function ea(e){let{open:t,onOpenChange:s,offer:a,onAccept:n,onDecline:r,isAccepting:i,isDeclining:o}=e,c=i||o;return(0,l.jsx)(V.lG,{open:t,onOpenChange:s,children:(0,l.jsxs)(V.Cf,{className:"max-w-md p-0 gap-0 overflow-hidden",children:[(0,l.jsxs)(V.c7,{className:"px-6 pt-6 pb-2",children:[(0,l.jsx)(V.L3,{className:"font-serif text-2xl",children:"Before you go"}
1),(0,l.jsxs)("p",{className:"text-[13px] text-foreground/60",children:["We'd rather keep you around — here's ",a.percentOff,"% off."]})]}),(0,l.jsxs)("div",{className:"mx-6 my-4 rounded-2xl bg-accent-3 px-5 py-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(et.g,{weight:"fill",className:"size-4 text-accent-11","aria-hidden":!0}),(0,l.jsxs)("p",{className:"text-sm font-semibold text-accent-12",children:[a.percentOff,"% off for ",a.months," months"]})]}),(0,l.jsxs)("p",{className:"mt-2 flex items-baseline gap-2",children:[(0,l.jsx)("span",{className:"text-2xl font-semibold text-accent-12",children:er(a.discountedAmount,a.currency)}),(0,l.jsx)("span",{className:"text-sm text-accent-11 line-through",children:er(a.currentAmount,a.currency)}),(0,l.jsx)("span",{className:"text-sm text-accent-11",children:"/ month"})]})]}),(0,l.jsxs)("p",{className:"px-6 pb-4 text-[13px] text-foreground/60",children:["You'll pay ",er(a.discountedAmount,a.currency)," per month for the next"," ",a.months," months, then ",er(a.currentAmount,a.currency)," per month. Cancel any time."]}),(0,l.jsxs)(V.Es,{className:"border-t border-gray-4 px-6 py-4 gap-2",children:[(0,l.jsx)(I.$n,{type:"button",onClick:n,disabled:c,className:"rounded-full",children:i?"Applying...":"Apply ".concat(a.percentOff,"% discount")}),(0,l.jsx)(I.$n,{type:"button",variant:"outline",onClick:r,disabled:c,className:"rounded-full border-red-7 text-red-11 hover:bg-red-2 hover:text-red-12",children:o?"Opening...":"Cancel my subscription"})]})]})})}function en(e){let{open:t,onDone:s,applied:a}=e;return(0,l.jsx)(V.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,l.jsxs)(V.Cf,{className:"max-w-md p-0 gap-0 overflow-hidden",children:[(0,l.jsx)(V.c7,{className:"px-6 pt-6 pb-2",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(es.C,{weight:"fill",className:"size-5 text-green-11","aria-hidden":!0}),(0,l.jsx)(V.L3,{className:"font-serif text-2xl",children:"Discount applied"})]})}),(0,l.jsxs)("dl",{className:"flex flex-col gap-3 px-6 py-4",children:[null!==a.discountedAmount&&(0,l.jsx)(el,{label:"Your price now",value:er(a.discountedAmount,a.currency),suffix:"/ month",emphasis:!0}),a.discountEnd&&(0,l.jsx)(el,{label:"Discount runs until",value:new Date(a.discountEnd).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),null!==a.regularAmount&&(0,l.jsx)(el,{label:"Then returns to",value:er(a.regularAmount,a.currency),suffix:"/ month"})]}),(0,l.jsxs)("p",{className:"px-6 pb-2 text-[13px] text-foreground/60",children:["Your ",a.percentOff,"% discount is active for the next ",a.months," months. Your subscription stays active and you can cancel at any time."]}),(0,l.jsx)(V.Es,{className:"border-t border-gray-4 px-6 py-4",children:(0,l.jsx)(I.$n,{type:"button",onClick:s,className:"rounded-full",children:"Got it"})})]})})}function el(e){let{label:t,value:s,suffix:a,emphasis:n}=e;return(0,l.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,l.jsx)("dt",{className:"text-[13px] text-foreground/60",children:t}),(0,l.jsxs)("dd",{className:n?"text-base font-semibold text-foreground":"text-sm text-foreground/80",children:[s,a?(0,l.jsx)("span",{className:"ml-1 text-[13px] text-foreground/60",children:a}):null]})]})}function er(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase()}).format(e/100)}var ei=s(770589),eo=s(406640);let ec=i.U3/i.ee,ed=Array.from({length:ec},(e,t)=>t+1);function eu(e){let{onUpgrade:t,tooltip:s}=e;return(0,l.jsxs)(U.Tooltip,{children:[(0,l.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(I.$n,{type:"button",variant:"ghost",size:"icon",onClick:()=>null==t?void 0:t({trigger:"credits_tooltip_daily_refresh",initialFaqKey:"daily-refresh"}),className:"size-4 rounded-full p-0 text-foreground/60 hover:bg-transparent hover:text-foreground","aria-label":"Learn more about daily refresh credits",children:(0,l.jsx)(L.u,{className:"size-3.5",weight:"fill"})})}),(0,l.jsx)(U.TooltipContent,{side:"top",className:"max-w-60",children:s})]})}function em(e){let{grantsIssued:t}=e;return(0,l.jsx)("ol",{"data-slot":"daily-refresh-grant-slots",className:"flex items-center gap-1.5","aria-label":"".concat(t," of ").concat(ec," daily refreshes granted"),children:ed.map(e=>{let s=e<=t;return(0,l.jsx)("li",{"data-slot":"daily-refresh-grant-slot","aria-label":"Refresh ".concat(e,": ").concat(s?"granted":"available"),children:(0,l.jsx)("span",{className:(0,K.cn)("block size-4 rounded-sm ring-1 ring-inset",s?"bg-green-7 ring-green-8/40":"bg-gray-3 ring-gray-5/70"),"aria-hidden":"true"})},e)})})}function ex(e){let{dailyBalance:t,dailyMonthlyGranted:s,cycleResetLabel:a="monthly",showCreditTotals:n=!1,onUpgrade:r}=e,o=Math.min(Math.max(Math.floor(s/i.ee),0),ec),c=s>=i.U3&&0===t;return(0,l.jsxs)("section",{"data-slot":"free-daily-refresh-credits","aria-label":"Daily refresh credits",className:"flex flex-col border-t border-gray-4 pt-3 mt-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-[15px] font-medium text-foreground
1/80",children:[(0,l.jsx)(F.gU,{className:"size-5"}),"Daily refresh credits",(0,l.jsx)(eu,{onUpgrade:r,tooltip:n?"Refresh credits follow the Free plan monthly cap. Credits granted earlier this cycle, including while paid, count toward the limit.":"Refresh credits are granted daily, up to five times per monthly cycle."})]}),(0,l.jsx)("span",{className:"text-sm font-medium tabular-nums text-foreground/80",children:c?"Monthly limit reached":"".concat(t.toLocaleString()," today")})]}),(0,l.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-[13px] tabular-nums text-foreground/70",children:n?"Up to ".concat(i.ee," credits daily"):"".concat(i.ee," credits \xd7 ").concat(ec," days")}),(0,l.jsxs)("span",{className:"text-xs tabular-nums text-foreground/50",children:[i.U3," monthly max"]})]}),(0,l.jsxs)("div",{className:"flex flex-col items-end gap-1.5",children:[!n&&(0,l.jsx)(em,{grantsIssued:o}),(0,l.jsx)("span",{className:"text-[11px] tabular-nums text-foreground/50",children:n?"".concat(s.toLocaleString()," granted this cycle"):"".concat(o," of ").concat(ec," granted")})]})]}),(0,l.jsxs)("div",{className:"mt-3 flex items-center justify-between text-xs text-foreground/50",children:[(0,l.jsx)("span",{children:"Expires daily \xb7 No rollover"}),(0,l.jsxs)("span",{children:["Resets ",a]})]})]})}function ef(e){let{dailyBalance:t,dailyMonthlyGranted:s,monthlyCap:a,onUpgrade:n}=e;return null!=a?(0,l.jsxs)("div",{children:[(0,l.jsx)(ex,{showCreditTotals:!0,dailyBalance:t,dailyMonthlyGranted:s}),(0,l.jsx)("p",{className:"mt-2 text-xs text-foreground/60",children:"Refresh credits currently follow Free plan limits."})]}):(0,l.jsxs)("div",{className:"flex flex-col border-t border-gray-4 pt-3 mt-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-[15px] font-medium text-foreground/80",children:[(0,l.jsx)(F.gU,{className:"size-4"}),"Daily refresh credits",(0,l.jsx)(eu,{onUpgrade:n,tooltip:"Refresh credits are granted daily, with no monthly limit on paid plans."})]}),(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:t.toLocaleString()})]}),(0,l.jsxs)("span",{className:"text-[13px] text-foreground/60",children:["Refreshes to ",i.ee.toLocaleString()," daily \xb7 No rollover"]})]})}function eh(e){let{userId:t,...s}=e,{data:a,isError:n}=(0,m.I)({queryKey:_.l.billing.dailyCreditPolicy(t),queryFn:()=>(0,p.Vg)("/api/billing/daily-credit-policy"),enabled:!!t});return a?(0,l.jsx)(ef,{...s,monthlyCap:a.monthly_cap}):(0,l.jsx)("div",{"aria-live":"polite",className:"mt-3 border-t border-gray-4 pt-3 text-sm text-foreground/60",children:n?"Unable to load daily refresh limits.":"Checking daily refresh limits…"})}let eg=(0,y.h)("BillingTab"),ep="rounded-full bg-gray-12 text-gray-1 hover:bg-gray-11",eb=(0,K.cn)(ep,"h-9 gap-1.5 !px-4"),ey={free:"Free",basic:"Basic",plus:"Plus",pro:"Pro"},ev={active:{label:"Active",className:"bg-green-3 text-green-11"},trialing:{label:"Trial",className:"bg-teal-3 text-teal-11"},past_due:{label:"Past Due",className:"bg-amber-3 text-amber-11"},canceled:{label:"Canceled",className:"bg-red-3 text-red-11"},unpaid:{label:"Unpaid",className:"bg-red-3 text-red-11"},incomplete:{label:"Incomplete",className:"bg-slate-3 text-slate-11"},paused:{label:"Paused",className:"bg-slate-3 text-slate-11"}},ej={label:"Processing",className:"bg-slate-3 text-slate-11"};function eN(e){var t,s,a,n,o,c,d,f,h,b,y,v,j,N,w,C,A,k,E,T,S;let{userId:B,onError:G,onSuccess:V,onUpgrade:q,billingTrigger:Y}=e,[X,Z]=(0,x.useState)(null),[et,es]=(0,x.useState)(25),[el,er]=(0,x.useState)(!0),[ec,ed]=(0,x.useState)(!1),[eu,em]=(0,x.useState)(!1),ef=(0,x.useRef)(0),[eN,ew]=(0,x.useState)(null),[e_,eC]=(0,x.useState)(null),eA=(0,u.jE)(),{track:ek}=(0,g.s)(),{data:eE,isFetching:eT,error:eS}=(0,m.I)({queryKey:_.l.billing.status,queryFn:()=>(0,p.Vg)("/api/billing/status"),enabled:!!B});(0,x.useEffect)(()=>{el&&!eT&&er(!1)},[el,eT]),(0,x.useEffect)(()=>
1{if("stripe-cancel"!==new URLSearchParams(window.location.search).get("from"))return;let e=!1,t=0,s=async()=>{if(!e){try{if((await eA.fetchQuery({queryKey:_.l.billing.status,queryFn:()=>(0,p.Vg)("/api/billing/status")})).cancel_at_period_end)return}catch(e){}(t+=1)<6&&setTimeout(s,1e3)}};s();let a=window.location.pathname+window.location.hash;return window.history.replaceState({},"",a),()=>{e=!0}},[eA]);let eL=null!=(t=null==eE?void 0:eE.plan_id)?t:i.VL.Free,eP=eL!==i.VL.Free,eI=void 0!==eE&&(0,eo.n)({planId:eE.plan_id,cancelAtPeriodEnd:eE.cancel_at_period_end,paymentProvider:eE.payment_provider}),{data:eR}=(0,m.I)({queryKey:_.l.billing.autoRecharge,queryFn:()=>(0,p.Vg)("/api/billing/auto-recharge"),enabled:i.It&&!!B&&eP});(0,x.useEffect)(()=>{(null==eR?void 0:eR.monthly_budget_usd)&&es(eR.monthly_budget_usd)},[null==eR?void 0:eR.monthly_budget_usd]);let eD=(0,z.n)({mutationFn:e=>(0,p.mu)("/api/billing/auto-recharge",e),onSuccess:()=>{eA.invalidateQueries({queryKey:_.l.billing.autoRecharge}),eA.invalidateQueries({queryKey:_.l.billing.status})},onError:e=>{eg.error("Failed to update auto recharge",e),null==G||G("Failed to update auto recharge settings.")}}),eO=(0,z.n)({mutationFn:()=>(0,p.$P)("/api/billing/portal",{return_url:window.location.href,flow:"cancel"}),onSuccess:e=>{let{portal_url:t}=e;em(!1),t&&window.location.assign(t)},onError:e=>{eg.error("Failed to open cancellation portal",e),null==G||G("Failed to open cancellation portal. Please try again.")}}),eU=(0,z.n)({mutationFn:async()=>{let e=ef.current;return{offer:await (0,p.Vg)("/api/billing/retention-offer"),attempt:e}},onSuccess:e=>{let{offer:t,attempt:s}=e;if(s===ef.current){if(!t.eligible)return void eO.mutate();em(!1),ew({percentOff:t.percent_off,months:t.months,currentAmount:t.current_amount,discountedAmount:t.discounted_amount,currency:t.currency})}},onError:e=>{eg.error("Failed to load retention offer",e),eO.mutate()}}),eF=(0,z.n)({mutationFn:()=>(0,p.$P)("/api/billing/retention-offer/accept",{}),onSuccess:e=>{ew(null),eC({discountedAmount:e.discounted_amount,regularAmount:e.regular_amount,currency:e.currency,discountEnd:e.discount_end,months:e.months,percentOff:e.percent_off})},onError:e=>{eg.error("Failed to apply retention discount",e),ew(null),null==G||G("Could not apply the discount. Please try again.")}}),eM=(0,z.n)({mutationFn:()=>(0,p.$P)("/api/billing/subscription/reactivate",{}),onSuccess:()=>{ek(r.X.SubscriptionReactivated,{plan_id:eL}),eA.invalidateQueries({queryKey:_.l.billing.status}),null==V||V("Subscription reactivated successfully.")},onError:e=>{eg.error("Failed to reactivate subscription",e),null==G||G("Failed to reactivate subscription. Please try again.")}}),ez=async e=>{try{Z("payment_method_update"===e?"payment_method_update":"manage"),ek(r.X.StripePortalOpened,{plan_id:eL}),await (0,M.rz)(async()=>{let{portal_url:t}=await (0,p.$P)("/api/billing/portal",{return_url:window.location.href,...e?{flow:e}:{}});if(!t)throw Error("billing portal returned no url");return t})}catch(e){eg.error("Failed to open billing portal",e),null==G||G("Failed to open billing portal. Please try again.")}finally{Z(null)}};if(el&&eT)return(0,l.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,l.jsx)(D.y,{size:"size-5"})});if(eS)return(0,l.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,l.jsx)("p",{className:"text-sm text-foreground/80",children:"Failed to load billing information."})});let eB=null!=(s=ey[eL])?s:"Free",eG=null==eE?void 0:eE.subscription_status,eV=(0,Q.k1)(eG,null==eE?void 0:eE.payment_processing),eK=eV===Q.Qc.Processing?ej:eG?ev[eG]:null,e$=eV===Q.Qc.Failed,eq=(0,Q.zO)(eG,null==eE?void 0:eE.payment_provider),eH=(0,Q.lo)(eq,null==eE?void 0:eE.payment_failure),eY=null==eE?void 0:eE.credits,eW=null!=(a=null==eY?void 0:eY.total_balance)?a:0,eQ=null!=(n=null==eY?void 0:eY.debt)?n:0,eX=eY?(0,H.e)(eY):0,eZ=(0,H.V)(null!=(o=null==eY?void 0:eY.subscription_balance)?o:0),eJ=(0,H.V)(null!=(c=null==eY?void 0:eY.daily_balance)?c:0),e0=(0,H.V)(null!=(d=null==eY?void 0:eY.bonus_balance)?d:0),e1=(0,H.V)((null!=(f=null==eY?void 0:eY.recharge_balance)?f:0)+(null!=(h=null==eY?void 0:eY.prev_recharge_balance)?h:0)),e5=(0,H.V)(eQ),e2=(0,H.V)(null!=(b=null==eY?void 0:eY.quota)?b:0),e3=(0,H.V)(null!=(y=null==eY?void 0:eY.event_balance)?y:0),e4=(0,H.V)(null!=(v=null==eY?void 0:eY.daily_monthly_granted)?v:0),e6=eW>0&&(null!=(j=null==eY?void 0:eY.quota)?j:0)>0&&eW/(null!=(N=null==eY?void 0:eY.quota)?N:1)<.2&&0===eQ,e8=(null==eE?void 0:eE.billing_interval)==="yearly"?function(e,t,s){if(!e||!s)return null;let a=new Date(e),n=new Date,l=a.getUTCFullYear(),r=a.getUTCMonth(),i=a.getUTCDate(),o=(n.getUTCFullYear()-l)*12+(n.getUTCMonth()-r),c=new Date(s),d=c.getUTCFullYear(),u=(d-l)*12+(c.getUTCMonth()-r)<o?o:o+1;if(u>11)return t;let m=r+u,x=l+Math.floor(m/12),f=m%12,h=Math.min(i,new Date(Date.UTC(x,f+1,0)).getUTCDate());return new Date(Date.UTC(x,f,h)).toISOString()}(null!=(w=null==eE?void 0:eE.current_period_start)?w:null,null!=(C=null==eE?void 0:eE.current_period_end)?C:null,null!=(A=null==eY?void 0:eY.last_reset_at)?A:null):null,e7=e8?new Date(e8).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null,e9=(null==eE?void 0:eE.current_period_end)?new Date(eE.current_period_end).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null,te=null!=(k=null==eR?void 0:eR.enabled)&&k,tt=null!=(E=null==eR?void 0:eR.monthly_charged_usd)?E:0,ts=null!=(T=null==eR?void 0:eR.monthly_budget_usd)?T:et,ta=et>=i.r5&&et<=i.xl,tn=tt>ts,tl=ta?(0,i.yv)(et):null;return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[eV===Q.Qc.Processing&&(0,l.jsx)(J,{planId:eL,status:eG}),e$&&eH&&(0,l.jsx)(W,{action:eH,pending:"payment_method_update"===X,onAction:()=>{try{ek("past_due_notice_clicked",{surface:"billing_tab",...(0,Q.LQ)({planId:eL,status:eG,provider:null==eE?void 0:eE.payment_provider,failure:null==eE?void 0:eE.payment_failure}),...(0,Q.PW)(Y)})}catch(e){eg.error("Failed to track past_due_notice_clicked",e)}let e=eH.storeUrl;if(!e)return void ez("payment_method_update");(0,M.PQ)(e)}}),(0,l.jsxs)("section",{"data-slot":"plan-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Plan"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xl font-semibold text-foreground",children:eB}
1),eK&&(0,l.jsx)("span",{className:(0,K.cn)("rounded-full px-2 py-0.5 text-[11px] font-medium",eK.className),children:eK.label})]}),(null==eE?void 0:eE.billing_interval)&&(0,l.jsxs)("span",{className:"text-[13px] text-foreground/80 capitalize",children:[eE.billing_interval," billing"]})]}),(0,l.jsxs)(I.$n,{type:"button",size:"sm",className:eb,onClick:()=>null==q?void 0:q({trigger:null!=Y?Y:"settings_billing"}),children:[(0,l.jsx)(F.Kl,{className:"size-5"}),"Upgrade"]})]}),e9&&eP&&(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)("span",{className:"text-[13px] text-foreground/80",children:(null==eE?void 0:eE.cancel_at_period_end)?"Access until":"Next billing date"}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:e9}),(null==eE?void 0:eE.payment_provider)&&(0,l.jsx)("span",{className:"rounded-full border border-gray-6 px-2 py-0.5 text-[11px] font-medium text-foreground/60",children:(0,ee.bN)(eE.payment_provider)})]})]}),(null==eE?void 0:eE.cancel_at_period_end)&&(0,l.jsx)("div",{className:"rounded-lg border border-amber-6 bg-amber-2 px-4 py-3",children:(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("p",{className:"text-sm text-amber-11",children:(0,ee.ws)(null==eE?void 0:eE.payment_provider)?"Your subscription is set to cancel at the end of the current period. Turn auto-renew back on in ".concat((0,ee.HM)(null==eE?void 0:eE.payment_provider),"."):"Your subscription is set to cancel at the end of the current period."}),(0,ee.fx)(null==eE?void 0:eE.payment_provider)&&(0,l.jsx)(I.$n,{type:"button",variant:"outline",size:"sm",onClick:()=>eM.mutate(),disabled:eM.isPending,className:"shrink-0",children:eM.isPending?"Reactivating...":"Reactivate"})]})})]}),(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-2",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Credits"}),(0,l.jsxs)("div",{className:"flex flex-col rounded-xl border border-gray-4 bg-gray-2 p-4",children:[eQ>0&&eW<=0&&(0,l.jsx)("div",{className:"rounded-lg border border-red-6 bg-red-2 px-4 py-2 mb-3",children:(0,l.jsx)("p",{className:"text-sm text-red-11",children:"Credits exhausted. AI features are paused until balance is restored."})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-m font-medium text-foreground/80",children:[(0,l.jsx)(F.Kl,{className:"size-5"}),"Total credits"]}),(0,l.jsx)("span",{className:(0,K.cn)("text-xl font-semibold",e5>0?"text-red-11":e6?"text-amber-11":"text-foreground"),children:eX.toLocaleString()})]}),(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between pt-1.5 text-foreground/60",children:[(0,l.jsx)("span",{className:"text-sm",children:"Free credits"}),(0,l.jsx)("span",{className:"text-sm font-medium",children:e0.toLocaleString()})]}),eP?(0,l.jsxs)(l.Fragment,{children:[e2>0&&(0,l.jsxs)("div",{className:"flex flex-col pt-1.5 text-foreground/60",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-sm",children:"Plan credits"}),(0,l.jsxs)("span",{className:"text-sm font-medium",children:[eZ.toLocaleString()," / ",e2.toLocaleString()]})]}),e7&&(0,l.jsxs)("span",{className:"text-[12px] text-foreground/40",children:["Resets on ",e7]})]}),e3>0&&(0,l.jsxs)("div",{className:"flex items-center justify-between pt-1.5 text-foreground/60",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-sm",children:["Event credits",(0,l.jsxs)(U.Tooltip,{children:[(0,l.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(L.u,{className:"size-3.5 cursor-help",weight:"fill"})}),(0,l.jsx)(U.TooltipContent,{side:"top",className:"max-w-60",children:"Credits from events, promotions, or compensation."})]})]}),(0,l.jsx)("span",{className:"text-sm font-medium",children:e3.toLocaleString()})]}),(0,l.jsx)(eh,{userId:B,dailyBalance:eJ,dailyMonthlyGranted:e4,onUpgrade:q})]}):(0,l.jsxs)(l.Fragment,{children:[e3>0&&(0,l.jsxs)("div",{className:"flex items-center justify-between pt-1.5 text-foreground
1/60",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-sm",children:["Event credits",(0,l.jsxs)(U.Tooltip,{children:[(0,l.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(L.u,{className:"size-3.5 cursor-help",weight:"fill"})}),(0,l.jsx)(U.TooltipContent,{side:"top",className:"max-w-60",children:"Credits from events, promotions, or compensation."})]})]}),(0,l.jsx)("span",{className:"text-sm font-medium",children:e3.toLocaleString()})]}),(0,l.jsx)(ex,{dailyBalance:eJ,dailyMonthlyGranted:e4,onUpgrade:q})]}),i.ne&&(e1>0||eP)&&(0,l.jsxs)("div",{className:"flex flex-col border-t border-gray-4 pt-3 mt-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-[15px] font-medium text-foreground/80",children:[(0,l.jsx)(F.rr,{className:"size-4"}),"Add-on credits",eI&&(0,l.jsx)(I.$n,{type:"button",size:"xs",className:(0,K.cn)("ml-1 h-7 !px-3 text-[13px]",ep),onClick:()=>ed(!0),children:"Top Up"})]}),(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:e1.toLocaleString()})]}),(0,l.jsx)("span",{className:"text-[13px] text-foreground/60",children:"Purchased credits — never expire"})]})]})]})]}),i.It&&eP&&(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Auto Recharge"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Auto-recharge credits"}),(0,l.jsx)("span",{className:"text-[13px] text-foreground/80",children:"Automatically top up when balance runs out"})]}),(0,l.jsx)(O.d,{checked:te,onCheckedChange:e=>{eD.mutate({enabled:e,monthly_budget_usd:et})},disabled:eD.isPending,className:"data-[state=unchecked]:bg-slate-8 h-[18px] dark:data-[state=unchecked]:bg-slate-7"})]}),te&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4 border-t border-gray-4 pt-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Monthly budget"}),(0,l.jsxs)("span",{className:"text-[13px] text-foreground/80",children:["$",i.r5,"–$",i.xl]}),et<i.r5?(0,l.jsxs)("span",{className:"text-[13px] text-red-11",children:["Minimum budget is $",i.r5]}):et>i.xl?(0,l.jsxs)("span",{className:"text-[13px] text-red-11",children:["Maximum budget is $",i.xl]}):tn?(0,l.jsx)("span",{className:"text-[13px] text-amber-11",children:"This month's usage exceeds the current budget"}):null!==tl?(0,l.jsxs)("span",{className:"text-[13px] text-foreground/80",children:["$",tl," per recharge"]}):null]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-sm text-foreground/80",children:"$"}),(0,l.jsx)("input",{type:"number",min:i.r5,max:i.xl,value:et,onChange:e=>es(Number(e.target.value)),onBlur:()=>{var e;et<i.r5||et>i.xl||et!==(null==eR?void 0:eR.monthly_budget_usd)&&eD.mutate({enabled:null!=(e=null==eR?void 0:eR.enabled)&&e,monthly_budget_usd:et})},className:"w-20 rounded-md border border-input bg-background px-3 py-1.5 text-right text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,l.jsxs)("div",{className:"flex flex-col border-t border-gray-4 pt-3",children:[(0,l.jsx)("span",{className:"text-[13px] text-foreground/80",children:"This month"}),(0,l.jsxs)("span",{className:"text-sm font-medium text-foreground",children:["$",tt," / $",ts,tt>=ts&&(0,l.jsx)("span",{className:"ml-1 text-amber-11",children:"\xb7 Limit reached"})]})]})]})]}),eP&&(0,ee.fx)(null==eE?void 0:eE.payment_provider)&&(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-2",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Billing"}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>ez("payment_method_update"),disabled:null!==X,className:"flex items-center gap-1.5 rounded-full border border-gray-4 bg-gray-2 px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-gray-3 disabled:cursor-not-allowed disabled:opacity-50",children:["payment_method_update"===X?"Opening...":"Update payment method",(0,l.jsx)(P.k,{className:"size-4 text-foreground
1/70",weight:"fill"})]}),(0,l.jsxs)("button",{type:"button",onClick:()=>ez(),disabled:null!==X,className:"flex items-center gap-1.5 rounded-full border border-gray-4 bg-gray-2 px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-gray-3 disabled:cursor-not-allowed disabled:opacity-50",children:["manage"===X?"Opening...":"Invoices",(0,l.jsx)(P.k,{className:"size-4 text-foreground/70",weight:"fill"})]})]}),!(null==eE?void 0:eE.cancel_at_period_end)&&(0,l.jsx)("button",{type:"button",onClick:()=>em(!0),disabled:eO.isPending,className:"mt-2 self-start rounded-full border border-gray-4 bg-background px-4 py-2 text-sm font-medium text-red-9 transition-colors hover:bg-gray-2 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel subscription"})]}),eP&&(0,ee.ws)(null==eE?void 0:eE.payment_provider)&&(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-2",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Billing"}),(0,l.jsx)("p",{className:"text-[13px] text-foreground/70",children:"Your subscription is billed through ".concat((0,ee.bN)(null==eE?void 0:eE.payment_provider),". Payment method, plan changes and cancellation are managed in ").concat((0,ee.HM)(null==eE?void 0:eE.payment_provider),".")}),(0,l.jsxs)("button",{type:"button",onClick:()=>{let e=(0,ee.gz)(null==eE?void 0:eE.payment_provider);e&&(0,M.PQ)(e)},className:"flex items-center gap-1.5 self-start rounded-full border border-gray-4 bg-gray-2 px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-gray-3",children:["Manage subscription",(0,l.jsx)(P.k,{className:"size-4 text-foreground/70",weight:"fill"})]})]}),i.ne&&eI&&(0,l.jsx)(ei.TopupModal,{open:ec,onOpenChange:ed,onSeePlans:()=>{ed(!1),null==q||q({trigger:"topup_modal_see_plans"})}}),eP&&(0,l.jsx)($,{open:eu,onOpenChange:e=>e?em(!0):void(ef.current+=1,em(!1)),planName:eB,periodEndIso:null!=(S=null==eE?void 0:eE.current_period_end)?S:null,topupBalance:e1,autoRechargeEnabled:i.It&&te,onConfirm:()=>eU.mutate(),isConfirming:eU.isPending||eO.isPending}),eN&&(0,l.jsx)(ea,{open:!0,onOpenChange:e=>{e||ew(null)},offer:eN,onAccept:()=>eF.mutate(),onDecline:()=>eO.mutate(),isAccepting:eF.isPending,isDeclining:eO.isPending}),e_&&(0,l.jsx)(en,{open:!0,applied:e_,onDone:()=>
1{eC(null),eA.invalidateQueries({queryKey:_.l.billing.status})}})]})}var ew=s(223540),e_=s(616594);let eC=new Set([]);function eA(e){return Array.isArray(e.scopes)?e.scopes.filter(e=>"string"==typeof e):[]}function ek(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function eE(){var e;let t=(0,u.jE)(),{track:s}=(0,g.s)(),[a,n]=(0,x.useState)(null),{data:r}=(0,m.I)({queryKey:_.l.tokens.list(),queryFn:()=>(0,p.Vg)("/api/tokens")}),i=(0,z.n)({mutationFn:async e=>(await (0,p.Al)("/api/tokens/".concat(e.token_id)),e),onSuccess:e=>{t.invalidateQueries({queryKey:_.l.tokens.list()});let a=eA(e);s("cli_token_revoked_from_settings",{has_spending_scope:a.some(e=>eC.has(e)),scope_count:a.length}),n(null)}}),o=null!=r?r:[];return 0===o.length?null:(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[o.map(e=>{var t;let s=eA(e).filter(e=>eC.has(e));return(0,l.jsxs)("div",{className:"flex items-start justify-between gap-6",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,l.jsx)(ew.u,{weight:"fill",className:"mt-0.5 size-5 shrink-0 text-foreground/40"}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,l.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:null!=(t=e.name)?t:"CLI"}),(0,l.jsx)("span",{"data-testid":"last-used-".concat(e.token_id),className:"text-sm text-foreground/60",children:function(e){let t=ek(e.created_at),s=ek(e.last_used_at);return[t?"Signed in ".concat(t):null,s?"Last used ".concat(s):"Never used"].filter(Boolean).join(" \xb7 ")}(e)}),s.length>0&&(0,l.jsxs)("span",{"data-testid":"spends-".concat(e.token_id),className:"flex items-center gap-1.5 text-sm text-foreground/60",children:[(0,l.jsx)(e_.g,{weight:"fill",className:"size-4 shrink-0"}),"Can spend credits (",s.join(", "),")"]})]})]}),(0,l.jsx)("button",{type:"button","data-testid":"revoke-".concat(e.token_id),onClick:()=>{i.reset(),n(e)},className:"shrink-0 text-sm font-medium text-foreground/60 hover:text-foreground",children:"Revoke"})]},e.token_id)}),(0,l.jsx)(E.Lt,{open:null!==a,onOpenChange:e=>!e&&n(null),children:(0,l.jsxs)(E.EO,{children:[(0,l.jsxs)(E.wd,{children:[(0,l.jsxs)(E.r7,{children:["Revoke ",null!=(e=null==a?void 0:a.name)?e:"this credential","?"]}),(0,l.jsx)(E.$v,{children:"That machine stops working immediately, and finds out by failing. Signing in again from it issues a new credential."})]}),i.isError&&(0,l.jsx)("p",{"data-testid":"revoke-error",role:"alert",className:"text-sm text-foreground/60",children:"Could not revoke this credential — it still works. Try again."}),(0,l.jsxs)(E.ck,{children:[(0,l.jsx)(E.Zr,{children:"Keep"}),(0,l.jsx)(E.Rx,{"data-testid":"confirm-revoke",onClick:e=>{e.preventDefault(),a&&!i.isPending&&i.mutate(a)},children:"Revoke"})]})]})})]})}function eT(){return"".concat(window.location.origin,"/SKILL.md")}function eS(){return(0,l.jsxs)("div",{"data-testid":"connect-agent-entry",className:"flex flex-col gap-2 rounded-lg border border-border bg-muted/30 p-4",children:[(0,l.jsx)("p",{className:"text-sm text-foreground",children:"Paste this into Claude Code or Codex:"}),(0,l.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted/60 px-3 py-2 font-mono text-sm text-foreground",children:(0,l.jsxs)("code",{children:["set up ",eT()]})}),(0,l.jsx)("p",{className:"text-sm text-foreground/60",children:"You will be asked to approve once in your browser."})]})}function eL(){return(0,l.jsxs)("p",{"data-testid":"add-another-machine",className:"text-sm text-foreground/60",children:["Add another computer: paste ",(0,l.jsxs)("code",{className:"font-mono",children:["set up ",eT()]})," into Claude Code or Codex."]})}function eP(){let{track:e}=(0,g.s)(),{cli_onboarding_entry_enabled:t}=(0,j.h)(),{data:s,isLoading:a,isError:n,isSuccess:r}=(0,m.I)({queryKey:_.l.tokens.list(),queryFn:()=>(0,p.Vg)("/api/tokens")}),i=(null!=s?s:[]).length>0,o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{r&&!o.current&&(o.current=!0,e("cli_settings_tab_viewed",{has_credentials:i,onboarding_entry_visible:t}))},[r,i,t,e]),(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("header",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"CLI"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}
1),n&&(0,l.jsx)("p",{className:"text-sm text-foreground/60",children:"Could not load your machines. Reopen this tab to try again."}),!a&&!n&&!i&&t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"text-sm text-foreground/60",children:"Let Claude Code, Codex, or any other agent you use control your SureThing resources — pages, websites, agents, and connected apps like Gmail and Slack."}),(0,l.jsx)(eS,{})]}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eE,{}),t&&(0,l.jsx)(eL,{})]})]})}var eI=s(600016),eR=s(60060),eD=s(434455),eO=s(327257),eU=s(327541),eF=s(681083),eM=s(945888),ez=s(912965),eB=s(292468),eG=s(44048);let eV=(0,y.h)("ConnectionsTab");function eK(e){return"gmail"===e||"google-calendar"===e||"google_calendar"===e}function e$(e){let{userId:t,onSuccess:s,onError:a}=e,n=(0,f.GZ)(),r=(0,eU.useRouter)(),i=(0,k.l)(e=>e.closeModal);return n?(0,l.jsx)(eq,{userId:t,onSuccess:s,onError:a}):(0,l.jsxs)("div",{className:"flex flex-col items-start gap-4 py-6",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Connected apps"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connections are now managed on the Connectors page — connect new apps, reconnect, disconnect, and choose which agents can use each account."})]}),(0,l.jsx)(I.$n,{type:"button",variant:"outline",size:"sm",radius:"pill",onClick:()=>{i(),r.push("/integrations")},children:"Open Connectors"})]})}function eq(e){var t;let{userId:s,onSuccess:a,onError:n}=e,r=(0,u.jE)(),i=(0,f.GZ)(),o=(0,eB.y)(e=>e.openModal),c=(0,k.l)(e=>e.closeModal),h=(0,eU.usePathname)(),b=(0,eG.D)(h),{track:y}=(0,g.s)(),[v,j]=(0,x.useState)(null),[N,w]=(0,x.useState)(new Set),[C,A]=(0,x.useState)(null),{connect:T,connectingSlug:S}=(0,ez.L)({surface:"settings"}),[L,P]=(0,x.useState)(null),O=(0,x.useCallback)(async e=>{var t;if("surething"===e.provider){if(L===e.platform)return;try{P(e.platform),await (0,eM.o)(e.platform,{platformLabel:e.name})}catch(t){eV.error("Failed to reconnect surething connector",t,{platform:e.platform}),null==n||n("Failed to reconnect. Please try again.")}finally{P(null)}return}T({slug:e.platform,name:e.name,description:null,logo:null!=(t=e.logo)?t:"",categories:[]})},[T,n,L]),{data:U,isLoading:F}=(0,m.I)({queryKey:_.l.connections.all,queryFn:()=>(0,p.Vg)("/api/connections"),enabled:!!s}),M=null!=(t=null==U?void 0:U.connectors)?t:[],z=(0,eF.hk)(),B="paired"===z.status.state,G=(0,x.useCallback)(()=>{y("connector_entry_clicked",{entry:"settings_connections_tab"}),i&&(0,d.Y5)()?(c(),(0,d.TU)(b)):(c(),requestAnimationFrame(()=>{o(b)}))},[b,c,i,o,y]),V=async e=>{let{id:t,platform:s,provider:l}=e;try{if(j(t),"google"===l){let e="google-calendar"===s||"google_calendar"===s?"calendar":"gmail";await (0,p.Al)("/api/connections/gmail?service=".concat(e))}else await (0,p.Al)("/api/connections/accounts/".concat(t));A(null),null==a||a("".concat(e.name," disconnected successfully")),w(e=>new Set(e).add(t)),setTimeout(()=>{r.setQueryData(_.l.connections.all,e=>{var s;return{connectors:(null!=(s=null==e?void 0:e.connectors)?s:[]).filter(e=>e.id!==t)}}),w(e=>{let s=new Set(e);return s.delete(t),s}),r.invalidateQueries({queryKey:_.l.connections.all}),r.invalidateQueries({queryKey:_.l.integrations.manage}),r.invalidateQueries({queryKey:_.l.integrations.agentServicesBase})},300)}catch(e){eV.error("Failed to disconnect",e,{platform:s}),null==n||n("Failed to disconnect. Please try again."),A(null),r.invalidateQueries({queryKey:_.l.connections.all}),r.invalidateQueries({queryKey:_.l.integrations.manage}),r.invalidateQueries({queryKey:_.l.integrations.agentServicesBase})}finally{j(null)}};if(F&&0===M.length)return(0,l.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,l.jsx)(D.y,{size:"size-5"})});let $=M.find(e=>e.id===C),q=$&&eK($.platform)&&M.some(e=>e.platform!==$.platform&&eK(e.platform)),H=$?"Disconnect ".concat($.name,"?"):"",W=$?q?"This will disconnect ".concat($.name,". Your ").concat("gmail"===$.platform?"Google Calendar":"Gmail"," will remain connected."):"This will disconnect ".concat($.name,". You can reconnect at any time."):"";return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Connected apps"}),(0,l.jsxs)(I.$n,{type:"button",variant:"outline",size:"sm",radiu
1s:"pill",onClick:G,className:"gap-1.5 border-gray-5 bg-card text-slate-12 shadow-xs hover:bg-gray-2 hover:text-slate-12",children:[(0,l.jsx)(eI.c,{className:"size-4",weight:"bold"}),"Add Connectors"]})]}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),M.length>0||B?(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-2xl bg-gray-3 p-2",children:[M.map(e=>(0,l.jsxs)("div",{className:(0,K.cn)("rounded-xl bg-card p-4 transition-all duration-300 dark:border dark:border-white/10 md:p-5",N.has(e.id)&&"scale-95 opacity-0"),children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 md:gap-4",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3 md:gap-4",children:[(0,l.jsx)("div",{className:"flex size-11 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-2 dark:bg-white",children:(0,l.jsx)(eH,{connector:e})}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"truncate text-base font-semibold text-foreground",children:e.name}),(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,l.jsx)(eY,{status:e.status}),(e.email||e.accountIdentifier)&&(0,l.jsxs)("span",{className:"truncate text-xs text-muted-foreground",children:["\xb7 ",e.email||e.accountIdentifier]})]})]})]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:["needs_auth"===e.status&&(0,l.jsx)(I.$n,{type:"button",onClick:()=>O(e),variant:"outline",size:"sm",className:"rounded-full",disabled:S===e.platform||L===e.platform,children:S===e.platform||L===e.platform?"Reconnecting...":"Reconnect"}),(0,l.jsx)(I.$n,{onClick:()=>A(e.id),variant:"outline",size:"sm",className:"rounded-full border-gray-6 text-gray-11 hover:border-red-6 hover:bg-red-2 hover:text-red-11 dark:border-slate-7 dark:text-slate-10 dark:hover:border-red-8 dark:hover:bg-red-3/40 dark:hover:text-red-10",disabled:v===e.id,children:"Disconnect"})]})]}),e.serviceDisabledReason&&(0,l.jsxs)("div",{className:"mt-3 flex items-start gap-3 rounded-xl bg-teal-3 p-4",children:[(0,l.jsx)(Y.M,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-teal-9",weight:"fill"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-teal-12",children:"gmail"===e.platform?"Mail service is not enabled":"Calendar service is not enabled"}),(0,l.jsx)("p",{className:"mt-0.5 text-xs text-teal-11",children:"Your organization may restrict this API access, or this account type doesn't support this feature."})]})]})]},e.id)),(0,l.jsx)(eF.R_,{bridge:z})]}):(0,l.jsx)("div",{className:"flex flex-col items-center gap-3 py-8",children:(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"No connected apps yet"})})]}),(0,l.jsx)(E.Lt,{open:!!C,onOpenChange:e=>!e&&A(null),children:(0,l.jsxs)(E.EO,{children:[(0,l.jsxs)(E.wd,{children:[(0,l.jsx)(E.r7,{children:H}),(0,l.jsx)(E.$v,{children:W})]}),(0,l.jsxs)(E.ck,{children:[(0,l.jsx)(I.$n,{onClick:()=>A(null),variant:"outline",size:"sm",className:"rounded-full",disabled:!!v,children:"Never mind"}),(0,l.jsx)(I.$n,{onClick:()=>{$&&V($)},variant:"destructive",size:"sm",className:"rounded-full",disabled:!!v,children:v?"Disconnecting...":"Disconnect"})]})]})})]})}function eH(e){let{connector:t}=e;return"gmail"===t.platform?(0,l.jsx)(eD.A,{className:"h-6 w-6"}):"google-calendar"===t.platform||"google_calendar"===t.platform?(0,l.jsx)(eO.A,{className:"h-6 w-6"}):(0,l.jsx)(eR.D,{logoUrl:t.logo,name:t.name,className:"text-foreground/70"})}function eY(e){let{status:t}=e;return"needs_auth"===t?(0,l.jsxs)("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-amber-11 dark:text-amber-10",children:[(0,l.jsx)("span",{className:"size-1.5 rounded-full bg-amber-9","aria-hidden":!0}),"Reconnect needed"]}):"disabled"===t?(0,l.jsxs)("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-gray-10 dark:text-slate-10",children:[(0,l.jsx)("span",{className:"size-1.5 rounded-full bg-gray-8","aria-hidden":!0}),"Disabled"]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-gray-10 dar
1k:text-slate-10",children:[(0,l.jsx)("span",{className:"size-1.5 rounded-full bg-green-9","aria-hidden":!0}),"Connected"]})}var eW=s(141286);let eQ=[{value:eW.hs,label:"Claude Haiku",provider:"anthropic",userVisible:!1},{value:eW.yb,label:"GPT-5.6 Luna",provider:"openai",userVisible:!1},{value:eW.Am,label:"GPT-5.6 Terra",provider:"openai",userVisible:!1},{value:eW.q3,label:"GPT-6 Luna",provider:"openai",userVisible:!1},{value:eW.SP,label:"GPT-6 Sol",provider:"openai",userVisible:!1},{value:eW.YY,label:"GPT-6.1 Sol",provider:"openai",userVisible:!1},{value:eW.w9,label:"Claude Sonnet",provider:"anthropic",userVisible:!1},{value:eW.DR,label:"Claude Sonnet 4.6",provider:"anthropic",userVisible:!1},{value:eW.tZ,label:"Claude Sonnet 5",provider:"anthropic",userVisible:!1},{value:eW.nS,label:"Claude Sonnet 5.5",provider:"anthropic",userVisible:!0},{value:eW.bD,label:"Claude Opus 4.6",provider:"anthropic",userVisible:!0},{value:eW.if,label:"Claude Opus 4.7",provider:"anthropic",userVisible:!1},{value:eW.bi,label:"Claude Opus 4.8",provider:"anthropic",userVisible:!1},{value:eW.zI,label:"Claude Opus 5",provider:"anthropic",userVisible:!0},{value:eW.BV,label:"Claude Opus 5.5",provider:"anthropic",userVisible:!0},{value:eW.aP,label:"Claude Fable 5",provider:"anthropic",userVisible:!1},{value:eW.Iw,label:"Claude Fable 5.1",provider:"anthropic",userVisible:!0},{value:eW.sO,label:"Gemini 3 Flash Preview",provider:"google",userVisible:!1},{value:eW.$P,label:"Gemini 3.5 Flash",provider:"google",userVisible:!1}],eX=eQ.filter(e=>e.userVisible),eZ={[eW.aP]:eW.Iw,[eW.tZ]:eW.nS},eJ={assistantChat:eW.nS};function e0(e){let{title:t,description:s,status:a,children:n}=e;return(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-4 roun
1ded-lg border border-border bg-card p-5",children:[(0,l.jsxs)("header",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsx)("h3",{className:"text-base font-medium text-foreground",children:t}),a&&(0,l.jsx)(e1,{status:a})]}),(0,l.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:s})]}),n]})}function e1(e){let{status:t}=e,s=function(e){switch(e){case"emerald":return"bg-emerald-500";case"amber":return"bg-amber-500";case"destructive":return"bg-destructive";case"muted":return"bg-muted-foreground/40"}}(t.tone),a=function(e){switch(e){case"emerald":return"text-emerald-600";case"amber":return"text-amber-600";case"destructive":return"text-destructive";case"muted":return"text-muted-foreground"}}(t.tone);return(0,l.jsxs)("span",{className:(0,K.cn)("inline-flex items-center gap-1.5 text-xs font-medium",a),children:[(0,l.jsx)("span",{className:(0,K.cn)("inline-block h-1.5 w-1.5 rounded-full",s)}),t.label]})}let e5=(0,y.h)("ChatModelSection"),e2=null!=(n=null==(a=eQ.find(e=>e.value===eJ.assistantChat))?void 0:a.label)?n:eJ.assistantChat;function e3(e){let{userId:t,onError:s}=e,{data:a}=(0,m.I)({queryKey:_.l.settings.preferences(null!=t?t:""),queryFn:()=>(0,p.Vg)("/api/settings/".concat(t,"/preferences")),enabled:!!t,staleTime:6e4,refetchOnWindowFocus:"always"}),[n,r]=(0,x.useState)({}),[i,o]=(0,x.useState)(!1);(0,x.useEffect)(()=>{if(a){var e;r(null!=(e=a.labsModels)?e:{})}},[a]);let c=async e=>{if(!t||i)return;let a={...n};if(null===e){let{assistantChat:e,...t}=n;r(t)}else r({...n,assistantChat:e});o(!0);try{await (0,p.mu)("/api/settings/".concat(t,"/preferences"),{labsModels:null===e?{assistantChat:void 0}:{assistantChat:e}})}catch(n){e5.error("Failed to save labs model",n,{userId:t,model:e}),r(a),null==s||s("Failed to save model selection")}finally{o(!1)}},d=new Set(eX.filter(e=>!1!==e.available).map(e=>e.value)),u=n.assistantChat?function(e){let t=e;for(let e=0;e<8;e+=1){let e=eZ[t];if(!e||e===t)break;t=e}return t}(n.assistantChat):void 0,f=!u||!d.has(u),h=f?eJ.assistantChat:u;return(0,l.jsx)(e0,{title:"Chat model",description:"Choose the model used for your chat replies. When a chat carries a model tier (Lite / Standard / Smart / Ultra), your pick only takes effect as a newer version within that tier's model family, while a pick from a different family keeps the tier's model. Routines, email processing, digests, and other background work continue to use the system default.",status:f?{tone:"muted",label:"default"}:{tone:"amber",label:null!=h?h:"custom"},children:(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)(e4,{label:"Use default",sublabel:"System default (".concat(e2,")"),selected:f,disabled:i,onClick:()=>c(null)}),eX.map(e=>{let t=!1===e.available;return(0,l.jsx)(e4,{label:e.label,sublabel:e.provider,selected:!f&&h===e.value,disabled:i||t,unavailable:t,onClick:()=>c(e.value)},e.value)})]})})}function e4(e){let{label:t,sublabel:s,selected:a,disabled:n,unavailable:r,onClick:i}=e;return(0,l.jsxs)("button",{type:"button",onClick:i,disabled:n,"aria-disabled":n,className:(0,K.cn)("relative flex items-center justify-between rounded-md border px-3 py-2.5 text-left transition-colors",a?"border-foreground bg-foreground
1/5":"border-input text-foreground",!n&&!a&&"hover:border-ring hover:bg-accent/50",n&&"cursor-not-allowed opacity-50"),children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:t}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground capitalize",children:s})]}),r?(0,l.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Currently unavailable"}):a&&(0,l.jsx)(B.S,{className:"size-4 text-foreground",weight:"bold"})]})}function e6(e){let{userId:t,onError:s}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("header",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Labs"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Try experimental settings before they become part of the main product. These controls may change as we learn from usage."})]}),(0,l.jsx)(e3,{userId:t,onError:s})]})}var e8=s(894353),e7=s(867576),e9=s(809588),te=s(493632),tt=s(466180);let ts="h-10 text-base";function ta(e){let{open:t,onOpenChange:s,onSuccess:a}=e,{track:n}=(0,g.s)(),r={current:(0,x.useId)(),next:(0,x.useId)(),confirm:(0,x.useId)()},[i,o]=(0,x.useState)(""),[c,d]=(0,x.useState)(""),[u,m]=(0,x.useState)(""),[f,h]=(0,x.useState)(!1),[p,b]=(0,x.useState)(null),y=(0,x.useRef)(t);y.current=t,(0,x.useEffect)(()=>{if(!t){o(""),d(""),m(""),b(null);return}n("account_password_dialog_opened",{mode:"change"})},[t,n]);let v=async e=>{if(e.preventDefault(),null!==(0,e7.Oj)(c))return void b("".concat(e7.Nn,"."));if(c!==u)return void b("The two passwords do not match.");h(!0),b(null);try{let e=await (0,te.ec)(i,c);if(!e.ok){n("account_password_submitted",{mode:"change",result:"error",error_code:e.error.code}),y.current&&b((0,tt.m)(e.error,"change_password"));return}n("account_password_submitted",{mode:"change",result:"success"}),a(),s(!1)}finally{h(!1)}},j=!f&&i.length>0&&c.length>0&&u.length>0;return(0,l.jsx)(V.lG,{open:t,onOpenChange:e=>f&&!e?void 0:s(e),children:(0,l.jsx)(V.Cf,{bottomSheetOnMobile:!0,className:"sm:max-w-[460px]",children:(0,l.jsxs)("form",{onSubmit:v,"data-slot":"password-dialog",className:"flex flex-col gap-5",children:[(0,l.jsxs)(V.c7,{className:"text-left",children:[(0,l.jsx)(V.L3,{className:"text-xl text-balance",children:"Change password"}),(0,l.jsx)(V.rr,{className:"text-pretty",children:"Enter your current password, then choose a new one. Other devices will be signed out."})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("label",{htmlFor:r.current,className:"text-sm font-medium text-foreground",children:"Current password"}),(0,l.jsx)(e9.p,{id:r.current,type:"password",autoComplete:"current-password",placeholder:"Enter current password",value:i,onChange:e=>o(e.target.value),disabled:f,required:!0,className:ts})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("label",{htmlFor:r.next,className:"text-sm font-medium text-foreground",children:"New password"}),(0,l.jsx)(e9.p,{id:r.next,type:"password",autoComplete:"new-password",placeholder:"Enter new password",value:c,onChange:e=>d(e.target.value),disabled:f,required:!0,className:ts}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"12 or more characters, with letters, numbers and symbols."})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("label",{htmlFor:r.confirm,className:"text-sm font-medium text-foreground",children:"Confirm new password"}),(0,l.jsx)(e9.p,{id:r.confirm,type:"password",autoComplete:"new-password",placeholder:"Re-enter new password",value:u,onChange:e=>m(e.target.value),disabled:f,required:!0,className:ts})]}),p&&(0,l.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:p})]}),(0,l.jsxs)(V.Es,{children:[(0,l.jsx)(I.$n,{type:"button",variant:"outline",disabled:f,onClick:()=>s(!1),children:"Cancel"}
1),(0,l.jsx)(I.$n,{type:"submit",disabled:!j,children:f?"Saving…":"Change password"})]})]})})})}var tn=s(400785),tl=s(364145),tr=s(588836),ti=s(236172),to=s(24560);function tc(e){let{className:t,type:s,...a}=e;return(0,l.jsx)("input",{type:s,"data-slot":"input",className:(0,K.cn)("flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/70 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-gray-8 focus-visible:ring-[3px] focus-visible:ring-gray-8/10","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40","search"===s&&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none","file"===s&&"p-0 pr-3 text-muted-foreground/70 italic file:me-3 file:h-full file:border-0 file:border-r file:border-solid file:border-input file:bg-transparent file:px-3 file:text-sm file:font-medium file:text-foreground file:not-italic",t),...a})}var td=s(690550),tu=s(942334);let tm="#f5f5f4",tx="#e7e5e4",tf="#a8a29e",th="#ffffff",tg="#3B7A79",tp="#2c2c2c",tb="#3a3a3a",ty="#6b6b6b",tv="#383838",tj="#3B7A79",tN={light:function(){return(0,l.jsxs)("svg",{viewBox:"0 0 180 80",className:"size-full",children:[(0,l.jsx)("rect",{width:"180",height:"80",rx:"6",fill:tm}),(0,l.jsx)("rect",{x:"10",y:"8",width:"120",height:"10",rx:"2",fill:tx}),(0,l.jsx)("rect",{x:"10",y:"24",width:"80",height:"5",rx:"1.5",fill:tf}),(0,l.jsx)("rect",{x:"10",y:"33",width:"56",height:"5",rx:"1.5",fill:tf}),(0,l.jsx)("rect",{x:"10",y:"46",width:"160",height:"24",rx:"3",fill:th}),(0,l.jsx)("circle",{cx:"20",cy:"58",r:"4",fill:tg}),(0,l.jsx)("rect",{x:"30",y:"55",width:"48",height:"5",rx:"1.5",fill:tf})]})},system:function(){return(0,l.jsxs)("svg",{viewBox:"0 0 180 80",className:"size-full",children:[(0,l.jsxs)("defs",{children:[(0,l.jsx)("clipPath",{id:"left-half",children:(0,l.jsx)("rect",{x:"0",y:"0",width:"90",height:"80"})}),(0,l.jsx)("clipPath",{id:"right-half",children:(0,l.jsx)("rect",{x:"90",y:"0",width:"90",height:"80"})}),(0,l.jsx)("clipPath",{id:"card-clip",children:(0,l.jsx)("rect",{width:"180",height:"80",rx:"6"})})]}),(0,l.jsxs)("g",{clipPath:"url(#card-clip)",children:[(0,l.jsxs)("g",{clipPath:"url(#left-half)",children:[(0,l.jsx)("rect",{width:"180",height:"80",rx:"6",fill:tm}),(0,l.jsx)("rect",{x:"10",y:"8",width:"120",height:"10",rx:"2",fill:tx}),(0,l.jsx)("rect",{x:"10",y:"24",width:"80",height:"5",rx:"1.5",fill:tf}),(0,l.jsx)("rect",{x:"10",y:"33",width:"56",height:"5",rx:"1.5",fill:tf}),(0,l.jsx)("rect",{x:"10",y:"46",width:"160",height:"24",rx:"3",fill:th}),(0,l.jsx)("circle",{cx:"20",cy:"58",r:"4",fill:tg}),(0,l.jsx)("rect",{x:"30",y:"55",width:"48",height:"5",rx:"1.5",fill:tf})]}),(0,l.jsxs)("g",{clipPath:"url(#right-half)",children:[(0,l.jsx)("rect",{width:"180",height:"80",rx:"6",fill:tp}),(0,l.jsx)("rect",{x:"10",y:"8",width:"120",height:"10",rx:"2",fill:tb}),(0,l.jsx)("rect",{x:"10",y:"24",width:"80",height:"5",rx:"1.5",fill:ty}),(0,l.jsx)("rect",{x:"10",y:"33",width:"56",height:"5",rx:"1.5",fill:ty}),(0,l.jsx)("rect",{x:"10",y:"46",width:"160",height:"24",rx:"3",fill:tv}),(0,l.jsx)("circle",{cx:"20",cy:"58",r:"4",fill:tj}),(0,l.jsx)("rect",{x:"30",y:"55",width:"48",height:"5",rx:"1.5",fill:ty})]}),(0,l.jsx)("line",{x1:"90",y1:"0",x2:"90",y2:"80",stroke:"#78716c",strokeWidth:"0.5"})]})]})},dark:function(){return(0,l.jsxs)("svg",{viewBox:"0 0 180 80",className:"size-full",children:[(0,l.jsx)("rect",{width:"180",height:"80",rx:"6",fill:tp}),(0,l.jsx)("rect",{x:"10",y:"8",width:"120",height:"10",rx:"2",fill:tb}),(0,l.jsx)("rect",{x:"10",y:"24",width:"80",height:"5",rx:"1.5",fill:ty}),(0,l.jsx)("rect",{x:"10",y:"33",width:"56",height:"5",rx:"1.5",fill:ty}),(0,l.jsx)("rect",{x:"10",y:"46",width:"160",height:"24",rx:"3",fill:tv}),(0,l.jsx)("circle",{cx:"20",cy:"58",r:"4",fill:tj}),(0,l.jsx)("rect",{x:"30",y:"55",width:"48",height:"5",rx:"1.5",fill:ty})]})}};function tw(e){let{mode:t,label:s,selected:a,onClick:n}=e,r=tN[t];return(0,l.jsxs)("button",{type:"button",onClick:n,className:(0,K.cn)("flex flex-col items-center gap-1.5 rounded-lg border p-1.5 transition-colors",a?"border-foreground bg-foreground
1/5":"border-input hover:border-ring hover:bg-foreground/[0.02]"),children:[(0,l.jsx)("div",{className:"w-full overflow-hidden rounded",children:(0,l.jsx)(r,{})}),(0,l.jsx)("span",{className:(0,K.cn)("text-xs font-medium",a?"text-foreground":"text-muted-foreground"),children:s})]})}let t_=[{label:"Americas",timezones:[{value:"America/New_York",label:"New York",offset:"UTC-5/-4"},{value:"America/Chicago",label:"Chicago",offset:"UTC-6/-5"},{value:"America/Denver",label:"Denver",offset:"UTC-7/-6"},{value:"America/Los_Angeles",label:"Los Angeles",offset:"UTC-8/-7"},{value:"America/Phoenix",label:"Phoenix",offset:"UTC-7"},{value:"America/Anchorage",label:"Anchorage",offset:"UTC-9/-8"},{value:"America/Toronto",label:"Toronto",offset:"UTC-5/-4"},{value:"America/Vancouver",label:"Vancouver",offset:"UTC-8/-7"},{value:"America/Mexico_City",label:"Mexico City",offset:"UTC-6"},{value:"America/Bogota",label:"Bogot\xe1",offset:"UTC-5"},{value:"America/Lima",label:"Lima",offset:"UTC-5"},{value:"America/Santiago",label:"Santiago",offset:"UTC-4/-3"},{value:"America/Buenos_Aires",label:"Buenos Aires",offset:"UTC-3"},{value:"America/Sao_Paulo",label:"S\xe3o Paulo",offset:"UTC-3"},{value:"America/Havana",label:"Havana",offset:"UTC-5/-4"}]},{label:"Europe",timezones:[{value:"Europe/London",label:"London",offset:"UTC+0/+1"},{value:"Europe/Dublin",label:"Dublin",offset:"UTC+0/+1"},{value:"Europe/Lisbon",label:"Lisbon",offset:"UTC+0/+1"},{value:"Europe/Paris",label:"Paris",offset:"UTC+1/+2"},{value:"Europe/Berlin",label:"Berlin",offset:"UTC+1/+2"},{value:"Europe/Amsterdam",label:"Amsterdam",offset:"UTC+1/+2"},{value:"Europe/Brussels",label:"Brussels",offset:"UTC+1/+2"},{value:"Europe/Zurich",label:"Zurich",offset:"UTC+1/+2"},{value:"Europe/Vienna",label:"Vienna",offset:"UTC+1/+2"},{value:"Europe/Madrid",label:"Madrid",offset:"UTC+1/+2"},{value:"Europe/Rome",label:"Rome",offset:"UTC+1/+2"},{value:"Europe/Prague",label:"Prague",offset:"UTC+1/+2"},{value:"Europe/Warsaw",label:"Warsaw",offset:"UTC+1/+2"},{value:"Europe/Budapest",label:"Budapest",offset:"UTC+1/+2"},{value:"Europe/Stockholm",label:"Stockholm",offset:"UTC+1/+2"},{value:"Europe/Oslo",label:"Oslo",offset:"UTC+1/+2"},{value:"Europe/Copenhagen",label:"Copenhagen",offset:"UTC+1/+2"},{value:"Europe/Helsinki",label:"Helsinki",offset:"UTC+2/+3"},{value:"Europe/Bucharest",label:"Bucharest",offset:"UTC+2/+3"},{value:"Europe/Athens",label:"Athens",offset:"UTC+2/+3"},{value:"Europe/Kyiv",label:"Kyiv",offset:"UTC+2/+3"},{value:"Europe/Istanbul",label:"Istanbul",offset:"UTC+3"},{value:"Europe/Moscow",label:"Moscow",offset:"UTC+3"}]},{label:"Asia",timezones:[{value:"Asia/Dubai",label:"Dubai",offset:"UTC+4"},{value:"Asia/Riyadh",label:"Riyadh",offset:"UTC+3"},{value:"Asia/Tehran",label:"Tehran",offset:"UTC+3:30"},{value:"Asia/Jerusalem",label:"Jerusalem",offset:"UTC+2/+3"},{value:"Asia/Karachi",label:"Karachi",offset:"UTC+5"},{value:"Asia/Kolkata",label:"Mumbai",offset:"UTC+5:30"},{value:"Asia/Dhaka",label:"Dhaka",offset:"UTC+6"},{value:"Asia/Yangon",label:"Yangon",offset:"UTC+6:30"},{value:"Asia/Bangkok",label:"Bangkok",offset:"UTC+7"},{value:"Asia/Ho_Chi_Minh",label:"Ho Chi Minh",offset:"UTC+7"},{value:"Asia/Jakarta",label:"Jakarta",offset:"UTC+7"},{value:"Asia/Singapore",label:"Singapore",offset:"UTC+8"},{value:"Asia/Kuala_Lumpur",label:"Kuala Lumpur",offset:"UTC+8"},{value:"Asia/Manila",label:"Manila",offset:"UTC+8"},{value:"Asia/Shanghai",label:"Shanghai",offset:"UTC+8"},{value:"Asia/Hong_Kong",label:"Hong Kong",offset:"UTC+8"},{value:"Asia/Taipei",label:"Taipei",offset:"UTC+8"},{value:"Asia/Tokyo",label:"Tokyo",offset:"UTC+9"},{value:"Asia/Seoul",label:"Seoul",offset:"UTC+9"},{value:"Asia/Almaty",label:"Almaty",offset:"UTC+6"},{value:"Asia/Tashkent",label:"Tashkent",offset:"UTC+5"}]},{label:"Africa",timezones:[{value:"Africa/Casablanca",label:"Casablanca",offset:"UTC+1"},{value:"Africa/Cairo",label:"Cairo",offset:"UTC+2"},{value:"Africa/Lagos",label:"Lagos",offset:"UTC+1"},{value:"Africa/Nairobi",label:"Nairobi",offset:"UTC+3"},{value:"Africa/Johannesburg",label:"Johannesburg",offset:"UTC+2"},{value:"Africa/Addis_Ababa",label:"Addis Ababa",offset:"UTC+3"}]},{label:"Pacific",timezones:[{value:"Australia/Perth",label:"Perth",offset:"UTC+8"},{value:"Australia/Brisbane",label:"Brisbane",offset:"UTC+10"},{value:"Australia/Sydney",label:"Sydney",offset:"UTC+10/+11"},{value:"Australia/Melbourne",label:"Melbourne",offset:"UTC+10/+11"},{value:"Pacific/Auckland",label:"Auckland",offset:"UTC+12/+13"},{value:"Pacific/Fiji",label:"Fiji",offset:"UTC+12"},{value:"Pacific/Guam",label:"Guam",offset:"UTC+10"},{value:"Pacific/Honolulu",label:"Honolulu",offset:"UTC-10"}]},{label:"Other",timezones:[{value:"UTC",label:"UTC",offset:"UTC+0"}]}],tC=t_.flatMap(e=>e.timezones);var tA=s(735653),tk=s(928423);let tE=(0,y.h)("PreferencesTab");function tT(e){let{userId:t,onError:s}=e,a=(0,tA.Vc)(),{theme:n,setTheme:r}=(0,to.D)(),i=(0,m.I)({queryKey:_.l.settings.preferences(null!=t?t:""),queryFn:()=>(0,p.Vg)("/api/settings/".concat(t,"/preferences")),enabled:!!t,staleTime:6e4,refetchOnWindowFocus:"always"}),[o,c]=(0,x.useState)({language:"en",theme:"system"}),[d,u]=(0,x.useState)("UTC"),[f,h]=(0,x.useState)(""),[g,b]=(0,x.useState)(!1),[y,v]=(0,x.useState)(!1),j=(0,x.useRef)(null),[N,w]=(0,x.useState)("default"),[C,A]=(0,x.useState)(!1),[k,E]=(0,x.useState)(!1),T="settings:recentCustomLanguages",[S,L]=(0,x.useState)(()=>{try{var e;return JSON.parse(null!=(e=localStorage.getItem(T))?e:"[]")}catch(e){return[]}});(0,x.useEffect)(()=>
1{if(i.data){c(i.data),i.data.timezone&&u(i.data.timezone);let e=i.data.language;e&&!tr.jR.some(t=>t.code===e)&&L(t=>{if(t.includes(e))return t;let s=[e,...t].slice(0,5);return localStorage.setItem(T,JSON.stringify(s)),s})}},[i.data]),(0,x.useEffect)(()=>{let e=(0,td.KO)();A(e),w(e?(0,td.hH)():"denied")},[]);let P=async e=>{var a;if(!t)return;c(t=>({...t,...e})),null==(a=j.current)||a.abort();let n=new AbortController;j.current=n;try{let s=await (0,p.mu)("/api/settings/".concat(t,"/preferences"),e,{signal:n.signal});c(s)}catch(a){if(n.signal.aborted)return;tE.error("Failed to save preferences",a,{userId:t,updates:e}),null==s||s("Failed to save preferences")}},O=async e=>{if(t){u(e),b(!1),h(""),v(!0);try{await (0,p.mu)("/api/settings/".concat(t,"/timezone"),{timezone:e})}catch(a){tE.error("Failed to save timezone",a,{userId:t,timezone:e}),null==s||s("Failed to save timezone")}finally{v(!1)}}},U=async()=>{E(!0);try{let e=await (0,td.mT)();w(e),(0,tu.Gi)(e),"granted"===e?await (0,tA.TQ)()&&(0,tA.y$)():"denied"===e&&await (0,tA.BV)()}catch(e){tE.error("Failed to enable browser notifications",e,{userId:t}),null==s||s("Failed to enable notifications")}finally{E(!1)}},F=t_.map(e=>({...e,timezones:e.timezones.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())||e.value.toLowerCase().includes(f.toLowerCase())||e.offset.toLowerCase().includes(f.toLowerCase()))})).filter(e=>e.timezones.length>0),M=C?"granted"===N?"You'll be notified when action is needed":"denied"===N?"Blocked in your browser settings":"Not enabled yet":"Notifications are not supported in this browser";return i.isLoading?(0,l.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,l.jsx)(D.y,{size:"size-5"})}):(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[!(0,tk.mi)(navigator.userAgent)&&(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Appearance"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Theme"}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"Choose how the app looks. Auto matches your system setting."})]}),(0,l.jsx)("div",{className:"grid grid-cols-3 gap-3",children:["light","system","dark"].map(e=>(0,l.jsx)(tw,{mode:e,label:"system"===e?"Auto":"light"===e?"Light":"Dark",selected:n===e,onClick:()=>r(e)},e))})]})]}),(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Notifications"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Browser Notifications"}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:M}),!a&&C&&(0,l.jsx)("span",{className:"mt-1 text-xs text-amber-9",children:"Push notifications are not configured in this environment."}),C&&"denied"===N&&(0,l.jsx)("span",{className:"mt-1 text-xs text-amber-9",children:"Blocked in browser settings. Allow notifications for this site to enable."})]}),C&&"default"===N&&(0,l.jsx)(I.$n,{type:"button",onClick:U,disabled:!a||k,variant:"outline",size:"sm",children:k?"Enabling...":"Enable"}),C&&"granted"===N&&(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-green-9",children:[(0,l.jsx)(es.C,{className:"size-4",weight:"fill"}),(0,l.jsx)("span",{className:"text-sm font-medium",children:"Enabled"})]})]})]}),(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Language & Region"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Language"}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"Choose your preferred language for the AI responses."})]}),i.isLoading?(0,l.jsx)("div",{className:"grid grid-cols-3 gap-2",children:Array.from({length:12}).map((e,t)=>(0,l.jsx)("div",{className:"h-10 animate-pulse rounded-lg border border-input bg-muted/30"},"skeleton-".concat(t)))}):(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[S.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>P({language:e}),className:(0,K.cn)("rounded-lg border px-3 py-2 text-left text-sm font-medium transition-colors",o.language===e?"border-foreground bg-foreground
1/5 text-foreground":"border-input text-muted-foreground hover:border-ring hover:bg-foreground/[0.02]"),children:(0,tr.rJ)(e)},e)),tr.jR.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>P({language:e.code}),className:(0,K.cn)("rounded-lg border px-3 py-2 text-left text-sm font-medium transition-colors",o.language===e.code?"border-foreground bg-foreground/5 text-foreground":"border-input text-muted-foreground hover:border-ring hover:bg-foreground/[0.02]"),children:e.label},e.code))]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Timezone"}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"Set your local timezone for accurate time display."})]}),(0,l.jsxs)(ti.AM,{open:g,onOpenChange:b,modal:!0,children:[(0,l.jsx)(ti.Wv,{asChild:!0,children:(0,l.jsxs)("button",{type:"button",disabled:y,className:(0,K.cn)("flex h-9 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm text-foreground transition-colors hover:border-ring",y&&"cursor-not-allowed opacity-50"),children:[(0,l.jsx)("span",{children:(e=>{let t=tC.find(t=>t.value===e);return t?"".concat(t.label," (").concat(t.offset,")"):e})(d)}),(0,l.jsx)(tn.b,{className:"size-4 text-slate-9",weight:"fill"})]})}),(0,l.jsxs)(ti.hl,{className:"w-80 p-0",align:"start",children:[(0,l.jsxs)("div",{className:"flex items-center border-b border-input px-3",children:[(0,l.jsx)(tl.$,{className:"mr-2 size-4 shrink-0 text-slate-9",weight:"fill"}),(0,l.jsx)(tc,{placeholder:"Search timezone...",value:f,onChange:e=>h(e.target.value),className:"h-10 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0"})]}),(0,l.jsx)("div",{className:"max-h-72 overflow-y-auto p-1",children:0===F.length?(0,l.jsx)("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No timezone found"}):F.map(e=>(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.timezones.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>O(e.value),className:"relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm text-foreground outline-none hover:bg-foreground
1/5",children:[d===e.value&&(0,l.jsx)("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:(0,l.jsx)(B.S,{className:"size-4",weight:"bold"})}),(0,l.jsx)("span",{children:e.label}),(0,l.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:e.offset})]},e.value))]},e.label))})]})]})]})]})]})}var tS=s(250209),tL=s(372970),tP=s(39562),tI=s(986622),tR=s(934077),tD=s(896442),tO=s(857373),tU=s(778594),tF=s(495956),tM=s(914786),tz=s(885175),tB=s(434769),tG=s(142449),tV=s(864350),tK=s(463416),t$=s(225976),tq=s(504608),tH=s(266408),tY=s(714708),tW=s(101450);let tQ={[tI.AI.DAILY_FREE_GRANT]:tV.o,[tI.AI.RESET]:tK.o,[tI.AI.PLAN_UPGRADE]:t$.E,[tI.AI.MODIFICATION]:tV.o,[tI.AI.REFERRAL_GRANT]:tq.G,[tI.AI.MILESTONE_GRANT]:tH.w,[tI.AI.REFUND]:tY.A},tX={[tI.AI.DAILY_FREE_GRANT]:"Daily refresh credits",[tI.AI.RESET]:"Monthly subscription credits",[tI.AI.PLAN_UPGRADE]:"Plan upgrade credits",[tI.AI.MODIFICATION]:"Bonus credits",[tI.AI.REFERRAL_GRANT]:"Referral credits",[tI.AI.MILESTONE_GRANT]:"App connection credits",[tI.AI.REFUND]:"Rescued credits"};function tZ(e){var t,s;let{item:a}=e;if(a.amount<=0)return null;let n=null!=(t=tQ[a.transaction_type])?t:tW.u,r=a.transaction_type===tI.AI.MODIFICATION&&a.description===i.dJ?"New user bonus":null!=(s=tX[a.transaction_type])?s:"Credits granted";return(0,l.jsxs)("div",{className:"flex items-start gap-3 py-3",children:[(0,l.jsx)("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-slate-3 text-slate-11",children:(0,l.jsx)(n,{className:"size-4",weight:"fill"})}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:r}),(0,l.jsxs)("span",{className:"flex min-w-[50px] shrink-0 items-center justify-end gap-1 text-sm font-semibold tabular-nums text-green-11",children:[(0,l.jsx)(F.Kl,{className:"size-3.5"}),"+",a.amount]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 text-xs text-foreground/60",children:(0,l.jsx)("span",{className:"shrink-0 tabular-nums",children:new Date(a.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})})})]})]})}function tJ(e){var t,s;let{userId:a,previewState:n}=e,[i,o]=(0,x.useState)(1),[c,d]=(0,x.useState)([]),u=(0,x.useRef)(0),{track:f}=(0,g.s)(),h=!!n,b=(0,m.I)({queryKey:_.l.billing.creditGrants({page:i}),queryFn:()=>{let e=new URLSearchParams({page:String(i),page_size:String(20)});return(0,p.Vg)("/api/billing/credit-grants?".concat(e.toString()))},enabled:!!a&&!h,staleTime:0,gcTime:0}),y=null!=(t=null==n?void 0:n.data)?t:b.data,v=null!=(s=null==n?void 0:n.isFetching)?s:b.isFetching;(0,x.useEffect)(()=>{y&&(u.current=y.total,d(e=>(y.page-1)*20===e.length?[...e,...y.items]:1===y.page?y.items:e))},[y]);let j=(20*i<u.current||v)&&c.length>0,N=(0,x.useCallback)(()=>{f(r.X.CreditGrantsLoadMore,{page:i+1}),o(e=>e+1)},[f,i]);return(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[0===c.length&&v&&(0,l.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,l.jsx)(D.y,{size:"size-5"})}),0===c.length&&!v&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[(0,l.jsx)("span",{className:"text-lg",children:"\uD83C\uDF81"}),(0,l.jsx)("p",{className:"text-sm text-foreground/60",children:"No credit grants yet. You'll see your daily refresh credits, monthly subscription grants, plan upgrades, app connection credits, referral credits, and bonus credits here."})]}),c.length>0&&(0,l.jsx)("div",{className:"flex flex-col divide-y divide-slate-12/5",children:c.map(e=>(0,l.jsx)(tZ,{item:e},e.id))}),j&&(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)("button",{type:"button",onClick:N,disabled:v,className:"rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground/80 transition-colors hover:bg-accent disabled:opacity-50",children:v?"Loading...":"Load more"})})]})}let t0=(0,tD.default)(()=>Promise.all([s.e(3984),s.e(6595),s.e(7798),s.e(1653),s.e(1172),s.e(861),s.e(6322)]).then(s.bind(s,936322)).then(e=>({default:e.TaskDetailPanel})),{loadableGenerated:{webpack:()=>[936322]},ssr:!1,loading:()=>null}),t1=new Set(tI.y7),t5=new Set(["email.received","email"]),t2=new Set(tI.k3),t3={[tI.k$.TASK]:"Scheduled task",[tI.k$.EMAIL]:"Email processing",[tI.k$.USER_MESSAGE]:"Chat",[tI.k$.EMAIL_SYNC]:"Email sync",[tI.k$.EVALUATE]:"System processing",[tI.k$.SELF_REFLECTION]:"System processing",[tI.k$.HEARTBEAT]:"System processing",[tI.k$.CALENDAR_EVENT]:"Calendar event",[tI.k$.OAUTH_COMPLETED]:"Account connected",[tI.k$.EMAIL_UPDATED]:"Email update",[tI.k$.TIDY]:"System processing",[tI.k$.FILE_RESEARCH]:"File research",[tI.k$.WEBHOOK]:"Webhook call"},t4={cron:"Recurring task",delay:"Timed task",event:"Event task"},t6={ALL:"All",SCHEDULE:"Schedule",CALENDAR:"Calendar",CHAT:"Chat",EMAIL:"Email",OTHERS:"Others"},t8=["ALL","SCHEDULE","CHAT","EMAIL","CALENDAR","OTHERS"],t7={CONSUMPTION:"consumption",GRANTS:"grants"},t9={[t7.CONSUMPTION]:"Consumption",[t7.GRANTS]:"Grants"},se=[t7.CONSUMPTION,t7.GRANTS],st={completed:"text-green-11",failed:"text-red-11",running:"text-blue-11",cancelled:"text-slate-11",timeout:"text-amber-11",queued:"text-slate-11"};function ss(e){var t,s,a,n,r,i,o,c;let{item:d,onPauseTask:u,onResumeTask:m,isPausingTask:x,isResumingTask:f}=e,h=(0,tO.nD)(function(e){if(e.trigger_type===tI.k$.USER_MESSAGE)return tI.BP.CHAT;if(e.trigger_type&&t1.has(e.trigger_type))return tI.BP.EMAIL;if(e.trigger_type===tI.k$.TASK){if("delay"===e.task_trigger_type||"cron"===e.task_trigger_type)return tI.BP.SCHEDULE;if("event"===e.task_trigger_type){var t,s;let a=(null==(t=e.task_trigger)?void 0:t.type)==="event"&&null!=(s=e.task_trigger.event_type)?s:null;if(a&&t2.has(a))return tI.BP.CALENDAR;if(a&&t5.has(a))return tI.BP.EMAIL}}return tI.BP.OTHERS}(d)),g=null!=(t=st[d.status])?t:"text-slate-11",p=!!d.task_id&&(0,tB.AG)(d.task_trigger_type,null!=(s=d.task_status)?s:""),b=!!d.task_id&&(0,tB.bE)(d.task_trigger_type,null!=(a=d.task_status)?a:"");return(0,l.jsxs)("div",{className:"flex items-start gap-3 py-3",children:[(0,l.jsx)("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-slate-3 text-slate-11",children:(0,l.jsx)(h,{className:"size-4",weight:"fill"})}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,l.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:d.cell_name||(n=d.trigger_type,r=d.task_trigger_type,n===tI.k$.TASK&&r?null!=(o=null!=(i=t4[r])?i:t3[tI.k$.TASK])?o:"Scheduled task":null!=(c=n?t3[n]:void 0)?c:"Others")}),"paused"===d.task_status&&(0,l.jsx)("span",{className:"shrink-0 rounded-full bg-slate-3 px-2 py-0.5 text-[11px] font-medium text-slate-11",children:"Paused"})]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[b&&m&&(0,l.jsx)("div",{className:"flex w-[68px] justify-end",children:(0,l.jsxs)(I.$n,{type:"button",size:"xs",radius:"pill",variant:"ghost",onClick:()=>{d.task_id&&m(d.task_id)},disabled:f||x,title:"Resume this task","aria-label":"Resume task",className:"w-full justify-center bg-slate-3 px-2 text-foreground
1/70 hover:bg-slate-4 hover:text-foreground/90",children:[(0,l.jsx)(tR.$F,{className:"size-3",weight:"fill"}),(0,l.jsx)("span",{children:"Resume"})]})}),p&&u&&(0,l.jsx)("div",{className:"flex w-[68px] justify-end",children:(0,l.jsxs)(I.$n,{type:"button",size:"xs",radius:"pill",variant:"ghost",onClick:()=>{d.task_id&&u(d.task_id)},disabled:x||f,title:"Pause this task","aria-label":"Pause task",className:"w-full justify-center bg-slate-3 px-2 text-foreground/70 hover:bg-slate-4 hover:text-foreground/90",children:[(0,l.jsx)(tL.E,{className:"size-3",weight:"fill"}),(0,l.jsx)("span",{children:"Pause"})]})}),!(p&&u)&&!(b&&m)&&(0,l.jsx)("div",{className:"w-[68px]","aria-hidden":"true"}),(0,l.jsxs)("span",{className:"flex min-w-[64px] shrink-0 items-center justify-end gap-1 text-sm font-semibold tabular-nums text-foreground",children:[(0,l.jsx)(F.Kl,{className:"size-3.5"}),"-",d.total_credits]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 text-xs text-foreground/60",children:[(0,l.jsx)("span",{className:"shrink-0 tabular-nums",children:new Date(d.started_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}),d.trigger_label&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{children:"\xb7"}),(0,l.jsx)("span",{className:"truncate",children:d.trigger_label})]}),"completed"!==d.status&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{children:"\xb7"}),(0,l.jsx)("span",{className:(0,K.cn)("capitalize",g),children:d.status})]})]})]})]})}function sa(e){var t,s,a,n;let{userId:o,previewState:c}=e,[d,f]=(0,x.useState)(null!=(t=null==c?void 0:c.activeView)?t:t7.CONSUMPTION),[h,b]=(0,x.useState)(1),[y,v]=(0,x.useState)(null!=(s=null==c?void 0:c.activeFilter)?s:tI.BP.ALL),[j,N]=(0,x.useState)([]),w=(0,x.useRef)(0),A=(0,u.jE)(),{track:k}=(0,g.s)(),T=!!c,S=function(){var e;let t=(0,C.n)(e=>{var t;return null==(t=e.user)?void 0:t.id}),{data:s}=(0,m.I)({queryKey:_.l.billing.status,queryFn:()=>(0,p.Vg)("/api/billing/status"),enabled:!!t});return(null!=(e=null==s?void 0:s.plan_id)?e:i.VL.Free)!==i.VL.Free}();(0,x.useEffect)(()=>{k(r.X.UsageHistoryViewed)},[k]);let L=(0,m.I)({queryKey:_.l.billing.usageHistory({page:h,filterGroup:y}),queryFn:()=>{let e=new URLSearchParams({page:String(h),page_size:String(20)});return y!==tI.BP.ALL&&e.set("filter_group",y),(0,p.Vg)("/api/billing/usage-history?".concat(e.toString()))}
1,enabled:!!o&&!T&&d===t7.CONSUMPTION,staleTime:0,gcTime:0}),P=null!=(a=null==c?void 0:c.data)?a:L.data,I=null!=(n=null==c?void 0:c.isFetching)?n:L.isFetching,O=(0,x.useCallback)(e=>{k(r.X.UsageHistoryFiltered,{filter:e}),v(e),b(1),N([]),w.current=0},[k]),U=(0,x.useCallback)(e=>{e!==d&&(k(r.X.UsageTabSwitched,{view:e}),f(e))},[d,k]);(0,x.useEffect)(()=>{P&&(w.current=P.total,N(e=>(P.page-1)*20===e.length?[...e,...P.items]:1===P.page?P.items:e))},[P]);let[F,M]=(0,x.useState)(null),B=(0,z.n)({mutationFn:e=>(0,p.$P)("/api/tasks/".concat(e,"/deactivate")),onSuccess:(e,t)=>{N(s=>s.map(s=>{var a;return s.task_id===t?{...s,task_status:null!=(a=e.status)?a:"paused"}:s})),A.invalidateQueries({queryKey:["billing","usage-history"]}),(0,tz.K)(A)}}),G=(0,z.n)({mutationFn:e=>(0,p.$P)("/api/tasks/".concat(e,"/activate")),onSuccess:(e,t)=>{N(s=>s.map(s=>{var a;return s.task_id===t?{...s,task_status:null!=(a=e.status)?a:"pending"}:s})),A.invalidateQueries({queryKey:["billing","usage-history"]}),(0,tz.K)(A)}}),V=(0,x.useCallback)(()=>{F&&(k(r.X.UsageTaskStopped,{task_id:F}),B.mutate(F),M(null))},[F,B,k]),$=(0,x.useCallback)(e=>{G.mutate(e)},[G]),q=20*h<w.current,H=(0,x.useCallback)(()=>{k(r.X.UsageHistoryLoadMore,{page:h+1}),b(e=>e+1)},[k,h]);return(0,l.jsxs)("section",{"data-slot":"settings-section",className:"flex flex-col gap-5",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("h2",{className:"font-serif text-lg font-semibold text-foreground",children:"Usage History"}),(0,l.jsx)(R.w,{className:"bg-slate-12/10"}),(0,l.jsxs)("div",{className:"flex items-center gap-6 border-b border-slate-12/10",children:[se.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>U(e),className:(0,K.cn)("relative -mb-px h-10 text-sm font-medium transition-colors",d===e?"text-foreground":"text-foreground/60 hover:text-foreground/90"),children:[t9[e],d===e&&(0,l.jsx)("span",{"aria-hidden":"true",className:"absolute inset-x-0 bottom-0 h-0.5 bg-foreground"})]},e)),!T&&S&&(0,l.jsx)("div",{className:"ml-auto pb-1.5",children:(0,l.jsx)(sn,{})})]})]}),d===t7.CONSUMPTION&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"flex items-center gap-1.5",children:t8.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>O(e),className:(0,K.cn)("h-8 rounded-full px-4 text-sm font-medium transition-colors",y===e?"bg-slate-12 text-slate-1":"bg-slate-3 text-foreground/70 hover:bg-slate-4 hover:text-foreground/90"),children:t6[e]},e))}),0===j.length&&I&&(0,l.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,l.jsx)(D.y,{size:"size-5"})}),0===j.length&&!I&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[(0,l.jsx)(tP.C,{className:"size-5 text-slate-11",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm text-foreground/60",children:"No usage history yet. Credits will be consumed when you chat with your assistant or when background tasks run."})]}),j.length>0&&(0,l.jsx)("div",{className:"flex flex-col divide-y divide-slate-12/5",children:j.map(e=>(0,l.jsx)(ss,{item:e,onPauseTask:e=>M(e),onResumeTask:$,isPausingTask:B.isPending,isResumingTask:G.isPending},e.id))}),q&&(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)("button",{type:"button",onClick:H,disabled:I,className:"rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground/80 transition-colors hover:bg-accent disabled:opacity-50",children:I?"Loading...":"Load more"})})]}),d===t7.GRANTS&&(0,l.jsx)(tJ,{userId:o}),(0,l.jsx)(E.Lt,{open:!!F,onOpenChange:e=>!e&&M(null),children:(0,l.jsxs)(E.EO,{children:[(0,l.jsxs)(E.wd,{children:[(0,l.jsx)(E.r7,{children:"Pause Task"}),(0,l.jsx)(E.$v,{className:"text-sm text-foreground/70",children:"Are you sure you want to pause this task? You can turn it back on again later."})]}),(0,l.jsxs)(E.ck,{children:[(0,l.jsx)(E.Zr,{children:"Cancel"}),(0,l.jsx)(E.Rx,{onClick:V,className:"bg-red-9 text-white hover:bg-red-10",children:"Pause"})]})]})})]})}function sn(){let[e,t]=(0,x.useState)(!1),s=(0,tG.Z)(e=>e.isOpen),{latestCompleted:a,suggestionsCount:n,unread:r}
1=(0,tM.L)(),i=(null==a?void 0:a.completed_at)?(0,tU.v)(a.completed_at):void 0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(I.$n,{type:"button",variant:"outline",size:"sm",radius:"pill",title:i,className:(0,K.cn)("gap-1.5 shadow-xs",r?"border-amber-6 bg-amber-2 text-amber-11 hover:bg-amber-3 hover:text-amber-11":"border-gray-5 bg-card text-slate-12 hover:bg-gray-2 hover:text-slate-12"),onClick:()=>t(!0),children:["Spending review",n>0?(0,l.jsx)("span",{className:(0,K.cn)("inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-semibold tabular-nums",r?"bg-amber-3 text-amber-11":"bg-slate-3 text-foreground/70"),children:n}):null]}),(0,l.jsx)(tF.a,{open:e,onOpenChange:t,source:"usage_tab"}),s?(0,l.jsx)(t0,{}):null]})}let sl=(0,y.h)("SettingsModal");function sr(e){return(null==e?void 0:e.trim().toLowerCase())||""}function si(){var e,t,s,a,n,y;let E=(0,C.n)(e=>e.user),L=null==E?void 0:E.id,{track:P}=(0,g.s)(),I=(0,f.GZ)(),{isOpen:R,activeTab:D,billingTrigger:O,openModal:U,closeModal:F,setActiveTab:M}=(0,k.l)(),[z,B]=(0,x.useState)(!1),[G,V]=(0,x.useState)(!1),[K,$]=(0,x.useState)(null),[q,H]=(0,x.useState)(null),Y=(0,u.jE)(),{data:W}=(0,m.I)({queryKey:_.l.billing.status,queryFn:()=>(0,p.Vg)("/api/billing/status"),enabled:!!L&&R}),{isOpen:Q,trigger:X,initialFaqKey:Z,closePricingModal:J}=(0,A.s)(),ee=(0,N.w)(),et=async()=>{try{if(B(!0),I){(0,d.rU)(),await (0,b.B)();return}await (0,b.B)(),F(),window.location.href="/login"}catch(e){sl.error("Failed to sign out",e,{userId:L}),c.toast.error("Failed to sign out. Please try again.")}finally{B(!1)}},[es,ea]=(0,x.useState)(null),en=(0,x.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=(null==E?void 0:E.email)||"",a=o(e),n=o(s),l=sr(e)===sr(s);t.acknowledgedCanceledRemaining||P(r.X.AccountDeletionConfirmAttempted,{confirm_input_shape:a,expected_email_shape:n,is_match:l});try{V(!0),c.toast.info("Deleting your account..."),await (0,p.$P)("/api/settings/account/delete",{confirmEmail:e,...t.acknowledgedCanceledRemaining?{acknowledged_canceled_remaining:!0}:{}}),P(r.X.AccountDeletionRequested,{confirm_input_shape:a}),c.toast.success("Account deleted. Signing out...");try{localStorage.clear()}catch(e){v.warn("Failed to clear localStorage after account deletion",e)}try{sessionStorage.clear()}catch(e){v.warn("Failed to clear sessionStorage after account deletion",e)}if(await (0,b.B)(),I)return void(0,d.rU)();F(),window.location.href="/login"}catch(t){if(t instanceof p.uZ&&409===t.statusCode){var i;let s=null!=(i=t.error.details)?i:{},a="string"==typeof s.plan_id?s.plan_id:void 0;if("ACTIVE_SUBSCRIPTION_PRESENT"===t.error.code){c.toast.dismiss(),ea(e),$({planId:a});return}if("SUBSCRIPTION_CANCELED_WITH_REMAINING_PERIOD"===t.error.code){c.toast.dismiss(),ea(e),H({planId:a,remainingDays:"number"==typeof s.remaining_days?s.remaining_days:void 0,currentPeriodEnd:"string"==typeof s.current_period_end?s.current_period_end:void 0});return}}sl.error("Failed to delete account",t,{userId:L}),P(r.X.AccountDeletionRequestFailed,{confirm_input_shape:a}),c.toast.error("Failed to delete account. Please try again.")}finally{V(!1)}},[F,I,P,null==E?void 0:E.email,L]),el=e=>{en(e)},er=(0,x.useCallback)(()=>{$(null),ea(null),U("billing","account_deletion_blocked")},[U]),ei=(0,x.useCallback)(()=>{es&&en(es,{acknowledgedCanceledRemaining:!0}).finally(()=>{H(null)})},[es,en]),eo=(0,x.useCallback)(()=>{let e=Y.getQueryData(_.l.billing.status),t=null!=e?e:W;if(!t)return!0;let s=t.plan_id,a=t.subscription_status,n=!0===t.cancel_at_period_end,l=a===i.it.Active||a===i.it.Trialing||a===i.it.PastDue;return"free"===s||!l||!!n||($({planId:s}),!1)},[W,Y]),ec=(0,x.useCallback)(e=>{c.toast.error(e)},[]),ed=(0,x.useCallback)(e=>{c.toast.success(e)},[]),eu=function(e){let t=(0,u.jE)(),[s,a]=(0,x.useState)(!1),{data:n}=(0,m.I)({queryKey:_.l.account.providers,queryFn:async()=>{var e;let t=await (0,te.CR)();if(!t.ok)throw Error(null!=(e=t.error.message)?e:"list-accounts failed");return t.data},enabled:e.enabled,staleTime:6e4}),l=(null==n?void 0:n.includes("credential"))?{onManage:()=>a(!0)}:void 0,r=e.onSaved,i=(0,x.useCallback)(()=>{r("Password changed."),t.invalidateQueries({queryKey:_.l.account.providers})},[r,t]);return{signInMethods:n?[...n].sort((e,t)=>
1Number("credential"===t)-Number("credential"===e)):void 0,password:l,dialog:{open:s,onOpenChange:a,onSuccess:i}}}({enabled:R&&!!E,onSaved:ed}),em=E?{displayName:(null==(e=E.name)?void 0:e.trim())||(null==(t=E.email)?void 0:t.split("@")[0])||"User",email:E.email||"",username:null==(s=E.email)?void 0:s.split("@")[0],avatarUrl:null!=(a=E.image)?a:void 0}:void 0,{labs_enabled:ex,cli_onboarding_entry_enabled:ef}=(0,j.h)(),eh=(0,w._)(),{data:eg}=(0,m.I)({queryKey:_.l.tokens.list(),queryFn:()=>(0,p.Vg)("/api/tokens"),enabled:R&&!ef&&!eh}),ep=(null!=(n=null==eg?void 0:eg.length)?n:0)>0,eb=(0,x.useMemo)(()=>(function(e){if(e.isReviewSession)return["account"];let t=["account","preferences","connections"];return(e.cliOnboardingEntryEnabled||e.hasCliCredentials)&&t.push("cli"),t.push("memory","billing","usage"),e.isLabsEnabled&&t.push("labs"),t})({isReviewSession:eh,isLabsEnabled:ex,cliOnboardingEntryEnabled:ef,hasCliCredentials:ep}),[eh,ex,ef,ep]);(0,x.useEffect)(()=>{if(R&&I&&(0,d.E7)())return(0,d.yL)(F,{title:"Settings"}),()=>{(0,d.vd)()}},[R,I,F]);let ey=eb.includes(D)?D:null!=(y=eb[0])?y:"account";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tS.bB,{open:R,onOpenChange:e=>{e||F()},activeTab:ey,onTabChange:M,user:em,visibleTabs:eb,tabLabels:{account:"Profile"},hideNavigation:I,children:(()=>{switch(ey){case"account":return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tS.zu,{user:em,signInMethods:eu.signInMethods,password:eu.password}),(0,l.jsx)(ta,{...eu.dialog}),(0,l.jsx)(tS.vA,{user:em,isSigningOut:z,onSignOut:et}),(0,l.jsx)(tS.$4,{email:null==em?void 0:em.email,isDeletingAccount:G,onDeleteAccount:el,onDeleteAccountIntent:eo})]});case"preferences":return(0,l.jsx)(tT,{userId:L,onError:ec});case"memory":return(0,l.jsx)(e8.M,{userId:L,onSuccess:ed,onError:ec});case"connections":return(0,l.jsx)(e$,{userId:L,onSuccess:ed,onError:ec});case"cli":return(0,l.jsx)(eP,{});case"labs":return(0,l.jsx)(e6,{userId:L,onError:ec});case"billing":return(0,l.jsx)(eN,{userId:L,onSuccess:ed,onError:ec,onUpgrade:ee,billingTrigger:O});case"usage":return(0,l.jsx)(sa,{userId:L});default:return null}})()}),(0,l.jsx)(h.PricingModal,{open:Q,onOpenChange:e=>!e&&J(),trigger:X,initialFaqKey:Z}),(0,l.jsx)(T,{open:!!K,onOpenChange:e=>{e||($(null),ea(null))},planId:null==K?void 0:K.planId,onGoToBilling:er}),(0,l.jsx)(S,{open:!!q,onOpenChange:e=>{e||(H(null),ea(null))},planId:null==q?void 0:q.planId,remainingDays:null==q?void 0:q.remainingDays,currentPeriodEnd:null==q?void 0:q.currentPeriodEnd,isConfirming:G,onConfirmDelete:ei})]})}},942334:(e,t,s)=>{s.d(t,{Gi:()=>b,aZ:()=>f,mj:()=>g,uv:()=>p,yf:()=>h});var a=s(386768),n=s(690550),l=s(735653),r=s(516872);let i=[7,30,90];function o(e){let t=(0,r.bi)(e);if(!t)return null;let s=Number(t);return Number.isFinite(s)?s:null}function c(e,t){(0,r.FX)(e,String(t))}function d(e){return"true"===(0,r.bi)(e)}function u(e,t){(0,r.FX)(e,t?"true":"false")}function m(){u(a.j1.PROMPT_DO_NOT_ASK,!0)}function x(){var e,t;let s=(null!=(t=o(a.j1.PROMPT_DISMISS_COUNT))?t:0)+1;c(a.j1.PROMPT_DISMISS_COUNT,s);let n=Math.min(s-1,i.length-1),l=null!=(e=i[n])?e:i[0],r=Date.now()+864e5*l;c(a.j1.PROMPT_SNOOZE_UNTIL,r),s>=i.length&&m()}function f(){return d(a.j1.PROMPT_GATE_ACTIVATED)}function h(){f()||(u(a.j1.PROMPT_GATE_ACTIVATED,!0),window.dispatchEvent(new CustomEvent(a.XQ.NOTIFICATION_PROMPT_GATE_ACTIVATED)))}function g(){if(!f()||!(0,n.KO)()||!(0,l.Vc)()||"default"!==(0,n.hH)()||((0,r.bi)(a.j1.LEGACY_DISMISSED)&&(u(a.j1.PROMPT_DO_NOT_ASK,!0),(0,r.Pw)(a.j1.LEGACY_DISMISSED)),d(a.j1.PROMPT_DO_NOT_ASK)))return!1;let e=o(a.j1.PROMPT_SNOOZE_UNTIL);return!(e&&e>Date.now())}function p(){x()}function b(e){return"granted"===e?void((0,r.Pw)(a.j1.PROMPT_SNOOZE_UNTIL),(0,r.Pw)(a.j1.PROMPT_DISMISS_COUNT),(0,r.Pw)(a.j1.PROMPT_DO_NOT_ASK)):"denied"===e?void m():void x()}},986622:(e,t,s)=>{s.d(t,{AI:()=>o,k3:()=>i,y7:()=>r,BP:()=>l,k$:()=>n});var a=s(13073);let n={TASK:"task",EMAIL:"email",USER_MESSAGE:"user_message",WEBHOOK:"webhook",EMAIL_SYNC:"email_sync",EVALUATE:"evaluate",SELF_REFLECTION:"self_reflection",HEARTBEAT:"heartbeat",CALENDAR_EVENT:"calendar_event",OAUTH_COMPLETED:"oauth_completed",EMAIL_UPDATED:"email_updated",TIDY:"tidy",FILE_RESEARCH:"file_research",ONBOARDING_RUN:"onboarding_run"};n.USER_MESSAGE;let l={ALL:"ALL",SCHEDULE:"SCHEDULE",CALENDAR:"CALENDAR",CHAT:"CHAT",EMAIL:"EMAIL",OTHERS:"OTHERS"},r=[n.EMAIL,n.EMAIL_SYNC,n.EMAIL_UPDATED],i=[a.X1.CREATED,a.X1.UPDATED,a.X1.CANCELLED];n.TASK,n.USER_MESSAGE,[...r],n.EVALUATE,n.SELF_REFLECTION,n.HEARTBEAT,n.CALENDAR_EVENT,n.OAUTH_COMPLETED,n.TIDY,n.FILE_RESEARCH;let o={DAILY_FREE_GRANT:"daily_free_grant",RESET:"reset",PLAN_UPGRADE:"plan_upgrade",MODIFICATION:"modification",REFERRAL_GRANT:"referral_grant",MILESTONE_GRANT:"milestone_grant",REFUND:"refund"};o.DAILY_FREE_GRANT,o.RESET,o.PLAN_UPGRADE,o.MODIFICATION,o.REFERRAL_GRANT,o.MILESTONE_GRANT,o.REFUND}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.