PageSourceSearch

https://tryconnekt.com/assets/dashboard-B9V7asP0.js

js tryconnekt.com collected 2026-10-02 01:46:51 UTC 91,688 bytes, 1 lines download raw bytes

1import{r as i,j as e,a as Fe,b as st}from"./index-BGezTjGx.js";import{c as Le,P as Ke,u as Bt,a as A,b as Ee,d as Ge,R as Ut,e as We,A as qt,f as Ht,h as Vt,g as Kt,i as Gt,F as Wt,D as Yt,C as Xt,j as je,k as Xn,l as rt,V as Qn,m as Qt,n as Zt,o as Zn,I as Jn,p as Jt,q as es,r as ts,T as en,s as tn,t as nn,v as ns,w as sn,x as ss,S as rn,y as on,z as an,B as ln,E as rs,U as os,G as as,H as is,J as ls,K as cs,L as Re,M as ds,N as us,O as ps,Q as ms,W as fs,X as hs}from"./DashboardShell-J3-_Q-Wq.js";import{u as xs,K as gs}from"./KeyboardHint-BuzV1Iay.js";import{A as cn}from"./api-Cn2saL-5.js";import{f as dn}from"./stripe-Bdw5RntL.js";import{G as vs,F as bs,a as un,b as ys}from"./planLimits-e1UkNKhD.js";import{S as me,B as F,c as js}from"./button-D3wmQuRn.js";import{T as ot}from"./textarea-D6eHOcCI.js";import{B as Q}from"./badge-Cs57JPoP.js";import{c as ae}from"./index-CcyIbcaG.js";import{u as ee,c as pn,I as ge}from"./index-C3zVpQPF.js";import{P as V,r as mn,L as fe,C as Ss}from"./label-DGXjj64F.js";import{C as fn}from"./chevron-down-ClwQSgbQ.js";import{C as at}from"./check-Kw45fIYH.js";import{c as we}from"./createLucideIcon-DdfQtFzQ.js";import{S as Oe}from"./sparkles-Dab42xIz.js";import{t as Ne}from"./names-BPndJhzJ.js";import{M as _e}from"./search-BuXTxqkF.js";import{L as ws,C as Cs}from"./link-2-uHQgI6Do.js";import{B as ks}from"./building-complex-CXy85BpC.js";import{D as it,a as lt,b as ct,c as dt,d as ut,e as pt}from"./dialog-DN0RfVyZ.js";import{S as hn,C as Ns}from"./send-BYSXssjB.js";import{X as Ye}from"./x-D2y-LThH.js";import{c as _s,s as Ts}from"./shortlists-CiVX3zNg.js";import{C as Ps}from"./copy-Cwh_QgwZ.js";import{S as Is}from"./shield-check-DaAtO2L1.js";const xn={name:"bookmark",size:24,node:[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]]};xn.node;const gn=we(xn);const vn={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};vn.node;const Rs=we(vn);const bn={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};bn.node;const Es=we(bn);const yn={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};yn.node;const As=we(yn);const jn={name:"languages",size:24,node:[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]};jn.node;const Ms=we(jn);const Sn={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};Sn.node;const Os=we(Sn);const wn={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};wn.node;const zs=we(wn);const Cn={name:"send-horizontal",size:24,node:[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],aliases:["send-horizonal"]};Cn.node;const Fs=we(Cn);var Ls=Object.defineProperty,ve=(t,n)=>Ls(t,"name",{value:n,configurable:!0}),mt="Checkbox",[Ds,Xa]=Le(mt),[$s,ft]=Ds(mt);function kn(t){const{__scopeCheckbox:n,checked:r,children:s,defaultChecked:l,disabled:o,form:c,name:a,onCheckedChange:d,required:u,value:m="on",internal_do_not_use_render:h}=t,[f,b]=Ee({prop:r,defaultProp:l??!1,onChange:d,caller:mt}),[j,k]=i.useState(null),[x,S]=i.useState(null),w=i.useRef(!1),[g,v]=i.useReducer(_=>_+1,0),R=j?!!c||!!j.closest("form"):!0,P={checked:f,disabled:o,setChecked:b,control:j,setControl:k,name:a,form:c,value:m,hasConsumerStoppedPropagationRef:w,userInteractionCount:g,onUserInteraction:v,required:u,defaultChecked:xe(l)?!1:l,isFormControl:R,bubbleInput:x,setBubbleInput:S};return e.jsx($s,{scope:n,...P,children:Nn(h)?h(P):s})}
1ve(kn,"CheckboxProvider");var Bs="CheckboxTrigger",Us=i.forwardRef(ve(function({__scopeCheckbox:n,onKeyDown:r,onClick:s,...l},o){const{control:c,value:a,disabled:d,checked:u,required:m,setControl:h,setChecked:f,hasConsumerStoppedPropagationRef:b,onUserInteraction:j,isFormControl:k,bubbleInput:x}=ft(Bs,n),S=ee(o,h),w=i.useRef(u);return i.useEffect(()=>{const g=c?.form;if(g){const v=ve(()=>f(w.current),"reset");return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[c,f]),e.jsx(V.button,{type:"button",role:"checkbox","aria-checked":xe(u)?"mixed":u,"aria-required":m,"data-state":ht(u),"data-disabled":d?"":void 0,disabled:d,value:a,...l,ref:S,onKeyDown:A(r,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:A(s,g=>{j(),f(v=>xe(v)?!0:!v),x&&k&&(b.current=g.isPropagationStopped(),b.current||g.stopPropagation())})})},"CheckboxTrigger")),qs=i.forwardRef(ve(function(n,r){const{__scopeCheckbox:s,name:l,checked:o,defaultChecked:c,required:a,disabled:d,value:u,onCheckedChange:m,form:h,...f}=n;return e.jsx(kn,{__scopeCheckbox:s,checked:o,defaultChecked:c,disabled:d,required:a,onCheckedChange:m,name:l,form:h,value:u,internal_do_not_use_render:({isFormControl:b})=>e.jsxs(e.Fragment,{children:[e.jsx(Us,{...f,ref:r,__scopeCheckbox:s}),b&&e.jsx(Gs,{__scopeCheckbox:s})]})})},"Checkbox")),Hs="CheckboxIndicator",Vs=i.forwardRef(ve(function(n,r){const{__scopeCheckbox:s,forceMount:l,...o}=n,c=ft(Hs,s);return e.jsx(Ke,{present:l||xe(c.checked)||c.checked===!0,children:e.jsx(V.span,{"data-state":ht(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...n.style}})})},"CheckboxIndicator")),Ks="CheckboxBubbleInput",Gs=i.forwardRef(ve(function({__scopeCheckbox:n,onClick:r,...s},l){const{control:o,hasConsumerStoppedPropagationRef:c,userInteractionCount:a,checked:d,defaultChecked:u,required:m,disabled:h,name:f,value:b,form:j,bubbleInput:k,setBubbleInput:x}=ft(Ks,n),S=ee(l,x),w=Bt(o),g=i.useRef(!1),v=i.useRef(d),R=i.useRef(a);i.useEffect(()=>{const _=k;if(!_)return;const O=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(O,"checked").set,q=a!==R.current;R.current=a;const B=v.current!==d;v.current=d;const K=!(q&&c.current);if(B&&D){g.current=!q;const H=new Event("click",{bubbles:K});_.indeterminate=xe(d),D.call(_,xe(d)?!1:d),_.dispatchEvent(H),g.current=!1}},[k,d,c,a]);const P=i.useRef(xe(d)?!1:d);return e.jsx(V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??P.current,required:m,disabled:h,name:f,value:b,form:j,...s,tabIndex:-1,ref:S,onClick:A(r,_=>{g.current&&_.stopPropagation()}),style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Nn(t){return typeof t=="function"}ve(Nn,"isFunction");function xe(t){return t==="indeterminate"}ve(xe,"isIndeterminate");function ht(t){return xe(t)?"indeterminate":t?"checked":"unchecked"}ve(ht,"getState");var Ws=Object.defineProperty,Ys=(t,n)=>Ws(t,"name",{value:n,configurable:!0});function _n(t){const n=i.useRef({value:t,previous:t});return i.useMemo(()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous),[t])}Ys(_n,"usePrevious");var Xs=Object.defineProperty,Qs=(t,n)=>Xs(t,"name",{value:n,configurable:!0});function tt(t,[n,r]){return Math.min(r,Math.max(n,t))}Qs(tt,"clamp");var Zs=Object.defineProperty,Ce=(t,n)=>Zs(t,"name",{value:n,configurable:!0}),xt="Popover",[Tn,Qa]=Le(xt,[Ge]),gt=Ge(),[Js,Me]=Tn(xt),er=Ce(t=>{const{__scopePopover:n,children:r,open:s,defaultOpen:l,onOpenChange:o,modal:c=!1}=t,a=gt(n),d=i.useRef(null),[u,m]=i.useState(!1),[h,f]=Ee({prop:s,defaultProp:l??!1,onChange:o,caller:xt});return e.jsx(Ut,{...a,children:e.jsx(Js,{scope:n,contentId:We(),triggerRef:d,open:h,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(b=>!b),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>m(!0),[]),onCustomAnchorRemove:i.useCallback(()=>m(!1),[]),modal:c,children:r})})},"Popover"),tr="PopoverTrigger",nr=i.forwardRef(Ce(function(n,r){const{__scopePopover:s,...l}=n,o=Me(tr,s),c=gt(s),a=ee(r,o.triggerRef),d=e.jsx(V.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":vt(o.open),...l,ref:a,onClick:A(n.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:e.jsx(qt,{asChild:!0,...c,children:d})},"PopoverTrigger")),Pn="PopoverPortal",[sr,rr]=Tn(Pn,{forceMount:void 0}),or=Ce(t=>{const{__scopePopover:n,forceMount:r,children:s,container:l}=t,o=Me(Pn,n);return e.jsx(sr,{scope:n,forceMount:r,children:e.jsx(Ke,{present:r||o.open,children:e.jsx(Ht,{asChild:!0,container:l,children:s})})})},"PopoverPortal"),ze="PopoverContent",ar=i.forwardRef(Ce(function(n,r){const s=rr(ze,n.__scopePopover),{forceMount:l=s.forceMount,...o}=n,c=Me(ze,n.__scopePopover);return e.jsx(Ke,{present:l||c.open,children:c.modal?e.jsx(lr,{...o,ref:r}):e.jsx(cr,{...o,ref:r})})},"PopoverContent")),ir=pn("PopoverContent.RemoveScroll"),lr=i.forwardRef(Ce(function(n,r){const s=Me(ze,n.__scopePopover),l=i.useRef(null),o=ee(r,l),c=i.useRef(!1);return i.useEffect(()=>{const a=l.current;if(a)return Vt(a)},[]),e.jsx(Kt,{as:ir,allowPinchZoom:!0,children:e.jsx(In,{...n,ref:o,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:A(n.onCloseAutoFocus,a=>{a.preventDefault(),c.current||s.triggerRef.current?.focus()}),onPointerDownOutside:A(n.onPointerDownOutside,a=>{const d=a.detail.originalEvent,u=d.button===0&&d.ctrlKey===!0,m=d.button===2||u;c.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:A(n.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),cr=i.forwardRef(Ce(function(n,r){const s=Me(ze,n.__scopePopover),l=i.useRef(!1),o=i.useRef(!1);return e.jsx(In,{...n,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),c.defaultPrevented||(l.current||s.triggerRef.current?.focus(),c.preventDefault()),l.current=!1,o.current=!1},onInteractOutside:c=>
1{n.onInteractOutside?.(c),c.defaultPrevented||(l.current=!0,c.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=c.target;s.triggerRef.current?.contains(a)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&o.current&&c.preventDefault()}})},"PopoverContentNonModal")),In=i.forwardRef(Ce(function(n,r){const{__scopePopover:s,trapFocus:l,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:a,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:m,onInteractOutside:h,...f}=n,b=Me(ze,s),j=gt(s);return Gt(),e.jsx(Wt,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:o,onUnmountAutoFocus:c,children:e.jsx(Yt,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:m,onDismiss:()=>b.onOpenChange(!1),deferPointerDownOutside:!0,children:e.jsx(Xt,{"data-state":vt(b.open),role:"dialog",id:b.contentId,...j,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function vt(t){return t?"open":"closed"}Ce(vt,"getState");var dr=er,ur=nr,pr=or,mr=ar,fr=Object.defineProperty,N=(t,n)=>fr(t,"name",{value:n,configurable:!0}),hr=[" ","Enter","ArrowUp","ArrowDown"],xr=[" ","Enter"],Ae="Select",[Xe,Qe,gr]=Xn(Ae),[Pe,Za]=Le(Ae,[gr,Ge]),bt=Ge(),[vr,ke]=Pe(Ae),[br,yr]=Pe(Ae);function Rn(t){const{__scopeSelect:n,children:r,open:s,defaultOpen:l,onOpenChange:o,value:c,defaultValue:a,onValueChange:d,dir:u,name:m,autoComplete:h,disabled:f,required:b,form:j,internal_do_not_use_render:k}=t,x=bt(n),[S,w]=i.useState(null),[g,v]=i.useState(null),[R,P]=i.useState(!1),_=Qt(u),[O,L]=Ee({prop:s,defaultProp:l??!1,onChange:o,caller:Ae}),[D,q]=Ee({prop:c,defaultProp:a,onChange:d,caller:Ae}),B=i.useRef(null),K=i.useRef(D);i.useEffect(()=>{const G=j?S?.ownerDocument.getElementById(j):S?.form;if(G instanceof HTMLFormElement){const J=N(()=>q(K.current),"reset");return G.addEventListener("reset",J),()=>G.removeEventListener("reset",J)}},[j,S,q]);const H=S?!!j||!!S.closest("form"):!0,[ne,Z]=i.useState(new Set),se=We(),te=Array.from(ne).map(G=>G.props.value).join(";"),ie=i.useCallback(G=>{Z(J=>new Set(J).add(G))},[]),Y=i.useCallback(G=>{Z(J=>{const re=new Set(J);return re.delete(G),re})},[]),X={required:b,trigger:S,onTriggerChange:w,valueNode:g,onValueNodeChange:v,valueNodeHasChildren:R,onValueNodeHasChildrenChange:P,contentId:se,value:D,onValueChange:q,open:O,onOpenChange:L,dir:_,triggerPointerDownPosRef:B,disabled:f,name:m,autoComplete:h,form:j,nativeOptions:ne,nativeSelectKey:te,isFormControl:H};return e.jsx(Ut,{...x,children:e.jsx(vr,{scope:n,...X,children:e.jsx(Xe.Provider,{scope:n,children:e.jsx(br,{scope:n,onNativeOptionAdd:ie,onNativeOptionRemove:Y,children:On(k)?k(X):r})})})})}N(Rn,"SelectProvider");var jr=N(t=>{const{__scopeSelect:n,children:r,...s}=t;return e.jsx(Rn,{__scopeSelect:n,...s,internal_do_not_use_render:({isFormControl:l})=>e.jsxs(e.Fragment,{children:[r,l?e.jsx(Gr,{__scopeSelect:n}):null]})})},"Select"),Sr="SelectTrigger",wr=i.forwardRef(N(function(n,r){const{__scopeSelect:s,disabled:l=!1,...o}=n,c=bt(s),a=ke(Sr,s),d=a.disabled||l,u=ee(r,a.onTriggerChange),m=Qe(s),h=i.useRef("touch"),[f,b,j]=jt(x=>{const S=m().filter(v=>!v.disabled),w=S.find(v=>v.value===a.value),g=St(S,x,w);g!==void 0&&a.onValueChange(g.value)}),k=N(x=>{d||(a.onOpenChange(!0),j()),x&&(a.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})},"handleOpen");return e.jsx(qt,{asChild:!0,...c,children:e.jsx(V.button,{type:"button",role:"combobox","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":De(a.value)?"":void 0,...o,ref:u,onClick:A(o.onClick,x=>
1{x.currentTarget.focus(),h.current!=="mouse"&&k(x)}),onPointerDown:A(o.onPointerDown,x=>{h.current=x.pointerType;const S=x.target;S.hasPointerCapture(x.pointerId)&&S.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(k(x),x.preventDefault())}),onKeyDown:A(o.onKeyDown,x=>{const S=f.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&b(x.key),!(S&&x.key===" ")&&hr.includes(x.key)&&(k(),x.preventDefault())})})})},"SelectTrigger")),Cr="SelectValue",kr=i.forwardRef(N(function(n,r){const{__scopeSelect:s,className:l,style:o,children:c,placeholder:a="",...d}=n,u=ke(Cr,s),{onValueNodeHasChildrenChange:m}=u,h=c!==void 0,f=ee(r,u.onValueNodeChange);je(()=>{m(h)},[m,h]);const b=De(u.value);return e.jsx(V.span,{...d,asChild:b?!1:d.asChild,ref:f,style:{pointerEvents:"none"},children:e.jsx(i.Fragment,{children:b?a:c},b?"placeholder":"value")})},"SelectValue")),Nr=i.forwardRef(N(function(n,r){const{__scopeSelect:s,children:l,...o}=n;return e.jsx(V.span,{"aria-hidden":!0,...o,ref:r,children:l||"▼"})},"SelectIcon")),_r="SelectPortal",[Tr,Pr]=Pe(_r,{forceMount:void 0}),Ir=N(t=>{const{__scopeSelect:n,forceMount:r,...s}=t;return e.jsx(Tr,{scope:t.__scopeSelect,forceMount:r,children:e.jsx(Ht,{asChild:!0,...s})})},"SelectPortal"),Te="SelectContent",Rr=i.forwardRef(N(function(n,r){const s=Pr(Te,n.__scopeSelect),{forceMount:l=s.forceMount,...o}=n,c=ke(Te,n.__scopeSelect),[a,d]=i.useState();return je(()=>{d(new DocumentFragment)},[]),e.jsx(Ke,{present:l||c.open,children:({present:u})=>u?e.jsx(Mr,{...o,ref:r}):e.jsx(Er,{...o,fragment:a})})},"SelectContent")),Er=i.forwardRef(N(function(n,r){const{__scopeSelect:s,children:l,fragment:o}=n;return o?mn.createPortal(e.jsx(En,{scope:s,children:e.jsx(Xe.Slot,{scope:s,children:e.jsx("div",{ref:r,children:l})})}),o):null},"SelectContentFragment")),pe=10,[En,Ie]=Pe(Te),Ar=pn("SelectContent.RemoveScroll"),Mr=i.forwardRef(N(function(n,r){const{__scopeSelect:s}=n,{position:l="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:a,side:d,sideOffset:u,align:m,alignOffset:h,arrowPadding:f,collisionBoundary:b,collisionPadding:j,sticky:k,hideWhenDetached:x,avoidCollisions:S,...w}=n,g=ke(Te,s),[v,R]=i.useState(null),[P,_]=i.useState(null),O=ee(r,R),[L,D]=i.useState(null),[q,B]=i.useState(null),K=Qe(s),[H,ne]=i.useState(!1),Z=i.useRef(!1);i.useEffect(()=>{if(v)return Vt(v)},[v]),Gt();const se=i.useCallback(C=>{const[z,...W]=K().map($=>$.ref.current),[E]=W.slice(-1),M=document.activeElement;for(const $ of C)if($===M||($?.scrollIntoView({block:"nearest"}),$===z&&P&&(P.scrollTop=0),$===E&&P&&(P.scrollTop=P.scrollHeight),$?.focus(),document.activeElement!==M))return},[K,P]),te=i.useCallback(()=>se([L,v]),[se,L,v]);i.useEffect(()=>{H&&te()},[H,te]);const{onOpenChange:ie,triggerPointerDownPosRef:Y}=g;i.useEffect(()=>{if(v){let C={x:0,y:0};const z=N(E=>{C={x:Math.abs(Math.round(E.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(E.pageY)-(Y.current?.y??0))}},"handlePointerMove"),W=N(E=>{C.x<=10&&C.y<=10?E.preventDefault():E.composedPath().includes(v)||ie(!1),document.removeEventListener("pointermove",z),Y.current=null},"handlePointerUp");return Y.current!==null&&(document.addEventListener("pointermove",z),document.addEventListener("pointerup",W,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",W,{capture:!0})}}},[v,ie,Y]),i.useEffect(()=>{const C=N(()=>ie(!1),"close");return window.addEventListener("blur",C),window.addEventListener("resize",C),()=>{window.removeEventListener("blur",C),window.removeEventListener("resize",C)}},[ie]);const[X,G]=jt(C=>{const z=K().filter(M=>!M.disabled),W=z.find(M=>M.ref.current===document.activeElement),E=St(z,C,W);E&&setTimeout(()=>E.ref.current?.focus())}),J=i.useCallback((C,z,W)=>{const E=!Z.current&&!W;(g.value!==void 0&&g.value===z||E)&&(D(C),E&&(Z.current=!0))},[g.value]),re=i.useCallback(()=>v?.focus(),[v]),le=i.useCallback((C,z,W)=>{const E=!Z.current&&!W;(g.value!==void 0&&g.value===z||E)&&B(C)},[g.value]),ce=l==="popper"?Rt:Or,he=ce===Rt?{side:d,sideOffset:u,align:m,alignOffset:h,arrowPadding:f,collisionBoundary:b,collisionPadding:j,sticky:k,hideWhenDetached:x,avoidCollisions:S}:{};return e.jsx(En,{scope:s,content:v,viewport:P,onViewportChange:_,itemRefCallback:J,selectedItem:L,onItemLeave:re,itemTextRefCallback:le,focusSelectedItem:te,
vendor: 6,223 bytes, line 1
1selectedItemText:q,position:l,isPositioned:H,searchRef:X,children:e.jsx(Kt,{as:Ar,allowPinchZoom:!0,children:e.jsx(Wt,{asChild:!0,trapped:g.open,onMountAutoFocus:C=>{C.preventDefault()},onUnmountAutoFocus:A(o,C=>{g.trigger?.focus({preventScroll:!0}),C.preventDefault()}),children:e.jsx(Yt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:C=>C.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:e.jsx(ce,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:C=>C.preventDefault(),...w,...he,onPlaced:()=>ne(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:A(w.onKeyDown,C=>{const z=C.ctrlKey||C.altKey||C.metaKey;if(C.key==="Tab"&&C.preventDefault(),!z&&C.key.length===1&&G(C.key),["ArrowUp","ArrowDown","Home","End"].includes(C.key)){let E=K().filter(M=>!M.disabled).map(M=>M.ref.current);if(["ArrowUp","End"].includes(C.key)&&(E=E.slice().reverse()),["ArrowUp","ArrowDown"].includes(C.key)){const M=C.target,$=E.indexOf(M);E=E.slice($+1)}setTimeout(()=>se(E)),C.preventDefault()}})})})})})})},"SelectContentImpl")),Or=i.forwardRef(N(function(n,r){const{__scopeSelect:s,onPlaced:l,...o}=n,c=ke(Te,s),a=Ie(Te,s),[d,u]=i.useState(null),[m,h]=i.useState(null),f=ee(r,h),b=Qe(s),j=i.useRef(!1),k=i.useRef(!0),{viewport:x,selectedItem:S,selectedItemText:w,focusSelectedItem:g}=a,v=i.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&m&&x&&S&&w){const O=c.trigger.getBoundingClientRect(),L=m.getBoundingClientRect(),D=c.valueNode.getBoundingClientRect(),q=w.getBoundingClientRect();if(c.dir!=="rtl"){const M=q.left-L.left,$=D.left-M,de=O.left-$,ue=O.width+de,be=Math.max(ue,L.width),y=window.innerWidth-pe,T=tt($,[pe,Math.max(pe,y-be)]);d.style.minWidth=ue+"px",d.style.left=T+"px"}else{const M=L.right-q.right,$=window.innerWidth-D.right-M,de=window.innerWidth-O.right-$,ue=O.width+de,be=Math.max(ue,L.width),y=window.innerWidth-pe,T=tt($,[pe,Math.max(pe,y-be)]);d.style.minWidth=ue+"px",d.style.right=T+"px"}const B=b(),K=window.innerHeight-pe*2,H=x.scrollHeight,ne=window.getComputedStyle(m),Z=parseInt(ne.borderTopWidth,10),se=parseInt(ne.paddingTop,10),te=parseInt(ne.borderBottomWidth,10),ie=parseInt(ne.paddingBottom,10),Y=Z+se+H+ie+te,X=Math.min(S.offsetHeight*5,Y),G=window.getComputedStyle(x),J=parseInt(G.paddingTop,10),re=parseInt(G.paddingBottom,10),le=O.top+O.height/2-pe,ce=K-le,he=S.offsetHeight/2,C=S.offsetTop+he,z=Z+se+C,W=Y-z;if(z<=le){const M=B.length>0&&S===B[B.length-1].ref.current;d.style.bottom="0px";const $=m.clientHeight-x.offsetTop-x.offsetHeight,de=Math.max(ce,he+(M?re:0)+$+te),ue=z+de;d.style.height=ue+"px"}else{const M=B.length>0&&S===B[0].ref.current;d.style.top="0px";const de=Math.max(le,Z+x.offsetTop+(M?J:0)+he)+W;d.style.height=de+"px",x.scrollTop=z-le+x.offsetTop}d.style.margin=`${pe}px 0`,d.style.minHeight=X+"px",d.style.maxHeight=K+"px",l?.(),requestAnimationFrame(()=>j.current=!0)}},[b,c.trigger,c.valueNode,d,m,x,S,w,c.dir,l]);je(()=>v(),[v]);const[R,P]=i.useState();je(()=>{m&&P(window.getComputedStyle(m).zIndex)},[m]);const _=i.useCallback(O=>{O&&k.current===!0&&(v(),g?.(),k.current=!1)},[v,g]);return e.jsx(zr,{scope:s,contentWrapper:d,shouldExpandOnScrollRef:j,onScrollButtonChange:_,children:e.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:e.jsx(V.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})},"SelectItemAlignedPosition")),Rt=i.forwardRef(N(function(n,r){const{__scopeSelect:s,align:l="start",collisionPadding:o=pe,...c}=n,a=bt(s);return e.jsx(Xt,{...a,...c,ref:r,align:l,collisionPadding:o,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[zr,yt]=Pe(Te,{}),Et="SelectViewport",Fr=i.forwardRef(N(function(n,r){const{__scopeSelect:s,nonce:l,...o}=n,c=Ie(Et,s),a=yt(Et,s),d=ee(r,c.onViewportChange),u=i.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),e.jsx(Xe.Slot,{scope:s,children:e.jsx(V.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:A(o.onScroll,m=>{const h=m.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:b}=a;if(b?.current&&f){const j=Math.abs(u.current-h.scrollTop);if(j>0){const k=window.innerHeight-pe*2,x=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),w=Math.max(x,S);if(w<k){const g=w+j,v=Math.min(k,g),R=g-v;f.style.height=v+"px",f.style.bottom==="0px"&&(h.scrollTop=R>0?R:0,f.style.justifyContent="flex-end")}}}u.current=h.scrollTop})})})]})},"SelectViewport")),Lr="SelectGroup",[Ja,ei]=Pe(Lr),nt="SelectItem",[Dr,An]=Pe(nt),$r=i.forwardRef(N(function(n,r){const{__scopeSelect:s,value:l,disabled:o=!1,textValue:c,...a}=n,d=ke(nt,s),u=Ie(nt,s),m=d.value===l,[h,f]=i.useState(c??""),[b,j]=i.useState(!1),k=rt(v=>u.itemRefCallback?.(v,l,o)),x=ee(r,k),S=We(),w=i.useRef("touch"),g=N(()=>{o||(d.onValueChange(l),d.onOpenChange(!1))},"handleSelect");return e.jsx(Dr,{scope:s,value:l,disabled:o,textId:S,isSelected:m,onItemTextChange:i.useCallback(v=>{f(R=>R||(v?.textContent??"").trim())},[]),children:e.jsx(Xe.ItemSlot,{scope:s,value:l,disabled:o,textValue:h,children:e.jsx(V.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":m&&b,"data-state":m?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:x,onFocus:A(a.onFocus,()=>j(!0)),onBlur:A(a.onBlur,()=>j(!1)),onClick:A(a.onClick,()=>{w.current!=="mouse"&&g()}),onPointerUp:A(a.onPointerUp,()=>{w.current==="mouse"&&g()}),onPointerDown:A(a.onPointerDown,v=>
1{w.current=v.pointerType}),onPointerMove:A(a.onPointerMove,v=>{w.current=v.pointerType,o?u.onItemLeave?.():w.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:A(a.onPointerLeave,v=>{v.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:A(a.onKeyDown,v=>{o||v.target!==v.currentTarget||u.searchRef?.current!==""&&v.key===" "||(xr.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})},"SelectItem")),Be="SelectItemText",Br=i.forwardRef(N(function(n,r){const{__scopeSelect:s,className:l,style:o,...c}=n,a=ke(Be,s),d=Ie(Be,s),u=An(Be,s),m=yr(Be,s),[h,f]=i.useState(null),b=rt(g=>d.itemTextRefCallback?.(g,u.value,u.disabled)),j=ee(r,f,u.onItemTextChange,b),k=h?.textContent,x=i.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:k},u.value),[u.disabled,u.value,k]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=m;return je(()=>(S(x),()=>w(x)),[S,w,x]),e.jsxs(e.Fragment,{children:[e.jsx(V.span,{id:u.textId,...c,ref:j}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren&&!De(a.value)?mn.createPortal(c.children,a.valueNode):null]})},"SelectItemText")),Ur="SelectItemIndicator",qr=i.forwardRef(N(function(n,r){const{__scopeSelect:s,...l}=n;return An(Ur,s).isSelected?e.jsx(V.span,{"aria-hidden":!0,...l,ref:r}):null},"SelectItemIndicator")),At="SelectScrollUpButton",Hr=i.forwardRef(N(function(n,r){const s=Ie(At,n.__scopeSelect),l=yt(At,n.__scopeSelect),[o,c]=i.useState(!1),a=ee(r,l.onScrollButtonChange);return je(()=>{if(s.viewport&&s.isPositioned){let d=function(){const m=u.scrollTop>0;c(m)};N(d,"handleScroll");const u=s.viewport;return d(),u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[s.viewport,s.isPositioned]),o?e.jsx(Mn,{...n,ref:a,onAutoScroll:()=>{const{viewport:d,selectedItem:u}=s;d&&u&&(d.scrollTop=d.scrollTop-u.offsetHeight)}}):null},"SelectScrollUpButton")),Mt="SelectScrollDownButton",Vr=i.forwardRef(N(function(n,r){const s=Ie(Mt,n.__scopeSelect),l=yt(Mt,n.__scopeSelect),[o,c]=i.useState(!1),a=ee(r,l.onScrollButtonChange);return je(()=>{if(s.viewport&&s.isPositioned){let d=function(){const m=u.scrollHeight-u.clientHeight,h=Math.ceil(u.scrollTop)<m;c(h)};N(d,"handleScroll");const u=s.viewport;return d(),u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[s.viewport,s.isPositioned]),o?e.jsx(Mn,{...n,ref:a,onAutoScroll:()=>{const{viewport:d,selectedItem:u}=s;d&&u&&(d.scrollTop=d.scrollTop+u.offsetHeight)}}):null},"SelectScrollDownButton")),Mn=i.forwardRef(N(function(n,r){const{__scopeSelect:s,onAutoScroll:l,...o}=n,c=Ie("SelectScrollButton",s),a=i.useRef(null),d=Qe(s),u=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),je(()=>{d().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),e.jsx(V.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:A(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(l,50))}),onPointerMove:A(o.onPointerMove,()=>{c.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(l,50))}),onPointerLeave:A(o.onPointerLeave,()=>{u()})})},"SelectScrollButtonImpl")),Kr="SelectBubbleInput",Gr=i.forwardRef(N(function({__scopeSelect:n,...r},s){const l=ke(Kr,n),{value:o,onValueChange:c,required:a,disabled:d,name:u,autoComplete:m,form:h}=l,{nativeOptions:f,nativeSelectKey:b}=l,j=i.useRef(null),k=ee(s,j),x=o??"",S=_n(x),w=Array.from(f).some(g=>(g.props.value??"")==="");return i.useEffect(()=>{const g=j.current;if(!g)return;const v=window.HTMLSelectElement.prototype,P=Object.getOwnPropertyDescriptor(v,"value").set;if(S!==x&&P){const _=new Event("change",{bubbles:!0});P.call(g,x),g.dispatchEvent(_)}},[S,x]),e.jsxs(V.select,{"aria-hidden":!0,required:a,tabIndex:-1,name:u,autoComplete:m,disabled:d,form:h,onChange:g=>c(g.target.value),...r,style:{...Qn,...r.style},ref:k,defaultValue:x,children:[De(o)&&!w?e.jsx("option",{value:""}):null,Array.from(f)]},b)},"SelectBubbleInput"));function On(t){return typeof t=="function"}N(On,"isFunction");function De(t){return t===""||t===void 0}N(De,"shouldShowPlaceholder");function jt(t){const n=rt(t),r=i.useRef(""),s=i.useRef(0),l=i.useCallback(c=>{const a=r.current+c;n(a),N((function d(u){r.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>d(""),1e3))}),"updateSearch")(a)},[n]),o=i.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,l,o]}N(jt,"useTypeaheadSearch");function St(t,n,r){const l=n.length>1&&Array.from(n).every(u=>u===n[0])?n[0]:n,o=r?t.indexOf(r):-1;let c=zn(t,Math.max(o,0));l.length===1&&(c=c.filter(u=>u!==r));const d=c.find(u=>u.textValue.toLowerCase().startsWith(l.toLowerCase()));return d!==r?d:void 0}N(St,"findNextItem");function zn(t,n){return t.map((r,s)=>t[(n+s)%t.length])}N(zn,"wrapArray");var Wr=Object.defineProperty,Se=(t,n)=>Wr(t,"name",{value:n,configurable:!0}),wt="Switch",[Yr,ti]=Le(wt),[Xr,Ct]=Yr(wt);function Fn(t){const{__scopeSwitch:n,checked:r,children:s,defaultChecked:l,disabled:o,form:c,name:a,onCheckedChange:d,required:u,value:m="on",internal_do_not_use_render:h}=t,[f,b]=Ee({prop:r,defaultProp:l??!1,onChange:d,caller:wt}),[j,k]=i.useState(null),[x,S]=i.useState(null),w=i.useRef(!1),[g,v]=i.useReducer(_=>_+1,0),R=j?!!c||!!j.closest("form"):!0,P={checked:f,setChecked:b,disabled:o,control:j,setControl:k,name:a,form:c,value:m,hasConsumerStoppedPropagationRef:w,userInteractionCount:g,onUserInteraction:v,required:u,defaultChecked:l,isFormControl:R,bubbleInput:x,setBubbleInput:S};return e.jsx(Xr,{scope:n,...P,children:Ln(h)?h(P):s})}Se(Fn,"SwitchProvider");var Qr="SwitchTrigger",Zr=i.forwardRef(Se(function({__scopeSwitch:n,onClick:r,...s},l){const{control:o,form:c,value:a,disabled:d,checked:u,required:m,setControl:h,setChecked:f,hasConsumerStoppedPropagationRef:b,onUserInteraction:j,isFormControl:k,bubbleInput:x}=Ct(Qr,n),S=ee(l,h),w=i.useRef(u);return i.useEffect(()=>{const g=c?o?.ownerDocument.getElementById(c):o?.form;if(g instanceof HTMLFormElement){const v=Se(()=>f(w.current),"reset");return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[o,c,f]),e.jsx(V.button,{type:"button",role:"switch","aria-checked":u,"aria-required":m,"data-state":kt(u),"data-disabled":d?"":void 0,disabled:d,value:a,...s,ref:S,onClick:A(r,g=>{j(),f(v=>!v),x&&k&&(b.current=g.isPropagationStopped(),b.current||g.stopPropagation())})})},"SwitchTrigger")),Jr=i.forwardRef(Se(function(n,r){const{__scopeSwitch:s,name:l,checked:o,defaultChecked:c,required:a,disabled:d,value:u,onCheckedChange:m,form:h,...f}=n;return e.jsx(Fn,{__scopeSwitch:s,checked:o,defaultChecked:c,disabled:d,required:a,onCheckedChange:m,name:l,form:h,value:u,internal_do_not_use_render:({isFormControl:b})=>e.jsxs(e.Fragment,{children:[e.jsx(Zr,{...f,ref:r,__scopeSwitch:s}),b&&e.jsx(so,{__scopeSwitch:s})]})})},"Switch")),eo="SwitchThumb",to=i.forwardRef(Se(function(n,r){const{__scopeSwitch:s,...l}=n,o=Ct(eo,s);return e.jsx(V.span,{"data-state":kt(o.checked),"data-disabled":o.disabled?"":void 0,...l,ref:r})},"SwitchThumb")),no="SwitchBubbleInput",so=i.forwardRef(Se(function({__scopeSwitch:n,onClick:r,...s},l){const{control:o,hasConsumerStoppedPropagationRef:c,userInteractionCount:a,checked:d,defaultChecked:u,required:m,disabled:h,name:f,value:b,form:j,bubbleInput:k,setBubbleInput:x}=Ct(no,n),S=ee(l,x),w=Bt(o),g=i.useRef(!1),v=i.useRef(d),R=i.useRef(a);i.useEffect(()=>{const _=k;if(!_)return;const O=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(O,"checked").set,q=a!==R.current;R.current=a;const B=v.current!==d;v.current=d;const K=!(q&&c.current);if(B&&D){g.current=!q;const H=new Event("click",{bubbles:K});D.call(_,d),_.dispatchEvent(H),g.current=!1}},[k,d,c,a]);const P=i.useRef(d);return e.jsx(V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??P.current,required:m,disabled:h,name:f,value:b,form:j,...s,tabIndex:-1,ref:S,onClick:A(r,_=>{g.current&&_.stopPropagation()}),style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})}
1,"SwitchBubbleInput"));function Ln(t){return typeof t=="function"}Se(Ln,"isFunction");function kt(t){return t?"checked":"unchecked"}Se(kt,"getState");var ro=Object.defineProperty,$e=(t,n)=>ro(t,"name",{value:n,configurable:!0}),Nt="Tabs",[oo,ni]=Le(Nt,[Zt]),Dn=Zt(),[ao,$n]=oo(Nt),io=i.forwardRef($e(function(n,r){const{__scopeTabs:s,value:l,onValueChange:o,defaultValue:c,orientation:a="horizontal",dir:d,activationMode:u="automatic",...m}=n,h=Qt(d),[f,b]=Ee({prop:l,onChange:o,defaultProp:c??"",caller:Nt});return e.jsx(ao,{scope:s,baseId:We(),value:f,onValueChange:b,orientation:a,dir:h,activationMode:u,children:e.jsx(V.div,{dir:h,"data-orientation":a,...m,ref:r})})},"Tabs")),lo="TabsList",co=i.forwardRef($e(function(n,r){const{__scopeTabs:s,loop:l=!0,...o}=n,c=$n(lo,s),a=Dn(s);return e.jsx(Zn,{asChild:!0,...a,orientation:c.orientation,dir:c.dir,loop:l,children:e.jsx(V.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:r})})},"TabsList")),uo="TabsTrigger",po=i.forwardRef($e(function(n,r){const{__scopeTabs:s,value:l,disabled:o=!1,...c}=n,a=$n(uo,s),d=Dn(s),u=Bn(a.baseId,l),m=Un(a.baseId,l),h=l===a.value;return e.jsx(Jn,{asChild:!0,...d,focusable:!o,active:h,children:e.jsx(V.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...c,ref:r,onMouseDown:A(n.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?a.onValueChange(l):f.preventDefault()}),onKeyDown:A(n.onKeyDown,f=>{o||f.target!==f.currentTarget||[" ","Enter"].includes(f.key)&&a.onValueChange(l)}),onFocus:A(n.onFocus,()=>{const f=a.activationMode!=="manual";!h&&!o&&f&&a.onValueChange(l)})})})},"TabsTrigger"));function Bn(t,n){return`${t}-trigger-${n}`}$e(Bn,"makeTriggerId");function Un(t,n){return`${t}-content-${n}`}$e(Un,"makeContentId");var mo=io,fo=co,ho=po;async function xo(t,n,r={},s=25){const l=await t(),o=await fetch(`${cn}/search/candidates`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({query:n,filters:r,limit:s})});if(!o.ok)throw new Error(`Candidate search failed: ${o.status}`);return o.json()}async function qn(t,n,r={}){const s=await t(),l=await fetch(`${cn}${n}`,{...r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json",...r.headers}});if(!l.ok)throw new Error(`Request to ${n} failed: ${l.status}`);return l.json()}async function go(t){const{history:n}=await qn(t,"/search/history");return n}async function vo(t){const{history:n}=await qn(t,"/search/history",{method:"DELETE"});return n}function bo(t){const n=Math.round((Date.now()-t)/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function Hn({className:t,size:n="default",...r}){return e.jsx(Jr,{"data-slot":"switch","data-size":n,className:ae("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",t),...r,children:e.jsx(to,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dar
1k:data-unchecked:bg-foreground"})})}function _t({...t}){return e.jsx(jr,{"data-slot":"select",...t})}function Tt({...t}){return e.jsx(kr,{"data-slot":"select-value",...t})}function Pt({className:t,size:n="default",children:r,...s}){return e.jsxs(wr,{"data-slot":"select-trigger","data-size":n,className:ae("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[r,e.jsx(Nr,{asChild:!0,children:e.jsx(fn,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function It({className:t,children:n,position:r="item-aligned",align:s="center",...l}){return e.jsx(Ir,{children:e.jsxs(Rr,{"data-slot":"select-content","data-align-trigger":r==="item-aligned",className:ae("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,align:s,...l,children:[e.jsx(yo,{}),e.jsx(Fr,{"data-position":r,className:ae("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",r==="popper"&&""),children:n}),e.jsx(jo,{})]})})}function He({className:t,children:n,...r}){return e.jsxs($r,{"data-slot":"select-item",className:ae("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:e.jsx(qr,{children:e.jsx(at,{className:"pointer-events-none"})})}),e.jsx(Br,{children:n})]})}function yo({className:t,...n}){return e.jsx(Hr,{"data-slot":"select-scroll-up-button",className:ae("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",t),...n,children:e.jsx(Rs,{})})}function jo({className:t,...n}){return e.jsx(Vr,{"data-slot":"select-scroll-down-button",className:ae("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",t),...n,children:e.jsx(fn,{})})}function Vn({className:t,size:n="default",...r}){return e.jsx("div",{"data-slot":"card","data-size":n,className:ae("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",t),...r})}function So({className:t,...n}){return e.jsx(qs,{"data-slot":"checkbox",className:ae("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...n,children:e.jsx(Vs,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(at,{})})})}function wo({...t}){return e.jsx(dr,{"data-slot":"popover",...t})}function Co({...t}){return e.jsx(ur,{"data-slot":"popover-trigger",...t})}function ko({className:t,align:n="center",sideOffset:r=4,...s}){return e.jsx(pr,{children:e.jsx(mr,{"data-slot":"popover-content",align:n,sideOffset:r,className:ae("z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground
1/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...s})})}function No(t){return t>=75?"bg-[color-mix(in_srgb,var(--status-good)_16%,transparent)] text-foreground border-transparent":t>=45?"bg-[color-mix(in_srgb,var(--status-warning)_18%,transparent)] text-foreground border-transparent":"bg-[color-mix(in_srgb,var(--status-critical)_16%,transparent)] text-foreground border-transparent"}function _o({score:t,rationale:n}){if(t==null)return e.jsxs(Q,{variant:"outline",className:"gap-1 text-muted-foreground",title:"Ranking isn't available for this result yet",children:[e.jsx(Oe,{className:"size-3"}),"Unranked"]});const r=Math.round(t);return e.jsxs(wo,{children:[e.jsx(Co,{asChild:!0,children:e.jsx("button",{type:"button",className:"cursor-pointer",children:e.jsxs(Q,{className:No(r)+" gap-1 font-semibold tabular-nums",children:[e.jsx(Oe,{className:"size-3"}),r,e.jsx("span",{className:"font-normal opacity-70",children:"fit"})]})})}),e.jsxs(ko,{className:"w-72 text-sm",align:"start",children:[e.jsxs("p",{className:"mb-1 font-semibold text-foreground",children:["Why this candidate ranked ",r]}),e.jsx("p",{className:"text-muted-foreground",children:n||"No rationale was generated for this result."})]})]})}const To=t=>{if(!t)return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:(Date.now()-n.getTime())/(1e3*60*60*24*30.44)},Ve=["entry","senior","manager","director","vp","cxo","owner"],Po=t=>!t||t.length===0?null:[...t].sort((n,r)=>Ve.indexOf(r)-Ve.indexOf(n))[0],Io=10;function Ro({levels:t}){const n=Po(t),r=n?Ve.indexOf(n):-1;return e.jsxs("div",{className:"flex min-w-[110px] flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-semibold text-foreground",children:n?Ne(n):"Unknown level"}),e.jsx("div",{className:"flex gap-1",children:Ve.slice(0,6).map((s,l)=>e.jsx("div",{className:"h-1.5 w-3.5 rounded-full",style:{backgroundColor:l<=r?"var(--primary)":"var(--muted)"}},s))}),e.jsx("span",{className:"text-[0.7rem] text-muted-foreground",children:"Seniority"})]})}function Ue({href:t,label:n,Icon:r}){const s=e.jsx(F,{asChild:!!t,variant:"ghost",size:"icon",disabled:!t,className:"size-8",children:t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer","aria-label":n,children:e.jsx(r,{className:"size-4"})}):e.jsx("span",{children:e.jsx(r,{className:"size-4"})})});return e.jsxs(en,{children:[e.jsx(tn,{asChild:!0,children:s}),e.jsx(nn,{children:n})]})}function Eo({userData:t,checked:n,onToggleChecked:r,focused:s=!1}){const l=t.skills?.slice(0,6)??[],o=(t.skills?.length??0)-l.length,c=To(t.start_date),a=c!==null?c/12:null,d=a!==null?Math.min(100,a/Io*100):0,u=t.email||t.work_email;return e.jsxs(Vn,{size:"sm",className:"relative w-full gap-2.5 rounded-lg border border-border p-3 ring-0",children:[s&&e.jsx(Jt.div,{layoutId:"candidate-focus-ring",className:"pointer-events-none absolute inset-0 z-10 rounded-lg ring-2 ring-primary",transition:{duration:.15,ease:[.16,1,.3,1]}}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[e.jsx(So,{checked:n,onCheckedChange:r,"aria-label":"Select candidate"}),e.jsx(es,{className:"size-11",children:e.jsxs(ts,{className:"bg-accent text-sm text-accent-foreground",children:[t.first_name?.[0]?.toUpperCase(),t.last_name?.[0]?.toUpperCase()]})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("h3",{className:"truncate text-sm font-semibold leading-tight text-foreground",children:Ne(t.full_name)}),e.jsx(_o,{score:t.rank_score,rationale:t.rank_rationale}),t.open_to_work&&e.jsx(Q,{variant:"secondary",children:"Open to work"})]}),t.headline&&e.jsx("p",{className:"mt-0.5 truncate text-sm text-foreground",children:t.headline}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[Ne(t.job_title),t.job_company_name&&` · ${Ne(t.job_c
1ompany_name)}`]}),u&&e.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(_e,{className:"size-3"}),e.jsx("span",{className:"truncate",children:u})]}),t.matched_on?.length>0&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.matched_on.map(m=>e.jsx(Q,{variant:"outline",className:"h-5 bg-[color-mix(in_srgb,var(--primary)_10%,transparent)] text-[0.7rem]",children:m},m))})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(Ue,{href:u?`mailto:${u}`:void 0,label:"Email candidate",Icon:_e}),e.jsx(Ue,{href:t.linkedin_url?`https://${t.linkedin_url}`:void 0,label:"LinkedIn profile",Icon:ws}),e.jsx(Ue,{href:t.github_url?`https://${t.github_url}`:void 0,label:"GitHub profile",Icon:Cs}),e.jsx(Ue,{href:t.job_company_website?`https://${t.job_company_website}`:void 0,label:"Company website",Icon:ks})]})]}),e.jsxs("div",{className:"flex items-start gap-4 border-t border-border pt-2.5",children:[e.jsxs(en,{children:[e.jsx(tn,{asChild:!0,children:e.jsxs("div",{className:"flex min-w-[110px] flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-semibold text-foreground",children:a!==null?`${a.toFixed(1)} yrs`:"—"}),e.jsx("div",{className:"h-1.5 w-[110px] overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary",style:{width:`${d}%`}})}),e.jsx("span",{className:"text-[0.7rem] text-muted-foreground",children:"Years of experience"})]})}),e.jsx(nn,{children:a!==null?`${a.toFixed(1)} years in current role`:"Start date unknown"})]}),e.jsx("div",{className:"w-px self-stretch bg-border"}),e.jsx(Ro,{levels:t.experience_level})]}),l.length>0&&e.jsxs("div",{className:"border-t border-border pt-2.5",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"SKILLS"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[l.map(m=>e.jsx(Q,{variant:"secondary",children:Ne(m)},m)),o>0&&e.jsxs(Q,{variant:"outline",children:["+",o," more"]})]})]}),(t.languages?.length??0)>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(Ms,{className:"size-3.5 text-muted-foreground"}),t.languages.map(m=>e.jsx(Q,{variant:"outline",children:Ne(m)},m))]})]})}function Ao(){return e.jsxs(Vn,{size:"sm",className:"w-full rounded-lg border border-border p-3 ring-0",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[e.jsx(me,{className:"size-11 shrink-0 rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(me,{className:"h-4 w-1/3"}),e.jsx(me,{className:"mt-1.5 h-3 w-1/2"})]})]}),e.jsxs("div",{className:"mb-3 flex gap-4",children:[e.jsx(me,{className:"h-9 w-28 rounded"}),e.jsx(me,{className:"h-9 w-28 rounded"})]}),e.jsx("div",{className:"flex gap-1.5",children:[56,72,64,48].map((t,n)=>e.jsx(me,{className:"h-5 rounded-full",style:{width:t}},n))})]})}function Mo({className:t,orientation:n="horizontal",...r}){return e.jsx(mo,{"data-slot":"tabs","data-orientation":n,className:ae("group/tabs flex gap-2 data-horizontal:flex-col",t),...r})}const Oo=js("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function zo({className:t,variant:n="default",...r}){return e.jsx(fo,{"data-slot":"tabs-list","data-variant":n,className:ae(Oo({variant:n}),t),...r})}function Fo({className:t,...n}){return e.jsx(ho,{"data-slot":"tabs-trigger",className:ae("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...n})}const Lo=3,Do=[0,2,3],$o=Array.from({length:Lo},(t,n)=>({subject:"",body:"",delayDays:Do[n]})),Ze={title:"",description:"",steps:$o},Bo=[{token:"{first_name}",label:"First name"},{token:"{last_name}",label:"Last name"},{token:"{apply_link}",label:"Apply link"}];function Ot({enrolled:t,skippedInvalid:n=[],skippedSuppressed:r=[],skippedExisting:s=[],successPrefix:l}){const o=[];return n.length&&o.push(`${n.length} failed email validation`),r.length&&o.push(`${r.length} previously bounced`),s.length&&o.push(`${s.length} already enrolled`),t===0?o.length?`No candidates were enrolled (${o.join(", ")}) — no emails will be sent.`:"No candidates were enrolled — no emails will be sent.":o.length?`${l} ${t} enrolled, ${o.join(", ")}.`:`${l} ${t} enrolled — the first email is sending now.`}function Uo(t){const n=[],r=new Set,s=[];return t.forEach(l=>{const o=l.email||l.work_email||null;if(o){const c=o.trim().toLowerCase();r.has(c)||(r.add(c),n.push({email:o.trim(),name:l.full_name||null,external_id:l.id!=null?String(l.id):null,first_name:l.first_name||null,last_name:l.last_name||null}))}else s.push(l)}),{recipients:n,missingCandidates:s}}function qo({open:t,onClose:n,selectedCount:r,onCreateSequence:s,onAddToSequence:l,selectedCandidates:o=[]}){const{getAccessTokenSilently:c}=Fe(),a=st(),[d,u]=i.useState([]),[m,h]=i.useState(!0),[f,b]=i.useState(!1),[j,k]=i.useState(Ze),[x,S]=i.useState(!1),[w,g]=i.useState([]),[v,R]=i.useState(null),[P,_]=i.useState(null),O=w.length>0,[L,D]=i.useState([]),[q,B]=i.useState(!1),[K,H]=i.useState(null),[ne,Z]=i.useState(!1),[se,te]=i.useState(!1),[ie,Y]=i.useState(null),{recipients:X,missingCandidates:G}=i.useMemo(()=>Uo(o),[o]),J=i.useCallback(async()=>{h(!0);try{const y=await ns(c);u(y?.data??[])}catch(y){console.error("Failed to fetch sequences:",y),u([])}finally{h(!1)}},[c]),re=i.useCallback(async()=>{try{const y=await sn(c);g(y?.data??[])}catch(y){console.error("Failed to fetch integration status:",y)}},[c]),le=i.useCallback(async()=>{B(!0);try{const y=await ss(c);D(y?.data??[])}catch(y){console.error("Failed to fetch sequence templates:",y),D([])}finally{B(!1)}},[c]),ce=j.steps.every(y=>y.subject.trim()&&y.body.trim()),he=j.steps.findIndex(y=>!y.subject.trim()||!y.body.trim()),C=j.title.trim()?X.length===0?"Select at least one candidate with an email on file.":ce?null:`Email ${he+1} still needs a subject and body.`:"Add a title to create this sequence.",z=y=>{k(T=>({...T,steps:y.steps.map(p=>({subject:p.subject,body:p.body,delayDays:p.delay_days}))}
1)),H(y.id)},W=async({title:y,description:T})=>{Z(!0),Y(null);try{await is(c,{title:y,description:T||null,steps:j.steps.map(p=>({subject:p.subject,body:p.body,delay_days:p.delayDays}))}),te(!1),le()}catch(p){console.error("Failed to save template:",p),Y(p.message||"Failed to save template.")}finally{Z(!1)}},E=async y=>{try{await ls(c,y.id),D(T=>T.filter(p=>p.id!==y.id)),K===y.id&&H(null)}catch(T){console.error("Failed to delete template:",T)}},M=async()=>{if(!(!j.title.trim()||X.length===0||!ce)){S(!0);try{const y=await cs(c,{title:j.title,description:j.description||null,steps:j.steps.map(T=>({subject:T.subject,body:T.body,delay_days:T.delayDays})),recipients:X});s?.(y?.data),k(Ze),b(!1),H(null),Re.success(Ot({enrolled:y?.data?.recipient_count??0,skippedInvalid:y?.skipped_invalid_email,skippedSuppressed:y?.skipped_suppressed,successPrefix:"Sequence created —"})),J(),y?.data?.id!=null&&a(`/sequences/${y.data.id}`)}catch(y){console.error("Failed to create sequence:",y),Re.error(y.message||"Failed to create sequence.")}finally{S(!1)}}},$=async y=>{if(X.length!==0){_(null),R(y.id);try{const T=await ds(c,y.id,X);Re.success(Ot({enrolled:T?.data?.added?.length??0,skippedInvalid:T?.data?.skipped_invalid_email,skippedSuppressed:T?.data?.skipped_suppressed,skippedExisting:T?.data?.skipped_existing,successPrefix:`Added to "${y.title}" —`})),l?.(y)}catch(T){console.error("Failed to add recipients to sequence:",T),_(T.message||"Failed to add candidates to this sequence.")}finally{R(null)}}},de=y=>T=>k(p=>({...p,[y]:T.target.value})),ue=(y,T)=>p=>{const I=T==="delayDays"?Math.max(0,Number(p.target.value)||0):p.target.value;k(U=>({...U,steps:U.steps.map((ye,oe)=>oe===y?{...ye,[T]:I}:ye)})),H(null)},be=()=>{b(!1),k(Ze),H(null),Y(null)};return i.useEffect(()=>{t&&Promise.resolve().then(()=>{J(),re()})},[t,J,re]),i.useEffect(()=>{f&&Promise.resolve().then(le)},[f,le]),e.jsxs(e.Fragment,{children:[e.jsx(rn,{open:t,onOpenChange:y=>!y&&n(),children:e.jsxs(on,{side:"right",className:"flex w-full flex-col sm:max-w-md",children:[e.jsx(an,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-[color-mix(in_srgb,var(--primary)_15%,transparent)]",children:e.jsx(_e,{className:"size-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(ln,{children:"Outbound sequence"}),e.jsx(rs,{children:"Enroll candidates in your hiring outreach emails"})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4",children:[e.jsxs(Q,{variant:"secondary",className:"mb-3 gap-1",children:[e.jsx(os,{className:"size-3"}),r," candidate",r===1?"":"s"," selected"]}),e.jsxs(F,{className:"mb-4 w-full",onClick:()=>b(!0),children:[e.jsx(as,{className:"size-4"}),"Create a new sequence"]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[e.jsx("span",{className:"h-px flex-1 bg-border"}),"Existing sequences",e.jsx("span",{className:"h-px flex-1 bg-border"})]}),P&&e.jsx("p",{className:"mb-2 text-sm text-destructive",children:P}),e.jsx("div",{className:"flex flex-col gap-2",children:m?e.jsx(Ho,{}):d.length===0?e.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[e.jsx(As,{className:"mx-auto mb-2 size-7 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No sequences yet."}),e.jsx("p",{className:"text-xs",children:"Create one above to start reaching out."})]}):d.map(y=>e.jsxs("button",{type:"button",disabled:v===y.id||X.length===0,onClick:()=>$(y),className:"flex items-start gap-2.5 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:border-primary hover:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] disabled:cursor-not-allowed disabled:opacity-60",children:[e.jsx(_e,{className:"mt-0.5 size-4 shrink-0 text-primary"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:y.title}),y.description&&e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:y.description}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.recipient_count??0," recipient",(y.recipient_count??0)===1?"":"s"," ·"," ",v===y.id?"Adding…":"Click to add selected candidates"]})]})]},y.id))})]})]})}),e.jsx(it,{open:f,onOpenChange:y=>!y&&!x&&be(),children:e.jsxs(lt,{className:"max-h-[90vh] overflow-y-auto sm:max-w-2xl",children:[e.jsx(ct,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[color-mix(in_srgb,var(--primary)_15%,transparent)]",children:e.jsx(_e,{className:"size-4 text-primary"})}),e.jsxs("div",{children:[e.jsx(dt,{children:"New outbound sequence"}),e.jsxs(ut,{children:[r," candidate",r===1?"":"s"," selected"]})]})]})}),O?e.jsx(Ko,{form:j,onFieldChange:de,onStepChange:ue,resolvedRecipients:X,missingCandidates:G,templates:L,loadingTemplates:q,appliedTemplateId:K,onApplyTemplate:z,onDeleteTemplate:E,onOpenSaveTemplate:()=>te(!0),canSaveTemplate:ce}):e.jsx(Vo,{onConnected:re,getAccessTokenSilently:c}),O&&e.jsxs(pt,{children:[C&&!x&&e.jsx("p",{className:"mr-auto text-xs text-muted-foreground",children:C}),e.jsx(F,{variant:"ghost",onClick:be,disabled:x,children:"Cancel"}),e.jsxs(F,{onClick:M,disabled:x||X.length===0||!ce||!j.title.trim(),children:[e.jsx(hn,{className:"size-4"}),x?"Saving…":"Create sequence"]})]})]})}),e.jsx(Wo,{open:se,onClose:()=>{te(!1),Y(null)},onSave:W,saving:ne,error:ie})]})}function Ho(){return e.jsx(e.Fragment,{children:[0,1,2].map(t=>e.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-card px-3 py-2.5",children:[e.jsx(me,{className:"mt-0.5 size-5 shrink-0 rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(me,{className:"h-4 w-1/2"}),e.jsx(me,{className:"mt-1 h-3 w-4/5"}),e.jsx(me,{className:"mt-1 h-3 w-1/3"})]})]},t))})}function Vo({onConnected:t,getAccessTokenSilently:n}
1){return e.jsxs("div",{className:"flex flex-col gap-3 py-1",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Connect your mailbox to send this sequence"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sequences send via SMTP from your own address. For Gmail, use an"," ",e.jsx("a",{href:"https://myaccount.google.com/apppasswords",target:"_blank",rel:"noopener noreferrer",children:"App Password"}),", not your regular password. Connect once — you won't be asked again."]}),e.jsx(us,{getAccessTokenSilently:n,onConnected:t})]})}function Ko({form:t,onFieldChange:n,onStepChange:r,resolvedRecipients:s,missingCandidates:l,templates:o,loadingTemplates:c,appliedTemplateId:a,onApplyTemplate:d,onDeleteTemplate:u,onOpenSaveTemplate:m,canSaveTemplate:h}){return e.jsxs("div",{className:"flex flex-col gap-5 py-1",children:[e.jsx(Go,{templates:o,loading:c,appliedTemplateId:a,onApply:d,onDelete:u,onOpenSaveTemplate:m,canSaveTemplate:h}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[e.jsx(fe,{htmlFor:"seq-title",children:"Title"}),e.jsx(ge,{id:"seq-title",value:t.title,onChange:n("title"),required:!0})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[e.jsx(fe,{htmlFor:"seq-desc",children:"Description"}),e.jsx(ge,{id:"seq-desc",value:t.description,onChange:n("description")})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[e.jsx(_e,{className:"size-4 text-primary"}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Recipients"}),e.jsx(Q,{variant:"secondary",className:"h-5",children:s.length})]}),s.length>0?e.jsx("div",{className:"flex max-h-24 flex-wrap gap-1.5 overflow-y-auto rounded-lg border border-border bg-card p-2",children:s.map(f=>e.jsxs(Q,{variant:"outline",className:"gap-1 bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]",children:[e.jsx(_e,{className:"size-3"}),f.name?`${Ne(f.name)} <${f.email}>`:f.email]},f.email))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select at least one candidate with an email on file to create a sequence."}),l.length>0&&e.jsxs("div",{className:"mt-2 rounded-lg border border-[var(--status-warning)]/40 bg-[color-mix(in_srgb,var(--status-warning)_12%,transparent)] p-2 text-sm",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Missing emails"}),e.jsxs("p",{className:"text-muted-foreground",children:[l.length," selected candidate",l.length===1?" has":"s have"," no email on file and will be skipped: ",l.map(f=>f.full_name||f.id).join(", ")]})]})]}),e.jsx(Yo,{steps:t.steps,onStepChange:r})]})}function Go({templates:t,loading:n,appliedTemplateId:r,onApply:s,onDelete:l,onOpenSaveTemplate:o,canSaveTemplate:c}){return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[e.jsx(Oe,{className:"size-4 text-primary"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-foreground",children:"Start from a template"}),e.jsxs(F,{size:"sm",variant:"ghost",onClick:o,disabled:!c,title:c?"Save the steps below as a reusable template":"Fill in all 3 steps to save as a template",children:[e.jsx(gn,{className:"size-3.5"}),"Save as template"]})]}),n?e.jsx("div",{className:"flex gap-2",children:[0,1,2].map(a=>e.jsx(me,{className:"h-8 w-32 rounded-md"},a))}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(a=>e.jsxs(Q,{variant:r===a.id?"default":"outline",className:"cursor-pointer gap-1",title:a.description||a.title,onClick:()=>s(a),children:[a.is_builtin&&e.jsx(Oe,{className:"size-3"}),a.title,!a.is_builtin&&e.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),l(a)},"aria-label":`Delete ${a.title}`,className:"rounded-full hover:opacity-70",children:e.jsx(Ye,{className:"size-3"})})]},a.id))})]})}function Wo({open:t,onClose:n,onSave:r,saving:s,error:l}){const[o,c]=i.useState(""),[a,d]=i.useState(""),[u,m]=i.useState(t);t!==u&&(m(t),t&&(c(""),d("")));const h=o.trim().length>0&&!s;return e.jsx(it,{open:t,onOpenChange:f=>!f&&!s&&n(),children:e.jsxs(lt,{className:"sm:max-w-sm",children:[e.jsxs(ct,{children:[e.jsx(dt,{children:"Save as template"}),e.jsx(ut,{children:"Saves the 3 email steps you've written so you can reuse them to start a future sequence."})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[l&&e.jsx("p",{className:"text-sm text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(fe,{htmlFor:"template-title",children:"Template name"}),e.jsx(ge,{id:"template-title",value:o,onChange:f=>c(f.target.value),autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(fe,{htmlFor:"template-desc",children:"Description (optional)"}),e.jsx(ge,{id:"template-desc",value:a,onChange:f=>d(f.target.value)})]})]}),e.jsxs(pt,{children:[e.jsx(F,{variant:"ghost",onClick:n,disabled:s,children:"Cancel"}),e.jsxs(F,{onClick:()=>r({title:o.trim(),description:a.trim()}),disabled:!h,children:[e.jsx(gn,{className:"size-4"}),s?"Saving…":"Save template"]})]})]})})}function Yo({steps:t,onStepChange:n}){const[r,s]=i.useState("0"),l=t[Number(r)],o=i.useRef(null),c=i.useRef(null),[a,d]=i.useState(null),u=m=>{const h=Number(r),f=a??"body",b=(f==="subject"?o:c).current,j=l[f]??"",k=!!a&&!!b,x=k?b.selectionStart:j.length,S=k?b.selectionEnd:j.length,w=j.slice(0,x)+m+j.slice(S);n(h,f)({target:{value:w}}),requestAnimationFrame(()=>{if(!b)return;b.focus();const g=x+m.length;b.setSelectionRange(g,g)})};return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-card",children:[e.jsx(Mo,{value:r,onValueChange:s,children:e.jsx(zo,{className:"w-full rounded-none border-b border-border bg-transparent p-0",children:t.map((m,h)=>e.jsxs(Fo,{value:String(h),className:"flex-1 gap-1.5 rounded-none",children:["Email ",h+1,!m.subject.trim()&&e.jsx("span",{className:"size-1.5 rounded-full bg-destructive"})]},h))})}),e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[Number(r)===0?e.jsxs(Q,{variant:"secondary",className:"w-fit gap-1",children:[e.jsx(hn,{className:"size-3"}),"Sends immediately when the sequence starts"]}):e.jsxs("div",{className:"flex max-w-[280px] flex-col gap-1",children:[e.jsxs(fe,{htmlFor:"step-delay",className:"flex items-center gap-1 text-xs",children:[e.jsx(Ns,{className:"size-3.5"})," Wait (days) after the previous email"]}),e.jsx(ge,{id:"step-delay",type:"number",min:0,max:90,value:l.delayDays,onChange:n(Number(r),"delayDays")})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(fe,{htmlFor:"step-subject",children:"Subject"}),e.jsx(ge,{id:"step-subject",value:l.subject,onChange:n(Number(r),"subject"),onFocus:()=>d("subject"),ref:o,required:!0})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Personalize:"}),Bo.map(({token:m,label:h})=>e.jsx(Q,{variant:"outline",className:"cursor-pointer font-mono text-[0.7rem]",title:`Insert ${h} at the cursor`,onClick:()=>u(m),children:m},m))]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(fe,{htmlFor:"step-body",children:"Body"}),e.jsx(ot,{id:"step-body",value:l.body,onChange:n(Number(r),"body"),onFocus:()=>d("body"),ref:c,rows:12,className:"text-sm leading-relaxed",required:!0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Plain text — line breaks are preserved when sent. Personalize with the tokens above — missing data falls back to a natural phrase (e.g. ","{first_name}"," → 'there'). Every email includes a way to apply: use ","{apply_link}"," to place it yourself, or it's added as a line at the end automatically."]})]})]})]})}function Xo({open:t,onOpenChange:n,candidates:r,defaultTitle:s,onCreated:l}){return e.jsx(it,{open:t,onOpenChange:n,children:e.jsx(lt,{className:"sm:max-w-lg",children:e.jsx(Qo,{candidates:r,defaultTitle:s,onCreated:l,onClose:()=>n(!1)})})})}function Qo({candidates:t,defaultTitle:n,onCreated:r,onClose:s}){const{getAccessTokenSilently:l}=Fe(),[o,c]=i.useState(n||""),[a,d]=i.useState(""),[u,m]=i.useState(!1),[h,f]=i.useState(null),[b,j]=i.useState(!1),k=async()=>{m(!0);try{const w=await _s(l,{title:o.trim(),note:a,candidates:t});f(Ts(w.data.public_code)),r?.(w.data)}catch(w){Re.error(w.message||"Couldn't create the shortlist.")}finally{m(!1)}},x=async()=>{try{await navigator.clipboard.writeText(h),j(!0),Re.success("Link copied — send it to your hiring manager.")}catch{Re.error("Couldn't copy automatically — select the link and copy it.")}},S=t.length;return e.jsxs(e.Fragment,{children:[e.jsxs(ct,{children:[e.jsx(dt,{children:h?"Shortlist ready to share":"Share with your hiring manager"}),e.jsx(ut,{children:h?"Anyone with this link can review these candidates and mark yes or no. No account needed.":`They'll see ${S} candidate${S===1?"":"s"} with why each one fits, and can mark yes or no. No account needed.`})]}),h?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ge,{readOnly:!0,value:h,onFocus:w=>w.target.select(),"aria-label":"Shortlist link"}),e.jsxs(F,{onClick:x,className:"shrink-0",children:[b?e.jsx(at,{className:"size-4"}):e.jsx(Ps,{className:"size-4"}),b?"Copied":"Copy"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Their decisions show up under Shortlists in your sidebar. Delete the shortlist there to turn the link off."})]}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(fe,{htmlFor:"shortlist-title",children:"Role"}),e.jsx(ge,{id:"shortlist-title",value:o,maxLength:200,placeholder:"e.g. Senior Backend Engineer",onChange:w=>c(w.target.value)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(fe,{htmlFor:"shortlist-note",children:"Note for the hiring manager (optional)"}),e.jsx(ot,{id:"shortlist-note",value:a,maxLength:2e3,rows:3,placeholder:"Here are my top picks. Mark the ones you'd like to interview.",onCh
1ange:w=>d(w.target.value)})]}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border bg-muted/50 px-3 py-2.5 text-xs text-muted-foreground",children:[e.jsx(Is,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"Emails and phone numbers are left out of the link, so it's safe to forward."})]})]}),e.jsx(pt,{children:h?e.jsx(F,{variant:"outline",onClick:s,children:"Done"}):e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"ghost",onClick:s,children:"Cancel"}),e.jsx(F,{onClick:k,disabled:u||!o.trim()||S===0,children:u?"Creating link…":"Create link"})]})})]})}const Kn=[{key:"open_to_work",label:"Open to Work",type:"boolean"},{key:"location",label:"Location",type:"text-multi",placeholder:"City, state, or country"},{key:"job_title",label:"Job Title",type:"text-multi",placeholder:"e.g. Software Engineer"},{key:"job_company_name",label:"Current Company",type:"text-multi",placeholder:"e.g. Google"},{key:"industry",label:"Industry",type:"text-multi",placeholder:"e.g. Fintech"},{key:"job_company_size",label:"Company Size",type:"select-multi",options:["1-10","11-50","51-200","201-500","501-1,000","1,001-5,000","5,001-10,000","10,001+"]},{key:"experience_level",label:"Seniority",type:"select-multi",options:["Entry","Mid","Senior","Manager","Director","VP","C-Level","Owner/Founder"]},{key:"skills",label:"Skills",type:"text-multi",placeholder:"e.g. Python, Salesforce"},{key:"school_name",label:"School",type:"text-multi",placeholder:"e.g. UC Berkeley"},{key:"education_degrees",label:"Degree",type:"select-multi",options:["High School","Associate","Bachelor's","Master's","MBA","Doctorate / PhD"]},{key:"languages",label:"Languages",type:"text-multi",placeholder:"e.g. Spanish"},{key:"certifications",label:"Certifications",type:"text-multi",placeholder:"e.g. PMP, AWS Certified"},{key:"remote",label:"Work Type",type:"select-single",options:["Remote","Onsite","Hybrid"]}];function qe(){return{}}function Gn(t){return Object.values(t).reduce((n,r)=>Array.isArray(r)?n+r.length:typeof r=="boolean"?n+(r?1:0):r?n+1:n,0)}function zt(t){const n=[];for(const r of Kn){const s=t[r.key];s!=null&&(Array.isArray(s)?s.forEach((l,o)=>n.push({key:r.key,label:r.label,display:l,arrayIndex:o})):typeof s=="boolean"?s&&n.push({key:r.key,label:r.label,display:"Yes"}):s!==""&&n.push({key:r.key,label:r.label,display:s}))}return n}function Zo({def:t,value:n,onChange:r}){const[s,l]=i.useState(""),o=n||[],c=()=>{const a=s.trim();a&&!o.includes(a)&&r([...o,a]),l("")};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ge,{placeholder:t.placeholder,value:s,onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),c())},onBlur:c}),o.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map((a,d)=>e.jsxs(Q,{variant:"outline",className:"gap-1 pr-1",children:[a,e.jsx("button",{type:"button",onClick:()=>r(o.filter((u,m)=>m!==d)),"aria-label":`Remove ${a}`,className:"rounded-full hover:bg-muted",children:e.jsx(Ye,{className:"size-3"})})]},`${a}-${d}`))})]})}function Jo({def:t,value:n,onChange:r}){const s=n||[],l=o=>{r(s.includes(o)?s.filter(c=>c!==o):[...s,o])};return e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.options.map(o=>e.jsx(Q,{variant:s.includes(o)?"default":"outline",className:"cursor-pointer select-none",onClick:()=>l(o),children:o},o))})}function ea({def:t,value:n,onChange:r}){switch(t.type){case"text-multi":return e.jsx(Zo,{def:t,value:n,onChange:r});case"select-multi":return e.jsx(Jo,{def:t,value:n,onChange:r});case"select-single":return e.jsxs(_t,{value:n||"__any",onValueChange:s=>r(s==="__any"?null:s),children:[e.jsx(Pt,{className:"w-full",children:e.jsx(Tt,{placeholder:"Any"})}),e.jsxs(It,{children:[e.jsx(He,{value:"__any",children:"Any"}),t.options.map(s=>e.jsx(He,{value:s,children:s},s))]})]});case"boolean":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(fe,{htmlFor:`filter-${t.key}`,className:"text-sm font-normal text-foreground",children:"Only show candidates likely open to work"}),e.jsx(Hn,{id:`filter-${t.key}`,checked:!!n,onCheckedChange:r})]});default:return null}}function ta({count:t,onClick:n}){return e.jsxs(F,{type:"button",variant:"outline",size:"sm",onClick:n,className:"relative",children:[e.jsx(Os,{className:"size-4"}),"Advanced filters",t>0&&e.jsx(Q,{className:"ml-1 h-4 min-w-4 rounded-full px-1 text-[10px]",children:t})]})}function na({open:t,onClose:n,filters:r,onChange:s,onClear:l}){const o=Gn(r),c=(a,d)=>s({...r,[a]:d});return e.jsx(rn,{open:t,onOpenChange:a=>!a&&n(),children:e.jsxs(on,{side:"right",className:"flex w-full flex-col sm:max-w-sm",children:[e.jsx(an,{children:e.jsxs(ln,{children:["Filters ",o>0&&`(${o})`]})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4",children:e.jsx("div",{className:"flex flex-col divide-y divide-border",children:Kn.map(a=>e.jsxs("details",{className:"group py-3",open:a.key==="location"||a.key==="job_title",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between text-sm font-medium text-foreground",children:[a.label,e.jsx("span",{className:"text-muted-foreground transition-transform group-open:rotate-180",children:"⌄"})]}),e.jsx("div",{className:"mt-2.5",children:e.jsx(ea,{def:a,value:r[a.key],onChange:d=>c(a.key,d)})})]},a.key))})}),e.jsxs(ps,{className:"flex-row gap-2 border-t border-border pt-3",children:[e.jsx(F,{variant:"outline",className:"flex-1",onClick:l,disabled:o===0,children:"Clear all"}),e.jsx(ms,{asChild:!0,children:e.jsx(F,{className:"flex-1",children:"Apply"})})]})]})})}const sa={free:bs,growth:vs},ra=.8;function oa(){const{getAccessTokenSilently:t}=Fe(),n=st(),[r,s]=i.useState(null),[l,o]=i.useState(!1);if(i.useEffect(()=>{dn(t).then(s).catch(()=>{})},[t]),l||!r)return null;const c=sa[r.plan];if(!c)return null;const a=r.candidatesReturned??0,d=Math.max(0,c-a);return a/c<ra?null:e.jsxs("div",{className:"mx-4 mt-3 flex items-center gap-3 rounded-lg border border-primary/25 bg-[color-mix(in_srgb,var(--primary)_8%,var(--background))] px-3 py-2.5 sm:mx-6",children:[e.jsx(Oe,{className:"size-4 shrink-0 text-primary"}),e.jsxs("p",{className:"min-w-0 flex-1 text-sm text-foreground",children:[d===0?"You've used every candidate on your plan.":`Only ${d} candidate${d===1?"":"s"} left on your plan.`," ",e.jsx("span",{className:"text-muted-foreground",children:"Upgrade for more room to search."})]}),e.jsx(F,{size:"sm",onClick:()=>n("/pricing"),className:"shrink-0",children:"Upgrade"}),e.jsx(F,{size:"icon",variant:"ghost",className:"size-7 shrink-0",onClick:()=>o(!0),"aria-label":"Dismiss",children:e.jsx(Ye,{className:"size-3.5"})})]})}const Ft="connekt-onboarding-dismissed",Wn="connekt-first-search-done";function aa({hasSearched:t}){const{getAccessTokenSilently:n}=Fe(),[r,s]=i.useState(null),[l,o]=i.useState(()=>{try{return localStorage.getItem(Ft)==="1"}catch{return!1}});i.useEffect(()=>{sn(n).then(d=>s((d?.data??[]).some(u=>u.provider==="smtp"))).catch(()=>s(!1))},[n]);const c=t||(()=>{try{return localStorage.getItem(Wn)==="1"}catch{return!1}})();if(l||r===null||r&&c)return null;const a=()=>{o(!0);try{localStorage.setItem(Ft,"1")}catch{}};return e.jsxs("div",{className:"mb-4 flex w-full max-w-[560px] items-center gap-4 roun
1ded-lg border border-border bg-card px-3 py-2 text-sm",children:[e.jsx(Lt,{done:r,label:"Connect mailbox"}),e.jsx(Lt,{done:c,label:"Run your first search"}),e.jsx("button",{type:"button",onClick:a,"aria-label":"Dismiss getting-started checklist",className:"ml-auto rounded p-0.5 text-muted-foreground hover:text-foreground",children:e.jsx(Ye,{className:"size-3.5"})})]})}function Lt({done:t,label:n}){return e.jsxs("span",{className:"flex items-center gap-1.5 "+(t?"text-muted-foreground line-through":"font-medium text-foreground"),children:[t?e.jsx(Ss,{className:"size-4 text-[var(--status-good)]"}):e.jsx(Es,{className:"size-4"}),n]})}const Je=5,et=25;function ia(t){return t==="free"?[un]:ys}const la=["entry","senior","manager","director","vp","cxo","owner"],Dt=t=>!t||t.length===0?-1:Math.max(...t.map(n=>la.indexOf((n||"").toLowerCase()))),$t=t=>{if(!t)return-1;const n=new Date(t);return Number.isNaN(n.getTime())?-1:(Date.now()-n.getTime())/(1e3*60*60*24*365.25)},ca=[{value:"relevance",label:"Best match"},{value:"rank_score",label:"Highest fit score"},{value:"seniority",label:"Most senior"},{value:"tenure",label:"Longest tenure"},{value:"open_to_work",label:"Open to work first"}];function da(t,n){if(n==="relevance")return t;const r=[...t];return n==="rank_score"?r.sort((s,l)=>s.rank_score==null&&l.rank_score==null?0:s.rank_score==null?1:l.rank_score==null?-1:l.rank_score-s.rank_score):n==="seniority"?r.sort((s,l)=>Dt(l.experience_level)-Dt(s.experience_level)):n==="tenure"?r.sort((s,l)=>$t(l.start_date)-$t(s.start_date)):n==="open_to_work"&&r.sort((s,l)=>(l.open_to_work?1:0)-(s.open_to_work?1:0)),r}const ua=["Find me a backend software developer in New York with experience in processing and organizing medical data","Show me a senior sales rep open to new roles in Chicago","I need a sales manager with 5+ years of experience in tech","Locate me a social media marketing intern in San Francisco"],pa={payment_required:{title:"You've used all your searches",description:"Upgrade your plan to keep searching",actionLabel:"Upgrade Plan"},no_results:{title:"No candidates match your search",description:"Try adjusting your search criteria and search again.",actionLabel:"Try Again"},fetch_failed:{title:"Something went wrong",description:"We couldn't complete your search. Try again or contact support.",actionLabel:"Try Again"},timeout:{title:"That search took too long",description:"Try simplifying your query or removing a few filters, then search again.",actionLabel:"Try Again"},network_error:{title:"Connection issue",description:"Check your connection and try again.",actionLabel:"Try Again"},out_of_candidates:{title:"You've used all your candidates",description:"You've hit this plan's candidate limit — upgrade for more room.",actionLabel:"Upgrade Plan"}},ma={title:"Something went wrong",description:"Please try again.",actionLabel:"Try Again"},fa=new Set(["payment_required","out_of_candidates"]);function ha(){const{getAccessTokenSilently:t}=Fe(),n=st(),[r,s]=i.useState(""),[l,o]=i.useState(qe()),[c,a]=i.useState(!1),[d,u]=i.useState(et),[m,h]=i.useState("relevance"),[f,b]=i.useState([]),[j,k]=i.useState(null);i.useEffect(()=>{go(t).then(b).catch(()=>{}),dn(t).then(p=>{const I=p?.plan??null;k(I),I==="free"&&u(un)}).catch(()=>{})},[]);const x=ia(j),[S,w]=i.useState(!1),[g,v]=i.useState(null),[R,P]=i.useState(null),[_,O]=i.useState(1),[L,D]=i.useState(new Set),[q,B]=i.useState(!1),[K,H]=i.useState(!1),[ne,Z]=i.useState(""),se=i.useCallback(p=>{D(I=>{const U=new Set(I);return U.has(p)?U.delete(p):U.add(p),U})},[]),te=p=>{const I=p.length>0&&p.every(U=>L.has(U));D(I?new Set:new Set(p))},ie=p=>{p&&(D(new Set),B(!1))},Y=()=>{D(new Set),B(!1)},X=()=>o(qe()),G=p=>{o(I=>{const U={...I},ye=U[p.key];if(Array.isArray(ye)){const oe=ye.filter((wa,Yn)=>Yn!==p.arrayIndex);oe.length===0?delete U[p.key]:U[p.key]=oe}else delete U[p.key];return U})},J=p=>s(p),re=(p,I={})=>{const U=I.filters??l,ye=I.resultLimit??d;v(null),w(!0),h("relevance"),xo(t,p,U,ye).then(oe=>{if(oe.success===!0){P(oe.data),Z(p),O(1),o(U),u(ye),oe.history&&b(oe.history);try{localStorage.setItem(Wn,"1")}catch{}}else v({type:oe?.error?.type??"unknown",message:oe?.error?.message??"Something went wrong please try again or c
1ontact support."})}).catch(oe=>{v({type:"network_error",message:oe.message??"Check your connection and try again."})}).finally(()=>{s(""),w(!1)})},le=p=>{v(null),s(""),o(p.filters||qe()),u(p.resultLimit||et),h("relevance"),P(p.candidates),Z(p.query||""),O(1)},ce=p=>{re(p.query,{filters:p.filters||qe(),resultLimit:p.resultLimit||et})},he=()=>{vo(t).then(b).catch(()=>{})},C=Array.isArray(R)?R:[],z=da(C,m),W=Math.ceil(z.length/Je),E=z.slice((_-1)*Je,_*Je),M=C.map(p=>p.id),$=M.length>0&&M.every(p=>L.has(p)),{focusedIndex:de,setFocusedIndex:ue,registerItem:be}=xs({count:E.length,onSelect:p=>{const I=E[p];I&&se(I.id)},enabled:!q&&!c}),y=p=>{O(p),ue(-1),window.scrollTo({top:0,behavior:"smooth"})};if(S)return e.jsx("div",{className:"w-full p-4 sm:p-6",children:e.jsx("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-2.5",children:Array.from({length:5}).map((p,I)=>e.jsx(Ao,{},I))})});const T=e.jsx("div",{className:"flex min-h-full w-full flex-1 flex-col p-4 sm:p-6",style:{backgroundImage:"radial-gradient(var(--border) 1.5px, transparent 1.5px)",backgroundSize:"24px 24px"},children:e.jsx("div",{className:"mx-auto flex w-full max-w-3xl flex-col items-center gap-5",children:e.jsxs("div",{className:"flex w-full flex-1 flex-col items-center",children:[e.jsx(aa,{}),e.jsx("h2",{className:"mt-[5%] mb-1 text-center text-2xl font-semibold sm:text-3xl md:text-4xl",children:"Let's find your next hire"}),e.jsx("p",{className:"mb-4 max-w-[480px] text-center text-sm text-muted-foreground",children:"Describe who you're looking for in plain English, or open advanced filters to narrow by location, seniority, skills, and more."}),e.jsx(na,{open:c,onClose:()=>a(!1),filters:l,onChange:o,onClear:X}),e.jsxs("div",{className:"mb-2 flex w-full flex-col items-center gap-1 md:items-end",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ba,{value:d,onChange:u,options:x}),e.jsx(ta,{count:Gn(l),onClick:()=>a(!0)})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"More candidates, same search"})]}),zt(l).length>0&&e.jsx("div",{className:"mb-2 flex w-full flex-wrap gap-1.5",children:zt(l).map(p=>e.jsxs(Q,{variant:"secondary",className:"gap-1 pr-1",children:[p.label,": ",p.display,e.jsx("button",{type:"button",onClick:()=>G(p),className:"rounded-full hover:bg-muted-foreground/20","aria-label":`Remove ${p.label} filter`,children:"×"})]},`${p.key}-${p.arrayIndex??p.display}`))}),e.jsx(va,{query:r,onQueryChange:s,onSubmit:()=>re(r)}),f.length>0&&e.jsxs("div",{className:"mt-4 flex w-full flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Recent searches"}),e.jsx("button",{type:"button",onClick:he,className:"text-xs font-semibold text-muted-foreground underline",children:"Clear"})]}),e.jsx("div",{className:"flex flex-col gap-0.5 rounded-lg border border-border bg-card p-1.5",children:f.map(p=>e.jsx(ya,{entry:p,onReplay:()=>le(p),onRerun:()=>ce(p)},p.id))})]}),e.jsx("div",{className:"mt-4 flex w-full flex-col gap-0.5 rounded-lg border border-border bg-card p-1.5",children:ua.map(p=>e.jsx(Sa,{text:p,onClick:()=>J(p)},p))})]})})});if(g){const p=pa[g.type]??ma,I=fa.has(g.type),U=()=>I?n("/pricing"):v(null);return I?e.jsxs("div",{className:"relative flex w-full flex-1 flex-col",children:[e.jsx("div",{className:"pointer-events-none flex w-full flex-1 flex-col opacity-40",children:T}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/45 p-4 sm:p-6",children:e.jsx(xa,{title:p.title,description:g.message??p.description,actionLabel:p.actionLabel,onAction:U})})]}):e.jsx(ga,{title:p.title,description:g.message??p.description,actionLabel:p.actionLabel,onAction:U})}return R?e.jsxs("div",{className:"w-full p-4 sm:p-6",children:[e.jsx(oa,{}),e.jsxs("div",{className:"mx-auto mb-3 mt-3 flex w-full max-w-3xl flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.length," candidate",C.length===1?"":"s"," found"]}
1),e.jsx(gs,{})]}),e.jsxs(_t,{value:m,onValueChange:p=>{h(p),O(1)},children:[e.jsx(Pt,{className:"w-[180px]",children:e.jsx(Tt,{})}),e.jsx(It,{children:ca.map(p=>e.jsx(He,{value:p.value,children:p.label},p.value))})]})]}),e.jsxs("div",{className:"mx-auto mb-3 flex w-full max-w-3xl items-center justify-between rounded-lg border border-border bg-card px-3 py-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Select all results"}),e.jsx(Hn,{checked:$,onCheckedChange:()=>te(M),"aria-label":"Select all candidates across all result pages"})]}),e.jsx(qo,{open:q,onClose:()=>B(!1),selectedCount:L.size,selectedCandidates:C.filter(p=>L.has(p.id)),onCreateSequence:ie,onAddToSequence:Y}),e.jsx(Xo,{open:K,onOpenChange:H,candidates:C.filter(p=>L.has(p.id)),defaultTitle:ne}),e.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-2.5",children:[e.jsx(fs,{initial:!1,mode:"popLayout",children:E.map((p,I)=>e.jsx(Jt.div,{ref:be(I),className:"relative scroll-mt-4",initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,transition:{duration:.1}},transition:{duration:.15,ease:"easeOut",delay:Math.min(I*.02,.1)},children:e.jsx(Eo,{userData:p,checked:L.has(p.id),onToggleChecked:()=>se(p.id),focused:I===de})},p.id))}),W>1&&e.jsx("div",{className:"mb-6 mt-1 flex items-center justify-center gap-1.5",children:Array.from({length:W}).map((p,I)=>e.jsx(F,{size:"icon",variant:_===I+1?"default":"outline",className:"size-8",onClick:()=>y(I+1),children:I+1},I))})]}),L.size>0&&!q&&e.jsx(ja,{count:L.size,onClear:()=>D(new Set),onShare:()=>H(!0),onReview:()=>B(!0)})]}):T}function xa({title:t,description:n,actionLabel:r,onAction:s}){return e.jsxs("div",{className:"w-full max-w-[420px] rounded-xl border border-border bg-card p-6 text-center",children:[e.jsx("h3",{className:"mb-1 text-xl font-bold",children:t}),e.jsx("p",{className:"mb-6 text-sm text-muted-foreground",children:n}),e.jsx(F,{className:"w-full",onClick:s,children:r})]})}function ga({title:t,description:n,actionLabel:r,onAction:s}){return e.jsx("div",{className:"flex justify-center p-10",children:e.jsxs("div",{className:"max-w-[480px] text-center",children:[e.jsx("h3",{className:"mb-1 text-xl font-semibold",children:t}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:n}),e.jsx(F,{variant:"outline",onClick:s,children:r})]})})}function va({query:t,onQueryChange:n,onSubmit:r}){return e.jsxs("div",{className:"relative w-full",children:[e.jsx(ot,{value:t,onChange:s=>n(s.target.value),placeholder:"Tell us more about your hiring needs...",rows:2,className:"min-h-[64px] resize-none rounded-lg bg-card pr-14 pb-14 text-sm sm:text-base",onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),r())}}),e.jsx(F,{size:"icon",className:"absolute bottom-2.5 right-2.5 size-9 rounded-full sm:bottom-3 sm:right-3","aria-label":"Search",onClick:s=>{s.currentTarget.blur(),r()},children:e.jsx(Fs,{className:"size-4"})})]})}function ba({value:t,onChange:n,options:r}){return e.jsxs(_t,{value:String(t),onValueChange:s=>n(Number(s)),children:[e.jsx(Pt,{className:"w-[168px]",children:e.jsx(Tt,{})}),e.jsx(It,{children:r.map(s=>e.jsxs(He,{value:String(s),children:[s," candidates"]},s))})]})}function ya({entry:t,onReplay:n,onRerun:r}){return e.jsxs("div",{onClick:n,className:"flex cursor-pointer items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:bg-muted",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-foreground",children:t.query||"Untitled search"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.resultCount," result",t.resultCount===1?"":"s"," · ",bo(t.timestamp)]})]}),e.jsx(F,{size:"icon",variant:"ghost",className:"size-7 shrink-0","aria-label":"Search again",onClick:s=>{s.stopPropagation(),r()},children:e.jsx(zs,{className:"size-3.5"})})]})}function ja({count:t,onClear:n,onShare:r,onReview:s}){return e.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-4",children:e.jsxs("div",{className:"pointer-events-auto flex flex-wrap items-center justify-center gap-2 rounded-xl border border-border bg-card px-4 py-3 shadow-lg sm:gap-3",children:[e.jsxs("span",{className:"text-sm font-semibold",children:[t," candidate",t===1?"":"s"," selected"]}),e.jsx(F,{variant:"ghost",size:"sm",onClick:n,children:"Clear"}),e.jsx(F,{variant:"outline",size:"sm",onClick:r,children:"Share with hiring manager"}),e.jsx(F,{size:"sm",onClick:s,children:"Reach out"})]})})}function Sa({text:t,onClick:n}){return e.jsx("div",{onClick:n,className:"cursor-pointer rounded-lg px-3 py-2 text-sm text-foreground hover:bg-muted",children:t})}function si(){return e.jsx(hs,{title:"Search",children:e.jsx(ha,{})})}
1export{si as default};

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.