1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CJLICdHJ.js","assets/vendor-react-kZYqt9_-.js","assets/vendor-shared-4I9wHvDt.js","assets/index-D97PxVye.css","assets/index-CZfo0HKM.js","assets/index-D3aOuVwH.js"])))=>i.map(i=>d[i]); 2import{r as o,j as e,d as K,u as Te,N as St,O as Ct}from"./vendor-react-kZYqt9_-.js";import{T as It,c as k,B as M,a as Et,b as Tt,d as At,S as re,e as Ot,u as A,f as B,s as T,M as Mt,L as Q,g as Je,h as ee,C as te,i as Y,j as Dt,X as pe,k as Rt,l as F,P as Lt,m as Pt,n as Bt,H as Vt}from"./index-CJLICdHJ.js";import{u as Ft}from"./use-mobile-DaDUvAFV.js";import{I as se}from"./input-CLF0vjN3.js";import{S as Kt}from"./separator-C7YGmTwn.js";import{S as qt,a as $t}from"./sheet-BjJjk6Ql.js";import{S as De}from"./skeleton-DXzjb2RS.js";import{P as zt,B as Ut,a as Wt}from"./pen-tool-Cu0u_ceJ.js";import{N as Ht}from"./NavLink-wacuWI38.js";import{l as Gt}from"./logo-dumpster-controls-Ri8Ui11r.js";import{u as Qt}from"./useAcceptedEstimates-Bk_W5z5a.js";import{u as Yt,a as Jt,b as Xt}from"./useOverweightPending-BjEMbT8B.js";import{u as Zt}from"./useHubNearbyBadge-DgB-G4yb.js";import{u as Xe,W as es}from"./WebsiteServicePendingDialog-XLjvshNg.js";import{u as fe,a as ts,b as ss}from"./useBusinessLines-BJvYOct_.js";import{s as rs,a as as,B as Ne,n as ns}from"./businessLine-CeEbKwwM.js";import{F as is}from"./file-text-B74h4Xm0.js";import{L as os}from"./layout-dashboard-02YL7-jw.js";import{A as ls}from"./activity-LgK1tsFk.js";import{C as cs}from"./calendar-check-Dbd3EPHq.js";import{C as Ze}from"./clock-CcRcaIdw.js";import{D as ds}from"./dollar-sign-SLb9z0od.js";import{U as ms}from"./users-C4cSSixY.js";import{M as us}from"./message-square-D2gtlrDF.js";import{S as ps}from"./shopping-bag-D31SFPv7.js";import{L as fs}from"./layout-grid-BPQRDZxg.js";import{T as xe}from"./truck-60gYvBHd.js";import{U as xs}from"./user-cog-yRxQ6tuW.js";import{G as ke}from"./globe-C1RnLXgE.js";import{S as et}from"./shield-Bmnryq25.js";import{S as hs}from"./star-BCfU9VYO.js";import{A as gs}from"./arrow-up-down-Cp7g3aH3.js";import{A as bs}from"./AppDownloadPopover-angSqvEk.js";import{u as ys}from"./useCurrentDriver-C2XOf7Fz.js";import{A as vs,a as ws,b as js,c as Ns,d as ks,e as _s,f as Ss,g as Cs}from"./alert-dialog-m-fnGeHX.js";import{C as tt}from"./checkbox-Sx_uQXVG.js";import{e as Is,s as Es}from"./driverModeSwitch-BegjbDVC.js";import{u as Ts,a as st,o as As,b as Os,c as Ms,O as Re,L as Ds}from"./LandfillsContext-CsDO-NRc.js";import{u as Rs}from"./useSupportNotifications-Ddr2hJ4-.js";import{I as Ls,K as Ps,a as Bs,b as Vs,B as Fs}from"./BusinessLineRow-CjNwlM96.js";import{D as X,a as Z,b as ce,c as W,d as de,e as Ks}from"./dialog-DpVeI0h0.js";import{M as me}from"./mail-CUnx4KR5.js";import{C as qs}from"./circle-check-BJij0u4x.js";import{i as $s}from"./signupOnboardingFlags-CJndTyCO.js";import{A as Le,a as Pe,b as Be}from"./avatar-BHnU-D7x.js";import{P as Ve,a as Fe,b as Ke}from"./popover-Co7pOVrJ.js";import{D as zs,a as Us,b as Ws,c as ne,d as ye}from"./dropdown-menu-CSckvii9.js";import{T as Hs,a as Gs,b as ve,c as we}from"./tabs-BfRjdn8x.js";import{K as Qs}from"./KnowledgeBaseTab-BULzrqwM.js";import{H as rt}from"./headset-CcLnjApn.js";import{P as Ys}from"./plus-irpJwzn2.js";import{M as Js}from"./message-circle-Dfvgay83.js";import{A as Ae}from"./arrow-right-D7eIBNhu.js";import{C as Xs}from"./CountryFlagBadge-BW-FsHyr.js";import{c as Zs}from"./country-BZ0uU73N.js";import{u as er}from"./useDcShop-C_YcFGIS.js";import{u as tr}from"./useDcShopOrder-Ck9Uwi0a.js";import{c as sr}from"./dcShop-oF1EDBUZ.js";import{S as _e}from"./shopping-cart-CVKKqujP.js";import{U as qe}from"./user-BF0PnEZ8.js";import{B as rr}from"./building-2-cOFH7Yfh.js";import{C as ar}from"./credit-card-CmogX9hM.js";import{L as nr}from"./link-2-BpxPlv-U.js";import{S as ir}from"./store-HRUUrwq7.js";import{G as or}from"./gift-C2wxrw9a.js";import{C as lr}from"./circle-help-BY6sk0o5.js";import{S as cr}from"./sun-iRIBzqre.js";import{M as dr}from"./moon-QOaNgaHI.js";import{S as at}from"./smartphone-eQRbnQIH.js";import{S as nt}from"./sparkles-CRitYmNR.js";import{R as it}from"./rocket-B4-M0hzK.js";import{B as $e}from"./bell-C7jyG-7J.js";import{I as ot}from"./info-DwtPUie4.js";import{S as oe}from"./settings-CJAMNpmJ.js";import{C as G}from"./chevron-right-CMERZ8Na.js";import{S as lt}from"./shield-alert-DoBGkylF.js";import{A as mr}from"./AppFooter-Bb7DdpHA.js";import{T as ur,a as pr}from"./TreshaAI-D9VVuG25.js";import{u as fr,a as xr}from"./useAdminImpersonation-Cz68WjQ5.js";import{E as hr}from"./external-link-DfZFY2C6.js";import{p as gr,u as br,a as yr,b as vr,c as wr,d as jr,e as Nr,F as kr}from"./ForceUpdateModal-Ow217hOP.js";import{C as _r}from"./chevron-down-DPR5hKML.js";import{C as Sr}from"./check-BeRDmh4q.js";import{P as Cr}from"./package-check-t5L2R6rJ.js";import ue from"./confetti.module-BwfKgdxr.js";import{H as Ir}from"./heart-BiLTyCUq.js";import{P as Se}from"./package-DfTxE0ok.js";import{G as Er,A as Tr}from"./AppStoreBadges-CK6NUzlW.js";import{S as Ar}from"./shield-check-Cu1QJtBc.js";import{u as Or}from"./useDriverProfile-BgVd-5xi.js";import{u as Mr}from"./usePresenceHeartbeat-BUrS4C98.js";import{A as Dr}from"./dispatchStatus-DLFout1f.js";import{f as he}from"./vendor-shared-4I9wHvDt.js";import{u as Rr}from"./useCompanyCurrency-C-nCEqIT.js";import{i as Lr}from"./scrapMetalFlags-Cv0mtKIz.js";import{i as Pr,W as Br,u as Vr,a as ze,w as Fr,b as Ue}from"./useWelcomeState-QLP748fB.js";import{f as Kr}from"./celebrate-DgwtQW6m.js";import{R as qr}from"./recycle-BNisE5rh.js";import"./index-DZHKSf5a.js";import"./index-CeLXSty7.js";import"./useMutation-CPskUMJp.js";import"./includedWeight-CEJ4w4G_.js";import"./life-buoy-DOcPW85m.js";import"./browser-CjSdxGTc.js";import"./index-YtiW1uB2.js";import"./paymentLink-BeNr5kjj.js";import"./landfills-HzHgvWJM.js";import"./calculator-BnbXtbQI.js";import"./chevron-up-DNBLDc5y.js";import"./flag-Oy7MAy6_.js";import"./circle-alert-B_T5QKOl.js";import"./dot-B632cFDZ.js";import"./switch-BpXkMjym.js";import"./BetaPill-Dvk0jErM.js";import"./index-LRksyPXF.js";import"./index-D7tS8DBk.js";import"./circle-BfazDjaN.js";import"./accordion-BM0ZWwDV.js";import"./index-BuvSPOvx.js";
2import"./badge-DmZDa3Nd.js";import"./search-Dr2_WKFT.js";import"./nexaforge-logo-Dvvx4Yps.js";import"./lock-Dcy-zoX4.js";import"./scroll-area-D1mKnTKp.js";import"./index-BdQq_4o_.js";import"./useCompanyName-BYmvT0WU.js";import"./edgeError-C-0OAb9E.js";import"./stampPhoto-DkMaiiXw.js";import"./reverseGeocode-kt0BnjXB.js";import"./googleMapsLoader-HybJcwXg.js";import"./driverPhotoTypes-BgCCVes-.js";import"./wrench-DZ7mSTDf.js";import"./clock-3-Je-ctr24.js";import"./camera-D8U4A9ng.js";import"./image-plus-BRDScmWQ.js";import"./circle-x-C--6Gv4g.js";import"./factory-D5GFiqi3.js";import"./volume-2-jBUP4rpc.js";import"./minimize-2-BLcZHJex.js";import"./maximize-2-Cbo-cxEA.js";import"./mic-DF9wDXri.js";import"./send-DjevxXYQ.js";import"./file-plus-2-BUK11n8o.js";import"./route-D8PVO3pT.js";import"./list-checks-BFAPXgSe.js";import"./boxes-AzOg5ElO.js";import"./receipt-CmfSIz9L.js";import"./index-D3aOuVwH.js";import"./savePushToken-CBc5p6Iw.js";import"./index-Dn1NXzlw.js";import"./download-DjpKa06A.js";const $r="sidebar:state",zr=60*60*24*7,Ur="16rem",Wr="18rem",Hr="3rem",Gr="b",ct=o.createContext(null);function ae(){const t=o.useContext(ct);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const dt=o.forwardRef(({defaultOpen:t=!0,open:r,onOpenChange:s,className:n,style:a,children:l,...u},f)=>
2{const i=Ft(),[g,p]=o.useState(!1),[m,c]=o.useState(t),d=r??m,N=o.useCallback(x=>{const y=typeof x=="function"?x(d):x;s?s(y):c(y),document.cookie=`${$r}=${y}; path=/; max-age=${zr}`},[s,d]),w=o.useCallback(()=>i?p(x=>!x):N(x=>!x),[i,N,p]);o.useEffect(()=>{const x=y=>{y.key===Gr&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),w())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[w]);const h=d?"expanded":"collapsed",v=o.useMemo(()=>({state:h,open:d,setOpen:N,isMobile:i,openMobile:g,setOpenMobile:p,toggleSidebar:w}),[h,d,N,i,g,p,w]);return e.jsx(ct.Provider,{value:v,children:e.jsx(It,{delayDuration:0,children:e.jsx("div",{style:{"--sidebar-width":Ur,"--sidebar-width-icon":Hr,...a},className:k("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",n),ref:f,...u,children:l})})})});dt.displayName="SidebarProvider";const mt=o.forwardRef(({side:t="left",variant:r="sidebar",collapsible:s="offcanvas",className:n,children:a,...l},u)=>{const{isMobile:f,state:i,openMobile:g,setOpenMobile:p}=ae();return s==="none"?e.jsx("div",{className:k("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",n),ref:u,...l,children:a}):f?e.jsx(qt,{open:g,onOpenChange:p,...l,children:e.jsx($t,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Wr},side:t,children:e.jsx("div",{className:"flex h-full w-full flex-col",children:a})})}):e.jsxs("div",{ref:u,className:"group peer hidden text-sidebar-foreground md:block","data-state":i,"data-collapsible":i==="collapsed"?s:"","data-variant":r,"data-side":t,children:[e.jsx("div",{className:k("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",r==="floating"||r==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),e.jsx("div",{className:k("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",r==="floating"||r==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...l,children:e.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow pb-[50px]",children:a})})]})});mt.displayName="Sidebar";const ut=o.forwardRef(({className:t,onClick:r,...s},n)=>{const{toggleSidebar:a}=ae();return e.jsxs(M,{ref:n,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:k("h-7 w-7",t),onClick:l=>{r==null||r(l),a()},...s,children:[e.jsx(zt,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});ut.displayName="SidebarTrigger";const Qr=o.forwardRef(({className:t,...r},s)=>{const{toggleSidebar:n}=ae();return e.jsx("button",{ref:s,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:k("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 hover:after:bg-sidebar-border sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...r})});Qr.displayName="SidebarRail";const Yr=o.forwardRef(({className:t,...r},s)=>e.jsx("main",{ref:s,className:k("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-
2h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",t),...r}));Yr.displayName="SidebarInset";const Jr=o.forwardRef(({className:t,...r},s)=>e.jsx(se,{ref:s,"data-sidebar":"input",className:k("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...r}));Jr.displayName="SidebarInput";const Xr=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"header",className:k("flex flex-col gap-2 p-2",t),...r}));Xr.displayName="SidebarHeader";const Zr=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"footer",className:k("flex flex-col gap-2 p-2 pb-[8px]",t),...r}));Zr.displayName="SidebarFooter";const ea=o.forwardRef(({className:t,...r},s)=>e.jsx(Kt,{ref:s,"data-sidebar":"separator",className:k("mx-2 w-auto bg-sidebar-border",t),...r}));ea.displayName="SidebarSeparator";const pt=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"content",className:k("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...r}));pt.displayName="SidebarContent";const Ce=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"group",className:k("relative flex w-full min-w-0 flex-col p-2",t),...r}));Ce.displayName="SidebarGroup";const ta=o.forwardRef(({className:t,asChild:r=!1,...s},n)=>{const a=r?re:"div";return e.jsx(a,{ref:n,"data-sidebar":"group-label",className:k("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...s})});ta.displayName="SidebarGroupLabel";const sa=o.forwardRef(({className:t,asChild:r=!1,...s},n)=>{const a=r?re:"button";return e.jsx(a,{ref:n,"data-sidebar":"group-action",className:k("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",t),...s})});sa.displayName="SidebarGroupAction";const Ie=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"group-content",className:k("w-full text-sm",t),...r}));Ie.displayName="SidebarGroupContent";const ft=o.forwardRef(({className:t,...r},s)=>e.jsx("ul",{ref:s,"data-sidebar":"menu",className:k("flex w-full min-w-0 flex-col gap-1",t),...r}));ft.displayName="SidebarMenu";const xt=o.forwardRef(({className:t,...r},s)=>e.jsx("li",{ref:s,"data-sidebar":"menu-item",className:k("group/menu-item relative",t),...r}));xt.displayName="SidebarMenuItem";const ra=Ot("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),ht=o.forwardRef(({asChild:t=!1,isActive:r=!1,variant:s="default",size:n="default",tooltip:a,className:l,...u},f)=>{const i=t?re:"button",{isMobile:g,state:p}=ae(),m=e.jsx(i,{ref:f,"data-sidebar":"menu-button","data-size":n,"data-active":r,className:k(ra({variant:s,size:n}),l),...u});
2return a?(typeof a=="string"&&(a={children:a}),e.jsxs(Et,{children:[e.jsx(Tt,{asChild:!0,children:m}),e.jsx(At,{side:"right",align:"center",hidden:p!=="collapsed"||g,...a})]})):m});ht.displayName="SidebarMenuButton";const aa=o.forwardRef(({className:t,asChild:r=!1,showOnHover:s=!1,...n},a)=>{const l=r?re:"button";return e.jsx(l,{ref:a,"data-sidebar":"menu-action",className:k("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...n})});aa.displayName="SidebarMenuAction";const na=o.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,"data-sidebar":"menu-badge",className:k("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...r}));na.displayName="SidebarMenuBadge";const ia=o.forwardRef(({className:t,showIcon:r=!1,...s},n)=>{const a=o.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return e.jsxs("div",{ref:n,"data-sidebar":"menu-skeleton",className:k("flex h-8 items-center gap-2 rounded-md px-2",t),...s,children:[r&&e.jsx(De,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),e.jsx(De,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});ia.displayName="SidebarMenuSkeleton";const oa=o.forwardRef(({className:t,...r},s)=>e.jsx("ul",{ref:s,"data-sidebar":"menu-sub",className:k("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...r}));oa.displayName="SidebarMenuSub";const la=o.forwardRef(({...t},r)=>e.jsx("li",{ref:r,...t}));la.displayName="SidebarMenuSubItem";const ca=o.forwardRef(({asChild:t=!1,size:r="md",isActive:s,className:n,...a},l)=>{const u=t?re:"a";return e.jsx(u,{ref:l,"data-sidebar":"menu-sub-button","data-size":r,"data-active":s,className:k("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",r==="sm"&&"text-xs",r==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",n),...a})});ca.displayName="SidebarMenuSubButton";const da=[{items:[{titleKey:"nav.dashboard",url:"/app/dashboard",icon:os},{titleKey:"nav.operations",url:"/app/operations",icon:ls},{titleKey:"nav.dispatch",url:"/app/dispatch",icon:cs},{titleKey:"nav.landfillMap",url:"/app/landfill-map",icon:Mt},{titleKey:"nav.rentalHistory",url:"/app/rental-history",icon:Ze}]},{items:[{titleKey:"nav.finances",url:"/app/finances",icon:ds},{titleKey:"nav.customers",url:"/app/customers",icon:ms},{titleKey:"nav.messages",url:"/app/messages",icon:us},{titleKey:"nav.store",url:"/app/store",icon:ps}]},{items:[{titleKey:"nav.inventory",url:"/app/inventory",icon:fs},{titleKey:"nav.trucks",url:"/app/trucks",icon:xe},{titleKey:"nav.drivers",url:"/app/drivers",icon:xs}]},{items:[{titleKey:"nav.bookingPage",url:"/app/booking",icon:Ut},{titleKey:"nav.websiteBuilder",url:"/app/website-builder",icon:ke}]},{items:[{titleKey:"nav.adminUser",url:"/app/admin",icon:et}]}];function ma(){const t=o.useRef(null);return o.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let s;const n=()=>{const a=4e3+Math.random()*2e3;s=setTimeout(()=>{var l;(l=t.current)==null||l.classList.add("version-badge-sweep-active"),setTimeout(()=>{var u;(u=t.current)==null||u.classList.remove("version-badge-sweep-active"),n()},1400)},a)};return n(),()=>clearTimeout(s)},[]),e.jsx("span",{ref:t,className:"version-badge-sweep relative inline-flex items-center justify-center rounded-[5px] ml-1.5",children:e.jsx("span",{className:"relative z-10 px-[5px] py-[1px] text-[9px] font-bold tracking-wide leading-none rounded-[4px] bg-gradient-to-b from-white to-muted/80 text-primary dark:from-muted dark:to-secondary dark:text-primary",style:{textShadow:"0 0.5px 0 hsl(0 0% 100% / 0.6)",boxShadow:"0 1px 3px hsl(0 0% 0% / 0.12), 0 0.5px 0 hsl(0 0% 100% / 0.5) inset, 0 -0.5px 0 hsl(0 0% 0% / 0.08) inset"},children:"2.0"})})}function ua(){const t=o.useRef(null);return o.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let s;const n=()=>{const a=3e3+Math.random()*2e3;s=setTimeout(()=>{var l;(l=t.current)==null||l.classList.add("star-sweep-active"),setTimeout(()=>{var u;(u=t.current)==null||u.classList.remove("star-sweep-active"),n()},1400)},a)};return n(),()=>clearTimeout(s)},[]),e.jsx("span",{ref:t,className:"ml-auto star-sweep-wrap",children:e.jsx(hs,{className:"w-3.5 h-3.5 text-muted-foreground
2/60"})})}function pa({onClick:t,t:r,hasNearbyOrders:s}){const n=o.useRef(null);return o.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let l;const u=()=>{const f=3e3+Math.random()*2e3;l=setTimeout(()=>{var i;(i=n.current)==null||i.classList.add("hub-sweep-active"),setTimeout(()=>{var g;(g=n.current)==null||g.classList.remove("hub-sweep-active"),u()},1400)},f)};return u(),()=>clearTimeout(l)},[]),e.jsx("div",{ref:n,className:"hub-sweep-card relative rounded-xl",children:e.jsxs("button",{onClick:t,className:"relative w-full rounded-xl border border-border/60 bg-card/50 sidebar-cta-btn flex items-center shadow-none hover:border-border hover:bg-card/80 hover:-translate-y-0.5 transition-all duration-200",children:[e.jsx("div",{className:"sidebar-cta-icon rounded-lg bg-muted/60 flex items-center justify-center shrink-0",children:e.jsx(gs,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("span",{className:"text-[13px] font-semibold block leading-tight text-foreground/80",children:r("nav.dumpsterHub")}),e.jsx("span",{className:"text-[10px] text-muted-foreground leading-tight",children:r("nav.marketplace")})]}),s&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0","data-testid":"sidebar-hub-nearby",title:r("nav.hubNearbyBadge"),children:e.jsx("span",{className:"sr-only",children:r("nav.hubNearbyBadge")})}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-muted-foreground/70 bg-muted/50 px-1.5 py-0.5 rounded-full shrink-0",children:"Open"})]})})}function fa(){const t=K(),r=Te(),{isMobile:s,setOpenMobile:n}=ae(),{t:a}=A(),{user:l}=B(),[u,f]=o.useState(!1),i=Qt(),g=Yt(),p=Jt(),m=Zt(),c=Xe(),[d,N]=o.useState(!1),{lines:w}=fe(),h=w.includes("dumpster_rental"),v=ts(!h),x=as({dumpsterOn:h,registeredInventory:v}),y=rs({dumpsterOn:h,junkOn:w.includes("junk_removal")});return o.useEffect(()=>{if(!(l!=null&&l.companyId)||!(l!=null&&l.userId))return;const C=async()=>{const{data:D}=await T.rpc("conversation_unread_counts");f((D??[]).some(q=>q.unread_count>0))};C();const S=T.channel("sidebar-unread").on("postgres_changes",{event:"INSERT",schema:"public",table:"messages",filter:`company_id=eq.${l.companyId}`},()=>{C()}).subscribe(),j=()=>{C()};window.addEventListener("dc:messages:read",j);const _=T.channel(`sidebar-unread-reads-${l.userId}`).on("postgres_changes",{event:"*",schema:"public",table:"conversation_state",filter:`member_user_id=eq.${l.userId}`},()=>{C()}).subscribe();return()=>{T.removeChannel(S),T.removeChannel(_),window.removeEventListener("dc:messages:read",j)}},[l==null?void 0:l.companyId,l==null?void 0:l.userId]),e.jsxs(e.Fragment,{children:[e.jsxs(mt,{className:"border-r border-sidebar-border sidebar-responsive",children:[e.jsxs("div",{className:"sidebar-logo flex items-center justify-start border-b border-border/20 pt-[41px]",children:[e.jsx("img",{src:Gt,alt:"Dumpster Controls",className:"sidebar-logo-img w-auto opacity-[0.88] hover:opacity-100 transition-opacity duration-300"}),e.jsx(ma,{})]}),e.jsxs(pt,{className:"px-2.5 overflow-y-auto styled-scrollbar",children:[da.map((C,S)=>e.jsx(Ce,{className:`sidebar-group ${S>0?"sidebar-group-border border-t border-border/30":""}`,children:e.jsx(Ie,{children:e.jsx(ft,{className:"sidebar-menu-gap",children:C.items.filter(j=>j.titleKey!=="nav.landfillMap"||s).filter(j=>j.titleKey!=="nav.websiteBuilder"||c==="pending"||c==="full").filter(j=>j.titleKey!=="nav.inventory"||x).filter(j=>j.titleKey!=="nav.bookingPage"||y).map(j=>e.jsx(xt,{children:e.jsx(ht,{asChild:!0,children:e.jsxs(Ht,{to:j.url,state:j.url==="/app/landfill-map"?{from:r.pathname+r.search}:void 0,className:"flex items-center sidebar-nav-item rounded-lg font-medium text-sidebar-foreground hover:bg-sidebar-accent transition-colors",activeClassName:"bg-sidebar-accent text-sidebar-accent-foreground font-semibold",onClick:_=>{if(j.titleKey==="nav.websiteBuilder"&&c==="pending"){_.preventDefault(),N(!0),s&&n(!1);return}s&&n(!1)},children:[e.jsx(j.icon,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:a(j.titleKey)}),j.titleKey==="nav.rentalHistory"&&g>0&&e.jsxs("span",{className:`ml-auto min-w-[18px] h-[18px] px-1 inline-flex items-center justify-center rounded-full text-[11px] font-semibold leading-none ${p>0?"bg-destructive text-destructive-foreground":"bg-primary text-primary-foreground"}`,title:p>0?a("nav.orphanAuthBadge",{count:p}):a("nav.abandonedLeadsBadge",{count:g}),children:[g>99?"99+":g,e.jsx("span",{className:"sr-only",children:p>0?a("nav.orphanAuthBadge",{count:p}):a("nav.abandonedLeadsBadge",{count:g})})]}),j.titleKey==="nav.messages"&&u&&e.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-blue-500","data-testid":"sidebar-messages-unread"}),j.titleKey==="nav.customers"&&i>0&&e.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-primary"}),j.titleKey==="nav.store"&&e.jsx(ua,{})]})})},j.titleKey))})})},S)),e.jsx(Ce,{className:"px-0 sidebar-cta-group border-t border-border/40",children:e.jsxs(Ie,{className:"sidebar-cta-spacing",children:[e.jsxs("button",{onClick:()=>{t("/app/new-order"),s&&n(!1)},className:"w-full rounded-xl bg-primary text-primary-foreground sidebar-cta-btn flex items-center shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all duration-200",children:[e.jsx("div",{className:"sidebar-cta-icon rounded-lg bg-primary-foreground
2/15 flex items-center justify-center shrink-0",children:e.jsx(is,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-[13px] font-semibold block leading-tight",children:a("nav.createNewOrder")}),e.jsx("span",{className:"text-[10px] opacity-70 leading-tight",children:a("nav.deliveryOrInvoice")})]})]}),e.jsx(pa,{onClick:()=>{t("/app/dumpster-hub"),s&&n(!1)},t:a,hasNearbyOrders:m})]})})]})]}),e.jsx(es,{open:d,onOpenChange:N})]})}function xa({open:t,onOpenChange:r}){const{t:s}=A(),n=K(),{user:a}=B(),[l,u]=o.useState(!1),f=async()=>{a!=null&&a.userId&&await Is(a.userId,{remember:l}),r(!1),n("/app/driver/tasks")};return e.jsx(vs,{open:t,onOpenChange:r,children:e.jsxs(ws,{"data-testid":"driver-mode-switch-dialog",children:[e.jsxs(js,{children:[e.jsxs(Ns,{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-5 h-5 text-primary","aria-hidden":!0}),s("driverMode.enterTitle")]}),e.jsx(ks,{children:s("driverMode.enterBody")})]}),e.jsxs("label",{className:"flex items-start gap-3 rounded-xl border border-border p-3 cursor-pointer",children:[e.jsx(tt,{checked:l,onCheckedChange:i=>u(i===!0),"data-testid":"driver-mode-remember",className:"mt-0.5"}),e.jsxs("span",{className:"space-y-0.5",children:[e.jsx("span",{className:"block text-sm font-medium leading-snug",children:s("driverMode.rememberOnThisDevice")}),e.jsx("span",{className:"block text-xs text-muted-foreground leading-snug",children:s("driverMode.rememberHint")})]})]}),e.jsxs(_s,{children:[e.jsx(Ss,{children:s("driverMode.notNow")}),e.jsx(Cs,{onClick:i=>{i.preventDefault(),f()},"data-testid":"driver-mode-confirm",children:s("driverMode.openDriverApp")})]})]})})}const Ee="dc:support:open",ie=60;function ha(t){switch(t.error){case"invalid_code":return"emailVerify.wrongCode";case"expired":case"no_live_challenge":case"attempts_or_expired":return"emailVerify.expired";case"max_sends":case"daily_cap":case"too_many_targets":case"target_cap":return"emailVerify.tooMany";case"suppressed":case"bounced":return"emailVerify.suppressed";case"email_in_use":return"emailVerify.emailInUse";case"verified_use_support":return"emailVerify.changeVerifiedUseSupport";case"wrong_password":return"emailVerify.wrongPassword";case"bad_email":case"invalid_email":case"same_email":return"emailVerify.invalidEmail";default:return t.status===403?"emailVerify.changeVerifiedUseSupport":t.status===429?"emailVerify.tooMany":t.status===4
210?"emailVerify.expired":"emailVerify.genericError"}}const ga=()=>typeof window<"u"&&window.innerWidth>=640;function ba({open:t,onOpenChange:r,status:s,send:n,confirm:a,change:l,cancelChange:u,autoSendRescue:f}){const{t:i}=A(),g=s.email_verified_at?"verified":s.pending_change_email?"changeCode":s.bounce==="permanent"?"change":"code",[p,m]=o.useState(g),[c,d]=o.useState(""),[N,w]=o.useState(""),[h,v]=o.useState(""),[x,y]=o.useState(!1),[C,S]=o.useState(0),[j,_]=o.useState(null),[D,$]=o.useState(""),[q,V]=o.useState(!1);o.useEffect(()=>{t&&(m(g),d(""),_(null))},[t]),o.useEffect(()=>{t&&s.bounce==="permanent"&&p==="code"&&(m("change"),_({text:i("emailVerify.suppressed"),tone:"error"}))},[t,s.bounce,p,i]),o.useEffect(()=>{!t||q||s.has_sent_challenge||s.email_verified_at||p!=="code"||(V(!0),f().then(I=>{I&&S(ie)}))},[t,q,s.has_sent_challenge,s.email_verified_at,p,f]),o.useEffect(()=>{if(C<=0)return;const I=setInterval(()=>S(H=>H>0?H-1:0),1e3);return()=>clearInterval(I)},[C>0]);const U=o.useMemo(ga,[t]),E=p==="changeCode"?"change":"verify",R=p==="changeCode"?s.pending_change_email??N:s.email??"",b=I=>{const H=ha(I);_({text:i(H,{left:I.attemptsLeft??0}),tone:"error"}),I.error==="cooldown"&&I.retryAfter&&S(I.retryAfter),(I.error==="suppressed"||I.error==="bounced")&&m("change")},O=async()=>{if(!(!/^\d{6}$/.test(c)||x)){y(!0);try{const I=await a(c,E);if(!I.ok){if(I.error==="already_verified"){m("verified");return}if(I.error==="cooldown"){_(null);return}b(I),d("");return}if(E==="change"){$(I.email??R),m("changed");try{await T.auth.refreshSession()}catch{}return}m("verified")}finally{y(!1)}}},L=async()=>{if(!(x||C>0)){y(!0);try{const I=await n();if(I.ok){S(ie),d(""),_({text:i("emailVerify.sent"),tone:"ok"});return}if(I.error==="cooldown"){S(I.retryAfter??ie);return}if(I.error==="already_verified"){m("verified");return}b(I)}finally{y(!1)}}},P=async()=>{const I=N.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)){_({text:i("emailVerify.invalidEmail"),tone:"error"});return}if(!h){_({text:i("emailVerify.changeNeedsPassword"),tone:"error"});return}if(!x){y(!0);try{const H=await l(I,h);if(!H.ok){b(H);return}v(""),d(""),_(null),S(ie),m("changeCode")}finally{y(!1)}}},be=async()=>{if(!x){y(!0);try{await u(),d(""),_(null),m(s.bounce==="permanent"?"change":"code")}finally{y(!1)}}},kt=()=>{try{window.dispatchEvent(new CustomEvent(Ee))}catch{}r(!1)},_t=e.jsx(Ls,{maxLength:6,value:c,onChange:I=>{d(I),(j==null?void 0:j.tone)==="error"&&_(null)},pattern:Ps,inputMode:"numeric",autoComplete:"one-time-code",autoFocus:U,disabled:x,pushPasswordManagerStrategy:"none",containerClassName:"w-full gap-1.5","data-testid":"email-verify-otp",children:e.jsx(Bs,{className:"w-full gap-1.5",children:[0,1,2,3,4,5].map(I=>e.jsx(Vs,{index:I,className:"flex-1 min-w-0 max-w-[52px] h-14 rounded-md border border-input text-[22px] font-semibold tabular-nums"},I))})}),Oe=e.jsx("p",{className:k("min-h-[20px] text-[13px] leading-5",(j==null?void 0:j.tone)==="error"&&"text-destructive",(j==null?void 0:j.tone)==="ok"&&"text-emerald-600",(j==null?void 0:j.tone)==="info"&&"text-muted-foreground"),"aria-live":"polite","data-testid":"email-verify-state",children:(j==null?void 0:j.text)??""}),Me=e.jsx("button",{type:"button",onClick:kt,className:"text-[13px] text-muted-foreground hover:underline","data-testid":"email-verify-support",children:i("emailVerify.support")});return e.jsx(X,{open:t,onOpenChange:r,children:e.jsxs(Z,{className:"max-w-sm p-5 sm:p-6 gap-0 rounded-xl","data-testid":"email-verify-panel",children:[(p==="code"||p==="changeCode")&&e.jsxs(e.Fragment,{children:[e.jsxs(ce,{className:"text-left space-y-2",children:[e.jsxs(W,{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(me,{className:"w-5 h-5 text-primary shrink-0"}),i("emailVerify.panelTitle")]}),e.jsx(de,{className:"text-sm",children:i("emailVerify.panelBody")}),e.jsx("p",{className:"text-lg font-semibold text-foreground break-all leading-snug","data-testid":"email-verify-email",children:R})]}),e.jsx("div",{className:"mt-5",children:_t}),e.jsx("div",{className:"mt-2",children:Oe}),e.jsx(M,{className:"mt-4 w-full h-12 text-base",onClick:O,disabled:x||c.length!==6,"data-testid":"email-verify-confirm",children:x?e.jsx(Q,{className:"w-4 h-4 animate-spin"}):i("emailVerify.confirm")}),e.jsx("div",{className:"mt-3 flex items-center justify-between text-[13px]",children:e.jsx("span",{className:"text-muted-foreground",children:i("emailVerify.whereIsCode")})}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-[13px]",children:[p==="changeCode"?e.jsx("button",{type:"button",onClick:be,disabled:x,className:"text-muted-foreground hover:underline","data-testid":"email-verify-cancel-change",children:i("emailVerify.cancelChange")}):s.bounce==="permanent"?e.jsx("span",{className:"text-destructive",children:i("emailVerify.onlyChange")}):e.jsx("button",{type:"button",onClick:L,disabled:x||C>0,className:"font-semibold text-primary disabled:text-muted-foreground disabled:cursor-default","data-testid":"email-verify-resend",children:C>0?i("emailVerify.resendIn",{seconds:C}):i("emailVerify.resend")}),Me]}),p==="code"&&e.jsx("button",{type:"button",onClick:()=>{_(null),m("change")},className:"mt-3 w-full text-center text-[13px] text-muted-foreground hover:underline","data-testid":"email-verify-not-my-email",children:i("emailVerify.notMyEmail")})]}),p==="change"&&e.jsxs(e.Fragment,{children:[e.jsxs(ce,{className:"text-left space-y-2",children:[e.jsxs(W,{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(me,{className:"w-5 h-5 text-primary shrink-0"}),i("emailVerify.notMyEmail")]}),e.jsx(de,{className:"text-sm",children:s.bounce==="permanent"?i("emailVerify.suppressed"):i("emailVerify.changeNeedsPassword")})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"email-verify-new-email",children:i("emailVerify.newEmailLabel")}),e.jsx(se,{id:"email-verify-new-email",type:"email",inputMode:"email",autoComplete:"email",autoFocus:U,value:N,onChange:I=>w(I.target.value),disabled:x,"data-testid":"email-verify-new-email"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"email-verify-password",children:i("emailVerify.currentPassword")}),e.jsx(se,{id:"email-verify-password",type:"password",autoComplete:"current-password",value:h,onChange:I=>v(I.target.value),onKeyDown:I=>{I.key==="Enter"&&P()},disabled:x,"data-testid":"email-verify-password"})]})]}),e.jsx("div",{className:"mt-2",children:Oe}),e.jsx(M,{className:"mt-2 w-full h-12 text-base",onClick:P,disabled:x||!N.trim()||!h,"data-testid":"email-verify-send-new",children:x?e.jsx(Q,{className:"w-4 h-4 animate-spin"}):i("emailVerify.sendToNew")}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-[13px]",children:[s.bounce==="permanent"?e.jsx("span",{}):e.jsx("button",{type:"button",onClick:()=>{_(null),m("code")},disabled:x,className:"text-muted-foreground hover:underline","data-testid":"email-verify-back",children:i("common.back")}),Me]})]}),(p==="verified"||p==="changed")&&e.jsxs("div",{className:"text-center py-2",children:[e.jsx(qs,{className:"w-10 h-10 text-emerald-500 mx-auto mb-3"}),e.jsx(W,{className:"text-lg font-semibold",children:p==="verified"?i("emailVerify.verified"):i("emailVerify.changed",{email:D})}),e.jsx(M,{className:"mt-5 w-full h-12 text-base",onClick:()=>r(!1),"data-testid":"email-verify-done",children:i("common.done")})]})]})})}const ya=7,va=2,wa=[{key:"scrap_metal_beta_2026_09",since:"2026-09-19T12:00:00Z",audience:t=>t.canEditBusinessLines,hideWhen:t=>t.lines.includes("scrap_metal"),route:"/app/account?tab=company#business-lines",titleKey:"whatsNew.scrapMetalTitle",bodyKey:"whatsNew.scrapMetalBody",ctaKey:"whatsNew.scrapMetalCta"}];function gt(t){return`announcement:${t.key}`}function ja(t,r,s,n=new Date){if(!s.profileCreatedAt)return[];const a=Date.parse(s.profileCreatedAt);if(Number.isNaN(a))return[];const l=n.getTime(),u=(l-a)/864e5;return t.filter(f=>{var g;const i=Date.parse(f.since);return!(Number.isNaN(i)||i>l||u<(f.minAccountAgeDays??ya)||s.ackedKeys.includes(gt(f))||!f.audie
2nce(r)||(g=f.hideWhen)!=null&&g.call(f,r))}).sort((f,i)=>Date.parse(i.since)-Date.parse(f.since)).slice(0,va)}const We=t=>["welcome-state",t];async function Na(){const{data:t,error:r}=await T.rpc("welcome_state_v1");if(r)throw r;return t??null}function ka(){const{user:t}=B(),r=Je(),s=(t==null?void 0:t.userId)??null,n=$s()&&!!t&&t.role!=="platform_admin"&&!t.isImpersonating,a=ee({queryKey:We(s),queryFn:Na,enabled:n,staleTime:5*60*1e3,retry:1}),{lines:l}=fe(),u=ss(),f=o.useMemo(()=>!n||!a.data?[]:ja(wa,{canEditBusinessLines:u,lines:l},{profileCreatedAt:a.data.profile_created_at,ackedKeys:a.data.acked_keys??[]}),[n,a.data,u,l]),i=o.useCallback(async g=>{if(!s||!n)return!1;const p=gt({key:g}),m=We(s);r.setQueryData(m,d=>{var N;return d&&!((N=d.acked_keys)!=null&&N.includes(p))?{...d,acked_keys:[...d.acked_keys??[],p]}:d});let c=!1;try{const{error:d}=await T.from("user_acknowledgements").insert({user_id:s,key:p}).select().single();c=!d||d.code==="23505"}catch{c=!1}return r.invalidateQueries({queryKey:m}),c},[s,n,r]);return{announcements:f,dismiss:i}}function _a({open:t,onOpenChange:r}){const{t:s}=A(),{user:n}=B(),a=K(),[l,u]=o.useState(0),[f,i]=o.useState("new"),[g,p]=o.use
2State(!1),m=o.useCallback(async()=>{if(!(n!=null&&n.companyId))return;p(!0);const{count:N}=await T.from("support_tickets").select("id",{count:"exact",head:!0}).eq("company_id",n.companyId).is("deleted_at",null).in("status",["open","in_progress"]);u(N??0),p(!1)},[n==null?void 0:n.companyId]);o.useEffect(()=>{t&&m()},[t,m]);const c=()=>{r(!1),a("/app/account?tab=support")},d=({icon:N,title:w,desc:h})=>e.jsxs("div",{className:"rounded-xl border border-border bg-muted/20 p-6 flex flex-col items-center text-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(N,{className:"w-6 h-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:h})]}),e.jsxs(M,{size:"sm",className:"rounded-lg mt-1",onClick:c,children:[s("support.openSupportCenter"),e.jsx(Ae,{className:"w-3.5 h-3.5 ml-1"})]})]});return e.jsx(X,{open:t,onOpenChange:r,children:e.jsxs(Z,{className:"max-w-[800px] w-[95vw] max-h-[90vh] p-0 gap-0 overflow-hidden",children:[e.jsx(ce,{className:"p-6 pb-4 border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(rt,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(W,{className:"text-lg font-semibold",children:s("support.title")}),e.jsx(de,{className:"text-sm text-muted-foreground",children:s("support.subtitle")})]})]})}),e.jsx("div",{className:"p-6 pt-4",children:e.jsxs(Hs,{value:f,onValueChange:i,children:[e.jsxs(Gs,{className:"mb-4 w-full sm:w-auto",children:[e.jsx(ve,{value:"new",children:s("support.newTicket")}),e.jsxs(ve,{value:"tickets",className:"gap-1.5",children:[s("support.myTickets"),l>0&&e.jsx("span",{className:"ml-1 text-[10px] font-semibold bg-destructive text-destructive-foreground rounded-full w-4.5 h-4.5 flex items-center justify-center px-px",children:l})]}),e.jsx(ve,{value:"kb",children:s("support.knowledgeBase")})]}),e.jsx(we,{value:"new",className:"mt-0",children:e.jsx(d,{icon:Ys,title:s("support.newTicketShortcutTitle"),desc:s("support.newTicketShortcutDesc")})}),e.jsx(we,{value:"tickets",className:"mt-0",children:g?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(Q,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):e.jsx(d,{icon:Js,title:s("support.myTicketsShortcutTitle"),desc:s("support.myTicketsShortcutDesc")})}),e.jsx(we,{value:"kb",className:"mt-0",children:e.jsx(Qs,{})})]})})]})})}function Sa({className:t}){const{t:r}=A(),s=K(),{user:n}=B(),a=er(),l=sr(n==null?void 0:n.roles),u=a&&l,f=tr(u);return!u||f===0?null:e.jsxs("button",{type:"button",onClick:()=>s("/app/shop/checkout?step=review"),title:r("nav.cart"),"aria-label":`${r("nav.cart")}: ${f}`,className:k("relative flex items-center justify-center w-9 h-9 rounded-lg text-muted-foreground","hover:bg-muted hover:text-foreground transition-colors",t),children:[e.jsx(_e,{className:"w-4 h-4"}),e.jsx("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full bg-primary text-primary-foreground text-[10px] font-bold flex items-center justify-center tabular-nums",children:f>9?"9+":f})]})}const le={danger:{bg:"bg-destructive/8",border:"border-destructive/20",icon:"text-destructive",Icon:lt},warning:{bg:"bg-warning/8",border:"border-warning/20",icon:"text-warning",Icon:Y},info:{bg:"bg-primary/[0.08]",border:"border-primary/20",icon:"text-primary",Icon:ot}};function Ca({alert:t,onNavigate:r}){const{t:s}=A(),n=le[t.type],a=n.Icon;return e.jsx("button",{onClick:()=>t.route&&r(t.route),className:k("w-full text-left p-3 rounded-lg border transition-colors hover:opacity-80",n.bg,n.border,t.route&&"cursor-pointer"),children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(a,{className:k("w-3.5 h-3.5 mt-0.5 flex-shrink-0",n.icon)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-foreground leading-tight",children:Os(t,s)}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate",children:Ms(t,s)})]})]})})}function Ia({item:t,onNavigate:r,onDismiss:s,dismissLabel:n,t:a}){return e.jsx("div",{className:"rounded-lg border border-primary/20 bg-primary/[0.08] p-3","data-testid":`whats-new-${t.key}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-semibold text-foreground leading-tight",children:a(t.titleKey)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:a(t.bodyKey)}),e.jsx("button",{type:"button",onClick:()=>r(t.route),className:"mt-1.5 text-xs font-semibold text-primary hover:underline",children:a(t.ctaKey)})]}),e.jsx("button",{type:"button","aria-label":n,title:n,onClick:()=>s(t.key),className:"w-6 h-6 -mr-1 -mt-1 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",children:e.jsx(pe,{className:"w-3.5 h-3.5"})})]})})}const Ea=te.isNativePlatform();function Ta({onOpenTresha:t,onOpenOnboarding:r,adminGlobal:s=!1,quietOnboardingDot:n=!1}){const{user:a,logout:l}=B(),[u,f]=o.useState(!1),{driverId:i}=ys(),g=!!i&&!(a!=null&&a.isImpersonating),[p,m]=o.useState(!1),c=K(),{t:d}=A(),[N,w]=o.useState(""),[h,v]=o.useState(null),[x,y]=o.useState(!1),{data:C}=Ts(!s),S=(C==null?void 0:C.alerts)??[],{unreadCount:j}=Rs(),{needsVerification:_}=st();o.useEffect(()=>{if(s)return;const b=()=>c("/app/account?tab=support");return window.addEventListener(Ee,b),()=>window.removeEventListener(Ee,b)},[s,c]);const{announcements:D,dismiss:$}=ka();o.useEffect(()=>{s||!(a!=null&&a.companyId)||T.from("companies").select("name, country").eq("id",a.companyId).maybeSingle().then(({data:b})=>{b!=null&&b.name&&w(b.name),b&&v(Zs(b.country))})},[s,a==null?void 0:a.companyId]);const q=S.filter(b=>b.type==="danger").length,V=S.length,U=[{label:d("header.myProfile"),icon:qe,tab:"profile"},{label:d("header.companyProfile"),icon:rr,tab:"company"},{label:d("header.billingAndPlan"),icon:ar,tab:"billing"},{label:d("header.stripeConnection"),icon:nr,tab:"stripe"},{label:d("header.dumpsterHubMarketplace"),icon:ir,tab:"marketplace"},{label:d("header.security"),icon:et,tab:"security"},{label:d("header.referrals"),icon:or,tab:"referrals"},{label:d("header.supportCenter"),icon:lr,tab:"support"}],E=b=>c(`/app/account?tab=${b}`),R=b=>{c(b)};return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"h-14 border-b border-border bg-card flex items-center justify-between px-4 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ut,{className:"lg:hidden"}),!s&&h&&e.jsx("span",{className:"hidden sm:inline-flex",children:e.jsx(Xs,{country:h})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Sa,{}),e.jsxs(M,{variant:"ghost",size:"icon",onClick:()=>{const b=document.documentElement,O=b.classList.contains("dark");b.classList.toggle("dark",!O),localStorage.setItem("theme",O?"light":"dark")},title:"Toggle dark mode",children:[e.jsx(cr,{className:"w-4.5 h-4.5 hidden dark:block"}),e.jsx(dr,{className:"w-4.5 h-4.5 block dark:hidden"})]}),!Ea&&e.jsxs(Ve,{children:[e.jsx(Fe,{asChild:!0,children:e.jsx(M,{variant:"ghost",size:"icon",title:"Download App",className:"hidden sm:inline-flex",children:e.jsx(at,{className:"w-4.5 h-4.5"})})}),e.jsx(Ke,{align:"end",className:"w-auto p-4 rounded-xl",children:e.jsx(bs,{})})]}),e.jsxs(M,{variant:"ghost",size:"icon",className:"relative",onClick:t,title:"Tresha AI",children:[e.jsx(nt,{className:"w-4.5 h-4.5"}),e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 bg-primary rounded-full"})]}),r&&e.jsxs(M,{variant:"ghost",size:"icon",onClick:()=>{f(!0),r()},title:"Setup Guide",className:"relative",children:[e.jsx(it,{className:"w-4.5 h-4.5 text-primary"}),(!n||!u)&&e.jsx("span",{className:k("absolute top-1.5 right-1.5 w-2 h-2 bg-primary rounded-full",!n&&"animate-pulse")})]}),!s&&e.jsxs(Ve,{children:[e.jsx(Fe,{asChild:!0,children:e.jsxs(M,{variant:"ghost",size:"icon",className:"relative",children:[e.jsx($e,{className:"w-4.5 h-4.5"}),V>0&&e.jsx("span",{className:k("absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] flex items-center justify-center rounded-full text-[10px] font-bold text-white px-1",q>0?"bg-destructive animate-pulse":"bg-warning"),children:V}),V===0&&(D.length>0||_)&&e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 bg-primary rounded-full","data-testid":D.length>0?"whats-new-dot":"bell-info-dot"})]})}),e.jsxs(Ke,{align:"end",className:"w-80 p-0 rounded-xl",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-destructive"}),e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:d("header.alerts")})]}),V>0&&e.jsxs("span",{className:k("text-[10px] font-bold px-2 py-0.5 rounded-full",q>0?"bg-destructive/10 text-destructive":"bg-warning/10 text-warning"),children:[V," ",d("header.active")]})]}),e.jsxs("div",{className:"max-h-80 overflow-y-auto p-3 space-y-2",children:[D.length>0&&e.jsxs("div",{className:k("space-y-2",(S.length>0||_)&&"pb-2 border-b border-border/60"),"data-testid":"whats-new",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx("p",{className:"text-xs font-semibold text-foreground",children:d("whatsNew.title")}),e.jsx("span",{className:"w-2 h-2 bg-primary rounded-full"})]}),D.map(b=>e.jsx(Ia,{item:b,onNavigate:R,onDismiss:O=>{$(O)}
2,dismissLabel:d("whatsNew.dismiss"),t:d},b.key))]}),_&&e.jsx("button",{onClick:As,className:k("w-full text-left p-3 rounded-lg border transition-colors hover:opacity-80 cursor-pointer",le.info.bg,le.info.border),"data-testid":"bell-verify-email",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ot,{className:k("w-3.5 h-3.5 mt-0.5 flex-shrink-0",le.info.icon)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-foreground leading-tight",children:d("alerts.verifyEmailTitle")}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate",children:d("alerts.verifyEmailDesc")})]})]})}),S.length===0&&D.length===0&&!_?e.jsxs("div",{className:"text-center py-8",children:[e.jsx($e,{className:"w-8 h-8 text-muted-foreground/30 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d("header.allClear")}),e.jsx("p",{className:"text-xs text-muted-foreground/60",children:d("header.noAlertsNow")})]}):S.map(b=>e.jsx(Ca,{alert:b,onNavigate:R},b.id))]})]})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsxs(M,{variant:"ghost",size:"icon",onClick:()=>y(!0),title:d("nav.support"),className:"relative",children:[e.jsx(rt,{className:"w-4.5 h-4.5"}),j>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 min-w-4 h-4 px-0.5 rounded-full bg-destructive text-destructive-foreground text-[9px] font-bold flex items-center justify-center",children:j>9?"9+":j})]}),e.jsx(M,{variant:"ghost",size:"icon",onClick:()=>c("/app/account?tab=profile"),children:e.jsx(oe,{className:"w-4.5 h-4.5"})})]}),e.jsxs(zs,{children:[e.jsx(Us,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-2 ml-2 hover:opacity-80 transition-opacity outline-none",children:[e.jsxs("div",{className:"text-right hidden sm:block",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:a==null?void 0:a.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a==null?void 0:a.role})]}),e.jsxs(Le,{className:"w-8 h-8",children:[(a==null?void 0:a.avatarUrl)&&e.jsx(Pe,{src:a.avatarUrl,alt:a==null?void 0:a.name,className:"object-cover"}),e.jsx(Be,{className:"bg-primary text-primary-foreground text-xs font-semibold",children:a==null?void 0:a.avatar})]})]})}),e.jsxs(Ws,{align:"end",className:"w-72 p-0 rounded-xl",children:[e.jsx("div",{className:"px-4 py-3.5 border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Le,{className:"w-10 h-10",children:[(a==null?void 0:a.avatarUrl)&&e.jsx(Pe,{src:a.avatarUrl,alt:a==null?void 0:a.name,className:"object-cover"}),e.jsx(Be,{className:"bg-primary text-primary-foreground text-sm font-semibold",children:a==null?void 0:a.avatar})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:a==null?void 0:a.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s?a==null?void 0:a.email:N||"..."}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[e.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-primary/10 text-primary",children:a==null?void 0:a.role}),!s&&e.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700",children:d("header.standardPlan")})]})]})]})}),s&&e.jsxs("div",{className:"py-1.5",children:[e.jsxs(ne,{onClick:()=>c("/app/admin-global/profile"),className:"px-4 py-2.5 cursor-pointer",children:[e.jsx(qe,{className:"w-4 h-4 mr-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:d("adminProfile.menuItem")}),e.jsx(G,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground/40"})]}),e.jsx(ye,{})]}),!s&&g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-1.5",children:e.jsxs(ne,{onClick:()=>m(!0),className:"px-4 min-h-[48px] cursor-pointer","data-testid":"header-switch-to-driver",children:[e.jsx(xe,{className:"w-5 h-5 mr-2.5 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:d("driverMode.switchToDriver")}
2),e.jsx(G,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground/40"})]})}),e.jsx(ye,{})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-1.5",children:U.map(b=>e.jsxs(ne,{onClick:()=>E(b.tab),className:"px-4 py-2.5 cursor-pointer",children:[e.jsx(b.icon,{className:"w-4 h-4 mr-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:b.label}),e.jsx(G,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground/40"})]},b.tab))}),e.jsx(ye,{})]}),e.jsx("div",{className:"py-1.5",children:e.jsxs(ne,{onClick:l,className:"px-4 py-2.5 cursor-pointer text-destructive focus:text-destructive",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2.5"}),e.jsx("span",{className:"text-sm",children:d("header.signOut")})]})})]})]})]}),g&&e.jsx(xa,{open:p,onOpenChange:m})]}),e.jsx(_a,{open:x,onOpenChange:y})]})}function Aa(t){if(t<=0)return"00:00";const r=Math.floor(t/1e3),s=Math.floor(r/60),n=r%60;return`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Oa(){const{data:t,isSuccess:r}=fr(),s=xr(),n=K(),{t:a}=A(),[l,u]=o.useState(null),f=t!=null&&t.expires_at?new Date(t.expires_at).getTime():null;o.useEffect(()=>{if(!f){u(null);return}const p=()=>{const c=f-Date.now();u(Math.max(0,c))};p();const m=setInterval(p,1e3);return()=>clearInterval(m)},[f]);const i=o.useCallback(()=>{t!=null&&t.id&&s.mutate(t.id)},[t==null?void 0:t.id,s]);if(o.useEffect(()=>{l!==null&&l<=0&&(t!=null&&t.id)&&i()},[l,t==null?void 0:t.id,i]),o.useEffect(()=>{r&&t===null&&localStorage.getItem("impersonation_session_id")&&localStorage.removeItem("impersonation_session_id")},[r,t]),!t)return null;const g=l!==null&&l<5*60*1e3;return e.jsxs("div",{className:`sticky top-0 z-50 flex items-center gap-3 px-4 py-2.5 text-sm ${g?"bg-destructive text-destructive-foreground":"bg-amber-500 text-amber-950"}`,children:[e.jsx(Y,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{className:"font-semibold",children:a("impersonation.impersonating")}),e.jsx("span",{className:"truncate",children:t.target_company_name}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[e.jsx(Ze,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"font-mono text-xs font-bold tabular-nums",children:l!==null?Aa(l):"--:--"})]}),e.jsxs(M,{variant:"outline",size:"sm",className:`h-7 text-xs shrink-0 ${g?"border-destructive-foreground/40 text-destructive-foreground hover:bg-destructive-foreground/10":"border-amber-950/30 text-amber-950 hover:bg-amber-600"}`,onClick:()=>n("/app/dashboard"),children:[e.jsx(hr,{className:"w-3 h-3 mr-1"}),a("impersonation.accessPanel")]}),e.jsxs(M,{variant:"outline",size:"sm",className:`h-7 text-xs shrink-0 ${g?"border-destructive-foreground/40 text-destructive-foreground hover:bg-destructive-foreground/10":"border-amber-950/30 text-amber-950 hover:bg-amber-600"}`,onClick:()=>t.id&&s.mutate(t.id),disabled:s.isPending,children:[e.jsx(pe,{className:"w-3 h-3 mr-1"}),a("impersonation.endSession")]})]})}function Ma(){const{user:t}=B(),r=t==null?void 0:t.companyId,{toast:s}=Rt(),n=K(),a=o.useRef(new Set),l=o.useRef(!0),[u,f]=o.useState([]),{t:i}=A(),g=o.useRef(new Set),p=o.useRef(!0),{data:m}=ee({queryKey:["global-new-order-check",r],queryFn:async()=>{const{data:h,error:v}=await T.from("orders").select("id, order_number").eq("company_id",r).eq("status","waiting_delivery").eq("source","online_booking").is("deleted_at",null).is("canceled_at",null);if(v)throw v;return h??[]},enabled:!!r,refetchInterval:15e3,refetchOnWindowFocus:!1}),{data:c}=ee({queryKey:["global-new-junk-check",r],queryFn:async()=>{const h=new Date(Date.now()-1728e5).toISOString(),{data:v,error:x}=await T.from("junk_jobs").select("id, job_number").eq("company_id",r).eq("source","online_junk_checkout").gte("created_at",h).is("deleted_at",null).is("canceled_at",null);if(x)throw x;return v??[]},enabled:!!r,refetchInterval:15e3,refetchOnWindowFocus:!1});o.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]);const d=o.useCallback(()=>{try{const h=new(window.AudioContext||window.webkitAudioContext),v=x=>{const y=h.createOscillator(),C=h.createGain();y.connect(C),C.connect(h.destination),y.type="sine",y.frequency.setValueAtTime(880,x),y.frequency.setValueAtTime(1100,x+.1),y.frequency.setValueAtTime(1320,x+.2),C.gain.setValueAtTime(.25,x),C.gain.exponentialRampToValueAtTime(.001,x+.45),y.start(x),y.stop(x+.45)};v(h.currentTime),v(h.currentTime+.6),v(h.currentTime+1.2)}catch{}},[]),N=o.useCallback(h=>{if(!(!("Notification"in window)||Notification.permission!=="granted"))try{const v=h.map(C=>`#${C.order_number}`).join(", "),x=h.length===1?"ð New Online Booking!":`ð ${h.length} New Online Bookings!`,y=new Notification(x,{body:`Order${h.length>
21?"s":""} ${v} waiting for delivery`,icon:"/favicon.ico",tag:"new-order",requireInteraction:!0});y.onclick=()=>{window.focus(),n("/app/operations?tab=delivery"),y.close()}}catch{}},[n]);o.useEffect(()=>{if(!m)return;const h=new Set(m.map(x=>x.id));if(l.current){a.current=h,l.current=!1;return}const v=m.filter(x=>!a.current.has(x.id));if(v.length>0){d(),N(v);const x=v.map(y=>`#${y.order_number}`).join(", ");s({title:`ð ${v.length===1?"New order received!":`${v.length} new orders received!`}`,description:`Order${v.length>1?"s":""} ${x} ${v.length===1?"is":"are"} waiting for delivery.`,action:e.jsx("button",{className:"text-xs font-semibold text-primary hover:underline whitespace-nowrap",onClick:()=>n("/app/operations?tab=delivery"),children:"View now â"})}),f(y=>[...y,...v]),v.forEach(y=>a.current.add(y.id))}a.current.forEach(x=>{h.has(x)||a.current.delete(x)})},[m,d,N,s,n]),o.useEffect(()=>{if(!c)return;const h=new Set(c.map(x=>x.id));if(p.current){g.current=h,p.current=!1;return}const v=c.filter(x=>!g.current.has(x.id));if(v.length>0){d();const x=v.map(S=>`#${S.job_number}`).join(", "),y=v.length===1?i("junkNotifier.titleOne"):i("junkNotifier.titleMany",{count:v.length}),C=i("junkNotifier.description",{numbers:x});if("Notification"in window&&Notification.permission==="granted")try{const S=new Notification(y,{body:C,icon:"/favicon.ico",tag:"new-junk-job",requireInteraction:!0});S.onclick=()=>{window.focus(),n("/app/junk-removal"),S.close()}}catch{}s({title:y,description:C,action:e.jsx("button",{className:"text-xs font-semibold text-primary hover:underline whitespace-nowrap",onClick:()=>n("/app/junk-removal"),children:i("junkNotifier.viewNow")})}),v.forEach(S=>g.current.add(S.id))}g.current.forEach(x=>{h.has(x)||g.current.delete(x)})},[c,d,s,n,i]);const w=o.useCallback(()=>{f([])},[]);return{unacknowledgedOrders:u,acknowledgeOrders:w}}const He=3e4,Da=12;function Ra(t=!0){var m;const{t:r,i18n:s}=A(),{user:n}=B(),a=(n==null?void 0:n.companyId)??null,l=t&&!!((m=n==null?void 0:n.roles)!=null&&m.some(c=>c==="admin"||c==="owner"||c==="dispatcher"||c==="supervisor")),u=o.useRef(new Set),f=o.useRef(!0),[i,g]=o.useState(!1);o.useEffect(()=>{if(!l)return;const c=()=>{br(),g(!0)};return window.addEventListener("pointerdown",c,{passive:!0,once:!0}),window.addEventListener("keydown",c,{once:!0}),()=>{window.removeEventListener("pointerdown",c),window.removeEventListener("keydown",c)}},[l]);const{data:p}=ee({queryKey:["claimed-tasks-notifier",a],enabled:!!a&&l,refetchInterval:He,staleTime:He,queryFn:async()=>{const c=new Date(Date.now()-Da*36e5).toISOString(),{data:d,error:N}=await T.from("dispatch_tasks").select("id, task_type, task_date, claimed_by_driver_at, released_by_driver_at, drivers(full_name), orders!dispatch_tasks_order_id_fkey(order_number)").eq("company_id",a).is("deleted_at",null).gte("claimed_by_driver_at",c).order("claimed_by_driver_at",{ascending:!1}).limit(20);if(N)throw N;return(d??[]).map(w=>{var v,x;const h=w;return{id:h.id,task_type:h.task_type,task_date:h.task_date,claimed_by_driver_at:h.claimed_by_driver_at,driver_name:((v=h.drivers)==null?void 0:v.full_name)??null,order_number:((x=h.orders)==null?void 0:x.order_number)??null}})}});o.useEffect(()=>{if(!p)return;const c=p.filter(d=>!u.current.has(d.id));if(c.forEach(d=>u.current.add(d.id)),u.current.size>200&&(u.current=new Set([...u.current].slice(-100))),f.current){f.current=!1;return}c.length!==0&&(i&&gr(!1),c.slice(0,3).forEach(d=>{const N={delivery:"driverApp.taskTypeDelivery",pickup:"driverApp.taskTypePickup",landfill:"driverApp.taskTypeLandfill",junk_removal:"driverApp.taskTypeJunk",special:"driverApp.taskTypeSpecial"};F.message(r("dispatch.claimedByDriver",{driver:d.driver_name??r("driverApp.companyTasks.unassigned"),type:d.task_type&&N[d.task_type]?r(N[d.task_type]).toLowerCase():d.task_type??"",order:d.order_number?`#${d.order_number}`:""}),{description:d.task_date?new Date(`${d.task_date}T12:00:00`).toLocaleDateString(s.language):void 0,duration:8e3})}))},[p,i,r,s.language])}function La(){return null}function Ge(t){return Math.max(0,(t.net_weight_tons??0)-(t.max_weight_tons??0))}function Qe(t,r){t(`/app/rental-history?order=${encodeURIComponent(r.order_number)}&action=overweight`)}function Pa(){const{data:t,waiveOverweight:r}
2=Xt(),s=K(),[n,a]=o.useState(!1),[l,u]=o.useState(new Set),[f,i]=o.useState(!1),g=async c=>{if(!l.has(c.id)&&window.confirm(`Waive the overweight charge on #${c.order_number}? The customer won't be charged.`)){u(d=>new Set(d).add(c.id));try{await r(c.id),F.success(`#${c.order_number} waived`)}catch(d){F.error((d==null?void 0:d.message)??"Could not waive")}finally{u(d=>{const N=new Set(d);return N.delete(c.id),N})}}},p=async c=>{if(f||!window.confirm(`Waive the overweight charge on all ${c.length} orders? None of these customers will be charged.`))return;i(!0);let d=0;for(const N of c)try{await r(N.id),d++}catch{}i(!1),F.success(`${d} ${d===1?"order":"orders"} waived`)};if(!t||t.length===0)return null;const m=t.length;if(m===1){const c=t[0],d=Ge(c);return e.jsxs("button",{onClick:()=>Qe(s,c),className:k("w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors","bg-[hsl(var(--warning))]/10 border-b border-[hsl(var(--warning))]/20","hover:bg-[hsl(var(--warning))]/15"),children:[e.jsx(Y,{className:"w-3.5 h-3.5 text-[hsl(var(--warning))] shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 leading-tight",children:[e.jsxs("p",{className:"text-xs text-foreground truncate",children:[e.jsxs("span",{className:"font-medium",children:["#",c.order_number]}),c.customer_name&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.customer_name]}),c.delivery_address_line1&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.delivery_address_line1]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Over by ",e.jsxs("span",{className:"font-medium text-[hsl(var(--warning))]",children:[d.toFixed(2)," ton"]})]})]}),e.jsx(G,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"})]})}return e.jsxs("div",{className:"bg-[hsl(var(--warning))]/10 border-b border-[hsl(var(--warning))]/20",children:[e.jsxs("div",{className:"w-full flex items-center gap-1 px-3 py-1.5",children:[e.jsxs("button",{onClick:()=>a(c=>!c),className:"flex-1 flex items-center gap-2 text-left min-w-0",children:[e.jsx(Y,{className:"w-3.5 h-3.5 text-[hsl(var(--warning))] shrink-0"}),e.jsxs("p",{className:"flex-1 text-xs font-medium text-foreground truncate",children:[m," overweight pending"]}),e.jsx(_r,{className:k("w-3.5 h-3.5 text-muted-foreground shrink-0 transition-transform",n&&"rotate-180")})]}),e.jsxs("button",{onClick:()=>p(t),disabled:f,className:"shrink-0 inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-semibold text-[hsl(var(--warning))] hover:bg-[hsl(var(--warning))]/15 disabled:opacity-50",children:[f?e.jsx(Q,{className:"w-3 h-3 animate-spin"}):e.jsx(Sr,{className:"w-3 h-3"}),"Waive all"]})]}),n&&e.jsx("ul",{className:"border-t border-[hsl(var(--warning))]/20 divide-y divide-[hsl(var(--warning))]/15",children:t.map(c=>{const d=Ge(c),N=l.has(c.id);return e.jsxs("li",{className:"flex items-center",children:[e.jsxs("button",{onClick:()=>Qe(s,c),className:"flex-1 min-w-0 flex items-center gap-2 px-3 py-1.5 text-left hover:bg-[hsl(var(--warning))]/10 transition-colors",children:[e.jsxs("div",{className:"flex-1 min-w-0 leading-tight",children:[e.jsxs("p",{className:"text-xs text-foreground truncate",children:[e.jsxs("span",{className:"font-medium",children:["#",c.order_number]}),c.customer_name&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.customer_name]}),c.delivery_address_line1&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.delivery_address_line1]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Over by ",e.jsxs("span",{className:"font-medium text-[hsl(var(--warning))]",children:[d.toFixed(2)," ton"]})]})]}),e.jsx(G,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"})]}),e.jsx("button",{onClick:()=>g(c),disabled:N,className:"shrink-0 px-3 py-1.5 text-[11px] font-semibold text-[hsl(var(--warning))] hover:bg-[hsl(var(--warning))]/15 disabled:opacity-50 inline-flex items-center gap-1",children:N?e.jsx(Q,{className:"w-3 h-3 animate-spin"}):"Waive"})]},c.id)})})]})}function Ba({orders:t,onDismiss:r}){const s=K();if(t.length===0)return null;const n=t.map(a=>`#${a.order_number}`).join(", ");return e.jsxs("div",{className:k("relative mx-4 mt-3 rounded-xl border-2 border-primary/30 bg-primary/5","p-4 flex items-center gap-4 animate-in slide-in-from-top-2 duration-300","shadow-lg shadow-primary/10"),children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"}),e.jsx("div",{className:"relative w-10 h-10 rounded-full bg-primary flex items-center justify-center",children:e.jsx(Cr,{className:"w-5 h-5 text-primary-foreground"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-bold text-foreground",children:["ð ",t.length===1?"New online booking received!":`${t.length} new online bookings received!`]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:["Order",t.length>
21?"s":""," ",n," â waiting for delivery assignment"]})]}),e.jsxs("button",{onClick:()=>{s("/app/operations?tab=delivery"),r()},className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 transition-colors",children:["View ",e.jsx(Ae,{className:"w-3.5 h-3.5"})]}),e.jsx("button",{onClick:r,className:"absolute top-2 right-2 p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",children:e.jsx(pe,{className:"w-3.5 h-3.5"})})]})}function Va({open:t,onClose:r,onComplete:s,userName:n}){var j;const[a,l]=o.useState(0),[u,f]=o.useState(!1),[i,g]=o.useState(!1),p=K(),{user:m}=B(),{t:c}=A(),{lines:d}=fe(),N=d.includes("dumpster_rental"),w=[{id:"welcome",label:c("onboarding.stepWelcome")},{id:"settings",label:c("onboarding.stepSettings")},...N?[{id:"inventory",label:c("onboarding.stepInventory")}]:[],{id:"orders",label:c("onboarding.stepOrders")},{id:"online",label:c("onboarding.stepGoOnline")}],h=(j=w[Math.min(a,w.length-1)])==null?void 0:j.id,v=(n==null?void 0:n.split(" ")[0])||"there",x=()=>{m!=null&&m.companyId&&T.from("companies").update({onboarding_completed:!0}).eq("id",m.companyId).then(),localStorage.setItem("dc_onboarding_completed","true"),s()},y=()=>{if(f(!0),i)x();else{const _=parseInt(localStorage.getItem("dc_onboarding_view_count")||"0",10);localStorage.setItem("dc_onboarding_view_count",String(_+1))}setTimeout(()=>{f(!1),r()},300)},C=()=>{a<w.length-1?l(_=>_+1):(ue({particleCount:150,spread:80,origin:{y:.6}}),setTimeout(()=>ue({particleCount:80,spread:100,origin:{y:.5}}),250),x(),f(!0),setTimeout(()=>{f(!1),l(0),r()},300))},S=_=>{r(),p(_)};return e.jsx(X,{open:t,onOpenChange:()=>y(),children:e.jsxs(Z,{className:k("sm:max-w-[520px] p-0 gap-0 overflow-hidden border-border/50 shadow-2xl","bg-gradient-to-b from-card to-card/95",u&&"animate-out fade-out-0 zoom-out-95"),children:[e.jsx(W,{className:"sr-only",children:"Getting Started"}),e.jsx("div",{className:"flex items-center justify-center gap-1.5 pt-6 pb-2",children:w.map((_,D)=>e.jsx("button",{onClick:()=>l(D),className:k("h-1.5 rounded-full transition-all duration-500",D===a?"w-8 bg-primary":D<a?"w-1.5 bg-primary/40":"w-1.5 bg-muted-foreground/20")},_.id))}),e.jsxs("div",{className:"px-8 pb-8 pt-4 min-h-[380px] flex flex-col",children:[h==="welcome"&&e.jsx(Fa,{firstName:v}),h==="settings"&&e.jsx(Ka,{onNavigate:S}),h==="inventory"&&e.jsx(qa,{onNavigate:S}),h==="orders"&&e.jsx($a,{onNavigate:S}),h==="online"&&e.jsx(za,{onNavigate:S}),e.jsxs("div",{className:"flex items-center justify-between mt-auto pt-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:a>0&&e.jsx("button",{onClick:()=>l(_=>_-1),className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:c("onboarding.back")})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[e.jsx(tt,{checked:i,onCheckedChange:_=>g(_===!0),className:"h-3.5 w-3.5"}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:c("onboarding.dontShowAgain")})]}),a>0&&a<w.length-1&&e.jsx("button",{onClick:y,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:c("onboarding.skipTour")}),e.jsx(M,{onClick:C,className:k("gap-2 rounded-full px-6 h-10 font-medium shadow-lg","bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary","transition-all duration-300"),children:a===w.length-1?e.jsxs(e.Fragment,{children:[c("onboarding.letsGo")," ",e.jsx(it,{className:"w-4 h-4"})]}):a===0?e.jsxs(e.Fragment,{children:[c("onboarding.getStarted")," ",e.jsx(Ae,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:[c("onboarding.next")," ",e.jsx(G,{className:"w-4 h-4"})]})})]})]})]})]})})}function Fa({firstName:t}){const{t:r}=A();return e.jsxs("div",{className:"flex flex-col items-center text-center flex-1 justify-center",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-gradient-to-br from-primary/15 to-primary/5 flex items-center justify-center border border-primary/10",children:e.jsx(nt,{className:"w-9 h-9 text-primary"})}),e.jsx("div",{className:"absolute -bottom-1 -right-1 w-7 h-7 rounded-full bg-primary flex items-center justify-center shadow-lg shadow-primary/30",children:e.jsx(Ir,{className:"w-3.5 h-3.5 text-primary-foreground fill-current"})})]}),e.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground mb-2",children:r("onboarding.welcomeTitle",{name:t})}),e.jsx("p",{className:"text-muted-foreground text-[15px] leading-relaxed max-w-sm mb-4",children:r("onboarding.welcomeBody").split("<1>").map((s,n)=>{if(n===0)return s;const[a,l]=s.split("</1>");return e.jsxs("span",{children:[e.jsx("span",{className:"text-foreground font-medium",children:a}),l]},n)})}),e.jsx("div",{className:"bg-muted/50 rounded-xl p-4 border border-border/50 max-w-sm",children:e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r("onboarding.welcomeNote").split("<1>").map((s,n)=>{if(n===0)return s;const[a,l]=s.split("</1>");return e.jsxs("span",{children:[e.jsx("span",{className:"text-foreground font-medium",children:a}),l]},n)})})})]})}function Ka({onNavigate:t}){const{t:r}=A();return e.jsxs("div",{className:"flex flex-col flex-1",children:[e.jsx(ge,{icon:oe,title:r("onboarding.settingsTitle"),subtitle:r("onboarding.settingsSubtitle")}),e.jsxs("div",{className:"space-y-3 mt-6 flex-1",children:[e.jsx(J,{icon:oe,title:r("onboarding.companySettings"),description:r("onboarding.companySettingsDesc"),onClick:()=>t("/app/account?tab=profile")}),e.jsx(J,{icon:oe,title:r("onboarding.bankPayments"),description:r("onboarding.bankPaymentsDesc"),onClick:()=>t("/app/account?tab=stripe")})]})]})}function qa({onNavigate:t}){const{t:r}=A();return e.jsxs("div",{className:"flex flex-col flex-1",children:[e.jsx(ge,{icon:Se,title:r("onboarding.inventoryTitle"),subtitle:r("onboarding.inventorySubtitle")}),e.jsx("div",{className:"space-y-3 mt-6 flex-1",children:e.jsx(J,{icon:Se,title:r("onboarding.inventoryAction"),description:r("onboarding.inventoryDesc"),onClick:()=>t("/app/inventory")})}),e.jsx("div",{className:"bg-primary/5 rounded-xl p-4 border border-primary/10 mt-4",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"text-foreground font-medium",children:r("onboarding.proTip")})," ",r("onboarding.inventoryProTip")]})})]})}function $a({onNavigate:t}){const{t:r}=A();return e.jsxs("div",{className:"flex flex-col flex-1",children:[e.jsx(ge,{icon:_e,title:r("onboarding.ordersTitle"),subtitle:r("onboarding.ordersSubtitle")}),e.jsx("div",{className:"space-y-3 mt-6 flex-1",children:e.jsx(J,{icon:_e,title:r("onboarding.newOrder"),description:r("onboarding.newOrderDesc"),onClick:()=>t("/app/new-order")})})]})}function za({onNavigate:t}){const{t:r}=A(),s=Xe();return e.jsxs("div",{className:"flex flex-col flex-1",children:[e.jsx(ge,{icon:ke,title:r("onboarding.goOnlineTitle"),subtitle:r("onboarding.goOnlineSubt
2itle")}),e.jsxs("div",{className:"space-y-3 mt-6 flex-1",children:[e.jsx(J,{icon:ke,title:r("onboarding.onlineBooking"),description:r("onboarding.onlineBookingDesc"),onClick:()=>t("/app/booking")}),s==="full"&&e.jsx(J,{icon:Wt,title:r("onboarding.createWebsite"),description:r("onboarding.createWebsiteDesc"),onClick:()=>t("/app/website-builder"),highlight:!0})]}),e.jsx("div",{className:"bg-gradient-to-r from-primary/5 to-transparent rounded-xl p-4 border border-primary/10 mt-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:r("onboarding.allSetMessage").split("<1>").map((n,a)=>{if(a===0)return n;const[l,u]=n.split("</1>");return e.jsxs("span",{children:[e.jsx("span",{className:"text-foreground font-medium",children:l}),u]},a)})})})]})}function ge({icon:t,title:r,subtitle:s}){return e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-gradient-to-br from-primary/15 to-primary/5 flex items-center justify-center border border-primary/10 shrink-0 mt-0.5",children:e.jsx(t,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight text-foreground",children:r}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]})]})}function J({icon:t,title:r,description:s,onClick:n,highlight:a}){return e.jsxs("button",{onClick:n,className:k("w-full flex items-start gap-3.5 p-4 rounded-xl border text-left transition-all duration-200","hover:shadow-md hover:-translate-y-0.5 active:translate-y-0 group",a?"bg-gradient-to-r from-primary/8 to-primary/3 border-primary/20 hover:border-primary/40":"bg-card border-border/60 hover:border-border"),children:[e.jsx("div",{className:k("w-9 h-9 rounded-lg flex items-center justify-center shrink-0 mt-0.5",a?"bg-primary/15 text-primary":"bg-muted text-muted-foreground"),children:e.jsx(t,{className:"w-4.5 h-4.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:k("text-sm font-semibold",a?"text-primary":"text-foreground"),children:r}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:s})]}),e.jsx(G,{className:k("w-4 h-4 shrink-0 mt-1 transition-transform group-hover:translate-x-0.5",a?"text-primary/50":"text-muted-foreground/40")})]})}function Ua(){const{user:t}=B(),{t:r}=A(),[s,n]=o.useState(!1),[a,l]=o.useState(0),[u,f]=o.useState(!1),i=o.useRef(!1);o.useEffect(()=>{if(!(t!=null&&t.userId)){n(!1),l(0),i.current=!1;return}(async()=>{const{data:m}=await T.from("profiles").select("must_change_password, login_count_since_pwd_set").eq("user_id",t.userId).maybeSingle();if(!m)return;const c=m.must_change_password??!1;if(n(c),c&&!i.current){i.current=!0;const d=(m.login_count_since_pwd_set??0)+1;l(d),await T.from("profiles").update({login_count_since_pwd_set:d}).eq("user_id",t.userId)}else l(m.login_count_since_pwd_set??0)})()},[t==null?void 0:t.userId]);const g=o.useCallback(async()=>{if(t!=null&&t.email){f(!0);try{const{error:p}=await T.auth.resetPasswordForEmail(t.email,{redirectTo:`${Lt}/reset-password`});if(p)throw p;F.success(r("passwordReset.resendSuccess"))}catch(p){F.error(p.message||"Error sending reset email")}finally{f(!1)}}},[t==null?void 0:t.email,r]);return{mustChange:s,loginCount:a,isBlocked:s&&a>=3,resendReset:g,isResending:u}}function Wa(){const{t}=A(),{mustChange:r,loginCount:s,isBlocked:n,resendReset:a,isResending:l}=Ua();if(!r)return null;const u=!n;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`relative z-50 w-full px-4 py-3 flex flex-col sm:flex-row items-center justify-center gap-2 sm:gap-4 text-sm font-medium ${u?"bg-amber-500/15 text-amber-900 border-b border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200":"bg-destructive/15 text-destructive border-b border-destructive/30"}`,children:[u?e.jsx(Y,{className:"h-4 w-4 shrink-0"}):e.jsx(lt,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-center",children:t(u?"passwordReset.bannerWarning":"passwordReset.bannerBlocked")}),e.jsxs(M,{size:"sm",variant:u?"outline":"destructive",onClick:a,disabled:l,className:"shrink-0",children:[l?e.jsx(Q,{className:"h-4 w-4 animate-spin"}):e.jsx(me,{className:"h-4 w-4"}),t("passwordReset.resendButton")]})]}),n&&e.jsx("div",{className:"fixed inset-0 z-40 bg-background/80 backdrop-blur-sm"})]})}const Ye="dc.emailVerify.shown",Ha=600,Ga=1500;function Qa(){try{return!!document.querySelector('[role="dialog"][data-state="open"]')}catch{return!1}}function Ya({blocked:t=!1}){var g;const{t:r}=A(),s=Te(),n=K(),[a,l]=o.useState(!1),u=st({panelOpen:a}),i=u.needsVerification&&(((g=u.status)==null?void 0:g.day)??1)>=4;return o.useEffect(()=>{const p=()=>l(!0);return window.addEventListener(Re,p),()=>window.removeEventListener(Re,p)},[]),o.useEffect(()=>{const p=new URLSearchParams(s.search);if(p.get("verify")!=="1")return;l(!0),p.delete("verify");const m=p.toString();n({pathname:s.pathname,search:m?`?${m}`:""},{replace:!0})},[s.search,s.pathname,n]),o.useEffect(()=>{if(!(!a||!i))try{sessionStorage.setItem(Ye,"1")}catch{}},[a,i]),o.useEffect(()=>{if(!i||a)return;let p=!1;try{p=sessionStorage.getItem(Ye)==="1"}catch{}if(p)return;let m=!1,c;const d=()=>
2{if(!m){if(t||Qa()){c=setTimeout(d,Ga);return}l(!0)}};return c=setTimeout(d,Ha),()=>{m=!0,clearTimeout(c)}},[i,a,t]),u.status?e.jsxs(e.Fragment,{children:[i&&e.jsxs("div",{className:"h-10 w-full flex items-center gap-2 px-4 bg-primary/8 border-b border-primary/15 text-[13px] shrink-0","data-testid":"email-verify-banner",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-primary shrink-0","aria-hidden":!0}),e.jsxs("span",{className:"flex-1 min-w-0 truncate font-medium text-foreground",children:[e.jsx("span",{className:"sm:hidden",children:r("emailVerify.bannerShort")}),e.jsx("span",{className:"hidden sm:inline",children:r("emailVerify.bannerText")})]}),e.jsx("button",{type:"button",onClick:()=>l(!0),className:"shrink-0 font-semibold text-primary hover:underline","data-testid":"email-verify-banner-cta",children:r("emailVerify.bannerCta")})]}),e.jsx(ba,{open:a,onOpenChange:l,status:u.status,send:u.send,confirm:u.confirm,change:u.change,cancelChange:u.cancelChange,autoSendRescue:u.autoSendRescue})]}):null}const bt="dc:install-banner:snooze-until",Ja=14;function Xa(){return/iphone|ipad|ipod|android/i.test(navigator.userAgent)}function Za(){try{const t=Number(window.localStorage.getItem(bt)||0);return Date.now()<t}catch{return!1}}function en(){const{t}=A(),[r,s]=o.useState(()=>!te.isNativePlatform()&&Xa()&&!Za());if(!r)return null;const n=/android/i.test(navigator.userAgent)?Er:Tr,a=()=>{try{window.localStorage.setItem(bt,String(Date.now()+Ja*864e5))}catch{}s(!1)};return e.jsx("div",{className:"fixed bottom-0 inset-x-0 z-40 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:e.jsxs("div",{className:"mx-auto max-w-md flex items-center gap-3 rounded-2xl border border-border bg-card/95 backdrop-blur shadow-lg px-3.5 py-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary/10 text-primary flex items-center justify-center shrink-0",children:e.jsx(at,{className:"w-4.5 h-4.5 w-[18px] h-[18px]"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-semibold text-foreground leading-tight",children:t("common.installBannerTitle","Faster in the app")}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-tight",children:t("common.installBannerBody","Push alerts, GPS and one-tap access.")})]}),e.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 inline-flex items-center px-3.5 h-8 rounded-lg bg-primary text-primary-foreground text-xs font-bold",children:t("common.installBannerCta","Get app")}),e.jsx("button",{type:"button",onClick:a,"aria-label":t("common.dismiss","Dismiss"),className:"shrink-0 p-1 rounded-md text-muted-foreground hover:bg-muted",children:e.jsx(pe,{className:"w-4 h-4"})})]})})}function tn({slug:t,phoneHint:r,open:s,onDone:n}){const{t:a}
2=A(),[l,u]=o.useState(""),[f,i]=o.useState(!1),[g,p]=o.useState(0);o.useEffect(()=>{if(g<=0)return;const w=setInterval(()=>p(h=>h>0?h-1:0),1e3);return()=>clearInterval(w)},[g>0]);const m=w=>{switch(w){case"invalid_code":return"directoryClaim.invalid";case"expired":return"directoryClaim.expired";case"too_many_attempts":return"directoryClaim.tooMany";case"no_challenge":return"directoryClaim.expired";case"cooldown":return"directoryClaim.cooldownWait";case"resend_cap":case"sms_cap":return"directoryClaim.resendCap";case"sms_failed":return"directoryClaim.smsFailed";default:return"directoryClaim.genericError"}},c=async(w,h)=>{const v=h;if(v!=null&&v.error)return v.error;try{const x=w==null?void 0:w.context;if(x&&typeof x.json=="function"){const y=await x.clone().json();if(y!=null&&y.error)return String(y.error)}}catch{}return"unknown"},d=async()=>{if(!/^\d{6}$/.test(l)){F.error(a("directoryClaim.invalid"));return}i(!0);try{const{data:w,error:h}=await T.functions.invoke("directory-claim-link",{body:{op:"verify",slug:t,code:l}}),v=w==null?void 0:w.action;if(!h&&v==="linked"){F.success(a("directoryClaim.success")),n(!0);return}if(!h&&v==="already_claimed"){F.info(a("directoryClaim.alreadyClaimed")),n(!0);return}F.error(a(m(await c(h,w))))}finally{i(!1)}},N=async()=>{i(!0);try{const{data:w,error:h}=await T.functions.invoke("directory-claim-link",{body:{op:"resend",slug:t}});if(!h&&(w!=null&&w.ok)){F.success(a("directoryClaim.resent")),p(60),u("");return}F.error(a(m(await c(h,w))))}finally{i(!1)}};return e.jsx(X,{open:s,onOpenChange:w=>{w||n(!1)},children:e.jsxs(Z,{className:"sm:max-w-md",children:[e.jsxs(ce,{children:[e.jsxs(W,{className:"flex items-center gap-2",children:[e.jsx(Ar,{className:"w-5 h-5 text-primary"}),a("directoryClaim.title")]}),e.jsx(de,{children:a("directoryClaim.desc",{phone:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(se,{inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,placeholder:"000000",className:"text-center text-2xl tracking-[0.5em] font-mono",value:l,onChange:w=>u(w.target.value.replace(/\D/g,"").slice(0,6)),onKeyDown:w=>{w.key==="Enter"&&l.length===6&&!f&&d()}}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("directoryClaim.hint")})]}),e.jsxs(Ks,{className:"flex-col sm:flex-col gap-2",children:[e.jsx(M,{className:"w-full",onClick:d,disabled:f||l.length!==6,children:f?e.jsx(Q,{className:"w-4 h-4 animate-spin"}):a("directoryClaim.verify")}),e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>n(!1),disabled:f,children:a("directoryClaim.later")}),e.jsx(M,{variant:"outline",size:"sm",onClick:N,disabled:f||g>0,children:g>0?a("directoryClaim.resendIn",{s:g}):a("directoryClaim.resend")})]})]})]})})}const sn=["scheduled","on_site","loading","to_landfill"];function rn(){const{user:t}=B(),r=(t==null?void 0:t.companyId)??null,{data:s}=ee({queryKey:["pending-badge-count",r],enabled:!!r,refetchInterval:6e4,refetchOnWindowFocus:!0,staleTime:3e4,queryFn:async()=>{const n=T.from("dispatch_tasks").select("id",{count:"exact",head:!0}).eq("company_id",r).eq("task_type","delivery").is("driver_id",null).is("completed_at",null).is("deleted_at",null).in("status",Dr),a=T.from("junk_jobs").select("id",{count:"exact",head:!0}).eq("company_id",r).is("driver_id",null).is("deleted_at",null).in("status",sn),[l,u]=await Promise.all([n,a]);if(l.error)throw l.error;if(u.error)throw u.error;return(l.count??0)+(u.count??0)}});return s??0}const an=15*24*60*60*1e3,yt="dc_last_review_request",nn=8e3;async function on(){try{const{Preferences:t}=await he(async()=>{const{Preferences:s}=await import("./index-CJLICdHJ.js").then(n=>n.bw);return{Preferences:s}},__vite__mapDeps([0,1,2,3])),{value:r}=await t.get({key:yt});return r?parseInt(r,10):0}catch{return 0}}async function ln(t){try{const{Preferences:r}=await he(async()=>{const{Preferences:s}=await import("./index-CJLICdHJ.js").then(n=>n.bw);return{Preferences:s}},__vite__mapDeps([0,1,2,3]));await r.set({key:yt,value:String(t)})}catch{}}async function cn(){const t=await on(),r=Date.now();if(!(r-t<an))try{const{InAppReview:s}=await he(async()=>{const{InAppReview:n}=await import("./index-CZfo0HKM.js");return{InAppReview:n}},__vite__mapDeps([4,2,0,1,3]));await s.requestReview(),await ln(r),console.log("[in-app-review] Review requested")}catch(s){console.warn("[in-app-review] requestReview failed:",s)}}function dn(){o.useEffect(()=>
2{if(!te.isNativePlatform())return;let t=null,r=null,s=!0;function n(){t&&clearTimeout(t),t=setTimeout(async()=>{s&&await cn()},nn)}async function a(){n();const{App:l}=await he(async()=>{const{App:f}=await import("./index-D3aOuVwH.js");return{App:f}},__vite__mapDeps([5,2,0,1,3])),u=await l.addListener("appStateChange",({isActive:f})=>{f&&s&&n()});r=()=>u.remove()}return a().catch(l=>console.warn("[in-app-review] setup error:",l)),()=>{s=!1,t&&clearTimeout(t),r==null||r()}},[])}function mn(){var g,p;const{t}=A(),r=Rr(),[s,n]=o.useState(null);if(o.useEffect(()=>{const m=c=>{const d=c.detail;if(d!=null&&d.key){n(d);try{ue({particleCount:130,spread:85,origin:{y:.5}}),setTimeout(()=>ue({particleCount:80,spread:110,origin:{y:.4}}),350)}catch{}}};return window.addEventListener("dc:milestone",m),()=>window.removeEventListener("dc:milestone",m)},[]),!s)return null;const a=m=>r==="$"?m.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}):r+m.toLocaleString("en-US",{maximumFractionDigits:0}),l=Number(((g=s.meta)==null?void 0:g.amount)??0),u=String(((p=s.meta)==null?void 0:p.levelName)??"");let f,i;return s.key.startsWith("level_")&&u?(f=s.key==="level_1"?t("activation.milestoneFirstOrderTitle"):t("levels.celebrateTitle",{name:u}),i=s.key==="level_1"?t("activation.milestoneFirstOrderBody"):t("levels.celebrateBody",{name:u})):s.key==="first_payment"?(f=t("activation.milestoneFirstPaymentTitle"),i=t("activation.milestoneFirstPaymentBody",{amount:a(l)})):s.key==="first_size"?(f=t("activation.milestoneFirstSizeTitle"),i=t("activation.milestoneFirstSizeBody")):(f=t("activation.milestoneFirstOrderTitle"),i=t("activation.milestoneFirstOrderBody")),e.jsx(X,{open:!0,onOpenChange:m=>{m||n(null)},children:e.jsxs(Z,{className:"max-w-sm text-center",children:[e.jsx("div",{className:"text-5xl mb-1","aria-hidden":!0,children:"ð"}),e.jsx(W,{className:"text-lg font-extrabold text-foreground",children:f}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e.jsx(M,{className:"mt-2",onClick:()=>n(null),children:t("activation.milestoneKeepGoing")})]})})}const un="áà âãäåéèêëÃìîïóòôõöúùûüçñýÿ",pn="aaaaaaeeeeiiiiooooouuuucnyy",fn=40,xn=/^co-[0-9a-f]{8}$/;function hn(t){return!!t&&xn.test(t)}function gn(t){let r=t.trim().toLowerCase();return r=Array.from(r,s=>{const n=un.indexOf(s);return n>=0?pn[n]:s}).join(""),r=r.replace(/[^a-z0-9]+/g,"-"),r=r.replace(/^-+|-+$/g,""),r=r.slice(0,fn).replace(/-+$/g,""),r}let z=null;function vt(t){return`dc_welcome_chime:${t}`}function wt(t){try{return!!window.localStorage.getItem(vt(t))}catch{return!1}}function jt(){return window.AudioContext||window.webkitAudioContext}function Nt(){var t;return!!((t=window.matchMedia)!=null&&t.call(window,"(prefers-reduced-motion: reduce)").matches)}function bn(t){if(!(typeof window>"u"||!t))try{if(Nt()||wt(t))return;const r=jt();if(!r)return;if(z&&z.key===t&&z.ctx.state!=="closed"){z.ctx.resume().catch(()=>{});return}const s=new r;s.resume().catch(()=>{}),z={key:t,ctx:s}}catch{}}function yn(t){if(!(typeof window>"u"||!t))try{if(Nt()||wt(t))return;const r=jt();if(!r)return;const s=z&&z.key===t&&z.ctx.state!=="closed"?z.ctx:new r;z=null;const n=()=>{const a=s.createGain();a.gain.value=.22,a.connect(s.destination);const l=(f,i,g)=>{const p=s.createOscillator();p.type="sine",p.frequency.value=f;const m=s.createGain();m.gain.setValueAtTime(0,i),m.gain.linearRampToValueAtTime(1,i+.02),m.gain.exponentialRampToValueAtTime(.001,i+g),p.connect(m),m.connect(a),p.start(i),p.stop(i+g+.05)},u=s.currentTime;l(659.25,u,.38),l(987.77,u+.13,.42),l(1318.51,u+.26,.5);try{window.localStorage.setItem(vt(t),"1")}catch{}window.setTimeout(()=>{s.close().catch(()=>{})},1500)};s.state==="running"?n():s.resume().then(n).catch(()=>{})}catch{}}const vn="dumpstercontrols.io",wn={dumpster_rental:"welcome.lineDumpsterShort",junk_removal:"welcome.lineJunkShort",scrap_metal:"welcome.lineScrapShort"},jn={dumpster_rental:xe,junk_removal:Se,scrap_metal:qr},je=Ne.filter(t=>t.defaultOn).map(t=>t.key);function Nn(t){const s=(t??"").trim().split(/\s+/)[0]??"";return s.includes("@")?s.split("@")[0]:s}function kn({open:t,onOpenChange:r,state:s,mode:n="flow"}){const{t:a}=A(),{user:l}
2=B(),u=Je(),f=(l==null?void 0:l.companyId)??null,i=Lr(),{lines:g,isLoading:p}=fe(),m=n==="flow",[c,d]=o.useState("name"),[N,w]=o.useState(""),[h,v]=o.useState(""),[x,y]=o.useState(je),[C,S]=o.useState(!1),[j,_]=o.useState(null);o.useEffect(()=>{if(!t)return;const b=s.company_name??"";w(b),v(b),_(null),S(!1),d(n==="name"||!i?"name":"lines"),y(n==="lines"&&i&&!p?g:je)},[t,n]),o.useEffect(()=>{const b=window.setTimeout(()=>v(N),400);return()=>window.clearTimeout(b)},[N]);const D=o.useMemo(()=>{const b=h.trim();return(hn(s.slug)&&!s.booking_online&&!Pr(b)?gn(b):"")||s.slug||""},[h,s.slug,s.booking_online]),$=N.trim(),q=$.length>=2&&$.length<=80,V=!C&&(c==="lines"?x.length>0:q&&!(n==="name"&&i&&p)),U=(b,O)=>y(L=>O?Ne.map(P=>P.key).filter(P=>L.includes(P)||P===b):L.filter(P=>P!==b)),E=async()=>{if(!V||!l)return;if(m&&c==="lines"){d("name");return}m&&bn(l.userId),S(!0),_(null);const b=n==="lines"?(s.company_name??"").trim():$,O=i?n==="name"?g:x:je,{data:L,error:P}=await T.rpc("company_set_name_and_slug_v1",{p_name:b,p_lines:O});if(P||!L){S(!1),_(a("businessLines.errorGeneric"));return}const be=L;u.setQueryData(["business-lines",f],ns(be.business_lines)),u.invali
2dateQueries({queryKey:["business-lines",f]}),u.invalidateQueries({queryKey:["setup-progress"]});try{await T.from("user_acknowledgements").insert({user_id:l.userId,key:Br}).select().single()}catch{}u.invalidateQueries({queryKey:["welcome-state",l.userId]}),S(!1),m&&(Kr(),yn(l.userId)),r(!1)},R=a(c==="lines"?"welcome.linesLabel":"welcome.companyNameLabel");return e.jsx(X,{open:t,onOpenChange:b=>{C||r(b)},children:e.jsxs(Z,{className:"max-w-sm gap-0 p-5","data-testid":"welcome-dialog","data-stage":c,"data-mode":n,children:[m?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"pr-6 text-xl font-bold leading-tight",children:a("welcome.title",{name:Nn(l==null?void 0:l.name)})}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a("welcome.subtitle")}),i&&e.jsx("p",{className:"mt-4 text-[11px] font-semibold uppercase tracking-wide text-primary","data-testid":"welcome-step-of",children:a("welcome.stepOf",{n:c==="lines"?1:2,total:2})}),e.jsx("p",{className:`${i?"mt-1":"mt-5"} text-[15px] font-semibold leading-tight text-foreground`,children:c==="lines"?R:e.jsx("label",{htmlFor:"welcome-company-name",children:R})})]}):e.jsx(W,{className:"pr-6 text-xl font-bold leading-tight",children:c==="lines"?R:e.jsx("label",{htmlFor:"welcome-company-name",children:R})}),c==="lines"?e.jsxs("section",{className:"mt-1","data-testid":"welcome-lines-section",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:a("welcome.linesHint")}),e.jsx("div",{className:"mt-3 grid gap-2","data-testid":"welcome-lines",children:Ne.map(b=>{const O=jn[b.key],L=x.includes(b.key);return e.jsxs("div",{className:`flex items-start gap-3 rounded-xl border px-3 transition-colors ${L?"border-primary/40 bg-primary/5":"border-border"}`,children:[e.jsx("span",{className:`mt-3.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${L?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,"aria-hidden":!0,children:e.jsx(O,{className:"h-[18px] w-[18px]"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Fs,{line:b.key,checked:L,disabled:C,descKey:wn[b.key],onCheckedChange:P=>U(b.key,P)})})]},b.key)})})]}):e.jsxs("section",{className:"mt-1","data-testid":"welcome-name-section",children:[e.jsx(se,{id:"welcome-company-name",value:N,onChange:b=>w(b.target.value),onFocus:b=>b.currentTarget.select(),maxLength:80,autoComplete:"organization",disabled:C,className:"mt-2 h-12 rounded-lg text-[17px] font-semibold","data-testid":"welcome-name"}),e.jsxs("p",{className:"mt-1.5 h-9 overflow-hidden break-all font-mono text-xs leading-[18px] text-muted-foreground","data-testid":"welcome-link-preview",children:[vn,"/book?company=",D]})]}),j&&e.jsx("p",{className:"mt-3 text-xs text-destructive",role:"alert",children:j}),e.jsx(M,{className:"mt-4 h-12 w-full text-base font-semibold",disabled:!V,onClick:E,"data-testid":"welcome-continue",children:a("welcome.continue")})]})})}function xl(){var U;const[t,r]=o.useState(!1);o.useEffect(()=>{const E=()=>r(!0);return window.addEventListener("dc:tresha:ask",E),()=>window.removeEventListener("dc:tresha:ask",E)},[]);const[s,n]=o.useState(!1),[a,l]=o.useState(!1),f=Te().pathname.startsWith("/app/admin-global"),{user:i}=B(),g=K(),p=o.useRef(!1);o.useEffect(()=>{if(p.current||!(i!=null&&i.userId))return;p.current=!0;let E=!1;return Es(i.userId).then(R=>{!E&&R&&g("/app/driver/tasks",{replace:!0})}),()=>{E=!0}},[i==null?void 0:i.userId,g]);const{driver:m}=Or();yr(!!(m!=null&&m.id)&&!!(m!=null&&m.company_id)&&!te.isNativePlatform(),m==null?void 0:m.id,m==null?void 0:m.company_id),vr(!!(m!=null&&m.id)&&!!(m!=null&&m.company_id)&&!te.isNativePlatform(),m==null?void 0:m.id,m==null?void 0:m.company_id),Mr(!!i),wr(void 0,(i==null?void 0:i.companyId)??void 0,i==null?void 0:i.userId),Pt(rn(),!!i),jr(),dn();const{needsUpdate:c,availableVersion:d}=Nr(),{unacknowledgedOrders:N,acknowledgeOrders:w}=Ma();Ra(Bt((i==null?void 0:i.companyId)??null,null,"companyBoard"));const[h,v]=o.useState(null),x=o.useCallback(()=>{try{localStorage.removeItem("dc_claim_intent"),localStorage.removeItem("dc_claim_intent_ts")}catch{}},[]);o.useEffect(()=>{if(!(i!=null&&i.companyId)||i.role==="platform_admin")return;let E=null,R=0;try{E=localStorage.getItem("dc_claim_intent"),R=Number(localStorage.getItem("dc_claim_intent_ts")||"0")}catch{}if(!E)return;if(!R||Date.now()-R>7*24*60*60*1e3){x();return}const b=E;T.functions.invoke("directory-claim-link",{body:{op:"start",slug:b}}).then(({data:O,error:L})=>{const P=O==null?void 0:O.action;if(!L&&P==="challenge"){v({slug:b,phoneHint:O.phone_hint||""});return}(!L||L.name!=="FunctionsFetchError")&&x()}).catch(()=>{})},[i==null?void 0:i.companyId,x]);const y=Vr(),[C,S]=o.useState(null);o.useEffect(()=>{const E=R=>{var O;const b=(O=R.detail)==null?void 0:O.mode;S(b==="lines"?"lines":"name")};return window.addEventListener(ze,E),()=>window.removeEventListener(ze,E)},[]);const j=o.useRef(!1),_=o.useRef(h);_.current=h;const D=o.useRef(null);o.useEffect(()=>()=>{D.current!==null&&window.clearTimeout(D.current)},[]),o.useEffect(()=>{if(!i||i.role==="platform_admin")return;if(localStorage.getItem("dc_onboarding_completed")==="true"||i.onboardingCompleted){l(!1);return}if(l(!0),y.isLoading||j.current)return;if(j.current=!0,Fr(y.data,i)){D.current=window.setTimeout(()=>{D.current=null,!_.current&&(document.querySelector('[role="dialog"][data-state="open"]')||S("flow"))},600);return}if(Ue(y.data))return;parseInt(localStorage.getItem("dc_onboarding_view_count")||"0",10)<5&&n(!0)},[i,y.status]);const $=o.useCallback(()=>
2{l(!1),n(!1)},[]),q=o.useCallback(()=>{n(!0)},[]),V=typeof window<"u"&&!!((U=window.localStorage)!=null&&U.getItem("impersonation_session_id"));return i!=null&&i.isPureAdmin&&!f&&!V?e.jsx(St,{to:"/app/admin-global",replace:!0}):e.jsx(Ds,{children:e.jsxs(dt,{children:[e.jsx(Vt,{children:e.jsx("meta",{name:"apple-itunes-app",content:"app-id=6476944277"})}),e.jsxs("div",{className:"min-h-screen flex flex-col w-full bg-background",style:{paddingTop:"env(safe-area-inset-top)",minHeight:"100dvh"},children:[e.jsx(Wa,{}),e.jsx(Ya,{blocked:s||!!h}),e.jsx(Oa,{}),e.jsxs("div",{className:"flex flex-1 min-w-0",children:[!f&&e.jsx(fa,{}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx(La,{}),e.jsx(Pa,{}),e.jsx(Ba,{orders:N,onDismiss:w}),e.jsx(Ta,{adminGlobal:f,onOpenTresha:()=>r(!0),onOpenOnboarding:a?q:void 0,quietOnboardingDot:Ue(y.data)}),e.jsx("main",{className:"flex-1 p-6 pb-[90px] px-[15px]",children:e.jsx(Ct,{})}),e.jsx(mn,{}),e.jsx(mr,{compact:!0,onOpenTresha:()=>r(!0)})]})]}),e.jsx(en,{})]}),e.jsx(ur,{onClick:()=>r(!0),hasAlert:!0}),e.jsx(pr,{open:t,onClose:()=>r(!1)}),e.jsx(Va,{open:s,onClose:()=>n(!1),onComplete:$,userName:i==null?void 0:i.name}),y.data&&e.jsx(kn,{open:C!==null,mode:C??"flow",onOpenChange:E=>{E||S(null)},state:y.data}),h&&e.jsx(tn,{slug:h.slug,phoneHint:h.phoneHint,open:!0,onDone:E=>{E&&x(),v(null)}}),c&&e.jsx(kr,{availableVersion:d})]})})}export{xl 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.