1import{j as e}from"./vendor-radix-BbF15g50.js";import{P as M}from"./PrivateImage-Dalhf6En.js";import{P as ae}from"./PropertyDocuments-CyhzlX9E.js";import{f as D,e as _,r as d}from"./vendor-router-yRCO-o9X.js";import{K as S,a3 as E,a5 as re,T as ne,aD as ie,d as W,aJ as le,av as de,Q as oe,aK as ce,aL as he,aM as H,W as U,G as xe,ab as me,aN as pe,aO as ue,u as ve,s as be,V as ge}from"./index-CQhanil9.js";import{A as fe}from"./AddressAutocomplete-CK9eLJVP.js";import{C as je}from"./CaptureLinkModal-Xlh3mPKU.js";import{s as Ne}from"./invitationService-DphOCtn8.js";import{L as I,u as G,v as ye,g as ke,a7 as we,H as Ce,U as Se,a8 as Pe,a9 as Ie,e as _e,aa as Ee,y as Ae,k as z,C as K}from"./vendor-icons-Dx5PMbX1.js";import"./vendor-supabase-DXeGmUyu.js";import"./alert-CcJxyedT.js";import"./DocumentDropzone-xzE5CLlt.js";import"./field-vZkwoCop.js";import"./propertyDocuments-DLYeufRX.js";import"./captureLinks-DOuDke7N.js";const k=({children:n})=>{const{propertyId:s=""}=_(),{data:a}=E(s);return e.jsx(xe,{scope:"settings",breadcrumb:e.jsx(me,{name:(a==null?void 0:a.property.name)||"â¦"}),pageLabel:"Property Settings",children:e.jsx("div",{className:"max-w-[760px] mx-auto px-4 sm:px-6 md:px-10 pt-5 md:pt-7 pb-10",children:n})})},w=({title:n,sub:s})=>{const{propertyId:a=""}=_(),{data:r}=E(a);return e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"text-[12px] text-[var(--dash-ink-subtle)]",children:(r==null?void 0:r.property.name)||" "}),e.jsx("h1",{className:"mt-1 text-[20px] md:text-[24px] font-semibold tracking-[-0.015em]",children:n}),s&&e.jsx("p",{className:"mt-1 text-[13px] text-[var(--dash-ink-muted)] max-w-[640px]",children:s})]})},v=({title:n,hint:s,children:a,footer:r})=>e.jsxs("div",{className:"rounded-[12px] border border-[var(--dash-hairline)] bg-white overflow-hidden",children:[e.jsxs("div",{className:"p-5",children:[e.jsx("div",{className:"text-[14px] font-semibold",children:n}),s&&e.jsx("div",{className:"mt-1 text-[12px] text-[var(--dash-ink-muted)] max-w-[560px]",children:s}),e.jsx("div",{className:"mt-3",children:a})]}),r&&e.jsx("div",{className:"px-5 py-3 bg-[var(--dash-surface-muted)] border-t border-[var(--dash-surface-active)] flex items-center justify-between",children:r})]}),J=({dirty:n,saving:s,saved:a,onSave:r,onReset:i})=>e.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[a&&!n&&e.jsxs("span",{className:"text-[12px] text-[var(--dash-success)] flex items-center gap-1",children:[e.jsx(K,{className:"h-3.5 w-3.5",strokeWidth:2.4}),"Saved"]}),i&&e.jsx(S,{onClick:i,disabled:!n||s,children:"Reset"}),e.jsx(S,{kind:"blue",onClick:r,disabled:!n||s,children:s?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}),"Savingâ¦"]}):"Save changes"})]}),Ue=[{label:"General",description:"Slug, ID, photo",to:"general",icon:we},{label:"Property",description:"Name, address, insurance",to:"property",icon:Ce},{label:"Capture",description:"Links and history",to:"capture",icon:G},{label:"Members",description:"People and invites",to:"members",icon:Se},{label:"AI & valuation",description:"Values and depreciation",to:"ai-and-valuation",icon:Pe},{label:"Notifications",description:"Email alerts",to:"notifications",icon:Ie},{label:"Billing",description:"Payment and invoices",to:"billing",icon:_e},{label:"Danger Zone",description:"Archive or delete",to:"danger-zone",icon:Ee}];function Qe(){const{propertyId:n=""}=_(),s=D(),{data:a}=E(n),r=a!=null&&a.property.itemCount?Math.round(a.property.valuedItemCount/a.property.itemCount*100):0;return e.jsxs(k,{children:[e.jsx(w,{title:"Settings"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"rounded-[12px] border border-[var(--dash-hairline)] bg-white p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[15px] font-semibold text-[var(--dash-ink)]",children:(a==null?void 0:a.property.name)||"Property"}),e.jsx("div",{className:"mt-1 line-clamp-2 text-[12.5px] leading-snug text-[var(--dash-ink-muted)]",children:(a==null?void 0:a.property.address)||"No address"})]}),e.jsx(oe,{percent:r,started:((a==null?void 0:a.property.itemCount)||0)>0,showLabel:!1})]})}),e.jsx("div",{className:"rounded-[12px] border border-[var(--dash-hairline)] bg-white overflow-hidden",children:Ue.map((i,t)=>{const p=i.icon;return e.jsxs("button",{type:"button",onClick:()=>s(`/properties/${n}/settings/${i.to}`),className:`w-full flex items-center gap-3 px-4 py-3.5 text-left hover:bg-[var(--dash-surface-muted)] ${t?"border-t border-[var(--dash-surface-active)]":""}`,children:[e.jsx("span",{className:"h-9 w-9 shrink-0 rounded-[9px] bg-[var(--dash-surface-alt)] text-[var(--dash-ink-muted)] flex items-center justify-center",children:e.jsx(p,{className:"h-4 w-4",strokeWidth:1.8})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13.5px] font-semibold text-[var(--dash-ink)]",children:i.label}),e.jsx("span",{className:"mt-0.5 block text-[12px] leading-snug text-[var(--dash-ink-muted)]",children:i.description})]}),e.jsx(Ae,{className:"h-4 w-4 shrink-0 text-[var(--dash-ink-subtle)]",strokeWidth:1.8})]},i.to)})})]})]})}function Ye(){const{propertyId:n=""}=_(),{data:s,refresh:a}=E(n),{currentWorkspace:r,currentWorkspaceId:i}=W(),t=d.useMemo(()=>s!=null&&s.property.name?s.property.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"",[s==null?void 0:s.property.name]),p=(r==null?void 0:r.handle)||"workspace",[x,h]=d.useState(null),[u,b]=d.useState(null),j=async m=>{if(!i||!s)return;b(null),h("upload");const{error:N}=await pe(s.property.id,i,m);h(null),N?b(N.message):a()},g=async()=>
1{if(!s)return;b(null),h("remove");const{error:m}=await ue(s.property.id);h(null),m?b(m.message):a()};return e.jsxs(k,{children:[e.jsx(w,{title:"General",sub:"Basics about how this property shows up in your workspace."}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{title:"Project slug",hint:"Used in shared links. Property name on Settings · Property is the source of truth.",children:e.jsx(le,{defaultValue:t,prefix:`valyn.app/${p}/`})}),e.jsx(v,{title:"Project ID",hint:"Use this when interacting with the Valyn API.",children:e.jsxs("div",{className:"flex items-center justify-between rounded-[8px] border border-[var(--dash-hairline-strong)] bg-white px-3 h-9",children:[e.jsx("span",{className:"text-[12.5px] font-mono tabular-nums text-[var(--dash-ink)] truncate",children:(s==null?void 0:s.property.id)||"-"}),e.jsx("button",{onClick:()=>{var m;return s&&((m=navigator.clipboard)==null?void 0:m.writeText(s.property.id))},className:"text-[var(--dash-ink-subtle)] hover:text-[var(--dash-ink)] shrink-0 ml-3",children:e.jsx(ye,{className:"h-3.5 w-3.5",strokeWidth:1.8})})]})}),e.jsxs(v,{title:"Cover photo",hint:"Shown on the Properties index card.",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("div",{className:"h-20 w-32 rounded-[8px] overflow-hidden bg-[var(--dash-surface-alt)] border border-[var(--dash-hairline)]",children:s!=null&&s.property.photoUrl?e.jsx(M,{src:s.property.photoUrl,className:"w-full h-full object-cover",alt:""}):e.jsx("div",{className:"h-full w-full flex items-center justify-center text-[var(--dash-ink-subtle)] text-[10.5px]",children:"No photo"})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(de,{accept:"image/png,image/jpeg",onPick:j,disabled:x!==null,children:m=>e.jsx(S,{onClick:m,disabled:x!==null,icon:x==="upload"?e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ke,{className:"h-3.5 w-3.5",strokeWidth:1.8}),children:x==="upload"?"Uploadingâ¦":s!=null&&s.property.photoUrl?"Replace":"Upload"})}),(s==null?void 0:s.property.photoUrl)&&e.jsx(S,{onClick:g,disabled:x!==null,children:x==="remove"?"Removingâ¦":"Remove"})]}),e.jsx("div",{className:"text-[11px] text-[var(--dash-ink-subtle)]",children:"PNG, JPG up to 5 MB"})]}),u&&e.jsx("div",{className:"mt-2 text-[11.5px] text-[var(--dash-danger)]",children:u})]})]})]})}const De=[{value:"house",label:"Single-family"},{value:"townhouse",label:"Townhouse"},{value:"condo",label:"Condo"},{value:"apartment",label:"Apartment"},{value:"other",label:"Other"}];function Ze(){const{propertyId:n=""}=_(),{authUser:s,currentWorkspaceId:a}=W(),{data:r,refresh:i}=E(n),t=r==null?void 0:r.property,p=D(),[x,h]=d.useState(""),[u,b]=d.useState(""),[j,g]=d.useState(),[m,N]=d.useState("house"),[c,o]=d.useState(""),[f,C]=d.useState(""),[y,P]=d.useState(""),[Q,O]=d.useState(!1),[Y,R]=d.useState(!1),[V,A]=d.useState(null),[Z,T]=d.useState(!1),[L,B]=d.useState(""),[$,F]=d.useState(!1);d.useEffect(()=>{t&&(h(t.name),b(t.address||""),g(t.placeId||void 0),N(t.type||"house"),o(t.insuranceProvider||""),C(t.policyNumber||""),P(t.claimNumber||""),R(!1))},[t]);const X=d.useMemo(()=>t?x!==t.name||u!==(t.address||"")||j!==(t.placeId||void 0)||m!==(t.type||"house")||c!==(t.insuranceProvider||"")||f!==(t.policyNumber||"")||y!==(t.claimNumber||""):!1,[t,x,u,j,m,c,f,y]),ee=async()=>{if(!(!s||!a||!t)){A(null),O(!0),R(!1);try{const l={id:t.id,name:x.trim(),address:u.trim()||void 0,type:m,placeId:j,photoUrl:t.photoUrl||void 0,insuranceProvider:c.trim()||void 0,policyNumber:f.trim()||void 0,claimNumber:y.trim()||void 0};if(!await be(l,a,s.id))throw new Error("Failed to save");R(!0),i()}catch(l){A(l instanceof Error?l.message:"Failed to save")}finally{O(!1)}}},se=()=>{t&&(h(t.name),b(t.address||""),g(t.placeId||void 0),N(t.type||"house"),o(t.insuranceProvider||""),C(t.policyNumber||""),P(t.claimNumber||""),A(null),R(!1))},te=async()=>{if(t){F(!0),A(null);try{if(!await ge(t.id))throw new Error("Failed to delete");p("/properties")}catch(l){A(l instanceof Error?l.message:"Failed to delete"),F(!1)}}};return e.jsxs(k,{children:[e.jsx(w,{title:"Property",sub:"Used on reports and replacement-cost lookups."}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{title:"Property name",hint:"Used on reports and claim packets.",children:e.jsx("input",{className:"w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]",value:x,onChange:l=>h(l.target.value)})}),e.jsx(v,{title:"Address",hint:"We use this for replacement-cost lookups.",children:j?e.jsxs("div",{className:"flex items-center gap-3 rounded-[9px] border border-emerald-200 bg-emerald-50/70 px-3.5 py-3",children:[e.jsx("div",{className:"grid size-8 shrink-0 place-items-center rounded-lg border border-emerald-200 bg-white text-emerald-700",children:e.jsx(K,{className:"size-4",strokeWidth:2})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-[var(--dash-ink)]",children:u}),e.jsx("div",{className:"text-[11.5px] text-emerald-700",children:"Verified"})]}),e.jsx("button",{type:"button",onClick:()=>g(void 0),className:"text-[12px] font-semibold text-[var(--dash-link)] hover:underline",children:"Edit"})]}):e.jsx(fe,{value:u,onChange:(l,q)=>{b(l),g(q)},placeholder:"Start typing an address...",className:"rounded-[9px] shadow-none"})}),e.jsx(v,{title:"Property type",hint:"Tunes room suggestions and valuation.",children:e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:m,onChange:l=>N(l.target.value),className:"w-full h-9 px-3 pr-9 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] appearance-none focus:outline-none focus:border-[var(--dash-ink)]",children:De.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx(z,{className:"h-3.5 w-3.5 text-[var(--dash-ink-subtle)] absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",strokeWidth:1.8})]})}),e.jsx(v,{title:"Insurance",hint:"Optional. Speeds up claim packets.",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(U,{children:"Provider"}),e.jsx("input",{value:c,onChange:l=>o(l.target.value),placeholder:"State Farm",className:"mt-1.5 w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]"})]}),e.jsxs("div",{children:[e.jsx(U,{children:"Policy number"}),e.jsx("input",{value:f,onChange:l=>C(l.target.value),placeholder:"HO-123456789",className:"mt-1.5 w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]"})]}),e.jsxs("div",{children:[e.jsx(U,{children:"Claim number"}),e.jsx("input",{value:y,onChange:l=>P(l.target.value),placeholder:"CLM-123456789",className:"mt-1.5 w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]"})]})]})}),e.jsx(v,{title:"Policy documents",hint:"Upload the policy and review its extracted details.",children:e.jsx(ae,{propertyId:n,readOnly:(r==null?void 0:r.accessMode)==="shared-readonly",onApplyPolicy:l=>{l.carrier&&o(l.carrier),l.policyNumber&&C(l.policyNumber)}})}),V&&e.jsx("div",{className:"rounded-[10px] border border-[var(--dash-danger-border)] bg-[var(--dash-danger-bg)] p-3 text-[12.5px] text-[var(--dash-danger)]",children:V}),e.jsx(J,{dirty:X,saving:Q,saved:Y,onSave:ee,onReset:se}),e.jsxs("div",{className:"rounded-[12px] border border-[var(--dash-danger-border)] bg-[var(--dash-danger-bg)] p-5",children:[e.jsx("div",{className:"text-[13px] font-semibold text-[var(--dash-danger)]",children:"Delete property"}),e.jsx("div",{className:"mt-1 text-[11.5px] text-[var(--dash-danger)]/80",children:"Permanently removes this property and all its captures and items. This cannot be undone."}),Z?e.jsxs("div",{className:"mt-3 max-w-[400px]",children:[e.jsxs("div",{className:"text-[12px] text-[var(--dash-ink-muted)] mb-1.5",children:["Type ",e.jsx("span",{className:"font-mono font-semibold",children:t==null?void 0:t.name})," to confirm"]}),e.jsx("input",{value:L,onChange:l=>B(l.target.value),className:"w-full h-9 px-3 rounded-[8px] border border-[var(--dash-danger-border-soft)] bg-white text-[13px] focus:outline-none",placeholder:(t==null?void 0:t.name)||""}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{T(!1),B("")},className:"h-8 px-3 rounded-[8px] border border-[var(--dash-hairline)] bg-white text-[12px] font-medium text-[var(--dash-ink)]",children:"Cancel"}),e.jsxs("button",{onClick:te,disabled:L!==(t==null?void 0:t.name)||$,className:"h-8 px-3 rounded-[8px] bg-[var(--dash-danger)] text-white text-[12px] font-semibold disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",children:[$?e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}):null,$?"Deletingâ¦":"Delete this property"]})]})]}):e.jsx("button",{onClick:()=>T(!0),className:"mt-3 h-8 px-3 rounded-[8px] border border-[var(--dash-danger-border-soft)] bg-white text-[12px] font-medium text-[var(--dash-danger)] hover:bg-[var(--dash-danger-bg-hover)]",children:"Delete property"})]})]})]})}function Xe(){const{workspaceMembers:n,currentWorkspaceId:s,currentWorkspace:a,authUser:r,profile:i}=W(),[t,p]=d.useState(""),[x,h]=d.useState("member"),[u,b]=d.useState(!1),[j,g]=d.useState(null),[m,N]=d.use
1State(null),c=async()=>{if(!s||!r)return;const o=t.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)){g("Enter a valid email address.");return}g(null),N(null),b(!0);try{const f=i!=null&&i.first_name?`${i.first_name}${i.last_name?" "+i.last_name:""}`:r.email,{invitations:C,errors:y}=await Ne(s,r.id,[{email:o,role:x}],a==null?void 0:a.name,f);y.length>0?g(y.join(" · ")):C.length>0&&(N(`Invitation sent to ${o}.`),p(""))}catch(f){g(f instanceof Error?f.message:"Failed to send")}finally{b(!1)}};return e.jsxs(k,{children:[e.jsx(w,{title:"Members",sub:"People who can view or edit this property's inventory and claims."}),e.jsx(v,{title:`${n.length} member${n.length===1?"":"s"}`,hint:"Owners can manage members and billing. Admins can edit. Read-only roles see the inventory but can't change it.",children:e.jsx("div",{className:"-mx-5 -mb-3 mt-1",children:n.length===0?e.jsx("div",{className:"px-5 py-6 text-[12.5px] text-[var(--dash-ink-subtle)] text-center",children:"No members yet."}):n.map(o=>{var y,P;const f=[o.profile.first_name,o.profile.last_name].filter(Boolean).join(" ")||o.profile.email,C=(((y=o.profile.first_name)==null?void 0:y[0])||o.profile.email[0]||"?").toUpperCase().concat((((P=o.profile.last_name)==null?void 0:P[0])||"").toUpperCase());return e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-t border-[var(--dash-surface-active)]",children:[o.profile.avatar_url?e.jsx(M,{src:o.profile.avatar_url,className:"h-8 w-8 rounded-full object-cover",alt:""}):e.jsx("div",{className:"h-8 w-8 rounded-full bg-[var(--dash-surface-active)] text-[var(--dash-ink-muted)] flex items-center justify-center text-[11px] font-semibold",children:C}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-medium truncate",children:f}),e.jsx("div",{className:"text-[11.5px] text-[var(--dash-ink-subtle)] truncate",children:o.profile.email})]}),e.jsx("div",{className:"text-[11.5px] text-[var(--dash-ink-muted)] w-44 capitalize",children:o.role}),e.jsx("span",{className:"text-[11px] text-[var(--dash-success)]",children:"â Active"})]},o.id)})})}),e.jsx("div",{className:"mt-4",children:e.jsxs(v,{title:"Invite a member",hint:"They'll get an email link to join this workspace.",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{value:t,onChange:o=>p(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},placeholder:"[email protected]",className:"w-full h-9 px-3 rounded-[8px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]",disabled:u})}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:x,onChange:o=>h(o.target.value),disabled:u,className:"w-44 h-9 pl-3 pr-9 rounded-[8px] border border-[var(--dash-hairline-strong)] bg-white text-[12.5px] appearance-none focus:outline-none focus:border-[var(--dash-ink)]",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"})]}),e.jsx(z,{className:"h-3.5 w-3.5 text-[var(--dash-ink-subtle)] absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",strokeWidth:1.8})]}),e.jsx(S,{kind:"blue",onClick:c,disabled:u||t.trim().length===0,children:u?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}),"Sendingâ¦"]}):"Send invite"})]}),j&&e.jsx("div",{className:"mt-2 text-[11.5px] text-[var(--dash-danger)]",children:j}),m&&e.jsx("div",{className:"mt-2 text-[11.5px] text-[var(--dash-success)]",children:m})]})})]})}function es(){const{propertyId:n=""}=_(),s=D(),{data:a}=E(n),r=re(n),[i,t]=d.useState(!1),{batches:p,activeJobs:x}=r.data;return e.jsxs(k,{children:[e.jsx(w,{title:"Capture"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{title:"Mobile link",hint:"Send a one-time capture link for this property.",children:e.jsx(S,{kind:"blue",onClick:()=>t(!0),disabled:!(a!=null&&a.property),children:"Generate link"})}),e.jsxs("div",{className:"rounded-[12px] border border-[var(--dash-hairline)] bg-white overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3.5 border-b border-[var(--dash-surface-active)] flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-semibold",children:"Captures"}),e.jsxs("div",{className:"mt-0.5 text-[12px] text-[var(--dash-ink-muted)]",children:[p.length+x.length," total"]})]}),e.jsx(S,{onClick:()=>s(`/properties/${n}/captures`),children:"View all"})]}),r.loading&&p.length===0&&x.length===0?e.jsxs("div",{className:"px-4 py-5 flex items-center gap-2 text-[12.5px] text-[var(--dash-ink-subtle)]",children:[e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}
1),"Loading captures..."]}):p.length===0&&x.length===0?e.jsx("div",{className:"px-4 py-8 text-center text-[13px] text-[var(--dash-ink-muted)]",children:"No captures yet."}):e.jsxs("div",{className:"divide-y divide-[var(--dash-surface-active)]",children:[x.map(h=>e.jsxs("div",{className:"px-4 py-3 flex items-center gap-3",children:[e.jsx("div",{className:"h-12 w-12 rounded-[10px] bg-[var(--dash-surface-alt)] flex items-center justify-center shrink-0",children:e.jsx(I,{className:"h-4 w-4 animate-spin text-[var(--dash-ink-muted)]"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-semibold text-[var(--dash-ink)] truncate",children:"Processing capture"}),e.jsx("div",{className:"mt-0.5 text-[12px] text-[var(--dash-ink-muted)] truncate",children:h.message||h.step||"Processing"})]})]},h.jobId)),p.slice(0,6).map(h=>e.jsxs("button",{type:"button",onClick:()=>s(`/properties/${n}/captures`),className:"w-full px-4 py-3 text-left flex items-center gap-3 hover:bg-[var(--dash-surface-muted)]",children:[e.jsx("div",{className:"h-12 w-12 rounded-[10px] overflow-hidden bg-[var(--dash-surface-alt)] border border-[var(--dash-hairline)] shrink-0",children:h.originalImageUrl?e.jsx(M,{src:h.originalImageUrl,className:"h-full w-full object-cover",alt:""}):e.jsx(G,{className:"h-5 w-5 m-3 text-[var(--dash-ink-subtle)]",strokeWidth:1.7})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-semibold text-[var(--dash-ink)] truncate",children:h.dominantRoom||"Capture"}),e.jsxs("div",{className:"mt-0.5 text-[12px] text-[var(--dash-ink-muted)] truncate",children:[h.itemCount," items · ",ne(h.createdAt)||"Recent"]})]}),e.jsx("div",{className:"shrink-0 text-[11px] text-[var(--dash-ink-muted)]",children:ie(h.status)})]},h.id)),p.length>6&&e.jsxs("button",{type:"button",onClick:()=>s(`/properties/${n}/captures`),className:"w-full px-4 py-3 text-center text-[12.5px] font-medium text-[var(--dash-link)] hover:bg-[var(--dash-surface-muted)]",children:["View ",p.length-6," more"]})]}),r.error&&e.jsx("div",{className:"px-4 py-3 border-t border-[var(--dash-surface-active)] text-[12px] text-[var(--dash-danger)]",children:"Could not load captures."})]})]}),i&&(a==null?void 0:a.property)&&e.jsx(je,{propertyId:a.property.id,propertyName:a.property.name,onClose:()=>t(!1)})]})}function ss(){return e.jsxs(k,{children:[e.jsx(w,{title:"AI & valuation",sub:"How Valyn estimates replacement cost (RCV) and actual cash value (ACV)."}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(v,{title:"Item valuation",hint:"A simple, reviewable calculation for every line item.",children:e.jsxs("div",{className:"flex flex-col gap-4 text-[12.5px] leading-relaxed text-[var(--dash-ink-muted)]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-[var(--dash-ink)]",children:"1. Replacement cost"}),e.jsx("p",{className:"mt-1",children:"Valyn estimates the current cost to replace the item with a comparable new item."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-[var(--dash-ink)]",children:"2. Depreciation percentage"}),e.jsx("p",{className:"mt-1",children:"Each item has one editable depreciation percentage. Reviewers can adjust it directly on the item."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-[var(--dash-ink)]",children:"3. Actual cash value"}),e.jsx("p",{className:"mt-1",children:"ACV updates automatically from RCV and the depreciation percentage."})]})]})}),e.jsx(v,{title:"Calculation",hint:"Effective age, useful life, and condition adjustments are not part of the claims value calculation.",children:e.jsxs("div",{className:"rounded-[10px] bg-[var(--dash-surface-muted)] p-4",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.07em] text-[var(--dash-ink-subtle)]",children:"ACV = RCV à (1 â depreciation percentage)"}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3 text-center tabular-nums",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] text-[var(--dash-ink-subtle)]",children:"RCV"}),e.jsx("div",{className:"mt-1 text-[18px] font-semibold",children:"$1,500"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] text-[var(--dash-ink-subtle)]",children:"Depreciation"}),e.jsx("div",{className:"mt-1 text-[18px] font-semibold",children:"60%"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] text-[var(--dash-ink-subtle)]",children:"ACV"}),e.jsx("div",{className:"mt-1 text-[18px] font-semibold",children:"$600"})]})]})]})})]})]})}const Re=[{key:"capture_completed",name:"Capture completed",hint:"When a walkthrough finishes processing."},{key:"new_items_detected",name:"New items detected",hint:"When AI finds items in an upload."}
1,{key:"claim_packet_created",name:"Claim packet created",hint:"When a new claim packet is generated."},{key:"access_granted",name:"Read-only access granted",hint:"When an adjuster or agent gets access to your property."},{key:"weekly_summary",name:"Weekly summary",hint:"Inventory & coverage roundup."}];function ts(){const{authUser:n,profile:s,refreshProfile:a}=W(),r=d.useMemo(()=>ce(s==null?void 0:s.email_notifications),[s]),[i,t]=d.useState(r),[p,x]=d.useState(!1),[h,u]=d.useState(!1),[b,j]=d.useState(null);d.useEffect(()=>{t(r),u(!1)},[r]);const g=d.useMemo(()=>Object.keys(r).some(c=>i[c]!==r[c]),[i,r]),m=(c,o)=>{t(f=>({...f,[c]:o})),u(!1)},N=async()=>{if(!n||!g)return;j(null),x(!0);const{error:c}=await ve(n.id,{email_notifications:i});if(x(!1),c){j(c.message);return}await a(),u(!0)};return e.jsxs(k,{children:[e.jsx(w,{title:"Notifications",sub:`Choose which Valyn events trigger an email. Sent from ${he}.`}),e.jsx(v,{title:"Email",hint:"Quiet hours below pause non-urgent emails during the window you set.",children:e.jsxs("div",{className:"-mx-5 -mb-3",children:[e.jsxs("div",{className:"grid grid-cols-12 px-5 py-2 text-[10.5px] uppercase tracking-[0.08em] text-[var(--dash-ink-subtle)] font-medium border-t border-[var(--dash-surface-active)]",children:[e.jsx("div",{className:"col-span-9",children:"Event"}),e.jsx("div",{className:"col-span-3 text-center",children:"Email"})]}),Re.map(c=>e.jsxs("div",{className:"grid grid-cols-12 px-5 py-3 items-center border-t border-[var(--dash-surface-active)]",children:[e.jsxs("div",{className:"col-span-9",children:[e.jsx("div",{className:"text-[13px] font-medium",children:c.name}),e.jsx("div",{className:"text-[11.5px] text-[var(--dash-ink-subtle)]",children:c.hint})]}),e.jsx("div",{className:"col-span-3 flex justify-center",children:e.jsx("button",{onClick:()=>m(c.key,!i[c.key]),"aria-label":`Toggle ${c.name}`,className:"cursor-pointer",children:e.jsx(H,{on:!!i[c.key]})})})]},c.key))]})}),e.jsx("div",{className:"mt-4",children:e.jsx(v,{title:"Quiet hours",hint:"Pauses non-urgent emails between these times. We'll still send things like password resets immediately.",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("quiet_hours_enabled",!i.quiet_hours_enabled),"aria-label":"Toggle quiet hours",className:"cursor-pointer",children:e.jsx(H,{on:!!i.quiet_hours_enabled})}),e.jsx("span",{className:"text-[13px]",children:i.quiet_hours_enabled?"On":"Off"})]}),i.quiet_hours_enabled&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-[400px]",children:[e.jsxs("div",{children:[e.jsx(U,{children:"Start"}),e.jsx("input",{type:"time",value:i.quiet_hours_start,onChange:c=>m("quiet_hours_start",c.target.value),className:"mt-1.5 w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]"})]}),e.jsxs("div",{children:[e.jsx(U,{children:"End"}),e.jsx("input",{type:"time",value:i.quiet_hours_end,onChange:c=>m("quiet_hours_end",c.target.value),className:"mt-1.5 w-full h-9 px-3 rounded-[9px] border border-[var(--dash-hairline-strong)] bg-white text-[13px] focus:outline-none focus:border-[var(--dash-ink)]"})]})]})]})})}),b&&e.jsx("div",{className:"mt-3 rounded-[10px] border border-[var(--dash-danger-border)] bg-[var(--dash-danger-bg)] p-3 text-[12.5px] text-[var(--dash-danger)]",children:b}),e.jsx(J,{dirty:g,saving:p,saved:h,onSave:N,onReset:()=>t(r)})]})}function as(){const n=D();return e.jsxs(k,{children:[e.jsx(w,{title:"Billing",sub:"Workspace billing and payment method live under Workspace · Billing."}),e.jsx(v,{title:"Workspace billing",hint:"$25 per property scan after the first free one.",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[12.5px] text-[var(--dash-ink-muted)]",children:"Manage your card on file, scan history, and invoices from the workspace billing page."}),e.jsx(S,{kind:"blue",onClick:()=>n("/billing"),children:"Open billing"})]})})]})}function rs(){const n=D();return e.jsxs(k,{children:[e.jsx(w,{title:"Danger Zone",sub:"Destructive actions for this property. These can't be und
1one."}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-[12px] border border-[var(--dash-danger-border)] bg-white overflow-hidden",children:e.jsxs("div",{className:"p-5 flex items-start gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-[14px] font-semibold text-[var(--dash-ink)]",children:"Archive property"}),e.jsx("div",{className:"mt-1 text-[12px] text-[var(--dash-ink-muted)]",children:"Hide this property from your active list. Inventory and claims are preserved."})]}),e.jsx("button",{className:"h-8 px-3 rounded-[8px] border border-[var(--dash-danger-border-soft)] bg-white text-[12px] font-medium text-[var(--dash-danger)] hover:bg-[var(--dash-danger-bg-hover)]",children:"Archive"})]})}),e.jsx("div",{className:"rounded-[12px] border border-[var(--dash-danger-border)] bg-[var(--dash-danger-bg)] overflow-hidden",children:e.jsxs("div",{className:"p-5",children:[e.jsx("div",{className:"text-[14px] font-semibold text-[var(--dash-danger)]",children:"Delete property"}),e.jsxs("div",{className:"mt-1 text-[12px] text-[var(--dash-danger)]/85",children:["Use the delete control on ",e.jsx("button",{onClick:()=>n("property"),className:"underline font-medium",children:"Settings · Property"})," for the typed-confirmation flow."]})]})})]})]})}export{ss as SettingsAIPage,as as SettingsBillingPage,es as SettingsCapturePage,rs as SettingsDangerPage,Ye as SettingsGeneralPage,Qe as SettingsIndexPage,Xe as SettingsMembersPage,ts as SettingsNotificationsPage,Ze as SettingsPropertyPage};
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.