1import{z as de,aG as z,a as oe,aM as me,r as V,aE as G,j as e,C as f,b as N,c as b,F as H,aS as v,d as w,B as c,aI as Z,q as Qe,e as k,i as ce,ao as ae,O as We,a7 as Ze,bo as Ke,x as Je,h as ze,p as Ge,b1 as pe,bM as Xe,bn as De,b2 as je,b3 as ye,b4 as fe,b5 as Ne,L as $,N as K,b7 as be,b_ as ve,cX as we,b$ as ke,c0 as Se,c1 as Ce,c2 as Ae,c3 as Pe,c4 as Te,c5 as Ee,a5 as es,f as ss,W as as,aH as ts,aN as rs,bR as ns,bz as ls,bA as is,bB as cs,by as Fe,bw as Le,k as q,aZ as Me,ah as I,bN as te,y as W,Z as ds,bj as re,bp as Oe,g as Re,$ as os,Y as X,cY as ms,bv as Ie}from"./index-DGo-vssZ.js";import{r as g,L as P}from"./vendor-Qgthw7N1.js";import{F as xs}from"./file-spreadsheet-BLcWv5CC.js";import{A as hs}from"./activity-BpWmCysw.js";import{C as gs}from"./checkbox-i5ygXx_L.js";import{K as _e}from"./key-BMkuqIiD.js";import{M as us}from"./MobileActionSheet-8J59SiMq.js";import{C as $e}from"./camera-CX18FS0H.js";import{S as ne}from"./sun-B-34ysY4.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ue=de("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** 7 * @license lucide-react v0.453.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const le=de("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** 12 * @license lucide-react v0.453.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ie=de("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);async function ps(a){return await(await z("POST","/api/statements/generate",{taxYear:typeof a=="number"?a:parseInt(a,10)})).json()}async function js(){return(await z("GET","/api/statements")).json()}async function ys(a){const l=await fetch(`/api/statements/download/${a}`,{credentials:"include"});if(!l.ok)throw new Error("Failed to download statement");return l.blob()}async function fs(a){const l=typeof a=="number"?a:parseInt(a,10),y=await fetch(`/api/statements/csv/${l}`,{credentials:"include"});if(!y.ok)throw new Error("Failed to download CSV");return y.blob()}async function Ns(a){await z("DELETE",`/api/statements/${a}`)}async function bs(){return(await z("GET","/api/statements/available-years")).json()}function Ye(){const{toast:a}=oe();me();const[l,y]=g.useState(null),{data:u,isLoading:T}=V({queryKey:["/api/statements/available-years"],queryFn:async()=>await bs()}),{data:o,isLoading:S,refetch:E}=V({queryKey:["/api/statements"],queryFn:async()=>await js()}),A=G({mutationFn:async t=>await ps(t),onSuccess:t=>{var m;const h=(m=t==null?void 0:t.statement)==null?void 0:m.taxYear;h?a({title:"Statement Generated",description:`Tax year ${h} statement has been generated successfully`}):(console.warn("â ï¸ [Statements] No taxYear found in response, using fallback message"),a({title:"Statement Generated",description:"Your statement has been generated successfully"})),E()},onError:t=>{console.error("â [Statements] Statement generation failed:",t),a({title:"Generation Failed",description:t.message||"Failed to generate statement",variant:"destructive"})}}),x=G({mutationFn:async t=>{await Ns(t)},onSuccess:()=>{a({title:"Statement Deleted",description:"Statement has been deleted successfully"}),E()},onError:t=>{a({title:"Delete Failed",description:t.message||"Failed to delete statement",variant:"destructive"})}}),L=async(t,h)=>{try{const m=await ys(t),p=window.URL.createObjectURL(m),r=document.createElement("a");r.href=p,r.download=`REPSShield_Statement_${h}.pdf`,document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(p),document.body.removeChild(r),a({title:"Download Started",description:"Your statement is being downloaded"})}catch(m){a({title:"Download Failed",description:m.message||"Failed to download statement",variant:"destructive"})}},U=async t=>{try{const h=await fs(t),m=window.URL.createObjectURL(h),p=document.createElement("a");p.href=m,p.download=`REPSShield_Entries_${t}.csv`,document.body.appendChild(p),p.click(),window.URL.revokeObjectURL(m),document.body.removeChild(p),a({title:"CSV Download Started",description:`Your ${t} entries CSV is being downloaded`})}catch(h){a({title:"CSV Download Failed",description:h.message||"Failed to download CSV",variant:"destructive"})}},C=t=>{A.mutate(t)},j=t=>{window.confirm("Are you sure you want to delete this statement?")&&x.mutate(t)},M=new Date().getFullYear(),F=((u==null?void 0:u.years)||[]).map(t=>typeof t=="string"?parseInt(t,10):t);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(f,{className:"border-blue-200 dark:border-blue-800",children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg",children:[e.jsx(H,{className:"h-5 w-5 mr-2 text-blue-600"}),"Generate Statement"]}),e.jsx(v,{children:l?`Create a formal tax year statement for ${l}`:"Select a year from the available tax years below to generate a statement"})]}),e.jsx(w,{children:e.jsx(c,{onClick:()=>l&&C(l),disabled:!l||A.isPending||T,className:"w-full",children:A.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"h-4 w-4 mr-2"}),"Generate ",l?`${l} Statement`:"Statement"]})})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg",children:[e.jsx(Qe,{className:"h-5 w-5 mr-2 text-green-600"}),"Available Tax Years"]}),e.jsx(v,{children:"Years with logged time entries"})]}),e.jsx(w,{children:T?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(Z,{className:"h-6 w-6 animate-spin text-gray-400"})}):F.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:F.map(t=>e.jsxs(k,{variant:l===t?"default":t===M?"secondary":"outline",className:"text-sm px-3 py-1 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onClick:()=>y(t),children:[t===M&&e.jsx(ce,{className:"h-3 w-3 mr-1"}),t]},t))}):e.jsxs("div",{className:"text-center py-4 text-gray-500",children:[e.jsx(ae,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),e.jsx("p",{className:"text-sm",children:"No time entries found"}),e.jsx("p",{className:"text-xs mt-1",children:"Start logging hours to generate statements"})]})})]})]}),e.jsx(We,{}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center",children:[e.jsx(H,{className:"h-5 w-5 mr-2"}),"Generated Statements"]}),e.jsx(v,{children:"Download or regenerate your tax year statements"})]}),e.jsx(w,{children:S?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Z,{className:"h-8 w-8 animate-spin text-gray-400"})}):o&&o.length>0?e.jsx("div",{className:"space-y-4",children:o.map(t=>{const h=t.taxYear===M,m=parseFloat(t.totalHours),p=m>=750;return e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[e.jsxs("div",{className:"flex flex-col gap-4 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap",children:[e.jsx(k,{variant:h?"default":"secondary",className:"text-sm whitespace-nowrap",children:h?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"h-3 w-3 mr-1"}),"Current Year"]}):t.taxYear}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"font-semibold text-base sm:text-lg",children:["Tax Year ",t.taxYear]}),e.jsxs("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:["Generated:"," ",Ze(new Date(t.generatedAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.pdfDownloadToken&&e.jsx(c,{size:"sm",variant:"outline",onClick:()=>L(t.pdfDownloadToken,t.taxYear),title:"Download PDF Statement",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50 min-h-[44px] px-4",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>U(t.taxYear),title:"Download CSV of Entries",className:"text-green-600 hover:text-green-700 hover:bg-green-50 min-h-[44px] px-4",children:e.jsx(xs,{className:"h-4 w-4"})}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>C(t.taxYear),disabled:A.isPending,title:"Regenerate Statement",className:"min-h-[44px] px-4",children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>j(t.id),disabled:x.isPending,className:"text-red-600 hover:text-red-700 hover:bg-red-50 min-h-[44px] px-4",title:"Delete Statement",children:e.jsx(Ke,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hs,{className:"h-4 w-4 text-blue-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Total Hours"}),e.jsx("p",{className:"text-lg font-semibold",children:m.toFixed(1)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Material Hours"}),e.jsx("p",{className:"text-lg font-semibold",children:parseFloat(t.materialParticipationHours).toFixed(1)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p?e.jsx(ze,{className:"h-4 w-4 text-green-600"}):e.jsx(ae,{className:"h-4 w-4 text-orange-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"REP Status"}),e.jsx("p",{className:`text-lg font-semibold ${p?"text-green-600":"text-orange-600"}`,children:p?"â Qualified":"In Progress"})]})]})]})]},t.id)})}):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(H,{className:"h-12 w-12 mx-auto mb-3 text-gray-400"}),e.jsx("p",{className:"text-lg font-medium",children:"No statements generated yet"}),e.jsx("p",{className:"text-sm mt-2",children:"Generate your first tax year statement to get started"})]})})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ae,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"Important Information"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsx("li",{children:"⢠Statements are generated based on all time entries for the selected tax year"}),e.jsx("li",{children:"⢠You can regenerate statements if you add or modify time entries"}),e.jsx("li",{children:"⢠Download links expire after 7 days for security"}),e.jsx("li",{children:"⢠Keep your statements for IRS audit purposes (recommended 3-7 years)"})]})]})]})})]})}const vs=[{value:"time_entries:read",label:"Time Entries â Read",description:"List and filter time entries"},{value:"time_entries:write",label:"Time Entries â Write",description:"Create and update time entries"},{value:"properties:read",label:"Properties â Read",description:"List properties for lookup"},{value:"reports:read",label:"Reports â Read",description:"Read trial, activation, and app-health reporting data",adminOnly:!0}];function ws({text:a}){const[l,y]=g.useState(!1),u=async()=>{await navigator.clipboard.writeText(a),y(!0),setTimeout(()=>y(!1),2e3)};return e.jsx(c,{variant:"outline",size:"sm",onClick:u,className:"shrink-0",children:l?e.jsx(ss,{className:"h-4 w-4 text-green-500"}):e.jsx(as,{className:"h-4 w-4"})})}function ks({selected:a,onChange:l,isAdmin:y=!1}){const u=o=>{l(a.includes(o)?a.filter(S=>S!==o):[...a,o])},T=vs.filter(o=>!o.adminOnly||y);return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave all unchecked for an unrestricted key (full access)."}),T.map(({value:o,label:S,description:E})=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-2.5 cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsx(gs,{checked:a.includes(o),onCheckedChange:()=>u(o),className:"mt-0.5"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:S}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:E})]})]},o))]})}function Ss({scopes:a}){return a.length===0?e.jsx(k,{variant:"secondary",className:"text-xs font-normal",children:"unrestr
16icted"}):e.jsx(e.Fragment,{children:a.map(l=>e.jsx(k,{variant:"outline",className:"font-mono text-xs",children:l},l))})}function qe(){const{toast:a}=oe(),l=me(),{isAdmin:y}=Ge(),[u,T]=g.useState(!1),[o,S]=g.useState(""),[E,A]=g.useState([]),[x,L]=g.useState(null),[U,C]=g.useState(!1),{data:j=[],isLoading:M}=V({queryKey:["/api/api-keys"],queryFn:async()=>{const r=await fetch("/api/api-keys",{credentials:"include"});if(!r.ok)throw new Error("Failed to fetch API keys");return r.json()}}),F=G({mutationFn:async({name:r,scopes:_})=>(await z("POST","/api/api-keys",{name:r,scopes:_})).json(),onSuccess:r=>{l.invalidateQueries({queryKey:["/api/api-keys"]}),L(r),T(!1),S(""),A([]),C(!0)},onError:()=>{a({title:"Failed to create API key",variant:"destructive"})}}),t=G({mutationFn:async r=>(await z("POST",`/api/api-keys/${r}/rotate`)).json(),onSuccess:r=>{l.invalidateQueries({queryKey:["/api/api-keys"]}),L(r),C(!0)},onError:()=>{a({title:"Failed to rotate API key",variant:"destructive"})}}),h=G({mutationFn:async r=>{await z("DELETE",`/api/api-keys/${r}`)},onSuccess:()=>{l.invalidateQueries({queryKey:["/api/api-keys"]}),a({title:"API key revoked"})},onError:()=>{a({title:"Failed to revoke API key",variant:"destructive"})}}),m=r=>r?new Date(r).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"â",p=()=>{o.trim()&&F.mutate({name:o.trim(),scopes:E})};return e.jsxs(e.Fragment,{children:[e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(_e,{className:"h-5 w-5 mr-2"}),"API Keys"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Generate API keys for external tools and AI agents. Assign scopes to limit what each key can do, or leave all scopes unchecked for full access."})]}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs(pe,{open:u,onOpenChange:r=>{T(r),r||(S(""),A([]))},children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(c,{size:"sm",className:"w-full sm:w-auto",children:[e.jsx(De,{className:"h-4 w-4 mr-2"}),"Create API Key"]})}),e.jsxs(je,{children:[e.jsxs(ye,{children:[e.jsx(fe,{children:"Create API Key"}),e.jsx(Ne,{children:"Give this key a memorable name and choose which scopes it should have."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"key-name",children:"Key name"}),e.jsx(K,{id:"key-name",placeholder:"e.g. My AI Agent, Cursor, n8n workflow",value:o,onChange:r=>S(r.target.value),onKeyDown:r=>{r.key==="Enter"&&p()}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{children:"Scopes"}),e.jsx(ks,{selected:E,onChange:A,isAdmin:y})]})]}),e.jsxs(be,{children:[e.jsx(c,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),e.jsx(c,{onClick:p,disabled:!o.trim()||F.isPending,children:F.isPending?"Creatingâ¦":"Create"})]})]})]}),M?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loadingâ¦"}):j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No API keys yet. Create one to get started."}):e.jsx("div",{className:"space-y-2",children:j.map(r=>e.jsxs("div",{className:"rounded-lg border p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:r.name}),e.jsxs(k,{variant:"outline",className:"font-mono text-xs",children:[r.keyPrefix,"â¦"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Created ",m(r.createdAt),r.lastUsedAt&&e.jsxs(e.Fragment,{children:[" · Last used ",m(r.lastUsedAt)]}),r.expiresAt&&e.jsxs(e.Fragment,{children:[" · Expires ",m(r.expiresAt)]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,children:e.jsx(c,{variant:"ghost",size:"sm",title:"Rotate key",disabled:t.isPending,children:e.jsx(Z,{className:"h-4 w-4"})})}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsx(Ce,{children:"Rotate API Key?"}),e.jsxs(Ae,{children:["The current key for ",e.jsx("strong",{children:r.name})," (",r.keyPrefix,"â¦) will be revoked immediately and a new key will be issued with the same scopes. Any tool using the old key will break until you update it."]})]}),e.jsxs(Pe,{children:[e.jsx(Te,{children:"Cancel"}),e.jsx(Ee,{onClick:()=>t.mutate(r.id),children:"Rotate"})]})]})]}),e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,children:e.jsx(c,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",title:"Revoke key",children:e.jsx(Ke,{className:"h-4 w-4"})})}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsx(Ce,{children:"Revoke API Key?"}),e.jsxs(Ae,{children:["Any tool using ",e.jsx("strong",{children:r.name})," (",r.keyPrefix,"â¦) will immediately lose access. This cannot be undone."]})]}),e.jsxs(Pe,{children:[e.jsx(Te,{children:"Cancel"}),e.jsx(Ee,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>h.mutate(r.id),children:"Revoke"})]})]})]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(Ss,{scopes:r.scopes??[]})})]},r.id))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["See the"," ",e.jsxs(P,{href:"/docs/api",className:"underline inline-flex items-center gap-0.5",children:["API documentation",e.jsx(es,{className:"h-3 w-3"})]})," ","for usage examples."]})]})]}),e.jsx(pe,{open:U,onOpenChange:C,children:e.jsxs(je,{children:[e.jsxs(ye,{children:[e.jsx(fe,{children:"Your new API key"}),e.jsxs(Ne,{children:["Copy this key now. For security, it will ",e.jsx("strong",{children:"never"})," be shown again."]})]}),e.jsxs("div",{className:"space-y-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{readOnly:!0,value:(x==null?void 0:x.key)??"",className:"font-mono text-sm"}),e.jsx(ws,{text:(x==null?void 0:x.key)??""})]}),x&&x.scopes.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground w-full",children:"Scopes:"}),x.scopes.map(r=>e.jsx(k,{variant:"outline",className:"font-mono text-xs",children:r},r))]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsx("p",{children:"Pass this as one of these headers:"}),e.jsxs("code",{className:"block bg-muted px-2 py-1 rounded text-xs break-all",children:["Authorization: Bearer ",(x==null?void 0:x.key)??"â¦"]}),e.jsxs("code",{className:"block bg-muted px-2 py-1 rounded text-xs break-all",children:["X-API-Key: ",(x==null?void 0:x.key)??"â¦"]})]})]}),e.jsx(be,{children:e.jsx(c,{onClick:()=>C(!1),children:"Done"})})]})})]})}function Us(){var ue;const{user:a,isAdmin:l}=Ge(),{hasActiveSubscription:y}=ts(),{toast:u}=oe(),T=rs(),o=me(),{startTour:S}=ns(),[E,A]=g.useState(!1),x=g.useCallback(async()=>{try{await ls("/api/logout",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})}catch{}await is(o,{force:!0}),cs("/logout-success")},[o]),{data:L}=V({queryKey:["/api/user/preferences"],queryFn:async()=>{const n=await fetch("/api/user/preferences",{credentials:"include"});if(!n.ok)throw new Error("Failed to fetch preferences");return n.json()}}),U=((ue=L==null?void 0:L.preferences)==null?void 0:ue.locationTrackingEnabled)??!1,C=G({mutationFn:async n=>{const i=await fetch("/api/user/preferences",{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({locationTrackingEnabled:n})});if(!i.ok)throw new Error("Failed to update preference");try{localStorage.setItem("geofence_optin_cache",JSON.stringify(n))}catch{}return i.json()},onSuccess:(n,i)=>{o.invalidateQueries({queryKey:["/api/user/preferences"]}),i?Fe.start().catch(console.error):Fe.stop().catch(console.error),u({title:i?"Location tracking enabled":"Location tracking disabled",description:i?"We'll detect visits to your properties and create pending time entries for your review.":"Backgroun
16d visit detection has been turned off."})},onError:()=>{u({title:"Error",description:"Failed to update location tracking preference.",variant:"destructive"})}}),[j,M]=g.useState("light"),[F,t]=g.useState("light");g.useEffect(()=>{const n=localStorage.getItem("theme")||"light";if(M(n),n==="system"){const i=window.matchMedia("(prefers-color-scheme: dark)").matches;t(i?"dark":"light")}else t(n)},[]),g.useEffect(()=>{if(j!=="system")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),i=Y=>{t(Y.matches?"dark":"light")};return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[j]);const h=n=>{M(n),localStorage.setItem("theme",n);const i=document.documentElement;n==="dark"?(i.classList.add("dark"),t("dark")):n==="light"?(i.classList.remove("dark"),t("light")):window.matchMedia("(prefers-color-scheme: dark)").matches?(i.classList.add("dark"),t("dark")):(i.classList.remove("dark"),t("light"))},[m,p]=g.useState(!1),[r,_]=g.useState((a==null?void 0:a.firstName)||""),[B,D]=g.useState((a==null?void 0:a.lastName)||""),[O,Be]=g.useState(!1),[ee,He]=g.useState(!1);g.useEffect(()=>{_((a==null?void 0:a.firstName)||""),D((a==null?void 0:a.lastName)||"")},[a]);const{data:s,isLoading:Ve}=V({queryKey:["/api/subscription/status"],retry:!1}),{data:d,isLoading:Cs}=V({queryKey:["/api/pricing"],retry:!1}),se=G({mutationFn:async n=>{const i=await fetch("/api/user/profile",{method:"POST",body:n});if(!i.ok)throw new Error("Failed to update profile");return i.json()},onSuccess:()=>{u({title:"Success",description:"Profile updated successfully"}),o.invalidateQueries({queryKey:["/api/auth/user"]})},onError:n=>{u({title:"Error",description:n.message,variant:"destructive"})}}),R=(()=>{if(s!=null&&s.isOnTrial&&(s!=null&&s.trialEndDate)){const n=new Date(s.trialEndDate),i=new Date,Y=n.getTime()-i.getTime(),J=Math.floor(Y/(1e3*60*60*24));return Math.max(0,J)}return null})(),xe=async n=>{var J;const i=(J=n.target.files)==null?void 0:J[0];if(!i)return;if(!i.type.startsWith("image/")){u({title:"Error",description:"Please select an image file",variant:"destructive"});return}if(i.size>5*1024*1024){u({title:"Error",description:"Image must be less than 5MB",variant:"destructive"});return}const Y=new FormData;Y.append("profileImage",i),p(!0);try{se.mutate(Y)}finally{p(!1)}},Q=(a==null?void 0:a.role)==="super_admin"?{label:"Super Admin",icon:q,color:"bg-purple-100 text-purple-800"}:(a==null?void 0:a.role)==="org_admin"?{label:"Organization Admin",icon:Re,color:"bg-blue-100 text-blue-800"}:{label:"Team Member",icon:Me,color:"bg-gray-100 text-gray-800"},he=Q.icon,ge=g.useCallback(()=>{if(O){const n=new FormData;n.append("firstName",r),n.append("lastName",B),se.mutate(n)}Be(!O)},[O,r,B,se]);return a?T?e.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 container-mobile",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 px-4 pt-6 pb-8",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(Le,{user:a,size:"lg"}),e.jsx(c,{size:"sm",className:"absolute -bottom-2 -right-2 rounded-full h-10 w-10 p-0 shadow-lg",disabled:m,onClick:()=>{var n;return(n=document.getElementById("photo-upload"))==null?void 0:n.click()},children:m?e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full"}):e.jsx($e,{className:"h-5 w-5"})}),e.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:xe})]}),e.jsxs("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:[r," ",B]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a.email}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsxs(k,{className:Q.color,children:[e.jsx(he,{className:"h-3 w-3 mr-1"}),Q.label]}),y&&e.jsxs(k,{className:"bg-green-100 text-green-800",children:[e.jsx(q,{className:"h-3 w-3 mr-1"}),"Premium"]})]})]})}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Profile"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:ge,className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Me,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:O?"Save Name":"Edit Name"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]}),O&&e.jsxs("div",{className:"px-4 pb-4 pt-2 space-y-3 bg-gray-50 dark:bg-gray-700/30",children:[e.jsxs("div",{children:[e.jsx($,{htmlFor:"firstName",className:"text-sm text-gray-600 dark:text-gray-300",children:"First Name"}),e.jsx(K,{id:"firstName",value:r,onChange:n=>_(n.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx($,{htmlFor:"lastName",className:"text-sm text-gray-600 dark:text-gray-300",children:"Last Name"}),e.jsx(K,{id:"lastName",value:B,onChange:n=>D(n.target.value),className:"mt-1"})]})]})]})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Subscription"})}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700",children:e.jsx(P,{href:"/manage-subscription",children:e.jsxs("button",{className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(te,{className:"h-5 w-5 text-gray-400 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Manage Subscription"}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:(s==null?void 0:s.subscriptionStatus)==="active"?"Premium Active":s!=null&&s.isOnTrial?`Trial - ${R} days left`:"Free Plan"})]})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400 flex-shrink-0 ml-2"})]})})})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Earnings"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsx(P,{href:"/affiliate/dashboard",children:e.jsxs("button",{className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px] border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Affiliate Dashboard"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]})}),e.jsx(P,{href:"/affiliate-program",children:e.jsxs("button",{className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ds,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Affiliate Program Info"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]})})]})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Appearance"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[j==="light"?e.jsx(ne,{className:"h-5 w-5 text-gray-400"}):j==="dark"?e.jsx(ie,{className:"h-5 w-5 text-gray-400"}):e.jsx(le,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Theme"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:()=>h("light"),className:`flex flex-col items-center gap-2 py-4 rounded-lg border-2 transition-all ${j==="light"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[e.jsx(ne,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium",children:"Light"})]}),e.jsxs("button",{onClick:()=>h("dark"),className:`flex flex-col items-center gap-2 py-4 rounded-lg border-2 transition-all ${j==="dark"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[e.jsx(ie,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium",children:"Dark"})]}),e.jsxs("button",{onClick:()=>h("system"),className:`flex flex-col items-center gap-2 py-4 rounded-lg border-2 transition-all ${j==="system"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[e.jsx(le,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium",children:"System"})]})]}),j==="system"&&e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 text-center",children:["Using ",F," mode"]})]})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Privacy & Location"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(re,{className:"h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Visit Detection"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-relaxed",children:"When enabled, REPSShield uses your device's location to detect when you arrive at and leave your rental properties. A pending activity entry is created for every qualifying visit â you review and approve each one before it counts toward your REPS hours."}),e.jsxs("ul",{className:"mt-2 space-y-1 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("li",{children:["⢠",e.jsx("span",{className:"font-medium",children:"What is tracked:"})," ","Arrival & departure at your saved properties"]}),e.jsxs("li",{children:["⢠",e.jsx("span",{className:"font-medium",children:"When:"})," Only while the app is installed and this toggle is on"]}),e.jsxs("li",{children:["⢠",e.jsx("span",{className:"font-medium",children:"How it's used:"})," ","Creates pending time entries for your review"]}
16),e.jsx("li",{children:"⢠Background tracking only fires within property geofences â nowhere else"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Enable visit detection"}),e.jsx(Oe,{checked:U,disabled:C.isPending,onCheckedChange:n=>C.mutate(n)})]})]})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Help & Support"})}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700",children:e.jsxs("button",{onClick:()=>{localStorage.removeItem("repshield_onboarding_completed"),S(),u({title:"Tour Started",description:"Follow the guided tour to learn about REPSShield features!"})},className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ue,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Interactive Tour"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]})})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Security"})}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"px-4 py-4 flex items-center justify-between min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Re,{className:"h-5 w-5 text-gray-400"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Google Authentication"}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"OAuth enabled"})]})]}),e.jsx(k,{variant:"outline",className:"bg-green-50 text-green-700 dark:bg-green-900/20 dark:text-green-400",children:"Active"})]})})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Developer"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>He(!ee),className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_e,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"API Keys"})]}),e.jsx(I,{className:`h-5 w-5 text-gray-400 transition-transform duration-200 ${ee?"rotate-90":""}`})]}),ee&&e.jsx("div",{className:"px-4 pb-4 border-t border-gray-200 dark:border-gray-700",children:e.jsx(qe,{})})]})]}),e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Documents"})}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:e.jsx(Ye,{})})]}),l&&e.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800",children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Administration"})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsx(P,{href:"/super-admin",children:e.jsxs("button",{className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px] border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Super Admin Panel"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]})}),e.jsx(P,{href:"/super-admin/affiliate-settings",children:e.jsxs("button",{className:"w-full flex items-center justify-between px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700/50 active:bg-gray-100 dark:active:bg-gray-700 transition-colors min-h-[56px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"text-base font-medium text-gray-900 dark:text-white",children:"Affiliate Settings"})]}),e.jsx(I,{className:"h-5 w-5 text-gray-400"})]})})]})]}),e.jsx("div",{className:"px-4 pb-8",children:e.jsx("button",{type:"button",onClick:()=>A(!0),className:"w-full rounded-xl border border-red-200 bg-white px-4 py-3.5 text-center text-sm font-bold text-red-600 transition hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2 active:scale-[0.99] dark:border-red-900 dark:bg-red-950/40 dark:text-red-400 dark:hover:bg-red-950/60",children:"Log Out"})}),e.jsx(us,{open:E,onOpenChange:A,title:"Log Out",message:"Are you sure you want to log out?",actions:[{label:"Log Out",destructive:!0,onClick:x}]})]}):e.jsxs("div",{className:"container-mobile py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white",children:"Settings"}),e.jsx("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-300 mt-2",children:"Manage your account settings and preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsx(b,{children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-lg sm:text-xl",children:"Profile Information"}),e.jsx(c,{variant:"outline",size:"sm",onClick:ge,children:O?"Save":"Edit"})]})}),e.jsx(v,{className:"text-sm sm:text-base",children:"Update your personal information and profile photo"})]}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:gap-6",children:[e.jsxs("div",{className:"relative mx-auto
16sm:mx-0",children:[e.jsx(Le,{user:a,size:"lg"}),e.jsx(c,{size:"sm",className:"absolute -bottom-2 -right-2 rounded-full h-8 w-8 p-0",disabled:m,onClick:()=>{var n;return(n=document.getElementById("photo-upload"))==null?void 0:n.click()},children:m?e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full"}):e.jsx($e,{className:"h-4 w-4"})}),e.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:xe})]}),e.jsxs("div",{className:"space-y-2 text-center sm:text-left w-full sm:w-auto",children:[e.jsx("h3",{className:"text-base sm:text-lg font-medium",children:"Profile Photo"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300",children:"Upload a new profile photo. Images should be square and under 5MB."}),e.jsxs(c,{variant:"outline",size:"sm",disabled:m,className:"w-full sm:w-auto",onClick:()=>{var n;return(n=document.getElementById("photo-upload"))==null?void 0:n.click()},children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),m?"Uploading...":"Upload Photo"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx($,{htmlFor:"firstName",children:"First Name"}),e.jsx(K,{id:"firstName",value:r,placeholder:"First name",disabled:!O,onChange:n=>_(n.target.value)})]}),e.jsxs("div",{children:[e.jsx($,{htmlFor:"lastName",children:"Last Name"}),e.jsx(K,{id:"lastName",value:B,placeholder:"Last name",disabled:!O,onChange:n=>D(n.target.value)})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx($,{htmlFor:"email",children:"Email Address"}),e.jsx(K,{id:"email",type:"email",defaultValue:a.email||"",disabled:!0})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(k,{className:Q.color,children:[e.jsx(he,{className:"h-3 w-3 mr-1"}),Q.label]}),y&&e.jsxs(k,{className:"bg-green-100 text-green-800",children:[e.jsx(q,{className:"h-3 w-3 mr-1"}),"Premium"]})]})]})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(te,{className:"h-5 w-5 mr-2"}),"Subscription Overview"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Your current subscription status and plan details"})]}),e.jsx(w,{children:Ve?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 border-t-transparent rounded-full"}),e.jsx("span",{className:"ml-2 text-gray-600",children:"Loading subscription details..."})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between p-4 sm:p-6 border rounded-lg bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-3 sm:space-x-4 w-full sm:w-auto",children:[e.jsx("div",{className:`p-3 rounded-full ${(s==null?void 0:s.subscriptionStatus)==="active"?"bg-green-100 dark:bg-green-900":(s==null?void 0:s.subscriptionStatus)==="suspended"?"bg-orange-100 dark:bg-orange-900":s!=null&&s.isOnTrial?"bg-blue-100 dark:bg-blue-900":s!=null&&s.hasManualPremiumAccess?"bg-purple-100 dark:bg-purple-900":"bg-gray-200 dark:bg-gray-600"}`,children:(s==null?void 0:s.subscriptionStatus)==="active"?e.jsx(ze,{className:"h-5 w-5 sm:h-6 sm:w-6 text-green-600"}):(s==null?void 0:s.subscriptionStatus)==="suspended"?e.jsx(X,{className:"h-5 w-5 sm:h-6 sm:w-6 text-orange-600"}):s!=null&&s.isOnTrial?e.jsx(ce,{className:"h-5 w-5 sm:h-6 sm:w-6 text-blue-600"}):s!=null&&s.hasManualPremiumAccess?e.jsx(q,{className:"h-5 w-5 sm:h-6 sm:w-6 text-purple-600"}):e.jsx(X,{className:"h-5 w-5 sm:h-6 sm:w-6 text-gray-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:(s==null?void 0:s.subscriptionStatus)==="active"?"Premium Subscription":(s==null?void 0:s.subscriptionStatus)==="suspended"?"Premium Subscription (Paused)":s!=null&&s.isOnTrial?"Free Trial":s!=null&&s.hasManualPremiumAccess?"Premium Access (Granted)":"Free Plan"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300",children:(s==null?void 0:s.subscriptionStatus)==="active"?(s==null?void 0:s.planType)==="annual_plan_variable"?`Annual plan - $${(s==null?void 0:s.annualPriceSelected)||((s==null?void 0:s.subscriptionTier)==="premium"?(d==null?void 0:d.premiumAnnualPrice)||279:(d==null?void 0:d.annualPriceMin)||100)}/year`:`Monthly plan - $${(s==null?void 0:s.subscriptionTier)==="premium"?(d==null?void 0:d.premiumMonthlyPrice)||29:(d==null?void 0:d.monthlyPrice)||10}/month`:(s==null?void 0:s.subscriptionStatus)==="suspended"?(s==null?void 0:s.planType)==="annual_plan_variable"?`Annual plan (paused) - $${(s==null?void 0:s.annualPriceSelected)||((s==null?void 0:s.subscriptionTier)==="premium"?(d==null?void 0:d.premiumAnnualPrice)||279:(d==null?void 0:d.annualPriceMin)||100)}/year`:`Monthly plan (paused) - $${(s==null?void 0:s.subscriptionTier)==="premium"?(d==null?void 0:d.premiumMonthlyPrice)||29:(d==null?void 0:d.monthlyPrice)||10}/month`:s!=null&&s.isOnTrial?R!==null?`${R} day${R!==1?"s":""} remaining`:"Active trial period":s!=null&&s.hasManualPremiumAccess?"Administrator granted access":"Limited access to basic features"})]})]}),e.jsx(k,{variant:(s==null?void 0:s.subscriptionStatus)==="active"||s!=null&&s.hasManualPremiumAccess?"default":(s==null?void 0:s.subscriptionStatus)==="suspended"||s!=null&&s.isOnTrial?"secondary":"outline",className:`text-sm px-3 py-1 ${(s==null?void 0:s.subscriptionStatus)==="active"||s!=null&&s.hasManualPremiumAccess?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":(s==null?void 0:s.subscriptionStatus)==="suspended"?"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200":s!=null&&s.isOnTrial?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":""}`,children:(s==null?void 0:s.subscriptionStatus)==="active"||s!=null&&s.hasManualPremiumAccess?"Premium":(s==null?void 0:s.subscriptionStatus)==="suspended"?"Paused":s!=null&&s.isOnTrial?"Trial":"Free"})]}),(s==null?void 0:s.isOnTrial)&&R!==null&&R<=3&&e.jsx("div",{className:"p-4 bg-orange-50 border border-orange-200 rounded-lg dark:bg-orange-900/20 dark:border-orange-800",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(X,{className:"h-5 w-5 text-orange-600 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-orange-800 dark:text-orange-200",children:"Trial ending soon"}),e.jsxs("p",{className:"text-sm text-orange-700 dark:text-orange-300 mt-1",children:["Your trial expires in ",R," day",R!==1?"s":"",". Upgrade to continue using premium features."]})]})]})}),(s==null?void 0:s.hasUsedTrial)&&!(s!=null&&s.isOnTrial)&&(s==null?void 0:s.subscriptionStatus)!=="active"&&!(s!=null&&s.hasManualPremiumAccess)&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg dark:bg-red-900/20 dark:border-red-800",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(X,{className:"h-5 w-5 text-red-600 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-red-800 dark:text-red-200",children:"Trial has expired"}),e.jsx("p",{className:"text-sm text-red-700 dark:text-red-300 mt-1",children:"Upgrade to a premium plan to continue accessing advanced features."})]})]})}),e.jsxs("div",{className:"pt-4",children:[e.jsx(P,{href:"/manage-subscription",children:e.jsxs(c,{variant:"default",size:"lg",className:"w-full sm:w-auto",children:[e.jsx(te,{className:"h-4 w-4 mr-2"}),"Manage Subscription"]})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:"Access detailed subscription management, billing history, and plan options."})]})]})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(W,{className:"h-5 w-5 mr-2"}),"Affiliate Program"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Earn 20% recurring commission by referring new users to REPSShield"})]}),e.jsx(w,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Join our affiliate program and earn a straightforward 20% recurring commission on every successful referral. Perfect for tax professionals, real estate coaches, and industry influencers."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(P,{href:"/affiliate/dashboard",children:e.jsxs(c,{className:"w-full sm:w-auto",children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"View Affiliate Dashboard"]})}),e.jsx(P,{href:"/affiliate-program",children:e.jsx(c,{variant:"outline",className:"w-full sm:w-auto",children:"Learn More About Program"})})]})]})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(H,{className:"h-5 w-5 mr-2"}),"Statements & Reports"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Generate and download end-of-year tax statements"})]}),e.jsx(w,{children:e.jsx(Ye,{})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsx(b,{className:"text-lg sm:text-xl",children:"Account Security"}),e.jsx(v,{className:"text-sm sm:text-base",children:"Manage your account security settings"})]}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between p-4 border rounded-lg gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:"Google Authentication"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300 mt-1",children:"You're signed in with Google OAuth"})]}),e.jsx(k,{variant:"outline",className:"bg-green-50 text-green-700",children:"Active"})]})})})]}),e.jsx(qe,{}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsx(b,{className:"text-lg sm:text-xl",children:"Appearance"}),e.jsx(v,{className:"text-sm sm:text-base",children:"Customize your app's appearance"})]}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx($,{className:"text-base font-medium",children:"Theme"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"Select your preferred color scheme"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs(c,{variant:j==="light"?"default":"outline",onClick:()=>h("light"),className:"flex flex-col items-center gap-2 h-auto py-4",children:[e.jsx(ne,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm",children:"Light"})]}),e.jsxs(c,{variant:j==="dark"?"default":"outline",onClick:()=>h("dark"),className:"flex flex-col items-center gap-2 h-auto py-4",children:[e.jsx(ie,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm",children:"Dark"})]}),e.jsxs(c,{variant:j==="system"?"default":"outline",onClick:()=>h("system"),className:"flex flex-col items-center gap-2 h-auto py-4",children:[e.jsx(le,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm",children:"System"})]})]}),j==="system"&&e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:["Currently using ",F==="dark"?"dark":"light"," ","mode based on your system preferences"]})]})})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(re,{className:"h-5 w-5 mr-2"}),"Privacy & Location"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Control how REPSShield uses your device location"})]}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(re,{className:"h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:"Visit Detection"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300 mt-1 leading-relaxed",children:"When enabled, REPSShield detects when you arrive at and leave your rental properties using background geofencing. A pending activity entry is created for every qualifying visit â you review and approve each one before it counts toward your REPS hours."})]})]}),e.jsxs("ul",{className:"ml-8 space-y-1 text-xs sm:text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"What is tracked:"})," ","Arrival & departure events at your saved properties only"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"When:"})," Only while this toggle is enabled and the app is installed"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"How it's used:"})," Creates pending time entries for your manual review"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"No background tracking"})," ","outside of your registered property geofences"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Enable visit detection"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:U?"Active â visits to your properties are being detected":"Off â no location data is collected"})]}),e.jsx(Oe,{checked:U,disabled:C.isPending,onCheckedChange:n=>C.mutate(n)})]})]})})})]}),e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(ms,{className:"h-5 w-5 mr-2"}),"Help & Support"]}),e.jsx(v,{className:"text-sm sm:text-base",children:"Get help using REPSShield and access guided tours"})]}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between p-4 border rounded-lg gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:"Interactive Tour"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300 mt-1",children:'Take a guided tour through all REPSShield features. Use this to restart the welcome tutorial if you previously selected "Do not show again".'})]}),e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>{localStorage.removeItem("repshield_onboarding_completed"),S(),u({title:"Tour Started",description:"Follow the guided tour to learn about REPSShield features!"})},className:"flex items-center w-full sm:w-auto",children:[e.jsx(Ue,{className:"h-4 w-4 mr-2"}),"Restart Tour"]})]})})})]}),l&&e.jsxs(f,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center text-lg sm:text-xl",children:[e.jsx(q,{className:"h-5 w-5 mr-2"}),"Administrative Access"]}
vendor: 1,046 bytes, line 16
16),e.jsx(v,{className:"text-sm sm:text-base",children:"Quick access to administrative features"})]}),e.jsx(w,{children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(P,{href:"/super-admin",children:e.jsxs(c,{variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Super Admin Panel"]})}),e.jsx(P,{href:"/super-admin/affiliate-settings",children:e.jsxs(c,{variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Affiliate Settings"]})})]})})]}),e.jsxs(f,{className:"border-red-200 dark:border-red-900",children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center gap-2 text-red-600 dark:text-red-400",children:[e.jsx(Ie,{className:"h-5 w-5"}),"Account Actions"]}),e.jsx(v,{className:"text-sm",children:"Sign out of your account on this device"})]}),e.jsx(w,{children:e.jsxs(c,{variant:"destructive",onClick:x,className:"w-full sm:w-auto",children:[e.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Log Out"]})})]})]})]}):null}export{Us 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.