PageSourceSearch

https://nestwatch.ai/assets/OperatorLayout-Cby12U3g.js

js nestwatch.ai collected 2026-10-05 14:26:30 UTC 36,119 bytes, 1 lines download raw bytes

1import{h as D,aZ as R,u as Ne,a_ as we,R as m,z as ke,a$ as Se,j as e,A as O,b0 as Y,E as Ce,b1 as I,T as $e,B as w,w as Te,b2 as Ae,b3 as le,aa as De,f as Oe,b4 as Ie,b5 as Me,b6 as qe,b7 as Ee,b8 as Pe,L as v,b9 as U,ba as S,bb as C,bc as $,bd as T,be as We,bf as Le,bg as Re,bh as de,a as k,aL as Fe,bi as _e}from"./index-BS9DQU3-.js";import{S as F,a as _,b as B,c as H,d as V,e as Be}from"./sheet-Cd0bHHN6.js";import{T as He}from"./TaskFormDialog-BCbrs4qf.js";import{u as ce}from"./permissions-DHafqw6q.js";import{T as Ve,a as Ge,b as Q,c as Z}from"./tabs-Kx4q_NtS.js";import{S as ze,a as Ke,b as Ye,c as Ue,d as Qe}from"./select-d6crtmio.js";import{u as Ze}from"./use-search-miss-logger-DHaHzHka.js";import{B as Xe}from"./book-open-Bjiw0gEs.js";import{C as G}from"./cloud-off-BAw0pnrU.js";import{S as ue}from"./search-Dsh6Y25t.js";import{C as Je}from"./ContextualHint-DvTW4oD3.js";import{A as et,a as tt,b as st,c as at,d as rt,e as nt,f as it,g as ot}from"./alert-dialog-iDwTk4xS.js";import{R as A}from"./refresh-cw-BasczHFf.js";import{T as lt}from"./trash-2-DLCRqjOF.js";import{C as dt,a as ct,b as ut,c as mt,d as ht,e as X}from"./PropertyPicker-B0CD-J6w.js";import{u as pt}from"./use-debounced-value-D-WQF8FM.js";import{B as me}from"./building-4tni05is.js";import{U as he}from"./users-xCMgr0IR.js";import{C as pe}from"./clipboard-check-g5tKZmws.js";import{W as xe}from"./wrench-B1ts_EGQ.js";import{R as xt}from"./receipt-QkQkW4Ej.js";import{B as ft,H as gt}from"./hard-hat-COQHvZ-U.js";import{N as J,u as bt,a as yt}from"./NotificationCenter-CmpGJVRm.js";import{L as ee}from"./life-buoy-K06Ovy2J.js";import{S as M}from"./settings-uFre7Kwo.js";import{H as jt}from"./house-D19na_pR.js";import{S as vt}from"./sun-5mwdWHjS.js";import{F as q}from"./file-pen-CXfrIAWA.js";import{C as Nt}from"./calendar-days-DROzY2pE.js";import{F as wt}from"./file-text-BulBVbjk.js";import{S as fe}from"./square-check-big-AN_022Wh.js";import{M as kt}from"./message-square-CRljyblg.js";import{T as St}from"./tags-Cw2SwfCG.js";import{C as Ct}from"./clipboard-list-BPbWovai.js";import{T as P}from"./triangle-alert-COVZRe0Z.js";import"./index-BlBXwTWu.js";import"./HomeownerPicker-qH1mzpCB.js";import"./dialog-D9JL4Fjm.js";import"./DatePickerField-BH1l1Mdh.js";import"./index-BdQq_4o_.js";import"./index-DWYdAkFM.js";import"./info-CgJRKE8w.js";const $t=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Tt=D("bug",$t);const At=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],Dt=D("chart-no-axes-column",At);const Ot=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],It=D("database",Ot);const Mt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],qt=D("panel-left-close",Mt);const Et=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Pt=D("panel-left-open",Et),Wt=[{value:"question",label:"Question — how do I…?"},{value:"bug",label:"Bug — something's broken"},{value:"feature",label:"Feature request — I wish it could…"}];function Lt(t,s){return{page:t,url:typeof window<"u"?window.location.href:t,plan:s??"unknown",appVersion:"web",userAgent:typeof navigator<"u"?navigator.userAgent:"",viewport:typeof window<"u"?`${window.innerWidth}x${window.innerHeight}`:""}}function Rt({open:t,onOpenChange:s,planTier:a,onOpenOfflineStatus:u}){const[o,r]=R(),{toast:i}=Ne(),n=we(),[h,f]=m.useState("guides"),[x,b]=m.useState(""),[d,l]=m.useState("question"),[y,j]=m.useState(""),[g,p]=m.useState(""),N=m.useMemo(()=>x.trim()?ke(x,8):[],[x]),z=m.useMemo(()=>Se(o),[o]);Ze(x,x.trim().length>0&&N.length===0,"launcher");function K(c){s(!1),r(Te(c,"/app/support"))}function be(c){s(!1),r(`/app/support/${c}`)}function ye(){s(!1),r("/app/support")}async function je(c){if(c.preventDefault(),!(!y.trim()||!g.trim()))try{await n.mutateAsync({data:{category:d,subject:y.trim(),message:g.trim(),context:Lt(o,a)}}),i({title:"Request submitted",description:"Your request was saved and queued for the NestWatch team. We'll reply by email."}),j(""),p(""),l("question"),s(!1)}catch(ve){i({variant:"destructive",title:"Couldn't submit your request",description:Ae(ve).message??"Your request couldn't be submitted. Please try again in a moment."})}}return e.jsx(F,{open:t,onOpenChange:s,children:e.jsxs(_,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-md",children:[e.jsxs(B,{className:"border-b px-6 py-4 text-left",children:[e.jsx(H,{className:"font-serif text-xl",children:"Help & Support"}),e.jsx(V,{children:"Search our guides or send us a message."})]}),e.jsxs(Ve,{value:h,onValueChange:f,className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"px-6 pt-4",children:e.jsxs(Ge,{className:"grid w-full grid-cols-2",children:[e.jsxs(Q,{value:"guides",children:[e.jsx(Xe,{className:"mr-2 h-4 w-4"})," Guides"]}),e.jsxs(Q,{value:"contact",children:[e.jsx(Tt,{className:"mr-2 h-4 w-4"})," Contact us"]})]})}),e.jsxs(Z,{value:"guides",className:"mt-0 min-h-0 flex-1 overflow-y-auto px-6 py-4",children:[u&&e.jsxs("button",{type:"button",onClick:()=>{s(!1),u()},className:"mb-4 flex w-full items-center gap-3 rounded-xl border bg-muted/40 p-3 text-left transition-colors hover:bg-muted","data-testid":"button-open-offline-status",children:[e.jsx(G,{className:"h-5 w-5 shrink-0 text-primary"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm font-medium",children:"Offline status"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Check this device before fieldwork."})]}),e.jsx(O,{className:"ml-auto h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Y,{value:x,onChange:c=>b(c.target.value),placeholder:"Search guides…",className:"pl-9","aria-label":"Search guides"})]}),x.trim()?e.jsx("div",{className:"mt-4 space-y-2",children:N.length===0?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No guides found. Try the C
1ontact us tab to reach our team."}):N.map(({article:c})=>e.jsxs("button",{onClick:()=>K(c),className:"w-full rounded-lg border border-border p-3 text-left transition hover:border-primary/40 hover:bg-muted/50",children:[e.jsx("span",{className:"block font-medium text-foreground",children:c.title}),e.jsx("span",{className:"mt-0.5 block text-sm text-muted-foreground",children:c.summary})]},c.slug))}):e.jsxs("div",{className:"mt-4 space-y-4",children:[z.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Guides for this screen"}),z.map(c=>e.jsxs("button",{type:"button",onClick:()=>K(c),className:"w-full rounded-lg border border-border p-3 text-left transition hover:border-primary/40 hover:bg-muted/50",children:[e.jsx("span",{className:"block font-medium text-foreground",children:c.title}),e.jsx("span",{className:"mt-0.5 block text-sm text-muted-foreground",children:c.summary})]},`${c.categorySlug}/${c.slug}`))]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Browse topics"}),Ce.map(c=>e.jsxs("button",{onClick:()=>be(c.slug),className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-sm transition hover:bg-muted",children:[e.jsx("span",{className:"font-medium text-foreground",children:c.title}),e.jsx(O,{className:"h-4 w-4 text-muted-foreground"})]},c.slug))]})]}),e.jsxs("button",{type:"button",onClick:ye,className:"mt-4 flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:["Open the full Help & Support center",e.jsx(O,{className:"h-3.5 w-3.5"})]})]}),e.jsx(Z,{value:"contact",className:"mt-0 min-h-0 flex-1 overflow-y-auto px-6 py-4",children:e.jsxs("form",{onSubmit:je,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"help-category",children:"What can we help with?"}),e.jsxs(ze,{value:d,onValueChange:c=>l(c),children:[e.jsx(Ke,{id:"help-category",children:e.jsx(Ye,{})}),e.jsx(Ue,{children:Wt.map(c=>e.jsx(Qe,{value:c.value,children:c.label},c.value))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"help-subject",children:"Subject"}),e.jsx(Y,{id:"help-subject",value:y,onChange:c=>j(c.target.value),placeholder:d==="bug"?"e.g. Report won't generate":"A short summary",maxLength:150,required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"help-message",children:d==="bug"?"What happened? What were you trying to do?":"Details"}),e.jsx($e,{id:"help-message",value:g,onChange:c=>p(c.target.value),placeholder:d==="bug"?"Tell us what you expected, what actually happened, and the steps to reproduce it.":"Share as much detail as you can.",rows:6,required:!0})]}),d==="bug"&&e.jsx("p",{className:"rounded-lg bg-muted px-3 py-2 text-xs text-muted-foreground",children:"We'll automatically include the page you're on and your plan so we can fix it faster."}),e.jsx(w,{type:"submit",className:"w-full",disabled:n.isPending||!y.trim()||!g.trim(),children:n.isPending?"Sending…":"Send message"}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Goes straight to the NestWatch team. We reply by email."})]})})]})]})})}function Ft({open:t,onOpenChange:s}){const a=le(),u=a.ops??[],[o,r]=m.useState(null),i=_t(a);return e.jsxs(e.Fragment,{children:[e.jsx(F,{open:t,onOpenChange:s,children:e.jsxs(_,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-md","data-testid":"offline-status-panel",children:[e.jsxs(B,{className:"border-b px-5 py-4 text-left sm:px-6",children:[e.jsx(H,{className:"font-serif text-xl",children:"Offline status"}),e.jsx(V,{children:"Check that this device is ready and manage work waiting to sync."})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-5 sm:p-6",children:[e.jsx("div",{className:`rounded-xl border p-4 ${i.className}`,role:"status","aria-live":"polite","data-testid":"offline-status-summary",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(i.icon,{className:"mt-0.5 h-5 w-5 shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:i.title}),e.jsx("p",{className:"mt-1 text-sm leading-5",children:i.description})]})]})}),a.lastSuccessfulDrain&&u.length===0&&e.jsxs("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"offline-last-drain",children:["Last c
1aught up"," ",new Date(a.lastSuccessfulDrain).toLocaleString(),"."]}),u.length>0&&e.jsxs("section",{className:"mt-6","aria-labelledby":"offline-work-heading",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{id:"offline-work-heading",className:"font-semibold",children:"Work on this device"}),a.errorCount>1&&e.jsxs(w,{size:"sm",variant:"outline",onClick:()=>{a.retryAll()},disabled:!a.isOnline||a.isFlushing,"data-testid":"button-retry-all-offline",children:[e.jsx(A,{className:"mr-2 h-4 w-4"}),"Retry all"]})]}),e.jsx("ul",{className:"mt-3 space-y-2",children:u.map(n=>e.jsx("li",{className:"rounded-xl border bg-card p-3","data-testid":`offline-op-${n.id}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:E(n)}),e.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Visit ending ",n.inspectionId.slice(-6)]}),e.jsx("p",{className:n.status==="error"?"mt-1 text-xs text-destructive":"mt-1 text-xs text-muted-foreground",children:n.status==="error"?Bt(n):a.isOnline?"Sending to NestWatch":"Saved safely on this device"})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[n.status==="error"&&e.jsx(w,{size:"icon",variant:"ghost",onClick:()=>{a.retry(n.id)},disabled:!a.isOnline||a.isFlushing,"aria-label":`Retry ${E(n)}`,"data-testid":`button-retry-offline-${n.id}`,children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx(w,{size:"icon",variant:"ghost",onClick:()=>r(n),disabled:a.isFlushing,"aria-label":`Discard ${E(n)}`,"data-testid":`button-discard-offline-${n.id}`,children:e.jsx(lt,{className:"h-4 w-4"})})]})]})},n.id))})]})]})]})}),e.jsx(et,{open:o!==null,onOpenChange:n=>!n&&r(null),children:e.jsxs(tt,{children:[e.jsxs(st,{children:[e.jsx(at,{children:"Discard unsaved work?"}),e.jsx(rt,{children:"This permanently removes this change from this device. It will not reach NestWatch, and this cannot be undone."})]}),e.jsxs(nt,{children:[e.jsx(it,{"data-testid":"button-cancel-discard-offline",children:"Keep work"}),e.jsx(ot,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:a.isFlushing,onClick:()=>{o&&a.discard(o).then(n=>{n&&r(null)})},"data-testid":"button-confirm-discard-offline",children:"Discard permanently"})]})]})})]})}function _t(t){return t.opsLoaded?t.storageReady===!1?{title:"Offline saving is unavailable",description:t.storageError??"Do not rely on offline capture on this device. Stay online and reload before fieldwork.",icon:It,className:"border-destructive/30 bg-destructive/10 text-destructive"}:t.errorCount>0?{title:"Some work did not save",description:`${t.errorCount} change${t.errorCount===1?"":"s"} need attention. Retry while online or discard only if you no longer need the work.`,icon:De,className:"border-destructive/30 bg-destructive/10 text-destructive"}:t.isOnline?t.isFlushing||t.pendingCount>0?{title:"Syncing with NestWatch",description:`${t.pendingCount} change${t.pendingCount===1?"":"s"} still waiting.`,icon:A,className:"border-primary/30 bg-primary/10 text-primary"}:{title:t.lastSuccessfulDrain?"Fully caught up":"Offline saving is ready",description:t.lastSuccessfulDrain?"Everything saved on this device has reached NestWatch.":"This device can safely hold supported visit work until you reconnect.",icon:Oe,className:"border-primary/30 bg-primary/10 text-foreground"}:{title:t.pendingCount>0?"Work is saved on this device":"Offline saving is ready",description:t.pendingCount>0?`${t.pendingCount} change${t.pendingCount===1?"":"s"} will sync when you reconnect.`:"You can capture supported visit work without a connection.",icon:G,className:"border-amber-500/30 bg-amber-500/10 text-amber-700"}:{title:"Checking this device",description:"Confirming that offline saving is available.",icon:A,className:"bg-muted text-foreground"}}function E(t){switch(t.kind){case"update-item":return"Checklist change";case"update-inspection":return"Visit update";case"add-photo":return"Visit photo";case"reschedule-recurring-visit":return"Visit reschedule";case"skip-recurring-visit":return"Visit skip";case"generate-report":return t.reportType==="ai"?"AI report draft":"Standard report draft"}}function Bt(t){return t.lastError&&(t.kind==="update-item"||t.kind==="update-inspection")?`${t.lastError} The change was not saved on the server. Correct it or discard this local edit.`:t.kind==="generate-report"&&t.reportType==="ai"?"Retry the AI draft, or discard it and create a standard report instead.":t.kind==="generate-report"?"Retry the report draft while online.":"This change needs attention."}const te=[{key:"properties",heading:"Properties",noun:"properties",icon:me,href:t=>`/app/properties/${t}`,listPath:"/app/properties"},{key:"homeowners",heading:"Homeowners",noun:"homeowners",icon:he,href:t=>`/app/homeowners/${t}`,listPath:"/app/homeowners"},{key:"inspections",heading:"Inspections",noun:"inspections",icon:pe,href:t=>`/app/inspections/${t}`,listPath:"/app/inspections"},{key:"issues",heading:"Issues",noun:"issues",icon:xe,href:t=>`/app/issues/${t}`,listPath:"/app/issues"},{key:"invoices",heading:"Invoices",noun:"invoices",icon:xt,href:t=>`/app/invoices/${t}`,listPath:"/app/invoices"},{key:"vendors",heading:"Vendors",noun:"vendors",icon:ft,href:t=>`/app/vendors/${t}`,listPath:"/app/vendors"}];function Ht({open:t,onOpenChange:s}){const[,a]=R();m.useEffect(()=>{const d=l=>
1{l.key==="k"&&(l.metaKey||l.ctrlKey)&&(l.preventDefault(),s(!t))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,s]);const[u,o]=m.useState(""),i=pt(u,250).trim(),n={q:i||void 0},{data:h,isFetching:f}=Ie(n,{query:{queryKey:qe(n),enabled:t&&i.length>0,placeholderData:Me}});m.useEffect(()=>{t||o("")},[t]);const x=!!h&&te.some(d=>(h[d.key]?.length??0)>0),b=d=>{s(!1),a(d)};return e.jsxs(dt,{open:t,onOpenChange:s,shouldFilter:!1,children:[e.jsx(ct,{placeholder:"Search properties, homeowners, inspections, invoices...",value:u,onValueChange:o,"data-testid":"input-global-search"}),e.jsx(ut,{children:i.length===0?e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Type to search across the whole app."}):x?te.map(d=>{const l=h?.[d.key]??[];if(l.length===0)return null;const y=d.icon,j=h?.totals?.[d.key]??l.length,g=j>l.length;return e.jsxs(ht,{heading:g?`${d.heading} — showing ${l.length} of ${j}`:d.heading,children:[l.map(p=>e.jsxs(X,{value:`${d.key}-${p.id}`,onSelect:()=>b(d.href(p.id)),"data-testid":`search-result-${d.key}-${p.id}`,children:[e.jsx(y,{className:"text-muted-foreground"}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate",children:p.title}),p.subtitle&&e.jsx("span",{className:"truncate text-xs text-muted-foreground capitalize",children:p.subtitle})]})]},`${d.key}-${p.id}`)),g&&e.jsxs(X,{value:`${d.key}-see-all`,onSelect:()=>b(`${d.listPath}?q=${encodeURIComponent(i)}`),"data-testid":`search-see-all-${d.key}`,children:[e.jsx(O,{className:"text-muted-foreground"}),e.jsxs("span",{className:"text-sm",children:["See all ",j," ",d.noun]})]},`${d.key}-see-all`)]},d.key)}):e.jsx(mt,{children:f?"Searching...":e.jsx("span",{className:"block px-4",children:"No matches. Search covers properties, homeowners, inspections, issues, invoices, and vendors."})})})]})}function se({onOpen:t,testId:s="button-global-search"}){return e.jsxs("button",{type:"button",onClick:t,"data-testid":s,className:"flex items-center gap-2 rounded-lg border bg-card/50 px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent/50",children:[e.jsx(ue,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"ml-1 hidden rounded border bg-muted px-1.5 text-[10px] font-medium text-muted-foreground sm:inline",children:"⌘K"})]})}function Vt(){const{data:t}=Re(),{can:s}=ce(),a=s("billing:manage"),u=de({mutation:{onSuccess:o=>{window.location.href=o.url}}});if(!t||!t.configured)return null;if(t.status==="trialing"&&t.trialEndsAt){const o=new Date(t.trialEndsAt).getTime()-Date.now(),r=Math.max(0,Math.ceil(o/(1e3*60*60*24))),i=r===0?"Your free trial ends today.":`Only ${r} day${r===1?"":"s"} left in your free trial.`;if(!t.hasSubscription){const n=t.trialExpired?"Your free trial has ended.":i;return a?e.jsxs(v,{href:"/app/start",className:"flex items-center justify-center gap-2 bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90","data-testid":"trial-banner",children:[e.jsx(k,{className:"h-4 w-4"}),n," ",e.jsx("span",{className:"underline underline-offset-2",children:"Add a card to continue"})]}):e.jsxs("div",{className:"flex w-full items-center justify-center gap-2 bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground","data-testid":"trial-banner",children:[e.jsx(k,{className:"h-4 w-4"}),n," Ask an account admin to add a card to continue."]})}return a?r<=3?e.jsxs("button",{type:"button",onClick:()=>u.mutate(),disabled:u.isPending,className:"flex w-full items-center justify-center gap-2 bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-70","data-testid":"trial-banner",children:[e.jsx(k,{className:"h-4 w-4"}),i," ",e.jsx("span",{className:"underline underline-offset-2",children:"Add a payment method"})]}):e.jsxs(v,{href:"/app/plans",className:"flex items-center justify-center gap-2 bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90","data-testid":"trial-banner",children:[e.jsx(k,{className:"h-4 w-4"}),`${r} day${r===1?"":"s"} left in your free trial.`," ",e.jsx("span",{className:"underline underline-offset-2",children:"Manage plan"})]}):e.jsxs("div",{className:"flex w-full items-center justify-center gap-2 bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground","data-testid":"trial-banner",children:[e.jsx(k,{className:"h-4 w-4"}),i," Ask an account admin to add a payment method."]})}return t.status==="past_due"?e.jsx(zt,{canManageBilling:a}):null}const Gt=1440*60*1e3,ae="nestwatch.banner.pastDue.dismissedAt";function zt({canManageBilling:t}){const s=de({mutation:{onSuccess:r=>{window.location.href=r.url}}}),[a,u]=m.useState(()=>{if(typeof window>"u")return!1;const r=window.localStorage.getItem(ae);
1if(!r)return!1;const i=Number(r);return Number.isFinite(i)&&Date.now()-i<Gt});if(a)return null;function o(){typeof window<"u"&&window.localStorage.setItem(ae,String(Date.now())),u(!0)}return e.jsxs("div",{className:"flex w-full items-center gap-2 bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground","data-testid":"past-due-banner",children:[t?e.jsxs("button",{type:"button",onClick:()=>s.mutate(),disabled:s.isPending,className:"flex flex-1 items-center justify-center gap-2 text-center transition-opacity hover:opacity-90 disabled:opacity-70","data-testid":"past-due-banner-action",children:[e.jsx(P,{className:"h-4 w-4 shrink-0"}),"Your last payment didn't go through."," ",e.jsx("span",{className:"underline underline-offset-2",children:"Fix billing"})]}):e.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-center","data-testid":"past-due-banner-info",children:[e.jsx(P,{className:"h-4 w-4 shrink-0"}),"Your last payment didn't go through. Ask an account admin to update your billing."]}),e.jsx("button",{type:"button",onClick:o,"aria-label":"Dismiss billing alert",className:"shrink-0 rounded-md p-1 transition-colors hover:bg-destructive-foreground/10","data-testid":"past-due-banner-dismiss",children:e.jsx(_e,{className:"h-4 w-4"})})]})}const Kt=[{href:"/app",label:"Dashboard",icon:jt},{href:"/app/day",label:"Start My Day",icon:vt},{href:"/app/properties",label:"Properties",icon:me},{href:"/app/homeowners",label:"Homeowners",icon:he},{href:"/app/inspections",label:"Inspections",icon:pe,children:[{href:"/app/templates",label:"Checklist templates",icon:q}]},{href:"/app/schedule",label:"Schedule",icon:Nt},{href:"/app/reports",label:"Reports",icon:wt,children:[{href:"/app/report-templates",label:"Report templates",icon:q}]},{href:"/app/issues",label:"Issues",icon:xe},{href:"/app/tasks",label:"Tasks & Requests",icon:fe},{href:"/app/vendors",label:"Vendors",icon:gt},{href:"/app/communications",label:"Communications",icon:kt},{href:"/app/invoices",label:"Invoices",icon:q,requires:"billing:manage",children:[{href:"/app/catalog",label:"Service catalog",icon:St,requires:"billing:manage"},{href:"/app/billable",label:"Billable work",icon:Ct,requires:"billing:manage"}]},{href:"/app/analytics",label:"Analytics",icon:Dt},{href:"/app/notifications",label:"Notifications",icon:Le,badgeKey:"notifications"}];function W(t,s){return t===s||s!=="/app"&&t.startsWith(s)}function ge(t,s){return`flex min-h-11 items-center gap-3 rounded-xl py-2.5 transition-[background-color,color,box-shadow] ${s?"ml-6 pl-3 pr-3 text-[0.875rem]":"px-3 font-medium"} ${t?"bg-secondary text-secondary-foreground shadow-sm shadow-secondary/20":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-foreground"}`}function L({item:t,location:s,nested:a=!1,badge:u=0,compact:o=!1}){const r=W(s,t.href),i=e.jsxs(v,{href:t.href,"aria-label":o?t.label:void 0,"aria-current":r?"page":void 0,className:o?`relative flex h-11 w-11 items-center justify-center rounded-xl transition-[background-color,color,box-shadow] ${r?"bg-secondary text-secondary-foreground shadow-sm shadow-secondary/20":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-foreground"}`:ge(r,a),children:[e.jsx(t.icon,{className:o?"h-5 w-5":"h-4 w-4"}),!o&&e.jsx("span",{className:"flex-1",children:t.label}),u>0&&e.jsx("span",{className:o?"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[0.625rem] font-semibold text-destructive-foreground":"flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1.5 text-[0.6875rem] font-semibold text-destructive-foreground","data-testid":"nav-notifications-badge",children:u>9?"9+":u})]});return o?e.jsxs(C,{children:[e.jsx($,{asChild:!0,children:i}),e.jsx(T,{side:"right",children:t.label})]}):i}function Yt({item:t,childItems:s,location:a}){const u=W(a,t.href),o=s.some(f=>W(a,f.href)),r=u||o,[i,n]=m.useState(r),h=m.useRef(r);return m.useEffect(()=>{r&&!h.current&&n(!0),h.current=r},[r]),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs(v,{href:t.href,"aria-current":u?"page":void 0,className:`${ge(u,!1)} flex-1`,children:[e.jsx(t.icon,{className:"h-4 w-4"}),t.label]}),e.jsx("button",{type:"button",onClick:()=>n(f=>!f),"aria-expanded":i,"aria-label":`${i?"Collapse":"Expand"} ${t.label}`,"data-testid":`nav-group-toggle-${t.href}`,className:"ml-1 flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded-xl text-sidebar-foreground
1/70 transition-colors hover:bg-sidebar-accent hover:text-foreground",children:e.jsx(Fe,{className:`h-4 w-4 transition-transform ${i?"rotate-180":""}`})})]}),i&&e.jsx("div",{className:"mt-1 grid gap-1",children:s.map(f=>e.jsx(L,{item:f,location:a,nested:!0},f.href))})]})}function re({location:t,can:s,compact:a=!1}){const{data:u=[]}=bt(),o=yt(u);return e.jsx(S,{children:Kt.filter(r=>!r.requires||s(r.requires)).map(r=>{const i=r.children?.filter(n=>!n.requires||s(n.requires));return!i||i.length===0?e.jsx(L,{item:r,location:t,badge:r.badgeKey==="notifications"?o:0,compact:a},r.href):a?e.jsx(L,{item:r,location:t,badge:r.badgeKey==="notifications"?o:0,compact:!0},r.href):e.jsx(Yt,{item:r,childItems:i,location:t},r.href)})})}const ne="nestwatch.operator.sidebarCollapsed";function ie({onOpen:t}){const{isOnline:s,pendingCount:a,errorCount:u,storageReady:o,opsLoaded:r}=le();return r&&!o||u>0?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs font-medium text-destructive","data-testid":"sync-badge",title:"Some changes could not be saved to the server",children:[e.jsx(P,{className:"h-3.5 w-3.5"})," ",o?`${u} failed`:"Offline unavailable"]}):s?a>0?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary","data-testid":"sync-badge",title:"Syncing your changes to the server",children:[e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"})," Syncing"," ",a]}):null:e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 dark:text-amber-500","data-testid":"sync-badge",title:"You're offline — changes are saved on this device and will sync when you reconnect",children:[e.jsx(G,{className:"h-3.5 w-3.5"})," Offline",a>0?` · ${a}`:""]})}function oe({testId:t}){const[s,a]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(S,{children:e.jsxs(C,{children:[e.jsx($,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"icon",onClick:()=>a(!0),"aria-label":"New task","data-testid":t,className:"text-foreground/70 hover:bg-muted hover:text-foreground",children:e.jsx(fe,{className:"h-5 w-5"})})}),e.jsx(T,{children:"New task"})]})}),s&&e.jsx(He,{open:s,onOpenChange:a})]})}function Ws({children:t}){const[s]=R(),{data:a}=Ee(),{data:u}=Pe(),{can:o}=ce(),[r,i]=m.useState(!1),[n,h]=m.useState(!1),[f,x]=m.useState(!1),[b,d]=m.useState(!1),[l,y]=m.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(ne)==="true");m.useEffect(()=>{d(!1)},[s]);const j=()=>{y(p=>{const N=!p;return window.localStorage.setItem(ne,String(N)),N})},g=({className:p})=>e.jsxs("button",{type:"button",onClick:()=>i(!0),"data-testid":"help-launcher-trigger",className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2.5 font-medium text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-foreground ${p??""}`,children:[e.jsx(ee,{className:"h-5 w-5"}),"Help & Support"]});return e.jsx(Je,{scopeId:a?.id,children:e.jsxs("div",{className:`grid min-h-screen w-full bg-muted/20 transition-[grid-template-columns] duration-200 ease-out ${l?"md:grid-cols-[72px_minmax(0,1fr)]":"md:grid-cols-[240px_minmax(0,1fr)] lg:grid-cols-[280px_minmax(0,1fr)]"}`,"data-testid":"operator-layout","data-sidebar-collapsed":l,children:[e.jsx("a",{href:"#operator-main",className:"fixed left-4 top-4 z-[100] -translate-y-24 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground shadow-lg transition-transform focus:translate-y-0","data-testid":"link-skip-main",children:"Skip to main content"}),e.jsx("div",{className:"hidden overflow-hidden border-r bg-card shadow-sm md:block","data-testid":"desktop-sidebar",children:e.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[e.jsxs("div",{className:`flex h-16 items-center lg:h-[72px] ${l?"justify-center px-2":"px-4 lg:px-6"}`,children:[e.jsxs(v,{href:"/app","aria-label":l?"NestWatch dashboard":void 0,className:"group flex items-center gap-2 font-semibold text-primary",children:[e.jsx(U,{className:"h-8 w-8 transition-transform group-hover:scale-105"}),!l&&e.jsx("span",{className:"font-serif text-xl tracking-tight",children:"NestWatch"})]}),!l&&e.jsx("div",{className:"ml-auto",children:e.jsx(ie,{onOpen:()=>h(!0)})})]}),e.jsx("div",{className:"flex-1 overflow-auto py-2",children:e.jsx("nav",{"aria-label":"Primary navigation",className:`grid items-start gap-1.5 text-sm font-medium ${l?"justify-center px-2":"px-3 lg:px-4"}`,children:e.jsx(re,{location:s,can:o,compact:l})})}),e.jsxs("div",{className:`mt-auto ${l?"flex flex-col items-center gap-2 border-t border-border/50 px-2 py-3":"space-y-4 p-4 lg:p-5"}`,children:[e.jsx("nav",{className:"text-sm font-medium border-t border-border/50 pt-4",children:l?e.jsx(S,{children:e.jsxs(C,{children:[e.jsx($,{asChild:!0,children:e.jsx("button",{type:"button",onClick:()=>i(!0),"aria-label":"Help & Support","data-testid":"help-launcher-trigger",className:"flex h-11 w-11 items-center justify-center rounded-xl text-sidebar-foreground
1/70 transition-colors hover:bg-sidebar-accent hover:text-foreground",children:e.jsx(ee,{className:"h-5 w-5"})})}),e.jsx(T,{side:"right",children:"Help & Support"})]})}):e.jsx(g,{})}),e.jsx(S,{children:e.jsxs(C,{children:[e.jsx($,{asChild:!0,children:e.jsx(v,{href:"/app/settings","aria-current":s.startsWith("/app/settings")?"page":void 0,"aria-label":l?"Workspace settings":void 0,className:l?`flex h-11 w-11 items-center justify-center rounded-xl transition-[background-color,color,box-shadow] ${s.startsWith("/app/settings")?"bg-secondary text-secondary-foreground shadow-sm":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-foreground"}`:"group -mx-2 flex items-center gap-3 rounded-[1.5rem] p-3 transition-colors hover:bg-sidebar-accent","data-testid":"workspace-settings-link",children:l?e.jsx(M,{className:"h-5 w-5"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold shadow-sm",children:a?.name?.charAt(0)||"W"}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:a?.name||"Workspace"}),e.jsxs("span",{className:"text-xs text-muted-foreground capitalize mt-0.5",children:[u?.planTier||a?.planTier||"Solo"," ","Plan"]})]}),e.jsx(M,{className:"ml-auto h-5 w-5 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground"})]})})}),l&&e.jsx(T,{side:"right",children:"Workspace settings"})]})}),e.jsx(S,{children:e.jsxs(C,{children:[e.jsx($,{asChild:!0,children:e.jsx("button",{type:"button",onClick:j,"aria-label":l?"Expand sidebar":"Collapse sidebar","aria-expanded":!l,"data-testid":"desktop-sidebar-toggle",className:`flex items-center rounded-xl text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-foreground ${l?"h-11 w-11 justify-center":"min-h-11 w-full gap-3 px-3 py-2.5 font-medium"}`,children:l?e.jsx(Pt,{className:"h-5 w-5"}):e.jsxs(e.Fragment,{children:[e.jsx(qt,{className:"h-5 w-5"}),"Collapse sidebar"]})})}),l&&e.jsx(T,{side:"right",children:"Expand sidebar"})]})})]})]})}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsxs("header",{className:"sticky top-0 z-30 flex h-[calc(4rem+env(safe-area-inset-top))] items-center gap-4 border-b bg-card/80 pl-[calc(1rem+env(safe-area-inset-left))] pr-[calc(1rem+env(safe-area-inset-right))] pt-[env(safe-area-inset-top)] backdrop-blur-xl md:hidden",children:[e.jsxs(F,{open:b,onOpenChange:d,children:[e.jsx(Be,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"icon",className:"shrink-0 md:hidden -ml-2","aria-label":b?"Close navigation menu":"Open navigation menu","aria-expanded":b,children:e.jsx(We,{className:"h-6 w-6"})})}),e.jsxs(_,{side:"left",className:"flex w-[85vw] max-w-[320px] flex-col bg-card",children:[e.jsxs(B,{className:"sr-only",children:[e.jsx(H,{children:"Navigation menu"}),e.jsx(V,{children:"Choose a section of the NestWatch operator app."})]}),e.jsxs("nav",{className:"grid gap-2 text-lg font-medium mt-6",children:[e.jsx(re,{location:s,can:o}),e.jsxs(v,{href:"/app/settings","aria-current":s.startsWith("/app/settings")?"page":void 0,className:`flex items-center gap-3 rounded-xl px-3 py-3 transition-[background-color,color,box-shadow] ${s.startsWith("/app/settings")?"bg-secondary text-secondary-foreground shadow-sm":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-foreground"}`,children:[e.jsx(M,{className:"h-5 w-5"}),"Settings"]}),e.jsx(g,{className:"mt-2"})]})]})]}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs(v,{href:"/app",className:"flex items-center gap-2 font-serif text-xl font-semibold text-primary",children:[e.jsx(U,{className:"h-8 w-8 shrink-0"}),e.jsx("span",{className:"truncate",children:"NestWatch"})]})}),e.jsx(se,{onOpen:()=>x(!0),testId:"button-global-search-mobile"}),e.jsx(oe,{testId:"button-quick-add-task-mobile"}),e.jsx(J,{}),e.jsx(ie,{onOpen:()=>h(!0)})]}),e.jsx("header",{className:"sticky top-0 z-30 hidden h-16 items-center gap-4 border-b bg-card/80 backdrop-blur-xl px-4 md:flex lg:h-[72px] lg:px-8",children:e.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[e.jsx(se,{onOpen:()=>x(!0)}),e.jsx(oe,{testId:"button-quick-add-task"}),e.jsx(J,{})]})}),e.jsx(Vt,{}
1),e.jsx("main",{id:"operator-main",tabIndex:-1,className:"flex flex-1 flex-col gap-4 p-4 lg:gap-8 lg:p-8 max-w-[1800px] w-full mx-auto",children:t})]}),e.jsx(Rt,{open:r,onOpenChange:i,planTier:u?.planTier||a?.planTier,onOpenOfflineStatus:()=>h(!0)}),e.jsx(Ft,{open:n,onOpenChange:h}),e.jsx(Ht,{open:f,onOpenChange:x})]})})}export{re as NavLinks,Vt as SubscriptionBanner,Ws 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.