PageSourceSearch

https://sd-public-website.lovable.app/assets/AdminPage-Da-kcIRo.js

js sd-public-website.lovable.app collected 2026-10-03 03:44:27 UTC 90,224 bytes, 114 lines download raw bytes

vendor: 10,220 bytes, lines 1-61
1var on=e=>{throw TypeError(e)};var ct=(e,t,n)=>t.has(e)||on("Cannot "+n);var x=(e,t,n)=>(ct(e,t,"read from private field"),n?n.call(e):t.get(e)),L=(e,t,n)=>t.has(e)?on("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),T=(e,t,n,r)=>(ct(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),P=(e,t,n)=>(ct(e,t,"access private method"),n);import{c as W,x as ya,y as cn,z as q,D as wt,E as _e,F as St,G as Ct,I as ln,J as xa,K as $e,M as ba,N as wa,O as un,Q as _n,r as l,T as Sa,U as Ca,V as Rn,W as X,X as Ea,j as a,B as K,Y as Bt,Z as In,d as Q,u as Na,e as Ye,_ as Tn,$ as qe,f as G,i as j,h as de,g as Kt,s as Re,P as Ae,a0 as Gt,a1 as Dn,a2 as ja,a3 as Ma,a4 as _a,a5 as Ra,a6 as Ia,a7 as Ta,a8 as Da,a9 as Et,aa as Nt,ab as jt,ac as Mt,L as ka,b as Aa}from"./index-Cqem7pi9.js";import{u as Vt,B as lt,f as kn,_ as re,a as An,b as Pa,R as _t,T as La,c as Pn,d as oe,e as ie,S as Oa,E as Fa,g as $a,h as Ua,i as Ln,L as Ba,A as Ka}from"./StatusBadge-DABFe7kY.js";import{a as On,b as Ga,C as Fn,c as $n,d as Un,e as Va}from"./card-DYzphSI7.js";import{a as dn,I as Ha,L as Wa}from"./input-C2aVidaQ.js";import{C as Qa}from"./check-B1ncVtU2.js";import{F as Bn}from"./file-text-Bg-a3LDW.js";import"./separator-LmtFolZA.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ne=W("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Kn=W("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const qa=W("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const za=W("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Xa=W("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Ya=W("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const Ja=W("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const Za=W("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const es=W("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const ts=W("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const ns=W("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
57 * @license lucide-react v0.462.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const rs=W("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var B,N,De,$,ce,be,ee,ae,ke,we,Se,le,ue,se,Ce,R,je,Rt,It,Tt,Dt,kt,At,Pt,Gn,Mn,as=(Mn=class extends ya{constructor(t,n){super();L(this,R);L(this,B);L(this,N);L(this,De);L(this,$);L(this,ce);L(this,be);L(this,ee);L(this,ae);L(this,ke);L(this,we);L(this,Se);L(this,le);L(this,ue);L(this,se);L(this,Ce,new Set);this.options=n,T(this,B,t),T(this,ae,null),T(this,ee,cn()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(x(this,N).addObserver(this),fn(x(this,N),this.options)?P(this,R,je).call(this):this.updateResult(),P(this,R,Dt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Lt(x(this,N),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lt(x(this,N),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,P(this,R,kt).call(this),P(this,R,At).call(this),x(this,N).removeObserver(this)}setOptions(t){const n=this.options,r=x(this,N);if(this.options=x(this,B).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof q(this.options.enabled,x(this,N))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");P(this,R,Pt).call(this),x(this,N).setOptions(this.options),n._defaulted&&!wt(this.options,n)&&x(this,B).getQueryCache().notify({type:"observerOptionsUpdated",query:x(this,N),observer:this});const s=this.hasListeners();s&&hn(x(this,N),r,this.options,n)&&P(this,R,je).call(this),this.updateResult(),s&&(x(this,N)!==r||q(this.options.enabled,x(this,N))!==q(n.enabled,x(this,N))||_e(this.options.staleTime,x(this,N))!==_e(n.staleTime,x(this,N)))&&P(this,R,Rt).call(this);const o=P(this,R,It).call(this);s&&(x(this,N)!==r||q(this.options.enabled,x(this,N))!==q(n.enabled,x(this,N))||o!==x(this,se))&&P(this,R,Tt).call(this,o)}getOptimisticResult(t){const n=x(this,B).getQueryCache().build(x(this,B),t),r=this.createResult(n,t);return os(this,r)&&(T(this,$,r),T(this,be,this.options),T(this,ce,x(this,N).state)),r}getCurrentResult(){return x(this,$)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&x(this,ee).status==="pending"&&x(this,ee).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){x(this,Ce).add(t)}getCurrentQuery(){return x(this,N)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=x(this,B).defaultQueryOptions(t),r=x(this,B).getQueryCache().build(x(this,B),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return P(this,R,je).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),x(this,$)))}createResult(t,n){var A;const r=x(this,N),s=this.options,o=x(this,$),c=x(this,ce),i=x(this,be),h=t!==r?t.state:x(this,De),{state:d}=t;let u={...d},m=!1,g;if(n._optimisticResults){const I=this.hasListeners(),O=!I&&fn(t,n),F=I&&hn(t,r,n,s);(O||F)&&(u={...u,...wa(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:b,errorUpdatedAt:p,status:v}=u;g=u.data;let y=!1;if(n.placeholderData!==void 0&&g===void 0&&v==="pending"){let I;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(I=o.data,y=!0):I=typeof n.placeholderData=="function"?n.placeholderData((A=x(this,Se))==null?void 0:A.state.data,x(this,Se)):n.placeholderData,I!==void 0&&(v="success",g=un(o==null?void 0:o.data,I,n),m=!0)}if(n.select&&g!==void 0&&!y)if(o&&g===(c==null?void 0:c.data)&&n.select===x(this,ke))g=x(this,we);else try{T(this,ke,n.select),g=n.select(g),g=un(o==null?void 0:o.data,g,n),T(this,we,g),T(this,ae,null)}catch(I){T(this,ae,I)}x(this,ae)&&(b=x(this,ae),g=x(this,we),p=Date.now(),v="error");const C=u.fetchStatus==="fetching",w=v==="pending",S=v==="error",M=w&&C,k=g!==void 0,_={status:v,fetchStatus:u.fetchStatus,isPending:w,isSuccess:v==="success",isError:S,isInitialLoading:M,isLoading:M,data:g,dataUpdatedAt:u.dataUpdatedAt,error:b,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>h.dataUpdateCount||u.errorUpdateCount>h.errorUpdateCount,isFetching:C,isRefetching:C&&!w,isLoadingError:S&&!k,isPaused:u.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&k,isStale:Ht(t,n),refetch:this.refetch,promise:x(this,ee),isEnabled:q(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=Y=>{_.status==="error"?Y.reject(_.error):_.data!==void 0&&Y.resolve(_.data)},O=()=>{const Y=T(this,ee,_.promise=cn());I(Y)},F=x(this,ee);
61switch(F.status){case"pending":t.queryHash===r.queryHash&&I(F);break;case"fulfilled":(_.status==="error"||_.data!==F.value)&&O();break;case"rejected":(_.status!=="error"||_.error!==F.reason)&&O();break}}return _}updateResult(){const t=x(this,$),n=this.createResult(x(this,N),this.options);if(T(this,ce,x(this,N).state),T(this,be,this.options),x(this,ce).data!==void 0&&T(this,Se,x(this,N)),wt(n,t))return;T(this,$,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!x(this,Ce).size)return!0;const c=new Set(o??x(this,Ce));return this.options.throwOnError&&c.add("error"),Object.keys(x(this,$)).some(i=>{const f=i;return x(this,$)[f]!==t[f]&&c.has(f)})};P(this,R,Gn).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&P(this,R,Dt).call(this)}},B=new WeakMap,N=new WeakMap,De=new WeakMap,$=new WeakMap,ce=new WeakMap,be=new WeakMap,ee=new WeakMap,ae=new WeakMap,ke=new WeakMap,we=new WeakMap,Se=new WeakMap,le=new WeakMap,ue=new WeakMap,se=new WeakMap,Ce=new WeakMap,R=new WeakSet,je=function(t){P(this,R,Pt).call(this);let n=x(this,N).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(St)),n},Rt=function(){P(this,R,kt).call(this);const t=_e(this.options.staleTime,x(this,N));if(Ct||x(this,$).isStale||!ln(t))return;const r=xa(x(this,$).dataUpdatedAt,t)+1;T(this,le,$e.setTimeout(()=>{x(this,$).isStale||this.updateResult()},r))},It=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(x(this,N)):this.options.refetchInterval)??!1},Tt=function(t){P(this,R,At).call(this),T(this,se,t),!(Ct||q(this.options.enabled,x(this,N))===!1||!ln(x(this,se))||x(this,se)===0)&&T(this,ue,$e.setInterval(()=>{(this.options.refetchIntervalInBackground||ba.isFocused())&&P(this,R,je).call(this)},x(this,se)))},Dt=function(){P(this,R,Rt).call(this),P(this,R,Tt).call(this,P(this,R,It).call(this))},kt=function(){x(this,le)&&($e.clearTimeout(x(this,le)),T(this,le,void 0))},At=function(){x(this,ue)&&($e.clearInterval(x(this,ue)),T(this,ue,void 0))},Pt=function(){const t=x(this,B).getQueryCache().build(x(this,B),this.options);if(t===x(this,N))return;const n=x(this,N);T(this,N,t),T(this,De,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Gn=function(t){_n.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(x(this,$))}),x(this,B).getQueryCache().notify({query:x(this,N),type:"observerResultsUpdated"})})},Mn);function ss(e,t){return q(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function fn(e,t){return ss(e,t)||e.state.data!==void 0&&Lt(e,t,t.refetchOnMount)}function Lt(e,t,n){if(q(t.enabled,e)!==!1&&_e(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ht(e,t)}return!1}function hn(e,t,n,r){return(e!==t||q(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ht(e,n)}function Ht(e,t){return q(t.enabled,e)!==!1&&e.isStaleByTime(_e(t.staleTime,e))}function os(e,t){return!wt(e.getCurrentResult(),t)}var Vn=l.createContext(!1),is=()=>l.useContext(Vn);Vn.Provider;var cs=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ls=e=>{l.useEffect(()=>{e.clearReset()},[e])},us=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Sa(n,[e.error,r])),ds=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},fs=(e,t)=>e.isLoading&&e.isFetching&&!t,hs=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,mn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ms(e,t,n){var u,m,g,b,p;const r=is(),s=Ca(),o=Rn(),c=o.defaultQueryOptions(e);(m=(u=o.getDefaultOptions().queries)==null?void 0:u._experimental_beforeQuery)==null||m.call(u,c),c._optimisticResults=r?"isRestoring":"optimistic",ds(c),cs(c,s),ls(s);const i=!o.getQueryCache().get(c.queryHash),[f]=l.useState(()=>new t(o,c)),h=f.getOptimisticResult(c),d=!r&&e.subscribed!==!1;if(l.useSyncExternalStore(l.useCallback(v=>{const y=d?f.subscribe(_n.batchCalls(v)):St;return f.updateResult(),y},[f,d]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),l.useEffect(()=>{f.setOptions(c)},[c,f]),hs(c,h))throw mn(c,f,s);if(us({result:h,errorResetBoundary:s,throwOnError:c.throwOnError,query:o.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw h.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,c,h),c.experimental_prefetchInRender&&!Ct&&fs(h,r)){const v=i?mn(c,f,s):(p=o.getQueryCache().get(c.queryHash))==null?void 0:p.promise;v==null||v.catch(St).finally(()=>{f.updateResult()})}return c.notifyOnChangeProps?h:f.trackResult(h)}function ps(e,t){return ms(e,as)}const pn=e=>Array.isArray(e)?e.map(t=>{const n=Je(t.id),r=t.email||t.business_email,s=t.company_name||t.companyName||t.company||"";let o="new";return(t.status==="contacted"||t.status==="closed")&&(o=t.status),{id:n,created_at:t.created_at,name:t.name||"",business_email:r||"",phone:t.phone||"",company_name:s,group:t.group||void 0,lead_type:t.lead_type==="contact"||t.lead_type==="deal"?t.lead_type:"contact",status:o,notes:t.notes||void 0}}):[],Je=e=>typeof e=="number"?e.toString():typeof e=="string"&&/^\d+$/.test(e)?e:(Date.now()+Math.floor(Math.random()*1e3)).toString(),Wt=()=>{const e=localStorage.getItem("syncedLeadIds");return e?JSON.parse(e):[]},Hn=()=>{const e=localStorage.getItem("syncedLeadDates");return e?JSON.parse(e):{}},gs=(e,t=[])=>{const n=Wt(),r=[...new Set([...n,...e])];localStorage.setItem("syncedLeadIds",JSON.stringify(r));const o={...Hn()};t.forEach(c=>{o[c]=!0}),localStorage.setItem("syncedLeadDates",JSON.stringify(o))},Ve=e=>{const t=new Date(e.created_at);return`${e.lead_type}-${t.toISOString().split("T")[0]}-${t.getHours()}-${t.getMinutes()}`},vs=(e,t)=>{const n=e.id.toString(),r=Wt(),s=Hn(),o=Ve(e);if(r.includes(n))return console.log(`Lead ${n} already synced by ID`),!0;if(s[o])return console.log(`Lead with signature ${o} already synced by date+time`),!0;if(t.map(d=>d.id.toString()).includes(n))return console.log(`Lead ${n} already exists in database`),!0;const i=new Date(e.created_at),f=`${i.toISOString().split("T")[0]}-${i.getHours()}-${i.getMinutes()}`;return t.some(d=>{const u=new Date(d.created_at),m=`${u.toISOString().split("T")[0]}-${u.getHours()}-${u.getMinutes()}`;return f===m})?(console.log(`Lead ${n} has a date-time duplicate in database`),!0):!1},ys=async(e,t,n,r,s=!1)=>{var o,c,i;if(!(!n||e.length===0))try{console.log(`Attempting to sync ${e.length} ${((o=e[0])==null?void 0:o.lead_type)||"unknown"} leads to Supabase`);let f=!1;try{const{data:y,error:C}=await n.rpc("get_table_columns",{table_name:"leads"});!C&&y&&(f=y.some(w=>w.column_name==="notes"))}catch(y){console.error("Error checking table structure:",y)}console.log("Notes column exists in leads table:",f?"Yes":"No");const{data:h,error:d}=await n.from("leads").select("id").eq("lead_type",((c=e[0])==null?void 0:c.lead_type)||"");d&&console.error("Error fetching lead IDs for deduplication:",d);const u=new Set;h&&h.forEach(y=>u.add(y.id.toString())),t.forEach(y=>u.add(y.id.toString())),console.log(`Found ${u.size} distinct lead IDs already in database`);const{data:m,error:g}=await n.from("leads").select("id, created_at").eq("lead_type",((i=e[0])==null?void 0:i.lead_type)||"");g&&console.error("Error fetching latest leads for deduplication:",g);const b=m||t,p=[],v=[];for(const y of e){const C=parseInt(Je(y.id)),w=C.toString();if(u.has(w)&&!s){console.log(`Lead ${C} already exists in database (primary key check)`);const D=Ve(y);p.push(w),v.push(D);continue}if(!s&&vs(y,b)){const D=Ve(y);p.push(w),v.push(D);continue}let S="new";(y.status==="contacted"||y.status==="closed")&&(S=y.status);const M={id:C,name:y.name,business_email:y.business_email||y.email,phone:y.phone,company_name:y.company_name||y.companyName||y.company,group:y.group||null,lead_type:y.lead_type||"contact",status:S,created_at:y.created_at};f&&y.notes&&(M.notes=y.notes);const{error:k}=await n.from("leads").upsert([M],{onConflict:"id",ignoreDuplicates:!1});k?console.error(`Error syncing lead ${C} to Supabase:`,k):(console.log(`Successfully synced lead ${C} to Supabase`),p.push(w),v.push(Ve(y)),u.add(w))}return p.length>0&&(gs(p,v),console.log(`Marked ${p.length} leads as synced in localStorage`)),p.length>0}catch(f){return console.error("Error syncing leads to Supabase:",f),!1}},xs=e=>({getLocalLeads:()=>
61{if(e==="cta_email")return[];const n=e==="deal"?"dealReviewLeads":"contactLeads",r=localStorage.getItem(n),s=r?pn(JSON.parse(r)):[],o=localStorage.getItem("allLeads"),c=o?pn(JSON.parse(o).filter(d=>d.lead_type===e)):[],i=[...s,...c];i.sort((d,u)=>new Date(u.created_at).getTime()-new Date(d.created_at).getTime());const f=new Map;i.forEach(d=>{const u=new Date(d.created_at),m=`${u.toISOString().split("T")[0]}-${u.getHours()}-${u.getMinutes()}`;(!f.has(m)||new Date(d.created_at).getTime()>new Date(f.get(m).created_at).getTime())&&f.set(m,d)});const h=Array.from(f.values());return e==="deal"&&s.length>h.length&&(localStorage.setItem(n,JSON.stringify(h)),console.log(`Cleaned up ${s.length-h.length} duplicate ${e} leads in localStorage`)),console.log(`Found ${h.length} ${e} leads in localStorage`),h}});let ut=!1;const dt=e=>{const t=Vt(),{getLocalLeads:n}=xs(e),[r,s]=l.useState(!1);return console.log("useLeadsData hook - Supabase client:",t?"Initialized":"Missing"),l.useEffect(()=>{(async()=>{if(!(ut||!t))try{const{data:{session:c}}=await t.auth.getSession();if(!c){console.log("User not authenticated, skipping sync");return}const i=n(),f=Wt(),h=i.filter(d=>!f.includes(d.id.toString()));if(h.length>0){console.log(`Found ${h.length} unsynced ${e} leads for initial sync`),ut=!0,s(!0);const{data:d}=await t.from("leads").select("id, created_at").eq("lead_type",e);await ys(h,d||[],t,c.access_token,!1)}else console.log(`No unsynced ${e} leads to sync`),ut=!0}catch(c){console.error("Error performing initial sync:",c)}finally{s(!1)}})()},[t,e,n]),ps({queryKey:[`${e}-leads`,r],queryFn:async()=>{if(t)try{const{data:{session:c}}=await t.auth.getSession();if(!c)return console.log("User not authenticated. Using only local leads."),n();console.log(`🔍 Fetching ${e} leads from Supabase...`);const{data:i,error:f}=await t.from("leads").select("*").eq("lead_type",e).order("created_at",{ascending:!1});if(f)return console.error(`❌ Error fetching ${e} leads:`,f),f.code==="42501"&&(console.error(`RLS Policy Error: ${f.message}`),X({title:"Permission Error",description:"Database access restricted. Contact administrator.",variant:"destructive"})),console.log("Falling back to local leads due to database error"),n();if(console.log(`✅ Fetched ${(i==null?void 0:i.length)||0} ${e} leads from Supabase`),i&&Array.isArray(i))return i.map(d=>{let u="new";return(d.status==="contacted"||d.status==="closed")&&(u=d.status),{id:d.id.toString(),created_at:d.created_at,name:d.name||"",business_email:d.business_email||"",phone:d.phone||"",company_name:d.company_name||"",group:d.group||void 0,lead_type:d.lead_type==="contact"||d.lead_type==="deal"||d.lead_type==="cta_email"?d.lead_type:"contact",status:u,notes:d.notes||void 0}})}catch(c){console.error(`Error fetching ${e} leads from Supabase:`,c),X({title:`Error fetching ${e} leads`,description:"Using local data as fallback",variant:"destructive"})}const o=n();return console.log(`Using local ${e} leads as fallback:`,o.length),o},staleTime:3e4,refetchOnWindowFocus:!0,refetchOnMount:!0,retry:(o,c)=>c&&typeof c=="object"&&"code"in c&&c.code==="42501"?!1:o<2})},bs=()=>{const[e,t]=l.useState(null),n=Vt(),r=Rn();return{selectedLead:e,handleSelectLead:c=>{t(c)},handleUpdateStatus:async(c,i,f)=>{if(!n){X({title:"Configuration Error",description:"Database connection not available. Changes saved locally only.",variant:"destructive"});return}try{const{data:{session:h}}=await n.auth.getSession();if(!h){X({title:"Authentication Required",description:"Please log in to update lead status.",variant:"destructive"});return}const d=parseInt(Je(c)),u={status:i};f!==void 0&&(u.notes=f),console.log("Updating lead with data:",{id:d,...u});const{data:m,error:g}=await n.from("leads").select("id").eq("id",d).limit(1);if(g)throw console.error("Error finding lead:",g),g;if(m&&m.length>0){const{error:b}=await n.from("leads").update(u).eq("id",m[0].id);if(b)throw b;console.log(`Updated lead with ID ${m[0].id}`)}else if(e!=null&&e.created_at){const b=e.created_at;console.log(`Looking for lead with creation date: ${b}`);const{data:p}=await n.from("leads").select("id").eq("created_at",b).limit(1);if(p&&p.length>0){const{error:v}=await n.from("leads").update(u).eq("id",p[0].id);if(v)throw v;console.log(`Updated lead with ID ${p[0].id} found by creation date ${b}`)}else{const v={id:d,name:e.name||null,business_email:e.business_email||e.email||null,phone:e.phone||null,company_name:e.company_name||e.companyName||e.company||null,group:e.group||null,lead_type:e.lead_type||"contact",status:i,created_at:e.created_at,...f!==void 0&&{notes:f}},{error:y}=await n.from("leads").insert([v]);if(y)if(y.message&&y.message.includes('column "notes" does not exist')){delete v.notes;const{error:C}=await n.from("leads").insert([v]);if(C)throw C}else throw y;console.log(`Inserted new lead with ID ${d} and creation date ${b}`)}}else throw new Error("Cannot update lead: No ID or creation date available");e&&e.id===c&&t({...e,id:c,status:i,...f!==void 0&&{notes:f}}),r.invalidateQueries({queryKey:["deal-leads"]}),r.invalidateQueries({queryKey:["contact-leads"]}),r.invalidateQueries({queryKey:["cta_email-leads"]}),X({title:"Lead updated",description:f!==void 0?"The lead status and notes have been successfully updated.":"The lead status has been successfully updated."})}catch(h){console.error("Error updating lead:",h);let d="There was an error updating the lead. Please try again.";h&&typeof h=="object"&&"code"in h&&(h.code==="42501"?d="Permission denied. Please contact administrator.":h.code==="PGRST116"&&(d="Lead not found or access denied.")),X({title:"Update failed",description:d,variant:"destructive"})}}}},ws=(e,t,n)=>{const[r]=Ea();l.useEffect(()=>{const s=r.get("lead");if(s){const o=[...e,...t].find(c=>c.id===s);o&&n(o)}},[r,e,t,n])},Ss=()=>a.jsxs("div",{className:"p-8 text-center",children:[a.jsx("h2",{className:"text-xl font-semibold text-red-600 mb-4",children:"Connection 
61Error"}),a.jsx("p",{className:"mb-4",children:"Unable to establish connection with Supabase. Please try the following:"}),a.jsx("div",{className:"bg-gray-100 p-4 rounded-md text-left mb-6 max-w-md mx-auto",children:a.jsxs("ol",{className:"list-decimal ml-5 space-y-2",children:[a.jsx("li",{children:"Clear your browser cache"}),a.jsx("li",{children:"Refresh the page"}),a.jsx("li",{children:"Try opening the app in a new browser window"}),a.jsx("li",{children:"Check if your Supabase project is active"})]})}),a.jsx("p",{className:"text-sm text-gray-600",children:"If the problem persists, please contact support."})]}),Cs=({children:e})=>{const[t,n]=l.useState("deal-reviews"),r=Vt(),{data:s=[],isLoading:o,error:c}=dt("deal"),{data:i=[],isLoading:f,error:h}=dt("contact"),{data:d=[],isLoading:u,error:m}=dt("cta_email"),{selectedLead:g,handleSelectLead:b,handleUpdateStatus:p}=bs();return ws(s,i,b),r?(c&&console.error("Deal leads error:",c),h&&console.error("Contact leads error:",h),m&&console.error("CTA leads error:",m),a.jsx("div",{children:e({dealLeads:s,contactLeads:i,ctaLeads:d,isLoadingDeals:o,isLoadingContacts:f,isLoadingCTA:u,selectedLead:g,handleSelectLead:b,handleUpdateStatus:p,activeTab:t})})):a.jsx(Ss,{})},Es=({onClick:e})=>a.jsx("div",{className:"mb-6",children:a.jsxs(K,{variant:"ghost",onClick:e,className:"flex items-center gap-2 hover:bg-gray-100 text-gray-700",children:[a.jsx(qa,{className:"h-4 w-4"}),"Back to all leads"]})}),Ns=({lead:e})=>{const t=n=>{switch(n){case"contacted":return a.jsx(lt,{variant:"info",children:"Contacted"});case"closed":return a.jsx(lt,{variant:"success",children:"Closed"});default:return a.jsx(lt,{variant:"warning",children:"New"})}};return a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx(On,{className:"text-xl text-gray-800",children:e.name}),a.jsxs(Ga,{className:"flex items-center gap-1 mt-1",children:[a.jsx(Bt,{className:"h-3.5 w-3.5 text-gray-500"}),a.jsx("span",{children:e.business_email||e.email}),a.jsx("span",{className:"mx-1",children:"•"}),a.jsx(ns,{className:"h-3.5 w-3.5 text-gray-500"}),a.jsx("span",{children:e.phone})]})]}),t(e.status)]})},js=({lead:e})=>{const t=e.company_name||e.companyName||e.company||"";return a.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(In,{className:"h-4 w-4 text-gray-600"}),a.jsx("h3",{className:"font-medium text-sm text-gray-600",children:"Company Information"})]}),a.jsx("p",{className:"text-lg font-medium text-gray-800",children:t}),e.group&&a.jsxs("p",{className:"text-gray-600 mt-1",children:["Group: ",e.group]})]})},Ms=({date:e})=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kn,{className:"h-4 w-4 text-gray-600"}),a.jsx("h3",{className:"font-medium text-sm text-gray-600",children:"Submission Date"})]}),a.jsx("p",{className:"text-gray-800",children:kn(new Date(e),"MMMM d, yyyy h:mm a")})]}),Qt=l.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Q("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
61ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Qt.displayName="Textarea";const _s=({notes:e,onChange:t,onSave:n})=>{const[r,s]=l.useState(!1),o=()=>{s(!0);try{n(),setTimeout(()=>s(!1),500)}catch{s(!1)}};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Za,{className:"h-4 w-4 text-gray-600"}),a.jsx("h3",{className:"font-medium text-sm text-gray-600",children:"Notes"})]}),a.jsx(Qt,{value:e,onChange:c=>t(c.target.value),placeholder:"Add notes about this lead...",rows:4,className:"w-full border-gray-300 focus:border-[#00816A] focus:ring-[#00816A]/20"}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsxs(K,{onClick:o,size:"sm",className:"bg-[#00816A] hover:bg-[#00816A]/90",disabled:r,children:[r?"Saving...":"Save Notes",r&&a.jsx("span",{className:"ml-2 animate-spin",children:"⋅"})]})})]})},Rs=({currentStatus:e,onUpdateStatus:t})=>a.jsxs("div",{className:"space-x-2",children:[a.jsx(K,{onClick:()=>t("new"),variant:"outline",disabled:e==="new",className:`border-gray-300 ${e==="new"?"bg-gray-100":"hover:bg-gray-100"}`,children:"Mark as New"}),a.jsx(K,{onClick:()=>t("contacted"),variant:"outline",disabled:e==="contacted",className:`border-gray-300 ${e==="contacted"?"bg-gray-100":"hover:bg-gray-100"}`,children:"Mark as Contacted"}),a.jsx(K,{onClick:()=>t("closed"),variant:"outline",disabled:e==="closed",className:`border-gray-300 ${e==="closed"?"bg-gray-100":"hover:bg-gray-100"}`,children:"Mark as Closed"})]}),Is=({subject:e,onSubjectChange:t,body:n,onBodyChange:r,onCancel:s,onSend:o,sending:c})=>a.jsxs("div",{className:"space-y-4 mt-4 border rounded-md p-4 bg-gray-50",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(dn,{htmlFor:"subject",className:"text-gray-700",children:"Email Subject"}),a.jsx(Ha,{id:"subject",value:e,onChange:i=>t(i.target.value),className:"border-gray-300 focus:border-[#00816A] focus:ring-[#00816A]/20"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(dn,{htmlFor:"body",className:"text-gray-700",children:"Email Body"}),a.jsx(Qt,{id:"body",value:n,onChange:i=>r(i.target.value),rows:8,className:"border-gray-300 focus:border-[#00816A] focus:ring-[#00816A]/20"})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(K,{variant:"outline",onClick:s,disabled:c,className:"border-gray-300 hover:bg-gray-100",children:"Cancel"}),a.jsx(K,{onClick:o,disabled:c,className:"bg-[#00816A] hover:bg-[#00816A]/90",children:c?a.jsxs(a.Fragment,{children:[a.jsx(Wa,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Email"})]})]}),Ts="/api/send-email";async function Ds({to:e,subject:t,html:n,date:r}){console.log("Preparing to send email to:",e);const s=2;let o=0,c;for(;o<=s;)try{o>0&&(console.log(`Retry attempt ${o} of ${s}...`),await new Promise(h=>setTimeout(h,1e3)));const i=await fetch(Ts,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:e,subject:t,html:n,date:r})});if(!i.ok){const h=await i.json().catch(()=>({message:`HTTP error: ${i.status} ${i.statusText}`}));if(console.error("Email sending failed with status:",i.status,h),i.status>=500&&o<s){c=new Error(h.message||`Failed to send email: ${i.status}`),o++;continue}throw new Error(h.message||`Failed to send email: ${i.status}`)}const f=await i.json();return console.log("Email sent successfully:",f),f}catch(i){if(console.error(`Error sending email (attempt ${o+1}):`,i),c=i,o<s)o++;else throw i}throw c}const ks=({lead:e,notes:t,onUpdateStatus:n})=>{const[r,s]=l.useState(!1),[o,c]=l.useState(`Follow-up on your Deal Review Request - ${e.companyName}`),[i,f]=l.useState(`Dear ${e.name},
62
63Thank you for submitting your request for a free deal review with Street Diligence. I'd like to follow up and schedule a time to discuss your needs and how our platform can assist with your deal analysis.
64
65Please let me know a few times that would work for you in the coming week.
66
67Best regards,
68Street Diligence Team`),[h,d]=l.useState(!1),[u,m]=l.useState(""),{toast:g}=Na(),b=async()=>{s(!0),m("");try{const p=i.replace(/\n/g,"<br>");console.log(`Attempting to send email to ${e.email}`),await Ds({to:e.email,subject:o,html:p,date:new Date().toISOString()}),n(e.id,"contacted",t),g({title:"Email sent successfully",description:`Follow-up email has been sent to ${e.name} at ${e.email}`,variant:"default"}),d(!1)}catch(p){console.error("Error sending email:",p);const v=p.message||"There was an error sending the email. Please try again later.";m(v),g({title:"Failed to send email",description:v,variant:"destructive"})}finally{s(!1)}};return a.jsxs(Fn,{className:"shadow-sm border-gray-200",children:[a.jsx($n,{className:"border-b bg-gray-50",children:a.jsxs(On,{className:"text-lg text-gray-800 flex items-center gap-2",children:[a.jsx(Ya,{className:"h-5 w-5 text-gray-600"}),"Follow-up Actions"]})}),a.jsxs(Un,{className:"space-y-4 pt-5",children:[a.jsxs(K,{onClick:()=>d(!h),className:"w-full bg-[#00816A] hover:bg-[#00816A]/90 transition-colors",children:[a.jsx(Bt,{className:"mr-2 h-4 w-4"}),"Send Follow-up Email"]}),h&&a.jsxs(a.Fragment,{children:[u&&a.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded flex items-start gap-2 text-sm",children:[a.jsx(Xa,{className:"h-5 w-5 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("strong",{className:"font-medium",children:"Error sending email:"})," ",u,a.jsx("p",{className:"mt-1",children:"Please check your network connection and try again."})]})]}),a.jsx(Is,{subject:o,onSubjectChange:c,body:i,onBodyChange:f,onCancel:()=>d(!1),onSend:b,sending:r})]})]})]})},As=({lead:e,onBack:t,onUpdateStatus:n})=>{const[r,s]=l.useState(e.notes||""),o=f=>{s(f)},c=()=>{n(e.id,e.status,r)},i=f=>{n(e.id,f,r)};return a.jsxs("div",{className:"w-full",children:[a.jsx(Es,{onClick:t}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[a.jsxs(Fn,{className:"md:col-span-2 shadow-sm border-gray-200",children:[a.jsx($n,{className:"border-b bg-gray-50",children:a.jsx(Ns,{lead:e})}),a.jsxs(Un,{className:"space-y-5 pt-5",children:[a.jsx(js,{lead:e}),a.jsx(Ms,{date:e.created_at}),a.jsx(_s,{notes:r,onChange:o,onSave:c}
vendor: 9,266 bytes, line 68
68)]}),a.jsx(Va,{className:"flex justify-between border-t pt-6 bg-gray-50",children:a.jsx(Rs,{currentStatus:e.status,onUpdateStatus:i})})]}),a.jsx(ks,{lead:e,notes:r,onUpdateStatus:n})]})]})};var Ps=l.createContext(void 0);function qt(e){const t=l.useContext(Ps);return e||t||"ltr"}var ft="rovingFocusGroup.onEntryFocus",Ls={bubbles:!1,cancelable:!0},Pe="RovingFocusGroup",[Ot,Wn,Os]=Tn(Pe),[Fs,Ze]=Ye(Pe,[Os]),[$s,Us]=Fs(Pe),Qn=l.forwardRef((e,t)=>a.jsx(Ot.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Ot.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Bs,{...e,ref:t})})}));Qn.displayName=Pe;var Bs=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:f,onEntryFocus:h,preventScrollOnEntryFocus:d=!1,...u}=e,m=l.useRef(null),g=de(t,m),b=qt(o),[p,v]=Kt({prop:c,defaultProp:i??null,onChange:f,caller:Pe}),[y,C]=l.useState(!1),w=Re(h),S=Wn(n),M=l.useRef(!1),[k,D]=l.useState(0);return l.useEffect(()=>{const _=m.current;if(_)return _.addEventListener(ft,w),()=>_.removeEventListener(ft,w)},[w]),a.jsx($s,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:p,onItemFocus:l.useCallback(_=>v(_),[v]),onItemShiftTab:l.useCallback(()=>C(!0),[]),onFocusableItemAdd:l.useCallback(()=>D(_=>_+1),[]),onFocusableItemRemove:l.useCallback(()=>D(_=>_-1),[]),children:a.jsx(G.div,{tabIndex:y||k===0?-1:0,"data-orientation":r,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:j(e.onMouseDown,()=>{M.current=!0}),onFocus:j(e.onFocus,_=>{const A=!M.current;if(_.target===_.currentTarget&&A&&!y){const I=new CustomEvent(ft,Ls);if(_.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=S().filter(J=>J.focusable),F=O.find(J=>J.active),Y=O.find(J=>J.id===p),st=[F,Y,...O].filter(Boolean).map(J=>J.ref.current);Xn(st,d)}}M.current=!1}),onBlur:j(e.onBlur,()=>C(!1))})})}),qn="RovingFocusGroupItem",zn=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:c,...i}=e,f=qe(),h=o||f,d=Us(qn,n),u=d.currentTabStopId===h,m=Wn(n),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:p}=d;return l.useEffect(()=>{if(r)return g(),()=>b()},[r,g,b]),a.jsx(Ot.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(G.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...i,ref:t,onMouseDown:j(e.onMouseDown,v=>{r?d.onItemFocus(h):v.preventDefault()}),onFocus:j(e.onFocus,()=>d.onItemFocus(h)),onKeyDown:j(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Vs(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=m().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const S=w.indexOf(v.currentTarget);w=d.loop?Hs(w,S+1):w.slice(S+1)}setTimeout(()=>Xn(w))}}),children:typeof c=="function"?c({isCurrentTabStop:u,hasTabStop:p!=null}):c})})});zn.displayName=qn;var Ks={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gs(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vs(e,t,n){const r=Gs(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ks[r]}function Xn(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Hs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Yn=Qn,Jn=zn,et="Tabs",[Ws]=Ye(et,[Ze]),Zn=Ze(),[Qs,zt]=Ws(et),er=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:c="horizontal",dir:i,activationMode:f="automatic",...h}=e,d=qt(i),[u,m]=Kt({prop:r,onChange:s,defaultProp:o??"",caller:et});return a.jsx(Qs,{scope:n,baseId:qe(),value:u,onValueChange:m,orientation:c,dir:d,activationMode:f,children:a.jsx(G.div,{dir:d,"data-orientation":c,...h,ref:t})})});er.displayName=et;var tr="TabsList",nr=l.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=zt(tr,n),c=Zn(n);return a.jsx(Yn,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(G.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});nr.displayName=tr;var rr="TabsTrigger",ar=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,c=zt(rr,n),i=Zn(n),f=ir(c.baseId,r),h=cr(c.baseId,r),d=r===c.value;return a.jsx(Jn,{asChild:!0,...i,focusable:!s,active:d,children:a.jsx(G.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":h,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:f,...o,ref:t,onMouseDown:j(e.onMouseDown,u=>{!s&&u.button===0&&u.ctrlKey===!1?c.onValueChange(r):u.preventDefault()}),onKeyDown:j(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&c.onValueChange(r)}),onFocus:j(e.onFocus,()=>{const u=c.activationMode!=="manual";!d&&!s&&u&&c.onValueChange(r)})})})});ar.displayName=rr;var sr="TabsContent",or=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...c}=e,i=zt(sr,n),f=ir(i.baseId,r),h=cr(i.baseId,r),d=r===i.value,u=l.useRef(d);return l.useEffect(()=>{const m=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Ae,{present:s||d,children:({present:m})=>a.jsx(G.div,{"data-state":d?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":f,hidden:!m,id:h,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:m&&o})})});or.displayName=sr;function ir(e,t){return`${e}-trigger-${t}`}function cr(e,t){return`${e}-content-${t}`}var qs=er,lr=nr,ur=ar,dr=or;const zs=qs,fr=l.forwardRef(({className:e,...t},n)=>a.jsx(lr,{ref:n,className:Q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));fr.displayName=lr.displayName;const He=l.forwardRef(({className:e,...t},n)=>a.jsx(ur,{ref:n,className:Q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));He.displayName=ur.displayName;const Xs=l.forwardRef(({className:e,...t},n)=>a.jsx(dr,{ref:n,className:Q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Xs.displayName=dr.displayName;const Ys=({currentTab:e,onTabChange:t})=>a.jsxs(fr,{children:[a.jsx(He,{value:"deal-reviews",children:"Deal Review Requests"}),a.jsx(He,{value:"contact-submissions",children:"Contact Submissions"}),a.jsx(He,{value:"cta-emails",children:"CTA Emails"})]});var ht=0;function Js(){l.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gn()),document.body.insertAdjacentElement("beforeend",e[1]??gn()),ht++,()=>{ht===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ht--}},[])}function gn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var mt="focusScope.autoFocusOnMount",pt="focusScope.autoFocusOnUnmount",vn={bubbles:!1,cancelable:!0},Zs="FocusScope",hr=l.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[i,f]=l.useState(null),h=Re(s),d=Re(o),u=l.useRef(null),m=de(t,p=>f(p)),g=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(r){let p=function(w){if(g.paused||!i)return;const S=w.target;i.contains(S)?u.current=S:ne(u.current,{select:!0})},v=function(w){if(g.paused||!i)return;const S=w.relatedTarget;S!==null&&(i.contains(S)||ne(u.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const M of w)M.removedNodes.length>0&&ne(i)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const C=new MutationObserver(y);return i&&C.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),C.disconnect()}}},[r,i,g.paused]),l.useEffect(()=>{if(i){xn.add(g);const p=document.activeElement;if(!i.contains(p)){const y=new CustomEvent(mt,vn);i.addEventListener(mt,h),i.dispatchEvent(y),y.defaultPrevented||(eo(so(mr(i)),{select:!0}),document.activeElement===p&&ne(i))}return()=>{i.removeEventListener(mt,h),setTimeout(()=>{const y=new CustomEvent(pt,vn);i.addEventListener(pt,d),i.dispatchEvent(y),y.defaultPrevented||ne(p??document.body,{select:!0}),i.removeEventListener(pt,d),xn.remove(g)},0)}}},[i,h,d,g]);const b=l.useCallback(p=>{if(!n&&!r||g.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(v&&y){const C=p.currentTarget,[w,S]=to(C);w&&S?!p.shiftKey&&y===S?(p.preventDefault(),n&&ne(w,{select:!0}
vendor: 4,959 bytes, line 68
68)):p.shiftKey&&y===w&&(p.preventDefault(),n&&ne(S,{select:!0})):y===C&&p.preventDefault()}},[n,r,g.paused]);return a.jsx(G.div,{tabIndex:-1,...c,ref:m,onKeyDown:b})});hr.displayName=Zs;function eo(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ne(r,{select:t}),document.activeElement!==n)return}function to(e){const t=mr(e),n=yn(t,e),r=yn(t.reverse(),e);return[n,r]}function mr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yn(e,t){for(const n of e)if(!no(n,{upTo:t}))return n}function no(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ro(e){return e instanceof HTMLInputElement&&"select"in e}function ne(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ro(e)&&t&&e.select()}}var xn=ao();function ao(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=bn(e,t),e.unshift(t)},remove(t){var n;e=bn(e,t),(n=e[0])==null||n.resume()}}}function bn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function so(e){return e.filter(t=>t.tagName!=="A")}function oo(e){const t=io(e),n=l.forwardRef((r,s)=>{const{children:o,...c}=r,i=l.Children.toArray(o),f=i.find(lo);if(f){const h=f.props.children,d=i.map(u=>u===f?l.Children.count(h)>1?l.Children.only(null):l.isValidElement(h)?h.props.children:null:u);return a.jsx(t,{...c,ref:s,children:l.isValidElement(h)?l.cloneElement(h,void 0,d):null})}return a.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function io(e){const t=l.forwardRef((n,r)=>{const{children:s,...o}=n;if(l.isValidElement(s)){const c=fo(s),i=uo(o,s.props);return s.type!==l.Fragment&&(i.ref=r?Gt(r,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var co=Symbol("radix.slottable");function lo(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===co}function uo(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const f=o(...i);return s(...i),f}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function fo(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ho=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ge=new WeakMap,Ue=new WeakMap,Be={},gt=0,pr=function(e){return e&&(e.host||pr(e.parentNode))},mo=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pr(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},po=function(e,t,n,r){var s=mo(t,Array.isArray(e)?e:[e]);Be[n]||(Be[n]=new WeakMap);var o=Be[n],c=[],i=new Set,f=new Set(s),h=function(u){!u||i.has(u)||(i.add(u),h(u.parentNode))};s.forEach(h);var d=function(u){!u||f.has(u)||Array.prototype.forEach.call(u.children,function(m){if(i.has(m))d(m);else try{var g=m.getAttribute(r),b=g!==null&&g!=="false",p=(ge.get(m)||0)+1,v=(o.get(m)||0)+1;ge.set(m,p),o.set(m,v),c.push(m),p===1&&b&&Ue.set(m,!0),v===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),i.clear(),gt++,function(){c.forEach(function(u){var m=ge.get(u)-1,g=o.get(u)-1;ge.set(u,m),o.set(u,g),m||(Ue.has(u)||u.removeAttribute(r),Ue.delete(u)),g||u.removeAttribute(n)}),gt--,gt||(ge=new WeakMap,ge=new WeakMap,Ue=new WeakMap,Be={})}},go=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=ho(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),po(r,s,n,"aria-hidden")):function(){return null}},We="right-scroll-bar-position",Qe="width-before-scroll-bar",vo="with-scroll-bars-hidden",yo="--removed-body-scroll-bar-size";function vt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xo(e,t){var n=l.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var bo=typeof window<"u"?l.useLayoutEffect:l.useEffect,wn=new WeakMap;function wo(e,t){var n=xo(null,function(r){return e.forEach(function(s){return vt(s,r)})});return bo(function(){var r=wn.get(n);
vendor: 4,244 bytes, lines 68-83
68if(r){var s=new Set(r),o=new Set(e),c=n.current;s.forEach(function(i){o.has(i)||vt(i,null)}),o.forEach(function(i){s.has(i)||vt(i,c)})}wn.set(n,e)},[e]),n}function So(e){return e}function Co(e,t){t===void 0&&(t=So);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,r);return n.push(c),function(){n=n.filter(function(i){return i!==c})}},assignSyncMedium:function(o){for(r=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(i){return o(i)},filter:function(){return n}}},assignMedium:function(o){r=!0;var c=[];if(n.length){var i=n;n=[],i.forEach(o),c=n}var f=function(){var d=c;c=[],d.forEach(o)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(d){c.push(d),h()},filter:function(d){return c=c.filter(d),n}}}};return s}function Eo(e){e===void 0&&(e={});var t=Co(null);return t.options=re({async:!0,ssr:!1},e),t}var gr=function(e){var t=e.sideCar,n=An(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return l.createElement(r,re({},n))};gr.isSideCarExport=!0;function No(e,t){return e.useMedium(t),gr}var vr=Eo(),yt=function(){},tt=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:yt,onWheelCapture:yt,onTouchMoveCapture:yt}),s=r[0],o=r[1],c=e.forwardProps,i=e.children,f=e.className,h=e.removeScrollBar,d=e.enabled,u=e.shards,m=e.sideCar,g=e.noRelative,b=e.noIsolation,p=e.inert,v=e.allowPinchZoom,y=e.as,C=y===void 0?"div":y,w=e.gapMode,S=An(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=m,k=wo([n,t]),D=re(re({},S),s);return l.createElement(l.Fragment,null,d&&l.createElement(M,{sideCar:vr,removeScrollBar:h,shards:u,noRelative:g,noIsolation:b,inert:p,setCallbacks:o,allowPinchZoom:!!v,lockRef:n,gapMode:w}),c?l.cloneElement(l.Children.only(i),re(re({},D),{ref:k})):l.createElement(C,re({},D,{className:f,ref:k}),i))});tt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};tt.classNames={fullWidth:Qe,zeroRight:We};var jo=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mo(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jo();return t&&e.setAttribute("nonce",t),e}function _o(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ro(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Io=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mo())&&(_o(t,n),Ro(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},To=function(){var e=Io();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},yr=function(){var e=To(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Do={left:0,top:0,right:0,gap:0},xt=function(e){return parseInt(e||"",10)||0},ko=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[xt(n),xt(r),xt(s)]},Ao=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Do;var t=ko(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Po=yr(),xe="data-scroll-locked",Lo=function(e,t,n,r){var s=e.left,o=e.top,c=e.right,i=e.gap;return n===void 0&&(n="margin"),`
69  .`.concat(vo,` {
70   overflow: hidden `).concat(r,`;
71   padding-right: `).concat(i,"px ").concat(r,`;
72  }
73  body[`).concat(xe,`] {
74    overflow: hidden `).concat(r,`;
75    overscroll-behavior: contain;
76    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
77    padding-left: `.concat(s,`px;
78    padding-top: `).concat(o,`px;
79    padding-right: `).concat(c,`px;
80    margin-left:0;
81    margin-top:0;
82    margin-right: `).concat(i,"px ").concat(r,`;
83    `),n==="padding"&&"padding-right: ".concat(i,"px ").concat(r,";
83")].filter(Boolean).join(""),`
84  }
85  
86  .`).concat(We,` {
87    right: `).concat(i,"px ").concat(r,`;
88  }
89  
90  .`).concat(Qe,` {
91    margin-right: `).concat(i,"px ").concat(r,`;
92  }
93  
94  .`).concat(We," .").concat(We,` {
95    right: 0 `).concat(r,`;
96  }
97  
98  .`).concat(Qe," .").concat(Qe,` {
99    margin-right: 0 `).concat(r,`;
100  }
101  
102  body[`).concat(xe,`] {
103    `).concat(yo,": ").concat(i,`px;
104  }
105`)},Sn=function(){var e=parseInt(document.body.getAttribute(xe)||"0",10);return isFinite(e)?e:0},Oo=function(){l.useEffect(function(){return document.body.setAttribute(xe,(Sn()+1).toString()),function(){var e=Sn()-1;e<=0?document.body.removeAttribute(xe):document.body.setAttribute(xe,e.toString())}},[])},Fo=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Oo();var o=l.useMemo(function(){return Ao(s)},[s]);return l.createElement(Po,{styles:Lo(o,!t,s,n?"":"!important")})},Ft=!1;if(typeof window<"u")try{var Ke=Object.defineProperty({},"passive",{get:function(){return Ft=!0,!0}});window.addEventListener("test",Ke,Ke),window.removeEventListener("test",Ke,Ke)}catch{Ft=!1}var ve=Ft?{passive:!1}:!1,$o=function(e){return e.tagName==="TEXTAREA"},xr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$o(e)&&n[t]==="visible")},Uo=function(e){return xr(e,"overflowY")},Bo=function(e){return xr(e,"overflowX")},Cn=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=br(e,r);if(s){var o=wr(e,r),c=o[1],i=o[2];if(c>i)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ko=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Go=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},br=function(e,t){return e==="v"?Uo(t):Bo(t)},wr=function(e,t){return e==="v"?Ko(t):Go(t)},Vo=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ho=function(e,t,n,r,s){var o=Vo(e,window.getComputedStyle(t).direction),c=o*r,i=n.target,f=t.contains(i),h=!1,d=c>0,u=0,m=0;do{if(!i)break;var g=wr(e,i),b=g[0],p=g[1],v=g[2],y=p-v-o*b;(b||y)&&br(e,i)&&(u+=y,m+=b);var C=i.parentNode;i=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!f&&i!==document.body||f&&(t.contains(i)||t===i));return(d&&Math.abs(u)<1||!d&&Math.abs(m)<1)&&(h=!0),h},Ge=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},En=function(e){return[e.deltaX,e.deltaY]},Nn=function(e){return e&&"current"in e?e.current:e},Wo=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qo=function(e){return`
106  .block-interactivity-`.concat(e,` {pointer-events: none;}
107  .allow-interactivity-`).concat(e,` {pointer-events: all;}
108`)},qo=0,ye=[];function zo(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),s=l.useState(qo++)[0],o=l.useState(yr)[0],c=l.useRef(e);l.useEffect(function(){c.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=Pa([e.lockRef.current],(e.shards||[]).map(Nn),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=l.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!c.current.allowPinchZoom;var y=Ge(p),C=n.current,w="deltaX"in p?p.deltaX:C[0]-y[0],S="deltaY"in p?p.deltaY:C[1]-y[1],M,k=p.target,D=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in p&&D==="h"&&k.type==="range")return!1;var _=window.getSelection(),A=_&&_.anchorNode,I=A?A===k||A.contains(k):!1;if(I)return!1;var O=Cn(D,k);if(!O)return!0;if(O?M=D:(M=D==="v"?"h":"v",O=Cn(D,k)),!O)return!1;if(!r.current&&"changedTouches"in p&&(w||S)&&(r.current=M),!M)return!0;var F=r.current||M;return Ho(F,v,p,F==="h"?w:S)},[]),f=l.useCallback(function(p){var v=p;if(!(!ye.length||ye[ye.length-1]!==o)){var y="deltaY"in v?En(v):Ge(v),C=t.current.filter(function(M){return M.name===v.type&&(M.target===v.target||v.target===M.shadowParent)&&Wo(M.delta,y)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}
vendor: 15,526 bytes, line 108
108if(!C){var w=(c.current.shards||[]).map(Nn).filter(Boolean).filter(function(M){return M.contains(v.target)}),S=w.length>0?i(v,w[0]):!c.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),h=l.useCallback(function(p,v,y,C){var w={name:p,delta:v,target:y,should:C,shadowParent:Xo(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=l.useCallback(function(p){n.current=Ge(p),r.current=void 0},[]),u=l.useCallback(function(p){h(p.type,En(p),p.target,i(p,e.lockRef.current))},[]),m=l.useCallback(function(p){h(p.type,Ge(p),p.target,i(p,e.lockRef.current))},[]);l.useEffect(function(){return ye.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:m}),document.addEventListener("wheel",f,ve),document.addEventListener("touchmove",f,ve),document.addEventListener("touchstart",d,ve),function(){ye=ye.filter(function(p){return p!==o}),document.removeEventListener("wheel",f,ve),document.removeEventListener("touchmove",f,ve),document.removeEventListener("touchstart",d,ve)}},[]);var g=e.removeScrollBar,b=e.inert;return l.createElement(l.Fragment,null,b?l.createElement(o,{styles:Qo(s)}):null,g?l.createElement(Fo,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xo(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Yo=No(vr,zo);var Sr=l.forwardRef(function(e,t){return l.createElement(tt,re({},e,{ref:t,sideCar:Yo}))});Sr.classNames=tt.classNames;var $t=["Enter"," "],Jo=["ArrowDown","PageUp","Home"],Cr=["ArrowUp","PageDown","End"],Zo=[...Jo,...Cr],ei={ltr:[...$t,"ArrowRight"],rtl:[...$t,"ArrowLeft"]},ti={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Le="Menu",[Ie,ni,ri]=Tn(Le),[fe,Er]=Ye(Le,[ri,Dn,Ze]),nt=Dn(),Nr=Ze(),[ai,he]=fe(Le),[si,Oe]=fe(Le),jr=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:c=!0}=e,i=nt(t),[f,h]=l.useState(null),d=l.useRef(!1),u=Re(o),m=qt(s);return l.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ja,{...i,children:a.jsx(ai,{scope:t,open:n,onOpenChange:u,content:f,onContentChange:h,children:a.jsx(si,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:m,modal:c,children:r})})})};jr.displayName=Le;var oi="MenuAnchor",Xt=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=nt(n);return a.jsx(Ma,{...s,...r,ref:t})});Xt.displayName=oi;var Yt="MenuPortal",[ii,Mr]=fe(Yt,{forceMount:void 0}),_r=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=he(Yt,t);return a.jsx(ii,{scope:t,forceMount:n,children:a.jsx(Ae,{present:n||o.open,children:a.jsx(_a,{asChild:!0,container:s,children:r})})})};_r.displayName=Yt;var H="MenuContent",[ci,Jt]=fe(H),Rr=l.forwardRef((e,t)=>{const n=Mr(H,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=he(H,e.__scopeMenu),c=Oe(H,e.__scopeMenu);return a.jsx(Ie.Provider,{scope:e.__scopeMenu,children:a.jsx(Ae,{present:r||o.open,children:a.jsx(Ie.Slot,{scope:e.__scopeMenu,children:c.modal?a.jsx(li,{...s,ref:t}):a.jsx(ui,{...s,ref:t})})})})}),li=l.forwardRef((e,t)=>{const n=he(H,e.__scopeMenu),r=l.useRef(null),s=de(t,r);return l.useEffect(()=>{const o=r.current;if(o)return go(o)},[]),a.jsx(Zt,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:j(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ui=l.forwardRef((e,t)=>{const n=he(H,e.__scopeMenu);return a.jsx(Zt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),di=oo("MenuContent.ScrollLock"),Zt=l.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:i,onEntryFocus:f,onEscapeKeyDown:h,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...p}=e,v=he(H,n),y=Oe(H,n),C=nt(n),w=Nr(n),S=ni(n),[M,k]=l.useState(null),D=l.useRef(null),_=de(t,D,v.onContentChange),A=l.useRef(0),I=l.useRef(""),O=l.useRef(0),F=l.useRef(null),Y=l.useRef("right"),Fe=l.useRef(0),st=b?Sr:l.Fragment,J=b?{as:di,allowPinchZoom:!0}:void 0,va=E=>{var pe,an;const V=I.current+E,z=S().filter(Z=>!Z.disabled),te=document.activeElement,ot=(pe=z.find(Z=>Z.ref.current===te))==null?void 0:pe.textValue,it=z.map(Z=>Z.textValue),rn=Ci(it,V,ot),Ee=(an=z.find(Z=>Z.textValue===rn))==null?void 0:an.ref.current;(function Z(sn){I.current=sn,window.clearTimeout(A.current),sn!==""&&(A.current=window.setTimeout(()=>Z(""),1e3))})(V),Ee&&setTimeout(()=>Ee.focus())};l.useEffect(()=>()=>window.clearTimeout(A.current),[]),Js();const me=l.useCallback(E=>{var z,te;return Y.current===((z=F.current)==null?void 0:z.side)&&Ni(E,(te=F.current)==null?void 0:te.area)},[]);return a.jsx(ci,{scope:n,searchRef:I,onItemEnter:l.useCallback(E=>{me(E)&&E.preventDefault()},[me]),onItemLeave:l.useCallback(E=>{var V;me(E)||((V=D.current)==null||V.focus(),k(null))},[me]),onTriggerLeave:l.useCallback(E=>{me(E)&&E.preventDefault()},[me]),pointerGraceTimerRef:O,onPointerGraceIntentChange:l.useCallback(E=>{F.current=E},[]),children:a.jsx(st,{...J,children:a.jsx(hr,{asChild:!0,trapped:s,onMountAutoFocus:j(o,E=>{var V;E.preventDefault(),(V=D.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:a.jsx(Ia,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:h,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:m,onDismiss:g,children:a.jsx(Yn,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:M,onCurrentTabStopIdChange:k,onEntryFocus:j(f,E=>{y.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Ta,{role:"menu","aria-orientation":"vertical","data-state":Hr(v.open),"data-radix-menu-content":"",dir:y.dir,...C,...p,ref:_,style:{outline:"none",...p.style},onKeyDown:j(p.onKeyDown,E=>{const z=E.target.closest("[data-radix-menu-content]")===E.currentTarget,te=E.ctrlKey||E.altKey||E.metaKey,ot=E.key.length===1;z&&(E.key==="Tab"&&E.preventDefault(),!te&&ot&&va(E.key));const it=D.current;if(E.target!==it||!Zo.includes(E.key))return;E.preventDefault();const Ee=S().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);Cr.includes(E.key)&&Ee.reverse(),wi(Ee)}),onBlur:j(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(A.current),I.current="")}),onPointerMove:j(e.onPointerMove,Te(E=>{const V=E.target,z=Fe.current!==E.clientX;if(E.currentTarget.contains(V)&&z){const te=E.clientX>Fe.current?"right":"left";Y.current=te,Fe.current=E.clientX}}))})})})})})})});Rr.displayName=H;var fi="MenuGroup",en=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(G.div,{role:"group",...r,ref:t})});en.displayName=fi;var hi="MenuLabel",Ir=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(G.div,{...r,ref:t})});Ir.displayName=hi;var ze="MenuItem",jn="menu.itemSelect",rt=l.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=l.useRef(null),c=Oe(ze,e.__scopeMenu),i=Jt(ze,e.__scopeMenu),f=de(t,o),h=l.useRef(!1),d=()=>{const u=o.current;if(!n&&u){const m=new CustomEvent(jn,{bubbles:!0,cancelable:!0});u.addEventListener(jn,g=>r==null?void 0:r(g),{once:!0}),Ra(u,m),m.defaultPrevented?h.current=!1:c.onClose()}};return a.jsx(Tr,{...s,ref:f,disabled:n,onClick:j(e.onClick,d),onPointerDown:u=>{var m;(m=e.onPointerDown)==null||m.call(e,u),h.current=!0},onPointerUp:j(e.onPointerUp,u=>{var m;h.current||(m=u.currentTarget)==null||m.click()}),onKeyDown:j(e.onKeyDown,u=>{const m=i.searchRef.current!=="";n||m&&u.key===" "||$t.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});rt.displayName=ze;var Tr=l.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,c=Jt(ze,n),i=Nr(n),f=l.useRef(null),h=de(t,f),[d,u]=l.useState(!1),[m,g]=l.useState("");return l.useEffect(()=>{const b=f.current;b&&g((b.textContent??"").trim())},[o.children]),a.jsx(Ie.ItemSlot,{scope:n,disabled:r,textValue:s??m,children:a.jsx(Jn,{asChild:!0,...i,focusable:!r,children:a.jsx(G.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:h,onPointerMove:j(e.onPointerMove,Te(b=>{r?c.onItemLeave(b):(c.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:j(e.onPointerLeave,Te(b=>c.onItemLeave(b))),onFocus:j(e.onFocus,()=>u(!0)),onBlur:j(e.onBlur,()=>u(!1))})})})}),mi="MenuCheckboxItem",Dr=l.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(Or,{scope:e.__scopeMenu,checked:n,children:a.jsx(rt,{role:"menuitemcheckbox","aria-checked":Xe(n)?"mixed":n,...s,ref:t,"data-state":nn(n),onSelect:j(s.onSelect,()=>r==null?void 0:r(Xe(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Dr.displayName=mi;var kr="MenuRadioGroup",[pi,gi]=fe(kr,{value:void 0,onValueChange:()=>{}}),Ar=l.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Re(r);return a.jsx(pi,{scope:e.__scopeMenu,value:n,onValueChange:o,children:a.jsx(en,{...s,ref:t})})});Ar.displayName=kr;var Pr="MenuRadioItem",Lr=l.forwardRef((e,t)=>{const{value:n,...r}=e,s=gi(Pr,e.__scopeMenu),o=n===s.value;return a.jsx(Or,{scope:e.__scopeMenu,checked:o,children:a.jsx(rt,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":nn(o),onSelect:j(r.onSelect,()=>{var c;return(c=s.onValueChange)==null?void 0:c.call(s,n)},{checkForDefaultPrevented:!1})})})});Lr.displayName=Pr;var tn="MenuItemIndicator",[Or,vi]=fe(tn,{checked:!1}),Fr=l.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=vi(tn,n);return a.jsx(Ae,{present:r||Xe(o.checked)||o.checked===!0,children:a.jsx(G.span,{...s,ref:t,"data-state":nn(o.checked)})})});Fr.displayName=tn;var yi="MenuSeparator",$r=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(G.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});$r.displayName=yi;var xi="MenuArrow",Ur=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=nt(n);return a.jsx(Da,{...s,...r,ref:t})});Ur.displayName=xi;var bi="MenuSub",[kc,Br]=fe(bi),Me="MenuSubTrigger",Kr=l.forwardRef((e,t)=>{const n=he(Me,e.__scopeMenu),r=Oe(Me,e.__scopeMenu),s=Br(Me,e.__scopeMenu),o=Jt(Me,e.__scopeMenu),c=l.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:f}=o,h={__scopeMenu:e.__scopeMenu},d=l.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return l.useEffect(()=>d,[d]),l.useEffect(()=>{const u=i.current;return()=>{window.clearTimeout(u),f(null)}},[i,f]),a.jsx(Xt,{asChild:!0,...h,children:a.jsx(Tr,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Hr(n.open),...e,ref:Gt(t,s.onTriggerChange),onClick:u=>{var m;(m=e.onClick)==null||m.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:j(e.onPointerMove,Te(u=>{o.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:j(e.onPointerLeave,Te(u=>{var g,b;d();const m=(g=n.content)==null?void 0:g.getBoundingClientRect();if(m){const p=(b=n.content)==null?void 0:b.dataset.side,v=p==="right",y=v?-5:5,C=m[v?"left":"right"],w=m[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:u.clientX+y,y:u.clientY},{x:C,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:C,y:m.bottom}],side:p}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(u),u.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:j(e.onKeyDown,u=>{var g;const m=o.searchRef.current!=="";e.disabled||m&&u.key===" "||ei[r.dir].includes(u.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),u.preventDefault())})})})});Kr.displayName=Me;var Gr="MenuSubContent",Vr=l.forwardRef((e,t)=>{const n=Mr(H,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=he(H,e.__scopeMenu),c=Oe(H,e.__scopeMenu),i=Br(Gr,e.__scopeMenu),f=l.useRef(null),h=de(t,f);return a.jsx(Ie.Provider,{scope:e.__scopeMenu,children:a.jsx(Ae,{present:r||o.open,children:a.jsx(Ie.Slot,{scope:e.__scopeMenu,children:a.jsx(Zt,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:h,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var u;c.isUsingKeyboardRef.current&&((u=f.current)==null||u.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:j(e.onFocusOutside,d=>{d.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:j(e.onEscapeKeyDown,d=>{c.onClose(),d.preventDefault()}),onKeyDown:j(e.onKeyDown,d=>{var g;const u=d.currentTarget.contains(d.target),m=ti[c.dir].includes(d.key);u&&m&&(o.onOpenChange(!1),(g=i.trigger)==null||g.focus(),d.preventDefault())})})})})})});Vr.displayName=Gr;function Hr(e){return e?"open":"closed"}function Xe(e){return e==="indeterminate"}function nn(e){return Xe(e)?"indeterminate":e?"checked":"unchecked"}function wi(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Si(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ci(e,t,n){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let c=Si(e,Math.max(o,0));s.length===1&&(c=c.filter(h=>h!==n));const f=c.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return f!==n?f:void 0}function Ei(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,c=t.length-1;o<t.length;c=o++){const i=t[o],f=t[c],h=i.x,d=i.y,u=f.x,m=f.y;d>r!=m>r&&n<(u-h)*(r-d)/(m-d)+h&&(s=!s)}return s}function Ni(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ei(n,t)}function Te(e){return t=>t.pointerType==="mouse"?e(t):void 0}var ji=jr,Mi=Xt,_i=_r,Ri=Rr,Ii=en,Ti=Ir,Di=rt,ki=Dr,Ai=Ar,Pi=Lr,Li=Fr,Oi=$r,Fi=Ur,$i=Kr,Ui=Vr,at="DropdownMenu",[Bi]=Ye(at,[Er]),U=Er(),[Ki,Wr]=Bi(at),Qr=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:c,modal:i=!0}=e,f=U(t),h=l.useRef(null),[d,u]=Kt({prop:s,defaultProp:o??!1,onChange:c,caller:at});return a.jsx(Ki,{scope:t,triggerId:qe(),triggerRef:h,contentId:qe(),open:d,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(m=>!m),[u]),modal:i,children:a.jsx(ji,{...f,open:d,onOpenChange:u,dir:r,modal:i,children:n})})};Qr.displayName=at;var qr="DropdownMenuTrigger",zr=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Wr(qr,n),c=U(n);return a.jsx(Mi,{asChild:!0,...c,children:a.jsx(G.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Gt(t,o.triggerRef),onPointerDown:j(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:j(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});zr.displayName=qr;var Gi="DropdownMenuPortal",Xr=e=>{const{__scopeDropdownMenu:t,...n}=e,r=U(t);return a.jsx(_i,{...r,...n})};Xr.displayName=Gi;var Yr="DropdownMenuContent",Jr=l.forwardRef((e,t)=>
108{const{__scopeDropdownMenu:n,...r}=e,s=Wr(Yr,n),o=U(n),c=l.useRef(!1);return a.jsx(Ri,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:j(e.onCloseAutoFocus,i=>{var f;c.current||(f=s.triggerRef.current)==null||f.focus(),c.current=!1,i.preventDefault()}),onInteractOutside:j(e.onInteractOutside,i=>{const f=i.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,d=f.button===2||h;(!s.modal||d)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jr.displayName=Yr;var Vi="DropdownMenuGroup",Hi=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Ii,{...s,...r,ref:t})});Hi.displayName=Vi;var Wi="DropdownMenuLabel",Zr=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Ti,{...s,...r,ref:t})});Zr.displayName=Wi;var Qi="DropdownMenuItem",ea=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Di,{...s,...r,ref:t})});ea.displayName=Qi;var qi="DropdownMenuCheckboxItem",ta=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(ki,{...s,...r,ref:t})});ta.displayName=qi;var zi="DropdownMenuRadioGroup",Xi=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Ai,{...s,...r,ref:t})});Xi.displayName=zi;var Yi="DropdownMenuRadioItem",na=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Pi,{...s,...r,ref:t})});na.displayName=Yi;var Ji="DropdownMenuItemIndicator",ra=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Li,{...s,...r,ref:t})});ra.displayName=Ji;var Zi="DropdownMenuSeparator",aa=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Oi,{...s,...r,ref:t})});aa.displayName=Zi;var ec="DropdownMenuArrow",tc=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Fi,{...s,...r,ref:t})});tc.displayName=ec;var nc="DropdownMenuSubTrigger",sa=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx($i,{...s,...r,ref:t})});sa.displayName=nc;var rc="DropdownMenuSubContent",oa=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=U(n);return a.jsx(Ui,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oa.displayName=rc;var ac=Qr,sc=zr,oc=Xr,ia=Jr,ca=Zr,la=ea,ua=ta,da=na,fa=ra,ha=aa,ma=sa,pa=oa;const ic=ac,cc=sc,lc=l.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(ma,{ref:s,className:Q("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(za,{className:"ml-auto h-4 w-4"})]}));lc.displayName=ma.displayName;const uc=l.forwardRef(({className:e,...t},n)=>a.jsx(pa,{ref:n,className:Q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));uc.displayName=pa.displayName;const ga=l.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(oc,{children:a.jsx(ia,{ref:r,sideOffset:t,className:Q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
108de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));ga.displayName=ia.displayName;const Ut=l.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(la,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ut.displayName=la.displayName;const dc=l.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(ua,{ref:s,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(fa,{children:a.jsx(Qa,{className:"h-4 w-4"})})}),t]}));dc.displayName=ua.displayName;const fc=l.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(da,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(fa,{children:a.jsx(Ja,{className:"h-2 w-2 fill-current"})})}),t]}));fc.displayName=da.displayName;const hc=l.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(ca,{ref:r,className:Q("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));hc.displayName=ca.displayName;const mc=l.forwardRef(({className:e,...t},n)=>a.jsx(ha,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));mc.displayName=ha.displayName;const pc=()=>{const[e,t]=l.useState(!1),n=async r=>{try{let o=`https://hhyaomljnghjoktpetib.supabase.co/functions/v1/public-rss-feed?format=${r}`;console.log(`Opening ${r} feed URL:`,o),window.open(o,"_blank"),X({title:r==="rss"?"RSS Feed":"HTML View",description:`Opening public ${r==="rss"?"RSS feed":"HTML view"} in new tab.`})}catch(s){console.error(`Error accessing ${r} feed:`,s),X({title:"Error",description:`Failed to open ${r} feed. Please check your connection.`,variant:"destructive"})}finally{t(!1)}};return a.jsx(Et,{children:a.jsxs(Nt,{children:[a.jsxs(ic,{open:e,onOpenChange:t,children:[a.jsx(jt,{asChild:!0,children:a.jsx(cc,{asChild:!0,children:a.jsxs(K,{variant:"outline",className:"flex items-center gap-2 border-gray-300 hover:bg-gray-100 hover:text-gray-900",children:[a.jsx(_t,{className:"h-4 w-4"}),"View RSS Feed"]})})}),a.jsxs(ga,{align:"end",children:[a.jsxs(Ut,{onClick:()=>n("rss"),children:[a.jsx(_t,{className:"h-4 w-4 mr-2"}),a.jsx("span",{children:"XML Feed"})]}),a.jsxs(Ut,{onClick:()=>n("html"),children:[a.jsx(Bn,{className:"h-4 w-4 mr-2"}),a.jsx("span",{children:"HTML View"})]})]})]}),a.jsx(Mt,{children:a.jsx("p",{className:"text-sm",children:"View public RSS feed (no authentication required)"})})]})})},gc=({onLogout:e,onExportTXT:t,onExportAllLeads:n,leads:r=[],allLeads:s=[]})=>{const o=()=>{t&&r.length>0&&t(r)},c=()=>{n&&n()},i=r.length,f=s.length;return a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx("h1",{className:"text-2xl font-bold text-[#06302b]",children:"Deal Review Leads"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(K,{variant:"outline",asChild:!0,className:"bg-gray-100 px-4 py-2 rounded-md hover:bg-gray-200 transition-colors flex items-center gap-2",children:a.jsxs(ka,{to:"/rss",children:[a.jsx(_t,{className:"h-4 w-4"}),"Back to RSS Feed"]})}),a.jsx(pc,{}),r&&r.length>0&&a.jsx(Et,{children:a.jsxs(Nt,{children:[a.jsx(jt,{asChild:!0,children:a.jsxs(K,{variant:"outline",onClick:o,className:"flex items-center gap-2 border-gray-300 hover:bg-gray-100 hover:text-gray-900",children:[a.jsx(Bn,{className:"h-4 w-4"}),"Export TXT (",i,")"]})}),a.jsx(Mt,{children:a.jsxs("p",{className:"text-sm",children:["Export ",i," leads from current tab"]})})]})}),s&&s.length>0&&a.jsx(Et,{children:a.jsxs(Nt,{children:[a.jsx(jt,{asChild:!0,children:a.jsxs(K,{variant:"outline",onClick:c,className:"flex items-center gap-2 border-gray-300 hover:bg-gray-100 hover:text-gray-900",children:[a.jsx(es,{className:"h-4 w-4"}),"Export All (",f,")"]})}),a.jsx(Mt,{children:a.jsxs("p",{className:"text-sm",children:["Export all ",f," leads (deals and contacts)"]})})]})}),a.jsxs(K,{variant:"outline",onClick:e,className:"flex items-center gap-2 border-gray-300 hover:bg-gray-100 hover:text-gray-900",children:[a.jsx(ts,{className:"h-4 w-4"}),"Logout"]})]})]})},vc=()=>a.jsx("div",{className:"flex justify-center items-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-[#00816A]"})}),yc=({sortField:e,sortDirection:t,onSort:n})=>a.jsx(La,{className:"bg-gray-50",children:a.jsxs(Pn,{children:[a.jsx(oe,{className:"cursor-pointer font-semibold text-gray-600 hover:text-gray-900 transition-colors",onClick:()=>n("created_at"),children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(Kn,{className:"h-4 w-4"}),a.jsx("span",{children:"Date"}),e==="created_at"&&a.jsx(Ne,{className:`h-4 w-4 transition-transform ${t==="asc"?"rotate-180":""}`})]})}),a.jsx(oe,{className:"cursor-pointer font-semibold text-gray-600 hover:text-gray-900 transition-colors",onClick:()=>n("name"),children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(rs,{className:"h-4 w-4"}),a.jsx("span",{children:"Name"}),e==="name"&&a.jsx(Ne,{className:`h-4 w-4 transition-transform ${t==="asc"?"rotate-180":""}`})]})}),a.jsx(oe,{className:"cursor-pointer font-semibold text-gray-600 hover:text-gray-900 transition-colors",onClick:()=>n("business_email"),children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(Bt,{className:"h-4 w-4"}),a.jsx("span",{children:"Email"}),e==="business_email"&&a.jsx(Ne,{className:`h-4 w-4 transition-transform ${t==="asc"?"rotate-180":""}`})]})}),a.jsx(oe,{className:"cursor-pointer font-semibold text-gray-600 hover:text-gray-900 transition-colors",onClick:()=>n("companyName"),children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(In,{className:"h-4 w-4"}),a.jsx("span",{children:"Company"}),e==="companyName"&&a.jsx(Ne,{className:`h-4 w-4 transition-transform ${t==="asc"?"rotate-180":""}`})]})}),a.jsx(oe,{className:"cursor-pointer font-semibold text-gray-600 hover:text-gray-900 transition-colors",onClick:()=>n("group"),children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("span",{children:"Group"}),e==="group"&&a.jsx(Ne,{className:`h-4 w-4 transition-transform ${t==="asc"?"rotate-180":""}`})]})}),a.jsx(oe,{className:"font-semibold text-gray-600",children:"Status"}),a.jsx(oe,{className:"font-semibold text-gray-600",children:"Actions"})]})}),xc=({lead:e,onSelectLead:t})=>{const n=e.company_name||e.companyName||e.company||"",r=e.business_email||e.email||"";return a.jsxs(Pn,{className:"hover:bg-gray-50 transition-colors",children:[a.jsx(ie,{className:"text-gray-600",children:kn(new Date(e.created_at),"MMM d, yyyy HH:mm:ss")}),a.jsx(ie,{className:"font-medium",children:e.name}),a.jsx(ie,{className:"text-gray-600",children:r}),a.jsx(ie,{className:"text-gray-600",children:n}),a.jsx(ie,{className:"text-gray-600",children:e.group||"-"}),a.jsx(ie,{children:a.jsx(Oa,{status:e.status})}),a.jsx(ie,{children:a.jsxs(K,{size:"sm",variant:"ghost",onClick:()=>t(e),className:"flex items-center gap-2 hover:bg-gray-100 text-gray-700 hover:text-gray-900",children:[a.jsx(F
108a,{className:"h-4 w-4"}),"View"]})})]},e.id)},bc=({leads:e,sortField:t,sortDirection:n,onSort:r,onSelectLead:s})=>{const o=[...e].sort((c,i)=>{if(t==="created_at")return n==="asc"?new Date(c.created_at).getTime()-new Date(i.created_at).getTime():new Date(i.created_at).getTime()-new Date(c.created_at).getTime();const f=c[t]||"",h=i[t]||"";return n==="asc"?String(f).localeCompare(String(h)):String(h).localeCompare(String(f))});return a.jsx("div",{className:"bg-white border rounded-md shadow-sm overflow-hidden",children:a.jsxs($a,{children:[a.jsx(yc,{sortField:t,sortDirection:n,onSort:r}),a.jsx(Ua,{children:o.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center h-32 text-gray-500",children:"No leads found"})}):o.map(c=>a.jsx(xc,{lead:c,onSelectLead:s},c.id))})]})})},bt=({leads:e,isLoading:t,onSelectLead:n,allLeads:r})=>{const{logout:s}=Ln(),[o,c]=l.useState("created_at"),[i,f]=l.useState("desc");l.useEffect(()=>{if(console.log(`LeadsList received ${(e==null?void 0:e.length)||0} leads`),e&&e.length>0){const m=e.filter(g=>g.business_email==="[email protected]"||g.business_email==="[email protected]");m.length>0?console.log("🎯 TARGET LEADS FOUND in LeadsList:",m):(console.log("⚠️ TARGET LEADS NOT FOUND in LeadsList"),console.log("📧 Available emails in current leads:",e.map(g=>g.business_email))),console.log("Sample leads:",e.slice(0,3))}},[e]);const h=m=>{o===m?f(i==="asc"?"desc":"asc"):(c(m),f("desc"))},d=m=>{const g=[{key:"lead_number",label:"Lead Number"},{key:"id",label:"ID"},{key:"name",label:"Name"},{key:"business_email",label:"Email"},{key:"phone",label:"Phone"},{key:"company",label:"Company"},{key:"group",label:"Group"},{key:"status",label:"Status"},{key:"created_at",label:"Created Date"},{key:"notes",label:"Notes"},{key:"lead_type",label:"Lead Type"}],b=g.map(S=>S.label).join("	"),p=m.map((S,M)=>{const k=Je(S.id);return`${g.map(_=>{const{key:A}=_;if(A==="lead_number")return(M+1).toString();if(A==="id")return k;if(A==="company")return S.company_name||S.companyName||S.company||"";if(A==="business_email")return S.business_email||S.email||"";const I=A in S?S[A]:"";return I==null?"":String(I)}).join("	")}`}).join(`
109`),v=`DEAL REVIEW LEADS - EXPORTED ${new Date().toLocaleDateString()}
110
111${b}
112${"=".repeat(b.length)}
113
114${p}`,y=new Blob([v],{type:"text/plain;charset=utf-8;"}),C=URL.createObjectURL(y),w=document.createElement("a");w.setAttribute("href",C),w.setAttribute("download",`deal-leads-export-${new Date().toISOString().split("T")[0]}.txt`),w.style.visibility="hidden",document.body.appendChild(w),w.click(),document.body.removeChild(w),X({title:"Export successful",description:`${m.length} leads exported to text file`})},u=()=>{if(r&&r.length>0){const m=[...r].sort((g,b)=>new Date(b.created_at).getTime()-new Date(g.created_at).getTime());d(m)}else X({title:"No leads available",description:"There are no leads to export",variant:"destructive"})};return a.jsxs("div",{className:"w-full",children:[a.jsx(gc,{onLogout:s,onExportTXT:d,onExportAllLeads:u,leads:e,allLeads:r}),a.jsx("div",{className:"mb-4",children:a.jsx("p",{className:"text-gray-500 text-sm",children:e.length>0?`Showing ${e.length} leads`:"No leads available"})}),t?a.jsx(vc,{}):a.jsx(bc,{leads:e,sortField:o,sortDirection:i,onSort:h,onSelectLead:n})]})},wc=({dealLeads:e,contactLeads:t,ctaLeads:n,isLoadingDeals:r,isLoadingContacts:s,isLoadingCTA:o,onSelectLead:c,currentTab:i})=>{const f=[...e,...t,...n];return l.useEffect(()=>{console.log(`LeadsTabContent - Deal leads count: ${(e==null?void 0:e.length)||0}`),console.log(`LeadsTabContent - Contact leads count: ${(t==null?void 0:t.length)||0}`),console.log(`LeadsTabContent - Current tab: ${i}`)},[e,t,i]),a.jsxs(a.Fragment,{children:[i==="deal-reviews"&&a.jsx("div",{className:"mt-2",children:a.jsx(bt,{leads:e,isLoading:r,onSelectLead:c,allLeads:f})}),i==="contact-submissions"&&a.jsx("div",{className:"mt-2",children:a.jsx(bt,{leads:t,isLoading:s,onSelectLead:c,allLeads:f})}),i==="cta-emails"&&a.jsx("div",{className:"mt-2",children:a.jsx(bt,{leads:n,isLoading:o,onSelectLead:c,allLeads:f})})]})},Sc=({currentTab:e,setCurrentTab:t,selectedLead:n,handleSelectLead:r,handleUpdateStatus:s,dealLeads:o,contactLeads:c,ctaLeads:i,isLoadingDeals:f,isLoadingContacts:h,isLoadingCTA:d})=>n?a.jsx(As,{lead:n,onBack:()=>r(null),onUpdateStatus:s}):a.jsx("div",{children:a.jsxs(zs,{value:e,onValueChange:t,children:[a.jsx(Ys,{currentTab:e,onTabChange:t}),a.jsx(wc,{dealLeads:o,contactLeads:c,ctaLeads:i,isLoadingDeals:f,isLoadingContacts:h,isLoadingCTA:d,onSelectLead:r,currentTab:e})]})}),Cc=(e="deal-reviews",t=null)=>{const[n,r]=l.useState(e);return l.useEffect(()=>{t&&r(t.lead_type==="deal"?"deal-reviews":"contact-submissions")},[t]),{currentTab:n,setCurrentTab:r}},Ec=({dealLeads:e,contactLeads:t,ctaLeads:n,isLoadingDeals:r,isLoadingContacts:s,isLoadingCTA:o,selectedLead:c,handleSelectLead:i,handleUpdateStatus:f,activeTab:h})=>{const{currentTab:d,setCurrentTab:u}=Cc(h,c);return a.jsx(Sc,{currentTab:d,setCurrentTab:u,selectedLead:c,handleSelectLead:i,handleUpdateStatus:f,deal
114Leads:e,contactLeads:t,ctaLeads:n,isLoadingDeals:r,isLoadingContacts:s,isLoadingCTA:o})},Ac=()=>{const{isAuthenticated:e,isLoading:t}=Ln();return t?a.jsx(Ba,{}):e?a.jsx(Aa,{children:a.jsx("div",{className:"container mx-auto py-8 px-4",children:a.jsx("div",{className:"bg-white rounded-lg shadow-sm border p-6",children:a.jsx(Cs,{children:n=>a.jsx(Ec,{...n})})})})}):a.jsx(Ka,{})};export{Ac 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.