PageSourceSearch

https://repsshield.com/assets/index-DGo-vssZ.js

js repsshield.com collected 2026-10-02 02:00:12 UTC 1,654,582 bytes, 659 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-DT41P0vB.js","assets/vendor-Qgthw7N1.js","assets/web-CNoyerdg.js","assets/web-kmhkKUni.js","assets/LandingPage-CpY9e08F.js","assets/building-wUoLfZZJ.js","assets/brain-B45HfaeR.js","assets/timer-DEA0yRXX.js","assets/useSEOMetaTags-DuPP1K7p.js","assets/useSchemaMarkup-CFsXJ2MT.js","assets/calendar-days-COgXMVIl.js","assets/activity-BpWmCysw.js","assets/LandingPreviewPage-BFauyJLJ.js","assets/PricingPage-d-MW6XDB.js","assets/minus-DxLgY3aB.js","assets/FeaturesPage-pn1Rv-VQ.js","assets/AboutPage-BVNHFNMk.js","assets/WhyRepsShieldPage-SA159hKp.js","assets/ComparisonPage-DMPdKll7.js","assets/REPSLogComparisonPage-VwxLE32v.js","assets/ChangelogPage-BwwMeoP8.js","assets/link-2-BPmLs3Hl.js","assets/ApiDocsPage-CHUb02qa.js","assets/key-BMkuqIiD.js","assets/TimeTrackingPage-_YnfPacG.js","assets/smartphone-BpAalAba.js","assets/mic-BX-3BXik.js","assets/MaterialParticipationPage-BWtz9Dr0.js","assets/AuditReadyReportingPage-yHnvHy4u.js","assets/award-BV9YrQ3O.js","assets/GoalProgressTrackerPage-CAMi-oR6.js","assets/bell-BgAmg4Oj.js","assets/MultiPropertySupportPage-Ds2dyHCm.js","assets/user-plus-CP6I1wqA.js","assets/PremiumFeaturesPage-Gk03PuVs.js","assets/ToolsIndexPage-BzeSR35Q.js","assets/share-C8joPG_r.js","assets/RentalCalculatorPage-BEfJO6hp.js","assets/chart-line-4Kbmewnn.js","assets/generateCategoricalChart-Ccg4ytiv.js","assets/LineChart-D1bfgCBJ.js","assets/BrrrCalculatorPage-CckvcML4.js","assets/RepStatusCalculatorPage-CfmTksfb.js","assets/circle-x--5-vDMIU.js","assets/RepStatusAuditScanPage-_ljnz2Xq.js","assets/file-spreadsheet-BLcWv5CC.js","assets/RepHoursTrackerPage-BT6xVRsW.js","assets/ExchangeTimerPage-DqNlnrnN.js","assets/AreaChart-CfNv0fRv.js","assets/differenceInDays-CrE7Wgja.js","assets/share-2-8n29V9oi.js","assets/ExchangeSharedPage-DXwPuBDP.js","assets/CostSegEstimatorPage-D90nCcQc.js","assets/CostSegEstimatorChatPage-DVRrvdxT.js","assets/BlogIndexPage-_T1lQLU_.js","assets/useBlogPosts-DsWQ2kvn.js","assets/api-DBoyQ-on.js","assets/BlogSidebar-CxShR7dj.js","assets/BlogCategoryPage-4WGb97PI.js","assets/BlogPostPage-D-WrB_nu.js","assets/RegisterPage-k5ifVQRv.js","assets/ForgotPasswordPage-C_THzFbZ.js","assets/ResetPasswordPage-DEjSjSDc.js","assets/LogoutSuccessPage-FcS1iM5p.js","assets/AcceptInvitePage-DoLwZuFU.js","assets/PrivacyPage-D39j4bdO.js","assets/database-XZnIdm5U.js","assets/phone-B9M8c3mC.js","assets/TermsPage-CzqkqI9Q.js","assets/AffiliateProgramPage-DNa8vIbD.js","assets/AffiliateSignupPage-BApRpjQV.js","assets/schema-D6YQS4W0.js","assets/diagnostics-BEoNHIuU.js","assets/public-diagnostics-6bKSQqGY.js","assets/debug-deployment-B9iloUGY.js","assets/AgenticOnboarding-O2_iyJeC.js","assets/ImapConnectionDialog-bvgeU80F.js","assets/ImapProviderPicker-IRBlFdn0.js","assets/index-B1ky1Hhc.js","assets/server-DuiuGkfi.js","assets/time-entries-DRwHCk_j.js","assets/memberService-B-f_co3d.js","assets/useMemberProfile-C1TnB_eM.js","assets/maximize-2-6AmOphWr.js","assets/file-image-DUgfxpHG.js","assets/use-transform-CDjFxHsE.js","assets/stats-C4Qbhp6A.js","assets/profile-Dfla2qZK.js","assets/MobileActionSheet-8J59SiMq.js","assets/camera-CX18FS0H.js","assets/dashboard-C0hhBF8c.js","assets/useParallelQueries-BP3is_yX.js","assets/CalendarDateRangeFilter-oz7Dy0YO.js","assets/differenceInMonths-Cb0HIyJb.js","assets/RepsClassificationSection-CqSsZHO1.js","assets/authUtils-CcDzk6i0.js","assets/useAutomation-B2DSQfVe.js","assets/automationService-OVbtW0oB.js","assets/MailActivityCard-CBdQYMfk.js","assets/checkbox-i5ygXx_L.js","assets/plug-zap-BZPclcEu.js","assets/CalendarView-B7MNTFos.js","assets/index-COtV6X2D.js","assets/filter-D8zDqrI6.js","assets/CalendarStatusLegend-XQseVSnX.js","assets/play-Du1KHNWc.js","assets/pause-BtInyhHa.js","assets/timeEntryService-DCnrU_uK.js","assets/toggle-group-CZTHaXSB.js","assets/MobileImapConnectSheet-h12j6IgX.js","assets/mobile-dashboard-calendar-BfM5YGIH.js","assets/mobile-dashboard-mail-giqHvrEA.js","assets/mobile-sync-settings-Cf6Iq4yL.js","assets/files-BeCv8a7K.js","assets/useFileAccessUrl-DT-HA0mT.js","assets/hard-drive-CZLUTk6_.js","assets/grid-3x3-C5a5Y6KW.js","assets/file-history-zy9TPtNn.js","assets/archive-CR8M3D3c.js","assets/super-admin-DsEb7_e5.js","assets/BlogAdminPage-BlfTy_uY.js","assets/save-vm4SLOwz.js","assets/sun-B-34ysY4.js","assets/message-circle-DLjqbKPV.js","assets/PieChart-DvPtr6vS.js","assets/test-tube-diagonal-CXQTMvzO.js","assets/organization-admin-XhFMe27z.js","assets/analytics-DZfAxZm8.js","assets/properties-new-BCkoiK3W.js","assets/mapbox-gl-DJUMvbgb.js","assets/mapbox-gl-Bc17DTGM.css","assets/PropertyDetailPage-C5mhyUfM.js","assets/activity-ledger-enhanced-zmIdZqQG.js","assets/team-BYOL3eP8.js","assets/automation-mhZxDjX1.js","assets/rules-management-CuTKPrt9.js","assets/SmartCalendarDialog-LZfabcAw.js","assets/rules-management-test-B4ffN99y.js","assets/RulesManagementSimplified-Y5US3rNH.js","assets/TestCalendar-BoXQfkDv.js","assets/test-dashboard-0jowPzQU.js","assets/affiliate-dashboard-CfSbolsf.js","assets/affiliate-settings-Dn90sCnG.js","assets/test-fixes-BFb
11bUgW.js","assets/file-preview-demo-BhyjUpDO.js","assets/settings-CnyRVw3g.js","assets/manage-subscription-CfEBFgen.js","assets/welcome-tour-DT1Afc98.js","assets/test-analytics-B3fyExw1.js","assets/web-BPWlRdnm.js","assets/web-CM4J8oWL.js"])))=>i.map(i=>d[i]);
2var R1=e=>{throw TypeError(e)};var cg=(e,t,n)=>t.has(e)||R1("Cannot "+n);var z=(e,t,n)=>(cg(e,t,"read from private field"),n?n.call(e):t.get(e)),Ie=(e,t,n)=>t.has(e)?R1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,r)=>(cg(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),rt=(e,t,n)=>(cg(e,t,"access private method"),n);var yh=(e,t,n,r)=>({set _(s){Se(e,t,s,n)},get _(){return z(e,t,r)}});import{r as m,f as Ia,c as Re,u as Pt,h as z0,L as De,S as Nf,i as it,R as du,g as H0,e as Yu}from"./vendor-Qgthw7N1.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var ST={exports:{}},qp={};/**
3 * @license React
4 * react-jsx-runtime.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var b$=m,w$=Symbol.for("react.element"),_$=Symbol.for("react.fragment"),k$=Object.prototype.hasOwnProperty,S$=b$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E$={key:!0,ref:!0,__self:!0,__source:!0};function ET(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)k$.call(t,r)&&!E$.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:w$,type:e,key:i,ref:o,props:s,_owner:S$.current}}qp.Fragment=_$;qp.jsx=ET;qp.jsxs=ET;ST.exports=qp;var a=ST.exports,NT,gy,M1=Ia;gy=M1.createRoot,NT=M1.hydrateRoot;var yc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ia,Ki,Rl,fT,N$=(fT=class extends yc{constructor(){super();Ie(this,ia);Ie(this,Ki);Ie(this,Rl);Se(this,Rl,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,Ki)||this.setEventListener(z(this,Rl))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ki))==null||t.call(this),Se(this,Ki,void 0))}setEventListener(t){var n;Se(this,Rl,t),(n=z(this,Ki))==null||n.call(this),Se(this,Ki,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){z(this,ia)!==t&&(Se(this,ia,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof z(this,ia)=="boolean"?z(this,ia):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ia=new WeakMap,Ki=new WeakMap,Rl=new WeakMap,fT),W0=new N$,C$={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yi,U0,pT,j$=(pT=class{constructor(){Ie(this,Yi,C$);Ie(this,U0,!1)}setTimeoutProvider(e){Se(this,Yi,e)}setTimeout(e,t){return z(this,Yi).setTimeout(e,t)}clearTimeout(e){z(this,Yi).clearTimeout(e)}setInterval(e,t){return z(this,Yi).setInterval(e,t)}clearInterval(e){z(this,Yi).clearInterval(e)}},Yi=new WeakMap,U0=new WeakMap,pT),na=new j$;function T$(e){setTimeout(e,0)}var P$=typeof window>"u"||"Deno"in globalThis;function Un(){}function A$(e,t){return typeof e=="function"?e(t):e}function vy(e){return typeof e=="number"&&e>=0&&e!==1/0}function CT(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lo(e,t){return typeof e=="function"?e(t):e}function xr(e,t){return typeof e=="function"?e(t):e}function O1(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==q0(o,t.options))return!1}else if(!Qu(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function D1(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(xa(t.options.mutationKey)!==xa(i))return!1}else if(!Qu(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function q0(e,t){return((t==null?void 0:t.queryKeyHashFn)||xa)(e)}function xa(e){return JSON.stringify(e,(t,n)=>yy(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qu(e[n],t[n])):!1}var I$=Object.prototype.hasOwnProperty;function jT(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=L1(e)&&L1(t);if(!r&&!(yy(e)&&yy(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let d=0;d<l;d++){const h=r?d:o[d],f=e[h],p=t[h];if(f===p){c[h]=f,(r?d<i:I$.call(e,h))&&u++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){c[h]=p;continue}const g=jT(f,p,n+1);c[h]=g,g===f&&u++}return i===l&&u===i?e:c}function Cf(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function L1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function yy(e){if(!F1(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!F1(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function F1(e){return Object.prototype.toString.call(e)==="[object Object]"}function R$(e){return new Promise(t=>{na.setTimeout(t,e)})}function xy(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?jT(e,t):t}function M$(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function O$(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var G0=Symbol();function TT(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===G0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function K0(e,t){return typeof e=="function"?e(...t):!!e}function D$(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Zu=(()=>{let e=()=>P$;return{isServer(){return e()},setIsServer(t){e=t}}})();function by(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var L$=T$;function F$(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=L$;const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var mn=F$(),Ml,Qi,Ol,mT,$$=(mT=class extends yc{constructor(){super();Ie(this,Ml,!0);Ie(this,Qi);Ie(this,Ol);Se(this,Ol,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){z(this,Qi)||this.setEventListener(z(this,Ol))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Qi))==null||t.call(this),Se(this,Qi,void 0))}setEventListener(t){var n;Se(this,Ol,t),(n=z(this,Qi))==null||n.call(this),Se(this,Qi,t(this.setOnline.bind(this)))}setOnline(t){z(this,Ml)!==t&&(Se(this,Ml,t),this.listeners.forEac
10h(r=>{r(t)}))}isOnline(){return z(this,Ml)}},Ml=new WeakMap,Qi=new WeakMap,Ol=new WeakMap,mT),jf=new $$;function V$(e){return Math.min(1e3*2**e,3e4)}function PT(e){return(e??"online")==="online"?jf.isOnline():!0}var wy=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function AT(e){let t=!1,n=0,r;const s=by(),i=()=>s.status!=="pending",o=v=>{var y;if(!i()){const x=new wy(v);f(x),(y=e.onCancel)==null||y.call(e,x)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>W0.isFocused()&&(e.networkMode==="always"||jf.isOnline())&&e.canRun(),d=()=>PT(e.networkMode)&&e.canRun(),h=v=>{i()||(r==null||r(),s.resolve(v))},f=v=>{i()||(r==null||r(),s.reject(v))},p=()=>new Promise(v=>{var y;r=x=>{(i()||u())&&v(x)},(y=e.onPause)==null||y.call(e)}).then(()=>{var v;r=void 0,i()||(v=e.onContinue)==null||v.call(e)}),g=()=>{if(i())return;let v;const y=n===0?e.initialPromise:void 0;try{v=y??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(h).catch(x=>{var E;if(i())return;const b=e.retry??(Zu.isServer()?0:3),w=e.retryDelay??V$,S=typeof w=="function"?w(n,x):w,_=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,x);if(t||!_){f(x);return}n++,(E=e.onFail)==null||E.call(e,n,x),R$(S).then(()=>u()?void 0:p()).then(()=>{t?f(x):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),s)}}var oa,gT,IT=(gT=class{constructor(){Ie(this,oa)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vy(this.gcTime)&&Se(this,oa,na.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zu.isServer()?1/0:5*60*1e3))}clearGcTimeout(){z(this,oa)!==void 0&&(na.clearTimeout(z(this,oa)),Se(this,oa,void 0))}},oa=new WeakMap,gT);function B$(e){return{onFetch:(t,n)=>{var d,h,f,p,g;const r=t.options,s=(f=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const y=w=>{D$(w,()=>t.signal,()=>v=!0)},x=TT(t.options,t.fetchOptions),b=async(w,S,_)=>{if(v)return Promise.reject(t.signal.reason);if(S==null&&w.pages.length)return Promise.resolve(w);const R=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};return y(T),T})(),A=await x(R),{maxPages:N}=t.options,k=_?O$:M$;return{pages:k(w.pages,A,N),pageParams:k(w.pageParams,S,N)}};if(s&&i.length){const w=s==="backward",S=w?U$:$1,_={pages:i,pageParams:o},E=S(r,_);l=await b(_,E,w)}else{const w=e??i.length;do{const S=c===0?o[0]??r.initialPageParam:$1(r,l);if(c>0&&S==null)break;l=await b(l,S),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var v,y;return(y=(v=t.options).persister)==null?void 0:y.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function $1(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function U$(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Dl,aa,Ll,Lr,la,bn,Rd,ca,yr,RT,ei,vT,z$=(vT=class extends IT{constructor(t){super();Ie(this,yr);Ie(this,Dl);Ie(this,aa);Ie(this,Ll);Ie(this,Lr);Ie(this,la);Ie(this,bn);Ie(this,Rd);Ie(this,ca);Se(this,ca,!1),Se(this,Rd,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,la,t.client),Se(this,Lr,z(this,la).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,aa,B1(this.options)),this.state=t.state??z(this,aa),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return z(this,Dl)}get promise(){var t;return(t=z(this,bn))==null?void 0:t.promise}setOptions(t){if(this.options={...z(this,Rd),...t},t!=null&&t._type&&Se(this,Dl,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=B1(this.options);n.data!==void 0&&(this.setState(V1(n.data,n.dataUpdatedAt)),Se(this,aa,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,Lr).remove(this)}setData(t,n){const r=xy(this.state.data,t,this.options);return rt(this,yr,ei).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){rt(this,yr,ei).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=z(this,bn))==null?void 0:r.promise;return(s=z(this,bn))==null||s.cancel(t),n?n.then(Un).catch(Un):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return z(this,aa)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>xr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===G0||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdate
10Count>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>lo(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!CT(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,bn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,bn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),z(this,Lr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(z(this,bn)&&(z(this,ca)||rt(this,yr,RT).call(this)?z(this,bn).cancel({revert:!0}):z(this,bn).cancelRetry()),this.scheduleGc()),z(this,Lr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rt(this,yr,ei).call(this,{type:"invalidate"})}async fetch(t,n){var u,d,h,f,p,g,v,y,x,b,w;if(this.state.fetchStatus!=="idle"&&((u=z(this,bn))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,bn))return z(this,bn).continueRetry(),z(this,bn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(_=>_.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,s=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Se(this,ca,!0),r.signal)})},i=()=>{const S=TT(this.options,n),E=(()=>{const R={client:z(this,la),queryKey:this.queryKey,meta:this.meta};return s(R),R})();return Se(this,ca,!1),this.options.persister?this.options.persister(S,E,this):S(E)},l=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,la),state:this.state,fetchFn:i};return s(S),S})(),c=z(this,Dl)==="infinite"?B$(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Se(this,Ll,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&rt(this,yr,ei).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),Se(this,bn,AT({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:S=>{S instanceof wy&&S.revert&&this.setState({...z(this,Ll),fetchStatus:"idle"}),r.abort()},onFail:(S,_)=>{rt(this,yr,ei).call(this,{type:"failed",failureCount:S,error:_})},onPause:()=>{rt(this,yr,ei).call(this,{type:"pause"})},onContinue:()=>{rt(this,yr,ei).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const S=await z(this,bn).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(f=z(this,Lr).config).onSuccess)==null||p.call(f,S,this),(v=(g=z(this,Lr).config).onSettled)==null||v.call(g,S,this.state.error,this),S}catch(S){if(S instanceof wy){if(S.silent)return z(this,bn).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw rt(this,yr,ei).call(this,{type:"error",error:S}),(x=(y=z(this,Lr).config).onError)==null||x.call(y,S,this),(w=(b=z(this,Lr).config).onSettled)==null||w.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},Dl=new WeakMap,aa=new WeakMap,Ll=new WeakMap,Lr=new WeakMap,la=new WeakMap,bn=new WeakMap,Rd=new WeakMap,ca=new WeakMap,yr=new WeakSet,RT=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ei=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...MT(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...V1(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,Ll,t.manual?s:void 0),s;case"error":const i=t.error;
10return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),mn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,Lr).notify({query:this,type:"updated",action:t})})},vT);function MT(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:PT(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function V1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function B1(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var nr,ft,Md,Vn,ua,Fl,ii,Zi,Od,$l,Vl,da,ha,Xi,Bl,Nt,hu,_y,ky,Sy,Ey,Ny,Cy,jy,OT,yT,H$=(yT=class extends yc{constructor(t,n){super();Ie(this,Nt);Ie(this,nr);Ie(this,ft);Ie(this,Md);Ie(this,Vn);Ie(this,ua);Ie(this,Fl);Ie(this,ii);Ie(this,Zi);Ie(this,Od);Ie(this,$l);Ie(this,Vl);Ie(this,da);Ie(this,ha);Ie(this,Xi);Ie(this,Bl,new Set);this.options=n,Se(this,nr,t),Se(this,Zi,null),Se(this,ii,by()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,ft).addObserver(this),U1(z(this,ft),this.options)?rt(this,Nt,hu).call(this):this.updateResult(),rt(this,Nt,Ey).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ty(z(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ty(z(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rt(this,Nt,Ny).call(this),rt(this,Nt,Cy).call(this),z(this,ft).removeObserver(this)}setOptions(t){const n=this.options,r=z(this,ft);if(this.options=z(this,nr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xr(this.options.enabled,z(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");rt(this,Nt,jy).call(this),z(this,ft).setOptions(this.options),n._defaulted&&!Cf(this.options,n)&&z(this,nr).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,ft),observer:this});const s=this.hasListeners();s&&z1(z(this,ft),r,this.options,n)&&rt(this,Nt,hu).call(this),this.updateResult(),s&&(z(this,ft)!==r||xr(this.options.enabled,z(this,ft))!==xr(n.enabled,z(this,ft))||lo(this.options.staleTime,z(this,ft))!==lo(n.staleTime,z(this,ft)))&&rt(this,Nt,_y).call(this);const i=rt(this,Nt,ky).call(this);s&&(z(this,ft)!==r||xr(this.options.enabled,z(this,ft))!==xr(n.enabled,z(this,ft))||i!==z(this,Xi))&&rt(this,Nt,Sy).call(this,i)}getOptimisticResult(t){const n=z(this,nr).getQueryCache().build(z(this,nr),t),r=this.createResult(n,t);return q$(this,r)&&(Se(this,Vn,r),Se(this,Fl,this.options),Se(this,ua,z(this,ft).state)),r}getCurrentResult(){return z(this,Vn)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&z(this,ii).status==="pending"&&z(this,ii).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){z(this,Bl).add(t)}getCurrentQuery(){return z(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=z(this,nr).defaultQueryOptions(t),r=z(this,nr).getQueryCache().build(z(this,nr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return rt(this,Nt,hu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,Vn)))}createResult(t,n){var N;const r=z(this,ft),s=this.options,i=z(this,Vn),o=z(this,ua),l=z(this,Fl),u=t!==r?t.state:z(this,Md),{state:d}=t;let h={...d},f=!1,p;if(n._optimisticResults){const k=this.hasListeners(),T=!k&&U1(t,n),I=k&&z1(t,r,n,s);(T||I)&&(h={...h,...MT(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:y}=h;p=h.data;let x=!1;if(n.placeholderData!==void 0&&p===void 0&&y==="pending"){let k;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(k=i.data,x=!0):k=typeof n.placeholderData=="function"?n.placeholderData((N=z(this,Vl))==null?void 0:N.state.data,z(this,Vl)):n.placeholderData,k!==void 0&&(y="success",p=xy(i==null?void 0:i.data,k,n),f=!0)}if(n.select&&p!==void 0&&!x)if(i&&p===(o==null?void 0:o.data)&&n.select===z(this,Od))p=z(this,$l);else try{Se(this,Od,n.select),p=n.select(p),p=xy(i==null?void 0:i.data,p,n),Se(this,$l,p),Se(this,Zi,null)}catch(k){Se(this,Zi,k)}z(this,Zi)&&(g=z(this,Zi),p=z(this,$l),v=Date.now(),y="error");const b=h.fetchStatus==="fetching",w=y==="pending",S=y==="error",_=w&&b,E=p!==void 0,A={status:y,fetchStatus:h.fetchStatus,isPending:w,isSuccess:y==="success",isError:S,isInitialLoading:_,isLoading:_,data:p,dataUpdatedAt:h.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdate
10Count:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:S&&!E,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&E,isStale:Y0(t,n),refetch:this.refetch,promise:z(this,ii),isEnabled:xr(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=A.data!==void 0,T=A.status==="error"&&!k,I=M=>{T?M.reject(A.error):k&&M.resolve(A.data)},F=()=>{const M=Se(this,ii,A.promise=by());I(M)},L=z(this,ii);switch(L.status){case"pending":t.queryHash===r.queryHash&&I(L);break;case"fulfilled":(T||A.data!==L.value)&&F();break;case"rejected":(!T||A.error!==L.reason)&&F();break}}return A}updateResult(){const t=z(this,Vn),n=this.createResult(z(this,ft),this.options);if(Se(this,ua,z(this,ft).state),Se(this,Fl,this.options),z(this,ua).data!==void 0&&Se(this,Vl,z(this,ft)),Cf(n,t))return;Se(this,Vn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!z(this,Bl).size)return!0;const o=new Set(i??z(this,Bl));return this.options.throwOnError&&o.add("error"),Object.keys(z(this,Vn)).some(l=>{const c=l;return z(this,Vn)[c]!==t[c]&&o.has(c)})};rt(this,Nt,OT).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rt(this,Nt,Ey).call(this)}},nr=new WeakMap,ft=new WeakMap,Md=new WeakMap,Vn=new WeakMap,ua=new WeakMap,Fl=new WeakMap,ii=new WeakMap,Zi=new WeakMap,Od=new WeakMap,$l=new WeakMap,Vl=new WeakMap,da=new WeakMap,ha=new WeakMap,Xi=new WeakMap,Bl=new WeakMap,Nt=new WeakSet,hu=function(t){rt(this,Nt,jy).call(this);let n=z(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Un)),n},_y=function(){rt(this,Nt,Ny).call(this);const t=lo(this.options.staleTime,z(this,ft));if(Zu.isServer()||z(this,Vn).isStale||!vy(t))return;const r=CT(z(this,Vn).dataUpdatedAt,t)+1;Se(this,da,na.setTimeout(()=>{z(this,Vn).isStale||this.updateResult()},r))},ky=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,ft)):this.options.refetchInterval)??!1},Sy=function(t){rt(this,Nt,Cy).call(this),Se(this,Xi,t),!(Zu.isServer()||xr(this.options.enabled,z(this,ft))===!1||!vy(z(this,Xi))||z(this,Xi)===0)&&Se(this,ha,na.setInterval(()=>{(this.options.refetchIntervalInBackground||W0.isFocused())&&rt(this,Nt,hu).call(this)},z(this,Xi)))},Ey=function(){rt(this,Nt,_y).call(this),rt(this,Nt,Sy).call(this,rt(this,Nt,ky).call(this))},Ny=function(){z(this,da)!==void 0&&(na.clearTimeout(z(this,da)),Se(this,da,void 0))},Cy=function(){z(this,ha)!==void 0&&(na.clearInterval(z(this,ha)),Se(this,ha,void 0))},jy=function(){const t=z(this,nr).getQueryCache().build(z(this,nr),this.options);if(t===z(this,ft))return;const n=z(this,ft);Se(this,ft,t),Se(this,Md,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},OT=function(t){mn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(z(this,Vn))}),z(this,nr).getQueryCache().notify({query:z(this,ft),type:"observerResultsUpdated"})})},yT);function W$(e,t){return xr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&xr(t.retryOnMount,e)===!1)}function U1(e,t){return W$(e,t)||e.state.data!==void 0&&Ty(e,t,t.refetchOnMount)}function Ty(e,t,n){if(xr(t.enabled,e)!==!1&&lo(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Y0(e,t)}return!1}function z1(e,t,n,r){return(e!==t||xr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Y0(e,n)}function Y0(e,t){return xr(t.enabled,e)!==!1&&e.isStaleByTime(lo(t.staleTime,e))}function q$(e,t){return!Cf(e.getCurrentResult(),t)}var Dd,xs,Pn,fa,bs,$i,xT,G$=(xT=class extends IT{constructor(t){super();Ie(this,bs);Ie(this,Dd);Ie(this,xs);Ie(this,Pn);Ie(this,fa);Se(this,Dd,t.client),this.mutationId=t.mutationId,Se(this,Pn,t.mutationCache),Se(this,xs,[]),this.state=t.state||DT(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){z(this,xs).includes(t)||(z(this,xs).push(t),this.clearGcTimeout(),z(this,Pn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Se(this,xs,z(this,xs).filter(n=>n!==t)),this.scheduleGc(),z(this,Pn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){z(this,xs).length||(this.state.status==="pending"?this.scheduleGc():z(this,Pn).remove(this))}continue(){var t;return((t=z(this,fa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,d,h,f,p,g,v,y,x,b,w,S,_,E,R;const n=()=>{rt(this,bs,$i).call(this,{type:"continue"})},r={client:z(this,Dd),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,fa,AT({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,N)=>{rt(this,bs,$i).call(this,{type:"failed",failureCount:A,error:N})},onPause:()=>{rt(this,bs,$i).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,Pn).canRun(this)}));const s=this.state.status==="pending",i=!z(this,fa).canStart();try{if(s)n();else{rt(this,bs,$i).call(this,{type:"pending",variables:t,isPaused:i}),z(this,Pn).config.onMutate&&await z(this,Pn).config.onMutate(t,this,r);
10const N=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));N!==this.state.context&&rt(this,bs,$i).call(this,{type:"pending",context:N,variables:t,isPaused:i})}const A=await z(this,fa).start();return await((u=(c=z(this,Pn).config).onSuccess)==null?void 0:u.call(c,A,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,A,t,this.state.context,r)),await((p=(f=z(this,Pn).config).onSettled)==null?void 0:p.call(f,A,null,this.state.variables,this.state.context,this,r)),await((v=(g=this.options).onSettled)==null?void 0:v.call(g,A,null,t,this.state.context,r)),rt(this,bs,$i).call(this,{type:"success",data:A}),A}catch(A){try{await((x=(y=z(this,Pn).config).onError)==null?void 0:x.call(y,A,t,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((w=(b=this.options).onError)==null?void 0:w.call(b,A,t,this.state.context,r))}catch(N){Promise.reject(N)}try{await((_=(S=z(this,Pn).config).onSettled)==null?void 0:_.call(S,void 0,A,this.state.variables,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((R=(E=this.options).onSettled)==null?void 0:R.call(E,void 0,A,t,this.state.context,r))}catch(N){Promise.reject(N)}throw rt(this,bs,$i).call(this,{type:"error",error:A}),A}finally{z(this,Pn).runNext(this)}}},Dd=new WeakMap,xs=new WeakMap,Pn=new WeakMap,fa=new WeakMap,bs=new WeakSet,$i=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),mn.batch(()=>
10{z(this,xs).forEach(r=>{r.onMutationUpdate(t)}),z(this,Pn).notify({mutation:this,type:"updated",action:t})})},xT);function DT(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var oi,Qr,Ld,bT,K$=(bT=class extends yc{constructor(t={}){super();Ie(this,oi);Ie(this,Qr);Ie(this,Ld);this.config=t,Se(this,oi,new Set),Se(this,Qr,new Map),Se(this,Ld,0)}build(t,n,r){const s=new G$({client:t,mutationCache:this,mutationId:++yh(this,Ld)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){z(this,oi).add(t);const n=xh(t);if(typeof n=="string"){const r=z(this,Qr).get(n);r?r.push(t):z(this,Qr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(z(this,oi).delete(t)){const n=xh(t);if(typeof n=="string"){const r=z(this,Qr).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&z(this,Qr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=xh(t);if(typeof n=="string"){const r=z(this,Qr).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=xh(t);if(typeof n=="string"){const s=(r=z(this,Qr).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){mn.batch(()=>
10{z(this,oi).forEach(t=>{this.notify({type:"removed",mutation:t})}),z(this,oi).clear(),z(this,Qr).clear()})}getAll(){return Array.from(z(this,oi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>D1(n,r))}findAll(t={}){return this.getAll().filter(n=>D1(t,n))}notify(t){mn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return mn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Un))))}},oi=new WeakMap,Qr=new WeakMap,Ld=new WeakMap,bT);function xh(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ai,Ji,rr,li,vi,Xh,Py,wT,Y$=(wT=class extends yc{constructor(n,r){super();Ie(this,vi);Ie(this,ai);Ie(this,Ji);Ie(this,rr);Ie(this,li);Se(this,ai,n),this.setOptions(r),this.bindMethods(),rt(this,vi,Xh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=z(this,ai).defaultMutationOptions(n),Cf(this.options,r)||z(this,ai).getMutationCache().notify({type:"observerOptionsUpdated",mutation:z(this,rr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&xa(r.mutationKey)!==xa(this.options.mutationKey)?this.reset():((s=z(this,rr))==null?void 0:s.state.status)==="pending"&&z(this,rr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=z(this,rr))==null||n.removeObserver(this)}
10onMutationUpdate(n){rt(this,vi,Xh).call(this),rt(this,vi,Py).call(this,n)}getCurrentResult(){return z(this,Ji)}reset(){var n;(n=z(this,rr))==null||n.removeObserver(this),Se(this,rr,void 0),rt(this,vi,Xh).call(this),rt(this,vi,Py).call(this)}mutate(n,r){var s;return Se(this,li,r),(s=z(this,rr))==null||s.removeObserver(this),Se(this,rr,z(this,ai).getMutationCache().build(z(this,ai),this.options)),z(this,rr).addObserver(this),z(this,rr).execute(n)}},ai=new WeakMap,Ji=new WeakMap,rr=new WeakMap,li=new WeakMap,vi=new WeakSet,Xh=function(){var r;const n=((r=z(this,rr))==null?void 0:r.state)??DT();Se(this,Ji,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Py=function(n){mn.batch(()=>{var r,s,i,o,l,c,u,d;if(z(this,li)&&this.hasListeners()){const h=z(this,Ji).variables,f=z(this,Ji).context,p={client:z(this,ai),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=z(this,li)).onSuccess)==null||s.call(r,n.data,h,f,p)}catch(g){Promise.reject(g)}try{(o=(i=z(this,li)).onSettled)==null||o.call(i,n.data,null,h,f,p)}catch(g){Promise.reject(g)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=z(this,li)).onError)==null||c.call(l,n.error,h,f,p)}catch(g){Promise.reject(g)}try{(d=(u=z(this,li)).onSettled)==null||d.call(u,void 0,n.error,h,f,p)}catch(g){Promise.reject(g)}}}this.listeners.forEach(h=>{h(z(this,Ji))})})},wT),ws,_T,Q$=(_T=class extends yc{constructor(t={}){super();Ie(this,ws);this.config=t,Se(this,ws,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??q0(s,n);let o=this.get(i);return o||(o=new z$({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){z(this,ws).has(t.queryHash)||(z(this,ws).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=z(this,ws).get(t.queryHash);n&&(t.destroy(),n===t&&z(this,ws).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){mn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return z(this,ws).get(t)}getAll(){return[...z(this,ws).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>O1(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>O1(t,r)):n}notify(t){mn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){mn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){mn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ws=new WeakMap,_T),Xt,eo,to,Ul,zl,no,Hl,Wl,kT,Z$=(kT=class{constructor(e={}){Ie(this,Xt);Ie(this,eo);Ie(this,to);Ie(this,Ul);Ie(this,zl);Ie(this,no);Ie(this,Hl);Ie(this,Wl);Se(this,Xt,e.queryCache||new Q$),Se(this,eo,e.mutationCache||new K$),Se(this,to,e.defaultOptions||{}),Se(this,Ul,new Map),Se(this,zl,new Map),Se(this,no,0)}mount(){yh(this,no)._++,z(this,no)===1&&(Se(this,Hl,W0.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Xt).onFocus())})),Se(this,Wl,jf.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Xt).onOnline())})))}unmount(){var e,t;yh(this,no)._--,z(this,no)===0&&((e=z(this,Hl))==null||e.call(this),Se(this,Hl,void 0),(t=z(this,Wl))==null||t.call(this),Se(this,Wl,void 0))}isFetching(e){return z(this,Xt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return z(this,eo).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Xt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=z(this,Xt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(lo(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return z(this,Xt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=z(this,Xt).get(r.queryHash),i=s==null?void 0:s.state.data,o=A$(t,i);if(o!==void 0)return z(this,Xt).build(this,r).setData(o,{...n,manual:!0})}
10setQueriesData(e,t,n){return mn.batch(()=>z(this,Xt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Xt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=z(this,Xt);mn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=z(this,Xt);return mn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=mn.batch(()=>z(this,Xt).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Un).catch(Un)}invalidateQueries(e,t={}){return mn.batch(()=>(z(this,Xt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=mn.batch(()=>z(this,Xt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Un)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Un)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=z(this,Xt).build(this,t);return n.isStaleByTime(lo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Un).catch(Un)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Un).catch(Un)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return jf.isOnline()?z(this,eo).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,Xt)}getMutationCache(){return z(this,eo)}getDefaultOptions(){return z(this,to)}setDefaultOptions(e){Se(this,to,e)}setQueryDefaults(e,t){z(this,Ul).set(xa(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...z(this,Ul).values()],n={};return t.forEach(r=>{Qu(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){z(this,zl).set(xa(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...z(this,zl).values()],n={};return t.forEach(r=>{Qu(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...z(this,to).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=q0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===G0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...z(this,to).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){z(this,Xt).clear(),z(this,eo).clear()}},Xt=new WeakMap,eo=new WeakMap,to=new WeakMap,Ul=new WeakMap,zl=new WeakMap,no=new WeakMap,Hl=new WeakMap,Wl=new WeakMap,kT),LT=m.createContext(void 0),Lt=e=>{const t=m.useContext(LT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},X$=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(LT.Provider,{value:e,children:t})),FT=m.createContext(!1),J$=()=>m.useContext(FT);FT.Provider;function eV(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var tV=m.createContext(eV()),nV=()=>m.useContext(tV),rV=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?K0(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},sV=e=>{m.useEffect(()=>{e.clearReset()},[e])},iV=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||K0(n,[e.error,r])),oV=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},aV=(e,t)=>e.isLoading&&e.isFetching&&!t,lV=(e,t)=>
10(e==null?void 0:e.suspense)&&t.isPending,H1=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function cV(e,t,n){var p,g,v,y;const r=J$(),s=nV(),i=Lt(),o=i.defaultQueryOptions(e);(g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||g.call(p,o);const l=i.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":c?"optimistic":void 0,oV(o),rV(o,s,l),sV(s);const u=!i.getQueryCache().get(o.queryHash),[d]=m.useState(()=>new t(i,o)),h=d.getOptimisticResult(o),f=!r&&c;if(m.useSyncExternalStore(m.useCallback(x=>{const b=f?d.subscribe(mn.batchCalls(x)):Un;return d.updateResult(),b},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),m.useEffect(()=>{d.setOptions(o)},[o,d]),lV(o,h))throw H1(o,d,s);if(iV({result:h,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;if((y=(v=i.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||y.call(v,o,h),o.experimental_prefetchInRender&&!Zu.isServer()&&aV(h,r)){const x=u?H1(o,d,s):l==null?void 0:l.promise;x==null||x.catch(Un).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?h:d.trackResult(h)}function tt(e,t){return cV(e,H$)}function gt(e,t){const n=Lt(),[r]=m.useState(()=>new Y$(n,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);const s=m.useSyncExternalStore(m.useCallback(o=>r.subscribe(mn.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=m.useCallback((o,l)=>{r.mutate(o,l).catch(Un)},[r]);if(s.error&&K0(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ql;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ql||(ql={}));class ug extends Error{constructor(t,n,r){super(t),this.message=t,this.code=n,this.data=r}}const uV=e=>{var t,n;return e!=null&&e.androidBridge?"android":!((n=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},dV=e=>{const t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},r=n.Plugins=n.Plugins||{},s=()=>t!==null?t.name:uV(e),i=()=>s()!=="web",o=h=>{const f=u.get(h);return!!(f!=null&&f.platforms.has(s())||l(h))},l=h=>{var f;return(f=n.PluginHeaders)===null||f===void 0?void 0:f.find(p=>p.name===h)},c=h=>e.console.error(h),u=new Map,d=(h,f={})=>{const p=u.get(h);if(p)return console.warn(`Capacitor plugin "${h}" already registered. Cannot register plugins twice.`),p.proxy;const g=s(),v=l(h);let y;const x=async()=>(!y&&g in f?y=typeof f[g]=="function"?y=await f[g]():y=f[g]:t!==null&&!y&&"web"in f&&(y=typeof f.web=="function"?y=await f.web():y=f.web),y),b=(A,N)=>{var k,T;if(v){const I=v==null?void 0:v.methods.find(F=>N===F.name);if(I)return I.rtype==="promise"?F=>n.nativePromise(h,N.toString(),F):(F,L)=>n.nativeCallback(h,N.toString(),F,L);if(A)return(k=A[N])===null||k===void 0?void 0:k.bind(A)}else{if(A)return(T=A[N])===null||T===void 0?void 0:T.bind(A);throw new ug(`"${h}" plugin is not implemented on ${g}`,ql.Unimplemented)}},w=A=>{let N;const k=(...T)=>{const I=x().then(F=>{const L=b(F,A);if(L){const M=L(...T);return N=M==null?void 0:M.remove,M}else throw new ug(`"${h}.${A}()" is not implemented on ${g}`,ql.Unimplemented)});return A==="addListener"&&(I.remove=async()=>N()),I};return k.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(k,"name",{value:A,writable:!1,configurable:!1}),k},S=w("addListener"),_=w("removeListener"),E=(A,N)=>{const k=S({eventName:A},N),T=async()=>{const F=await k;_({eventName:A,callbackId:F},N)},I=new Promise(F=>k.then(()=>F({remove:T})));return I.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await T()},I},R=new Proxy({},{get(A,N){switch(N){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return v?E:S;case"removeListener":return _;default:return w(N)}}});return r[h]=R,u.set(h,{name:h,proxy:R,platforms:new Set([...Object.keys(f),...v?[g]:[]])}),R};return n.convertFileSrc||(n.convertFileSrc=h=>h),n.getPlatform=s,n.handleError=c,n.isNativePlatform=i,n.isPluginAvailable=o,n.registerPlugin=d,n.Exception=ug,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},hV=e=>e.Capacitor=dV(e),Gl=hV(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),us=Gl.registerPlugin;class Q0{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,n){let r=!1;this.listeners[t]||(this.listeners[t]=[],r=!0),this.listeners[t].push(n);const i=this.windowListeners[t];i&&!i.registered&&this.addWindowListener(i),r&&this.sendRetainedArgumentsForEvent(t);const o=async()=>this.removeListener(t,n);return Promise.resolve({remove:o})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,n,r){const s=this.listeners[t];if(!s){if(r){let i=this.retainedEventArguments[t];i||(i=[]),i.push(n),this.retainedEventArguments[t]=i}return}s.forEach(i=>
10i(n))}hasListeners(t){var n;return!!(!((n=this.listeners[t])===null||n===void 0)&&n.length)}registerWindowListener(t,n){this.windowListeners[n]={registered:!1,windowEventName:t,pluginEventName:n,handler:r=>{this.notifyListeners(n,r)}}}unimplemented(t="not implemented"){return new Gl.Exception(t,ql.Unimplemented)}unavailable(t="not available"){return new Gl.Exception(t,ql.Unavailable)}async removeListener(t,n){const r=this.listeners[t];if(!r)return;const s=r.indexOf(n);this.listeners[t].splice(s,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const n=this.retainedEventArguments[t];n&&(delete this.retainedEventArguments[t],n.forEach(r=>{this.notifyListeners(t,r)}))}}const W1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),q1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fV extends Q0{async getCookies(){const t=document.cookie,n={};return t.split(";").forEach(r=>{if(r.length<=0)return;let[s,i]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");s=q1(s).trim(),i=q1(i).trim(),n[s]=i}),n}async setCookie(t){try{const n=W1(t.key),r=W1(t.value),s=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",i=(t.path||"/").replace("path=",""),o=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${n}=${r||""}${s}; path=${i}; ${o};`}catch(n){return Promise.reject(n)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const n of t)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}us("CapacitorCookies",{web:()=>new fV});const pV=async e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const s=r.result;t(s.indexOf(",")>=0?s.split(",")[1]:s)},r.onerror=s=>n(s),r.readAsDataURL(e)}),mV=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(s=>s.toLocaleLowerCase()).reduce((s,i,o)=>(s[i]=e[t[o]],s),{})},gV=(e,t=!0)=>e?Object.entries(e).reduce((r,s)=>{const[i,o]=s;let l,c;return Array.isArray(o)?(c="",o.forEach(u=>{l=t?encodeURIComponent(u):u,c+=`${i}=${l}&`}),c.slice(0,-1)):(l=t?encodeURIComponent(o):o,c=`${i}=${l}`),`${r}&${c}`},"").substr(1):null,vV=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),s=mV(e.headers)["content-type"]||"";if(typeof e.data=="string")n.body=e.data;else if(s.includes("application/x-www-form-urlencoded")){const i=new URLSearchParams;for(const[o,l]of Object.entries(e.data||{}))i.set(o,l);n.body=i.toString()}else if(s.includes("multipart/form-data")||e.data instanceof FormData){const i=new FormData;if(e.data instanceof FormData)e.data.forEach((l,c)=>{i.append(c,l)});else for(const l of Object.keys(e.data))i.append(l,e.data[l]);n.body=i;const o=new Headers(n.headers);o.delete("content-type"),n.headers=o}else(s.includes("application/json")||typeof e.data=="object")&&(n.body=JSON.stringify(e.data));return n};class yV extends Q0{async request(t){const n=vV(t,t.webFetchExtra),r=gV(t.params,t.shouldEncodeUrlParams),s=r?`${t.url}?${r}`:t.url,i=await fetch(s,n),o=i.headers.get("content-type")||"";let{responseType:l="text"}=i.ok?t:{};o.includes("application/json")&&(l="json");let c,u;switch(l){case"arraybuffer":case"blob":u=await i.blob(),c=await pV(u);break;case"json":c=await i.json();break;case"document":case"text":default:c=await i.text()}const d={};return i.headers.forEach((h,f)=>{d[f]=h}),{data:c,headers:d,status:i.status,url:i.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}us("CapacitorHttp",{web:()=>new yV});var G1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"}
10)(G1||(G1={}));var K1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(K1||(K1={}));class xV extends Q0{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}us("SystemBars",{web:()=>new xV});function bV(){return Gl.isNativePlatform()?"https://repsshield.com"||"https://repsshield.com":""}function Su(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;const t=bV();if(!t)return e;const n=e.startsWith("/")?e:`/${e}`;return`${t}${n}`}async function Cs(e,t){if(typeof e=="string")return fetch(Su(e),t);if(e instanceof URL)return fetch(new URL(Su(e.toString())),t);const n=new Request(Su(e.url),e);return fetch(n,t)}const wV="modulepreload",_V=function(e){return"/"+e},Y1={},ve=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=_V(c),c in Y1)return;Y1[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":wV,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},$T=us("Preferences",{web:()=>ve(()=>import("./web-DT41P0vB.js"),__vite__mapDeps([0,1])).then(e=>new e.PreferencesWeb)}),Ye=()=>{var r,s,i;if(typeof window>"u")return!1;const e=window.Capacitor,t=(r=window.location)==null?void 0:r.protocol,n=!!((i=(s=window.webkit)==null?void 0:s.messageHandlers)!=null&&i.bridge);return t==="capacitor:"||t==="ionic:"||n||typeof e<"u"&&e.isNativePlatform()},Gp=()=>{var e,t;return Ye()&&((t=(e=window.Capacitor)==null?void 0:e.getPlatform)==null?void 0:t.call(e))==="android"},Ra=()=>{var r,s,i,o,l,c;if(!Ye())return!1;const e=(s=(r=window.Capacitor)==null?void 0:r.getPlatform)==null?void 0:s.call(r);if(e)return e==="ios";const t=((i=window.navigator)==null?void 0:i.userAgent)||"",n=/iPad|iPhone|iPod/.test(t);return!!((l=(o=window.webkit)==null?void 0:o.messageHandlers)!=null&&l.bridge)||n&&["capacitor:","ionic:"].includes((c=window.location)==null?void 0:c.protocol)},Tf={};async function Pf(e,t){Tf[e]=t;try{localStorage.setItem(e,t)}catch{}if(Ye())try{await $T.set({key:e,value:t})}catch{}}function Fd(e){if(e in Tf)return Tf[e];try{return localStorage.getItem(e)}catch{return null}}async function Ay(e){delete Tf[e];try{localStorage.removeItem(e)}catch{}if(Ye())try{await $T.remove({key:e})}catch{}}const Kp="accessToken",VT="session_auth";async function co(e){await Promise.all([Pf(Kp,e),Pf(VT,"true")])}function kV(){return Fd(Kp)}async function BT(){await Promise.all([Ay(Kp),Ay(VT)])}function Z0(){const e=Fd(Kp);return e!==null&&e.length>0}const SV=["accessToken","session_auth","refreshToken","user","demoMode","demoSubscriptionTier"],EV=["accessToken","refreshToken","connect.sid","authToken"];function NV(){const e=window.location.hostname,t=new Set;if(!e)return[];t.add(e),e&&!e.startsWith(".")&&t.add(`.${e}`);const n=e.split(".").filter(Boolean);if(n.length>2){const r=n.slice(-2).join(".");t.add(r),t.add(`.${r}`)}return[...t]}function CV(){const e="expires=Thu, 01 Jan 1970 00:00:00 GMT",t=["/",""],n=NV();for(const r of EV)for(const s of t){const i=s?`; path=${s}`:"";document.cookie=`${r}=; ${e}${i}`;for(const o of n)document.cookie=`${r}=; ${e}${i}; domain=${o}`}}const Q1=5e3;let dg=0;async function Ms(e,t={}){const n=Date.now();if(!t.force&&n-dg<Q1){console.log("[auth] clearClientAuthState debounced — call within",Q1,"ms window"),dg=n;return}dg=n,await BT(),await Promise.all(SV.map(async r=>{try{localStorage.removeItem(r)}catch{}await Ay(r)})),sessionStorage.clear(),await(e==null?void 0:e.cancelQueries()),e==null||e.setQueryData(["/api/auth/user"],null),e==null||e.removeQueries({queryKey:["/api/auth/user"]}
10),e==null||e.clear(),CV();try{const{clearOAuthState:r}=await ve(async()=>{const{clearOAuthState:s}=await Promise.resolve().then(()=>LV);return{clearOAuthState:s}},void 0);r()}catch{}}function Kl(e="/logout-success"){if(!Ye()){window.location.replace(e);return}Af()}function Af(){if(!Ye())return;const e="/login";`${window.location.pathname}${window.location.search}`!==e&&(window.history.replaceState(null,"",e),window.dispatchEvent(new PopStateEvent("popstate")))}class ro extends Error{constructor(t,n,r){super(t),this.status=n,this.body=r,this.name="ApiError"}}async function If(e){if(!e.ok){const t=await e.text()||e.statusText;if(e.status===429)throw console.warn("Rate limited - too many requests"),new ro("Rate limited - please wait a moment before trying again",429);if(e.status===503&&e.headers.get("Replit-Proxy-Error")==="asleep")throw console.warn("Backend server is asleep - waking up..."),new ro("Server is starting up - please wait a moment",503);try{const n=JSON.parse(t);if(n.message)throw new ro(n.message,e.status,n)}catch(n){if(!(n instanceof SyntaxError))throw n}throw new ro(`${e.status}: ${t}`,e.status)}}async function Xe(e,t,n){var l;console.group(`📡 [API] ${e} ${t}`);const r=Fd("accessToken");let s={},i;n&&(n instanceof FormData?i=n:(s["Content-Type"]="application/json",i=JSON.stringify(n))),r&&(s.Authorization=`Bearer ${r}`);const o=await Cs(t,{method:e,headers:s,body:i,credentials:"include"});if(console.groupEnd(),o.status===401&&r)try{const c=await Cs("/api/auth/refresh",{method:"POST",credentials:"include"});if(c.ok){const u=await c.json();if((l=u.tokens)!=null&&l.accessToken){await co(u.tokens.accessToken),s.Authorization=`Bearer ${u.tokens.accessToken}`;const d=await Cs(t,{method:e,headers:s,body:i,credentials:"include"});return await If(d),d}}}catch(c){throw console.error("Token refresh failed:",c),await Ms(js),Af(),c}return await If(o),o}const UT=({on401:e})=>async({queryKey:t})=>{var c;const n=Fd("accessToken"),r={};n&&(r.Authorization=`Bearer ${n}`);const[s,i]=t;let o=s;if(i&&Object.keys(i).length>0){const u=new URLSearchParams;Object.entries(i).forEach(([h,f])=>{f!=null&&u.append(h,String(f))});const d=u.toString();d&&(o=`${s}?${d}`)}const l=await Cs(o,{credentials:"include",headers:r});if(l.status===401&&n)try{const u=await Cs("/api/auth/refresh",{method:"POST",credentials:"include"});if(u.ok){const d=await u.json();if((c=d.tokens)!=null&&c.accessToken){await co(d.tokens.accessToken);const h=await Cs(o,{credentials:"include",headers:{...r,Authorization:`Bearer ${d.tokens.accessToken}`}});return e==="returnNull"&&h.status===401?null:(await If(h),await h.json())}}}catch(u){if(console.error("Token refresh failed:",u),await Ms(js),e==="returnNull")return null;throw Af(),u}if(l.status===401){if(await Ms(js),e==="returnNull")return null;Af()}if(l.status===429){if(console.warn("Rate limited - too many requests to",t.join("/")),e==="returnNull")return null;throw new Error("Rate limited - too many requests")}return await If(l),await l.json()},js=new Z$({defaultOptions:{queries:{queryFn:UT({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1e3*2,retry:(e,t)=>t.message.includes("Rate limited")||t.message.includes("429")||t.message.includes("401")||t.message.includes("Unauthorized")?!1:e<1,retryDelay:e=>Math.min(1e3*2**e,3e4)},mutations:{retry:(e,t)=>t.message.includes("Rate limited")||t.message.includes("429")||t.message.includes("401")||t.message.includes("Unauthorized")?!1:e<1}}}),Z1=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ro,apiRequest:Xe,getQueryFn:UT,queryClient:js},Symbol.toStringTag,{value:"Module"})),zT=Re.createContext(void 0),jV={user:{id:"demo-user-123",email:"[email protected]",firstName:"Sarah",lastName:"Martinez",profileImageUrl:"https://images.unsplash.com/photo-1494790108755-2616b332ef42?w=150",repType:"longTerm",isAdmin:!1,subscriptionStatus:"active",createdAt:"2024-01-15T08:00:00.000Z",updatedAt:new Date().toISOString()},properties:[{id:1,userId:"demo-user-123",nickname:"Downtown Loft Complex",address:"1247 Mission Street, Unit 302",city:"San Francisco",state:"CA",zipCode:"94103",propertyType:"Long-term Rental",createdAt:"2024-01-15T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:2,userId:"demo-user-123",nickname:"Suburban Family Home",address:"789 Elm Street",city:"Palo Alto",state:"CA",zipCode:"94301",propertyType:"Long-term Rental",createdAt:"2024-02-20T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:3,userId:"demo-user-123",nickname:"Beach House Airbnb",address:"456 Ocean Drive",city:"Santa Cruz",state:"CA",zipCode:"95060",propertyType:"Short-term Rental",createdAt:"2024-03-10T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:4,userId:"demo-user-123",nickname:"Mountain Cabin Retreat",address:"123 Pine Ridge Road",city:"Lake Tahoe",state:"CA",zipCode:"96150",propertyType:"Short-term Rental",createdAt:"2024-04-05T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:5,userId:"demo-user-123",nickname:"Tech Worker Condo",address:"901 Market Street, #1205",city:"San Francisco",state:"CA",zipCode:"94102",propertyType:"Long-term Rental",createdAt:"2024-05-12T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:6,userId:"demo-user-123",nickname:"University District Duplex",address:"2234 Telegraph Avenue",city:"Berkeley",state:"CA",zipCode:"94704",propertyType:"Long-term Rental",createdAt:"2024-06-18T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:7,userId:"demo-user-123",nickname:"Corporate Housing Unit",address:"567 Business Park Drive",city:"Sunnyvale",state:"CA",zipCode:"94086",propertyType:"Short-term Rental",createdAt:"2024-0
107-22T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:8,userId:"demo-user-123",nickname:"Artist Loft Studio",address:"890 Folsom Street, #4B",city:"San Francisco",state:"CA",zipCode:"94107",propertyType:"Long-term Rental",createdAt:"2024-08-14T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:9,userId:"demo-user-123",nickname:"Family Townhouse",address:"345 Residential Way",city:"San Mateo",state:"CA",zipCode:"94403",propertyType:"Long-term Rental",createdAt:"2024-09-08T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:10,userId:"demo-user-123",nickname:"Wine Country Villa",address:"678 Vineyard Lane",city:"Napa",state:"CA",zipCode:"94558",propertyType:"Short-term Rental",createdAt:"2024-10-15T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:11,userId:"demo-user-123",nickname:"Startup Incubator Space",address:"432 Innovation Blvd",city:"Mountain View",state:"CA",zipCode:"94041",propertyType:"Commercial",createdAt:"2024-11-02T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"},{id:12,userId:"demo-user-123",nickname:"Historic Victorian Rental",address:"1876 Victorian Street",city:"San Francisco",state:"CA",zipCode:"94115",propertyType:"Long-term Rental",createdAt:"2024-11-20T10:00:00.000Z",updatedAt:"2024-12-15T10:00:00.000Z"}],timeEntries:[{id:1,userId:"demo-user-123",propertyId:1,date:"2024-12-15T09:00:00.000Z",hours:3.5,activityType:"property-management",propertyType:"Long-term Rental",description:"Coordinated major HVAC system replacement with contractor team. Reviewed quotes, scheduled installation, and conducted quality inspection.",isMaterialParticipation:!0,evidenceFiles:["HVAC_Installation_Invoice.pdf","Before_After_Photos.jpg"],createdAt:"2024-12-15T09:00:00.000Z",updatedAt:"2024-12-15T09:00:00.000Z"},{id:2,userId:"demo-user-123",propertyId:3,date:"2024-12-14T14:00:00.000Z",hours:2,activityType:"leasing-tenant-relations",propertyType:"Short-term Rental",description:"Handled guest complaint about WiFi connectivity. Contacted internet provider, arranged technician visit, and provided compensation to guests.",isMaterialParticipation:!0,evidenceFiles:["Guest_Communication_Thread.pdf"],createdAt:"2024-12-14T14:00:00.000Z",updatedAt:"2024-12-14T14:00:00.000Z"},{id:4,userId:"demo-user-123",propertyId:2,date:"2024-12-12T16:00:00.000Z",hours:1.5,activityType:"bookkeeping-recordkeeping",propertyType:"Long-term Rental",description:"Monthly bookkeeping review - categorized expenses, reconciled bank statements, prepared quarterly tax documentation for CPA.",isMaterialParticipation:!1,evidenceFiles:["Monthly_P&L_Statement.pdf"],createdAt:"2024-12-12T16:00:00.000Z",updatedAt:"2024-12-12T16:00:00.000Z"},{id:5,userId:"demo-user-123",propertyId:4,date:"2024-12-11T10:00:00.000Z",hours:2.5,activityType:"vendor-contractor-management",propertyType:"Short-term Rental",description:"Interviewed and vetted new cleaning service providers. Compared rates, checked references, negotiated service agreements for three properties.",isMaterialParticipation:!0,evidenceFiles:["Cleaning_Service_Contracts.pdf","Reference_Check_Notes.docx"],createdAt:"2024-12-11T10:00:00.000Z",updatedAt:"2024-12-11T10:00:00.000Z"},{id:6,userId:"demo-user-123",propertyId:6,date:"2024-11-28T13:00:00.000Z",hours:3,activityType:"property-acquisition-activities",propertyType:"Long-term Rental",description:"Property inspection for potential acquisition in Berkeley. Conducted thorough walk-through, photographed condition issues, researched comparable sales.",isMaterialParticipation:!0,evidenceFiles:["Property_Inspection_Report.pdf","Inspection_Photos.zip"],createdAt:"2024-11-28T13:00:00.000Z",updatedAt:"2024-11-28T13:00:00.000Z"},{id:7,userId:"demo-user-123",propertyId:7,date:"2024-11-25T09:00:00.000Z",hours:1,activityType:"compliance-legal-administration",propertyType:"Short-term Rental",description:"Updated local business license and STR permit documentation. Filed quarterly occupancy tax returns with city of Sunnyvale.",isMaterialParticipation:!1,evidenceFiles:["Business_License_Renewal.pdf","Tax_Filing_Confirmation.pdf"],createdAt:"2024-11-25T09
10:00:00.000Z",updatedAt:"2024-11-25T09:00:00.000Z"},{id:8,userId:"demo-user-123",propertyId:8,date:"2024-11-22T15:00:00.000Z",hours:2,activityType:"travel-property-related-tasks",propertyType:"Long-term Rental",description:"Travel to artist loft for quarterly property inspection and tenant check-in. Documented maintenance needs and tenant satisfaction.",isMaterialParticipation:!0,evidenceFiles:["Travel_Mileage_Log.pdf","Quarterly_Inspection_Checklist.pdf"],createdAt:"2024-11-22T15:00:00.000Z",updatedAt:"2024-11-22T15:00:00.000Z"},{id:9,userId:"demo-user-123",propertyId:9,date:"2024-10-30T11:00:00.000Z",hours:4.5,activityType:"strategic-planning-portfolio-management",propertyType:"Long-term Rental",description:"Annual portfolio performance review and 2025 planning session. Analyzed ROI across all properties, identified optimization opportunities.",isMaterialParticipation:!0,evidenceFiles:["Portfolio_Performance_Analysis.xlsx","2025_Investment_Strategy.pdf"],createdAt:"2024-10-30T11:00:00.000Z",updatedAt:"2024-10-30T11:00:00.000Z"},{id:10,userId:"demo-user-123",propertyId:10,date:"2024-10-28T14:00:00.000Z",hours:2.5,activityType:"education-training-property-specific",propertyType:"Short-term Rental",description:"Attended Napa County STR regulation workshop. Learned about new noise ordinances and guest management requirements affecting wine country properties.",isMaterialParticipation:!1,evidenceFiles:["Workshop_Certificate.pdf","New_Regulations_Summary.pdf"],createdAt:"2024-10-28T14:00:00.000Z",updatedAt:"2024-10-28T14:00:00.000Z"}],milestones:[{id:1,userId:"demo-user-123",title:"Q4 2024 REP Hours Goal",targetHours:200,currentHours:145,deadline:"2024-12-31T23:59:59.000Z",category:"quarterly",isCompleted:!1,createdAt:"2024-10-01T10:00:00.000Z"},{id:2,userId:"demo-user-123",title:"Annual REP Status Achievement",targetHours:750,currentHours:642,deadline:"2024-12-31T23:59:59.000Z",category:"annual",isCompleted:!1,createdAt:"2024-01-01T10:00:00.000Z"}],analytics:{totalHours:642,materialParticipationHours:485,propertiesManaged:12,averageHoursPerWeek:15.2,complianceStatus:"on-track",monthlyTrend:"increasing",topActivityTypes:[{type:"property-management",hours:124,percentage:19.3},{type:"maintenance-repairs-oversight",hours:98,percentage:15.3},{type:"leasing-tenant-relations",hours:87,percentage:13.5},{type:"bookkeeping-recordkeeping",hours:76,percentage:11.8},{type:"vendor-contractor-management",hours:65,percentage:10.1}]}};let Rr={isDemoMode:!1,demoSubscriptionTier:"free"};function TV({children:e}){const t=()=>{Rr.isDemoMode=!0;try{localStorage.setItem("demoMode","true")}catch(c){console.warn("localStorage access failed:",c)}},n=()=>{Rr.isDemoMode=!1,Rr.demoSubscriptionTier="free";try{localStorage.removeItem("demoMode")}catch(c){console.warn("localStorage access failed:",c)}},r=()=>{Rr.demoSubscriptionTier=Rr.demoSubscriptionTier==="free"?"premium":"free"},s=()=>{Rr.demoSubscriptionTier="free"},i=["csv-export","ai-assistant","voice-to-text","image-analysis","milestones","advanced-analytics","calendar-sync","ai-description-analyzer","premium-analytics","advanced-reports","ai-chatbot-unlimited"],o=c=>Rr.isDemoMode?Rr.demoSubscriptionTier==="free"&&i.includes(c):!1,l=()=>{const c={...jV};return Rr.demoSubscriptionTier==="premium"?c.user.subscriptionStatus="active":(c.user.subscriptionStatus="inactive",c.milestones=[],c.timeEntries=c.timeEntries.slice(0,25)),c};try{localStorage.getItem("demoMode")==="true"&&(Rr.isDemoMode=!0)}catch(c){console.warn("Error accessing localStorage in DemoContext:",c)}return a.jsx(zT.Provider,{value:{isDemoMode:Rr.isDemoMode,demoSubscriptionTier:Rr.demoSubscriptionTier,enterDemoMode:t,exitDemoMode:n,toggleDemoSubscription:r,resetDemo:s,getDemoData:l,isDemoFeatureBlocked:o},children:e})}function HT(){const e=Re.useContext(zT);return e===void 0?(console.warn("useDemo called outside DemoProvider - using fallback state"),{isDemoMode:!1,demoSubscriptionTier:"free",enterDemoMode:()=>console.warn("Demo not available: enterDemoMode called outside provider"),exitDemoMode:()=>console.warn("Demo not available: exitDemoMode called outside provider"),toggleDemoSubscription:()=>console.warn("Demo not available: toggleDemoSubscription called outside provider"),resetDemo:()=>console.warn("Demo not available: resetDemo called outside provider"),getDemoData:()=>({user:null}),isDemoFeatureBlocked:()=>!1}):e}const PV=1,AV=1e6;let hg=0;function IV(){return hg=(hg+1)%Number.MAX_SAFE_INTEGER,hg.toString()}
10const fg=new Map,X1=e=>{if(fg.has(e))return;const t=setTimeout(()=>{fg.delete(e),Eu({type:"REMOVE_TOAST",toastId:e})},AV);fg.set(e,t)},RV=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,PV)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?X1(n):e.toasts.forEach(r=>{X1(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Jh=[];let ef={toasts:[]};function Eu(e){ef=RV(ef,e),Jh.forEach(t=>{t(ef)})}function MV({...e}){const t=IV(),n=s=>Eu({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Eu({type:"DISMISS_TOAST",toastId:t});return Eu({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function sn(){const[e,t]=m.useState(ef);return m.useEffect(()=>(Jh.push(t),()=>{const n=Jh.indexOf(t);n>-1&&Jh.splice(n,1)}),[e]),{...e,toast:MV,dismiss:n=>Eu({type:"DISMISS_TOAST",toastId:n})}}const Yp=us("App",{web:()=>ve(()=>import("./web-CNoyerdg.js"),__vite__mapDeps([2,1])).then(e=>new e.AppWeb)}),es=us("Browser",{web:()=>ve(()=>import("./web-kmhkKUni.js"),__vite__mapDeps([3,1])).then(e=>new e.BrowserWeb)});class WT extends Error{constructor(){super("OAuth cancelled by user"),this.name="OAuthCancelledError"}}let _l=null,En=null,uo=null,Nu=null,J1=null,Iy=0;function qT(e){const t=Date.now();if(J1===e&&t-Iy<2e3)return;J1=e,Iy=t,console.log("App opened with URL:",e);const n=new URL(e),r=n.protocol.replace(":","");if(r!=="com.repsshield.app"&&r!=="repsshield")return;if(n.hostname==="subscription"){const o=n.searchParams.get("status");uo&&(uo({status:o==="success"?"success":"cancelled",pending:!1}),uo=null),es.close().catch(()=>{});return}const i=n.searchParams.get("flow")||(En==null?void 0:En.flowType)||"login";Nu==null||Nu(e,i)}const GT=e=>{Ye()&&(Nu=e,_l&&_l.remove(),Yp.addListener("appUrlOpen",t=>{qT(t.url)}).then(t=>{_l=t}))},KT=async()=>{_l&&(await _l.remove(),_l=null),Nu=null},YT=(e,t,n)=>{const r=new URL(Su(e));return r.searchParams.set("mobile","true"),r.searchParams.set("flow",t),r.searchParams.set("callback_url","com.repsshield.app://auth"),n&&r.searchParams.set("return_url",n),r.toString()};async function X0(e){var t,n;if(Ra()){const r=(n=(t=window.Capacitor)==null?void 0:t.Plugins)==null?void 0:n.AuthSession;if(r)return new Promise((s,i)=>{r.start({url:e,callbackUrlScheme:"com.repsshield.app"}).then(o=>{o!=null&&o.url&&qT(o.url),s()}).catch(o=>{const l=o.message||"",c=o.code||"";c==="CANCELED"||c==="canceledLogin"||/cancel/i.test(l)?(J0(),i(new WT)):i(new Error(o.message||"Authentication failed"))})})}try{await es.close()}catch{}await es.open({url:e})}const Ry=async(e="login",t)=>{if(!Ye()){const r=e==="calendar"?"/api/auth/google/calendar":"/api/auth/google";window.location.href=t?`${r}?return_url=${encodeURIComponent(t)}`:r;return}En={flowType:e,returnUrl:t,pending:!0};const n=YT(e==="calendar"?"/api/auth/google/calendar":"/api/auth/google",e,t);console.log("Opening OAuth URL:",n),await X0(n)},QT=async e=>{if(!Ye()){const n=e?`/api/auth/apple?return_url=${encodeURIComponent(e)}`:"/api/auth/apple";window.location.href=n;return}En={flowType:"login",returnUrl:e,pending:!0};const t=YT("/api/auth/apple","login",e);await X0(t)},My=async(e="mail",t)=>{if(!Ye())throw new Error("Use the regular Microsoft auth flow for web");En={flowType:"microsoft",returnUrl:t,pending:!0};const n=await fetch(`/api/auth/microsoft/${e}/auth`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({returnUrl:t,mobile:!0,callback_url:"com.repsshield.app://auth"})});if(!n.ok)throw new Error("Failed to get Microsoft auth URL");const{authUrl:r}=await n.json();await X0(r)},ZT=async()=>{if(Ye())try{await es.close()}catch(e){console.log("Error closing browser:",e)}},XT=e=>{try{const n=new URL(e).searchParams,r=n.get("error");if(r)return{success:!1,error:decodeURIComponent(r),flowType:n.get("flow")||void 0};const s=n.get("token")||void 0,i=n.get("refresh_token")||void 0,o=n.get("flow")||(En==null?void 0:En.flowType),l=n.get("return_url")||(En==null?void 0:En.returnUrl);return{success:n.get("success")==="true"||!!s,token:s,refreshToken:i,flowType:o||"login",returnUrl:l||void 0}}catch{return{success:!1,error:"Failed to parse OAuth callback"}}},J0=()=>{En=null},Oy=()=>(En==null?void 0:En.pending)===!0,Xu=()=>Iy,OV=()=>En,JT=async e=>{if(!Ye())throw new Error("openSubscriptionCheckout is only available on Capacitor");try{await es.close()}catch{}return new Promise(t=>{let n=null,r=!1;const s=i=>{r||(r=!0,uo=null,n==null||n.remove(),t(i))};uo=i=>{s(i)},es.addListener("browserFinished",()=>{const i=Xu();
10Date.now()-i<3e3||(console.log("[Subscription] Browser dismissed before checkout completed"),s({status:"cancelled",pending:!1}))}).then(i=>{n=i}),es.open({url:e}).catch(i=>{console.error("Failed to open subscription checkout:",i),s({status:"cancelled",pending:!1})})})},eb=async e=>{if(!Ye())throw new Error("openBillingPortalNative is only available on Capacitor");try{await es.close()}catch{}return new Promise(t=>{let n=null,r=!1;const s=i=>{r||(r=!0,uo=null,n==null||n.remove(),t(i))};uo=i=>{s(i)},es.addListener("browserFinished",()=>{const i=Xu();Date.now()-i<3e3||(console.log("[Subscription] Browser dismissed before portal completed"),s({status:"cancelled",pending:!1}))}).then(i=>{n=i}),es.open({url:e}).catch(i=>{console.error("Failed to open billing portal:",i),s({status:"cancelled",pending:!1})})})},DV=e=>{uo=e},LV=Object.freeze(Object.defineProperty({__proto__:null,OAuthCancelledError:WT,clearOAuthState:J0,closeBrowser:ZT,getLastDeepLinkAt:Xu,getOAuthState:OV,initAppUrlListener:GT,isOAuthPending:Oy,openAppleAuth:QT,openBillingPortalNative:eb,openGoogleAuth:Ry,openMicrosoftAuth:My,openSubscriptionCheckout:JT,parseOAuthCallback:XT,removeAppUrlListener:KT,setSubscriptionCallback:DV},Symbol.toStringTag,{value:"Module"})),eP=m.createContext(null),tP=()=>{const e=m.useContext(eP);if(!e)throw new Error("useCapacitorAuth must be used within CapacitorAuthProvider");return e};function FV(e){if(e instanceof Error){const t={name:e.name,message:e.message,stack:e.stack},n=e;return n.code&&(t.code=n.code),n.cause&&(t.cause=n.cause),t}try{return{type:typeof e,value:JSON.stringify(e)}}catch{return{type:typeof e,value:String(e)}}}const $V=({children:e})=>{const[,t]=Pt(),n=Lt(),{toast:r}=sn(),[s,i]=m.useState(!1),o=m.useCallback(()=>{i(!1),J0(),sessionStorage.removeItem("oauth-in-progress"),sessionStorage.removeItem("oauthFlowInitiated"),sessionStorage.removeItem("oauthStartTime")},[]),l=m.useCallback(async(f,p)=>{console.log("Handling OAuth callback:",{url:f,flowType:p}),i(!0);try{await ZT();const g=XT(f);if(!g.success){r({title:p==="calendar"?"Calendar Connection Failed":"Authentication Failed",description:g.error||"Failed to authenticate",variant:"destructive"}),p==="calendar"?t("/dashboard/sync-settings",{replace:!0}):t("/login?error=auth_failed");return}if(g.token){await co(g.token),g.refreshToken&&await Pf("refreshToken",g.refreshToken),console.log("Tokens stored in localStorage:",{accessToken:g.token.substring(0,20)+"...",refreshToken:g.refreshToken?"present":"not present"});try{console.log("Verifying token with /api/auth/user..."),console.log("API Base URL:","https://repsshield.com"),console.log("Token (first 20 chars):",g.token.substring(0,20)+"...");const v=await Cs("/api/auth/user",{method:"GET",headers:{Authorization:`Bearer ${g.token}`},credentials:Ye()?"omit":"include"});if(console.log("Token verification response:",v.status),!v.ok){const b=await v.text();throw console.error("Token verification failed:",{status:v.status,statusText:v.statusText,body:b}),new Error(`Invalid token: ${v.status} - ${b}`)}const y=await v.json();console.log("User data received:",{id:y.id,email:y.email}),await Pf("user",JSON.stringify(y)),n.setQueryData(["/api/auth/user"],y);const x=g.returnUrl||"/dashboard";t(x,{replace:!0})}catch(v){console.error("Token verification failed:",FV(v));let y="Could not verify your session. Please try again.";v instanceof Error&&(y=v.message),r({title:"Authentication Failed",description:y,variant:"destructive"}),t("/login?error=token_verification_failed")}}else{(p==="calendar"||p==="microsoft")&&await Promise.all([n.invalidateQueries({queryKey:["google-calendar","status"]}),n.invalidateQueries({queryKey:["microsoft-calendar","status"]}),n.invalidateQueries({queryKey:["microsoft-mail","status"]}),n.invalidateQueries({queryKey:["calendar","events"]}),n.invalidateQueries({queryKey:["mail","status"]}),n.invalidateQueries({queryKey:["/api/integrations/calendar-status"]})]),r({title:"Success",description:p==="calendar"?"Calendar connected successfully!":p==="microsoft"?"Outlook connected successfully!":"Authentication successful!"});const v=g.returnUrl||"/dashboard/sync-settings";t(v,{replace:!0})}}catch(g){console.error("Auth callback error:",g),r({title:"Authentication 
10Error",description:"An unexpected error occurred.",variant:"destructive"}),t("/login?error=auth_callback_error")}finally{o()}},[t,n,o,r]);m.useEffect(()=>{if(Ye())return GT(l),()=>{KT()}},[l]),m.useEffect(()=>{if(!Ye())return;const f=()=>{if(!Oy())return;const g=Xu();Date.now()-g<3e3||(console.log("[OAuth] User returned to app without completing auth — resetting"),o())};let p=null;return Yp.addListener("appStateChange",g=>{g.isActive&&setTimeout(f,500)}).then(g=>{p=()=>{g.remove()}}),()=>{p&&p()}},[o]),m.useEffect(()=>{if(!Ye())return;let f=null;return es.addListener("browserFinished",()=>{if(!Oy())return;const p=Xu();Date.now()-p<3e3||(console.log("[OAuth] Browser dismissed before auth completed — resetting"),o())}).then(p=>{f=()=>{p.remove()}}),()=>{f&&f()}},[o]),m.useEffect(()=>{const f=new URLSearchParams(window.location.search),p=f.get("login"),g=f.get("error");if(g){r({title:"Authentication Failed",description:g==="token_verification_failed"?"Could not verify your session. Please try again.":"Sign in failed. Please try again.",variant:"destructive"});const v=window.location.pathname;window.history.replaceState({},"",v);return}if(p==="success"){const v=window.location.pathname;window.history.replaceState({},"",v)}},[r]);const c=m.useCallback(async f=>{if(Ye()){i(!0);try{await Ry("login",f)}catch(p){(p==null?void 0:p.name)==="OAuthCancelledError"?(console.log("Google auth cancelled by user"),o()):(console.error("Google auth error:",p),r({title:"Error",description:"Failed to open Google authentication.",variant:"destructive"}),o())}}else{const p=f?`/api/auth/google?return_url=${encodeURIComponent(f)}`:"/api/auth/google";window.location.href=p}},[o,r]),u=m.useCallback(async f=>{if(Ye()){i(!0);try{await QT(f)}catch(p){(p==null?void 0:p.name)==="OAuthCancelledError"?(console.log("Apple auth cancelled by user"),o()):(console.error("Apple auth error:",p),r({title:"Error",description:"Failed to open Apple authentication.",variant:"destructive"}),o())}}else{const p=f?`/api/auth/apple?return_url=${encodeURIComponent(f)}`:"/api/auth/apple";window.location.href=p}},[o,r]),d=m.useCallback(async f=>{if(Ye()){i(!0);try{await Ry("calendar",f)}catch(p){(p==null?void 0:p.name)==="OAuthCancelledError"?(console.log("Calendar auth cancelled by user"),o()):(console.error("Calendar auth error:",p),r({title:"Error",description:"Failed to open Google Calendar authentication.",variant:"destructive"}),o())}}else{const p=f?`/api/auth/google/calendar?return_url=${encodeURIComponent(f)}`:"/api/auth/google/calendar";window.location.href=p}},[o,r]),h={isCapacitor:Ye(),isAndroid:Gp(),isIOS:Ra(),isAuthenticating:s,openGoogleAuth:c,openAppleAuth:u,openCalendarAuth:d};return a.jsx(eP.Provider,{value:h,children:e})};function VV({children:e}){return m.useEffect(()=>{const t=localStorage.getItem("theme")||"light",n=document.documentElement;t==="dark"?n.classList.add("dark"):t==="light"?n.classList.remove("dark"):t==="system"&&(window.matchMedia("(prefers-color-scheme: dark)").matches?n.classList.add("dark"):n.classList.remove("dark"))},[]),a.jsx(a.Fragment,{children:e})}const nP=m.createContext(void 0);function BV({children:e}){const[t,n]=m.useState(!1),[r,s]=m.useState(null),i=m.useCallback(()=>{n(!0)},[]),o=m.useCallback(()=>{n(!1)},[]),l=m.useCallback(()=>{r&&r()},[r]),c=m.useCallback(u=>{s(()=>u)},[]);return a.jsx(nP.Provider,{value:{isOpen:t,openDialog:i,closeDialog:o,onEntryCreated:l,registerRefreshCallback:c},children:e})}function rP(){const e=m.useContext(nP);if(e===void 0)throw new Error("useNewEntryDialog must be used within a NewEntryDialogProvider");return e}const UV=m.createContext(void 0);function zV({children:e}){const[t,n]=m.useState(!1),r=tt({queryKey:["/api/auth/user"],queryFn:async()=>{const o=await fetch("/api/auth/user");if(o.ok)return n(!0),o.json();if(n(!1),o.status===401)return null;throw new Error("Failed to fetch auth status")},retry:!1,staleTime:6e4}),s=tt({queryKey:["/api/subscription/status"],queryFn:async()=>{const o=await fetch("/api/subscription/status");if(!o.ok)throw new Error("Failed to fetch subscription status");const l=await o.json();if(l.trialEndDate){const c=new Date,d=new Date(l.trialEndDate).getTime()-c.getTime(),h=Math.max(0,Math.ceil(d/(1e3*60*60*24)));return{...l,trialDaysRemaining:h,isTrialExpired:l.hasUsedTrial&&!l.isOnTrial&&l.subscriptionStatus!=="active"}}
10return{...l,trialDaysRemaining:0,isTrialExpired:l.hasUsedTrial&&!l.isOnTrial&&l.subscriptionStatus!=="active"}},enabled:t,staleTime:6e4,refetchInterval:3e5}),i=()=>{js.invalidateQueries({queryKey:["/api/subscription/status"]}),js.invalidateQueries({queryKey:["/api/auth/user"]})};return a.jsx(UV.Provider,{value:{status:s.data||null,isLoading:s.isLoading||r.isLoading,error:s.error,refetchStatus:i,isAuthenticated:t},children:e})}const sP=m.createContext(null);function HV({children:e}){const[t,n]=m.useState({isVisible:!1,id:"",mode:"fullscreen",loadingType:"auto",shouldShowEnhanced:!1}),r=m.useRef(null),s=m.useRef(null),i=m.useRef(null),o=m.useRef(null),l=m.useRef(""),c=m.useCallback(()=>`loading-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[]),u=m.useCallback((x={})=>{const b=c();l.current=b;const S=x.threshold??500,_=x.loadingType||"auto";r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current);let E=!1;return _==="enhanced"?E=!0:_==="minimal"&&(E=!1),r.current=setTimeout(()=>{l.current===b&&(o.current=Date.now(),n({isVisible:!0,id:b,message:x.message||"Please wait while we get everything ready for you...",subMessage:x.subMessage,progress:x.progress,mode:x.mode||"fullscreen",ariaLabel:x.ariaLabel,loadingType:_,threshold:S,shouldShowEnhanced:E,startTime:Date.now()}),_==="auto"&&(i.current=setTimeout(()=>{l.current===b&&n(R=>({...R,shouldShowEnhanced:!0}))},S)))},200),b},[c]),d=m.useCallback((x={})=>{const b=c();l.current=b;const S=x.threshold??500,_=x.loadingType||"auto";r.current&&(clearTimeout(r.current),r.current=null),i.current&&(clearTimeout(i.current),i.current=null);let E=!1;return _==="enhanced"&&(E=!0),o.current=Date.now(),n({isVisible:!0,id:b,message:x.message||"Please wait while we get everything ready for you...",subMessage:x.subMessage,progress:x.progress,mode:x.mode||"fullscreen",ariaLabel:x.ariaLabel,loadingType:_,threshold:S,shouldShowEnhanced:E,startTime:Date.now()}),_==="auto"&&(i.current=setTimeout(()=>{l.current===b&&n(R=>({...R,shouldShowEnhanced:!0}))},S)),b},[c]),h=m.useCallback(x=>{n(b=>b.isVisible?{...b,...x}:b)},[]),f=m.useCallback(x=>{if(x&&l.current!==x)return;r.current&&(clearTimeout(r.current),r.current=null),i.current&&(clearTimeout(i.current),i.current=null);const b=()=>{n(w=>({...w,isVisible:!1,shouldShowEnhanced:!1})),l.current=""};if(o.current){const w=Date.now()-o.current,S=400;w<S?s.current=setTimeout(b,S-w):b()}else b()},[]),p=m.useCallback(async(x,b={})=>{const w=u(b);try{const S=await x;return f(w),S}catch(S){throw f(w),S}},[u,f]),g=m.useCallback(()=>u({loadingType:"enhanced",message:"Signing you in...",mode:"fullscreen"}),[u]),v=m.useCallback(()=>u({loadingType:"enhanced",message:"Signing you out...",mode:"fullscreen"}),[u]);m.useEffect(()=>()=>{r.current&&clearTimeout(r.current),s.current&&clearTimeout(s.current),i.current&&clearTimeout(i.current)},[]);const y={loadingState:t,show:u,showSync:d,update:h,hide:f,showDuring:p,showForLogin:g,showForLogout:v};return a.jsx(sP.Provider,{value:y,children:e})}function iP(){const e=m.useContext(sP);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}const oP=m.createContext(void 0),WV=()=>{const e=m.useContext(oP);if(!e)throw new Error("useOnboarding must be used within OnboardingProvider");return e},bh=[{id:"welcome",title:"Welcome to REPSShield! 🎉",description:"Let me show you around your new Real Estate Professional time tracking dashboard. This tour will help you understand all the features available to you.",targetSelector:'[data-tour="dashboard-header"]',position:"bottom"},{id:"rep-type",title:"Choose Your REP Type",description:"First, set your Real Estate Professional type. Toggle between Long-Term (750 hrs) and Short-Term (500 + 100 hrs) rentals. Click the expand button to see rental type details.",targetSelector:'[data-tour="rep-type-selector"]',position:"bottom"},{id:"progress-overview",title:"Track Your Progress",description:"This section shows your current REP status progress with visual indicators. You can see total hours, material participation hours, and monthly tracking all in one place.",targetSelector:'[data-tour="progress-overview"]',position:"bottom"},{id:"time-logging",title:"Log Your Activities",description:"Use this form to log your real estate activities. You can track hours, select activity types, add descriptions, and upload evidence files to support your REP status.",targetSelector:'[data-tour="time-logging-form"]',position:"left"},{id:"ai-assistant",title:"AI Assistant at Your Service",description:"Need help with REP requirements or tax questions? Switch this pill to Advisor mode for tax-aware guidance with cited answers, or Compliance mode for audit-defensibility questions — either one connects you with an AI assistant trained on your real estate tax situation.",targetSelector:'[data-tour="chat-mode-selector"]',position:"bottom",page:"/dashboard"},{id:"stopwatch",title:"Real-Time Tracking",description:"Use the stopwatch to track t
10ime in real-time. Start it when you begin working, and it will automatically populate your time entry form when you stop.",targetSelector:'[data-tour="stopwatch"]',position:"left",page:"/dashboard",openStopwatch:!0},{id:"properties",title:"Manage Your Properties",description:"Now let's visit the Properties page! This grid shows all your rental properties where you can add new ones and manage existing properties. Each property can be linked to your time entries for better organization and reporting.",targetSelector:'[data-tour="properties-page"]',position:"top",page:"/properties"},{id:"activity-ledger",title:"View Your Activity History",description:"Let's visit the Activity Ledger page! Here you'll find all your logged activities in this interactive table where you can edit entries by clicking on them, upload evidence files, and export your data for tax purposes.",targetSelector:'[data-tour="activity-ledger-datatable"]',position:"top",page:"/activity-ledger"},{id:"files-management",title:"File Vault & Management",description:"Next, let's visit the file vault! This secure storage system manages all your uploaded evidence files with AI-powered analysis and organization. Browse, search, and organize your files here.",targetSelector:'[data-tour="files-management"]',position:"top",page:"/files"},{id:"complete",title:"Congratulations! You're All Set! 🎉",description:`Excellent! You've successfully completed the REPSShield tour and now know how to track your real estate activities across Dashboard, Properties, Activity Ledger, and File Vault. You can restart this tour anytime from the help menu. Click "Finish" to start tracking your REP hours!`,targetSelector:'[data-tour="dashboard-header"]',position:"bottom",page:"/dashboard"}],qV=({children:e})=>{const[t,n]=m.useState(!1),[r,s]=m.useState(0),[i,o]=m.useState(!0),[l,c]=Pt(),u=()=>{o(!0),n(!0),s(0),c("/dashboard")},d=()=>{if(r<bh.length-1){const y=bh[r+1];y.page&&y.page!==l?(c(y.page),setTimeout(()=>{s(r+1)},1e3)):s(r+1)}else p()},h=()=>{if(r>0){const y=bh[r-1];y.page&&y.page!==l?(c(y.page),setTimeout(()=>{s(r-1)},1e3)):s(r-1)}},f=()=>{p()},p=()=>{n(!1),s(0),o(!0),localStorage.setItem("repshield_onboarding_completed","true"),l!=="/dashboard"&&c("/dashboard")},v={isActive:t,currentStep:r,steps:bh,startTour:u,nextStep:d,prevStep:h,skipTour:f,endTour:p,hasCompletedOnboarding:i,setHasCompletedOnboarding:o,restartTour:()=>{o(!1),n(!1),s(0),localStorage.removeItem("repshield_onboarding_completed"),l!=="/dashboard"&&c("/dashboard")}};return a.jsx(oP.Provider,{value:v,children:e})},Dy="repsshield.support.diagnostics.v1",Ly="repsshield.support.apiFailures.v1",GV=50,KV=20,YV=300,QV=500;let Yr=null,si=null;function aP(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function Qp(e){const t=aP();if(!t)return[];try{const n=JSON.parse(t.getItem(e)||"[]");return Array.isArray(n)?n:[]}catch{return[]}}function lP(e,t){const n=aP();if(n)try{n.setItem(e,JSON.stringify(t))}catch{}}const ZV=[[/Bearer\s+[A-Za-z0-9._~+/=-]+/gi,"Bearer [redacted]"],[/eyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]+){1,2}/g,"[redacted-jwt]"],[/((?:token|password|passwd|secret|api[-_]?key|authorization)\s*[:=]\s*)[^\s,;'"&]+/gi,"$1[redacted]"]];function ek(e,t){let n=e;for(const[r,s]of ZV)n=n.replace(r,s);return n=n.replace(/\s+/g," ").trim(),n.length>t?`${n.slice(0,t)}…`:n}function pg(e){if(typeof e=="string")return e;if(e instanceof Error)return e.stack||e.message;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function fu(e){try{Yr===null&&(Yr=Qp(Dy));const t={at:new Date().toISOString(),kind:e.kind,message:ek(e.message,YV),detail:e.detail?ek(e.detail,QV):void 0},n=Yr[Yr.length-1];if(n&&n.kind===t.kind&&n.message===t.message)return;Yr.push(t),Yr=Yr.slice(-GV),lP(Dy,Yr)}catch{}}function tk(e){try{let t=e.url;try{t=new URL(e.url,"http://placeholder.invalid").pathname}catch{t=e.url.split("?")[0]}si===null&&(si=Qp(Ly)),si.push({at:new Date().toISOString(),method:e.method.toUpperCase(),path:t,status:e.status}),si=si.slice(-KV),lP(Ly,si)}catch{}}function XV(){return Yr===null&&(Yr=Qp(Dy)),[...Yr]}function JV(){return si===null&&(si=Qp(Ly)),[...si]}const e6=1800;function cP(){const e=[],t=XV().slice(-8);
10if(t.length===0)e.push("None recorded");else for(const o of t)e.push(`[${o.at}] ${o.kind}: ${o.message}`),o.detail&&e.push(`  ${o.detail}`);const n=[],r=JV().slice(-8);if(r.length===0)n.push("None recorded");else for(const o of r){const l=o.status===0?"network error":String(o.status);n.push(`[${o.at}] ${o.method} ${o.path} — ${l}`)}const s=()=>[...e,...n].reduce((o,l)=>o+l.length+1,0);let i=!1;for(;s()>e6;){if(e.length>1&&e[0]!=="None recorded")e.shift();else if(n.length>1&&n[0]!=="None recorded")n.shift();else break;i=!0}return i&&e.unshift("… [earlier entries truncated]"),["RECENT ERRORS THIS SESSION (auto-filled):",...e,"","RECENT FAILED REQUESTS THIS SESSION (auto-filled):",...n]}let nk=!1;function t6(){if(!(nk||typeof window>"u")){nk=!0;try{const e=console.error.bind(console),t=console.warn.bind(console);console.error=(...n)=>{fu({kind:"console-error",message:n.map(pg).join(" ")}),e(...n)},console.warn=(...n)=>{fu({kind:"console-warn",message:n.map(pg).join(" ")}),t(...n)},window.addEventListener("error",n=>{fu({kind:"window-error",message:n.message||"Unknown window error",detail:n.error instanceof Error?n.error.stack:void 0})}),window.addEventListener("unhandledrejection",n=>{const r=n.reason;fu({kind:"unhandled-rejection",message:r instanceof Error?r.message:pg(r),detail:r instanceof Error?r.stack:void 0})})}catch{}}}class Fy extends Re.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){fu({kind:"react-error",message:t.message,detail:n.componentStack||t.stack}),console.error("ErrorBoundary caught an error:",t,n),console.error("Error stack:",t.stack),console.error("Component stack:",n.componentStack),console.error("Production Error Details:",{message:t.message,stack:t.stack,componentStack:n.componentStack,url:window.location.href,userAgent:navigator.userAgent,timestamp:new Date().toISOString()})}render(){return this.state.hasError?this.props.fallback?this.props.fallback:a.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center p-8 max-w-md mx-auto",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Something went wrong"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"We encountered an error while loading the application."}),!1,a.jsxs("div",{className:"space-x-3",children:[a.jsx("button",{className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",onClick:()=>window.location.reload(),children:"Reload Page"}),a.jsx("button",{className:"px-4 py-2 bg-gray-200 text-gray-800 rounded hover:bg-gray-300 transition-colors",onClick:()=>window.location.href="/",children:"Go Home"})]})]})}):this.props.children}}class n6 extends Re.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){if(t.message.includes("useState")||t.message.includes("useContext")||t.message.includes("useEffect")||t.message.includes("Cannot read properties of null"))return console.warn("HookErrorBoundary caught React hook error:",t.message),{hasError:!0,error:t};throw t}componentDidCatch(t,n){console.error("HookErrorBoundary details:",t,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:a.jsxs("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[a.jsx("h3",{className:"text-yellow-800 font-medium mb-2",children:"Loading Components..."}),a.jsx("p",{className:"text-yellow-700 text-sm",children:"Some components are still initializing. Please wait a moment."})]}):this.props.children}}function r6(){return a.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center p-8",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"REPSShield"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Professional real estate tracking tool"})]})})}class s6 extends Re.Component{constructor(t){super(t),this.initializationTimer=null,this.initializeReact=()=>{try{if(typeof Re<"u"&&Re.useState&&Re.useRef)this.setState({isReactReady:!0,error:null});else throw new Error("React hooks not available")}catch(n){console.warn("React hooks not ready, retrying...",n),setTimeout(()=>{try{this.setState({isReactReady:!0,error:null})}catch(r){this.setState({isReactReady:!1,error:r})}},2e3)}},this.state={isReactReady:!1,error:null}}componentDidMount(){this.initializationTimer=setTimeout(()=>{this.initializeReact()},100)}componentWillUnmount(){this.initializationTimer&&clearTimeout(this.initializationTimer)}render(){return this.state.isReactReady?this.state.error?a.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900",children:a.jsxs("div",{className:"text-center p-8",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Initializing Application"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"Please wait while we set up your workspace..."}),a.jsx("button",{className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",onClick:()=>window.location.reload(),children:"Refresh Page"})]})}):this.props.children:a.jsx(r6,{})}}function i6(){return a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Loading application..."}),a.jsx("p",{className:"text-gray-600",children:"Please wait while we start up."})]})})}function o6({children:e}){return a.jsx(s6,{children:a.jsx(Fy,{fallback:a.jsx(i6,{}),children:a.jsx(TV,{children:a.jsx(X$,{client:js,children:a.jsx(n6,{children:a.jsx(zV,{children:a.jsx(VV,{children:a.jsx($V,{children:a.jsx(BV,{children:a.jsx(HV,{children:a.jsx(qV,{children:a.jsx(Fy,{children:e})})})})})})})})})})})})}async function a6(){const e=kV(),t=e?{Authorization:`Bearer ${e}`}:{},n=await fetch("/api/auth/user",{credentials:"include",cache:"no-cache",headers:t});if(n.status===401)throw(await n.json().catch(()=>({}))).accountCanceled&&(window.location.href="/login?reason=account_canceled"),new Error("Unauthorized");if(!n.ok)throw new Error(`HTTP error: ${n.status}`);return n.json()}function l6(e={}){var u,d,h;const{enabled:t=!0}=e;Lt();const{data:n,isLoading:r,error:s,isError:i}=tt({queryKey:["/api/auth/user"],enabled:t,queryFn:a6,retry:(f,p)=>p.message.includes("401")||p.message.includes("Unauthorized")||p.message.includes("429")?!1:p.message.includes("Server is starting up")||p.message.includes("503")?f<3:f<1,retryDelay:f=>Math.min(1e3*2**f,5e3),refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:!1,staleTime:6e4,gcTime:6e4}),o=((u=s==null?void 0:s.message)==null?void 0:u.includes("401"))||((d=s==null?void 0:s.message)==null?void 0:d.includes("Unauthorized"))||(s==null?void 0:s.status)===401||((h=s==null?void 0:s.response)==null?void 0:h.status)===401,l=o||i?null:n??null,c=!o&&!i&&l!==null;return{user:l,isLoading:r&&!i,isAuthenticated:c,isAdmin:c&&!!(l!=null&&l.isAdmin),error:i?s:null}}const K="u">typeof window?window:void 0,Mn="u">typeof globalThis?globalThis:K,gn=Mn==null?void 0:Mn.navigator,ee=Mn==null?void 0:Mn.document,Bt=Mn==null?void 0:Mn.location,Ju=Mn==null?void 0:Mn.fetch,tb=Mn!=null&&Mn.XMLHttpRequest&&"withCredentials"in new Mn.XMLHttpRequest?Mn.XMLHttpRequest:void 0,rk=Mn==null?void 0:Mn.AbortController,c6=Mn==null?void 0:Mn.CompressionStream,Bn=gn==null?void 0:gn.userAgent;function uP(){return!(!K||K.navigator.onLine===!1)}const Mc=typeof globalThis<"u"?globalThis:K;Mc&&typeof self>"u"&&(Mc.self=Mc),Mc&&typeof File>"u"&&(Mc.File=function(){});const Ce=K??{},u6="0.9.0",di={DEBUG:!1,LIB_VERSION:u6,LIB_NAME:"browser-common"};var vs=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),$y=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const d6=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],h6=["token"];function Pe(e,t){return e.indexOf(t)!==-1}const Zp=function(e){return e.trim()},Vy=function(e){return e.replace(/^\$/,"")};function dP(e){var t;const n=[];return(t=JSON.stringify(e,function(r,s){if(typeof s=="bigint")return s.toString();if(typeof s!="function"&&typeof s!="symbol"){if(s instanceof Error)return{name:s.name,message:s.message,stack:s.stack};if(s&&typeof s=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(s))return"[Circular]";n.push(s)}return s}}))!==null&&t!==void 0?t:"null"}const hP=Object.prototype,nb=hP.hasOwnProperty,Xp=hP.toString,Ae=Array.isArray||function(e){return Xp.call(e)==="[object Array]"},pn=e=>typeof e=="function",et=e=>e===Object(e)&&!Ae(e),sr=e=>{if(et(e)){for(const t in e)if(nb.call(e,t))return!1;return!0}return!1},Q=e=>e===void 0,Je=e=>Xp.call(e)=="[object String]",Cu=e=>Je(e)&&e.trim().length===0,Ut=e=>e===null,Fe=e=>Q(e)||Ut(e),Gt=e=>Xp.call(e)=="[object Number]"&&e==e,ti=e=>Gt(e)&&e>0,Kn=e=>Xp.call(e)==="[object Boolean]",f6=e=>Pe(d6,e),p6=e=>Pe(h6,e);function fP(e){return e===null||typeof e!="object"}function Rf(e,t){return{}.toString.call(e)===`[object ${t}]`}function xc(e){switch({}
vendor: 9,117 bytes, line 10
10.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return pP(e,Error)}}function rb(e){return"u">typeof Event&&pP(e,Event)}function pP(e,t){try{return e instanceof t}catch{return!1}}const m6=[!0,"true",1,"1","yes"],mg=e=>Pe(m6,e),g6=[!1,"false",0,"0","no"];function sk(e,t,n,r,s,i,o){try{var l=e[i](o),c=l.value}catch(u){return void n(u)}l.done?t(c):Promise.resolve(c).then(r,s)}function Rt(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var i=e.apply(t,n);function o(c){sk(i,r,s,o,l,"next",c)}function l(c){sk(i,r,s,o,l,"throw",c)}o(void 0)})}}const v6=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ik=function(e,t=[]){if(!e)return!1;const n=e.toLowerCase();return v6.concat(t).some(r=>{const s=r.toLowerCase();return n.indexOf(s)!==-1})};function Ss(e,t,n,r,s){return t>n&&(r.warn("min cannot be greater than max."),t=n),Gt(e)?e>n?(r.warn(" cannot be  greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),Ss(s??n,t,n,r))}var y6=class{constructor(e){this.C={},this.I=e.I,this.R=Ss(e.bucketSize,0,100,e.A),this.$=Ss(e.refillRate,0,this.R,e.A),this.O=Ss(e.refillInterval,0,864e5,e.A)}F(e,t){const n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.$,this.R),e.lastAccess=e.lastAccess+n*this.O)}consumeRateLimit(e){var t;const n=Date.now(),r=String(e);let s=this.C[r];return s?this.F(s,n):(s={tokens:this.R,lastAccess:n},this.C[r]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),s.tokens===0)}stop(){this.C={}}};const Yl="Mobile",ed="Android",Mf="Tablet",mP="Android Tablet",gP="iPad",vP="Apple Watch",tf="Safari",Jp="BlackBerry",yP="Samsung Internet",nf="Chrome",xP="Chrome iOS",bP="Internet Explorer",wP="Internet Explorer Mobile",_P="Opera",kP="Microsoft Edge",rf="Firefox",SP="Firefox iOS",Of="Nintendo",Df="PlayStation",em="Xbox",EP="Android Mobile",NP="Mobile Safari",gg="Windows",CP="Windows Phone",ok="Nokia",By="Ouya",x6="Generic "+Yl.toLowerCase(),jP="Generic "+Mf.toLowerCase(),Uy="Konqueror",TP="Oculus Browser",PP="Vivaldi",AP="Yandex",IP="Whale",RP="DuckDuckGo",MP="Pale Moon",OP="Waterfox",zy="Brave",DP="Claude",LP="Codex",FP="ChatGPT",$P="Google Search App",vg=new RegExp("Version/(\\d+(\\.\\d+)?)"),yg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),b6=new RegExp(em,"i"),w6=new RegExp("PlayStation \\w+","i"),_6=new RegExp("Nintendo \\w+","i"),sb=new RegExp("BlackBerry|PlayBook|BB10","i"),k6={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},VP=function(e,t,n,r){return t=t||"",function(i){return i!=null&&i.brave?zy:null}(n)||(r!=null&&r.detectGoogleSearchApp&&Pe(e,"GSA/")?$P:Pe(e," OPR/")&&Pe(e,"Mini")?"Opera Mini":Pe(e," OPR/")?_P:sb.test(e)?Jp:Pe(e,"IEMobile")||Pe(e,"WPDesktop")?wP:Pe(e,"OculusBrowser")?TP:Pe(e,"SamsungBrowser")?yP:Pe(e,"Edge")||Pe(e,"Edg/")?kP:Pe(e,"Vivaldi/")?PP:Pe(e,"YaBrowser/")?AP:Pe(e,"Whale/")?IP:Pe(e,"DuckDuckGo/")||Pe(e,"Ddg/")?RP:Pe(e,"Claude/")?DP:Pe(e,"Codex/")?LP:Pe(e,"ChatGPT/")?FP:Pe(e,"FBIOS")?"Facebook Mobile":Pe(e,"UCWEB")||Pe(e,"UCBrowser")?"UC Browser":Pe(e,"CriOS")?xP:Pe(e,"CrMo")||Pe(e,nf)?nf:Pe(e,ed)&&Pe(e,tf)?EP:Pe(e,"FxiOS")?SP:Pe(e.toLowerCase(),Uy.toLowerCase())?Uy:Pe(e,"Brave/")?zy:((i,o)=>o&&Pe(o,"Apple")||function(l){return Pe(l,tf)&&!Pe(l,nf)&&!Pe(l,ed)}(i))(e,t)?Pe(e,Yl)?NP:tf:Pe(e,"PaleMoon/")?MP:Pe(e,"Waterfox/")?OP:Pe(e,rf)?rf:Pe(e,"MSIE")||Pe(e,"Trident/")?bP:Pe(e,"Gecko")?rf:"")},S6={[wP]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[kP]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[nf]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[xP]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[tf]:[vg],[NP]:[vg],[_P]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[rf]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[SP]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Uy]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Jp]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),vg],[EP]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[yP]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[TP]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[PP]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[AP]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[IP]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[zy]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[DP]:[yg],[LP]:[yg],[FP]:[yg],[RP]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[MP]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[OP]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$P]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[bP]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},E6=function(e,t,n,r){const s=VP(e,t,n,r),i=S6[s];if(Q(i))return null;for(let o=0;i.length>o;o++){const l=e.match(i[o]);if(l)return parseFloat(l[l.length-2])}return null},ak=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[em,e&&e[1]||""]],[new RegExp(Of,"i"),[Of,""]],[new RegExp(Df,"i"),[Df,""]],[sb,[Jp,""]],[new RegExp(gg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[CP,""];if(new RegExp(Yl).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let r=k6[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[gg,r]}return[gg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=Q(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ed,[e[2],e[3],e[4]||"0"].join(".")]:[ed,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],BP=function(e){for(let t=0;ak.length>t;t++){const[n,r]=ak[t],s=n.exec(e),i=s&&(pn(r)?r(s,e):r);if(i)return i}return["",""]},UP=function(e){return _6.test(e)?Of:w6.test(e)?Df:b6.test(e)?em:new RegExp(By,"i").test(e)?By:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?CP:/iPad/.test(e)?gP:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?vP:sb.test(e)?Jp:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ok,"i").test(e)?ok:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Yl).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ed:mP:new RegExp("(pda|Mobile)","i").test(e)?x6:new RegExp(Mf,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?jP:""},N6=function(e,t){var n;const r=UP(e);return r===gP||r===mP||r==="Kobo"||r==="Kindle Fire"||r===jP?Mf:r===Of||r===em||r===Df||r===By?"Console":r===vP?"Wearable":r?Yl:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((n=t==null?void 0:t.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((s=t==null?void 0:t.screenWidth)!==null&&s!==void 0?s:0,(i=t==null?void 0:t.screenHeight)!==null&&i!==void 0?i:0)/((o=t==null?void 0:t.devicePixelRatio)!==null&&o!==void 0?o:1)?Yl:Mf:"Desktop";var s,i,o},xg=/\bFBAV\/(\d+(?:\.\d+)*)/i,lk=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",xg],[/\bFBAN\/EMA\b/i,"Facebook Lite",xg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",xg],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?
10:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Hy="[Truncated]",$d="[Unserializable]";function kl(e){let t="";for(let n=0;e.length>n;n++){const r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{const s=e.charCodeAt(n+1);56320>s||s>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}function zP(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(const r of n){let s;try{s=t[r]}catch{s=$d}Object.defineProperty(e,r,{value:s,enumerable:!0,writable:!0,configurable:!0})}return e}const sf=3e5;var HP=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),n=Date.now(),r=Math.min(e.retryAfterMs,sf);if(!t)return this.ts=n,void(this.es=n+r);this.es=Math.max(this.es,Math.min(n+r,this.ts+sf))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(sf,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const C6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ck(e,t){return typeof(n=e)=="string"&&C6.test(n)?e:t();var n}function WP(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function po(e){return e&&e.split("#")[0]}function uk(e){try{return e()}catch{return}}function qP(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function dk(e,t,n){return GP.apply(this,arguments)}function GP(){return(GP=Rt(function*(e,t,n){let r;try{return yield Promise.race([e,new Promise((s,i)=>{r=qP(()=>{try{n==null||n(),s()}catch(o){i(o)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}let wh,hk,bg;function j6(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return bg&&n.length===hk||(hk=n.length,bg=n.reduce((r,s)=>{wh||(wh={});const i=wh[s];if(i)r[i[0]]=i[1];else{const o=e(s);for(let l=o.length-1;l>=0;l--){const c=o[l],u=c==null?void 0:c.filename,d=t[s];if(u&&d){r[u]=d,wh[s]=[u,d];break}}}return r},{})),bg}function ju(e){return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(e)}function T6(e,t,n){return(t=function(r){var s=function(i){if(ju(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var l=o.call(i,"string");if(ju(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}(r);return ju(s)=="symbol"?s:s+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fk(Object(n),!0).forEach(function(r){T6(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var P6=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){const n=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(n,t,0).apply(e),s=this.buildParsingContext(t),i=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(i,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Rt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Ae(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n;let r,s;if(e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
10pFirstLines:0),t.chunkIdMap)}catch{}return U(U({},e),{},{cause:r,stack:s,errors:(n=e.errors)===null||n===void 0?void 0:n.map(i=>this.parseStacktrace(i,t))})}applyChunkIds(e,t){return e.map(n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n))}applyCoercers(e,t){for(const n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Rt(function*(){let n=e;for(const r of t.modifiers)n=yield r(n);return n})()}convertToExceptionList(e,t){const n=[],r=(s,i,o)=>{var l;const c=n.length,u=i===void 0?U(U({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:s.synthetic,exception_id:c}):{type:"chained",source:o,synthetic:s.synthetic,exception_id:c,parent_id:i},d={type:s.type,value:s.value,mechanism:u};s.stack&&(d.stacktrace={type:"raw",frames:s.stack}),n.push(d),s.cause&&r(s.cause,c,"cause");for(const h of(l=s.errors)!==null&&l!==void 0?l:[])r(h,c,"member")};return r(e),n}buildParsingContext(e){var t;return{chunkIdMap:j6(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(xc(e)){let n=Object.getPrototypeOf(e);for(let r=0;n&&100>r;r++){var t;const s=(t=Object.getOwnPropertyDescriptor(n,"constructor"))===null||t===void 0?void 0:t.value;if(typeof s=="function"&&s.name==="AggregateError"){const i=e.errors;return Ae(i)?i:void 0}n=Object.getPrototypeOf(n)}}}catch{}}buildCoercingContext(e,t,n=0){let r=0,s=0,i=!1;const o=new Set,l=[],c={},u=(f,p,g=0)=>{const v=d(p,g),y=v.apply;if(v.apply=E=>{l.push(f);try{return y(E)}finally{l.pop()}},g>4||g>0&&l.indexOf(f)!==-1)return this.coerceFallback(v);const x=typeof f=="object"&&f!==null||typeof f=="function";if(g===0&&r>=50||x&&o.has(f))return;x&&o.add(f),g===0&&r++;const b=this.getAggregateErrors(f);let w,S;i||(i=!!b);try{if(w=this.applyCoercers(f,v),!w)throw c}catch(E){if(E===c)return void(g===0&&r--);if(!i)throw E;w=this.coerceFallback(v)}if(!b||r>=50)return w;try{S=b.length}catch{return w}if(!Number.isInteger(S)||0>S||S>4294967295)return w;const _=[];for(let E=0;50>r&&1e3>s&&S>E;E++){let R;s++;try{R=v.next(b[E])}catch{r++,R=this.coerceFallback(d(p+1))}R&&_.push(R)}return U(U({},w),{},{errors:_})},d=(f,p=0)=>U(U({},t),{},{syntheticException:f==0?t.syntheticException:void 0,mechanism:f==0?e:{},apply(g){const v=u(g,f,p+1);if(!v)throw c;return v},next:g=>u(g,f+1)}),h=d(n);return U(U({},h),{},{apply:f=>{var p;return(p=u(f,n))!==null&&p!==void 0?p:this.coerceFallback(h)}})}};const A6=/^([a-z][a-z0-9.+-]+):/i,I6=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function R6(e){if(!e||e==="<anonymous>")return!1;const t=A6.exec(e);return!t||I6.includes(t[1].toLowerCase())}function Wy(e,t,n,r,s){const i={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:R6(t)};return Q(r)||(i.lineno=r),Q(s)||(i.colno=s),i}const KP=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:"?",n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},M6=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,O6=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,D6=/\((\S*)(?::(\d+))(?::(\d+))\)/,L6=(e,t)=>{const n=M6.exec(e);if(n){const[,s,i,o]=n;return Wy(t,s,"?",+i,+o)}const r=O6.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){const o=D6.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}const[s,i]=KP(r[1]||"?",r[2]);return Wy(t,i,s,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},F6=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$6=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,V6=(e,t)=>{const n=F6.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const i=$6.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}let r=n[3],s=n[1]||"?";return[s,r]=KP(s,r),Wy(t,r,s,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},pk=/\(error: (.*)\)/;function ib(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function B6(e){for(let t=1;10>=t;t++){const n=e.length-2*t;if(0>n)break;let r=!0;for(let s=0;t>s;s++)if(!ib(e[n+s],e[n+t+s])){r=!1;break}if(r){for(let s=0;t>s;s++)e[n+s]=e[n+t+s];return e.length=n+t,{start:n,length:t}}}}function U6(e,t){const n=t.start+t.length,r=QP(e,t);r&&e.splice(n+r===e.length?n:t.start,r)}function YP(e,t){let n=t.start;for(;n>0&&ib(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function QP(e,t){const n=t.start+t.length;let r=n;for(;e.length>r&&ib(e[r],e[r-t.length]);)r++;return r-n}function z6(e,t){const n=t[0];let r=e.length-(n?YP(e,n):0);for(const s of t)r-=QP(e,s);return r}function H6(e,t,n){for(let r=0;e.length>r;r++){const s=e[(t+r)%e.length],i=e[(n+r)%e.length];if(s!==i)return i>s}return!1}var W6=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=Je(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Rf(e,"DOMException")}isDOMError(e){return Rf(e,"DOMError")}},q6=class{match(e){return xc(e)}coerce(e,t){var n;const r=this.getStack(e),s=r===void 0?(n=t.syntheticException)===null||n===void 0?void 0:n.stack:void 0,i=!!s;return{type:this.getType(e),value:this.getMessage(e,t),stack:r??s,cause:e.cause?t.next(e.cause):void 0,synthetic:i}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const n=e.stack;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}},G6=class{match(e){return!!Rf(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);const r=t.apply(e.message);return U(U({},r),{},{stack:(n=this.lr(e))!==null&&n!==void 0?n:r.stack,synthetic:!0})}ar(e){return Je(e.message)&&e.message.length>0}lr(e){var t,n;const r=e,s=(t=r.lineno)!==null&&t!==void 0?t:0,i=(n=r.colno)!==null&&n!==void 0?n:0;if(Je(r.filename)&&r.filename.length!==0&&s!==0)return`Error
11    at ${r.filename}:${s}:${i}`}};const K6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Y6=class{match(e){return typeof e=="string"}coerce(e,t){var n;const[r,s]=this.getInfos(e);return{type:r??"Error",value:s??e,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}getInfos(e){let t="Error",n=e;const r=e.match(K6);return r&&(t=r[1],n=r[2]),[t,n]}};const Q6=["fatal","error","warning","log","info","debug"];function ZP(e,t=40){const n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(let r=n.length;r>0;r--){const s=n.slice(0,r).join(", ");
11if(t>=s.length)return r===n.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var Z6=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,r;const s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))!==null&&n!==void 0?n:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(rb(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Je(t)&&!Cu(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message: '${e.message}'`),n}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${ZP(e)}`}isSeverityLevel(e){return Je(e)&&!Cu(e)&&Q6.indexOf(e)>=0}getStack(e){try{return Je(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Je(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(xc(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},X6=class{match(e){return rb(e)}coerce(e,t){var n;const r=e.constructor.name;return{type:r,value:`${r} captured as exception with keys: ${ZP(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},J6=class{match(t){return fP(t)}coerce(t,n){var r;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:(r=n.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},eB=class{match(e){return Rf(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!rb(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var n;const r=this.getUnhandledRejectionReason(e);return fP(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(r)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Lf="$message",Ff="$timestamp",tB=new Set([Lf,Ff]),wg={enabled:!0,max_bytes:32768};function $f(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:wg.enabled,max_bytes:rB(e.max_bytes,wg.max_bytes)}:U({},wg)}var nB=class{constructor(t){this.ns=[],this.ss=0,this.Ir=$f(t)}setConfig(t){this.Ir=$f(t),this.rs()}add(t){const n=function(s){let i;try{i=dP(s)}catch{return}try{const o=JSON.parse(i);if(!et(o))return;const l=o,c=l[Lf],u=l[Ff];return!Je(c)||c.trim().length===0||!Je(u)&&!Gt(u)?void 0:{step:l,json:i}}catch{return}}(t);if(!n)return;const r=function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;const i=encodeURIComponent(s);let o=0;for(let l=0;i.length>l;l++)i[l]==="%"?(o+=1,l+=2):o+=1;return o}(n.json);r>this.Ir.max_bytes||(this.ns.push({step:n.step,bytes:r}),this.ss+=r,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function rB(e,t){if(!Gt(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const mk=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function gk(e){return typeof e=="string"||e}function vk(e){return typeof e=="string"?e:void 0}const sB=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],XP="NativeGzipValidationError",qy=e=>e.length>=2&&e[0]===31&&e[1]===139,yk=(e,t)=>e===$y.GZipJS||t===$y.GZipJS||t==="gzip",xk=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Oc;const _h=e=>
11{throw WP(XP,`Native gzip produced invalid output: ${e}`)},iB=(bk=Rt(function*(e,t){18>e.size&&_h("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());qy(n)&&n[2]===8||_h("invalid-header");const r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(i=>{const o=(()=>{if(Oc)return Oc;Oc=[];for(let c=0;256>c;c++){let u=c;for(let d=0;8>d;d++)u=1&u?3988292384^u>>>1:u>>>1;Oc[c]=u>>>0}return Oc})();let l=4294967295;for(let c=0;i.length>c;c++)l=o[255&(l^i[c])]^l>>>8;return(4294967295^l)>>>0})(t)&&_h("invalid-crc");const s=t.length>>>0;r.getUint32(4,!0)!==s&&_h("invalid-size")}),function(e,t){return bk.apply(this,arguments)});var bk;function Gy(){return Gy=Rt(function*(e,t=!0,n){try{const s=new TextEncoder().encode(e),i=new globalThis.CompressionStream("gzip"),o=i.writable.getWriter(),l=o.write(s).then(()=>o.close()).catch((r=Rt(function*(d){try{yield o.abort(d)}catch{}throw d}),function(d){return r.apply(this,arguments)})),c=new Response(i.readable).blob(),[u]=yield Promise.all([c,l]);return yield iB(u,s),u}catch(s){if(n!=null&&n.rethrow)throw s;return t&&console.error("Failed to gzip compress data",s),null}var r}),Gy.apply(this,arguments)}function JP(e,t){if(e==null)return{};var n,r,s=function(o,l){if(o==null)return{};var c={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(l.includes(u))continue;c[u]=o[u]}return c}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;i.length>r;r++)t.includes(n=i[r])||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const oB={}.propertyIsEnumerable;function Vf(e,t){try{return eA(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function ob(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:Hy};if(n.remainingNodes--,Kn(e))return{boolValue:e};if(typeof e=="bigint")return function(s,i){const o=s.toString(),l=BigInt("9223372036854775808");return s>=l||-l>s?(i==null||i.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}}(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const s=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:kl(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:Hy};if(e instanceof Date){const s=e.getTime(),i=Number.isFinite(s)?e.toISOString():String(e);return{stringValue:typeof i=="string"?kl(i):String(i)}}n.ancestors.add(e);try{try{const s=e.toJSON;if(typeof s=="function")return ob(s.call(e),t,n,r+1)}catch{}return Ae(e)?{arrayValue:{values:aB(e,t,n,r+1)}}:{kvlistValue:{values:eA(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:kl(String(e))}}function aB(e,t,n,r){const s=[],i=Math.min(e.length,1e3);let o=0;for(;i>o&&n.remainingNodes>0;o++)try{const l=o in e?e[o]:void 0;if(Fe(l))continue;s.push(ob(l,t,n,r))}catch{s.push({stringValue:$d})}return e.length>o&&s.push({stringValue:Hy}),s}function eA(e,t,n,r){const s=[];for(const i in e)if(oB.call(e,i)){if(!i){t==null||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[i];if(Ut(o)||Q(o))continue;s.push({key:kl(i),value:ob(o,t,n,r)})}catch{s.push({key:kl(i),value:{stringValue:$d}})}}return s}function tA(e,t,n){return U(U(U(U({},zP({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}const lB=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function nA(e,t){const n=zP({},e),r={};for(const s of lB)({}).hasOwnProperty.call(n,s)&&(r[s]=n[s],delete n[s]);return[...Vf(n,t),...Vf(r,t)]}const wk={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},rA={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},cB=rA.info;function uB(e){try{return kl(String(e))}catch{return $d}}function dB(e,t,n,r){const s=e.level||"info",{text:i,number:o}=rA[s]||cB,l=function(f=Date.now()){return String(f)+"000000"}(Gt(r)?r:void 0),c={};t.distinctId&&(c.posthogDistinctId=t.distinctId),t.sessionId&&(c.sessionId=t.sessionId),t.windowId&&(c["window.id"]=t.windowId),Fe(t.sessionStartTimestamp)||(c.sessionStartTimestamp=String(t.sessionStartTimestamp)),Fe(t.lastActivityTimestamp)||(c.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(c["url.full"]=t.currentUrl),t.screenName&&(c["screen.name"]=t.screenName),t.appState&&(c["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(c.feature_flags=t.activeFeatureFlags);const u=U({},c),d=e.attributes;if(d){let f=[];try{f=Object.keys(d)}catch{f=[]}for(const p of f){let g;
11try{g=d[p]}catch{g=$d}Object.defineProperty(u,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:i,body:{stringValue:uB(e.body)},attributes:Vf(u,n)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Q(e.trace_flags)||(h.flags=e.trace_flags),h}function sA(e,t,n){return tA(e,t,n)}function iA(e,t,n,r){return{resourceLogs:[{resource:{attributes:nA(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var oA=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=qP(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function aA(){return .75+.5*Math.random()}function lA(e,t,n,r){const s=Math.min(Math.max(0,t-1),6),i=e*Math.pow(2,s);return Math.round(Math.min(i,Math.max(r,e))*n)}var hB=class{constructor(e,t,n,r,s,i=()=>Promise.resolve(),o){var l;this._instance=e,this.Ir=t,this.A=n,this.cs=r,this.ds=s,this.vs=i,this.fs=o,this.ps=new oA(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new HP,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((l=t.maxQueueSize)!==null&&l!==void 0?l:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(vs.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var n;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;const r=this.Os(e);if(r===null)return;if(!r.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:dB(r,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.cs(),this.A,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const n=Ae(t)?t:[t];let r=e;for(const s of n)try{const i=s(r);if(!i)return this.A.info("Log was rejected in beforeSend function"),null;r=i}catch(i){return this.A.error("Error in beforeSend function for log:",i),null}return r}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Rt(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Rt(function*(){var t;e.ps.clear();let n=(t=e._instance.getPersistedProperty(vs.LogsQueue))!==null&&t!==void 0?t:[];if(n.length===0)return;const r=n.length;let s=0;for(;n.length>0&&r>s;){var i,o;const l=e._s;e.bs=0;const c=Math.min(n.length,e.Es),u=n.slice(0,c),d=iA(u.map(f=>f.record),e.qs(),(i=e.fs)!==null&&i!==void 0?i:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(d);if(e._s!==l)return;if(h.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.A.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),n=(o=e._instance.getPersistedProperty(vs.LogsQueue))!==null&&o!==void 0?o:[],s+=u.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return Rt(function*(){var n;const r=Math.max(0,e-t.bs),s=(n=t._instance.getPersistedProperty(vs.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(vs.LogsQueue,s.slice(r)),yield t.vs()})()}qs(){return sA(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(vs.LogsQueue))!==null&&t!==void 0?t:[];this.Is>n.length||(n.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(vs.LogsQueue,n),this.Ts>n.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(lA(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(vs.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Rt(function*(){t.ps.clear();const n=t.flush().catch(()=>{});e!==void 0?yield dk(n,e):yield n})()}flushWithTimeout(e){var t=this;return Rt(function*(){const n=t.flush();yield dk(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=aA(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const _g=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function _k(e){return String(e)+"000000"}function kk(e,t,n,r){let s="";return r&&(s=Object.keys(r).sort().map(i=>`${JSON.stringify(i)}:${JSON.stringify(r[i])}`).join(",")),`${e}\0${t}\0${n??""}\0${s}`}var fB=class{constructor(e,t,n){this._instance=e,this.Ir=t,this.A=n,this.zs=new Map,this.ps=new oA(()=>this.flush().catch(r=>{this.A.error("Metrics flush failed:",r)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new HP,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}
11gauge(e,t,n){this.Zs({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Zs({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this;const t=this.ys,n=function(){var r=Rt(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return r.apply(this,arguments)}}()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,r;try{n=t.attributes?U({},t.attributes):void 0,r=kk(t.type,t.name,t.unit,n)}catch(o){return void this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let s=this.zs.get(r);if(!s){if(!this.Ks())return;s={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.zs.set(r,s)}const i=this.Ws.get(t.name);i===void 0?this.Ws.set(t.name,t.type):i===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${i}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var n;e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(_g.length+1).fill(0)});const r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[function(s,i){for(let o=0;i.length>o;o++)if(i[o]>=s)return o;return i.length}(t,_g)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const n=Ae(t)?t:[t];let r=e;for(const s of n)try{const i=s(r);if(!i)return this.A.info("Metric was rejected in beforeSend function"),null;r=i}catch(i){return this.A.error("Error in beforeSend function for metric:",i),null}return r}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(lA(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Rt(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const n=e.Gs,r=yield e._instance.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(r),r.kind==="retry-later"?(e.ks++,e.Ss=aA()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),r.kind){case"ok":return;case"retry-later":return e.ho(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",r.error)}})()}Js(e){return t=this.co(e),n=function(i,o,l){return tA(i,o,l)}(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:nA(n)},scopeMetrics:[{scope:{name:r,version:s},metrics:t}]}]};var t,n,r,s}co(e){const t=_k(Date.now()),n=new Map;for(const o of e.values()){var r;const l=kk(o.type,o.name,o.unit,void 0);let c=n.get(l);c||(c=U({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},n.set(l,c));const u=Vf((r=o.attributes)!==null&&r!==void 0?r:{},this.A),d=_k(o.windowStartMs);if(o.type==="count"){var s;const h={attributes:u,startTimeUnixNano:d,timeUnixNano:t,asDouble:(s=o.total)!==null&&s!==void 0?s:0};c.sum.dataPoints.push(h)}else if(o.type==="gauge"){var i;const h={attributes:u,timeUnixNano:t,asDouble:(i=o.last)!==null&&i!==void 0?i:0};c.gauge.dataPoints.push(h)}else o.hist&&c.histogram.dataPoints.push({attributes:u,startTimeUnixNano:d,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:_g})}return Array.from(n.values())}ho(e){for(const[r,s]of e){const i=this.zs.get(r);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,s.windowStartMs),i.type){case"count":var t,n;i.total=((t=i.total)!==null&&t!==void 0?t:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(i.hist){i.hist.count+=s.hist.count,i.hist.sum+=s.hist.sum,i.hist.min=Math.min(i.hist.min,s.hist.min),i.hist.max=Math.max(i.hist.max,s.hist.max);for(let o=0;i.hist.bucketCounts.length>o;o++)i.hist.bucketCounts[o]+=s.hist.bucketCounts[o]}else i.hist=s.hist}else this.Ks()&&this.zs.set(r,s)}}};const cA=(e,{debugEnabled:t}={})=>
11{const n={N(r,...s){K&&(di.DEBUG||K.POSTHOG_DEBUG||t)&&!Q(K.console)&&K.console&&("__rrweb_original__"in K.console[r]?K.console[r].__rrweb_original__:K.console[r])(e,...s)},debug(...r){n.N("debug",...r)},info(...r){n.N("log",...r)},warn(...r){n.N("warn",...r)},error(...r){n.N("error",...r)},critical(...r){console.error(e,...r)},uninitializedWarning(r){n.error(`You must initialize PostHog before calling ${r}`)},createLogger:(r,s)=>cA(`${e} ${r}`,s)};return n},ue=cA("[PostHog.js]"),Ht=ue.createLogger,pB=Ht("[ExternalScriptsLoader]"),Bf=e=>{const t=ee==null?void 0:ee.querySelectorAll("script");if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Wo=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return pB.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const r=Bf(t);if(r){if(r.__posthog_loading_callback_fired)return n();const i=r.__posthog_loading_error;return i?n(i):(r.addEventListener("load",o=>{r.__posthog_loading_callback_fired=!0,n(void 0,o)}),void r.addEventListener("error",o=>{r.__posthog_loading_error=o,n(o)}))}const s=()=>
11{if(!ee)return n("document not found");if(Bf(t))return Wo(e,t,n);let i=ee.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=l=>{i.__posthog_loading_callback_fired=!0,n(void 0,l)},i.onerror=l=>{i.__posthog_loading_error=l,n(l)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ee.head.appendChild(i);else{const l=ee.querySelectorAll("body > script");var o;l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(i,l[0]):ee.body.appendChild(i)}};ee!=null&&ee.body?s():ee==null||ee.addEventListener("DOMContentLoaded",s)},kg={},Sk=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",n)};Ce.__PosthogExtensions__=Ce.__PosthogExtensions__||{},Ce.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t==="remote-config"){const s=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Wo(e,s,n)}const r=e.config.strict_script_versioning;if(r){const s=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),i=kg[s];if(r==="fallback"&&i){if(Bf(i))return void Wo(e,i,n);delete kg[s]}return void Wo(e,s,r==="fallback"?(o,l)=>{if(o)if(typeof o=="string")n(o);else{var c;const u=Sk(e,t);kg[s]=u;const d=Bf(s);d==null||(c=d.parentNode)===null||c===void 0||c.removeChild(d),Wo(e,u,n)}else n(void 0,l)}:n)}Wo(e,Sk(e,t),n)},Ce.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const r=e.requestRouter.endpointFor("api",t);Wo(e,r,n)},di.DEBUG=!1,di.LIB_VERSION="1.435.3",di.LIB_NAME="web";var un=di;const mB="$people_distinct_id",Wr="distinct_id",ab="$device_id",Sg="$device_model",Uf="__alias",gB="__cmpns",Ek="$fbc",Sl="$fbc_persistence",Nk="$fbp",Tu="$fbp_persistence",Ky="__timers",uA="$autocapture_disabled_server_side",Yy="$heatmaps_enabled_server_side",Qy="$exception_capture_enabled_server_side",dA="$error_tracking_suppression_rules",Zy="$error_tracking_capture_extension_exceptions",Xy="$web_vitals_enabled_server_side",lb="$dead_clicks_enabled_server_side",cb="$product_tours_enabled_server_side",hA="$logs_capture_enabled_server_side",fA="$web_vitals_allowed_metrics",Pu="$session_recording_remote_config",vB="$session_recording_enabled_server_side",yB="$replay_sample_rate",xB="$replay_override_sampling",bB="$replay_override_linked_flag",wB="$replay_override_url_trigger",_B="$replay_override_event_trigger",fl="$sesid",pA="$session_is_sampled",kB="$session_past_minimum_duration",SB="$session_recording_url_trigger_activated_session",EB="$session_recording_event_trigger_activated_session",NB="$debug_first_full_snapshot_timestamp",CB="$sess_rec_flush_size",Zr="$enabled_feature_flags",ci="$active_feature_flags",Jy="$early_access_features",pa="$feature_flag_details",so="$feature_flag_payloads",ma="$feature_flag_request_id",Au="$minimal_flag_called_events",gs="$override_feature_flags",qo="$override_feature_flag_payloads",io="$stored_person_properties",oo="$stored_group_properties",mA="$groups",pu="$surveys",zf="$surveys_loaded_at",gA="$surveys_activated",vA="$surveys_activated_session",yA="$surveys_activated_timestamps",ex="ph_product_tours",jB="$product_tours_activated",TB="$product_tours_activated_session",PB="$conversations_widget_session_id",AB="$conversations_ticket_id",IB="$conversations_widget_state",RB="$conversations_user_traits",ao="$flag_call_reported",mu="$flag_call_reported_session_id",td="$feature_flag_errors",ho="$feature_flag_evaluated_at",Hn="$user_state",tx="$client_session_props",MB="$capture_rate_limit",xA="$initial_campaign_params",bA="$initial_referrer_info",pl="$initial_person_info",ub="$epp",Eg="$posthog_cookieless",wA="$cookieless_mode",_A="$sdk_debug_extensions_init_method",kA="$sdk_debug_extensions_init_time_ms",db="$sdk_debug_recording_script_not_loaded",hb="$sdk_debug_replay_stale_config",SA="$sdk_debug_replay_event_trigger_status",EA="$sdk_debug_replay_linked_flag_trigger_status",NA="$sdk_debug_replay_matched_recording_trigger_groups",CA="$sdk_debug_replay_pen
11ding_trigger_conditions",jA="$sdk_debug_replay_remote_trigger_matching_config",TA="$sdk_debug_replay_trigger_groups_count",PA="$sdk_debug_replay_url_trigger_status",OB="$session_recording_start_reason",fb="PostHog loadExternalDependency extension not found.",ui="anonymous",of="identified",AA="identified_only",nd="visibilitychange",Hf="beforeunload",pb="$pageview",Ck="$pageleave",IA="$identify",jk="$groupidentify";function ml(e,t){Ae(e)&&e.forEach(t)}function xt(e,t){if(!Fe(e))if(Ae(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,r)=>t(n,r));else for(const n in e)nb.call(e,n)&&t(e[n],n)}const It=function(e,...t){for(const n of t)for(const r in n)n[r]!==void 0&&(e[r]=n[r]);return e};function af(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}const DB=function(e){return function(...t){try{return e.apply(this,t)}catch(n){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(n)}}},mb=function(e){const t={};return xt(e,function(n,r){(Je(n)&&n.length>0||Gt(n))&&(t[r]=n)}),t};function RA(e){const t=U({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const LB=["herokuapp.com","vercel.app","netlify.app"];function FB(e){const t=e==null?void 0:e.hostname;if(!Je(t))return!1;const n=t.split(".").slice(-2).join(".");for(const r of LB)if(n===r)return!1;return!0}function pt(e,t,n,r){const{capture:s=!1,passive:i=!0}=r??{};e==null||e.addEventListener(t,n,{capture:s,passive:i})}function nx(e){return e.name==="ph_toolbar_internal"}const Iu=e=>{if(ee){try{const t=e+"=",n=ee.cookie.split(";").filter(r=>r.length);for(let r=0;n.length>r;r++){let s=n[r];for(;s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Gt(e)&&isFinite(e)&&Math.floor(e)===e});var $B=class rx{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,s){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||0>t||0>n||0>r||0>s||t>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/256,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new rx(i)}toString(){let t="";for(let n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new rx(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;16>n;n++){const r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}},VB=class{generate(){const e=this.generateOrAbort();if(!Q(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(Q(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return Gt(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return $B.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new BB}};let MA=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};K&&!Q(K.crypto)&&crypto.getRandomValues&&(MA=e=>crypto.getRandomValues(e));var BB=class{nextUint32(){return this.Rt.length>this.At||(MA(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}};let Tk;const Xr=()=>UB().toString(),UB=()=>(Tk||(Tk=new VB)).generate();let Dc="";const zB=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Ga=null;const Vt={Et(){if(!Ut(Ga))return Ga;if(Ga=!1,ee)try{const e=`__ph_cookie_support_${Xr()}`;Vt.$t(e,"xyz"),Ga=Iu(e)==='"xyz"',Vt.Lt(e)}catch{Ga=!1}
11return Ga},Pt(e){ue.error("cookieStore error: "+e)},Ot:Iu,Dt(e){let t;try{t=JSON.parse(Vt.Ot(e))||{}}catch{}return t},$t(e,t,n,r,s){if(!ee)return!1;try{let i="",o="";const l=function(u,d){if(d){let h=function(f,p=ee){if(Dc)return Dc;if(!p||["localhost","127.0.0.1"].includes(f))return"";const g=f.split(".");let v=Math.min(g.length,8);const y="dmn_chk_"+Xr();for(;!Dc&&v--;){const x=g.slice(v).join("."),b=y+"=1;domain=."+x+";path=/";p.cookie=b+";max-age=3",p.cookie.includes(y)&&(p.cookie=b+";max-age=0",Dc=x)}return Dc}(u);if(!h){const f=(p=>{const g=p.match(zB);return g?g[0]:""})(u);f!==h&&ue.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""}(ee.location.hostname,r);if(n){const u=new Date;u.setTime(u.getTime()+864e5*n),i="; expires="+u.toUTCString()}s&&(o="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+l+o;return c.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+c.length),ee.cookie=c,!0}catch{return!1}},Lt(e,t){if(ee!=null&&ee.cookie&&(!t||!Ut(Iu(e))))try{Vt.$t(e,"",-1,t)}catch{return}}};let Ng=null;const ot={Et(){if(!Ut(Ng))return Ng;let e=!0;if(Q(K))e=!1;else try{const t="__mplssupport__";ot.$t(t,"xyz"),ot.Ot(t)!=='"xyz"'&&(e=!1),ot.Lt(t)}catch{e=!1}return e||ue.error("localStorage unsupported; falling back to cookie store"),Ng=e,e},Pt(e){ue.error("localStorage error: "+e)},Ot(e){try{return K==null?void 0:K.localStorage.getItem(e)}catch(t){ot.Pt(t)}return null},Dt(e){try{return JSON.parse(ot.Ot(e))||{}}catch{}return null},$t(e,t){try{return K==null||K.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ot.Pt(n)}return!1},Lt(e){try{K==null||K.localStorage.removeItem(e)}catch(t){ot.Pt(t)}}},Cg=[io,ci,Zr,pa,so,ma,ho,td,ao],Go=[ab,Wr,fl,pA,ub,pl,Sl,Hn],Wf=e=>e+"_cpm",HB=["__proto__","constructor","prototype"],jg=e=>{if(!et(e))return{};const t={};return Object.keys(e).forEach(n=>{HB.indexOf(n)===-1&&(t[n]=e[n])}),t},Tg=(e,t=[])=>{const n={};return[...Go,...t].forEach(r=>{const s=e[r];Q(s)||Ut(s)||s===""||(n[r]=s)}),n},OA=e=>{let t=5381,n=2166136261;for(let r=0;e.length>r;r++){const s=e.charCodeAt(r);t=33*t^s,n=Math.imul(n^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Pk=(e,t)=>({p:t,f:OA(JSON.stringify(e))}),Ak=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Vt.Dt(Wf(e)),r=(n==null?void 0:n.f)===OA(t)&&Ae(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Pg=(e,t)=>t+"|"+(Vt.Ot(Wf(e))||""),Ka={},sx={Et:()=>!0,Pt(e){ue.error("memoryStorage error: "+e)},Ot:e=>e in Ka?Ka[e]:null,Dt:e=>e in Ka?Ka[e]:null,$t:(e,t)=>(Ka[e]=t,!0),Lt(e){delete Ka[e]}};let Fo=null;const Tt={Et(){if(!Ut(Fo))return Fo;if(Fo=!0,Q(K))Fo=!1;else try{const e="__support__";Tt.$t(e,"xyz"),Tt.Ot(e)!=='"xyz"'&&(Fo=!1),Tt.Lt(e)}catch{Fo=!1}return Fo},Pt(e){ue.error("sessionStorage error: ",e)},Ot(e){try{return K==null?void 0:K.sessionStorage.getItem(e)}catch(t){Tt.Pt(t)}return null},Dt(e){try{return JSON.parse(Tt.Ot(e))||null}catch{}return null},$t(e,t){try{return K==null||K.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Tt.Pt(n)}return!1},Lt(e){try{K==null||K.sessionStorage.removeItem(e)}catch(t){Tt.Pt(t)}}};var WB=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return mg(e)?1:Pe(g6,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?ot:Vt,n=t.Et()?t:sx;if(!this.jo||this.jo!==n){this.jo=n;const r=e==="localStorage"?Vt:ot;r.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(mg(r.Ot(this.qo))),r.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[gn==null?void 0:gn.doNotTrack,gn==null?void 0:gn.msDoNotTrack,Ce.doNotTrack,gn==null?void 0:gn.globalPrivacyControl].some(e=>mg(e))}};function DA(e,t){var n;const r=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;
11if(!pn(r))return t;try{const s=r(t);return Je(s)&&s?s:t}catch(s){return ue.error("Error in get_current_url, falling back to window.location.href",s),t}}function Ik(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Os(e){return!!e&&e.nodeType===1}function Nn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function LA(e){return!!e&&e.nodeType===3}function gb(e){return!!e&&e.nodeType===11&&Os(e.host)}function vb(e){return e?Zp(e).split(/\s+/):[]}function Rk(e,t){const n=function(r){var s;const i=K==null||(s=K.location)===null||s===void 0?void 0:s.href;return Q(i)?void 0:DA(r,i)}(t);return!!(n&&e&&e.some(r=>n.match(r)))}function Ql(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return vb(t)}function FA(e){return Fe(e)?null:Zp(e).split(/(\s+)/).filter(t=>Mu(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rd(e){let t="";return El(e)&&!sd(e)&&e.childNodes&&e.childNodes.length&&xt(e.childNodes,function(n){var r;LA(n)&&n.textContent&&(t+=(r=FA(n.textContent))!==null&&r!==void 0?r:"")}),Zp(t)}function Ru(e){var t;return Q(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const yb=["a","button","form","input","select","textarea","label"];function ix(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function ox(e,t){if(Q(t))return!0;for(const n of e)if(t.some(r=>ix(n,r)))return!0;return!1}function $A(e){const t=e.parentNode;return!(!t||!Os(t))&&t}const Ag=[".ph-no-autocapture","[data-ph-no-autocapture]"],VA=["next","previous","prev",">","<"],qB=[...VA,"+","-","−","–"],Mk=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Ok=[".ph-no-rageclick",".ph-no-capture"],GB=["","text","search","email","password","url","tel","number"];function BA(e,t){if(!K||xb(e))return!1;let n,r,s;var i,o;if(Kn(t)?(n=!!t&&Ok,r=void 0,s=!1):(n=(i=t==null?void 0:t.css_selector_ignorelist)!==null&&i!==void 0?i:Ok,r=t==null?void 0:t.content_ignorelist,s=(o=t==null?void 0:t.ignore_text_selection)!==null&&o!==void 0&&o),n===!1||s&&function(c){return!(!c||!Os(c))&&(!!Nn(c,"textarea")||(Nn(c,"input")?Pe(GB,(c.getAttribute("type")||"").toLowerCase()):function(u){var d;if(u.isContentEditable)return!0;const h=(d=u.getAttribute)===null||d===void 0?void 0:d.call(u,"contenteditable");return h==="true"||h===""}(c)))}(e))return!1;const{targetElementList:l}=UA(e,!1);return!function(c,u){if(c===!1||Q(c))return!1;let d;if(c===!0)d=VA;else{if(!Ae(c))return!1;if(c.length>10)return ue.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;d=c.map(h=>h.toLowerCase())}return u.some(({safeText:h,ariaLabel:f})=>d.some(p=>Mk(h,p)||Mk(f,p)))}(r,l.map(c=>{var u;return{safeText:rd(c).toLowerCase(),ariaLabel:((u=c.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!ox(l,n)}const xb=e=>!e||Nn(e,"html")||!Os(e),UA=(e,t)=>{if(!K||xb(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const r=[e];let s=e;for(;s.parentNode&&!Nn(s,"body");){if(gb(s.parentNode)){r.push(s.parentNode.host),s=s.parentNode.host;continue}const i=$A(s);if(!i)break;if(t||yb.indexOf(i.tagName.toLowerCase())>-1)n=!0;else try{const o=K.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function El(e){const t=new Set;let n=0;for(let i=e;i.parentNode&&!Nn(i,"body");i=i.parentNode){if(n++>=1e3||t.has(i))return!1;t.add(i);const o=Ql(i);if(Pe(o,"ph-sensitive")||Pe(o,"ph-no-capture"))return!1}if(Pe(Ql(e),"ph-include"))return!0;const r=e.type||"";if(Je(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}
11const s=e.name||e.id||"";return!Je(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function sd(e){return!!(Nn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Nn(e,"select")||Nn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const Dk=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Lk=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,KB=[16,15,14,13],YB=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Fk=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),$k=/[0-9A-Za-z_]/;function QB(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let s=e.charCodeAt(r)-48;n&&(s*=2,s>9&&(s-=9)),t+=s,n=!n}return t%10==0}function Mu(e,t=!0){return!(Fe(e)||Je(e)&&(e=Zp(e),(t?Dk.test((e||"").replace(/[- ]/g,"")):function(n){let r;for(Lk.lastIndex=0;r=Lk.exec(n);){const s=r[2];if(!s)continue;const i=s.replace(/[- ]/g,"");for(let o=0;i.length>o;o++)for(const l of KB){const c=o+l;if(i.length>=c){const u=i.slice(o,c);if(Dk.test(u)&&QB(u))return!0}}}return!1}(e))||(t?YB.test(e):function(n){let r;for(Fk.lastIndex=0;r=Fk.exec(n);){const s=r[1],i=r[3];if(!(s&&i&&$k.test(s)&&$k.test(i)))return!0}return!1}(e))))}function Vk(e){let t=rd(e);return t=`${t} ${zA(e)}`.trim(),Mu(t)?t:""}function zA(e){let t="";return e&&e.childNodes&&e.childNodes.length&&xt(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{const s=rd(n);t=`${t} ${s}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${zA(n)}`.trim())}catch(s){ue.error("[AutoCapture]",s)}}),t}function Bk(e){return e.replace(/"|\\"/g,'\\"')}function ZB(e){const t=e.attr__class;if(t)return Ae(t)?t:vb(t)}const kh=Ht("[Dead Clicks]"),XB=()=>!0,JB=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(lb)),r=e.instance.config.capture_dead_clicks;return Kn(r)?r:!!et(r)||n};var Uk=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[lb]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(e){var t,n,r;!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"dead-clicks-autocapture",s=>{s?kh.error("failed to load script",s):e()})}zo(){var e;if(ee){if(!this.Bo&&(!((e=Ce.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=et(this.instance.config.capture_dead_clicks)?U({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=Ce.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(ee),kh.info("starting...")}}else kh.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,kh.info("stopping..."))}};const Lc=Ht("[SegmentIntegration]");function zk(e,t,n=!0){const r=e.config.segment;if(!r)return t();const{analytics:s,filterProperties:i}=(l=>pn(l.register))(o=r)?{analytics:o}:o;var o;(function(l,c,u,d){const h=p=>{const g=()=>p.anonymousId()||Xr();l.config.get_device_id=g,d&&p.id()&&(l.register({distinct_id:p.id(),$device_id:g()}),l.persistence.set_property(Hn,of)),u(d?void 0:p.anonymousId()||void 0)},f=c.user();"then"in f&&pn(f.then)?f.then(h):h(f)})(e,s,l=>{s.register(((c,u,{filterProperties:d}={})=>{typeof Promise<"u"&&Promise.resolve||Lc.warn("This browser does not have Promise support, and can not use the segment integration");const h=(f,p)=>{if(!p)return f;const g=!!u&&f.event.anonymousId===u&&!f.event.userId;g||f.event.userId||f.event.anonymousId===c.get_distinct_id()||(Lc.info("No userId set, resetting PostHog"),c.reset()),g||(u=void 0),f.event.userId&&f.event.userId!==c.get_distinct_id()&&(Lc.info("UserId set, identifying with PostHog"),c.identify(f.event.userId)
vendor: 1,505 bytes, line 11
11);let v=c.calculateEventProperties(p,f.event.properties);if(!Fe(d)){const y=f.event.properties||{},x={};for(const w of Object.keys(v))nb.call(y,w)||(x[w]=v[w]);const b=((w,S)=>{const _=Ae(w)?w:[w];let E=U({},S);for(const R of _)try{if(E=R(E),Fe(E))return null}catch(A){return Lc.error("Error in Segment filterProperties:",A),null}return E})(d,x);if(Fe(b))return f;v=b}return f.event.properties=Object.assign({},v,f.event.properties),f};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(f){return h(f,f.event.event)},page(f){return h(f,pb)},identify(f){return h(f,IA)},screen(f){return h(f,"$screen")}}})(e,l,{filterProperties:i})).then(()=>{t()},c=>{Lc.error("Failed to register the Segment integration",c),t()})},n)}const HA="posthog-js";function WA(e,{organization:t,projectId:n,prefix:r,severityAllowList:s=["error"],sendExceptionsToPostHog:i=!0}={}){return o=>{var l,c,u,d,h;if(s!=="*"&&!s.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const f=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=((l=o.exception)===null||l===void 0?void 0:l.values)||[],g=p.map(x=>U(U({},x),{},{stacktrace:x.stacktrace?U(U({},x.stacktrace),{},{type:"raw",frames:(x.stacktrace.frames||[]).map(b=>U(U({},b),{},{platform:"web:javascript"}))}):void 0}
11)),v={$exception_message:((c=p[0])===null||c===void 0?void 0:c.value)||o.message,$exception_type:(u=p[0])===null||u===void 0?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=p[0])===null||d===void 0?void 0:d.value)||o.message,$sentry_exception_type:(h=p[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var y;return t&&n&&(v.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),i&&((y=e.exceptions)===null||y===void 0||y.sendExceptionEvent(v)),o}}var eU=class{constructor(e,t,n,r,s,i){this.name=HA,this.setupOnce=function(o){o(WA(e,{organization:t,projectId:n,prefix:r,severityAllowList:s,sendExceptionsToPostHog:i==null||i}))}}},Hk=class{constructor(e){this.Uo=(t,n,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var n;const r=this.Zo(e,t);return this.Wo={pathname:(n=K==null?void 0:K.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Zo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,t){const n=this.Wo;if(!n)return{$pageview_id:t};let r={$pageview_id:t,$prev_pageview_id:n.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:i,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=s;if(!(Q(i)||Q(o)||Q(l)||Q(c)||Q(u)||Q(d))){i=Math.ceil(i),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);const h=i>1?Ss(o/i,0,1,ue):1,f=i>1?Ss(l/i,0,1,ue):1,p=c>1?Ss(u/c,0,1,ue):1,g=c>1?Ss(d/c,0,1,ue):1;r=It(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:g})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}};const Fc=["flags","surveys"],tU={[mB]:{exposure:"hidden"},[Uf]:{exposure:"hidden"},[gB]:{exposure:"hidden"},[Ky]:{exposure:"hidden"},[Sl]:{exposure:"hidden"},[Tu]:{exposure:"hidden"},[uA]:{exposure:"event"},[Yy]:{exposure:"hidden"},[hA]:{exposure:"hidden"},[Qy]:{exposure:"event"},[dA]:{exposure:"hidden"},[Zy]:{exposure:"event"},[Xy]:{exposure:"event"},[lb]:{exposure:"event"},[cb]:{exposure:"hidden"},[fA]:{exposure:"event"},[Pu]:{exposure:"hidden"},[vB]:{exposure:"hidden"},[fl]:{exposure:"hidden"},[pA]:{exposure:"event"},[yB]:{exposure:"event",shouldSkipFromEventProperties:e=>Ut(e)},[kB]:{exposure:"event"},[SB]:{exposure:"event"},[EB]:{exposure:"event"},[NB]:{exposure:"event"},[CB]:{exposure:"hidden"},[Zr]:{exposure:"hidden",storageGroup:"flags"},[ci]:{exposure:"hidden",storageGroup:"flags"},[Jy]:{exposure:"hidden"},[pa]:{exposure:"hidden",storageGroup:"flags"},[so]:{exposure:"hidden",storageGroup:"flags"},[ma]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Au]:{exposure:"hidden",storageGroup:"flags"},[gs]:{exposure:"hidden"},[qo]:{exposure:"hidden"},[io]:{exposure:"hidden"},[oo]:{exposure:"hidden"},[pu]:{exposure:"hidden",storageGroup:"surveys"},[zf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gA]:{exposure:"event"},[vA]:{exposure:"hidden"},[yA]:{exposure:"hidden"},[ex]:{exposure:"hidden"},[jB]:{exposure:"hidden"},[TB]:{exposure:"hidden"},[PB]:{exposure:"event"},[AB]:{exposure:"event"},[IB]:{exposure:"event"},[RB]:{exposure:"event"}
11,[ao]:{exposure:"hidden"},[mu]:{exposure:"hidden"},[mA]:{exposure:"event"},[td]:{exposure:"hidden"},[ho]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Hn]:{exposure:"hidden"},[tx]:{exposure:"hidden"},[MB]:{exposure:"hidden"},[xA]:{exposure:"hidden"},[bA]:{exposure:"hidden"},[pl]:{exposure:"hidden"},[ub]:{exposure:"hidden"},[xB]:{exposure:"event"},[bB]:{exposure:"event"},[wB]:{exposure:"event"},[_B]:{exposure:"event"},[_A]:{exposure:"event"},[kA]:{exposure:"event"},[db]:{exposure:"hidden"},[hb]:{exposure:"hidden"},[SA]:{exposure:"hidden"},[EA]:{exposure:"hidden"},[NA]:{exposure:"hidden"},[CA]:{exposure:"hidden"},[jA]:{exposure:"hidden"},[TA]:{exposure:"hidden"},[PA]:{exposure:"hidden"},[OB]:{exposure:"event"}},nU=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xn=e=>{const t=tU[e];if(t)return t;for(const[n,r]of nU)if(e.indexOf(n)===0)return r},gl=(e,t)=>{try{let n;return JSON.stringify(e,(r,s)=>{var i;return xc(s)?((i=n)!==null&&i!==void 0||(n=new WeakMap),n.has(s)||n.set(s,RA(s)),n.get(s)):typeof s=="bigint"?s.toString():s},t)}catch{return dP(e)}},yi=e=>{const t=ee==null?void 0:ee.createElement("a");return Q(t)?null:(t.href=e,t)},Zl=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let r;for(let s=0;n.length>s;s++){const i=n[s].split("=");if(i[0]===t){r=i;break}}if(!Ae(r)||2>r.length)return"";{let s=r[1];try{s=decodeURIComponent(s)}catch{ue.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")}},id=function(e,t,n){if(!e||!t||!t.length)return e;const r=e.split("#"),s=r[1],i=(r[0]||"").split("?"),o=i[1],l=i[0],c=(o||"").split("&"),u=[];for(let h=0;c.length>h;h++){const f=c[h].split("=");Ae(f)&&(t.includes(f[0])?u.push(f[0]+"="+n):u.push(c[h]))}let d=l;return o!=null&&(d+="?"+u.join("&")),s!=null&&(d+="#"+s),d},qf=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},qA=(e,t)=>e>=t&&uP(),GA=(e,t,n,r)=>{if(e===0){if(uP()){const s=t+1;return s===n&&r(),s}return t}return 0},Xl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rU=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Xl],od="<masked>",sU=["li_fat_id"];function KA(e,t,n){if(!ee)return{};const r=t?[...Xl,...n||[]]:[],s=YA(id(ee.URL,r,od),e),i=function(){const o={};return xt(sU,function(l){const c=Iu(l);o[l]=c||null}),o}();return It(i,s)}function YA(e,t){const n=rU.concat(t||[]),r={};return xt(n,function(s){const i=Zl(e,s);r[s]=i||null}),r}function QA(e){const t=function(s){return s?s.search("https?://(.*)google.([^/?]*)")===0?"google":s.search("https?://(.*)bing.com")===0?"bing":s.search("https?://(.*)yahoo.com")===0?"yahoo":s.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null}(e),n=t!="yahoo"?"q":"p",r={};if(!Ut(t)){r.$search_engine=t;const s=ee?Zl(ee.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function ZA(){return navigator.language||navigator.userLanguage}function iU(){const e=ZA();return typeof e=="string"?e.split("-")[0]:void 0}const Gf="$direct";function XA(){return(ee==null?void 0:ee.referrer)||Gf}function JA(e,t,n=!1){const r=e?[...Xl,...t||[]]:[],s=n?po(Bt==null?void 0:Bt.href):Bt==null?void 0:Bt.href,i=s==null?void 0:s.substring(0,1e3);return{r:XA().substring(0,1e3),u:i?id(i,r,od):void 0}}function eI(e,t=!1){var n;const{r,u:s}=e,i=t?po(s):s,o={$referrer:r,$referring_domain:r==null?void 0:r==Gf?Gf:(n=yi(r))===null||n===void 0?void 0:n.host};
11if(i){o.$current_url=i;const l=yi(i);o.$host=l==null?void 0:l.host,o.$pathname=l==null?void 0:l.pathname;const c=YA(i);It(o,c)}if(r){const l=QA(r);It(o,l)}return o}function tI(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function oU(){try{return new Date().getTimezoneOffset()}catch{return}}const aU={flags:ho,surveys:zf},lU=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Sh=e=>`${e}_cookie_identity_change_pending`,Eh=e=>{let t="",n=0;for(const r of e){const s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+s>1e3)break;t+=r,n+=s}return t},an="main",ni=[Zr,ci,pa,so,ma,ho,Au,io],Ig=e=>ni.indexOf(e)!==-1,nI=[Sl,Tu],Wk=e=>nI.indexOf(e)!==-1,Pi=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Ya=e=>{if(!e)return{};const t=JSON.parse(e);return et(t)?t:{}},qk=(e,t)=>{xt(e,(n,r)=>{const s=xn(r);s&&s.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]})};var Rg=class{constructor(e,t,n=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=n,this.props={},this.la=void 0,this.ua=(r=>{let s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&ue.info("Persistence loaded",e.persistence,U({},this.props)),this.update_config(e,e,t),this.save(),K){const r=()=>this.flush();pt(K,"beforeunload",r,{capture:!1}),pt(K,"pagehide",r,{capture:!1}),this.va=s=>{if(this.Jo&&(!s.storageArea||s.storageArea===(K==null?void 0:K.localStorage))&&s.key)if(s.key!==this.ua){if(this.Xo){const i=Fc.find(o=>s.key===this.fa(o));i&&this.pa(s.key,i)}}else this.pa(s.key,an)},pt(K,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const r=this.ea.get(t);if(!Ig(t)||r===!0)return;if(n===!0)return void this.ga(t,!0);const s=new Set(r||[]);n.forEach(i=>s.add(i)),s.size&&this.ga(t,s)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&K&&(K.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,n=!0){if(this.hi)return!1;let r,s;try{if(s=ot.Ot(e),Ut(s)){const l=this.ma(t);return l.storageValue=null,t!==an&&(l.persisted=!1),!1}r=Ya(s)}catch{return!1}const i=t===an?r:ot.Dt(this.ua);if(i&&this.ya(i))return!1;const o=this.ba(r,t,n);return t===an&&this.Xo&&!Pi(this._a().main,r)||this.wa(r,t,!0,s),o}ya(e){const t=this.props[Wr],n=e[Wr];return!Q(t)&&!Q(n)&&t!==n}wa(e,t,n,r){const s=this.ma(t);s.storageValue=r,t!==an&&(s.persisted=n);try{s.fingerprint=this.ka(e,t)}catch{s.fingerprint=void 0}}ba(e,t,n){let r=!1;return ni.forEach(s=>{var i;const o=(i=xn(s))===null||i===void 0?void 0:i.storageGroup;if(t===an&&this.Xo&&o||t!==an&&o!==t)return;const l=s in e,c=this.Sa(s,l?e[s]:void 0),u=this.ea.has(s)?s in this.props:l;u===s in this.props&&Pi(c,this.props[s])||(u?this.xa(s,c,!1):this.Ca(s,!1),r=!0)}),r&&n&&this.oa.forEach(s=>s()),r}$a(){if(!this.Jo)return!1;try{this.sa=!1;const e=ot.Ot(this.ua),t=this.ma(an);let n,r=!1,s=!1;if(e!==t.storageValue)if(Ut(e))t.storageValue=null;else{if(n=Ya(e),this.sa=!this.na&&this.ya(n),this.sa)return!1;s=this.ba(n,an,!1),!this.Xo||Pi(this._a().main,n)?this.wa(n,an,!0,e):t.storageValue=e,r=!0}return this.Xo&&Fc.forEach(i=>{const o=ot.Ot(this.fa(i)),l=this.ma(i),c=n||{},u=r&&ni.some(h=>{var f;return((f=xn(h))===null||f===void 0?void 0:f.storageGroup)===i&&h in c});if(o===l.storageValue&&!u)return;if(Ut(o))return l.storageValue=null,l.persisted=!1,void(u&&(s=this.ba(c,i,!1)||s));const d=Ya(o);s=this.ba(d,i,!1)||s,this.wa(d,i,!0,o)}),s}catch{return!1}}ga(e,t){this.ea.set(e,t);const n=xn(e);n!=null&&n.volatile||(this.ma((this.Xo?n==null?void 0:n.storageGroup:void 0)||an).fingerprint=void 0,this.Ta(e))}Ia(){ni.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=ot.Ot(this.ua),t=Ya(e);this.ma(an).storageValue=e,ni.forEach(n=>{var r;
11const s=this.Xo?(r=xn(n))===null||r===void 0?void 0:r.storageGroup:void 0,i=s?ot.Ot(this.fa(s)):null;if(s){const l=this.ma(s);l.storageValue=i,l.persisted=!Ut(i)}const o=s&&!Ut(i)?Ya(i):t;n in this.props?this.Ma(n,o[n],this.props[n]):n in o&&this.ga(n,!0)})}catch{}}Sa(e,t){const n=this.ea.get(e);if(!n)return t;if(n===!0)return this.props[e];if(e==="$active_feature_flags"){const i=new Set(Ae(t)?t:[]),o=new Set(Ae(this.props[e])?this.props[e]:[]);return n.forEach(l=>o.has(l)?i.add(l):i.delete(l)),Array.from(i)}const r=et(t)?U({},t):{},s=et(this.props[e])?this.props[e]:{};return n.forEach(i=>{i in s?r[i]=s[i]:delete r[i]}),r}Ma(e,t,n){if(!Ig(e))return;const r=this.ea.get(e);if(r===!0)return;let s=t;if(this.Jo)try{var i;const l=this.Xo?(i=xn(e))===null||i===void 0?void 0:i.storageGroup:void 0,c=l?this.fa(l):this.ua;s=Ya(ot.Ot(c))[e]}catch{}const o=new Set(r||[]);if(e==="$active_feature_flags"){if(!Q(t)&&!Ae(t)||!Q(s)&&!Ae(s)||!Ae(n))return void this.ga(e,!0);const l=new Set(t||[]),c=new Set(s||[]),u=new Set(n);new Set([...l,...u]).forEac
11h(d=>{l.has(d)!==u.has(d)&&o.add(d)}),o.forEach(d=>{c.has(d)===u.has(d)&&o.delete(d)})}else{if(!et(n))return void(Pi(s,n)?this.ea.delete(e):this.ga(e,!0));{if(!Q(t)&&!et(t)||Q(t)&&sr(n)&&Q(s))return void this.ga(e,!0);const l=et(t)?t:{},c=et(s)?s:{};new Set([...Object.keys(l),...Object.keys(n)]).forEach(u=>{u in l==u in n&&Pi(l[u],n[u])||o.add(u)}),o.forEach(u=>{u in c==u in n&&Pi(c[u],n[u])&&o.delete(u)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Gt(t)&&t>0?t:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Tg(e,this.Ir.cookie_persisted_properties||[]),n=Pk(t,this.Ir.cookie_persisted_properties||[]),r=JSON.stringify(t)+"|"+JSON.stringify(n),s=Vt.Ot(this.ua)||void 0;s&&Pg(this.ua,s)===r&&(this.Ra=r,this.Aa=s)}catch{}else try{const t=Vt.Ot(this.ua)||void 0;this.Ra=t?Pg(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Vt.Ot(this.ua)||void 0}catch{}if(!n||n===this.Aa)return!1;const r=Pg(this.ua,n);let s;try{s=jg(JSON.parse(n))}catch{return!1}if((Vt.Ot(this.ua)||void 0)!==n)return!1;this.Ra=r,this.Aa=n;const i=Ak(this.ua,n),o=[...Go,...i.properties],l={};if(Object.keys(s).forEach(v=>{const y=s[v];(Q(y)||Ut(y)||y===""||v==="$user_state"&&y!=="anonymous"&&y!=="identified")&&(l[v]=!0,delete s[v])}),sr(s))return!1;const c="distinct_id"in s||s.$user_state==="anonymous"||s.$user_state==="identified",u=this.props,d=u[Wr],h=u[Hn],f=It({},u);[...Go,...e.cookie_persisted_properties||[]].forEach(v=>{if(o.indexOf(v)!==-1&&!(v in s)&&!l[v]&&(c||v!=="distinct_id"&&v!=="$user_state")){const y=f[v];(i.isValid||Go.indexOf(v)===-1||y!==!1&&y!==0)&&delete f[v]}}),this.props=It(f,s),ni.forEach(v=>{const y=v in this.props;v in u===y&&Pi(u[v],this.props[v])||(y?this.Ma(v,u[v],this.props[v]):this.ga(v,!0))}),!c||"$user_state"in s||"$user_state"in this.props||this.xa(Hn,ui);const p=this.props[Wr],g=this.props[Hn];return!c||p===d&&g===h||(this.na=!0,this.Yo=!0,Tt.$t(Sh(this.ua),!0),this.Ca(io),this.Ca(ci),this.Ca(Zr),this.Ca(pa),this.Ca(so),this.Ca(ma),this.Ca(ho),this.Ca(td),this.Ca(ao),g!=="anonymous"||h!=="identified"&&s.$user_state!=="anonymous"&&(Q(d)||p===d)||(qk(this.props,s),this.Ca(oo)),g==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.Ca(Uf)),!0}
11consumeCookieIdentityChange(){const e=Sh(this.ua),t=this.Yo||!!Tt.Ot(e);return this.Yo=!1,t&&Tt.Lt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(Q(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[an],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():Q(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){lU.indexOf(e.persistence.toLowerCase())===-1&&(ue.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],l=!1)=>{const c=[...Go,...o];return U(U({},ot),{},{Dt(u){try{let h,f={};try{h=Vt.Ot(u)||void 0,f=h?jg(JSON.parse(h)):{}}catch{}const p=JSON.parse(ot.Ot(u)||"{}");let g;if(l){const v=Ak(u,h),y=[...Go,...v.properties],x={};Object.keys(f).forEach(w=>{const S=f[w];Ut(S)||S===""||w==="$user_state"&&S!=="anonymous"&&S!=="identified"||(x[w]=S)});const b="distinct_id"in x||x.$user_state==="anonymous"||x.$user_state==="identified";if(Object.keys(x).length>0){var d;const w=p[Wr],S=(d=p.$user_state)!==null&&d!==void 0?d:ui;c.forEach(_=>{if(y.indexOf(_)!==-1&&!(_ in f)&&(b||_!=="distinct_id"&&_!=="$user_state")){const E=p[_];(v.isValid||Go.indexOf(_)===-1||E!==!1&&E!==0)&&delete p[_]}}),!b||"$user_state"in f||"$user_state"in p||(p[Hn]=ui),!b||("distinct_id"in x?x[Wr]:p[Wr])===w&&("$user_state"in x?x[Hn]:p[Hn])===S||(Cg.forEach(_=>delete p[_]),x.$user_state==="identified"&&"distinct_id"in x?p.$user_id=x[Wr]:delete p.$user_id,x.$user_state!=="identified"&&(delete p[mA],delete p[oo]),delete p.__alias)}g=It(p,x)}else g=It(f,p);return ot.$t(u,g),g}catch{}return null},$t(u,d,h,f,p,g){const v=ot.$t(u,d,void 0,void 0,g);try{const y=Tg(d,o);if(Object.keys(y).length){if(l){const x=Wf(u),b=Pk(y,o);if(Vt.$t(x,b,h,f,p,g),Vt.Ot(x)!==JSON.stringify(b)){Vt.Lt(x,f);const w=Tg(d);return Vt.$t(u,w,h,f,p,g),v}}Vt.$t(u,y,h,f,p,g)}}catch(y){ot.Pt(y)}return v},Lt(u,d){try{K==null||K.localStorage.removeItem(u),Vt.Lt(u,d),Vt.Lt(Wf(u),d)}catch(h){ot.Pt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,r=!1,s=!1;const i=e.persistence.toLowerCase();return i==="localstorage"&&ot.Et()?(n=ot,s=!0):i==="localstorage+cookie"&&t.Et()?(n=t,s=!0,r=!0):i==="sessionstorage"&&Tt.Et()?n=Tt:i==="memory"?n=sx:i==="cookie"&&Vt.Et()?(n=Vt,r=!0):t.Et()?(n=t,s=!0,r=!0):Vt.Et()?(n=Vt,r=!0):n=sx,this.Jo=s,this.Ko=r,n}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){const e={};return xt(this.props,(t,n)=>{const r=xn(n);if(!r||r.exposure==="event"){var s;if(!(r==null||(s=r.shouldSkipFromEventProperties)===null||s===void 0)&&s.call(r,t))return;e[n]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",n=t?ot.Dt(this.ua):null;let r={};if(t)try{r=jg(Vt.Dt(this.ua)),xt(r,(l,c)=>{(Q(l)||Ut(l)||l==="")&&delete r[c]})}catch{}const s=this.No.Dt(this.ua);if(s&&(this.props=It({},s)),this.Xo&&this.ja(),t&&s){var i,o;const l=n==null?void 0:n[Wr],c=(i=n==null?void 0:n.$user_state)!==null&&i!==void 0?i:ui,u=s[Wr],d=(o=s.$user_state)!==null&&o!==void 0?o:ui;if(u!==l||d!==c){this.Yo=!0,Tt.$t(Sh(this.ua),!0);const h=It({},this.props);Cg.forEach(p=>delete h[p]),d!=="anonymous"||c!=="identified"&&r.$user_state!=="anonymous"&&(Q(l)||u===l)||(qk(h,r),delete h[oo]),this.props=h;const f=new Set;Cg.forEach(p=>{var g;const v=(g=xn(p))===null||g===void 0?void 0:g.storageGroup;v&&f.add(v)}),f.forEach(p=>{const g={};xt(this.props,(v,y)=>{var x;
11((x=xn(y))===null||x===void 0?void 0:x.storageGroup)===p&&(g[y]=v)}),sr(g)?(ot.Lt(this.fa(p)),this.Qo[p]={}):ot.$t(this.fa(p),g)&&(this.Qo[p]={persisted:!0,fingerprint:this.ka(g,p)})})}}Tt.Ot(Sh(this.ua))&&(this.Yo=!0)}ja(){for(const e of Fc){const t=ot.Dt(this.fa(e));if(t&&!sr(t)){const n=this.ma(e);n.persisted=!0,this.Ba(e)||(n.fingerprint=this.ka(t,e)),this.Ha(e,t)||It(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var n;return((n=xn(t))===null||n===void 0?void 0:n.storageGroup)===e})}Ha(e,t){const n=aU[e];if(!n)return!1;const r=t[n],s=this.props[n];return Gt(r)&&Gt(s)&&s>r}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;const n=this.Xo?(t=xn(e))===null||t===void 0?void 0:t.storageGroup:void 0,r=n?ot.Dt(this.fa(n)):this.No.Dt(this.ua);if(r&&e in r)this.xa(e,r[e],!1);else{if(n){const s=this.No.Dt(this.ua);if(s&&e in s)return void this.xa(e,s[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?Q(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){Q(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||nI.forEach(s=>this.refreshKey(s)));const t=!e&&!this.ia;t||(this.sa=!1);const n=!!t&&this.$a();if(this.sa)return void(this.Ir.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(n&&this.oa.forEach(s=>s()));const r=this.Ua(this.No,this.ua,this.props,an);r==="written"&&this.Pa(this.props),r!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),n&&this.oa.forEach(s=>s())}za(){const{main:e,groups:t}=this._a(),n=this.Ua(this.No,this.ua,e,an);n==="written"&&this.Pa(e),n!=="failed"&&(this.na=!1,this.ra.clear(),ni.forEach(s=>{var i;!((i=xn(s))===null||i===void 0)&&i.storageGroup||this.ea.delete(s)}));for(const s of Fc){var r;const i=t[s];if(sr(i)&&!(!((r=this.Qo[s])===null||r===void 0)&&r.persisted)){ni.forEach(l=>{var c;((c=xn(l))===null||c===void 0?void 0:c.storageGroup)===s&&this.ea.delete(l)});continue}const o=this.Ua(ot,this.fa(s),i,s);o!=="failed"&&ni.forEach(l=>{const c=xn(l);(c==null?void 0:c.storageGroup)!==s||o!=="written"&&c.volatile||this.ea.delete(l)})}}_a(){const e={},t={flags:{},surveys:{}};return xt(this.props,(n,r)=>{var s;const i=(s=xn(r))===null||s===void 0?void 0:s.storageGroup;i?t[i][r]=n:e[r]=n}),{main:e,groups:t}}ka(e,t){if(t===an)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const n={};return xt(e,(r,s)=>{var i;n[s]=!((i=xn(s))===null||i===void 0)&&i.volatile?"__volatile__":r}),JSON.stringify(n)}Ua(e,t,n,r){const s=this.ma(r);if(r!==an&&!s.dirty&&!Q(s.fingerprint))return"skipped";let i;try{if(i=this.ka(n,r),i===s.fingerprint)return s.dirty=!1,"skipped"}catch{i=void 0}return e.$t(t,n,this.Wa,this.Va,this.Ga,this.Ir.debug)?(s.dirty=!1,r!==an&&(s.persisted=!0),Q(i)||(s.fingerprint=i),this.Jo&&(s.storageValue=ot.Ot(t)),"written"):(this.Ir.debug&&ue.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),Q(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(const t of Fc)ot.Lt(this.fa(t));e?delete this.Qo[an]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(et(e)){this.syncCookieProperties(),Q(t)&&(t="None"),this.Wa=Q(n)?this.Za:n;let r=!1;if(xt(e,(s,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.xa(i,s),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(et(e)){this.syncCookieProperties(),this.Wa=Q(t)?this.Za:t;let n=!1;if(xt(e,(r,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==r||et(r)||Ae(r))&&(this.xa(s,r),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let n=!1;for(const r of t)r in this.props&&(this.Ca(r),n=!0);n&&this.save()}update_campaign_params(){const e=ee==null?void 0:ee.URL;if(e===this.la)return;const t=KA(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),n=!sr(mb(t));return n&&this.register(t),this.la=e,n?t:void 0}update_search_keyword(){this.register(function(){const e=ee==null?void 0:ee.referrer;return e?QA(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:XA(),$referring_domain:(ee==null?void 0:ee.referrer)&&((e=yi(ee.referrer))===null||e===void 0?void 0:e.host)||Gf},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=JA(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes
11);this.register_once({[pl]:this.Ko?{r:Eh(e.r),u:e.u?Eh(e.u):void 0}:e},void 0)}get_initial_props(){const e={};xt([bA,xA],n=>{const r=this.props[n];r&&xt(r,function(s,i){e["$initial_"+Vy(i)]=s})});const t=this.props[pl];if(t){const n=function(r,s=!1){const i=eI(r,s),o={};return xt(i,function(l,c){o[`$initial_${Vy(c)}`]=l}),o}(t,this.Ir.disable_capture_url_hashes);It(e,n)}return e}safe_merge(e){return xt(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){const r=e.persistence!==t.persistence,s=!((p,g)=>{if(p.length!==g.length)return!1;const v=[...p].sort(),y=[...g].sort();return v.every((x,b)=>x===y[b])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),i=r||s,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!n,c=!!this.hi&&!l;l||this.Fa(t,c),this.Ir=e,!l&&(r||s||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(U(U({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));const u=i||o?this.ha(e):this.No;this.Qa();const d=this.ca(e),h=i||d!==this.Xo,f=!l&&(h||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=h;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){const p=this.props;this.clear(),this.No=u,this.Xo=d,this.props=p,this.save()}else o&&(this.No=u,l||(delete this.Qo[an],this.Na()))}finally{this.ia=!1,f&&this.qa()}}Qa(){const e=this.props[pl];if(!this.Ko||!et(e)||typeof e.r!="string")return;const t=Eh(e.r),n=typeof e.u=="string"?Eh(e.u):e.u;t===e.r&&n===e.u||this.xa(pl,U(U({},e),{},{r:t,u:n}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this.xa(Ky,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return Q(n)||(delete t[e],this.xa(Ky,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,n=!0){var r;const s=this.props[e];this.props[e]=t,n&&(e!=="distinct_id"&&e!=="$user_state"||s===t||(this.na=!0),Wk(e)&&!Pi(s,t)&&this.ra.add(e),this.Ma(e,s,t),!((r=xn(e))===null||r===void 0)&&r.volatile||this.Ta(e))}Ca(e,t=!0){delete this.props[e],t&&(Ig(e)&&this.ga(e,!0),Wk(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;const n=(t=xn(e))===null||t===void 0?void 0:t.storageGroup;n&&(this.ma(n).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}};const Er={GZipJS:"gzip-js",Base64:"base64"},$c={Activation:"events",Cancellation:"cancelEvents"},Mg={Popover:"popover",API:"api",Widget:"widget"},_r={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Og={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ax={Popover:"popover",Inline:"inline"};function Nh(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&pn(n.then)&&n.then(void 0,()=>{})}}}}const cU={SHOWN:"product tour shown"},Gk={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Kk=Ht("[RateLimiter]");var uU=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(r=>{Kk.info(`${r||"events"} is quota limited.`),this.serverLimits[r]=new Date().getTime()+6e4})}catch(r){return void Kk.warn(`could not rate limit - continuing. Error: "${r==null?void 0:r.message}"`,{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,n,r;const{captureEventsBurstLimit:s,captureEventsPerSecond:i}=this,o=new Date().getTime(),l=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:s,last:o};l.tokens+=(o-l.last)/1e3*i,l.last=o,l.tokens>s&&(l.tokens=s);const c=1>l.tokens;if(c||e||(l.tokens=Math.max(0,l.tokens-1)),c&&!e){const u=(Gt(l.dropped)?l.dropped:0)+1;l.dropped=u,!this.lastEventRateLimited&&this.Ja(u)&&(l.dropped=0)}return this.lastEventRateLimited=c,(r=this.instance.persistence)===null||r===void 0||r.set_property("$capture_rate_limit",l),{isRateLimited:c,remainingTokens:l.tokens}
11}Ka(e){const t=this.instance.config.property_denylist;return!Ae(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(Bt!=null&&Bt.pathname))return`${(e=Bt.origin)!==null&&e!==void 0?e:""}${Bt.pathname}`}Ja(e){var t,n;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,i=this.Xa(),o=this.Ka("$session_id")?(t=(n=this.instance).get_session_id)===null||t===void 0?void 0:t.call(n):void 0,l=[`${e} event(s) dropped since the last warning`,i?`triggered on ${i}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${r} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const Ai=Ht("[RemoteConfig]");var rI=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Ce._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,n,r;!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Ai.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void Ai.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return Ai.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){Ai.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||Ai.warn("Failed to fetch remote config from PostHog."):Ai.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(r){Ai.error("Error applying remote config",r)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)===null||n===void 0||n.ensureFlagsLoaded()}catch(r){Ai.error("Error loading feature flags",r)}}},Vr=Uint8Array,ar=Uint16Array,Jl=Uint32Array,bb=new Vr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wb=new Vr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Yk=new Vr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sI=function(e,t){for(var n=new ar(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var s=new Jl(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)s[i]=i-n[r]<<5|r;return[n,s]},iI=sI(bb,2),lx=iI[1];iI[0][28]=258,lx[258]=28;for(var Qk=sI(wb,0)[1],oI=new ar(32768),zt=0;32768>zt;++zt){var Qa=(43690&zt)>>>1|(21845&zt)<<1;oI[zt]=((65280&(Qa=(61680&(Qa=(52428&Qa)>>>2|(13107&Qa)<<2))>>>4|(3855&Qa)<<4))>>>8|(255&Qa)<<8)>>>1}var Ou=function(e,t,n){for(var r=e.length,s=0,i=new ar(t);r>s;++s)++i[e[s]-1];var o,l=new ar(t);for(s=0;t>s;++s)l[s]=l[s-1]+i[s-1]<<1;for(o=new ar(r),s=0;r>s;++s)o[s]=oI[l[e[s]-1]++]>>>15-e[s];return o},ba=new Vr(288);for(zt=0;144>zt;++zt)ba[zt]=8;for(zt=144;256>zt;++zt)ba[zt]=9;for(zt=256;280>zt;++zt)ba[zt]=7;for(zt=280;288>zt;++zt)ba[zt]=8;var Kf=new Vr(32);for(zt=0;32>zt;++zt)Kf[zt]=5;var dU=Ou(ba,9),hU=Ou(Kf,5),aI=function(e){return(e/8|0)+(7&e&&1)},lI=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof ar?ar:e instanceof Jl?Jl:Vr)(n-t);return r.set(e.subarray(t,n)),r},qs=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Vc=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Dg=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return[new Vr(0),0];if(s==1){var o=new Vr(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(_,E){return _.f-E.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,h=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=s-1;)l=n[n[h].f>n[u].f?u++:h++],c=n[u!=d&&n[h].f>n[u].f?u++:h++],n[d++]={s:-1,f:l.f+c.f,l,r:c};var f=i[0].s;for(r=1;s>r;++r)i[r].s>f&&(f=i[r].s);var p=new ar(f+1),g=cx(n[d-1],p,0);if(g>t){r=0;var v=0,y=g-t,x=1<<y;for(i.sort(function(_,E){return p[E.s]-p[_.s]||_.f-E.f});s>r;++r){var b=i[r].s;if(t>=p[b])break;v+=x-(1<<g-p[b]),p[b]=t}for(v>>>=y;v>0;){var w=i[r].s;t>p[w]?v-=1<<t-p[w]++-1:++r}for(;r>=0&&v;--r){var S=i[r].s;p[S]==t&&(--p[S],++v)}g=t}return[new Vr(p),g]},cx=function(e,t,n){return e.s==-1?Math.max(cx(e.l,t,n+1),cx(e.r,t,n+1)):t[e.s]=n},Zk=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ar(++t),r=0,s=e[0],i=1,o=function(c){n[r++]=c},l=1;t>=l;++l)if(e[l]==s&&l!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[l]}return[n.subarray(0,r),t]},Bc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},ux=function(e,t,n){var r=n.length,s=aI(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var i=0;r>i;++i)e[s+i+4]=n[i];return 8*(s+4+r)},Xk=function(e,t,n,r,s,i,o,l,c,u,d){qs(t,d++,n),++s[256];for(var h=Dg(s,15),f=h[0],p=h[1],g=Dg(i,15),v=g[0],y=g[1],x=Zk(f),b=x[0],w=x[1],S=Zk(v),_=S[0],E=S[1],R=new ar(19),A=0;b.length>A;++A)R[31&b[A]]++;for(A=0;_.length>A;++A)R[31&_[A]]++;for(var N=Dg(R,7),k=N[0],T=N[1],I=19;I>4&&!k[Yk[I-1]];--I);var F,L,M,$,j=u+5<<3,P=Bc(s,ba)+Bc(i,Kf)+o,D=Bc(s,f)+Bc(i,v)+o+14+3*I+Bc(R,k)+(2*R[16]+3*R[17]+7*R[18]);if(P>=j&&D>=j)return ux(t,d,e.subarray(c,c+u));if(qs(t,d,1+(P>D)),d+=2,P>D){F=Ou(f,p),L=f,M=Ou(v,y),$=v;var C=Ou(k,T);for(qs(t,d,w-257),qs(t,d+5,E-1),qs(t,d+10,I-4),d+=14,A=0;I>A;++A)qs(t,d+3*A,k[Yk[A]]);d+=3*I;for(var H=[b,_],V=0;2>V;++V){var O=H[V];for(A=0;O.length>A;++A)qs(t,d,C[G=31&O[A]]),d+=k[G],G>
vendor: 4,095 bytes, line 11
1115&&(qs(t,d,O[A]>>>5&127),d+=O[A]>>>12)}}else F=dU,L=ba,M=hU,$=Kf;for(A=0;l>A;++A)if(r[A]>255){var G;Vc(t,d,F[257+(G=r[A]>>>18&31)]),d+=L[G+257],G>7&&(qs(t,d,r[A]>>>23&31),d+=bb[G]);var Z=31&r[A];Vc(t,d,M[Z]),d+=$[Z],Z>3&&(Vc(t,d,r[A]>>>5&8191),d+=wb[Z])}else Vc(t,d,F[r[A]]),d+=L[r[A]];return Vc(t,d,F[256]),d+L[256]},fU=new Jl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pU=function(){for(var e=new Jl(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Lg=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function mU(e,t){t===void 0&&(t={});var n=function(){var h=4294967295;return{p(f){for(var p=h,g=0;f.length>g;++g)p=pU[255&p^f[g]]^p>>>8;h=p},d(){return 4294967295^h}}}(),r=e.length;n.p(e);var s,i,o,l,c,u=(l=10+((s=t).filename&&s.filename.length+1||0),c=8,function(h,f,p,g,v,y){var x=h.length,b=new Vr(g+x+5*(1+Math.floor(x/7e3))+v),w=b.subarray(g,b.length-v),S=0;if(!f||8>x)for(var _=0;x>=_;_+=65535){var E=_+65535;x>E?S=ux(w,S,h.subarray(_,E)):(w[_]=y,S=ux(w,S,h.subarray(_,x)))}else{for(var R=fU[f-1],A=R>>>13,N=8191&R,k=(1<<p)-1,T=new ar(32768),I=new ar(k+1),F=Math.ceil(p/3),L=2*F,M=function(fn){return(h[fn]^h[fn+1]<<F^h[fn+2]<<L)&k},$=new Jl(25e3),j=new ar(288),P=new ar(32),D=0,C=0,H=(_=0,0),V=0,O=0;x>_;++_){var G=M(_),Z=32767&_,ae=I[G];if(T[Z]=ae,I[G]=Z,_>=V){var te=x-_;if((D>7e3||H>24576)&&te>423){S=Xk(h,w,0,$,j,P,C,H,O,_-O,S),H=D=C=0,O=_;for(var ne=0;286>ne;++ne)j[ne]=0;for(ne=0;30>ne;++ne)P[ne]=0}var re=2,J=0,ge=N,se=Z-ae&32767;if(te>2&&G==M(_-se))for(var ke=Math.min(A,te)-1,Me=Math.min(32767,_),Be=Math.min(258,te);Me>=se&&--ge&&Z!=ae;){if(h[_+re]==h[_+re-se]){for(var $e=0;Be>$e&&h[_+$e]==h[_+$e-se];++$e);if($e>re){if(re=$e,J=se,$e>ke)break;var We=Math.min(se,$e-2),Qt=0;for(ne=0;We>ne;++ne){var Le=_-se+ne+32768&32767,dt=Le-T[Le]+32768&32767;dt>Qt&&(Qt=dt,ae=Le)}}}se+=(Z=ae)-(ae=T[Z])+32768&32767}if(J){$[H++]=268435456|lx[re]<<18|Qk[J];var jn=31&lx[re],pr=31&Qk[J];C+=bb[jn]+wb[pr],++j[257+jn],++P[pr],V=_+re,++D}else $[H++]=h[_],++j[h[_]]}}S=Xk(h,w,y,$,j,P,C,H,O,_-O,S)}return lI(b,0,g+aI(S)+v)}(i=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+o.mem,l,c,!0)),d=u.length;return function(h,f){var p=f.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>f.level?4:f.level==9?2:0,h[9]=3,f.mtime!=0&&Lg(h,4,Math.floor(new Date(f.mtime||Date.now())/1e3)),p){h[3]=8;for(var g=0;p.length>=g;++g)h[g+10]=p.charCodeAt(g)}}(u,t),Lg(u,d-8,n.d()),Lg(u,d-4,r),u}const gU=!!tb||!!Ju,cI=new WeakMap,uI="text/plain";let Fg=0,lf=!1;const dI=(e,t)=>{const[n,r]=e.split("#"),[s,i]=n.split("?");if(!i)return e;const o=i.split("&").filter(l=>l.split("=")[0]!==t).join("&");return`${s}${o?`?${o}`:""}${r?`#${r}`:""}`},Vd=(e,t,n=!0)=>{var r;const[s,i]=e.split("?"),o=U({},t),l=(r=i==null?void 0:i.split("&").map(u=>{var d;const[h,f]=u.split("="),p=n&&(d=o[h])!==null&&d!==void 0?d:f;return delete o[h],`${h}=${p}`}))!==null&&r!==void 0?r:[],c=function(u,d="&"){let h,f;const p=[];return xt(u,function(g,v){Q(g)||Q(v)||v==="undefined"||(h=encodeURIComponent((y=>y instanceof File)(g)?g.name:g.toString()),f=encodeURIComponent(v),p[p.length]=f+"="+h)}),p.join(d)}(o);return c&&l.push(c),l.length>0?`${s}?${l.join("&")}`:s},$g=e=>{if(e.nl)return e.nl;const{data:t,compression:n}=e;if(!t)return;if(n===Er.GZipJS){const s=mU(function(i){var o=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var l=new Vr(i.length+(i.length>>>1)),c=0,u=function(p){l[c++]=p},d=0;o>d;++d){if(c+5>l.length){var h=new Vr(c+8+(o-d<<1));h.set(l),l=h}var f=i.charCodeAt(d);128>f?u(f):2048>f?(u(192|f>>>6),u(128|63&f)):f>55295&&57344>f?(u(240|(f=65536+(1047552&f)|1023&i.charCodeAt(++d))>>>18),u(128|f>>>12&63),u(128|f>>>6&63),u(128|63&f)):(u(224|f>>>12),u(128|f>>>6&63),u(128|63&f))}return lI(l,0,c)}(gl(t)),{mtime:0});return{contentType:uI,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(n===Er.Base64){const s=function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))}(gl(t)),i=(o=>
11"data="+encodeURIComponent(typeof o=="string"?o:gl(o)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const r=gl(t);return{contentType:"application/json",body:r,estimatedSize:new Blob([r]).size}},hI=e=>{const t=()=>e.transport==="sendBeacon"?{url:Vd(e.url,{compression:Er.Base64}),encodedBody:$g(U(U({},e),{},{compression:Er.Base64,nl:void 0}))}:{url:dI(e.url,"compression"),encodedBody:$g(U(U({},e),{},{compression:void 0,nl:void 0}))};let n;try{n=$g(e)}catch(s){if(yk(e.compression,Zl(e.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",s),t();throw s}return n&&yk(e.compression,Zl(e.url,"compression"))&&!((r=n.body)instanceof ArrayBuffer?qy(new Uint8Array(r)):ArrayBuffer.isView(r)&&qy(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(lf=!0,t()):{url:e.url,encodedBody:n};var r},fI=e=>{try{return hI(e)}catch(n){var t;return ue.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},vU=function(){var e=Rt(function*(t){const n=yield function(s){return Gy.apply(this,arguments)}(gl(t.data),un.DEBUG,{rethrow:!0});if(!n)return t;const r=yield n.arrayBuffer();return U(U({},t),{},{nl:{contentType:uI,body:r,estimatedSize:r.byteLength}})});return function(t){return e.apply(this,arguments)}}(),yU=/Failed to fetch|NetworkError|Load failed/i,pI=e=>(e==null?void 0:e.name)==="TypeError"&&yU.test((e==null?void 0:e.message)||""),mI=e=>{try{const t=function(n,r=Date.now()){if(typeof n!="string"||!n)return;const s=n.trim(),i=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(i)){const c=1e3*Math.min(Number(i),300);return c>0?c:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(i))return;const o=/^\w{3} \w{3} /.test(i)?i+" GMT":i,l=Date.parse(o)-r;return Number.isFinite(l)&&l>0?Math.min(l,sf):void 0}(e());return Q(t)?void 0:Math.min(t,3e4)}catch{return}},gI=e=>{const t=fI(e);if(!t)return;const n=new tb;cI.set(n,!0);const{url:r,encodedBody:s}=t;n.open(e.method||"GET",r,!0);const{contentType:i,body:o}=s??{};xt(e.headers,function(l,c){n.setRequestHeader(c,l)}),i&&n.setRequestHeader("Content-Type",i),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var l;const c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}(l=e.callback)===null||l===void 0||l.call(e,c,mI(()=>n.getResponseHeader("Retry-After")))}},n.send(o)},vI=e=>{const t=fI(e);if(!t)return;const{url:n,encodedBody:r}=t,{contentType:s,body:i,estimatedSize:o}=r??{},l=new Headers;xt(e.headers,function(g,v){l.append(v,g)}),s&&l.append("Content-Type",s);let c=null,u=!1;if(rk){const g=new rk;c={signal:g.signal,timeout:setTimeout(()=>{u=!0;try{g.abort(WP("AbortError","PostHog request timed out"+((v=e.timeout)?` after ${v}ms`:"")))}catch(y){h(y)}var v},e.timeout)}}let d=!1;const h=g=>{var v;d||(d=!0,u&&(g==null?void 0:g.name)==="AbortError"||pI(g)?ue.warn(g):ue.error(g),(v=e.callback)===null||v===void 0||v.call(e,{statusCode:0,error:g}))};let f=0;const p=()=>{Fg-=f,f=0,c&&clearTimeout(c.timeout)};try{const g=U({method:(e==null?void 0:e.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:i,signal:c==null?void 0:c.signal},e.fetchOptions),v=o??(Q(i)?0:void 0);g.keepalive=g.method==="POST"&&!e.sl&&g.keepalive!==!1&&g.body===i&&!Q(v)&&v>=0&&52428.8>Fg+v,g.keepalive&&(f=v,Fg+=f),Ju(n,g).then(y=>y.text().then(x=>{var b;if(d)return;const w={statusCode:y.status,text:x};if(y.status===200)try{w.json=JSON.parse(x)}catch(S){ue.error(S)}d=!0,p(),(b=e.callback)===null||b===void 0||b.call(e,w,mI(()=>y.headers.get("Retry-After")))})).catch(y=>{p(),h(y)}).finally(p)}catch(g){p(),h(g)}},dx=e=>{try{var t;const{url:n,encodedBody:r}=hI(e),{contentType:s,body:i,estimatedSize:o}=r??{};if(!i)return;const l=i instanceof Blob?i:new Blob([i],{type:s});if(gn.sendBeacon(n,l))return;const c=Ae(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Ae(c)&&c.length>1&&(o??0)>16384){const u=Math.ceil(c.length/2),d=h=>Ae(e.data)?h:U(U({},e.data),{},{batch:h});return dx(U(U({},e),{},{data:d(c.slice(0,u))})),void dx(U(U({},e),{},{data:d(c.slice(u))}))}ue.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${Ju?"fetch":"XHR"}`),Ju?vI(U(U({},e),{},{sl:!0})):gI(e)}catch(n){ue.warn("Beacon send failed",n)}},Jk=(e,t,n,r)=>{const s=r==="query"?t==="POST"?"sent_at":"_":void 0;return Vd(n===Er.GZipJS?dI(e,"compression"):e,U(U({},s?{[s]:Date.now().toString()}:{}),n===Er.GZipJS?{}:{compression:n}))},xU=(()=>{const e=[];return Ju&&e.push({transport:"fetch",method:vI}),tb&&e.push({transport:"XHR",method:gI}),gn!=null&&gn.sendBeacon&&e.push({transport:"sendBeacon",method:dx}),e})();let yI=!gU&&(Bn==null?void 0:Bn.indexOf("MSIE"))===-1&&(Bn==null?void 0:Bn.indexOf("Mozilla"))===-1;
11function xI(e,t,n){var r,s,i;n&&(t=U(U({},t),{},{callback:o=>n(o)})),e.__loaded?yI?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((s=t.callback)===null||s===void 0||s.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=U(U({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(r=e.compression)!==null&&r!==void 0?r:t.compressionFallback:t.compression,(Q(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,l)=>{var c,u,d;const h=U(U({},o),{},{callback:l??(y=>{var x;return(x=o.callback)===null||x===void 0?void 0:x.call(o,y)})});h.timeout=h.timeout||6e4;const f=(c=h.transport)!==null&&c!==void 0?c:"fetch";f==="sendBeacon"&&Q(h.compression)&&h.data&&(h.compression=Er.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data=(y=>{var x,b;const w=(Ae(y)?y:[y]).map(_=>U(U({},_),_.timestamp instanceof Date&&!isNaN(_.timestamp.getTime())?{timestamp:_.timestamp.toISOString()}:{})),S=w[0];return{api_key:(x=S==null||(b=S.properties)===null||b===void 0?void 0:b.token)!==null&&x!==void 0?x:S==null?void 0:S.token,batch:w,sent_at:new Date().toISOString()}})(h.data):h.timestampMode==="body"&&(h.data=((y,x=new Date().toISOString())=>Ae(y)?y.map(b=>U(U({},b),{},{sent_at:x})):U(U({},y),{},{sent_at:x}))(h.data))),h.url=Jk(h.url,h.method,h.compression,h.timestampMode);const p=xU.filter(y=>!h.disableTransport||!y.transport||!h.disableTransport.includes(y.transport)),g=(u=(d=function(y,x){for(let b=0;y.length>b;b++)if(x(y[b]))return y[b]}(p,y=>y.transport===f))===null||d===void 0?void 0:d.method)!==null&&u!==void 0?u:p[0].method;if(!g)throw new Error("No available transport method");const v=y=>{try{g(y)}catch(b){var x;pI(b)?ue.warn(b):ue.error(b),(x=h.callback)===null||x===void 0||x.call(h,{statusCode:0,error:b})}};f!=="sendBeacon"&&!h.preferSyncCompression&&h.data&&h.compression===Er.GZipJS&&c6&&typeof Promise<"u"&&!lf?vU(h).then(y=>{v(y)}).catch(y=>{if(xk(y))return lf=!0,void v(U(U({},h),{},{compression:void 0,url:Jk(o.url,o.method,void 0,o.timestampMode)}));(x=>{if(!x||typeof x!="object")return!1;const b="name"in x?String(x.name):"";return xk(x)||b===XP})(y)&&(lf=!0),v(h)}):v(h)})(t,(o,l)=>{var c,u,d;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(c=(u=e.config).on_request_error)===null||c===void 0||c.call(u,o),n?n(o,l):(d=t.callback)===null||d===void 0||d.call(t,o)})):t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:0}))}var bU=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=Ss((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();const e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.vl(n,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){const e=this.dl();for(const t in e)this.vl(e[t])}},this.al))}vl(e,t){try{this.ll(e,t)}catch(n){ue.error(n)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return xt(this.ol,t=>{var n;const r=t,s=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:"");Q(e[s])&&(e[s]=U(U({},r),{},{data:[]})),(n=e[s].data)===null||n===void 0||n.push(r.data)}),this.ol=[],e}};const wU=["retriesPerformedSoFar"];var _U=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!Q(K)&&"onLine"in K.navigator){if(this.gl=K.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},pt(K,"online",this.ml),pt(K,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,r=JP(e,wU);ti(n)&&(r.url=Vd(r.url,{retry_count:n})),xI(this._instance,t?U(U({},r),{},{transport:t}):r,(s,i)=>{var o;if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(n??0))return void this.Ls(U({retriesPerformedSoFar:n},r),i);s.statusCode===0&&ue.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${n??0} retries.`)}(o=r.callback)===null||o===void 0||o.call(r,s)})}Ls(e,t){const n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;const r=Math.max(function(o){const l=3e3*Math.pow(2,o),c=l/2,u=Math.min(18e5,l),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)}(n),t??0),s=Date.now()+r;this.ol.push({retryAt:s,requestOptions:e});let i=`Enqueued failed request for retry in ${r}`;navigator.onLine||(i+=" (Browser is offline)"),ue.warn(i),this.fl||(this.fl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.fl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}
11yl(){const e=Date.now(),t=[],n=this.ol.filter(r=>e>r.retryAt||(t.push(r),!1));if(this.ol=t,n.length>0)for(const{requestOptions:r}of n)this.retriableRequest(r)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,Q(K)||(this.ml&&(K.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(K.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(U(U({},e),{},{transport:"sendBeacon"}))}catch(t){ue.error(t)}this.ol=[]}},kU=class{constructor(e){this._instance=e,this.kl=()=>{var t,n,r,s;this.Sl||(this.Sl={});const i=this.scrollElement(),o=this.scrollY(),l=i?Math.max(0,i.scrollHeight-i.clientHeight):0,c=o+((i==null?void 0:i.clientHeight)||0),u=(i==null?void 0:i.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(o),this.Sl.maxScrollY=Math.max(o,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(l,(n=this.Sl.maxScrollHeight)!==null&&n!==void 0?n:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(r=this.Sl.maxContentY)!==null&&r!==void 0?r:0),this.Sl.maxContentHeight=Math.max(u,(s=this.Sl.maxContentHeight)!==null&&s!==void 0?s:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){pt(K,"scroll",this.kl,{capture:!0}),pt(K,"scrollend",this.kl,{capture:!0}),pt(K,"resize",this.kl)}scrollElement(){if(this.xl){const n=Ae(this.xl)?this.xl:[this.xl];for(const r of n){var e;const s=K==null||(e=K.document)===null||e===void 0?void 0:e.querySelector(r);if(s)return s}return}var t;return K==null||(t=K.document)===null||t===void 0?void 0:t.documentElement}Cl(e){var t,n;const r=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const s=this.scrollElement();return s&&s[r]||0}return K?e==="y"?K.scrollY||K.pageYOffset||((t=K.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:K.scrollX||K.pageXOffset||((n=K.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}};const SU=e=>JA(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);var eS=class{constructor(e,t,n,r){this.qe=s=>{const i=this.$l();if(i&&i.sessionId===s)return;const o={sessionId:s,props:this.Tl(this._instance)};this.Il.register({[tx]:o})},this._instance=e,this.Ml=t,this.Il=n,this.Tl=r||SU,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[tx]}getSetOnceProps(){var e;const t=(e=this.$l())===null||e===void 0?void 0:e.props;return t?"r"in t?eI(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return xt(mb(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${Vy(n)}`]=t}),e}},Yf=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(n=>n!==t)}}emit(e,t){for(const n of this.El[e]||[])n(t);for(const n of this.El["*"]||[])n(e,t)}constructor(){this.El={}}};const Za=Ht("[SessionId]"),tS=864e5;var nS=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,n){var r;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new Yf,this.Ll=(i,o)=>!(!ti(i)||!ti(o))&&Math.abs(i-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||Xr,this.jl=n||Xr;const s=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*Ss(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Za.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+s+"_window_id",this.zl="ph_"+s+"_primary_window_exists",this.Ul()){const i=Tt.Dt(this.Hl),o=Tt.Dt(this.zl);i&&!o?this.je=i:Tt.Lt(this.Hl),Tt.$t(this.zl,!0)}!((r=this.Ir.bootstrap)===null||r===void 0)&&r.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Q(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Ir.persistence!=="memory"&&!this.Il.hi&&Tt.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Tt.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Tt.Dt(this.Hl):null}Zl(e){const t=this.Rl;return!Ut(t)&&!Ut(e)&&5e3>Math.abs(e-t)}Ql(e,t,n){const r=t!==this._sessionActivityTimestamp,s=!(e!==this.Xt||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,s&&!r||s&&this.Zl(t)||(this.Rl=t,this.Il.register({[fl]:[t,e,n]}))}Jl(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ti(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(fl):(this.Il.flush(),this.Il.load())}Xl(){var e;if(Ut(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,t,n]=this.Yl();t===this.Xt&&n===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[fl]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),t=ti(e)?e:0,n=ti(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[fl];return Ae(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(null,null,null)}setBootstrapSessionId(e,t=!1){const n=((r,s=new Date().getTime())=>{try{const i=(o=>{const l=o.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return i>s+6e4?void Za.error("Bootstrap sessionID cannot be in the future"):i}catch(i){return void Za.error("Invalid sessionID in bootstrap",i)}})(e);return!Q(n)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:n}:this.Ql(e,new Date().getTime(),n),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&K&&(K.removeEventListener(Hf,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Tt.Lt(this.zl)},pt(K,Hf,this.Ol,{capture:!1})}
11checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const r=t||new Date().getTime(),s=this.Xt;if(n)this.Al=r;else if(Ut(this.Al)||this.Al>r||r-this.Al>=1e3){var i,o;(i=(o=this.Il).syncCookieProperties)===null||i===void 0||i.call(o),this.Al=r}let[,l,c]=this.Yl();const u=!Q(s)&&l!==s,d=this.tu();let h=this.Gl();const f=this.Nl,p=!!f&&(f.sessionStartTimestamp>r+6e4||r-f.sessionStartTimestamp>tS),g=f?p:ti(c)&&Math.abs(r-c)>tS;let v=!1,y=u,x=!l||!!f;const b=l;let w=!x&&!e&&this.Ll(r,d);if(w&&(w=this.eu(r),w||Za.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,c]=this.Yl(),w||(x=!l||!!f)),x||w||g){y=!1;const R=f&&!p;l=R?f.sessionId:this.ql(),h=this.jl(),Za.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!R,changeReason:{noSessionId:x,activityTimeout:w,sessionPastMaximumLength:g}}),c=R?f.sessionStartTimestamp:r,this.Nl=void 0,v=!0}else h||(h=this.jl(),v=!0),y=y||l!==b,y&&(Za.info("adopted cross-tab session id",{sessionId:l,windowId:h}),v=!0);const S=ti(d)&&e&&!g?d:r,_=ti(c)?c:new Date().getTime();this.Vl(h),this.Ql(l,S,_),e||this.Bl();const E={noSessionId:x,activityTimeout:w,sessionPastMaximumLength:g,crossTabAdoption:y};return v&&this.Fl.forEach(R=>R(l,h,E)),{sessionId:l,windowId:h,sessionStartTimestamp:_,changeReason:v?E:void 0,lastActivityTimestamp:d}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const bI=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&ik(n,t))return!0;try{const r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>ik(s==null?void 0:s.brand,t)))return!0}catch{}return!!e.webdriver};function wI(){return(wI=Rt(function*(){const e=gn==null?void 0:gn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Je(n)&&n.length>0?n:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function EU(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function _I(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const Qf=(e,t)=>
11{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ch=e=>e.toLowerCase(),kI={exact:(e,t)=>t.some(n=>e.some(r=>n===r)),is_not:(e,t)=>t.every(n=>e.every(r=>n!==r)),regex:(e,t)=>t.some(n=>e.some(r=>Qf(n,r))),not_regex:(e,t)=>t.every(n=>e.every(r=>!Qf(n,r))),icontains:(e,t)=>t.map(Ch).some(n=>e.map(Ch).some(r=>n.includes(r))),not_icontains:(e,t)=>t.map(Ch).every(n=>e.map(Ch).every(r=>!n.includes(r))),gt:(e,t)=>t.some(n=>{const r=parseFloat(n);return!isNaN(r)&&e.some(s=>r>parseFloat(s))}),lt:(e,t)=>t.some(n=>{const r=parseFloat(n);return!isNaN(r)&&e.some(s=>r<parseFloat(s))})};function SI(e,t){return!e||Object.entries(e).every(([n,r])=>{const s=t==null?void 0:t[n];if(s==null)return!1;const i=kI[r.operator];return!!i&&i(r.values.map(String),[String(s)])})}function Vg(e,t,n){return gl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const hx="custom",rS="i.posthog.com",NU=/^\/static\//,CU=["/s/","/e/","/i/"];var jU=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${rS}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":hx),this.nu[this.apiHost]}su(e){if(!NU.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){const t=yi(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,n){if(e==="ui")return n;let r=n;const s=this.instance.config.rewriteRequestPath;if(s){var i;const o=((i=yi(n))===null||i===void 0?void 0:i.href)||n;r=s(new URL(o)).toString()}if(s&&e==="api"&&CU.some(o=>t.indexOf(o)===0)){const o=this.ru(r);if(o){const l=this.apiHost;let c=this.au;(c==null?void 0:c.apiHost)===l&&c.rewriteRequestPath===s||(c={apiHost:l,rewriteRequestPath:s,urls:new Set},this.au=c),c.urls.add(o)}}return r}isIngestionEndpoint(e){const t=this.au,n=this.ru(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){const r=this.su(t);if(r)return this.ou(e,t,`${r}${t}`)}if(this.region===hx)return this.ou(e,t,this.apiHost+t);const n=rS+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${n}`);case"api":return this.ou(e,t,`https://${this.region}.${n}`)}}};const mt=Ht("[Surveys]"),EI=e=>{try{const t=(n=>((r,s)=>`seenSurvey_${function(i){return i.current_iteration&&i.current_iteration>0?`${i.id}_${i.current_iteration}`:i.id}(s)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){mt.error("Failed to persist survey seen state",t)}},TU=[Mg.Popover,Mg.Widget,Mg.API],PU={ignoreConditions:!1,ignoreDelay:!1,displayType:ax.Popover},AU=Ht("[PostHog ExternalIntegrations]"),IU={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var RU=class{constructor(e){this._instance=e}Ho(e,t){var n,r;(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this._instance,e,s=>{if(s)return AU.error("failed to load script",s);t()})}startIfEnabledOrStop(){var e;for(const[s,i]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,r;i&&!(!((t=Ce.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[s])&&this.Ho(IU[s],()=>{var o;(o=Ce.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[s])===null||o===void 0||o.start(this._instance)}),!i&&(!((n=Ce.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[s])&&((r=Ce.__PosthogExtensions__)===null||r===void 0||(r=r.
11integrations)===null||r===void 0||(r=r[s])===null||r===void 0||r.stop())}}},MU=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return Rt(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{const n=e.setup(t.bo);n&&(yield n)}catch(n){const r=t.lu.get(e.name)===e;r&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,n),r&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const t of e)this.uu(t)}uu(e){try{var t;const n=(t=e.dispose)===null||t===void 0?void 0:t.call(e);n&&pn(n.then)&&n.then(void 0,r=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,r)})}catch(n){this.A.error(`Failed to dispose browser extension "${e.name}"`,n)}}},OU=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);const n={};for(const r of e){const s=t==null?void 0:t.get_property(r);Q(s)||(n[r]=s)}return n}set(e,t){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const sS="extensionsRemoteConfig";var DU=class{constructor(e){this.instance=e,this.To=!1,this.A=ue,this.hu=e.cu,this.kv=new OU(e),this.onEvent=t=>Nh(this.instance.on("eventCaptured",n=>{try{t({event:n.event,properties:n.properties})}catch(r){this.A.error("Browser extension event listener failed",r)}})),this.onRemoteConfig=t=>{if(this.To)return Nh(()=>{});const n=s=>{try{t(s)}catch(i){this.A.error("Browser extension remote config listener failed",i)}},r=this.instance.du.on(sS,n);return this.hu&&n(this.hu),Nh(r)},this.vu=new MU(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(ab);return typeof e=="string"?e:void 0}get library(){return{name:un.LIB_NAME,version:un.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,r;const s=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=s==null?void 0:s.sessionId)!==null&&t!==void 0?t:"",windowId:(n=s==null?void 0:s.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(r=s==null?void 0:s.sessionStartTimestamp)!==null&&r!==void 0?r:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,n){n?this.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Nh(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(sS,e))}sendRequest(e){var t=this;return Rt(function*(n,r={}){var s;const i=t.instance.requestRouter.endpointFor((s=r.target)!==null&&s!==void 0?s:"api",n),o={method:r.method,url:r.query?Vd(i,r.query):i,data:r.body,headers:r.headers,timeout:r.timeoutMs,fireCallbackOnDrop:!0,transport:r.transport,compression:r.compression,compressionFallback:r.target==="flags"&&r.compression==="best-available"?$y.Base64:void 0,timestampMode:r.sentAt};return r.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(l=>{o.callback=l,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const Du={};let Bg=0;const Lu=()=>{}
11,iS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xa="Surveys module not available",oS="sanitize_properties is deprecated. Use before_send instead",NI="Invalid value for property_denylist config: ",LU=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],FU=["$feature_flag_called","$$heatmap","$snapshot"],aS=e=>e.charAt(0)==="$"&&!Pe(FU,e),$U=/^[A-Za-z0-9_-]{1,400}$/,lS=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,cS=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,VU=["token","distinct_id",wA],gu="posthog",BU=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ug=e=>{var t;return U({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:FB(ee==null?void 0:ee.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Lu,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Bt&&Je(Bt==null?void 0:Bt.search)&&Bt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(K==null||(t=K.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){ue.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:AA,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Lu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:qB,ignore_text_selection:!0}
11:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:BU(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},UU=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],uS=e=>{const t={};for(const[s,i]of UU)Q(e[s])||(t[i]=e[s]);const n=It({},t,e),r=e.__preview_external_dependency_versioned_paths;return Q(r)||(Q(e.strict_script_versioning)&&(n.strict_script_versioning=!!r),Je(r)&&Q(e.asset_host)&&(n.asset_host=r)),Ae(e.property_blacklist)&&(Q(e.property_denylist)?n.property_denylist=e.property_blacklist:Ae(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:ue.error(NI+e.property_denylist)),n};var zU=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Fu=class Vi{gu(t){if(!t)return;const n=this.lu.indexOf(t);n!==-1&&this.lu.splice(n,1)}mu(t,n){var r;return this.gu(t),this.lu.push(n),(r=n.initialize)===null||r===void 0||r.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let n,r,s;t?(n=`persistence is set to '${this.config.persistence}'`,r=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",r="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${r}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}ku(){if(this.yu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.Su()||t.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const r=this.config.get_device_id(Xr());this.register({distinct_id:r,$device_id:r}),t.set_property(Hn,ui)}this.xu()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Cu=!1,this.$u=!1,this.webPerformance=new zU,this.Tu=!1,this.version=un.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new Yf,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ug(),this.SentryIntegration=eU,this.sentryIntegration=r=>function(s,i){const o=WA(s,i);return{name:HA,processEvent:l=>o(l)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new kU(this),this.pageViewM
11anager=new Hk(this),this.rateLimiter=new uU(this),this.requestRouter=new jU(this),this.consent=new WB(this),this.externalIntegrations=new RU(this);const n=(t=Vi.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,s,i)=>{const o=Je(r)?{[r]:s}:r;this.setPersonProperties(o),i==null||i({})},set_once:(r,s,i)=>{const o=Je(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),i==null||i({})}},this.on("eventCaptured",r=>ue.info(`send "${r==null?void 0:r.event}"`,r))}init(t,n,r){if(r&&r!==gu){var s;const i=(s=Du[r])!==null&&s!==void 0?s:new Vi;return i._init(t,n,r),Du[r]=i,Du[gu][r]=i,i}return this._init(t,n,r)}_init(t,n={},r){var s,i,o;const l=Je(t)?t.trim():"";if(!l)return ue.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var c;if(this.__loaded)return l!==((c=this.config)===null||c===void 0?void 0:c.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ug(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const u=Ug(n.defaults),d=uS(n),h=It({},u,d,{name:r,token:l});et(u.rageclick)&&et(d.rageclick)&&(h.rageclick=It({},u.rageclick,d.rageclick)),et(u.session_recording)&&et(d.session_recording)&&(h.session_recording=It({},u.session_recording,d.session_recording)),this.set_config(h),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Er.GZipJS;const f=this.Su();if(this.persistence=new Rg(this.config,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Rg(U(U({},this.config),{},{persistence:"sessionStorage"}),f,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!f&&Tt.Et()){const x=Tt.Dt(this.Mu);Ae(x)&&x.forEach(b=>{Je(b)&&this.Iu.add(b)})}else Tt.Lt(this.Mu);const p=U({},this.persistence.props),g=U({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new bU((x,b)=>this.ju(x,b),this.config.request_queue_config),this.Bu=new _U(this),this.__request_queue=[];const v=this.yu();v||(this.sessionManager=new nS(this),this.sessionPropsManager=new eS(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((x,b,w)=>{(w!=null&&w.activityTimeout||w!=null&&w.sessionPastMaximumLength||w!=null&&w.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(v)},0)):(ue.info("Initializing extensions synchronously"),this.Uu(v)),un.DEBUG=un.DEBUG||this.config.debug,un.DEBUG&&ue.info("Starting in debug mode",{this:this,config:n,thisC:U({},this.config),p,s:g}),this.config.identity_distinct_id&&!(!((s=n.bootstrap)===null||s===void 0)&&s.distinctID)&&(n.bootstrap=U(U({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const y=(i=n.bootstrap)===null||i===void 0?void 0:i.distinctID;if(this.wu=!!y&&!Cu(y),(o=n.bootstrap)===null||o===void 0?void 0:o.distinctID){const x=n.bootstrap.distinctID,b=this.get_distinct_id(),w=this.persistence.get_property(Hn);if(n.bootstrap.isIdentifiedID&&b!=null&&b!==x&&w==="anonymous")this.identify(x);else if(n.bootstrap.isIdentifiedID&&b!=null&&b!==x&&w==="identified")ue.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const S=this.config.get_device_id(Xr()),_=n.bootstrap.isIdentifiedID?S:x;this.persistence.set_property(Hn,n.bootstrap.isIdentifiedID?of:ui),this.register({distinct_id:x,$device_id:_})}}if(v)this.register_once({distinct_id:Eg,$device_id:null},"");else if(!this.get_distinct_id()){const x=this.config.get_device_id(Xr());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Hn,ui)}return pt(K,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),pt(K,"pageshow",()=>{var x;this.Cu=!1,this.$u||(x=this.Bu)===null||x===void 0||x.resume()}),n.segment?zk(this,()=>this.Wu()):this.Wu(),pn(this.config._onCapture)&&this.config._onCapture!==Lu&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",x=>this.config._onCapture(x.event,x))),this.config.ip&&ue.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return wI.apply(this,arguments)}().then(x=>{x&&this.register({[Sg]:x})}).catch(Lu),this}Vu(t){const n=t;return Je(n.name)&&pn(n.setup)}Gu(t,n){this.Vu(t)?n.push(()=>
11{this.Zu().add(t).catch(()=>{var r;return(r=t.dispose)===null||r===void 0?void 0:r.call(t)}).catch(r=>{ue.error(`Failed to dispose browser extension "${t.name}"`,r)})}):this.lu.push(t)}zu(){var t,n,r;const s=(t=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=Vi.__defaultExtensionClasses)===null||r===void 0?void 0:r.featureFlags;var i,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||((i=this.Qu)===null||i===void 0||i.call(this),this.Qu=void 0,this.featureFlags=new s(this)),pn(this.featureFlags.onReloading)&&pn(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(o=(l=this.featureFlags).initialize)===null||o===void 0||o.call(l))}Uu(t){const n=performance.now(),r=U(U({},Vi.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var i,o,l,c,u,d,h;r.exceptions&&this.lu.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new r.exceptions(this)),r.historyAutocapture&&this.lu.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.lu.push(this.tracingHeaders=new r.tracingHeaders(this)),r.siteApps&&this.lu.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),r.autocapture&&this.Gu(this.autocapture=new r.autocapture(this),s),r.surveys&&this.Gu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new r.surveys(this),s),r.logs&&this.Gu(this.logs=(l=this.logs)!==null&&l!==void 0?l:new r.logs(this),s),r.metrics&&this.lu.push(this.metrics=(c=this.metrics)!==null&&c!==void 0?c:new r.metrics(this)),r.conversations&&this.lu.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new r.conversations(this)),r.productTours&&this.lu.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.lu.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.lu.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,JB)),r.toolbar&&this.lu.push(this.toolbar=(d=this.toolbar)!==null&&d!==void 0?d:new r.toolbar(this)),r.experiments&&this.lu.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new r.experiments(this)),this.lu.forEach(f=>{f.initialize&&s.push(()=>{var p;(p=f.initialize)===null||p===void 0||p.call(f)})}),s.push(()=>{if(this.Ju){const f=this.Ju;this.Ju=void 0,this.lu.forEach(p=>{var g;return(g=p.onRemoteConfig)===null||g===void 0?void 0:g.call(p,f)})}}),this.Ku(s,n)}Ku(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,n)},0);const s=t.shift();if(s)try{s()}catch(i){ue.error("Error initializing extension:",i)}}const r=Math.round(performance.now()-n);this.register_for_session({[_A]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[kA]:r}),this.config.__preview_deferred_init_extensions&&ue.info(`PostHog extensions initialized (${r}ms)`)}el(t){var n;if(!ee||!ee.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.cu=t,this.compression=void 0,t.ok){var r;const s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=Pe(s.supportedCompression,Er.GZipJS)?Er.GZipJS:Pe(s.supportedCompression,Er.Base64)?Er.Base64:void 0),!((r=s.analytics)===null||r===void 0)&&r.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:AA}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(t),this.lu.forEach(s=>{var i;return(i=s.onRemoteConfig)===null||i===void 0?void 0:i.call(s,t)})}Wu(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(Bt==null?void 0:Bt.hostname)){const t=Bt.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.th()},1),this.eh=new rI(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&ml(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,n,r,s,i,o;this.Cu=!0,(t=this.surveys)===null||t===void 0||(n=t.handlePageUnload)===null||n===void 0||n.call(t),(r=this.metrics)===null||r===void 0||r.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(Ck),(s=this.logs)===null||s===void 0||s.flushLogs("sendBeacon"),(i=this.qu)===null||i===void 0||i.unload(),(o=this.Bu)===null||o===void 0||o.unload()):this.ih()&&this.capture(Ck,null,{transport:"sendBeacon"})}_send_request(t){xI(this,t)}ju(t,n){this.Bu?this.Bu.retriableRequest(t,n):this._send_request(n?U(U({},t),{},{transport:n}):t)}
11_execute_array(t){Bg++;try{let n;const r=[],s=[],i=[];ml(t,l=>{if(l)if(n=l[0],Ae(n))i.push(l);else if(pn(l))try{l.call(this)}catch(c){ue.error("Error executing queued PostHog call",l,c)}else Ae(l)&&n==="alias"?r.push(l):Ae(l)&&n.indexOf("capture")!==-1&&pn(this[n])?i.push(l):s.push(l)});const o=function(l,c){ml(l,function(u){try{if(Ae(u[0])){let d=c;xt(u,function(h){d=d[h[0]].apply(d,h.slice(1))})}else c[u[0]].apply(c,u.slice(1))}catch(d){ue.error("Error executing queued PostHog call",u,d)}})};o(r,this),o(s,this),o(i,this)}finally{Bg--}}push(t){if(Bg>0&&Ae(t)&&Je(t[0])){const n=Vi.prototype[t[0]];return void(pn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:Ek,persistenceKey:Sl,cookieName:"_fbc",pattern:lS,register:(t,n)=>{var r;return(r=this.persistence)===null||r===void 0?void 0:r.register({[Sl]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Sl)}}}get sh(){return{property:Nk,persistenceKey:Tu,cookieName:"_fbp",pattern:cS,register:(t,n)=>{var r;return(r=this.persistence)===null||r===void 0?void 0:r.register({[Tu]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Tu)}}}rh(t){var n;const r=(n=this.persistence)===null||n===void 0?void 0:n.get_property(t.persistenceKey);return Je(r)&&t.pattern.test(r)?{value:r,delivered:!1}:et(r)&&Je(r.value)&&t.pattern.test(r.value)?{value:r.value,delivered:r.delivered===!0}:void 0}oh(t,n,r){return n===(r==null?void 0:r.value)?{value:n,pending:!r.delivered}:(t.register(n,!1),{value:n,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.yu())return;const n=Iu(t.cookieName);return Je(n)&&t.pattern.test(n)?n:void 0}uh(t,n,r,s){if(!this.persistence)return;const i=this.nh;this.persistence.refreshKey(i.persistenceKey);const o=this.rh(i);if(s)return void i.unregister();if(r)return Je(n)&&lS.test(n)?this.oh(i,n,o):void i.unregister();const l=Je(t)&&$U.test(t)?t:void 0,c=this.ah(i);return c&&((u,d,h)=>{const f=u.split(".");if(d)return f[3]===d;if(!h)return!0;const p=h.value.split(".");return f[3]===p[3]||Number(f[2])>Number(p[2])})(c,l,o)?this.oh(i,c,o):l?(o==null?void 0:o.value.split(".")[3])===l?{value:o.value,pending:!o.delivered}:this.oh(i,`fb.1.${Date.now()}.${l}`,o):o?{value:o.value,pending:!o.delivered}:void 0}hh(t,n,r){if(!this.persistence)return;const s=this.sh;this.persistence.refreshKey(s.persistenceKey);const i=this.rh(s);if(r)return void s.unregister();if(n)return Je(t)&&cS.test(t)?this.oh(s,t,i):void s.unregister();const o=this.ah(s);return o?this.oh(s,o,i):i?{value:i.value,pending:!i.delivered}:void 0}dh(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const r=this.rh(t);(r==null?void 0:r.value)!==n||r.delivered||t.register(n,!0)}capture(t,n,r){var s,i;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ue.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Q(t)||!Je(t))return void ue.error("No event name provided to posthog.capture");this.ku();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const l=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l!=null&&l.isRateLimited)return void ue.critical("This capture call is ignored due to client rate limiting.");let c;n!=null&&n.$current_url&&!Je(n==null?void 0:n.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||r!=null&&r.fh||ue.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const u=new Date,d=(r==null?void 0:r.timestamp)||u,h=ck(r==null?void 0:r.uuid,Xr);let f={uuid:h,event:t,properties:this.calculateEventProperties(t,n||{},d,h)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),l&&(f.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);const p=t==="$feature_flag_called"&&f.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;r!=null&&r.$set&&!p&&(f.$set=r==null?void 0:r.$set);const g=et(n==null?void 0:n.$set)?n.$set:void 0,v=Ae(n==null?void 0:n.$unset)?n.$unset:[],y=(r==null?void 0:r.$unset)||[],x=L=>{var M;const $=!!(r!=null&&r.$set)&&L in r.$set;return{hasProvided:$||!!g&&L in g,provided:$?r==null||(M=r.$set)===null||M===void 0?void 0:M[L]:g==null?void 0:g[L],unset:v.indexOf(L)!==-1||y.indexOf(L)!==-1}},b=x(Ek),w=x(Nk),S=[{channel:this.nh,hasProvided:b.hasProvided,update:this.uh(c==null?void 0:c.fbclid,b.provided,b.hasProvided,b.unset)},{channel:this.sh,hasProvided:w.hasProvided,update:this.hh(w.provided,w.hasProvided,w.unset)}];for(const{channel:L,hasProvided:M,update:$}of S)$&&f.properties.$process_person_profile===!0&&$.pending&&!M&&!p&&(f.$set=U({[L.property]:$.value},f.$set));const _=r==null?void 0:r.$unset;_&&(f.$unset=_);const E=p?void 0:this.ph(r==null?void 0:r.$set_once,t!==jk,t===IA);if(E&&(f.$set_once=E),r!=null&&r._noTruncate||(R=this.config.properties_string_max_length,f=function(L,M){const $=new Set;return function j(P,D){if(P!==Object(P))return M?M(P):P;if($.has(P))return;let C;if($.add(P),Ae(P))C=[],ml(P,H=>{C.push(j(H))});else{const H={};xt(xc(P)?RA(P):P,(V,O)=>{$.has(V)||(H[O]=j(V))}),C=H}return C}(L)}(f,L=>Je(L)?L.slice(0,R):L)),f.timestamp=d,Q(r==null?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=u),p&&(f.properties=((L,M=[])=>{const $={},j=P=>{L[P]!==void 0&&($[P]=L[P])};
11return sB.forEach(j),M.forEach(j),$})(f.properties,VU)),t===_r.DISMISSED||t===_r.SENT){const L=n==null?void 0:n[Og.SURVEY_ID],M=n==null?void 0:n[Og.SURVEY_ITERATION];EI({id:L,current_iteration:M}),f.$set=U(U({},f.$set),{},{[EU({id:L,current_iteration:M},t===_r.SENT?"responded":"dismissed")]:!0})}else t===_r.SHOWN&&(f.$set=U(U({},f.$set),{},{[Og.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var R;if(t===cU.SHOWN){const L=n==null?void 0:n[Gk.TOUR_TYPE];L&&(f.$set=U(U({},f.$set),{},{[`${Gk.TOUR_LAST_SEEN_DATE}/${L}`]:new Date().toISOString()}))}const A=U(U({},f.properties.$set),f.$set);if(sr(A)||this.setPersonPropertiesForFlags(A),!Fe(this.config.before_send)){const L=this.Os(f);if(!L)return;f=L,f.uuid=ck(f.uuid,Xr)}this.sessionRecording&&!this.Pu&&aS(t)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const N=S.filter(({channel:L,update:M})=>{var $,j,P;const D=($=(j=f.$set)===null||j===void 0?void 0:j[L.property])!==null&&$!==void 0?$:et((P=f.properties)===null||P===void 0?void 0:P.$set)?f.properties.$set[L.property]:void 0;return(M==null?void 0:M.pending)&&D===M.value});this.du.emit("eventCaptured",f);const k=(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T=(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(k),I=U(U(U({method:"POST",url:k,data:f,compression:"best-available",preferSyncCompression:r==null?void 0:r.send_instantly,timestampMode:T?"body":"capture-body",batchKey:r==null?void 0:r._batchKey},T&&(!((i=f.properties)===null||i===void 0)&&i.$session_id)?{batchGroup:f.properties.$session_id+(f.properties.$window_id?`-${f.properties.$window_id}`:"")}:{}),r!=null&&r.transport?{transport:r.transport}:{}),N.length?{fireCallbackOnDrop:!0,callback:L=>{if(L.statusCode>=200&&300>L.statusCode)for(const{channel:M,update:$}of N)this.dh(M,$.value)}}:{});if(!this.config.request_batching||r&&!(r!=null&&r._batchKey)||r!=null&&r.send_instantly||N.length){var F;let L;!I.transport&&!I.callback&&sr((F=this.config.request_headers)!==null&&F!==void 0?F:{})&&this.Cu&&(L="sendBeacon"),this.ju(I,L)}else this.qu.enqueue(I);return f}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new DU(this)}fu(t){this.Eu.push(t);let n=!0;return()=>{if(!n)return;n=!1;const r=this.Eu.indexOf(t);r!==-1&&this.Eu.splice(r,1)}}gh(t=!0){var n,r,s;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((s=this.sessionPersistence)===null||s===void 0||s.clear(),this.Iu.clear(),this.mh()),(r=this.featureFlags)===null||r===void 0||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const o=i?void 0:this.persistence.remove_event_timer(t);let l=U({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.yu()&&(l[wA]=!0),t==="$snapshot"){const b=U(U({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=b.distinct_id,(!Je(l.distinct_id)&&!Gt(l.distinct_id)||Cu(l.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const c=function(b,w,S,_=!1){var E,R,A,N;if(!Bn)return{};const k=b?[...Xl,...w||[]]:[],[T,I]=BP(Bn),[F,L]=function(G){for(let Z=0;lk.length>Z;Z++){const[ae,te,ne]=lk[Z],re=G.match(ae);if(re){const J=ne&&G.match(ne)||re;return[te,(J==null?void 0:J[1])||""]}}return["",""]}(Bn),M=function(){const G="u">typeof navigator?navigator:void 0;return G!=null&&G.brave?{brave:!0}:{}}(),$={};Q(S)||($.detectGoogleSearchApp=S);const j={},P=(E=navigator)===null||E===void 0||(E=E.userAgentData)===null||E===void 0?void 0:E.platform,D=(R=navigator)===null||R===void 0?void 0:R.maxTouchPoints,C=K==null||(A=K.screen)===null||A===void 0?void 0:A.width,H=K==null||(N=K.screen)===null||N===void 0?void 0:N.height,V=K==null?void 0:K.devicePixelRatio;Q(P)||(j.userAgentDataPlatform=P),Q(D)||(j.maxTouchPoints=D),Q(C)||(j.screenWidth=C),Q(H)||(j.screenHeight=H),Q(V)||(j.devicePixelRatio=V);const O=It(mb({$os:T,$os_version:I,$browser:VP(Bn,navigator.vendor,M,$),$webview_app:F,$webview_app_version:L,$device:UP(Bn),$device_type:N6(Bn,j),$timezone:tI(),$timezone_offset:oU()}),{$current_url:id(_?po(Bt==null?void 0:Bt.href):Bt==null?void 0:Bt.href,k,od),$host:Bt==null?void 0:Bt.host,$pathname:Bt==null?void 0:Bt.pathname,$raw_user_agent:Bn.length>1e3?Bn.substring(0,997)+"...":Bn,$browser_version:E6(Bn,navigator.vendor,M,$),$browser_language:ZA(),$browser_language_prefix:iU(),$screen_height:K==null?void 0:K.screen.height,$screen_width:K==null?void 0:K.screen.width,$viewport_height:K==null?void 0:K.innerHeight,$viewport_width:K==null?void 0:K.innerWidth,$lib:di.LIB_NAME,$lib_version:di.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return di.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=di.SDK_DIST_CHANNEL),O}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes
11);if(this.sessionManager){const{sessionId:b,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime(),!0);l.$session_id=b,l.$window_id=w}this.sessionPropsManager&&It(l,this.sessionPropsManager.getSessionProps());try{var u;if(this.sessionRecording){const b=this.sessionRecording.sdkDebugProperties,w=!this.Pu&&aS(t);for(const S in b)(w||Pe(LU,S))&&(l[S]=b[S])}l.$sdk_debug_retry_queue_size=(u=this.Bu)===null||u===void 0?void 0:u.length}catch(b){l.$sdk_debug_error_capturing_properties=String(b)}let d;if(this.requestRouter.region===hx&&(l.$lib_custom_api_host=this.config.api_host),d=t!=="$pageview"||i?t!=="$pageleave"||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=It(l,d),t==="$pageview"&&ee&&(l.title=ee.title),!Q(o)){const b=r.getTime()-o;l.$duration=parseFloat((b/1e3).toFixed(3))}Bn&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const h=this.persistence.properties(),f=this.sessionPersistence.properties(),p=l.$groups,g=h.$groups;et(p)&&!sr(p)&&(l.$groups=U(U({},et(g)?g:{}),p)),xt(["$referrer","$referring_domain"],b=>{b in h&&delete f[b]});const v={};if(this.Eu.length>0)for(const b of this.Eu.slice())try{It(v,b())}catch(w){ue.error("Failed to produce browser extension event properties",w)}l=It({},c,h,f,U(U({},v),l)),l.$is_identified=this._isIdentified(),Ae(this.config.property_denylist)?xt(this.config.property_denylist,function(b){delete l[b]}):ue.error(NI+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(ue.error(oS),l=y(l,t));const x=this.yh();return l.$process_person_profile=x,x&&!i&&this.bh("_calculate_event_properties"),l}ph(t,n=!0,r=!1){var s;if(!this.persistence||!this.yh()||this.Tu&&!r)return t;const i=this.persistence.get_initial_props(),o=(s=this.sessionPropsManager)===null||s===void 0?void 0:s.getSetOnceProps();let l=It({},i,o||{},t||{});const c=this.config.sanitize_properties;return c&&(ue.error(oS),l=c(l,"$set_once")),n&&(this.Tu=!0),sr(l)?void 0:l}register(t,n){var r;(r=this.persistence)===null||r===void 0||r.register(t,n)}register_once(t,n,r){var s;(s=this.persistence)===null||s===void 0||s.register_once(t,n,r)}register_for_session(t){var n,r;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh(),(r=this.sessionPersistence)===null||r===void 0||r.register(t),Object.keys(t).forEach(s=>this.Iu.add(s)),this.mh()}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t),this.Iu.delete(t),this.mh()}_h(t,n){this.register({[t]:n})}Hu(){this.Iu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.Iu.clear(),this.mh()}mh(){var t;if(!this.Mu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!Tt.Et())return void Tt.Lt(this.Mu);const n=[];this.Iu.forEach(r=>n.push(r)),n.length>0?Tt.$t(this.Mu,n):Tt.Lt(this.Mu)}getFeatureFlag(t,n){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,s;return(r=(s=this.featureFlags)===null||s===void 0?void 0:s.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,n,r){var s;(s=this.featureFlags)===null||s===void 0||s.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var s;(s=this.featureFlags)===null||s===void 0||s.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n=!1,r){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.du.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Xa}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n=!1){this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:Xa})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Xa})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Xa}),()=>{})}renderSurvey(t,n){var r;(r=this.surveys)===null||r===void 0||r.renderSurvey(t,n)}displaySurvey(t,n=PU){var r;(r=this.surveys)===null||r===void 0||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Xa}}canRenderSurveyAsync(t,n=!1){var r,s;return(r=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Xa})}wh(t){return!t||Cu(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(ue.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ue.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
11ot a hardcoded string.`),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return ue.uninitializedWarning("posthog.identify");if(Gt(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t)||!this.bh("posthog.identify"))return;this.ku();const s=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,o=this.gh(!1),l=this.persistence.Oa();let c=!1;try{const d=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:d},""),t!==d&&t!==this.get_property("__alias")&&(this.unregister(Uf),this.register({distinct_id:t}));const h=(this.persistence.get_property("$user_state")||"anonymous")===ui,f=t!==d,p=!f&&h;if(f&&h){var u;const g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:d};this.persistence.set_property(Hn,of),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",g,{$set:n||{},$set_once:r||{}})&&(this.Ou=Vg(t,n,r)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:d)}else if(p){this.persistence.set_property(Hn,of);const g=n||{},v=r||{};this.setPersonPropertiesForFlags({$set:g,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:g,$set_once:v})&&(this.Ou=Vg(t,n,r))}else(n||r)&&this.setPersonProperties(n,r);f||i||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ao)):p&&(n||r)&&this.reloadFeatureFlags(),c=!0}finally{l&&this.persistence.qa(c)}}setPersonProperties(t,n){if(!t&&!n||!this.bh("posthog.setPersonProperties"))return;const r=Vg(this.get_distinct_id(),t,n);this.Ou!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}})&&(this.Ou=r)):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const r=(Ae(t)?t:[t]).filter(s=>Je(s)&&s.length>0);r.length!==0&&this.bh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Ou=null)}group(t,n,r){var s;if(!t||!n)return void ue.error("posthog.group requires a group type and group key");(s=this.persistence)===null||s===void 0||s.syncCookieProperties(),this.gh();const i=this.getGroups(),o=i[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:U(U({},i),{},{[t]:n})}),(o||r)&&this.yh()){const l={$group_type:t,$group_key:n};r&&(l.$group_set=r),this.capture(jk,l)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n=!0){var r;(r=this.featureFlags)===null||r===void 0||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n=!0){var r;this.bh("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)===null||r===void 0||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(t)}reset(t){const n=Kn(t)?t:t==null?void 0:t.resetDeviceID,r=Kn(t)||t==null?void 0:t.bootstrap;this.kh(n,!1,r)}kh(t,n=!1,r){var s,i,o,l,c,u;if(ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");const d=r==null?void 0:r.sessionID;this.config.bootstrap=r||((s=this.Lu)===null||s===void 0?void 0:s.bootstrap)||{},(i=this.featureFlags)===null||i===void 0||(o=i.updateConfig)===null||o===void 0||o.call(i,this.config,this.il());const h=this.get_property(ab),f=this.get_property(Sg),p=this.get_property(Pu);(l=this.sessionRecording)===null||l===void 0||l.flushBeforeIdentityReset();const g=this.is_capturing();this.consent.reset(),n||!g||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const v=(c=this.persistence)===null||c===void 0||(u=c.Oa)===null||u===void 0?void 0:u.call(c);let y=!1;try{var x,b,w,S,_,E,R,A,N,k,T,I,F;if((x=this.persistence)===null||x===void 0||x.clear(),(b=this.sessionPersistence)===null||b===void 0||b.clear(),this.Iu.clear(),this.mh(),Q(p)||(k=this.persistence)===null||k===void 0||k.register({$session_recording_remote_config:p}),(w=this.surveys)===null||w===void 0||w.reset(),(S=this.featureFlags)===null||S===void 0||S.reset(),(_=this.conversations)===null||_===void 0||_.reset(),(E=this.logs)===null||E===void 0||E.reset(),(R=this.metrics)===null||R===void 0||R.reset(),(A=this.persistence)===null||A===void 0||A.set_property("$user_state","anonymous"),(N=this.sessionManager)===null||N===void 0||N.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Eg,$device_id:null},"");else{const $=this.config.get_device_id(Xr());this.register_once({distinct_id:$,$device_id:t?$:h},""),t||Q(f)||this.register({[Sg]:f})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID&&!this.yu()&&((F=this.persistence)===null||F===void 0||F.set_property("$user_state",r.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.distinctID}
11)),(T=this.featureFlags)===null||T===void 0||T.initialize(),!Fe(d)&&!(!((I=this.sessionManager)===null||I===void 0)&&I.setBootstrapSessionId(d,!0)))){const $=U({},r);delete $.sessionID,this.config.bootstrap=$}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var L,M;v&&((L=this.persistence)===null||L===void 0||(M=L.qa)===null||M===void 0||M.call(L,y))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Rt(function*(){var r,s,i,o,l,c,u,d;if(n.__loaded){n.$u=!0,n.Zu().dispose(),(r=n.sessionRecording)===null||r===void 0||r.dispose(),(s=n.logs)===null||s===void 0||s.flushLogs("sendBeacon"),(i=n.metrics)===null||i===void 0||i.flush("sendBeacon"),(o=n.metrics)===null||o===void 0||o.dispose(),(l=n.qu)===null||l===void 0||l.unload(),(c=n.Bu)===null||c===void 0||c.unload();try{var h;(h=n.featureFlags)===null||h===void 0||h.destroy()}catch(f){ue.error("Error while destroying feature flags",f)}(u=n.persistence)===null||u===void 0||u.destroy(),(d=n.sessionPersistence)===null||d===void 0||d.destroy()}else ue.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,n){var r;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)===null||r===void 0||r.Sh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(t!=null&&t.withTimestamp&&r){var i;const o=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+=`?t=${Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}`}return s}alias(t,n){return t===this.get_property("$people_distinct_id")?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Q(n)&&(n=this.get_distinct_id()),t!==n?(this._h(Uf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ue.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=U({},this.config);if(et(t)){var r,s,i,o,l,c,u,d,h,f,p,g,v,y;It(this.config,uS(t));const b=this.Su();(r=this.persistence)===null||r===void 0||r.update_config(this.config,n,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Rg(U(U({},this.config),{},{persistence:"sessionStorage"}),b,!1);const w=this.Du(this.config.debug);var x;Kn(w)&&(this.config.debug=w),Kn(this.config.debug)&&(this.config.debug?(un.DEBUG=!0,ot.Et()&&ot.$t("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:n,newConfig:U({},this.config)})):(un.DEBUG=!1,ot.Et()&&ot.Lt("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(i=s.updateConfig)===null||i===void 0||i.call(s,this.config,this.il()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(l=this.exceptions)===null||l===void 0||l.onConfigChange(),(c=this.metrics)===null||c===void 0||c.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(d=this.tracingHeaders)===null||d===void 0||d.startIfEnabledOrStop(),(h=this.autocapture)===null||h===void 0||h.startIfEnabled(),(f=this.heatmaps)===null||f===void 0||f.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((x=this.historyAutocapture)===null||x===void 0||x.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)===null||g===void 0||g.startIfEnabledOrStop(),(v=this.surveys)===null||v===void 0||v.loadIfEnabled(),this.xu(),(y=this.externalIntegrations)===null||y===void 0||y.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&zk(this,Lu,!1)}}
11_overrideSDKInfo(t,n){un.LIB_NAME=t,un.LIB_VERSION=n}startSessionRecording(t){const n=t===!0,r={sampling:n||!!(t!=null&&t.sampling),linked_flag:n||!!(t!=null&&t.linked_flag),url_trigger:n||!!(t!=null&&t.url_trigger),event_trigger:n||!!(t!=null&&t.event_trigger)};var s,i,o,l,c;Object.values(r).some(Boolean)&&((s=this.sessionManager)===null||s===void 0||s.checkAndGetSessionAndWindowId(),r.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),r.url_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,n){try{if(!this.exceptions)return;const r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(U(U({},r),n))}catch{return}}addExceptionStep(t,n){var r;(r=this.exceptions)===null||r===void 0||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)===null||n===void 0||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&t!==void 0?t:Vi.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)===null||r===void 0?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t;let n=(t=this.config.name)!==null&&t!==void 0?t:gu;return n!==gu&&(n="posthog."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yh(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&sr(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return this.config.person_profiles==="never"?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this._h(ub,!0),!0)}Su(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,n;const r=this.Su();var s,i,o;return this.is_capturing()||(s=this.logs)===null||s===void 0||s.$h(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==r&&((i=this.persistence)===null||i===void 0||i.set_disabled(r)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==r&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(r)),r&&(this.Iu.clear(),this.mh()),r}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var r,s,i,o,l,c;(r=this.sessionRecording)===null||r===void 0||r.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(s=this.sessionManager)===null||s===void 0||s.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=new nS(this),this.pageViewManager=new Hk(this),this.persistence&&(this.sessionPropsManager=new eS(this,this.sessionManager,this.persistence));const p=(o=(l=this.config.__extensionClasses)===null||l===void 0?void 0:l.sessionRecording)!==null&&o!==void 0?o:(c=Vi.__defaultExtensionClasses)===null||c===void 0?void 0:c.sessionRecording;var u,d;p&&(this.sessionRecording=this.mu(this.sessionRecording,new p(this)),this.cu&&((u=this.sessionRecording)===null||u===void 0||(d=u.onRemoteConfig)===null||d===void 0||d.call(u,this.cu)))}var h,f;this.consent.optInOut(!0),this.xu(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(Q(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((f=t==null?void 0:t.captureEventName)!==null&&f!==void 0?f:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ue.warn(iS)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ue.warn(iS);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,r;
11t==null||t.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Eg,$device_id:null}),this.gu(t),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return gn?bI(gn,this.config.custom_blocked_useragents):void 0}th(){ee&&(ee.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(pb,{title:ee.title},{send_instantly:!0}),this.Au&&(ee.removeEventListener(nd,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),pt(ee,nd,this.Au)))}debug(t){t===!1?(K==null||K.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(K==null||K.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}il(){const t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ue.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(n,r,s,i,o){const l=r in n&&!Fe(n[r]),c=s in n&&!Fe(n[s]);return l?n[r]:!!c&&(o&&o.warn(`Config field '${s}' is deprecated. Please use '${r}' instead. The old field will be removed in a future major version.`),n[s])}(t,"advanced_disable_flags","advanced_disable_decide",0,ue)}Os(t){var n;if(Fe(this.config.before_send))return t;const r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(p6),s=Ae(this.config.before_send)?this.config.before_send:[this.config.before_send];let i=t;for(const o of s)try{if(i=o(i),Fe(i)){const l=`Event '${t.event}' was rejected in beforeSend function`;return f6(t.event)?ue.warn(`${l}. This can cause unexpected behavior.`):ue.info(l),null}i.properties&&!sr(i.properties)||ue.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(l){return ue.error(`Error in beforeSend function for event '${t.event}':`,l),null}for(const o of r)if(i.properties&&Fe(i.properties[o]))return ue.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return i}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Du(t){const n=Kn(t)&&!t,r=ot.Et()&&ot.Ot("ph_debug")==="true";return!n&&(!!r||t)}};Fu.__defaultExtensionClasses={},Fu.Ch=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=DB(e.prototype[t[n]])}(Fu,["identify"]);var CI=class{constructor(e){this.disabled=e===!1;const t=et(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;const r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}};const zg="$copy_autocapture",Hg=Ht("[AutoCapture]");function Wg(e,t){return t.length>e?t.slice(0,e)+"...":t}function HU(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Os(t));return t}function WU(e,{e:t,maskAllElementAttributes:n,maskAllText:r,elementAttributeIgnoreList:s,elementsC
11hainAsString:i,disableCaptureUrlHashes:o}){var l,c;if(!Os(e))return{props:{}};const u=[e],d=new Set([e]);let h=e;for(;h.parentNode&&!Nn(h,"body")&&1e3>u.length;){if(gb(h.parentNode)){const E=h.parentNode.host;if(d.has(E))break;d.add(E),u.push(E),h=E;continue}if(!Os(h.parentNode)||d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const f=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(E=>Nn(E,"button")||Nn(E,"a")):-1;f>0&&(r=r||u.slice(0,f+1).some(E=>!El(E)||sd(E)));const p=[],g={};let v,y=!1,x=!1;if(xt(u,E=>{const R=El(E);if(Nn(E,"a")&&!n&&!(s!=null&&s.includes("href"))){const A=E.getAttribute("href");y=!!(R&&A&&Mu(A))&&(o?po(A):A)}Pe(Ql(E),"ph-no-capture")&&(x=!0),p.push(function(A,N,k,T,I=!1){const F=A.tagName.toLowerCase(),L={tag_name:F};yb.indexOf(F)>-1&&!k&&(L.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?Wg(1024,Vk(A)):Wg(1024,rd(A)));const M=Ql(A);N||T!=null&&T.includes("class")||0>=M.length||(L.classes=M.filter(function(D){return D!==""})),xt(A.attributes,function(D){var C;if((!sd(A)||["name","id","class","aria-label"].indexOf(D.name)!==-1)&&!(T!=null&&T.includes(D.name))&&!N&&Mu(D.value)&&(!Je(C=D.name)||C.substring(0,10)!=="_ngcontent"&&C.substring(0,7)!=="_nghost")){let H=D.value;D.name==="class"&&(H=vb(H).join(" ")),L["attr__"+D.name]=Wg(1024,D.name==="href"&&I?po(H):H)}});let $=1,j=1,P=A;for(;P=HU(P);)$++,P.tagName===A.tagName&&j++;return L.nth_child=$,L.nth_of_type=j,L}(E,n,r,s,o)),xt(function(A){if(!El(A))return{};const N={};return xt(A.attributes,function(k){if(k.name&&k.name.indexOf("data-ph-capture-attribute")===0){const T=k.name.replace("data-ph-capture-attribute-",""),I=k.value;T&&I&&Mu(I)&&(N[T]=I)}}),N}(E),(A,N)=>{({}).hasOwnProperty.call(g,N)||(g[N]=A)})}),x)return{props:{},explicitNoCapture:x};if(f>0&&(e=u[f],p.splice(0,f)),r||(p[0].$el_text=Nn(e,"a")||Nn(e,"button")?Vk(e):rd(e)),y){var b,w;p[0].attr__href=y;const E=(b=yi(y))===null||b===void 0?void 0:b.host,R=K==null||(w=K.location)===null||w===void 0?void 0:w.host;E&&R&&E!==R&&(v=y)}return{props:It((_=t.type,{$event_type:_,$ce_version:1}),i?{}:{$elements:p},{$elements_chain:(S=p,Ae(S)?function(E){return E.map(R=>{var A,N;let k="";if(R.tag_name&&(k+=R.tag_name),R.attr_class){R.attr_class.sort();for(const F of R.attr_class)k+=`.${F.replace(/"/g,"")}`}const T=U(U(U(U({},R.text?{text:R.text}:{}),{},{"nth-child":(A=R.nth_child)!==null&&A!==void 0?A:0,"nth-of-type":(N=R.nth_of_type)!==null&&N!==void 0?N:0},R.href?{href:R.href}:{}),R.attr_id?{attr_id:R.attr_id}:{}),R.attributes),I={};return af(T).sort(([F],[L])=>function(M,$){return $>M?-1:M>$?1:0}(F,L)).forEach(([F,L])=>I[Bk(F.toString())]=Bk(L.toString())),k+=":",k+=af(I).map(([F,L])=>`${F}="${L}"`).join(""),k}).join(";")}(function(E){return E.map(R=>{var A,N;const k={text:(A=R.$el_text)===null||A===void 0?void 0:A.slice(0,400),tag_name:R.tag_name,href:(N=R.attr__href)===null||N===void 0?void 0:N.slice(0,2048),attr_class:ZB(R),attr_id:R.attr__id,nth_child:R.nth_child,nth_of_type:R.nth_of_type,attributes:{}};return af(R).filter(([T])=>T.indexOf("attr__")===0).forEach(([T,I])=>k.attributes[T]=I),k})}(S)):"")},!((l=p[0])===null||l===void 0)&&l.$el_text?{$el_text:(c=p[0])===null||c===void 0?void 0:c.$el_text}:{},v&&t.type==="click"?{$external_click_url:v}:{},g),target:e};var S,_}var qU=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!El(e))return!0;const n=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:Ag,r=new Set;let s=e;for(;s;){if(r.size>=1e3||r.has(s))return!0;r.add(s);const i=s,o=Ql(i);if(Pe(o,"ph-no-capture")||Pe(o,"ph-sensitive")||sd(i)||n.some(c=>ix(i,c)))return!0;const l=s.parentNode;s=gb(l)?l.host:l&&Os(l)?l:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const r=Ru(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&r&&Os(r)&&(this.vo={target:r,excluded:this.po(r),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId}))}const n=this.vo;n&&(e.pointerId!==n.id||Math.abs(e.clientX-n.x)>5||Math.abs(e.clientY-n.y)>5?this.do():e.type==="pointerup"&&(n.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;const n=this.vo;this.do();const r=Ru(e);if(n!=null&&n.released&&n.target.isConnected&&n.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===n.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-n.x)&&5>=Math.abs(e.clientY-n.y)&&r&&(Nn(r,"html")||Nn(r,"body"))){var s;if(n.excluded)return null;const i=(s=this.mo().css_selector_ignorelist)!==null&&s!==void 0?s:Ag;return[r,ee==null?void 0:ee.documentElement,ee==null?void 0:ee.body].some(o=>{if(!o)return!1;const l=Ql(o);return Pe(l,"ph-no-capture")||Pe(l,"ph-sensitive")||!El(o)||sd(o)||i.some(c=>ix(o,c))})?null:n.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new CI(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,t;return this.mo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Ir.url_ignorelist=(t=this.Ir.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Ir}Ro(){if(!this.isBrowserSupported())return void Hg.info("Disabling Automatic Event Collection because this browser is not supported");if(!K||!ee)return;const e=this.Ao=t=>{t=t||(K==null?void 0:K.event);try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);const n=t.type==="click"?this._o(t):void 0;if(Ut(n))return;this.Fo(t,"$autocapture",n)}catch(n){Hg.error("Failed to capture event",n)}};if(pt(K,"blur",e),pt(ee,"submit",e,{capture:!0}),pt(ee,"change",e,{capture:!0}),pt(ee,"click",e,{capture:!0}),xt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{pt(ee,t,e,{capture:!0})}),this.mo().capture_copied_text){const t=this.Oo=n=>
11{n=n||(K==null?void 0:K.event);try{this.Fo(n,zg)}catch(r){Hg.error("Failed to capture clipboard event",r)}};pt(ee,"copy",t,{capture:!0}),pt(ee,"cut",t,{capture:!0}),pt(ee,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(K==null||K.removeEventListener("blur",this.Ao),xt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{ee==null||ee.removeEventListener(e,this.Ao,!0)}),ee==null||ee.removeEventListener("submit",this.Ao,!0),ee==null||ee.removeEventListener("change",this.Ao,!0),ee==null||ee.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(ee==null||ee.removeEventListener("copy",this.Oo,!0),ee==null||ee.removeEventListener("cut",this.Oo,!0),ee==null||ee.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.$o=t.elementsChainAsString);const n=t.autocapture_opt_out;var r;Kn(n)&&((r=this.bo)===null||r===void 0||r.kv.set("$autocapture_disabled_server_side",n),this.So=n),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.Co.set(t,new Set(e)):this.Co.delete(t);const n=new Set;this.Co.forEach(r=>{r.forEach(s=>n.add(s))}),this.Io=n}getElementSelectors(e,t){var n;const r=[];return(n=this.Io)===null||n===void 0||n.forEach(s=>{const i=ee==null?void 0:ee.querySelectorAll(s);i==null||i.forEach(o=>{e!==o&&t!==o||Pe(r,s)||r.push(s)})}),r}get isEnabled(){var e,t;if(this.To)return!1;const n=(e=this.bo)===null||e===void 0?void 0:e.kv.get(uA),r=this.So,s=this.mo();if(!s.remoteRequestsDisabled&&!this.xo)return!1;const i=s.remoteRequestsDisabled&&!this.xo;if(Ut(r)&&!Kn(n)&&!i)return!1;const o=(t=this.So)!==null&&t!==void 0?t:!!n;return!!s.enabled&&!o}Fo(e,t="$autocapture",n){if(!this.isEnabled)return void this.do();let r=n||Ru(e);LA(r)&&(r=r.parentNode||null);const s=this.Mo();var i;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&s.rageclick&&(!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&BA(r,s.rageclick)&&this.Fo(e,"$rageclick",n);const o=t===zg,l=o?U(U({},s),{},{dom_event_allowlist:void 0}):s;if(r&&function(h,f,p,g,v,y){var x;if(!K||xb(h)||p!=null&&p.url_allowlist&&!Rk(p.url_allowlist,y)||p!=null&&p.url_ignorelist&&Rk(p.url_ignorelist,y))return!1;if(p!=null&&p.dom_event_allowlist){const _=p.dom_event_allowlist;if(_&&!_.some(E=>f.type===E))return!1}const{parentIsUsefulElement:b,targetElementList:w}=UA(h,g);if(!function(_,E){const R=E==null?void 0:E.element_allowlist;if(Q(R))return!0;for(const A of _)if(R.some(N=>A.tagName.toLowerCase()===N))return!0;return!1}(w,p)||!ox(w,p==null?void 0:p.css_selector_allowlist)||ox(w,(x=p==null?void 0:p.css_selector_ignorelist)!==null&&x!==void 0?x:Ag))return!1;try{const _=K.getComputedStyle(h);if(_&&_.getPropertyValue("cursor")==="pointer"&&f.type==="click")return!0}catch{}const S=h.tagName.toLowerCase();switch(S){case"html":return!1;case"form":return(v||["submit"]).indexOf(f.type)>=0;case"input":case"select":case"textarea":return(v||["change","click"]).indexOf(f.type)>=0;default:return b?(v||["click"]).indexOf(f.type)>=0:(v||["click"]).indexOf(f.type)>=0&&(yb.indexOf(S)>-1||h.getAttribute("contenteditable")==="true")}}(r,e,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var c;const{props:h,explicitNoCapture:f,target:p}=WU(r,{e,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(f)return!1;const g=this.getElementSelectors(r,p);if(g&&g.length>0&&(h.$element_selectors=g),t===zg){const v=e.type||"clipboard";if(v!=="paste"){var u,d;const y=K==null||(u=K.getSelection())===null||u===void 0?void 0:u.toString(),x=FA(y);if(!x)return!1;h.$selected_content=x,h.$clipboard_text_length=(d=y==null?void 0:y.length)!==null&&d!==void 0?d:0}h.$copy_type=v}
11return(c=this.bo)===null||c===void 0||c.capture(t,h),!0}}isBrowserSupported(){return pn(ee==null?void 0:ee.querySelectorAll)}},GU=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=et(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=n==null?void 0:n.url_allowlist,e.url_ignorelist=n==null?void 0:n.url_ignorelist,e.dom_event_allowlist=n==null?void 0:n.dom_event_allowlist,e.element_allowlist=n==null?void 0:n.element_allowlist,e.css_selector_allowlist=n==null?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=n==null?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=n==null?void 0:n.element_attribute_ignorelist,e.capture_copied_text=n==null?void 0:n.capture_copied_text}};const Uc=Ht("[ExceptionAutocapture]"),dS=()=>{},hS=e=>{var t;if(pn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ad(e,t,n){try{if(!(t in e))return dS;const r={next:e[t]},s=n(function(...i){return r.next.apply(this,i)});return pn(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=s,()=>{if(e[t]===s)return void(e[t]=r.next);let i=e[t],o=hS(i);for(;o;){if(o.next===s)return void(o.next=r.next);i=o.next,o=hS(i)}}}catch{return dS}}const KU=Ht("[TracingHeaders]"),$o=Ht("[Web Vitals]"),fS=9e5,pS=["CLS","FCP","INP","LCP"],YU=["INP","LCP"],QU=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],qg="disabled",mS="lazy_loading",Gs=Ht("[SessionRecording]"),ZU=[db,hb,SA,EA,NA,CA,jA,TA,PA],XU=Ht("[Heatmaps]");function Gg(e){return et(e)&&"clientX"in e&&"clientY"in e&&Gt(e.clientX)&&Gt(e.clientY)}const jh=Ht("[Product Tours]"),Kg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(cb))},JU=["$set_once","$set"],ps=Ht("[SiteApps]"),gS="Error while initializing PostHog app with config id ",jI=(e,t)=>e!=null&&e.then?e.then(t):t(e),Ja="SDK is not enabled or survey functionality is not yet loaded",vS="Disabled. Not loading surveys.";var ez=class{constructor(e,t){this.wo=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=n=>{if(this.To||this.Ir.disableSurveys)return;if(!n.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),mt.warn("Remote config unavailable. Not loading surveys.");const r=n.config.surveys;if(Fe(r))return mt.warn("Flags not loaded yet. Not loading surveys.");this.Dh=Kn(r)?r:r.length>0,mt.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=n=>{this.Ph.slice().forEach(r=>this.Lh(r,n))}}setup(e){if(!this.To)return this.Nh=e,jI(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,n,r,s;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)===null||n===void 0||(r=n.dispose)===null||r===void 0||r.call(n),this._surveyManager=null,this.Eh=[],this.Ph.forEach(i=>{i.active=!1}),this.Ph=[],(s=this.qh)===null||s===void 0||s.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(i=>clearTimeout(i)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var n;(n=this._surveyEventReceiver)===null||n===void 0||n.reset(),localStorage.removeItem("lastSeenSurveyDate");const r=[];for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);(i!=null&&i.startsWith("seenSurvey_")||i!=null&&i.startsWith("inProgressSurvey_"))&&r.push(i)}r.forEach(s=>localStorage.removeItem(s))}catch{}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void mt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void mt.info(vS);if(e.cookielessMode&&this.wo.isOptedOut())return void mt.info("Not loading surveys in cookieless mode without consent.");const t=this.wo.getExtensions();if(!t)return void this.jh("PostHog Extensions not found.");if(Q(this.Dh)&&!e.advancedEnableSurveys)return;const n=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{const r=t.generateSurveys;if(r)return this.Bh(r,n),void(this.Ih=!1);const s=t.loadExternalDependency;if(!s)return this.jh(fb),void(this.Ih=!1);s(i=>{try{if(this.To)return;const o=this.wo.getExtensions();i||!(o!=null&&o.generateSurveys)?this.jh("Could not load surveys script",i):this.Bh(o.generateSurveys,n)}finally{this.Ih=!1}})}catch(r){throw this.Ih=!1,this.jh("Error initializing surveys",r),r}}Bh(e,t){var n,r;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);const s=(n=(r=this.bo)!==null&&r!==void 0?r:this.Th)===null||n===void 0?void 0:n.kv.get(pu);s&&this.Hh(s),mt.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,t){this.Mh=!0,mt.error(e,t),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const r=(n=this.bo)!==null&&n!==void 0?n:this.Th;if(!r||this.To)return;if(this.Ir.disableSurveys)return mt.info(vS),e([]);const s=r.kv.get(pu);
11if(s&&!t)return e(s,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:l,context:c})=>{this.To||e(l,c)}).catch(l=>mt.error("Error in survey callback",l));const i=this.Vh("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(l=>{try{return this.Gh(r,l)}catch(c){return mt.error("Error processing surveys response",c),this.Gh(r,{statusCode:0,error:c})}},l=>this.Gh(r,{statusCode:0,error:l}));this.Rh=i;const o=()=>{this.Rh===i&&(this.Rh=null)};i.then(l=>{o(),this.To||(this.Oh(l.context),e(l.surveys,l.context))},o).catch(l=>mt.error("Error in survey callback",l))}Vh(e,t){const n=this.bo;return n?n.sendRequest(e,t):new Promise(r=>r({statusCode:0,error:new Error(Ja)}))}Gh(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:Ja}};const n=t.statusCode;if(n!==200||!t.json){const s=`Surveys API could not be loaded, status: ${n}`;return n!==0?mt.error(s):t.error||mt.warn(s),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Ah=null;const r=t.json.surveys||[];return e.kv.set({[pu]:r,[zf]:Date.now()}),this.Hh(r),{surveys:r,context:{isLoaded:!0}}}Hh(e){var t;const n=e.filter(r=>function(s){return!(!s.start_date||s.end_date)}(r)&&(_I(r)||function(s){var i;return!!(!((i=s.conditions)===null||i===void 0||(i=i.actions)===null||i===void 0||(i=i.values)===null||i===void 0)&&i.length)}(r)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(n)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,t;const n=(e=(t=this.bo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(zf);return Gt(n)&&Date.now()-n>3e5}Qh(){return Gt(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,t){var n;const r={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};EI(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oh()}Uh(e){for(const t of this.Eh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){mt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!Fe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);mt.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,n;if(this.To)return()=>{};const r={callback:e,active:!0,revision:0};this.Ph.push(r),this.zh();const s=(t=(n=this.bo)!==null&&n!==void 0?n:this.Th)===null||t===void 0?void 0:t.kv.get(pu);return this.Ir.disableSurveys||!this._surveyManager&&this.Mh&&!this.Ih||!s&&!Fe(this.Ah)&&!this.Rh?this.Lh(r,{isLoaded:!1}):this._surveyManager&&this.Lh(r),()=>{var i;r.active=!1,this.Ph=this.Ph.filter(o=>o!==r),this.Ph.length===0&&((i=this.qh)===null||i===void 0||i.call(this),this.qh=void 0)}}zh(){var e,t,n;this._surveyManager&&this.Ph.length>0&&((e=this.qh)!==null&&e!==void 0||(this.qh=(t=(n=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(n,this.Oh)))}Lh(e,t){if(this.To||!e.active)return;const n=++e.revision,r=s=>{if(!this.To&&e.active&&n===e.revision)try{const i=t??{isLoaded:!0},o=JSON.stringify([s,i]);if(o===e.lastResult)return;e.lastResult=o,e.callback(s,i)}catch(i){mt.error("Error in active matching surveys callback",i)}};try{t&&!t.isLoaded?r([]):this.getActiveMatchingSurveys(r)}catch(s){mt.error("Error in active matching surveys callback",s)}}Jh(e){let t=null;return this.getSurveys(n=>{var r;t=(r=n.find(s=>s.id===e))!==null&&r!==void 0?r:null}),t}Kh(e){if(Fe(this._surveyManager))return{eligible:!1,reason:Ja};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Fe(this._surveyManager))return{eligible:!1,reason:Ja};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Fe(this._surveyManager))return mt.warn("init was not called"),{visible:!1,disabledReason:Ja};const t=this.Xh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Fe(this._surveyManager)?(mt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ja})):new Promise(n=>
11{this.getSurveys(r=>{var s;const i=(s=r.find(o=>o.id===e))!==null&&s!==void 0?s:null;if(i){const o=this.Xh(i);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var r;if(!this.wo.isCapturing())return;if(Fe(this._surveyManager))return void mt.warn("init was not called");const s=typeof e=="string"?this.Jh(e):e;if(!(s!=null&&s.id))return void mt.warn("Survey not found");if(!TU.includes(s.type))return void mt.warn(`Surveys of type ${s.type} cannot be rendered in the app`);const i=ee==null?void 0:ee.querySelector(t);if(i){if(!((r=s.appearance)===null||r===void 0)&&r.surveyPopupDelaySeconds){mt.info(`Rendering survey ${s.id} with delay of ${s.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var l,c;this.Fh.delete(o),!this.To&&this.wo.isCapturing()&&(mt.info(`Rendering survey ${s.id} with delay of ${(l=s.appearance)===null||l===void 0?void 0:l.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(s,i,n),mt.info(`Survey ${s.id} rendered`))},1e3*s.appearance.surveyPopupDelaySeconds);return void this.Fh.add(o)}this._surveyManager.renderSurvey(s,i,n)}else mt.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.wo.isCapturing())return;if(Fe(this._surveyManager))return void mt.warn("init was not called");const r=this.Jh(e);if(!r)return void mt.warn("Survey not found");let s=r;if(!((n=r.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=U(U({},r),{},{appearance:U(U({},r.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==ax.Popover&&t.initialResponses&&mt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const i=this.Kh(r);if(!i.eligible)return void mt.warn("Survey is not eligible to be displayed: ",i.reason)}t.displayType!==ax.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}cancelPendingSurvey(e){Fe(this._surveyManager)?mt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function el(e,t,n){if(Fe(e))return!1;switch(n){case"exact":return e===t;case"contains":{const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var tz=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new Yf,this.nc=(t,n)=>this.sc(t,n)&&this.rc(t,n)&&this.oc(t,n)&&this.ac(t,n),this.sc=(t,n)=>!(n!=null&&n.event)||(t==null?void 0:t.event)===(n==null?void 0:n.event)}init(){var e,t;Q((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.lc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,r)=>{this.on(n,r)}))}dispose(){var e,t;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ec=new Yf}register(e){var t,n;if(!Q((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(r=>{var s;this.Yh.add(r),(s=r.steps)===null||s===void 0||s.forEach(i=>{this.tc.add((i==null?void 0:i.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const r=new Set;this.Yh.forEach(s=>{var i;(i=s.steps)===null||i===void 0||i.forEach(o=>{o!=null&&o.selector&&r.add(o.selector)})}),this._instance.autocapture.setElementSelectors(r,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.tc.has(e)||this.tc.has(t.event))&&this.Yh.forEach(n=>{this.uc(t,n)&&this.ec.emit("actionCaptured",n.name)})}hc(e){this.onAction("actionCaptured",t=>e(t))}uc(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.nc(e,n))return!0;return!1}onAction(e,t){return this.ec.on(e,t)}rc(e,t){if(t!=null&&t.url){var n;const r=e==null||(n=e.properties)===null||n===void 0?void 0:n.$current_url;if(!r||typeof r!="string"||!el(r,t.url,t.url_matching||"contains"))return!1}return!0}oc(e,t){return!!this.cc(e,t)&&!!this.dc(e,t)&&!!this.vc(e,t)}cc(e,t){var n;if(!(t!=null&&t.href))return!0;const r=this.fc(e);if(r.length>0)return r.some(i=>el(i.href,t.href,t.href_matching||"exact"));const s=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!s&&el(function(i){const o=i.match(/(?::|")href="(.*?)"/);return o?o[1]:""}(s),t.href,t.href_matching||"exact")}dc(e,t){var n;if(!(t!=null&&t.text))return!0;const r=this.fc(e);if(r.length>0)return r.some(c=>
11el(c.text,t.text,t.text_matching||"exact")||el(c.$el_text,t.text,t.text_matching||"exact"));const s=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!s&&(i=function(c){const u=[],d=/(?::|")text="(.*?)"/g;let h;for(;!Fe(h=d.exec(c));)u.includes(h[1])||u.push(h[1]);return u}(s),o=t.text,l=t.text_matching||"exact",i.some(c=>el(c,o,l)));var i,o,l}vc(e,t){var n,r;if(!(t!=null&&t.selector))return!0;const s=e==null||(n=e.properties)===null||n===void 0?void 0:n.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;const i=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$elements_chain)||"";if(t.selector_regex&&i)try{return new RegExp(t.selector_regex).test(i)}catch{return!1}return!1}fc(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}ac(e,t){return!(t!=null&&t.properties)||t.properties.length===0||SI(t.properties.reduce((n,r)=>{const s=Ae(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return n[r.key]={values:s,operator:r.operator||"exact"},n},{}),e==null?void 0:e.properties)}},nz=class{constructor(e,t){var n,r;this.gc=[],this._instance=e,this.mc=t,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=(n=this._instance)===null||n===void 0||(r=n.onSessionId)===null||r===void 0?void 0:r.call(n,s=>this.kc(s))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,t){return!!e&&SI(e.propertyFilters,t==null?void 0:t.properties)}Ic(e,t){const n=new Map;return e.forEach(r=>{var s;(s=r.conditions)===null||s===void 0||(s=s[t])===null||s===void 0||(s=s.values)===null||s===void 0||s.forEach(i=>{if(i!=null&&i.name){const o=n.get(i.name)||[];o.push(r.id),n.set(i.name,o)}})}),n}Mc(e,t,n){const r=(n===$c.Activation?this.yc:this.bc).get(e);let s=[];return this.Ec(i=>{s=i.filter(o=>r==null?void 0:r.includes(o.id))}),s.filter(i=>{var o;const l=(o=i.conditions)===null||o===void 0||(o=o[n])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(c=>c.name===e);return this.Tc(l,t)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,t){var n;Q((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.Rc(e,t),this.Ac(e,t))}Ac(e,t){const n=e.filter(i=>{var o;return(o=i.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var r;if(t&&this._c.clear(),n.length===0)return void(t&&((r=this.Fc)===null||r===void 0||r.replace([])));this.Fc||(this.Fc=new tz(this._instance),this.Fc.init(),this.Fc.hc(i=>this.onAction(i)));const s=[];n.forEach(i=>{var o;(o=i.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(l=>{if(s.push(l),l.name){var c;const u=(c=this._c.get(l.name))!==null&&c!==void 0?c:[];u.includes(i.id)||u.push(i.id),this._c.set(l.name,u)}})}),t?this.Fc.replace(s):this.Fc.register(s)}Oc(e,t){t.forEach((n,r)=>{var s;const i=(s=e.get(r))!==null&&s!==void 0?s:[];n.forEach(o=>{i.includes(o)||i.push(o)}),e.set(r,i)})}Rc(e,t){var n,r;const s=e.filter(c=>{var u,d;return((u=c.conditions)===null||u===void 0?void 0:u.events)&&((d=c.conditions)===null||d===void 0||(d=d.events)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),i=e.filter(c=>{var u,d;return((u=c.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((d=c.conditions)===null||d===void 0||(d=d.cancelEvents)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),o=this.Ic(e,$c.Activation),l=this.Ic(e,$c.Cancellation);t?(this.yc=o,this.bc=l):(this.Oc(this.yc,o),this.Oc(this.bc,l)),(s.length!==0||i.length!==0||e.some(c=>{var u;return(u=c.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length}))&&((n=this.lc)!==null&&n!==void 0||(this.lc=(r=this._instance)===null||r===void 0?void 0:r._addCaptureHook((c,u)=>{this.onEvent(c,u)})))}onEvent(e,t){var n,r;const s=this.Dc(),i=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$survey_id)||(t==null||(r=t.properties)===null||r===void 0?void 0:r.$product_tour_id);if(i&&this.getActivatedIds().includes(i)){const l=this.Lc(e,i,t);if(l==="consume")return s.info("event consumed activated item, remov
11ing it",{event:e,itemId:i}),void this.Nc([i]);if(l==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:i}),this.qc(i),void this.jc([i])}if(this.bc.has(e)){const l=this.Mc(e,t,$c.Cancellation);l.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map(c=>c.id)}),this.Nc(l.map(c=>c.id)),l.forEach(c=>this.Bc(c.id)))}if(!this.yc.has(e))return;s.info("event name matched",{event:e,eventPayload:t,items:this.yc.get(e)});const o=this.Mc(e,t,$c.Activation);this.Hc(o.map(l=>l.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(e){var t,n;if(e.length===0)return;const r=!!(!((t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0)&&n.call(t)),s=[];for(const i of e)r&&this.Sc(i)?this.qc(i)&&this.zc(i):s.push(i);s.length>0&&(this.gc=[...new Set([...this.gc,...s])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(n=>n!==e);const t=this.Wc();return!t.includes(e)&&(this.Vc([...t,e]),this.Gc(),!0)}Nc(e){const t=new Set(e);this.gc=this.gc.filter(s=>!t.has(s));const n=this.Zc(),r=n.filter(s=>!t.has(s));r.length!==n.length&&(this.Vc(r),r.length===0&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;(e=this.mc)===null||e===void 0||e.call(this)}catch(t){this.Dc().error("Error while handling activated items change",t)}}Jc(){var e;const t=this.xc();if(!t)return{};const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return n&&typeof n=="object"?n:{}}zc(e){if(!this.xc())return;const t=this.Jc();this.Cc(U(U({},t),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;const t=this.Jc(),n={};let r=!1;for(const[s,i]of Object.entries(t))e.includes(s)?r=!0:n[s]=i;r&&(sr(n)?this.$c():this.Cc(n))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;const t=this.Jc()[e];return Gt(t)?t:void 0}Zc(){var e;const t=this.Xc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Wc(){var e,t,n;const r=this.Zc();if(r.length===0)return[];const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Yc()],i=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return i&&s===i?r:[]}Gc(){var e,t;const n=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);n&&this.td(n)}Qc(){this.ed()}kc(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Yc()];if(n&&n!==e){const r=this.Zc(),s=this.Jc();r.length>0&&(this.Vc([]),r.filter(i=>Gt(s[i])).forEach(i=>this.Bc(i))),this.Qc(),this.Kc(),r.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,t,n;(e=this.wc)===null||e===void 0||e.call(this),this.wc=void 0,(t=this.lc)===null||t===void 0||t.call(this),this.lc=void 0,(n=this.Fc)===null||n===void 0||n.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},rz=class extends nz{constructor(e,t){super(e,t)}Xc(){return gA}Yc(){return vA}xc(){return yA}Cc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}$c(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}Sc(e){var t;let n;this.Ec(s=>{n=s.find(i=>i.id===e)});const r=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return Gt(r)&&r>0}rd(){return _r.SHOWN}Ec(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Bc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Dc(){return mt}Vc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}td(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}ed(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,t,n){var r;if(e===_r.SENT&&(n==null||(r=n.properties)===null||r===void 0?void 0:r.$survey_completed)===!1)return"ignore";let s;return this.Ec(i=>{s=i.find(o=>o.id===t)}),!s||function(i){var o;return _I(i)&&!!(!((o=i.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||i.schedule==="always"}(s)?e===_r.SHOWN?"consume":"ignore":e===_r.SHOWN?"persist":e===_r.DISMISSED||e===_r.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
11getEventToSurveys(){return this.getEventToItemsMap()}},sz=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const n of e){const r=this._instance.get_property(n);Q(r)||(t[n]=r)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},iz=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Ce==null?void 0:Ce.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?r=>t(this._instance,r):void 0,loadExternalDependency:n?r=>n(this._instance,"surveys",r):void 0}}createEventReceiver(e){return new rz(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(i=>{i!=="$pageview"&&i!==_r.SHOWN&&i!==_r.DISMISSED&&i!==_r.SENT||e()}),n=()=>e();pt(K,"PHSurveyShown",n);let r=!1;const s=this._instance.onFeatureFlags(()=>{r&&e()});return r=!0,()=>{r=!1,t(),s(),K==null||K.removeEventListener("PHSurveyShown",n)}}};const oz=K!=null&&K.location?qf(K.location.hash,"__posthog")||qf(location.hash,"state"):null,yS="_postHogToolbarParams",xS=Ht("[Toolbar]"),bS=Ht("[FeatureFlags]");var az=class{constructor(e,t=!1){this.od=!1,this.update(e,t)}update(e,t){this.ad=((n,r)=>{var s,i,o,l,c,u,d,h;return{bootstrap:{featureFlags:(s=(i=n.bootstrap)===null||i===void 0?void 0:i.featureFlags)!==null&&s!==void 0?s:void 0,featureFlagPayloads:(o=(l=n.bootstrap)===null||l===void 0?void 0:l.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:r,featureFlagsDisabled:!!n.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!n.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!n.advanced_feature_flags_dedup_per_session,cacheTtlMs:n.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=n.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Q(n.remote_config_refresh_interval_ms),requestTimeoutMs:n.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(u=n.feature_flag_request_max_retries)!==null&&u!==void 0?u:1),compression:n.disable_compression?void 0:"best-available",evaluationContexts:(d=(h=n.evaluation_contexts)!==null&&h!==void 0?h:n.evaluation_environments)!==null&&d!==void 0?d:[],flagKeys:Ae(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.od||(bS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),Q(e.flag_keys)||Ae(e.flag_keys)||bS.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}};const wS=Ht("[FeatureFlags]"),Vo=Ht("[FeatureFlags]",{debugEnabled:!0}),Yg=`" failed. Feature flags didn't load in time.`,lz=[502,504],_S=["click","keydown","wheel","touchstart","pointerdown"],kS="connection_error",SS=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},ES=e=>{const t={};for(const[n,r]of af(e||{}))r&&(t[n]=r);return t},NS=e=>xc(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Hr=Ht("[Error tracking]"),fx="webkit-masked-url:",cz=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],uz=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",fx],dz=["__firefox__","__gCrWeb"],CS="Refusing to render web experiment since the viewer is a likely bot",hz={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Qf(t,e),not_regex:(e,t)=>!Qf(t,e),exact:(e,t)=>
11t===e,is_not:(e,t)=>t!==e},Mr=Ht("[Conversations]"),Bo="Conversations not available yet.";function jS(e,t){var n,r,s,i,o,l,c;const u=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,d=(r=e==null?void 0:e.maxBufferSize)!==null&&r!==void 0?r:100,h=t!=null&&t.consoleCapture?void 0:(s=e==null?void 0:e.maxLogsPerInterval)!==null&&s!==void 0?s:1e3,f=Q(h)?Math.max(d,2048):Math.max(d,h),p=U(U({},function(){let g="",v="";try{const y=gn==null?void 0:gn.userAgent;y&&([g,v]=BP(y))}catch{}return function(y,x){const b=function(w){if(w)return{}.hasOwnProperty.call(wk,w)?wk[w]:w}(y);return U(U({},b?{"os.name":b}:{}),x?{"os.version":x}:{})}(g,v)}()),e==null?void 0:e.resourceAttributes);return{serviceName:(i=(o=p==null?void 0:p["service.name"])!==null&&o!==void 0?o:e==null?void 0:e.serviceName)!==null&&i!==void 0?i:t==null?void 0:t.serviceNameDefault,serviceVersion:(l=p==null?void 0:p["service.version"])!==null&&l!==void 0?l:e==null?void 0:e.serviceVersion,environment:(c=p==null?void 0:p["deployment.environment"])!==null&&c!==void 0?c:e==null?void 0:e.environment,resourceAttributes:p,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const fz=["debug","log","warn","error","info"],pz=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},TS="console",TI="__posthogHandledLogsRequestError",Qg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[TI]=!0,n},PS=e=>!!e&&typeof e=="object"&&e[TI]===!0,Zf=Ht("[NetworkMetrics]"),_b=()=>{var e;return!(K==null||(e=K.performance)===null||e===void 0)&&e.now?K.performance.now():Date.now()},mz={"http:":80,"https:":443},gz=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),PI=(e,t)=>{var n;const r=String(t);return{method:String(e).toUpperCase(),url:((n=yi(r))===null||n===void 0?void 0:n.href)||r}},px=(e,t,n,r,s,i,o=!1)=>{try{var l,c;const u=s();if(!u)return;const d=n||void 0,h=_b()-r,f=yi(t.url);if(f&&f.protocol!=="http:"&&f.protocol!=="https:")return;const p={url:(f==null?void 0:f.href)||t.url,method:t.method},g=pn(u.name)?u.name(p):Je(u.name)?u.name:"http.client.request.duration";if(!g)return;const v=o&&!d?void 0:((x,b)=>x?400>x?void 0:String(x):(b==null?void 0:b.name)||"_OTHER")(d,i),y=U(U(U(U(U({},(x=>{const b=gz.has(x)?x:"_OTHER";return U({"http.request.method":b},b==="_OTHER"&&x!==b?{"http.request.method_original":x}:{})})(p.method)),f?(x=>{return{"server.address":x.hostname.startsWith("[")&&x.hostname.endsWith("]")?x.hostname.slice(1,-1):x.hostname,"server.port":Number(x.port)||mz[x.protocol],"url.scheme":x.protocol.slice(0,-1),"url.template":(b=x.pathname,b.split("/").map(w=>(S=>/^\d+$/.test(S)||S.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(S))(w)?":id":w).join("/"))};var b})(f):{}),d?{"http.response.status_code":d}:{}),v?{"error.type":v}:{}),(l=u.attributes)===null||l===void 0?void 0:l.call(u,p,{status:d,durationMs:h}));(c=e.metrics)===null||c===void 0||c.histogram(g,h,{unit:"ms",attributes:y})}catch(u){Zf.error("Failed to record network metric",u)}},AI=()=>{},vz=(e,t)=>pn(K==null?void 0:K.fetch)?ad(K,"fetch",n=>function(...r){const s=_b(),i=n.apply(this,r);if(!t())return i;try{var o,l,c;const[u,d]=r,h=PI((o=(l=d==null?void 0:d.method)!==null&&l!==void 0?l:u==null?void 0:u.method)!==null&&o!==void 0?o:"GET",(c=u==null?void 0:u.url)!==null&&c!==void 0?c:u);return i.then(f=>(px(e,h,f==null?void 0:f.status,s,t,void 0,!0),f),f=>{throw px(e,h,void 0,s,t,f),f})}catch(u){return Zf.error("Failed to observe fetch",u),i}}):AI,yz=(e,t)=>{var n;const r=K==null||(n=K.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!r)return AI;const s=new WeakMap,i=ad(r,"open",l=>function(...c){try{cI.has(this)||s.set(this,PI(c[0],c[1]))}catch(u){Zf.error("Failed to observe XHR open",u)}return l.apply(this,c)}),o=ad(r,"send",l=>function(...c){let u;try{const d=s.get(this);if(d&&t()){const h=_b();u=()=>{this.removeEventListener("loadend",u),px(e,d,this.status,h,t)},pt(this,"loadend",u)}}catch(d){Zf.error("Failed to observe XHR send",d)}try{return l.apply(this,c)}catch(d){throw u&&this.removeEventListener("loadend",u),d}});return()=>{i(),o()}},tm={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=wS,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const t=this.kd();this._d=0,t&&this.reloadFeatureFlags()},this.Sd=()=>{var t,n;const r=this.xd,s=(t=this.Cd)!==null&&t!==void 0?t:r;Q(r)||Q(s)||this.Ir.remoteRequestsDisabled||!ee||ee.visibilityState==="hidden"||Date.now()-((n=this.$d)!==null&&n!==void 0?n:0)<s||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?r:Math.min(2*s,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{(ee==null?void 0:ee.visibilityState)==="visible"&&this.Md()},"get"in e?this.wo=e:(this._instance=e,this.Ed=new az(e.config,e.il()),this.wo=this.Ed)}updateConfig(e,t){var n;(n=this.Ed)===null||n===void 0||n.update(e,t),this.bo&&this.Pd()}setup(e){return this.Nh=e,this.A=e.logger.createLogger("[FeatureFlags]"),jI(e.kv.initialize(),()=>{this.Nh===e&&(this.Nh=void 0,this.bo=e,this.Rd(e))})}Rd(e){var t;if(this.bo===e)return K&&pt(K,"online",this.rn),this.Pd(),this.Ad=e.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){const e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&ee&&!Q(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.Cd=t),t!==this.xd&&(this.qd(),Q(t)||(this.xd=t,this.Cd=t,this.Td(),ee!=null&&ee.addEventListener&&(pt(ee,nd,this.sn),ml(_S,n=>{pt(ee,n,this.Id,{capture:!0})}
11))))}Td(){Q(this.xd)||(Q(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var e;Q(this.jd)||(clearInterval(this.jd),this.jd=void 0,ee==null||(e=ee.removeEventListener)===null||e===void 0||e.call(ee,"visibilitychange",this.sn),ml(_S,t=>{var n;ee==null||(n=ee.removeEventListener)===null||n===void 0||n.call(ee,t,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var e,t;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),(e=this.Ad)===null||e===void 0||e.dispose(),this.Ad=void 0,(t=this.Od)===null||t===void 0||t.call(this),this.Od=void 0,this.dd=[],K==null||K.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(e){var t;return this.Ud&&e in this.Ud?this.Ud[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var e;return!Q((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Gd(e,t,n){var r;if(!(!((r=this._instance)===null||r===void 0)&&r.persistence)||!e.$enabled_feature_flags)return;const s=this.zd("$enabled_feature_flags")||{},i=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,l=t.flags?Object.entries(t.flags).filter(([,x])=>!(x!=null&&x.failed)).map(([x])=>x):[],c=!!t.errorsWhileComputingFlags&&!!t.flags,u=c?l:n&&!Ae(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(i)])),d=this.zd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},f=c||n?u:Array.from(new Set([...Object.keys(d),...Object.keys(h)])),p=!c&&!n,g=!!p||u,v=!!p||f,y={[ci]:g,[Zr]:g,[so]:v};e.$feature_flag_details&&(y[pa]=g);for(const x of[ma,ho,Au])Q(e[x])||(y[x]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(y)}Lt(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Vd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Ld(){const e={};for(const r of[ci,so,ma,gs]){const s=this.zd(r);Q(s)||(e[r]=s)}this.ud=e;const t=U({},e),n=this.zd(Zr);if(n)for(const[r,s]of Object.entries(n))t[`$feature/${r}`]=s;this.hd=t}Fd(){const e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;const t=this.zd(ho);return typeof t!="number"||Date.now()-t>e}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){const e=this.Ir.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}Jd(){const e=this.Ir.flagKeys;if(!Q(e))return e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t;const n=this.Ir,r=(e=(t=n.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var s,i;const o=(s=(i=n.bootstrap)===null||i===void 0?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},l=Object.keys(r).filter(u=>!Q(r[u])).reduce((u,d)=>(u[d]=r[d],u),{}),c=Object.keys(o).filter(u=>l[u]).reduce((u,d)=>(u[d]=o[d],u),{});return this.Kd({featureFlags:l,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,t,n){var r,s;const i=n!=null&&n.merge&&(r=this.zd("$enabled_feature_flags"))!==null&&r!==void 0?r:{},o=n!=null&&n.merge&&(s=this.zd("$feature_flag_payloads"))!==null&&s!==void 0?s:{},l=U(U({},i),e),c=U(U({},o),t),u={};for(const[d,h]of Object.entries(l))u[d]={key:d,enabled:gk(h),variant:vk(h),reason:void 0,metadata:Q(c==null?void 0:c[d])?void 0:{id:0,version:void 0,description:void 0,payload:c[d]}};this.Kd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.zd(pa),t=this.zd(gs),n=this.zd(qo);if(!n&&!t)return e||{};const r=It({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(const l of s){var i;const c=r[l],u=t==null?void 0:t[l],d=Q(u)?(i=c==null?void 0:c.enabled)!==null&&i!==void 0&&i:!!u,h=Q(u)?c==null?void 0:c.variant:typeof u=="string"?u:void 0,f=n==null?void 0:n[l],p=U(U({},c),{},{enabled:d,variant:d?h??(c==null?void 0:c.variant):void 0});var o;d!==(c==null?void 0:c.enabled)&&(p.original_enabled=c==null?void 0:c.enabled),h!==(c==null?void 0:c.variant)&&(p.original_variant=c==null?void 0:c.variant),f&&(p.metadata=U(U({},c==null?void 0:c.metadata),{},{payload:f,original_payload:c==null||(o=c.metadata)===null||o===void 0?void 0:o.payload})),r[l]=p}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ld=!0),r}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const r=e[n];return{key:n,enabled:gk(r),variant:vk(r),payload:mk(t[n])}})}getFlagVariants(){const e=this.zd(Zr),t=this.zd(gs);if(!t)return e||{};
11const n=It({},e||{}),r=Object.keys(t);for(let s=0;r.length>s;s++)n[r[s]]=t[r[s]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){const e=this.zd(so),t=this.zd(qo);if(!t)return e||{};const n=It({},e||{}),r=Object.keys(t);for(let s=0;r.length>s;s++)n[r[s]]=t[r[s]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.Lt(ao)}Yd(e){this.Hd();const t=this.bo;if(!t||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!0);const n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:U(U(U({},t.initialPersonProperties),this.zd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.zd(oo),timezone:tI()};Q(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ir.featureFlagsDisabled)&&(n.disable_flags=!0);const r=this.Qd();r.length&&(n.evaluation_contexts=r);const s=this.Jd();Q(s)||(n.flag_keys=s);const i=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(i?"&only_evaluate_survey_feature_flags=true":""),l=this.pd;this.fd=!0;const c=()=>{this.md&&(this.md=!1,this.Yd())},u=g=>{var v,y;const x=(v=g.json)!==null&&v!==void 0?v:{},b=g.statusCode!==200;if(this.fd=!1,l!==this.pd)return void c();if(this.tv(g.statusCode),b||this.md||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.md)return;this.yd=!b;const w=[];g.error?w.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?kS:"unknown_error"):g.statusCode!==200&&w.push(`api_error_${g.statusCode}`),x.errorsWhileComputingFlags&&w.push("errors_while_computing_flags");const S=!!(!((y=x.quotaLimited)===null||y===void 0)&&y.includes("feature_flags"));S&&w.push("quota_limited"),this.$t({[td]:w}),S?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Kd(x,b,{partialResponse:i}),c()},d=g=>{this.fd=!1,l===this.pd&&(this.$t({[td]:[kS]}),this.A.error("Feature flag request failed",g),this.Wd()&&this.Nd(!0)),c()};let h=this.Ir.requestMaxRetries;const f=()=>h>0&&l===this.pd,p=()=>{if(l!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void c();try{t.sendRequest(o,{target:"flags",method:"POST",body:n,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(g=>{if((v=>lz.includes(v.statusCode)||(y=>y.statusCode===0&&y.error instanceof Error&&y.error.name==="AbortError")(v))(g)&&f())return h--,void setTimeout(p,500);u(g)}).catch(d)}catch(g){d(g)}};p()}kd(){return qA(this._d,3)}tv(e){this._d=GA(e,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var n;if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+Yg);if(this.Zd())return;const r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+Yg);if(this.Zd())return;const n=this.getFlagVariants(),r=e in n,s=n[e],i=this.getFlagPayloads()[e],o=String(s),l=this.zd("$feature_flag_request_id")||void 0,c=this.zd("$feature_flag_evaluated_at")||void 0;let u,d=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var h;const N=(h=this.bo)===null||h===void 0?void 0:h.session.sessionId,k=this.zd(mu);N&&N!==k&&(d={},u=N)}if(t.send_event||!("send_event"in t))if(e in d&&d[e].includes(o))u&&this.$t({[ao]:d,[mu]:u});else{var f,p,g,v,y,x,b,w,S,_,E,R;Ae(d[e])?d[e].push(o):d[e]=[o],this.$t(U({[ao]:d},u?{[mu]:u}:{}));const N=this.getFeatureFlagDetails(e),k=[...(f=this.zd("$feature_flag_errors"))!==null&&f!==void 0?f:[]];Q(s)&&k.push("flag_missing");const T={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:i??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(p=(g=this.Ir.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(v=(y=this.Ir.bootstrap)===null||y===void 0||(y=y.featureFlagPayloads)===null||y===void 0?void 0:y[e])!==null&&v!==void 0?v:null,$used_bootstrap_value:!this.yd};Q(N==null||(x=N.metadata)===null||x===void 0?void 0:x.has_experiment)||(T.$feature_flag_has_experiment=N.metadata.has_experiment),Q(N==null||(b=N.metadata)===null||b===void 0?void 0:b.version)||(T.$feature_flag_version=N.metadata.version);const I=(w=N==null||(S=N.reason)===null||S===void 0?void 0:S.description)!==null&&w!==void 0?w:N==null||(_=N.reason)===null||_===void 0?void 0:_.code;var A;I&&(T.$feature_flag_reason=I),!(N==null||(E=N.metadata)===null||E===void 0)&&E.id&&(T.$feature_flag_id=N.metadata.id),Q(N==null?void 0:N.original_variant)&&Q(N==null?void 0:N.original_enabled)||(T.$feature_flag_original_response=Q(N.original_variant)?N.original_enabled:N.original_variant),!(N==null||(R=N.metadata)===null||R===void 0)&&R.original_payload&&(T.$feature_flag_original_payload=N==null||(A=N.metadata)===null||A===void 0?void 0:A.original_payload),k.length&&(T.$feature_flag_error=k.join(",")),this.ev(T)}else u&&this.$t({[ao]:d,[mu]:u});return r?{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:mk(i)}:void 0}ev(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.iv(e,t)}iv(e,t){var n=this;return Rt(function*(){const r=n.bo;if(!r)return;const s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},i=n.Qd();i.length&&(s.evaluation_contexts=i);const o=n.Jd();let l;Q(o)||(s.flag_keys=o);try{var c;const u=(c=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:n.Ir.compression,sentAt:"body",timeoutMs:n.Ir.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;l=(u==null?void 0:u[e])||void 0}catch(u){return void n.A.error("Remote config feature flag request failed",u)}try{t(l)}catch(u){n.A.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+Yg),t.defaultValue;const n=this.getFeatureFlag(e,t);return Q(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}
11receivedFeatureFlags(e,t,n){this.Kd(e,t,n)}Kd(e,t,n){if(!this.bo)return;this.vd=!0;const r=((s,i={},o={},l={},c,u=wS)=>{const d=((w,S)=>{const _=w.flags;if(_){const E=Object.fromEntries(Object.keys(_).map(A=>{var N;return[A,(N=_[A].variant)!==null&&N!==void 0?N:_[A].enabled]})),R=Object.fromEntries(Object.keys(_).filter(A=>_[A].enabled).filter(A=>{var N;return!Q((N=_[A].metadata)===null||N===void 0?void 0:N.payload)}).map(A=>{var N;return[A,(N=_[A].metadata)===null||N===void 0?void 0:N.payload]}));return U(U({},w),{},{featureFlags:E,featureFlagPayloads:R})}return w.featureFlags&&S.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(s,u),h=d.flags,f=d.featureFlags,p=d.featureFlagPayloads;if(!f)return;const g=s.requestId,v=s.evaluatedAt;if(Ae(f)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const w={};if(f)for(let S=0;f.length>S;S++)w[f[S]]=!0;return{[ci]:f,[Zr]:w,[Au]:!1}}let y=f,x=p,b=h;if(c!=null&&c.partialResponse){const w=Object.keys(y),S=x||{};y=U(U({},i),y),x=U(U({}
11,o),S),w.forEach(_=>{_ in S||x==null||delete x[_]}),b=U(U({},l),b)}else if(s.errorsWhileComputingFlags)if(h){const w=new Set(Object.keys(h).filter(_=>{var E;return!(!((E=h[_])===null||E===void 0)&&E.failed)}));y=U(U({},i),Object.fromEntries(Object.entries(y).filter(([_])=>w.has(_))));const S=Object.fromEntries(Object.entries(x||{}).filter(([_])=>w.has(_)));x=U(U({},o),S),w.forEach(_=>{_ in S||x==null||delete x[_]}),b=U(U({},l),Object.fromEntries(Object.entries(b||{}).filter(([_])=>w.has(_))))}else y=U(U({},i),y),x=U(U({},o),x),b=U(U({},l),b);return U(U({[ci]:Object.keys(ES(y)),[Zr]:y||{},[so]:x||{},[pa]:b||{},[Au]:s.minimalFlagCalledEvents===!0},g?{[ma]:g}:{}),v?{[ho]:v}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(r)if((n==null?void 0:n.persist)===!1){const s=!Q(this.bo.kv.get(Zr));this.Ud=r,s||this.$t(r)}else this.Dd(),this.Gd(r,e,!!(n!=null&&n.partialResponse)),this.$t(r);else t&&this.Wd();t||(this.bd=!1),this.Nd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.nv(e)}nv(e){if(this.bo){if(e===!1)return this.Lt([gs,qo]),this.Nd(),void Vo.info("All overrides cleared");if(Ae(e))return this.$t({[gs]:SS(e)}),this.Nd(),void Vo.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const n=e;this.ld=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const r={},s=n.flags,i=n.payloads;return s&&(r[gs]=Ae(s)?SS(s):s),i&&(r[qo]=i),Object.keys(r).length&&this.$t(r),s===!1&&i===!1?this.Lt([gs,qo]):s===!1?this.Lt(gs):i===!1&&this.Lt(qo),this.Nd(),s===!1?Vo.info("Flag overrides cleared"):s&&Vo.info("Flag overrides set",{flags:s}),void(i===!1?Vo.info("Payload overrides cleared"):i&&Vo.info("Payload overrides set",{payloads:i}))}if(e&&typeof e=="object")return this.$t({[gs]:e}),this.Nd(),void Vo.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){const{flags:t,flagVariants:n}=this.sv();try{e(t,n)}catch(r){this.A.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;const s=(this.zd("$early_access_features")||[]).find(u=>u.flagKey===e),i={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:i};s&&(o.$early_access_feature_name=s.name),n&&(o.$feature_enrollment_stage=n);const l=U(U({},this.getFlagVariants()),{},{[e]:t});(r=this._instance)===null||r===void 0||(r=r.persistence)===null||r===void 0||r.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(i)}),this.$t({[ci]:Object.keys(ES(l)),[Zr]:l,[io]:U(U({},this.zd("$stored_person_properties")||{}),i)}),this.Nd();try{var c;(c=this.bo)===null||c===void 0||c.capture("$feature_enrollment_update",o)}catch(u){this.A.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,n){const r=this.zd(Jy);!r||t?this.rv(e,n):e(r)}rv(e,t){var n=this;return Rt(function*(){const r=n.bo;if(!r)return;const s=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let i;try{const o=yield r.sendRequest(`/api/early_access_features/?token=${r.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;i=o.json.earlyAccessFeatures,n.$t({[Jy]:i})}catch(o){return void n.A.error("Early access feature request failed",o)}try{e(i)}catch(o){n.A.error("Early access feature callback failed",o)}})()}sv(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Nd(e){this.Ld();const{flags:t,flagVariants:n}=this.sv();this.featureFlagEventHandlers.forEach(r=>{try{r(t,n,{errorsLoading:e})}catch(s){this.A.error("Error while running feature flags callback",s)}})}setPersonPropertiesForFlags(e,t=!0){this.ov(e,t)}ov(e,t=!0){const n=this.zd("$stored_person_properties")||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),s=e==null?void 0:e.$set_once,i={};if(s)for(const o in s)({}).hasOwnProperty.call(s,o)&&(o in n||(i[o]=s[o]));this.$t({[io]:U(U(U({},n),i),r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=U({},this.zd("$stored_person_properties")||{});e.forEach(r=>{delete n[r]}),this.$t({[io]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(io),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.zd("$stored_group_properties")||{},r=U({},n);for(const s of Object.keys(e))r[s]=U(U({},n[s]),e[s]);this.$t({[oo]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.zd("$stored_group_properties")||{};this.$t({[oo]:U(U({},t),{},{[e]:{}})})}else this.Lt(oo)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},xz={sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.av)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.lv==="awaiting_config"||this.lv==="missing_config"?this.lv:(e=(t=this.av)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.lv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.lv=qg,this.uv=void 0,this.hv=!1,this.Je=(()=>{var t,n;if(!(ee!=null&&ee.visibilityState)||ee.visibilityState==="visible")return!0;const r=K==null||(t=K.performance)===null||t===void 0||(n=t.getEntriesByType)===null||n===void 0?void 0:n.call(t,"visibility-state");return!(r!=null&&r.length)||r.some(s=>s.name==="visible")})(),this.sn=()=>{var t,n;(ee==null?void 0:ee.visibilityState)==="visible"&&(this.Je=!0,(t=this.av)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw Gs.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');ee!=null&&ee.addEventListener&&pt(ee,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.hv=!0,ee==null||(t=ee.removeEventListener)===null||t===void 0||t.call(ee,"visibilitychange",this.sn),e?this.dv(!0):this.stopRecording()}get vv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),n=!this.Ir.disable_session_recording,r=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return K&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(this.hv||this.vv&&(!((t=this.av)===null||t===void 0)&&t.isStarted))return;const n=!Q(Object.assign)&&!Q(Array.from);this.vv&&n?(this.fv(e),Gs.info("starting")):(this.lv=qg,this.stopRecording())}fv(e){var t,n;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=mS),(Ce==null||(t=Ce.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((n=Ce.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.pv(e);else{var r,s;const i=this._instance.sessionManager;(r=Ce.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,this.gv,o=>{if(!this.hv&&this.vv&&this._instance.sessionManager===i)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Gs.error("could not load recorder",o)):void this.pv(e);this.lv="disabled"})}}stopRecording(){var e,t;(e=this.uv)===null||e===void 0||e.call(this),this.uv=void 0,(t=this.av)===null||t===void 0||t.stop()}dv(e=!1){var t,n;(t=this.uv)===null||t===void 0||t.call(this),this.uv=void 0,(n=this.av)===null||n===void 0||n.discard({discardProducerEvents:e})}mv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}yv(e,t){if(Fe(e))return null;const n=Gt(e)?e:parseFloat(e);return typeof(r=n)!="number"||!Number.isFinite(r)||0>r||r>1?(Gs.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var r}bv(e){if(this.Il){var t,n;const r=this.Il,s=()=>{var i;const o=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.yv((i=this.Ir.session_recording)===null||i===void 0?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.yv(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=l??c;Fe(u)&&this.mv();const d=o==null?void 0:o.minimumDurationMilliseconds;r.register({[Pu]:U(U({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:U({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Q(d)?null:d,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};s(),(t=this.uv)===null||t===void 0||t.call(this),this.uv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(s)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.bv(t),void this.dv()):(this.bv(t),void this.startIfEnabledOrStop()):(this.lv==="awaiting_config"&&(this.lv="missing_config",this._instance.register_for_session({[hb]:!0}),Gs.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.av)===null||n===void 0)&&n.log?this.av.log(e,t):Gs.warn("log called before recorder was ready")}get gv(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Pu);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}_v(){const e=this._instance.get_property(Pu);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return Gs.warn("persisted remote config for session recording is invali
11d and will be ignored",n),!1}return!Fe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}pv(e){var t,n,r;if(!this.hv&&this.vv&&this._instance.sessionManager){if(!(!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Gs.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[db]:!0});var s;if(this.av||(this.av=(s=Ce.__PosthogExtensions__)===null||s===void 0?void 0:s.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v())return this.lv==="missing_config"||this.lv==="awaiting_config"?void 0:(this.lv="awaiting_config",Gs.info("persisted remote config is stale, requesting fresh config before starting"),void new rI(this._instance).load());this.lv=mS,(n=(r=this.av).setDocumentWasEverVisible)===null||n===void 0||n.call(r,this.Je),this.av.start(e)}else this.lv=qg}onRRwebEmit(e){var t,n;(t=this.av)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.av)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.av)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.av||(n=this.Il)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.av)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const r of ZU){var n;const s=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(r);Q(s)||(t[r]=s)}return U(U({},t),((e=this.av)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var n;return!!(!((n=this.av)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.av)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},bz={autocapture:class extends qU{constructor(e){super(new GU(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.wv=!1,this._instance=e,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Cv();return!!(e.path||e.search||this.$v(e))}startIfEnabled(){this.isEnabled&&(ue.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,ue.info("History API monitoring stopped")}monitorHistoryChanges(){K&&K.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(e){var t;if(!K||!((t=K.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;ad(K.history,e,r=>function(s,i,o){var l;n.Rv(o)&&n.Av(),r.call(this,s,i,o),n.Fv(e,!n.wv&&(K==null||(l=K.event)===null||l===void 0?void 0:l.type)!=="popstate")})}xv(){const e=K==null?void 0:K.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Cv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:et(e)?e:{}}$v(e=this.Cv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Ov(e){const t=this.Cv(),n=this.Sv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.$v(t)&&e.hash!==n.hash))}Fv(e,t=!1){try{t||this.Av();const n=this.xv();if(!n)return;if(this.Ov(n)){const r=()=>this._instance.capture(pb,{navigation_type:e});t?(this.Dv=r,Promise.resolve().then(()=>this.Av())):r()}this.Sv=n}catch(n){ue.error(`Error capturing ${e} pageview`,n)}}Rv(e){var t,n;return!(Fe(e)||!K)&&((t=yi(String(e)))===null||t===void 0?void 0:t.href)!==((n=K.location)===null||n===void 0?void 0:n.href)}Av(){const e=this.Dv;if(e){this.Dv=void 0,this.wv=!0;try{e()}catch(t){ue.error("Error capturing deferred pageview",t)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const e=()=>{this.Fv("popstate")};pt(K,"popstate",e),this.Tv=()=>{K&&K.removeEventListener("popstate",e)}}Pv(){if(this.Iv)return;const e=()=>{this.Fv("hashchange")};pt(K,"hashchange",e),this.Iv=()=>{K&&K.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=e,this.Lv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Yy]),this.rageclicks=new CI(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return et(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Fe(this.Ir.capture_heatmaps)?Fe(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;XU.info("starting..."),this.qv(),this.sn()}else{var e;clearInterval((e=this.Nv)!==null&&e!==void 0?e:void 0),this.jv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Yy]:n}),this.Lv=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Bv(e){Gg(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv=(ee==null?void 0:ee.visibilityState)==="visible"?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){K&&ee&&(this.Hv=this.yl.bind(this),pt(K,Hf,this.Hv),this.zv=e=>this.Mr(e||(K==null?void 0:K.event)),pt(ee,"click",this.zv,{capture:!0}),this.Uv=e=>this.Wv(e||(K==null?void 0:K.event)),pt(ee,"mousemove",this.Uv,{capture:!0}),this.Vv=new Uk(this.instance,XB,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),pt(ee,nd,this.Gv),this.ko=!0)}jv(){var e;K&&ee&&(this.Hv&&K.removeEventListener(Hf,this.Hv),this.zv&&ee.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&ee.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&ee.removeEventListener(nd,this.Gv),clearTimeout(this.Zv),(e=this.Vv)===null||e===void 0||e.stop(),this.ko=!1)}Qv(e,t){const n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(o,l,c){let u=o;for(;u&&Os(u)&&!Nn(u,"body");){if(u===c)return!1;let p;try{var d,h,f;p=(d=(h=(f=u.ownerDocument)===null||f===void 0?void 0:f.defaultView)!==null&&h!==void 0?h:K)===null||d===void 0?void 0:d.getComputedStyle(u).position}catch{return!1}if(Pe(l,p))return!0;u=$A(u)}return!1}(Ru(e),["fixed","sticky"],s);return{x:e.clientX+(i?0:r),y:e.clientY+(i?0:n),target_fixed:i,type:t}}Mr(e,t="click"){var n;if(Ik(e.target)||!Gg(e))return;const r=this.Qv(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&BA(Ru(e),this.instance.config.rageclick)&&this.Zs(U(U({},r),{},{type:"rageclick"})),this.Zs(r)}Wv(e){!Ik(e.target)&&Gg(e)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(e,"mousemove"))},500))}Zs(e){if(!K)return;const t=this.Ir.disable_capture_url_hashes?po(K.location.href):K.location.href,n=this.Ir.custom_personal_data_properties,r=this.Ir.mask_personal_data_properties?[...Xl,...n||[]]:[],s=id(t,r,od);this.Rt=this.Rt||{},this.Rt[s]||(this.Rt[s]=[]),this.Rt[s].push(e)}yl(){this.Rt&&!sr(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Uk,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",U({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,r)=>U(U({},n),{},{[`$web_vitals_${r.name}_event`]:U({},r),[`$web_vitals_${r.name}_value`]:r.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Xv=n=>{var r;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Fe(n==null?void 0:n.name)||Fe(n==null?void 0:n.value))return void $o.error("Invalid metric received",n);
11const s=typeof n.navigationURL=="string"?n.navigationURL:void 0,i=this.Yv(s);if(Q(i))return;const o=Gt(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${i}`;if(this.tf&&n.value>=this.tf)return void $o.error("Ignoring metric with value >= "+this.tf,n);this.Rt.navigationKey!==o&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),Q(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=i),this.Rt.firstMetricTimestamp=Q(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const l=(r=this._instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0),c=U(U(U({},n),s?{navigationURL:i}:{}),{},{$current_url:i,timestamp:Date.now()});if(delete c.entries,et(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const u={};for(const d of QU){const h=d==="url"&&typeof n.attribution[d]=="string"?this.Yv(n.attribution[d]):n.attribution[d];Q(h)||(u[d]=h)}c.attribution=u}else delete c.attribution;Q(l)||(c.$session_id=l.sessionId,c.$window_id=l.windowId),this.Rt.metrics.push(c),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let n,r,s,i,o=!1;const l=Ce.__PosthogExtensions__,c=l==null?void 0:l.postHogWebVitalsCallbacksByFlavor,u=(c==null?void 0:c[this.if])||(this.if==="web-vitals"&&Q(c)?l==null?void 0:l.postHogWebVitalsCallbacks:void 0);if(!Q(u)){const f=u.withoutAttribution,p=this.attributionMetrics;o=!Q(f),n=p.indexOf("LCP")>-1?u.onLCP:(f==null?void 0:f.onLCP)||u.onLCP,r=p.indexOf("CLS")>-1?u.onCLS:(f==null?void 0:f.onCLS)||u.onCLS,s=p.indexOf("FCP")>-1?u.onFCP:(f==null?void 0:f.onFCP)||u.onFCP,i=p.indexOf("INP")>-1?u.onINP:(f==null?void 0:f.onINP)||u.onINP}if(!(n&&r&&s&&i))return void $o.error("web vitals callbacks not loaded - not starting");const d={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?U(U({},d),{},{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Xv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Xv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&s(this.Xv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&i(this.Xv.bind(this),h),this.ko=!0},this.Lv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Xy]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=et(this.nf)?(e=this.nf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return Fe(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||pS:n}get flushToCaptureTimeoutMs(){return(et(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=et(this.nf)?this.nf.web_vitals_attribution:void 0;return Kn(e)?e?pS:[]:Ae(e)?e:YU}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=et(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get tf(){const e=et(this.nf)&&Gt(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:fS;return e>0&&6e4>=e?fS:e}get isEnabled(){const e=Bt==null?void 0:Bt.protocol;if(e!=="http:"&&e!=="https:")return $o.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=et(this.nf)?this.nf.web_vitals:Kn(this.nf)?this.nf:void 0;return Kn(t)?t:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&($o.info("enabled, starting..."),this.Ho(this.ef))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=et(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=et(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xy]:n}),this._instance.persistence.register({[fA]:r})),this.Lv=n,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(e){var t;const n=Ce.__PosthogExtensions__,r=this.if,s=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;s!=null&&s[r]||r==="web-vitals"&&Q(s)&&(n!=null&&n.postHogWebVitalsCallbacks)?e():n==null||(t=n.loadExternalDependency)===null||t===void 0||t.call(n,this._instance,r,i=>{i?$o.error("failed to load script",i):e()})}
11Yv(e){const t=e||(K==null?void 0:K.location.href);if(!t)return void $o.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?po(t):t,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Xl,...r||[]]:[];return id(n,s,od)}}},wz={exceptionObserver:class{constructor(e){var t;this.ef=()=>{var n;if(!K||!this.isEnabled||!(!((n=Ce.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const r=Ce.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=Ce.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Ce.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sf&&this.Ir.capture_unhandled_errors&&(this.sf=r(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=s(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=i(this.captureException.bind(this)))}catch(o){Uc.error("failed to start",o),this.lf()}},this._instance=e,this.uf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Qy]),this.wt=new y6(U(U({},function(n={}){var r,s,i,o;return{refillRate:(r=(s=n.exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=(o=n.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:n.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Uc})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return et(e)?t=U(U({},t),e):(Q(e)?this.uf:e)&&(t=U(U({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Uc.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(e){var t,n,r;!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this._instance,"exception-autocapture",s=>{if(s)return Uc.error("failed to load script",s);e()})}lf(){var e,t,n;(e=this.sf)===null||e===void 0||e.call(this),this.sf=void 0,(t=this.rf)===null||t===void 0||t.call(this),this.rf=void 0,(n=this.af)===null||n===void 0||n.call(this),this.af=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.uf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Qy]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}captureException(e){try{var t,n,r;const s=(t=e==null||(n=e.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(s))return void Uc.info("Skipping exception capture because of client rate limiting.",{exception:s});(r=this._instance.exceptions)===null||r===void 0||r.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this.cf=[],this.df=new P6([new W6,new eB,new G6,new q6,new X6,new Z6,new Y6,new J6],function(r,...s){return(i,o=0)=>{const l=[],c=i.split(`
12`),u=Math.min(c.length,o+1e3),d=[];for(let p=o;u>p;p++){const g=c[p];if(g.length>1024)continue;const v=pk.test(g)?g.replace(pk,"$1"):g;if(!v.match(/\S*Error: /)){for(const y of s){const x=y(v,r);if(x){l.push(x);const b=B6(l);if(b){for(let w=d.length-1;w>=0;w--){const S=d[w];if(b.start>=S.start+S.length)break;d.pop()}d.push(b)}break}}if(z6(l,d)>=50)break}}const h=[...d].sort((p,g)=>g.start-p.start),f=h[h.length-1];if(f){const p=YP(l,f);l.splice(f.start-p,p);for(const g of h)g.start-=p}for(const p of h)U6(l,p);return d.some(p=>p.start===0&&l.length===p.length)&&function(p){const g=p.map(y=>`${y.function}|${y.filename}|${y.lineno}|${y.colno}|${y.module}`);let v=0;for(let y=1;g.length>y;y++)H6(g,y,v)&&(v=y);p.push(...p.splice(0,v))}(l),function(p){if(!p.length)return[];const g=Array.from(p);return g.reverse(),g.slice(0,50).map(v=>{return U(U({},v),{},{filename:v.filename||(y=g,y[y.length-1]||{}).filename,function:v.function||"?"});var y})}(l)}}("web:javascript",L6,V6)),this._instance=e,this.cf=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.vf=$f(this.ff()),this.pf=new nB(this.vf)}onConfigChange(){this.vf=$f(this.ff()),this.pf.setConfig(this.vf)}onRemoteConfig(e){var t,n,r;if(!e.ok)return;const s=e.config;if(!("errorTracking"in s))return;const i=(t=(n=s.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],o=(r=s.errorTracking)===null||r===void 0?void 0:r.captureExtensionExceptions;this.cf=i,this._instance.persistence&&this._instance.persistence.register({[dA]:this.cf,[Zy]:o})}get gf(){var e;const t=!!this._instance.get_property(Zy),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.df.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.vf.enabled)try{if(!Je(e)||e.trim().length===0)return void Hr.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:r}=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(s).reduce((o,l)=>tB.has(l)?(i.push(l),o):(o[l]=s[l],o),{}),droppedKeys:i}}(this.mf(t));r.length>0&&Hr.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.pf.add(U({[Lf]:e,[Ff]:new Date().toISOString()},n))}catch(n){Hr.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.yf(t)){if(this.bf(t))return this._f("Exception dropped: matched a suppression rule"),void Hr.info("Skipping exception capture because a suppression rule matched");if(!this.gf&&this.wf(t))return this._f("Exception dropped: thrown by a browser extension"),void Hr.info("Skipping exception capture because it was thrown by an extension");if(!this.gf&&this.kf(t))return this._f("Exception dropped: thrown by an injected browser script"),void Hr.info("Skipping exception capture because it was thrown by an injected browser script");
12if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Sf(t))return this._f("Exception dropped: thrown by the PostHog SDK"),void Hr.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.vf.enabled&&Fe(e.$exception_steps)?this.xf(e):e,r=function(){const s=globalThis._posthogReleaseId;return typeof s=="string"&&s.length>0?s:void 0}();r&&(n.$release_id=r);try{const s=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return s&&this.pf.clear(),s}catch(s){return NS(s)||Hr.error("Failed to capture exception event. Dropping this exception.",s),void this.pf.clear()}}catch(t){return void(NS(t)||Hr.error("Failed to process exception event. Ignoring this exception.",t))}}xf(e){try{const t=this.pf.getAttachable();return t.length===0?e:U(U({},e),{},{$exception_steps:t})}catch(t){return Hr.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_f(e){this.vf.enabled&&this.pf.add({[Lf]:e,[Ff]:new Date().toISOString()})}mf(e){return et(e)?U({},e):{}}ff(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}bf(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:r,value:s})=>(Je(r)&&r.length>0&&n.$exception_types.push(r),Je(s)&&s.length>0&&n.$exception_values.push(s),n),{$exception_types:[],$exception_values:[]});return this.cf.some(n=>{const r=n.values.map(s=>{const i=kI[s.operator],o=t[s.key];if(!i||!o)return!1;const l=Ae(s.value)?s.value:[s.value];return l.length>0&&i(l,o)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}catch(t){return Hr.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}wf(e){const t=e.flatMap(r=>{var s,i;return(s=(i=r.stacktrace)===null||i===void 0?void 0:i.frames)!==null&&s!==void 0?s:[]}),n=t.filter(({filename:r})=>!!r&&uz.some(s=>r.startsWith(s)));return n.length!==0&&(!n.every(({filename:r})=>!!r&&r.startsWith(fx))||e.some(({type:r,value:s})=>r==="NoResponse"||Je(s)&&cz.some(({value:i,exact:o})=>o?s===i:s.includes(i)))&&!t.some(({in_app:r,filename:s})=>r&&!(s!=null&&s.startsWith(fx))))}kf(e){return e.some(({value:t})=>Je(t)&&dz.some(n=>t.includes(n)))}Sf(e){if(e.length>0){var t,n,r,s;const i=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],o=i[i.length-1];return(r=o==null||(s=o.filename)===null||s===void 0?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}yf(e){return!Fe(e)&&Ae(e)}}},_z=U({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Cf=null,this.$f=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var n,r;if(this.Il&&this.Il.register({[cb]:!!t.productTours}),!Kg(this._instance))return!this.Cf&&Fe((n=this.Il)===null||n===void 0?void 0:n.props.ph_product_tours)||jh.info("product tours disabled; stopping and clearing cached tours"),(r=this.Cf)===null||r===void 0||r.stop(),this.Cf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Cf&&Kg(this._instance)&&this.Ho(()=>this.Tf())}Ho(e){var t,n,r;!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this._instance,"product-tours",s=>{s?jh.error("Could not load product tours script",s):e()})}Tf(){var e;!this.Cf&&(!((e=Ce.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.Cf=Ce.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Ae(this.$f)&&!t)return void e(this.$f,{isLoaded:!0});const n=this.Il;if(n){const r=n.props[ex];if(Ae(r)&&!t)return this.$f=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:r=>{if(!Kg(this._instance))return void e([],{isLoaded:!0});const s=r.statusCode;if(s!==200||!r.json){const o=`Product Tours API could not be loaded, status: ${s}`;return s===0?r.error||jh.warn(o):jh.error(o),void e([],{isLoaded:!1,error:o})}const i=Ae(r.json.product_tours)?r.json.product_tours:[];this.$f=i,n&&n.register({[ex]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){Fe(this.Cf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Cf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Cf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Cf?this.Cf.previewTour(e):this.Ho(()=>{var t;this.Tf(),(t=this.Cf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Cf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Cf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Cf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.$f=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Cf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Cf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Cf)===null||t===void 0||t.cancelPendingTour(e)}}},tm),kz={siteApps:class{constructor(e){this._instance=e,this.If=0,this.Mf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ef(e,t){if(!t)return;const n=this.globalsForEvent(t);this.Mf.push(n),this.Mf.length>1e3&&(this.Mf=this.Mf.slice(10))}get siteAppLoaders(){var e;
12return(e=Ce._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.Ef.bind(this));this.Pf=()=>{e(),this.Mf=[],this.Pf=void 0}}}globalsForEvent(e){var t,n,r,s,i,o,l;if(!e)throw new Error("Event payload is required");const c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(const[p,g]of Object.entries(d))c[p]={id:u[p],type:p,properties:g};const{$set_once:h,$set:f}=e;return{event:U(U({},JP(e,JU)),{},{properties:U(U(U({},e.properties),f?{$set:U(U({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),f)}:{}),h?{$set_once:U(U({},(r=(s=e.properties)===null||s===void 0?void 0:s.$set_once)!==null&&r!==void 0?r:{}),h)}:{}),elements_chain:(i=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=e.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}Rf(e){var t;const n=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(ps.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(ps.error("prepare_external_dependency_script returned null"),null):e}Af(){var e,t,n,r,s,i,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=ee==null?void 0:ee.defaultView,u=c==null||(e=c.Node)===null||e===void 0?void 0:e.prototype;if(!c||!u)return()=>{};if(this.If++,this.Ff)return this.Of();const d=[],h=this,f=new WeakSet,p=(y,x,b)=>{if(!(y!=null&&y[x]))return;const w=y[x];y[x]=b(w),d.push(()=>{y[x]=w})},g=y=>{if(f.has(y))return y;const x=h.Rf(y);return x&&f.add(x),x},v=y=>y.map(x=>typeof x=="string"?x:g(x)).filter(x=>!Ut(x));return p(u,"appendChild",y=>function(x){const b=g(x);return b?y.call(this,b):x}),p(u,"insertBefore",y=>function(x,b){const w=g(x);return w?y.call(this,w,b):x}),p(u,"replaceChild",y=>function(x,b){const w=g(x);return w?y.call(this,w,b):b}),[(t=c.Element)===null||t===void 0?void 0:t.prototype,(n=c.Document)===null||n===void 0?void 0:n.prototype,(r=c.DocumentFragment)===null||r===void 0?void 0:r.prototype].forEach(y=>{p(y,"append",x=>function(...b){return x.apply(this,v(b))}),p(y,"prepend",x=>function(...b){return x.apply(this,v(b))})}),[(s=c.Element)===null||s===void 0?void 0:s.prototype,(i=c.CharacterData)===null||i===void 0?void 0:i.prototype,(o=c.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(y=>{p(y,"before",x=>function(...b){return x.apply(this,v(b))}),p(y,"after",x=>function(...b){return x.apply(this,v(b))}),p(y,"replaceWith",x=>function(...b){const w=v(b);return b.length&&!w.length?void 0:x.apply(this,w)})}),p((l=c.Element)===null||l===void 0?void 0:l.prototype,"insertAdjacentElement",y=>function(x,b){const w=g(b);return w?y.call(this,x,w):null}),this.Ff=()=>{d.forEach(y=>y()),this.Ff=void 0},this.Of()}Of(){let e=!1;return()=>{var t;e||(e=!0,this.If--,this.If===0&&((t=this.Ff)===null||t===void 0||t.call(this)))}}Df(e,t=!0){const n=this.Af();try{const r=e(n);return t&&n(),r}catch(r){throw n(),r}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var i;!t.errored&&this.Mf.length&&(ps.info(`Processing ${this.Mf.length} events for site app with id ${e.id}`),this.Mf.forEach(o=>this.Df(()=>{var l;return(l=t.processEvent)===null||l===void 0?void 0:l.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((i=this.Pf)===null||i===void 0||i.call(this))};let r=!1;const s=i=>{t.errored=!i,t.loaded=!0,ps.info(`Site app with id ${e.id} ${i?"loaded":"errored"}`),r&&n()};try{const{processEvent:i}=this.Df(o=>e.init({posthog:this._instance,callback(l){o(),s(l)}}),!1);i&&(t.processEvent=i),r=!0}catch(i){ps.error(gS+e.id,i),s(!1)}if(r&&t.loaded)try{n()}catch(i){ps.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}Lf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Nf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.Df(()=>{var r;return(r=n.processEvent)===null||r===void 0?void 0:r.call(n,t)})}catch(r){ps.error(`Error while processing event ${e.event} for site app ${n.id}`,r)}}onRemoteConfig(e){var t,n,r;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Lf(),void this._instance.on("eventCaptured",l=>this.Nf(l))):void ps.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Pf)===null||n===void 0||n.call(this),!e.ok)return;const s=e.config;if(!((r=s.siteApps)===null||r===void 0)&&r.length)if(this.isEnabled)for(const{id:l,url:c}of s.siteApps){var i,o;Ce[`__$$ph_site_app_${l}`]=this._instance,(i=Ce.__PosthogExtensions__)===null||i===void 0||(o=i.loadSiteApp)===null||o===void 0||o.call(i,this._instance,c,u=>{if(u)return ps.error(gS+l,u)})}else ps.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Sz={tracingHeaders:class{constructor(e){this._instance=e,this.qf=void 0,this.jf=void 0,this.Bf=void 0,this.ef=()=>{const t=this.Hf();var n,r;t?(Q(this.qf)&&(this.qf=(n=Ce.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Q(this.jf)&&(this.jf=(r=Ce.__PosthogExtensions__)===null||r===void 0||(r=r.tracingHeadersPatchFns)===null||r===void 0?void 0:r._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.lf()}}initialize(){this.startIfEnabledOrStop()}Ho(e){var t,n,r;!((t=Ce.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(n=Ce.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this._instance,"tracing-headers",s=>{if(s)return KU.error("failed to load script",s);e()})}zf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Hf(){const e=this.zf();return Ae(e)?(Ae(this.Bf)?this.Bf.splice(0,this.Bf.length,...e):this.Bf=[...e],e.length>0?this.Bf:void 0):(Ae(this.Bf)&&this.Bf.splice(0),this.Bf=e||void 0,this.Bf)}lf(){var e,t;(e=this.qf)===null||e===void 0||e.call(this),(t=this.jf)===null||t===void 0||t.call(this),this.qf=void 0,this.jf=void 0}startIfEnabledOrStop(){this.Hf()?this.Ho(this.ef):this.lf()}}},Ez=U({surveys:class extends ez{constructor(e){var t;super(new iz(e),(t=e,{get projectToken(){return t.config.token},kv:new sz(t)})),this._instance=e}Vh(e,t){const n=t.query?Vd(e,t.query):e;return new Promise(r=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((s=t.target)!==null&&s!==void 0?s:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:r})})}}},tm),Nz={toolbar:class{constructor(e){this.instance=e}Uf(e){Ce.ph_toolbar_state=e}Wf(){var e;return(e=Ce.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){var r,s;if(nx(this.instance.config)||!K||!ee)return!1;e=(r=e)!==null&&r!==void 0?r:K.location,n=(s=n)!==null&&s!==void 0?s:K.history;try{if(!t){try{K.localStorage.setItem("test","test"),K.localStorage.removeItem("test")}catch{return!1}t=K==null?void 0:K.localStorage}const i=oz||qf(e.hash,"__posthog")||qf(e.hash,"state");let o;const l=i?uk(()=>JSON.parse(atob(decodeURIComponent(i))))||uk(()=>JSON.parse(decodeURIComponent(i))):null;return l&&l.action==="ph_authorize"?(o=l,o.source="url",o&&Object.keys(o).length>0&&(l.desiredHash?e.hash=l.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(yS)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Vf(e){const t=Ce.ph_load_toolbar||Ce.ph_load_editor;!Fe(t)&&pn(t)?t(e,this.instance):xS.warn("No toolbar load function found")}loadToolbar(e){const t=!!(ee!=null&&ee.getElementById("__POSTHOG_TOOLBAR__"));if(!K||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=U(U({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(K.localStorage.setItem(yS,JSON.stringify(U(U({},r),{},{source:void 0}))),this.Wf()===2)this.Vf(r);else if(this.Wf()===0){var s,i;this.Uf(1),(s=Ce.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this.instance,"toolbar",o=>{if(o)return xS.error("[Toolbar] Failed to load",o),void this.Uf(0);this.Uf(2),this.Vf(r)}),pt(K,"turbolinks:load",()=>{this.Uf(0),this.loadToolbar(r)})}return!0}Gf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},Cz=U({experiments:class $n{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(r=>{$n.Zf("retrieved web experiments from the server"),this.Qf=new Map,r.forEach(s=>
12{if(s.feature_flag_key){var i;this.Qf&&($n.Zf("setting flag key ",s.feature_flag_key," to web experiment ",s),(i=this.Qf)===null||i===void 0||i.set(s.feature_flag_key,s));const o=this._instance.getFeatureFlag(s.feature_flag_key);Je(o)&&s.variants[o]&&this.Jf(s.name,o,s.variants[o].transforms)}else if(s.variants)for(const o in s.variants){const l=s.variants[o];$n.Kf(l,this._instance)&&this.Jf(s.name,o,l.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())$n.Zf(CS);else if(!this.Ir.disable_web_experiments){if(Fe(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();$n.Zf("applying feature flags",t),t.forEach(n=>{var r;if(this.Qf&&(!((r=this.Qf)===null||r===void 0)&&r.has(n))){var s;const i=this._instance.getFeatureFlag(n),o=(s=this.Qf)===null||s===void 0?void 0:s.get(n);i&&(o!=null&&o.variants[i])&&this.Jf(o.name,i,o.variants[i].transforms)}})}}previewWebExperiment(){const t=$n.getWindowLocation();if(t!=null&&t.search){const n=Zl(t==null?void 0:t.search,"__experiment_id"),r=Zl(t==null?void 0:t.search,"__experiment_variant");n&&r&&($n.Zf(`previewing web experiments ${n} && ${r}`),this.getWebExperiments(s=>{this.Xf(parseInt(n),r,s)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.Ir.disable_web_experiments&&!r)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!n)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ir.token}`),method:"GET",timestampMode:"query",callback:i=>t(i.statusCode===200&&i.json&&i.json.experiments||[])})}Xf(t,n,r){const s=r.filter(i=>i.id===t);s&&s.length>0&&($n.Zf(`Previewing web experiment [${s[0].name}] with variant [${n}]`),this.Jf(s[0].name,n,s[0].variants[n].transforms))}static Kf(t,n){return!Fe(t.conditions)&&$n.Yf(t,n)&&$n.tp(t)}static Yf(t,n){var r;if(Fe(t.conditions)||Fe((r=t.conditions)===null||r===void 0?void 0:r.url))return!0;const s=$n.getWindowLocation();if(s){var i,o,l;const c=DA(n,s.href);return!(!((i=t.conditions)===null||i===void 0)&&i.url)||hz[(o=(l=t.conditions)===null||l===void 0?void 0:l.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c)}return!1}
12static getWindowLocation(){return K==null?void 0:K.location}static tp(t){var n;if(Fe(t.conditions)||Fe((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const r=KA();if(r.utm_source){var s,i,o,l,c,u,d,h;const f=!(!((s=t.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0)&&s.utm_campaign)||((i=t.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0?void 0:i.utm_campaign)==r.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0?void 0:l.utm_source)==r.utm_source,g=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==r.utm_medium,v=!(!((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0)&&d.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==r.utm_term;return f&&g&&v&&p}return!1}static Zf(t,...n){ue.info(`[WebExperiments] ${t}`,n)}Jf(t,n,r){this._is_bot()?$n.Zf(CS):n!=="control"?r.forEach(s=>{if(s.selector){var i;$n.Zf(`applying transform of variant ${n} for experiment ${t} `,s);const o=(i=document)===null||i===void 0?void 0:i.querySelectorAll(s.selector);o==null||o.forEach(l=>{const c=l;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)})}}):$n.Zf("Control variants leave the page unmodified.")}_is_bot(){return gn&&this._instance?bI(gn,this.Ir.custom_blocked_useragents):void 0}}},tm),jz={conversations:class{constructor(e){this._instance=e,this.ep=void 0,this._conversationsManager=null,this.np=!1,this.ne=null,this.sp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.rp=e.ok,!e.ok))return;const t=e.config.conversations;Fe(t)||(Kn(t)?this.ep=t:(this.ep=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.ep=void 0,this.ne=null,this.rp=void 0,this.sp=!1}loadIfEnabled(){if(this._conversationsManager||this.np||this._instance.config.disable_conversations||nx(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=Ce==null?void 0:Ce.__PosthogExtensions__;if(e&&!Q(this.ep)&&this.ep)if(this.ne&&this.ne.token){this.np=!0;try{const t=e.initConversations;if(t)return this.op(t),void(this.np=!1);const n=e.loadExternalDependency;if(!n)return void this.ap(fb);n(this._instance,"conversations",r=>{r||!e.initConversations?this.ap("Could not load conversations script",r):this.op(e.initConversations),this.np=!1})}catch(t){this.ap("Error initializing conversations",t),this.np=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}op(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.sp=!1,Mr.info("Conversations loaded successfully")}catch(t){this.ap("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}ap(e,t){Mr.error(e,t),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ep===!0&&!Ut(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":nx(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.rp===!1?"remote_config_failed":Q(this.ep)?this.rp?"disabled_in_project":"remote_config_pending":this.ep?Fe(this.ne)||!this.ne.token?"missing_token":Ce!=null&&Ce.__PosthogExtensions__?this.np?"initializing":this.sp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return Rt(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Mr.warn(Bo),null)})()}getMessages(e,t){var n=this;return Rt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn(Bo),null)})()}markAsRead(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn(Bo),null)})()}getTickets(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn(Bo),null)})()}requestRestoreLink(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Mr.warn(Bo),null)})()}restoreFromToken(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Mr.warn(Bo),null)})()}restoreFromUrlToken(){var e=this;return Rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Mr.warn(Bo),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},Tz={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=Ht("[logs]"),this.cp=U(U({},this.A),{},{error:(...n)=>{n.some(PS)||this.A.error(...n)}}),this.ol=[],this.dp=[],this._d=0,this.To=!1,this.vp=[],this.fp=[],this.pp=!1,this.gp=!1,this.mp=()=>{var n,r;this.To||(this._d=0,(n=this.yp)===null||n===void 0||n.onReconnect(),(r=this.bp)===null||r===void 0||r.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.lp=!0),K&&pt(K,"online",this.mp)}_p(e,t,n,r){var s;const i=jS((s=this._instance)===null||s===void 0||(s=s.config)===null||s===void 0?void 0:s.logs,n);return[new hB(this.wp(e,t),i,this.cp,()=>this.kp(),o=>o(),void 0,r),i]}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.yp&&this.xp===t||((n=this.yp)===null||n===void 0||n.reset(),this.xp=t,[this.yp,this.Cp]=this._p(()=>this.ol,r=>{this.ol=r})),this.yp}$p(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.bp&&this.Tp===t||((n=this.bp)===null||n===void 0||n.reset(),this.Tp=t,[this.bp,this.Ip]=this._p(()=>this.dp,r=>{this.dp=r},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},TS)),this.bp}setup(e){var t;if(this.To)return;this.bo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.lp=!0),(this.lp||this.Mp()&&this.Ep())&&this.Pp();let n=!1;const r=e.onRemoteConfig(s=>{var i;n=s.ok&&((i=s.config.logs)===null||i===void 0?void 0:i.captureConsoleLogs)===!0,this.onRemoteConfig(s)});this.To?r.dispose():(this.Eo=r,n||this.loadIfEnabled())}dispose(){var e,t,n,r;this.To||(this.To=!0,this.Rp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.hp=!1,K==null||K.removeEventListener("online",this.mp),(t=this.Ap)===null||t===void 0||t.call(this),this.Ap=void 0,(n=this.yp)===null||n===void 0||n.reset(),(r=this.bp)===null||r===void 0||r.reset())}onRemoteConfig(e){var t,n;if(this.To)return;const r=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;Fe(r)?this.Fp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!r}),r?(this.lp=!0,this.up||this.Pp(),this.loadIfEnabled()):this.Fp())}reset(){var e,t,n,r;this.Rp(),(e=this.yp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.yp)===null||t===void 0||t.reset(),(n=this.bp)===null||n===void 0||n.clearQueue(),this.dp=[],(r=this.bp)===null||r===void 0||r.reset(),this._d=0}captureLog(e){this.To||this.Sp().captureLog(e)}captureConsoleLog(e){this.To||this.$p().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.To||this.$p().captureLog(e,{context:t,occurredAtMs:n})}Ep(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[hA])}Mp(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((n=Ce._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}$h(){var e;this.Rp(),(e=this.bp)===null||e===void 0||e.clearQueue(),this.dp=[]}Fp(){this.lp||this.Rp()}Pp(){var e;
12if(this.pp||!(Ce!=null&&Ce.console))return;const t=jS((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let n=!0;this.fp.push(()=>{n=!1});for(const r of fz){let s;try{s=pz(Ce.console[r])}catch{continue}s&&this.fp.push(ad(Ce.console,r,i=>{const o=(...l)=>{try{n&&this.Op(r,l,t)}catch{}return i.apply(Ce.console,l)};return o.__rrweb_original__=s,o}))}this.pp=!0,this.Dp=setTimeout(()=>{this.Rp()},3e4)}Op(e,t,n){var r;if(this.pp&&!this.gp&&t.length!==0)if(!((r=this._instance)===null||r===void 0)&&r.is_capturing()){if(n>this.vp.length){this.gp=!0;try{this.vp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.kp()})}finally{this.gp=!1}}}else this.Rp()}Rp(){if(this.vp=[],this.pp){this.pp=!1,this.Dp&&(clearTimeout(this.Dp),this.Dp=void 0);for(const e of this.fp)e();this.fp=[]}}Lp(){const e=this.vp;return this.Rp(),e}get logger(){return this.Np||(this.Np={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Np}flushLogs(e){e?this.qp(e):(this.yp&&this.yp.flush().catch(t=>this.jp(t)),this.bp&&this.bp.flush().catch(t=>this.jp(t)))}jp(e){PS(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;const e=Ce==null?void 0:Ce.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Rp();const t=e.loadExternalDependency;if(!t)return this.A.error(fb),void this.Rp();this.hp=!0;try{t(this._instance,"logs",n=>{if(this.hp=!1,this.To||!this.lp)return;const r=e.logs;if(n||!(r!=null&&r.initializeLogs))this.A.error("Could not load logs script",n),this.Rp();else{var s;const l=this.Lp();var i,o;this.Ap=r.initializeLogs((s=this.bo)!==null&&s!==void 0?s:this._instance),this.up=!0,l.length>0&&((i=r.replayConsoleBuffer)===null||i===void 0||i.call(r,(o=this.bo)!==null&&o!==void 0?o:this._instance,l))}})}catch(n){throw this.hp=!1,n}}wp(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===vs.LogsQueue?e():void 0,setPersistedProperty(r,s){var i;r===vs.LogsQueue&&t((i=s)!==null&&i!==void 0?i:[])},js:r=>this.js(r),getLibraryId:()=>un.LIB_NAME,getLibraryVersion:()=>un.LIB_VERSION}}js(e){return new Promise(t=>{if(qA(this._d,3))return void t({kind:"fatal",error:Qg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const r=i=>{n||(n=!0,clearTimeout(s),t(i))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Qg(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Bp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{const o=i.statusCode;if(this.Hp(o),o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var l;o===0?(i.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Qg(i.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(l=i.error)!==null&&l!==void 0?l:new Error(`logs request failed with status ${o}`)})}}})})}Hp(e){(e!==0||this._instance.__loaded)&&(this._d=GA(e,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}qp(e){this.ol.length>0&&this.zp(e,this.ol,this.Cp,un.LIB_NAME,t=>{this.ol=t}),this.dp.length>0&&this.zp(e,this.dp,this.Ip,TS,t=>{this.dp=t})}zp(e,t,n,r,s){if(t.length===0)return;const i=t.map(l=>l.record);s([]);const o=iA(i,sA(n,un.LIB_NAME,un.LIB_VERSION),r,un.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Bp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}kp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=r,Fe(s)||(t.sessionStartTimestamp=s),Fe(i)||(t.lastActivityTimestamp=i)}if(!(Ce==null||(e=Ce.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?po(Ce.location.href):Ce.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},Pz={metrics:class{constructor(e){this._instance=e,this.A=Ht("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Up?this.Up=(n=>{let r=!0;const s=()=>r?(l=>{var c;const u=(c=l.config.metrics)===null||c===void 0?void 0:c.network;return u===!0?{}:u||void 0})(n):void 0,i=vz(n,s),o=yz(n,s);return()=>{r=!1,i(),o()}})(this._instance):!t&&this.Up&&(this.Up(),this.Up=void 0)}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var n;return this.yp&&this.xp===t||((n=this.yp)===null||n===void 0||n.reset(),this.xp=t,this.yp=new fB(this.wp(),function(r){var s,i,o,l,c;const u=r==null?void 0:r.resourceAttributes;return{serviceName:(s=u==null?void 0:u["service.name"])!==null&&s!==void 0?s:r==null?void 0:r.serviceName,serviceVersion:(i=u==null?void 0:u["service.version"])!==null&&i!==void 0?i:r==null?void 0:r.serviceVersion,environment:(o=u==null?void 0:u["deployment.environment"])!==null&&o!==void 0?o:r==null?void 0:r.environment,resourceAttributes:u,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(l=r==null?void 0:r.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(c=r==null?void 0:r.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}}(t),this.A)),this.yp}count(e,t=1,n){this.Sp().count(e,t,n)}
12gauge(e,t,n){this.Sp().gauge(e,t,n)}histogram(e,t,n){this.Sp().histogram(e,t,n)}flush(e){if(!this.yp)return Promise.resolve();if(e){const t=this.yp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.yp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.yp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Up)===null||e===void 0||e.call(this),this.Up=void 0,(t=this.yp)===null||t===void 0||t.reset()}wp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:n=>t.Ys(n),getLibraryId:()=>un.LIB_NAME,getLibraryVersion:()=>un.LIB_VERSION}}Ys(e,t){return new Promise(n=>{let r=!1;const s=o=>{r||(r=!0,clearTimeout(i),n(o))},i=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(U(U({method:"POST",url:this.Wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const l=o.statusCode;if(l>=200&&300>l)s({kind:"ok"});else if(l===413)s({kind:"too-large"});else if(l!==0&&l!==408&&l!==429&&500>l)s({kind:"fatal",error:new Error(`metrics request failed with status ${l}`)});else{var c;s({kind:"retry-later",error:(c=o.error)!==null&&c!==void 0?c:new Error(`metrics request failed with status ${l}`)})}}}))})}Wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Fu.__defaultExtensionClasses=U({},U(U(U(U(U(U(U(U(U(U(U(U(U({},tm),xz),bz),wz),_z),kz),Ez),Sz),Nz),Cz),jz),Tz),Pz));const Az=function(){un.SDK_DIST_CHANNEL="npm";const e=Du[gu]=new Fu;return function(){function t(){t.done||(t.done=!0,yI=!1,xt(Du,function(n){n._dom_loaded()}))}ee!=null&&ee.addEventListener?ee.readyState==="complete"?t():pt(ee,"DOMContentLoaded",t,{capture:!1}):K&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var ec=Az;const II={VITE_POSTHOG_PROJECT_TOKEN:"phc_x5APwUeWZHhqtjerPtcWNqvv2PQN5EsWdYHsqXj9tgwx"},RI=!0,Iz="637837";let tc=!1;function Rz(){return II.VITE_POSTHOG_PROJECT_TOKEN}function Mz(){const e=II;return e.VITE_POSTHOG_HOST||e.VITE_PUBLIC_POSTHOG_HOST||"https://us.i.posthog.com"}function Oz(){if(tc)return;const e=Rz();try{ec.init(e,{api_host:Mz(),capture_pageview:"history_change",capture_pageleave:!0,autocapture:!1,person_profiles:"identified_only",capture_exceptions:!1,...RI?{session_recording:{maskAllInputs:!0}}:{disable_session_recording:!0}}),tc=!0;try{ec.register({platform:DI()})}catch{}}catch{}}function MI(e,t){if(!(!tc||!e))try{const n={};t!=null&&t.subscriptionStatus&&(n.subscription_status=t.subscriptionStatus),ec.identify(String(e),n)}catch{}}function Dz(){if(tc)try{ec.reset()}catch{}}function OI(){if(!tc||!RI)return null;try{const e=ec.get_session_replay_url({withTimestamp:!0,timestampLookBack:30});return e?e.replace(/\/project\/[^/]+\//,`/project/${Iz}/`):null}catch{return null}}function DI(){try{if(Ra())return"ios";if(Gp())return"android"}catch{}return"web"}function wa(e,t){if(tc)try{ec.capture(e,{platform:DI(),...t})}catch{}}function Wt(e={}){const t=Lt(),n=l6(e),{user:r,isLoading:s,isAuthenticated:i,isAdmin:o,error:l}=n;let c;try{c=HT()}catch{c={isDemoMode:!1,demoSubscriptionTier:"free",getDemoData:()=>({user:null})}}const{isDemoMode:u,demoSubscriptionTier:d,getDemoData:h}=c;let f=r;u&&(f={...h().user,subscriptionStatus:d==="premium"?"active":"inactive",isAdmin:(r==null?void 0:r.isAdmin)||!1});async function p(w){var E;const S=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(w)}),_=await S.json().catch(()=>({}));if(!S.ok)throw new Error(_.message||"Login failed");return(E=_.tokens)!=null&&E.accessToken&&await co(_.tokens.accessToken),t.invalidateQueries({queryKey:["/api/auth/user"]}),{success:!0,user:_.user,tokens:_.tokens,redirectUrl:_.redirectUrl}}async function g(w){var E;const S=await fetch("/api/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(w)}),_=await S.json().catch(()=>({}));if(!S.ok)throw new Error(_.message||"Signup failed");return(E=_.tokens)!=null&&E.accessToken&&await co(_.tokens.accessToken),t.invalidateQueries({queryKey:["/api/auth/user"]}),{success:!0,user:_.user,tokens:_.tokens}
12}async function v(){try{await Cs("/api/auth/logout",{method:"POST",credentials:"include"})}finally{Dz(),await Ms(t,{force:!0}),Kl("/login")}}async function y(){var w;try{const S=await fetch("/api/auth/refresh",{method:"POST",credentials:"include"});if(!S.ok)return null;const _=await S.json();if((w=_.tokens)!=null&&w.accessToken)return await co(_.tokens.accessToken),_.tokens}catch{}return null}function x(){t.invalidateQueries({queryKey:["/api/auth/user"]})}function b(){Ms(t)}return{user:f,isLoading:s,isAuthenticated:i,isAdmin:o,error:l,login:p,signup:g,logout:v,refreshToken:y,refetchAuth:x,clearAuth:b}}function Lz(){const[e]=Pt(),{user:t,isAdmin:n}=Wt();m.useEffect(()=>{typeof window<"u"&&window.dataLayer&&window.dataLayer.push({event:"page_view",page_path:e,page_title:document.title,user_authenticated:!!t,is_admin:!!n})},[e,t,n])}function Fz(){m.useEffect(()=>{const e=new URL(window.location.href);if(e.searchParams.has("logout")||e.searchParams.has("bust")||e.searchParams.has("emergency_logout")){e.searchParams.delete("logout"),e.searchParams.delete("bust"),e.searchParams.delete("emergency_logout"),e.searchParams.delete("clear_cache"),window.history.replaceState({},"",e.toString());try{js.removeQueries({queryKey:["/api/auth/user"]}),js.setQueryData(["/api/auth/user"],null),js.invalidateQueries({queryKey:["/api/auth/user"]})}catch{}}},[]),m.useEffect(()=>{window.location.hostname.includes("picard.replit.dev")&&window.location.search.includes("clearCache")&&ve(async()=>{const{clearAllCaches:t}=await Promise.resolve().then(()=>Qxe);return{clearAllCaches:t}},void 0).then(({clearAllCaches:t})=>{t().then(()=>{const n=new URL(window.location.href);n.searchParams.delete("clearCache"),window.history.replaceState({},"",n.toString())})})},[])}const $z=[{path:"/",component:m.lazy(()=>ve(()=>import("./LandingPage-CpY9e08F.js"),__vite__mapDeps([4,1,5,6,7,8,9,10,11])).then(e=>({default:e.default}))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/landing-preview",component:m.lazy(()=>ve(()=>import("./LandingPreviewPage-BFauyJLJ.js"),__vite__mapDeps([12,1,8,10]))),prerender:!1,category:"marketing",isLandingPage:!0},{path:"/pricing",component:m.lazy(()=>ve(()=>import("./PricingPage-d-MW6XDB.js"),__vite__mapDeps([13,1,14]))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/features",component:m.lazy(()=>ve(()=>import("./FeaturesPage-pn1Rv-VQ.js"),__vite__mapDeps([15,1]))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/about",component:m.lazy(()=>ve(()=>import("./AboutPage-BVNHFNMk.js"),__vite__mapDeps([16,1]))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/why-reps-shield",component:m.lazy(()=>ve(()=>import("./WhyRepsShieldPage-SA159hKp.js"),__vite__mapDeps([17,1]))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/repstracker-alternative",component:m.lazy(()=>ve(()=>import("./ComparisonPage-DMPdKll7.js"),__vite__mapDeps([18,1,6]))),prerender:!0,category:"marketing",isLandingPage:!1},{path:"/repslog-alternative",component:m.lazy(()=>ve(()=>import("./REPSLogComparisonPage-VwxLE32v.js"),__vite__mapDeps([19,1,6]))),prerender:!0,category:"marketing",isLandingPage:!1},{path:"/changelog",component:m.lazy(()=>ve(()=>import("./ChangelogPage-BwwMeoP8.js"),__vite__mapDeps([20,1,21]))),prerender:!0,category:"marketing",isLandingPage:!0},{path:"/docs/api",component:m.lazy(()=>ve(()=>import("./ApiDocsPage-CHUb02qa.js"),__vite__mapDeps([22,1,23]))),prerender:!0,category:"marketing",isLandingPage:!0}],Vz=[{path:"/features/time-tracking",component:m.lazy(()=>ve(()=>import("./TimeTrackingPage-_YnfPacG.js"),__vite__mapDeps([24,1,25,26]))),prerender:!0,category:"features",isLandingPage:!0},{path:"/features/material-participation",component:m.lazy(()=>ve(()=>import("./MaterialParticipationPage-BWtz9Dr0.js"),__vite__mapDeps([27,1]))),prerender:!0,category:"features",isLandingPage:!0},{path:"/features/audit-ready-reporting",component:m.lazy(()=>ve(()=>import("./AuditReadyReportingPage-yHnvHy4u.js"),__vite__mapDeps([28,1,29]))),prerender:!0,category:"features",isLandingPage:!0},{path:"/features/goal-progress-tracker",component:m.lazy(()=>ve(()=>import("./GoalProgressTrackerPage-CAMi-oR6.js"),__vite__mapDeps([30,1,31]))),prerender:!0,category:"features",isLandingPage:!0},{path:"/features/multi-property-support",component:m.lazy(()=>ve(()=>import("./MultiPropertySupportPage-Ds2dyHCm.js"),__vite__mapDeps([32,1,33]))),prerender:!0,category:"features",isLandingPage:!0},{path:"/features/premium-features",component:m.lazy(()=>ve(()=>import("./PremiumFeaturesPage-Gk03PuVs.js"),__vite__mapDeps([34,1,6,26])
12)),prerender:!0,category:"features",isLandingPage:!0}],Bz=[{path:"/tools",component:m.lazy(()=>ve(()=>import("./ToolsIndexPage-BzeSR35Q.js"),__vite__mapDeps([35,1,36]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/rental-calculator",component:m.lazy(()=>ve(()=>import("./RentalCalculatorPage-BEfJO6hp.js"),__vite__mapDeps([37,1,38,39,40,36]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/brrr-calculator",component:m.lazy(()=>ve(()=>import("./BrrrCalculatorPage-CckvcML4.js"),__vite__mapDeps([41,1,38,39,40,36]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/rep-status-calculator",component:m.lazy(()=>ve(()=>import("./RepStatusCalculatorPage-CfmTksfb.js"),__vite__mapDeps([42,1,43,36]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/rep-status-audit-scan",component:m.lazy(()=>ve(()=>import("./RepStatusAuditScanPage-_ljnz2Xq.js"),__vite__mapDeps([44,1,45,36,43]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/rep-hours-tracker",component:m.lazy(()=>ve(()=>import("./RepHoursTrackerPage-BT6xVRsW.js"),__vite__mapDeps([46,1,45]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/1031-exchange-timer",component:m.lazy(()=>ve(()=>import("./ExchangeTimerPage-DqNlnrnN.js"),__vite__mapDeps([47,1,39,48,49,50]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/1031-exchange-share/:id",component:m.lazy(()=>ve(()=>import("./ExchangeSharedPage-DXwPuBDP.js"),__vite__mapDeps([51,1,50,39,48,49]))),prerender:!1,category:"tools",isLandingPage:!0},{path:"/tools/cost-seg-estimator",component:m.lazy(()=>ve(()=>import("./CostSegEstimatorPage-D90nCcQc.js"),__vite__mapDeps([52,1]))),prerender:!0,category:"tools",isLandingPage:!0},{path:"/tools/cost-seg-estimator/chat",component:m.lazy(()=>ve(()=>import("./CostSegEstimatorChatPage-DVRrvdxT.js"),__vite__mapDeps([53,1]))),prerender:!1,category:"tools",isLandingPage:!0}],Uz=[{path:"/blog",component:m.lazy(()=>ve(()=>import("./BlogIndexPage-_T1lQLU_.js"),__vite__mapDeps([54,1,8,55,56,57,10]))),prerender:!1,category:"marketing",isLandingPage:!0},{path:"/blog/category/:slug",component:m.lazy(()=>ve(()=>import("./BlogCategoryPage-4WGb97PI.js"),__vite__mapDeps([58,1,8,55,56,57,10]))),prerender:!1,category:"marketing",isLandingPage:!0},{path:"/blog/:slug",component:m.lazy(()=>ve(()=>import("./BlogPostPage-D-WrB_nu.js"),__vite__mapDeps([59,1,8,9,55,56,10]))),prerender:!1,category:"marketing",isLandingPage:!0}],zz=[{path:"/login",component:m.lazy(()=>ve(()=>Promise.resolve().then(()=>qoe),void 0)),prerender:!0,category:"auth",isLandingPage:!1},{path:"/register",component:m.lazy(()=>ve(()=>import("./RegisterPage-k5ifVQRv.js"),__vite__mapDeps([60,1]))),prerender:!0,category:"auth",isLandingPage:!1},{path:"/forgot-password",component:m.lazy(()=>ve(()=>import("./ForgotPasswordPage-C_THzFbZ.js"),__vite__mapDeps([61,1]))),prerender:!1,category:"auth",isLandingPage:!1},{path:"/reset-password",component:m.lazy(()=>ve(()=>import("./ResetPasswordPage-DEjSjSDc.js"),__vite__mapDeps([62,1]))),prerender:!1,category:"auth",isLandingPage:!1},{path:"/logout-success",component:m.lazy(()=>ve(()=>import("./LogoutSuccessPage-FcS1iM5p.js"),__vite__mapDeps([63,1]))),prerender:!1,category:"auth",isLandingPage:!1},{path:"/accept-invite/:token",component:m.lazy(()=>ve(()=>import("./AcceptInvitePage-DoLwZuFU.js"),__vite__mapDeps([64,1]))),prerender:!1,category:"auth",isLandingPage:!1}],Hz=[{path:"/privacy",component:m.lazy(()=>ve(()=>import("./PrivacyPage-D39j4bdO.js"),__vite__mapDeps([65,1,66,50,25,67]))),prerender:!0,category:"legal",isLandingPage:!0},{path:"/terms",component:m.lazy(()=>ve(()=>import("./TermsPage-CzqkqI9Q.js"),__vite__mapDeps([68,1,66,67]))),prerender:!0,category:"legal",isLandingPage:!1}],Wz=[{path:"/affiliate-program",component:m.lazy(()=>ve(()=>import("./AffiliateProgramPage-DNa8vIbD.js"),__vite__mapDeps([69,1,29]))),prerender:!0,category:"affiliate",isLandingPage:!0},{path:"/affiliate-signup",component:m.lazy(()=>ve(()=>import("./AffiliateSignupPage-BApRpjQV.js"),__vite__mapDeps([70,1,71]))),prerender:!0,category:"affiliate",isLandingPage:!0}],qz=[{path:"/diagnostics",component:m.lazy(()=>ve(()=>import("./diagnostics-BEoNHIuU.js"),__vite__mapDeps([72,1,43]))),prerender:!1,category:"debug",isLandingPage:!1},{path:"/public-diagnostics",component:m.lazy(()=>ve(()=>
12import("./public-diagnostics-6bKSQqGY.js"),__vite__mapDeps([73,1,43]))),prerender:!1,category:"debug",isLandingPage:!1},{path:"/debug-deployment",component:m.lazy(()=>ve(()=>import("./debug-deployment-B9iloUGY.js"),__vite__mapDeps([74,1,43]))),prerender:!1,category:"debug",isLandingPage:!1}],ld=[...$z,...Vz,...Bz,...Uz,...zz,...Hz,...Wz,...qz],Gz=ld.filter(e=>e.isLandingPage).map(e=>e.path),Kz=ld.filter(e=>e.category!=="debug").map(e=>e.path);ld.filter(e=>e.prerender).map(e=>e.path);function LI(e){const t=e.split(/[?#]/,1)[0]||"/";return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function AS(e){const t=LI(e);return Gz.includes(t)||t.startsWith("/features/")||t.startsWith("/tools/")||t.startsWith("/blog/")}function kb(e){const t=LI(e);return Kz.some(n=>t===n||t.startsWith(n+"/"))||t.startsWith("/tools/")}function IS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mo(...e){return t=>{let n=!1;const r=e.map(s=>{const i=IS(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():IS(e[s],null)}}}}function He(...e){return m.useCallback(mo(...e),e)}function go(e){const t=m.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,l=!1;const c=[];RS(s)&&typeof Th=="function"&&(s=Th(s._payload)),m.Children.forEach(s,f=>{var p;if(Jz(f)){l=!0;const g=f;let v="child"in g.props?g.props.child:g.props.children;RS(v)&&typeof Th=="function"&&(v=Th(v._payload)),o=Qz(g,v),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(f)}),o?o=m.cloneElement(o,void 0,c):!l&&m.Children.count(s)===1&&m.isValidElement(s)&&(o=s);const u=o?Xz(o):void 0,d=He(r,u);if(!o){if(s||s===0)throw new Error(l?r9(e):n9(e));return s}const h=Zz(i,o.props??{});return o.type!==m.Fragment&&(h.ref=r?d:u),m.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var FI=go("Slot"),$I=Symbol.for("radix.slottable");function Yz(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=$I,t}var Qz=(e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null};function Zz(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Xz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jz(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$I}var e9=Symbol.for("react.lazy");function RS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===e9&&"_payload"in e&&t9(e._payload)}function t9(e){return typeof e=="object"&&e!==null&&"then"in e}var n9=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,r9=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Th=z0[" use ".trim().toString()];function VI(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=VI(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function BI(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=VI(e))&&(r&&(r+=" "),r+=t);return r}const MS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,OS=BI,bc=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return OS(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const f=MS(d)||MS(h);return s[u][f]}),l=n&&Object.entries(n).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(g=>{let[v,y]=g;return Array.isArray(y)?y.includes({...i,...l}[v]):{...i,...l}[v]===y})?[...u,h,f]:u},[]);return OS(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Sb="-",s9=e=>{const t=o9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(Sb);return l[0]===""&&l.length!==1&&l.shift(),UI(l,t)||i9(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},UI=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?UI(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Sb);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},DS=/^\[(.+)\]$/,i9=e=>{if(DS.test(e)){const t=DS.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},o9=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};
vendor: 5,130 bytes, line 12
12return l9(Object.entries(e.classGroups),n).forEach(([i,o])=>{mx(o,r,i,t)}),r},mx=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:LS(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(a9(s)){mx(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{mx(o,LS(t,i),n,r)})})},LS=(e,t)=>{let n=e;return t.split(Sb).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},a9=e=>e.isThemeGetter,l9=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,c9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},zI="!",u9=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,h;for(let y=0;y<l.length;y++){let x=l[y];if(u===0){if(x===s&&(r||l.slice(y,y+i)===t)){c.push(l.slice(d,y)),d=y+i;continue}if(x==="/"){h=y;continue}}x==="["?u++:x==="]"&&u--}const f=c.length===0?l:l.substring(d),p=f.startsWith(zI),g=p?f.substring(1):f,v=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:o}):o},d9=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},h9=e=>({cache:c9(e.cacheSize),parseClassName:u9(e),...s9(e)}),f9=/\s+/,p9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(f9);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=n(u);let g=!!p,v=r(g?f.substring(0,p):f);if(!v){if(!g){l=u+(l.length>0?" "+l:l);continue}if(v=r(f),!v){l=u+(l.length>0?" "+l:l);continue}g=!1}const y=d9(d).join(":"),x=h?y+zI:y,b=x+v;if(i.includes(b))continue;i.push(b);const w=s(v,g);for(let S=0;S<w.length;++S){const _=w[S];i.push(x+_)}l=u+(l.length>0?" "+l:l)}return l};function m9(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=HI(t))&&(r&&(r+=" "),r+=n);return r}const HI=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=HI(e[r]))&&(n&&(n+=" "),n+=t);return n};function g9(e,...t){let n,r,s,i=o;function o(c){const u=t.reduce((d,h)=>h(d),e());return n=h9(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=p9(c,n);return s(c,d),d}return function(){return i(m9.apply(null,arguments))}}const $t=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},WI=/^\[(?:([a-z-]+):)?(.+)\]$/i,v9=/^\d+\/\d+$/,y9=new Set(["px","full","screen"]),x9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,b9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,w9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ks=e=>Nl(e)||y9.has(e)||v9.test(e),Ii=e=>wc(e,"length",A9),Nl=e=>!!e&&!Number.isNaN(Number(e)),Zg=e=>wc(e,"number",Nl),zc=e=>!!e&&Number.isInteger(Number(e)),S9=e=>e.endsWith("%")&&Nl(e.slice(0,-1)),st=e=>WI.test(e),Ri=e=>x9.test(e),E9=new Set(["length","size","percentage"]),N9=e=>wc(e,E9,qI),C9=e=>wc(e,"position",qI),j9=new Set(["image","url"]),T9=e=>wc(e,j9,R9),P9=e=>wc(e,"",I9),Hc=()=>!0,wc=(e,t,n)=>{const r=WI.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},A9=e=>b9.test(e)&&!w9.test(e),qI=()=>!1,I9=e=>_9.test(e),R9=e=>k9.test(e),M9=()=>{const e=$t("colors"),t=$t("spacing"),n=$t("blur"),r=$t("brightness"),s=$t("borderColor"),i=$t("borderRadius"),o=$t("borderSpacing"),l=$t("borderWidth"),c=$t("contrast"),u=$t("grayscale"),d=$t("hueRotate"),h=$t("invert"),f=$t("gap"),p=$t("gradientColorStops"),g=$t("gradientColorStopPositions"),v=$t("inset"),y=$t("margin"),x=$t("opacity"),b=$t("padding"),w=$t("saturate"),S=$t("scale"),_=$t("sepia"),E=$t("skew"),R=$t("space"),A=$t("translate"),N=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",st,t],I=()=>[st,t],F=()=>["",Ks,Ii],L=()=>["auto",Nl,st],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],j=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",st],C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[Nl,st];return{cacheSize:500,separator:":",theme:{colors:[Hc],spacing:[Ks,Ii],blur:["none","",Ri,st],brightness:H(),borderColor:[e],borderRadius:["n
12one","","full",Ri,st],borderSpacing:I(),borderWidth:F(),contrast:H(),grayscale:D(),hueRotate:H(),invert:D(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[S9,Ii],inset:T(),margin:T(),opacity:H(),padding:I(),saturate:H(),scale:H(),sepia:D(),skew:H(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",st]}],container:["container"],columns:[{columns:[Ri]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),st]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zc,st]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",st]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",zc,st]}],"grid-cols":[{"grid-cols":[Hc]}],"col-start-end":[{col:["auto",{span:["full",zc,st]},st]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Hc]}],"row-start-end":[{row:["auto",{span:[zc,st]},st]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",st]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",st]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",st,t]}],"min-w":[{"min-w":[st,t,"min","max","fit"]}],"max-w":[{"max-w":[st,t,"none","full","min","max","fit","prose",{screen:[Ri]},Ri]}],h:[{h:[st,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[st,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[st,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[st,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ri,Ii]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zg]}],"font-family":[{font:[Hc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",st]}],"line-clamp":[{"line-clamp":["none",Nl,Zg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ks,st]}],"list-image":[{"list-image":["none",st]}],"list-style-type":[{list:["none","disc","decimal",st]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ks,Ii]}],"underline-offset":[{"underline-offset":["auto",Ks,st]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",st]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",st]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),C9]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",N9]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},T9]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}
vendor: 5,180 bytes, line 12
12],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:$()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[Ks,st]}],"outline-w":[{outline:[Ks,Ii]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Ks,Ii]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ri,P9]}],"shadow-color":[{shadow:[Hc]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...j(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ri,st]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[w]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",st]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",st]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",st]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[zc,st]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",st]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",st]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
12],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",st]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ks,Ii,Zg]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},O9=g9(M9);function q(...e){return O9(BI(e))}function n0e(e){const t=typeof e=="string"?parseFloat(e):e;return isNaN(t)?"0.0":t.toFixed(1)}function GI(e){if(!e)return"";try{return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0})}catch{return""}}function r0e(e){const t=new Date(e),n=new Date,r=(i,o)=>i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate(),s=i=>{const o=new Date;return o.setDate(n.getDate()-1),r(i,o)};return r(t,n)?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):s(t)?"Yesterday":t.toLocaleDateString([],{month:"short",day:"numeric"})}const cd=bc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 touch-manipulation active:scale-[0.97] active:opacity-90",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline active:scale-100"},size:{default:"h-12 px-4 py-2 sm:h-10",sm:"h-10 rounded-md px-3 sm:h-9",lg:"h-12 rounded-md px-8 sm:h-11",icon:"h-11 w-11 sm:h-10 sm:w-10"}},defaultVariants:{variant:"default",size:"default"}}),ie=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?FI:"button";return a.jsx(o,{className:q(cd({variant:t,size:n,className:e})),ref:i,...s})});
vendor: 5,138 bytes, lines 12-82
12ie.displayName="Button";/**
13 * @license lucide-react v0.453.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const D9=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),KI=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
18 * @license lucide-react v0.453.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */var L9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
23 * @license lucide-react v0.453.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const F9=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>m.createElement("svg",{ref:c,...L9,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:KI("lucide",s),...l},[...o.map(([u,d])=>m.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
28 * @license lucide-react v0.453.0 - ISC
29 *
30 * This source code is licensed under the ISC license.
31 * See the LICENSE file in the root directory of this source tree.
32 */const le=(e,t)=>{const n=m.forwardRef(({className:r,...s},i)=>m.createElement(F9,{ref:i,iconNode:t,className:KI(`lucide-${D9(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
33 * @license lucide-react v0.453.0 - ISC
34 *
35 * This source code is licensed under the ISC license.
36 * See the LICENSE file in the root directory of this source tree.
37 */const $9=le("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
38 * @license lucide-react v0.453.0 - ISC
39 *
40 * This source code is licensed under the ISC license.
41 * See the LICENSE file in the root directory of this source tree.
42 */const V9=le("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/**
43 * @license lucide-react v0.453.0 - ISC
44 *
45 * This source code is licensed under the ISC license.
46 * See the LICENSE file in the root directory of this source tree.
47 */const Eb=le("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
48 * @license lucide-react v0.453.0 - ISC
49 *
50 * This source code is licensed under the ISC license.
51 * See the LICENSE file in the root directory of this source tree.
52 */const ts=le("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
53 * @license lucide-react v0.453.0 - ISC
54 *
55 * This source code is licensed under the ISC license.
56 * See the LICENSE file in the root directory of this source tree.
57 */const B9=le("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
58 * @license lucide-react v0.453.0 - ISC
59 *
60 * This source code is licensed under the ISC license.
61 * See the LICENSE file in the root directory of this source tree.
62 */const U9=le("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
63 * @license lucide-react v0.453.0 - ISC
64 *
65 * This source code is licensed under the ISC license.
66 * See the LICENSE file in the root directory of this source tree.
67 */const gx=le("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
68 * @license lucide-react v0.453.0 - ISC
69 *
70 * This source code is licensed under the ISC license.
71 * See the LICENSE file in the root directory of this source tree.
72 */const z9=le("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
73 * @license lucide-react v0.453.0 - ISC
74 *
75 * This source code is licensed under the ISC license.
76 * See the LICENSE file in the root directory of this source tree.
77 */const H9=le("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
78 * @license lucide-react v0.453.0 - ISC
79 *
80 * This source code is licensed under the ISC license.
81 * See the LICENSE file in the root directory of this source tree.
82 */const FS=le("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}
82],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
83 * @license lucide-react v0.453.0 - ISC
84 *
85 * This source code is licensed under the ISC license.
86 * See the LICENSE file in the root directory of this source tree.
87 */const jo=le("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
88 * @license lucide-react v0.453.0 - ISC
89 *
90 * This source code is licensed under the ISC license.
91 * See the LICENSE file in the root directory of this source tree.
92 */const W9=le("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
93 * @license lucide-react v0.453.0 - ISC
94 *
95 * This source code is licensed under the ISC license.
96 * See the LICENSE file in the root directory of this source tree.
97 */const q9=le("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
98 * @license lucide-react v0.453.0 - ISC
99 *
100 * This source code is licensed under the ISC license.
101 * See the LICENSE file in the root directory of this source tree.
102 */const YI=le("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
103 * @license lucide-react v0.453.0 - ISC
104 *
105 * This source code is licensed under the ISC license.
106 * See the LICENSE file in the root directory of this source tree.
107 */const QI=le("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
108 * @license lucide-react v0.453.0 - ISC
109 *
110 * This source code is licensed under the ISC license.
111 * See the LICENSE file in the root directory of this source tree.
112 */const G9=le("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
113 * @license lucide-react v0.453.0 - ISC
114 *
115 * This source code is licensed under the ISC license.
116 * See the LICENSE file in the root directory of this source tree.
117 */const bt=le("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
118 * @license lucide-react v0.453.0 - ISC
119 *
120 * This source code is licensed under the ISC license.
121 * See the LICENSE file in the root directory of this source tree.
122 */const Ma=le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
123 * @license lucide-react v0.453.0 - ISC
124 *
125 * This source code is licensed under the ISC license.
126 * See the LICENSE file in the root directory of this source tree.
127 */const To=le("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
128 * @license lucide-react v0.453.0 - ISC
129 *
130 * This source code is licensed under the ISC license.
131 * See the LICENSE file in the root directory of this source tree.
132 */const Ar=le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
133 * @license lucide-react v0.453.0 - ISC
134 *
135 * This source code is licensed under the ISC license.
136 * See the LICENSE file in the root directory of this source tree.
137 */const K9=le("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
138 * @license lucide-react v0.453.0 - ISC
139 *
140 * This source code is licensed under the ISC license.
141 * See the LICENSE file in the root directory of this source tree.
142 */const Y9=le("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
143 * @license lucide-react v0.453.0 - ISC
144 *
145 * This source code is licensed under the ISC license.
146 * See the LICENSE file in the root directory of this source tree.
147 */const xi=le("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
148 * @license lucide-react v0.453.0 - ISC
149 *
150 * This source code is licensed under the ISC license.
151 * See the LICENSE file in the root directory of this source tree.
152 */const Jo=le("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
153 * @license lucide-react v0.453.0 - ISC
154 *
155 * This source code is licensed under the ISC license.
156 * See the LICENSE file in the root directory of this source tree.
157 */const Nb=le("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
158 * @license lucide-react v0.453.0 - ISC
159 *
160 * This source code is licensed under the ISC license.
161 * See the LICENSE file in the root directory of this source tree.
162 */const ZI=le("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
163 * @license lucide-react v0.453.0 - ISC
164 *
165 * This source code is licensed under the ISC license.
166 * See the LICENSE file in the root directory of this source tree.
167 */const Q9=le("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
168 * @license lucide-react v0.453.0 - ISC
169 *
170 * This source code is licensed under the ISC license.
171 * See the LICENSE file in the root directory of this source tree.
172 */const Z9=le("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
173 * @license lucide-react v0.453.0 - ISC
174 *
175 * This source code is licensed under the ISC license.
176 * See the LICENSE file in the root directory of this source tree.
177 */const XI=le("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
178 * @license lucide-react v0.453.0 - ISC
179 *
180 * This source code is licensed under the ISC license.
181 * See the LICENSE file in the root directory of this source tree.
182 */const X9=le("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
183 * @license lucide-react v0.453.0 - ISC
184 *
185 * This source code is licensed under the ISC license.
186 * See the LICENSE file in the root directory of this source tree.
187 */const JI=le("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
188 * @license lucide-react v0.453.0 - ISC
189 *
190 * This source code is licensed under the ISC license.
191 * See the LICENSE file in the root directory of this source tree.
192 */const Cb=le("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
193 * @license lucide-react v0.453.0 - ISC
194 *
195 * This source code is licensed under the ISC license.
196 * See the LICENSE file in the root directory of this source tree.
197 */const J9=le("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
198 * @license lucide-react v0.453.0 - ISC
199 *
200 * This source code is licensed under the ISC license.
201 * See the LICENSE file in the root directory of this source tree.
202 */const eH=le("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
203 * @license lucide-react v0.453.0 - ISC
204 *
205 * This source code is licensed under the ISC license.
206 * See the LICENSE file in the root directory of this source tree.
207 */const $S=le("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
208 * @license lucide-react v0.453.0 - ISC
209 *
210 * This source code is licensed under the ISC license.
211 * See the LICENSE file in the root directory of this source tree.
212 */const Cr=le("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
213 * @license lucide-react v0.453.0 - ISC
214 *
215 * This source code is licensed under the ISC license.
216 * See the LICENSE file in the root directory of this source tree.
217 */const eR=le("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
218 * @license lucide-react v0.453.0 - ISC
219 *
220 * This source code is licensed under the ISC license.
221 * See the LICENSE file in the root directory of this source tree.
222 */const tH=le("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
223 * @license lucide-react v0.453.0 - ISC
224 *
225 * This source code is licensed under the ISC license.
226 * See the LICENSE file in the root directory of this source tree.
227 */const nH=le("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
228 * @license lucide-react v0.453.0 - ISC
229 *
230 * This source code is licensed under the ISC license.
231 * See the LICENSE file in the root directory of this source tree.
232 */const Cl=le("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
233 * @license lucide-react v0.453.0 - ISC
234 *
235 * This source code is licensed under the ISC license.
236 * See the LICENSE file in the root directory of this source tree.
237 */const rH=le("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
238 * @license lucide-react v0.453.0 - ISC
239 *
240 * This source code is licensed under the ISC license.
241 * See the LICENSE file in the root directory of this source tree.
242 */const tR=le("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
243 * @license lucide-react v0.453.0 - ISC
244 *
245 * This source code is licensed under the ISC license.
246 * See the LICENSE file in the root directory of this source tree.
247 */const sH=le("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
248 * @license lucide-react v0.453.0 - ISC
249 *
250 * This source code is licensed under the ISC license.
251 * See the LICENSE file in the root directory of this source tree.
252 */const vx=le("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/**
253 * @license lucide-react v0.453.0 - ISC
254 *
255 * This source code is licensed under the ISC license.
256 * See the LICENSE file in the root directory of this source tree.
257 */const Nr=le("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
258 * @license lucide-react v0.453.0 - ISC
259 *
260 * This source code is licensed under the ISC license.
261 * See the LICENSE file in the root directory of this source tree.
262 */const iH=le("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
263 * @license lucide-react v0.453.0 - ISC
264 *
265 * This source code is licensed under the ISC license.
266 * See the LICENSE file in the root directory of this source tree.
267 */const nR=le("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
268 * @license lucide-react v0.453.0 - ISC
269 *
270 * This source code is licensed under the ISC license.
271 * See the LICENSE file in the root directory of this source tree.
272 */const oH=le("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
273 * @license lucide-react v0.453.0 - ISC
274 *
275 * This source code is licensed under the ISC license.
276 * See the LICENSE file in the root directory of this source tree.
277 */const aH=le("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
278 * @license lucide-react v0.453.0 - ISC
279 *
280 * This source code is licensed under the ISC license.
281 * See the LICENSE file in the root directory of this source tree.
282 */const Bd=le("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
283 * @license lucide-react v0.453.0 - ISC
284 *
285 * This source code is licensed under the ISC license.
286 * See the LICENSE file in the root directory of this source tree.
287 */const lH=le("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
288 * @license lucide-react v0.453.0 - ISC
289 *
290 * This source code is licensed under the ISC license.
291 * See the LICENSE file in the root directory of this source tree.
292 */const cH=le("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
293 * @license lucide-react v0.453.0 - ISC
294 *
295 * This source code is licensed under the ISC license.
296 * See the LICENSE file in the root directory of this source tree.
297 */const uH=le("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
298 * @license lucide-react v0.453.0 - ISC
299 *
300 * This source code is licensed under the ISC license.
301 * See the LICENSE file in the root directory of this source tree.
302 */const dH=le("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/**
303 * @license lucide-react v0.453.0 - ISC
304 *
305 * This source code is licensed under the ISC license.
306 * See the LICENSE file in the root directory of this source tree.
307 */const VS=le("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
308 * @license lucide-react v0.453.0 - ISC
309 *
310 * This source code is licensed under the ISC license.
311 * See the LICENSE file in the root directory of this source tree.
312 */const yx=le("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
313 * @license lucide-react v0.453.0 - ISC
314 *
315 * This source code is licensed under the ISC license.
316 * See the LICENSE file in the root directory of this source tree.
317 */const hH=le("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
318 * @license lucide-react v0.453.0 - ISC
319 *
320 * This source code is licensed under the ISC license.
321 * See the LICENSE file in the root directory of this source tree.
322 */const rR=le("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
323 * @license lucide-react v0.453.0 - ISC
324 *
325 * This source code is licensed under the ISC license.
326 * See the LICENSE file in the root directory of this source tree.
327 */const ct=le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
328 * @license lucide-react v0.453.0 - ISC
329 *
330 * This source code is licensed under the ISC license.
331 * See the LICENSE file in the root directory of this source tree.
332 */const jb=le("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
333 * @license lucide-react v0.453.0 - ISC
334 *
335 * This source code is licensed under the ISC license.
336 * See the LICENSE file in the root directory of this source tree.
337 */const ud=le("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
338 * @license lucide-react v0.453.0 - ISC
339 *
340 * This source code is licensed under the ISC license.
341 * See the LICENSE file in the root directory of this source tree.
342 */const nm=le("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
343 * @license lucide-react v0.453.0 - ISC
344 *
345 * This source code is licensed under the ISC license.
346 * See the LICENSE file in the root directory of this source tree.
347 */const rm=le("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
348 * @license lucide-react v0.453.0 - ISC
349 *
350 * This source code is licensed under the ISC license.
351 * See the LICENSE file in the root directory of this source tree.
352 */const sm=le("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
353 * @license lucide-react v0.453.0 - ISC
354 *
355 * This source code is licensed under the ISC license.
356 * See the LICENSE file in the root directory of this source tree.
357 */const sR=le("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
358 * @license lucide-react v0.453.0 - ISC
359 *
360 * This source code is licensed under the ISC license.
361 * See the LICENSE file in the root directory of this source tree.
362 */const iR=le("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/**
363 * @license lucide-react v0.453.0 - ISC
364 *
365 * This source code is licensed under the ISC license.
366 * See the LICENSE file in the root directory of this source tree.
367 */const tl=le("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
368 * @license lucide-react v0.453.0 - ISC
369 *
370 * This source code is licensed under the ISC license.
371 * See the LICENSE file in the root directory of this source tree.
372 */const fH=le("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
373 * @license lucide-react v0.453.0 - ISC
374 *
375 * This source code is licensed under the ISC license.
376 * See the LICENSE file in the root directory of this source tree.
377 */const Tb=le("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
378 * @license lucide-react v0.453.0 - ISC
379 *
380 * This source code is licensed under the ISC license.
381 * See the LICENSE file in the root directory of this source tree.
382 */const pH=le("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
383 * @license lucide-react v0.453.0 - ISC
384 *
385 * This source code is licensed under the ISC license.
386 * See the LICENSE file in the root directory of this source tree.
387 */const nc=le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
388 * @license lucide-react v0.453.0 - ISC
389 *
390 * This source code is licensed under the ISC license.
391 * See the LICENSE file in the root directory of this source tree.
392 */const dd=le("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
393 * @license lucide-react v0.453.0 - ISC
394 *
395 * This source code is licensed under the ISC license.
396 * See the LICENSE file in the root directory of this source tree.
397 */const mH=le("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
398 * @license lucide-react v0.453.0 - ISC
399 *
400 * This source code is licensed under the ISC license.
401 * See the LICENSE file in the root directory of this source tree.
402 */const Pb=le("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
403 * @license lucide-react v0.453.0 - ISC
404 *
405 * This source code is licensed under the ISC license.
406 * See the LICENSE file in the root directory of this source tree.
407 */const gH=le("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
408 * @license lucide-react v0.453.0 - ISC
409 *
410 * This source code is licensed under the ISC license.
411 * See the LICENSE file in the root directory of this source tree.
412 */const oR=le("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/**
413 * @license lucide-react v0.453.0 - ISC
414 *
415 * This source code is licensed under the ISC license.
416 * See the LICENSE file in the root directory of this source tree.
417 */const hd=le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
418 * @license lucide-react v0.453.0 - ISC
419 *
420 * This source code is licensed under the ISC license.
421 * See the LICENSE file in the root directory of this source tree.
422 */const Xg=le("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
423 * @license lucide-react v0.453.0 - ISC
424 *
425 * This source code is licensed under the ISC license.
426 * See the LICENSE file in the root directory of this source tree.
427 */const vH=le("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
428 * @license lucide-react v0.453.0 - ISC
429 *
430 * This source code is licensed under the ISC license.
431 * See the LICENSE file in the root directory of this source tree.
432 */const yH=le("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
433 * @license lucide-react v0.453.0 - ISC
434 *
435 * This source code is licensed under the ISC license.
436 * See the LICENSE file in the root directory of this source tree.
437 */const im=le("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
438 * @license lucide-react v0.453.0 - ISC
439 *
440 * This source code is licensed under the ISC license.
441 * See the LICENSE file in the root directory of this source tree.
442 */const Ud=le("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
442y:"oel41y"}]]);/**
443 * @license lucide-react v0.453.0 - ISC
444 *
445 * This source code is licensed under the ISC license.
446 * See the LICENSE file in the root directory of this source tree.
447 */const xH=le("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
448 * @license lucide-react v0.453.0 - ISC
449 *
450 * This source code is licensed under the ISC license.
451 * See the LICENSE file in the root directory of this source tree.
452 */const Ab=le("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/**
453 * @license lucide-react v0.453.0 - ISC
454 *
455 * This source code is licensed under the ISC license.
456 * See the LICENSE file in the root directory of this source tree.
457 */const vo=le("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
458 * @license lucide-react v0.453.0 - ISC
459 *
460 * This source code is licensed under the ISC license.
461 * See the LICENSE file in the root directory of this source tree.
462 */const BS=le("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
463 * @license lucide-react v0.453.0 - ISC
464 *
465 * This source code is licensed under the ISC license.
466 * See the LICENSE file in the root directory of this source tree.
467 */const bH=le("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
468 * @license lucide-react v0.453.0 - ISC
469 *
470 * This source code is licensed under the ISC license.
471 * See the LICENSE file in the root directory of this source tree.
472 */const xx=le("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
473 * @license lucide-react v0.453.0 - ISC
474 *
475 * This source code is licensed under the ISC license.
476 * See the LICENSE file in the root directory of this source tree.
477 */const wH=le("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
478 * @license lucide-react v0.453.0 - ISC
479 *
480 * This source code is licensed under the ISC license.
481 * See the LICENSE file in the root directory of this source tree.
482 */const _H=le("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
483 * @license lucide-react v0.453.0 - ISC
484 *
485 * This source code is licensed under the ISC license.
486 * See the LICENSE file in the root directory of this source tree.
487 */const aR=le("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
488 * @license lucide-react v0.453.0 - ISC
489 *
490 * This source code is licensed under the ISC license.
491 * See the LICENSE file in the root directory of this source tree.
492 */const Ib=le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
493 * @license lucide-react v0.453.0 - ISC
494 *
495 * This source code is licensed under the ISC license.
496 * See the LICENSE file in the root directory of this source tree.
497 */const kH=le("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
498 * @license lucide-react v0.453.0 - ISC
499 *
500 * This source code is licensed under the ISC license.
501 * See the LICENSE file in the root directory of this source tree.
502 */const SH=le("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
503 * @license lucide-react v0.453.0 - ISC
504 *
505 * This source code is licensed under the ISC license.
506 * See the LICENSE file in the root directory of this source tree.
507 */const bi=le("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
508 * @license lucide-react v0.453.0 - ISC
509 *
510 * This source code is licensed under the ISC license.
511 * See the LICENSE file in the root directory of this source tree.
512 */const fd=le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
513 * @license lucide-react v0.453.0 - ISC
514 *
515 * This source code is licensed under the ISC license.
516 * See the LICENSE file in the root directory of this source tree.
517 */const rc=le("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
518 * @license lucide-react v0.453.0 - ISC
519 *
520 * This source code is licensed under the ISC license.
521 * See the LICENSE file in the root directory of this source tree.
522 */const lR=le("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
523 * @license lucide-react v0.453.0 - ISC
524 *
525 * This source code is licensed under the ISC license.
526 * See the LICENSE file in the root directory of this source tree.
527 */const cR=le("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
528 * @license lucide-react v0.453.0 - ISC
529 *
530 * This source code is licensed under the ISC license.
531 * See the LICENSE file in the root directory of this source tree.
532 */const EH=le("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
533 * @license lucide-react v0.453.0 - ISC
534 *
535 * This source code is licensed under the ISC license.
536 * See the LICENSE file in the root directory of this source tree.
537 */const vn=le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
537],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
538 * @license lucide-react v0.453.0 - ISC
539 *
540 * This source code is licensed under the ISC license.
541 * See the LICENSE file in the root directory of this source tree.
542 */const om=le("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function uR(){const[,e]=Pt();return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundImage:"url('/auth.png')",backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"},children:a.jsxs("div",{className:"max-w-md w-full text-center px-4",children:[a.jsx("div",{className:"mb-4 flex justify-center",children:a.jsx("img",{src:"/api/assets/404.png",alt:"404 Not Found",className:"h-60 w-auto"})}),a.jsxs("div",{className:"mb-8",children:[a.jsx("h1",{className:"text-6xl font-bold text-gray-900 dark:text-white mb-4",children:"404"}),a.jsx("h2",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Page Not Found"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"The page you're looking for doesn't exist or has been moved. Your REP status tracking is still safe with us!"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ie,{onClick:()=>e("/dashboard"),className:"w-full bg-blue-600 hover:bg-blue-700 text-white",size:"lg",children:[a.jsx(Bd,{className:"h-5 w-5 mr-2"}),"Go to Dashboard"]}),a.jsxs(ie,{onClick:()=>e("/"),variant:"outline",className:"w-full",size:"lg",children:[a.jsx(Eb,{className:"h-5 w-5 mr-2"}),"Back to REPSShield.com"]})]}),a.jsxs("div",{className:"mt-8 p-4 bg-white/90 dark:bg-gray-800/90 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[a.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-2",children:[a.jsx(Ud,{className:"h-5 w-5 text-blue-600"}),a.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:"Need Help?"})]}),a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["If you believe this is an error, please contact"," ",a.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 hover:underline",children:"[email protected]"})," ","or return to your dashboard to continue tracking your Real Estate Professional status."]})]}),a.jsx("div",{className:"mt-8 text-center",children:a.jsxs("div",{className:"flex items-center justify-center space-x-2 text-gray-500 dark:text-gray-400",children:[a.jsx("img",{src:"/repsshield-logo-icon.png",alt:"REPSShield",className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:"REPSShield - Your Shield Against Audit Risks"})]})})]})})}const NH=m.lazy(()=>ve(()=>import("./AgenticOnboarding-O2_iyJeC.js"),__vite__mapDeps([75,1,76,77,78,79,10,33])));function CH(){return a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full"})})}function jH({user:e,userData:t,location:n,children:r}){const s=(t==null?void 0:t.accountOwnerId)!=null;return e&&t&&t.hasCompletedOnboardingForm!==!0&&!s&&n!=="/onboarding"?a.jsx(m.Suspense,{fallback:a.jsx(CH,{}),children:a.jsx(NH,{onComplete:()=>{window.location.href="/dashboard"}})}):a.jsx(a.Fragment,{children:r})}function TH(){const[e,t]=Pt(),[n,r]=m.useState(()=>{if(typeof window<"u"){const i=localStorage.getItem("repsshield-member-sidebar-expanded");return i!==null?JSON.parse(i):!0}return!0});m.useEffect(()=>{typeof window<"u"&&localStorage.setItem("repsshield-member-sidebar-expanded",JSON.stringify(n))},[n]);const s=[{path:"/member/time-entries",label:"My Time Entries",icon:JI},{path:"/member/stats",label:"My Statistics",icon:QI},{path:"/member/profile",label:"My Profile",icon:rc}];return a.jsxs("aside",{className:`hidden md:flex flex-col bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 transition-[width] duration-200 overflow-hidden ${n?"w-72":"w-16"}`,children:[a.jsxs("div",{className:"h-16 px-4 flex items-center justify-between border-b border-gray-200 dark:border-gray-700",children:[n&&a.jsxs(De,{href:"/member/time-entries",className:"flex items-center gap-3 min-w-0 hover:opacity-80 transition-opacity hover:no-underline focus:no-underline",onClick:()=>t("/member/time-entries"),children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield Logo",className:"w-8 h-8 flex-shrink-0"}),a.jsx("span",{className:"font-semibold text-lg text-gray-900 dark:text-white truncate",children:"REPSShield"})]}),a.jsx(ie,{variant:"ghost",size:"icon",className:n?"ml-auto":"mx-auto",onClick:()=>r(!n),"aria-expanded":n,"aria-label":n?"Collapse sidebar":"Expand sidebar",children:a.jsx(sm,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 flex flex-col p-4 overflow-y-auto",children:[a.jsx("nav",{className:"space-y-4 mt
542-4",role:"navigation",children:s.map(i=>{const o=i.icon,l=e===i.path;return a.jsxs(De,{href:i.path,className:`flex items-center rounded-md text-base font-medium transition-colors group ${n?"px-3 py-2.5":"px-0 py-2 justify-center"} ${l?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100 hover:no-underline focus:no-underline":"text-blue-700 hover:bg-blue-50 hover:text-blue-800 dark:text-blue-200 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline"}`,onClick:c=>{c.metaKey||c.ctrlKey||c.shiftKey||c.altKey||c.button!==0||(c.preventDefault(),t(i.path))},"aria-current":l?"page":void 0,"aria-label":n?void 0:i.label,title:n?void 0:i.label,children:[a.jsx(o,{className:"w-5 h-5 flex-shrink-0"}),n&&a.jsx("span",{className:"ml-2.5 truncate",children:i.label})]},i.path)})}),a.jsx("div",{className:"mt-auto pt-6",children:a.jsx("div",{className:`px-3 py-2 rounded-md bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 ${!n&&"px-0 py-2 flex justify-center"}`,children:n?a.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300 font-medium text-center",children:"Team Member Portal"}):a.jsx(rc,{className:"w-4 h-4 text-blue-700 dark:text-blue-300"})})})]})]})}function he(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function yn(e,t=[]){let n=[];function r(i,o){const l=m.createContext(o);l.displayName=i+"Context";const c=n.length;n=[...n,o];const u=h=>{var x;const{scope:f,children:p,...g}=h,v=((x=f==null?void 0:f[e])==null?void 0:x[c])||l,y=m.useMemo(()=>g,Object.values(g));return a.jsx(v.Provider,{value:y,children:p})};u.displayName=i+"Provider";function d(h,f){var v;const p=((v=f==null?void 0:f[e])==null?void 0:v[c])||l,g=m.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>m.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,PH(s,...t)]}function PH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var nn=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},AH=z0[" useInsertionEffect ".trim().toString()]||nn;function cr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=IH({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=m.useCallback(d=>{var h;if(l){const f=RH(d)?d(e):d;f!==e&&((h=o.current)==null||h.call(o,f))}else i(d)},[l,e,i,o]);return[c,u]}function IH({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),i=m.useRef(t);return AH(()=>{i.current=t},[t]),m.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function RH(e){return typeof e=="function"}var MH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=MH.reduce((e,t)=>{const n=go(`Primitive.${t}`),r=m.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rb(e,t){e&&Ia.flushSync(()=>e.dispatchEvent(t))}function _c(e){const t=e+"CollectionProvider",[n,r]=yn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:y,children:x}=v,b=m.useRef(null),w=m.useRef(new Map).current;return a.jsx(s,{scope:y,itemMap:w,collectionRef:b,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=go(l),u=m.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=i(l,x),S=He(y,w.collectionRef);return a.jsx(c,{ref:S,children:b})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",f=go(d),p=m.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=m.useRef(null),_=He(y,S),E=i(d,x);return m.useEffect(()=>(E.itemMap.set(S,{ref:S,...w}),()=>void E.itemMap.delete(S))),a.jsx(f,{[h]:"",ref:_,children:b})});p.displayName=d;function g(v){const y=i(e+"CollectionConsumer",v);return m.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((E,R)=>w.indexOf(E.ref.current)-w.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,r]}var OH=m.createContext(void 0);function Oa(e){const t=m.useContext(OH);return e||t||"ltr"}function tn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function DH(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}
542var LH="DismissableLayer",bx="dismissableLayer.update",FH="dismissableLayer.pointerDownOutside",$H="dismissableLayer.focusOutside",US,Mb=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Da=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:c,...u}=e,d=m.useContext(Mb),[h,f]=m.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=m.useState({}),v=He(t,N=>f(N)),y=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(x),w=h?y.indexOf(h):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,_=w>=b,E=m.useRef(!1),R=UH(N=>{const k=N.target;if(!(k instanceof Node))return;const T=[...d.branches].some(I=>I.contains(k));!_||T||(i==null||i(N),l==null||l(N),N.defaultPrevented||c==null||c())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:d.dismissableSurfaces}),A=zH(N=>{if(r&&E.current)return;const k=N.target;[...d.branches].some(I=>I.contains(k))||(o==null||o(N),l==null||l(N),N.defaultPrevented||c==null||c())},p);return DH(N=>{w===d.layers.size-1&&(s==null||s(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))},p),m.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(US=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),zS(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=US))}},[h,p,n,d]),m.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),zS())},[h,d]),m.useEffect(()=>{const N=()=>g({});return document.addEventListener(bx,N),()=>document.removeEventListener(bx,N)},[]),a.jsx(we.div,{...u,ref:v,style:{pointerEvents:S?_?"auto":"none":void 0,...e.style},onFocusCapture:he(e.onFocusCapture,A.onFocusCapture),onBlurCapture:he(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:he(e.onPointerDownCapture,R.onPointerDownCapture)})});Da.displayName=LH;var VH="DismissableLayerBranch",dR=m.forwardRef((e,t)=>{const n=m.useContext(Mb),r=m.useRef(null),s=He(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(we.div,{...e,ref:s})});dR.displayName=VH;function BH(){const e=m.useContext(Mb),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function UH(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=tn(e),l=m.useRef(!1),c=m.useRef(!1),u=m.useRef(new Map),d=m.useRef(()=>{});return m.useEffect(()=>{function h(){c.current=!1,s.current=!1,u.current.clear()}function f(){return Array.from(u.current.values()).some(Boolean)}function p(b){if(!c.current)return;const w=b.target;w instanceof Node&&[...i].some(_=>_.contains(w))||u.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}function g(b){c.current&&u.current.set(b.type,!1)}const v=b=>{if(b.target&&!l.current){let w=function(){n.removeEventListener("click",d.current);const _=f();h(),_||hR(FH,o,S,{discrete:!0})};const S={originalEvent:b};c.current=!0,s.current=r&&b.button===0,u.current.clear(),!r||b.button!==0?w():(n.removeEventListener("click",d.current),d.current=w,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),h();l.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of y)n.addEventListener(b,p,!0),n.addEventListener(b,g);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",d.current);for(const b of y)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>l.current=!0}}function zH(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=m.useRef(!1);return m.useEffect(()=>{const s=i=>{i.target&&!r.current&&hR($H,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function zS(){const e=new CustomEvent(bx);document.dispatchEvent(e)}function hR(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Rb(s,i):s.dispatchEvent(i)}var HH=Da,WH=dR,Ph=0,ms=null;function am(){m.useEffect(()=>{ms||(ms={start:HS(),end:HS()});const{start:e,end:t}=ms;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ph++,()=>{Ph===1&&(ms==null||ms.start.remove(),ms==null||ms.end.remove(),ms=null),Ph=Math.max(0,Ph-1)}},[])}function HS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.
vendor: 5,698 bytes, line 542
542style.position="fixed",e.style.pointerEvents="none",e}var Jg="focusScope.autoFocusOnMount",ev="focusScope.autoFocusOnUnmount",WS={bubbles:!1,cancelable:!0},qH="FocusScope",zd=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=m.useState(null),u=tn(s),d=tn(i),h=m.useRef(null),f=He(t,v=>c(v)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(w){if(p.paused||!l)return;const S=w.target;l.contains(S)?h.current=S:Bi(h.current,{select:!0})},y=function(w){if(p.paused||!l)return;const S=w.relatedTarget;S!==null&&(l.contains(S)||Bi(h.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const _ of w)_.removedNodes.length>0&&Bi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),b.disconnect()}}},[r,l,p.paused]),m.useEffect(()=>{if(l){GS.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(Jg,WS);l.addEventListener(Jg,u),l.dispatchEvent(x),x.defaultPrevented||(GH(XH(fR(l)),{select:!0}),document.activeElement===v&&Bi(l))}return()=>{l.removeEventListener(Jg,u),setTimeout(()=>{const x=new CustomEvent(ev,WS);l.addEventListener(ev,d),l.dispatchEvent(x),x.defaultPrevented||Bi(v??document.body,{select:!0}),l.removeEventListener(ev,d),GS.remove(p)},0)}}},[l,u,d,p]);const g=m.useCallback(v=>{if(!n&&!r||p.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(y&&x){const b=v.currentTarget,[w,S]=KH(b);w&&S?!v.shiftKey&&x===S?(v.preventDefault(),n&&Bi(w,{select:!0})):v.shiftKey&&x===w&&(v.preventDefault(),n&&Bi(S,{select:!0})):x===b&&v.preventDefault()}},[n,r,p.paused]);return a.jsx(we.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});zd.displayName=qH;function GH(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bi(r,{select:t}),document.activeElement!==n)return}function KH(e){const t=fR(e),n=qS(t,e),r=qS(t.reverse(),e);return[n,r]}function fR(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qS(e,t){for(const n of e)if(!YH(n,{upTo:t}))return n}function YH(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function QH(e){return e instanceof HTMLInputElement&&"select"in e}function Bi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&QH(e)&&t&&e.select()}}var GS=ZH();function ZH(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=KS(e,t),e.unshift(t)},remove(t){var n;e=KS(e,t),(n=e[0])==null||n.resume()}}}function KS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XH(e){return e.filter(t=>t.tagName!=="A")}var JH=z0[" useId ".trim().toString()]||(()=>{}),e8=0;function dn(e){const[t,n]=m.useState(JH());return nn(()=>{n(r=>r??String(e8++))},[e]),t?`radix-${t}`:""}const t8=["top","right","bottom","left"],yo=Math.min,kr=Math.max,Xf=Math.round,Ah=Math.floor,Ts=e=>({x:e,y:e}),n8={left:"right",right:"left",bottom:"top",top:"bottom"};function wx(e,t,n){return kr(e,yo(t,n))}function wi(e,t){return typeof e=="function"?e(t):e}function _i(e){return e.split("-")[0]}function kc(e){return e.split("-")[1]}function Ob(e){return e==="x"?"y":"x"}function Db(e){return e==="y"?"height":"width"}function Es(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Lb(e){return Ob(Es(e))}function r8(e,t,n){n===void 0&&(n=!1);const r=kc(e),s=Lb(e),i=Db(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Jf(o)),[o,Jf(o)]}function s8(e){const t=Jf(e);return[_x(e),t,_x(t)]}function _x(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const YS=["left","right"],QS=["right","left"],i8=["top","bottom"],o8=["bottom","top"];function a8(e,t,n){switch(e){case"top":case"bottom":return n?t?QS:YS:t?YS:QS;case"left":case"right":return t?i8:o8;default:return[]}}function l8(e,t,n,r){const s=kc(e);let i=a8(_i(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(_x)))),i}function Jf(e){const t=_i(e);return n8[t]+e.slice(t.length)}function c8(e){return{top:0,right:0,bottom:0,left:0,...e}}function pR(e){return typeof e!="number"?c8(e):{top:e,right:e,bottom:e,left:e}}function ep(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function ZS(e,t,n){let{reference:r,floating:s}=e;const i=Es(t),o=Lb(t),l=Db(o),c=_i(t),u=i==="y",d=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-s.width,y:h};break;default:p={x:r.x,y:r.y}}switch(kc(t)){case"start":p[o]-=f*(n&&u?-1:1);break;case"end":p[o]+=f*(n&&u?-1:1);break}return p}async function u8(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=wi(t,e),g=pR(p),y=l[f?h==="floating"?"reference":"floating":h],x=ep(await i.getClippingRect
vendor: 4,808 bytes, line 542
542({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),b=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},_=ep(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(x.top-_.top+g.top)/S.y,bottom:(_.bottom-x.bottom+g.bottom)/S.y,left:(x.left-_.left+g.left)/S.x,right:(_.right-x.right+g.right)/S.x}}const d8=50,h8=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:u8},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:h}=ZS(u,r,c),f=r,p=0;const g={};for(let v=0;v<i.length;v++){const y=i[v];if(!y)continue;const{name:x,fn:b}=y,{x:w,y:S,data:_,reset:E}=await b({x:d,y:h,initialPlacement:r,placement:f,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});d=w??d,h=S??h,g[x]={...g[x],..._},E&&p<d8&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(u=E.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:d,y:h}=ZS(u,f,c)),v=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:g}},f8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=wi(e,t)||{};if(u==null)return{};const h=pR(d),f={x:n,y:r},p=Lb(s),g=Db(p),v=await o.getDimensions(u),y=p==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=i.reference[g]+i.reference[p]-f[p]-i.floating[g],_=f[p]-i.reference[p],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let R=E?E[w]:0;(!R||!await(o.isElement==null?void 0:o.isElement(E)))&&(R=l.floating[w]||i.floating[g]);const A=S/2-_/2,N=R/2-v[g]/2-1,k=yo(h[x],N),T=yo(h[b],N),I=k,F=R-v[g]-T,L=R/2-v[g]/2+A,M=wx(I,L,F),$=!c.arrow&&kc(s)!=null&&L!==M&&i.reference[g]/2-(L<I?k:T)-v[g]/2<0,j=$?L<I?L-I:L-F:0;return{[p]:f[p]+j,data:{[p]:M,centerOffset:L-M-j,...$&&{alignmentOffset:j}},reset:$}}}),p8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...y}=wi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=_i(s),b=Es(l),w=_i(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=f||(w||!v?[Jf(l)]:s8(l)),E=g!=="none";!f&&E&&_.push(...l8(l,v,g,S));const R=[l,..._],A=await c.detectOverflow(t,y),N=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&N.push(A[x]),h){const L=r8(s,o,S);N.push(A[L[0]],A[L[1]])}if(k=[...k,{placement:s,overflows:N}],!N.every(L=>L<=0)){var T,I;const L=(((T=i.flip)==null?void 0:T.index)||0)+1,M=R[L];if(M&&(!(h==="alignment"?b!==Es(M):!1)||k.every(P=>Es(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:L,overflows:k},reset:{placement:M}};let $=(I=k.filter(j=>j.overflows[0]<=0).sort((j,P)=>j.overflows[1]-P.overflows[1])[0])==null?void 0:I.placement;if(!$)switch(p){case"bestFit":{var F;const j=(F=k.filter(P=>{if(E){const D=Es(P.placement);return D===b||D==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(D=>D>0).reduce((D,C)=>D+C,0)]).sort((P,D)=>P[1]-D[1])[0])==null?void 0:F[0];j&&($=j);break}case"initialPlacement":$=l;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function XS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function JS(e){return t8.some(t=>e[t]>=0)}const m8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=wi(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=XS(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:JS(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),l=XS(o,n.floating);return{data:{escapedOffsets:l,escaped:JS(l)}}}default:return{}}}}},mR=new Set(["left","top"]);async function g8(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=_i(n),l=kc(n),c=Es(n)==="y",u=mR.has(o)?-1:1,d=i&&c?-1:1,h=wi(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}
542:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const v8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await g8(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},y8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...u}=wi(e,t),d={x:n,y:r},h=await i.detectOverflow(t,u),f=Es(_i(s)),p=Ob(f);let g=d[p],v=d[f];if(o){const x=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=g+h[x],S=g-h[b];g=wx(w,g,S)}if(l){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=v+h[x],S=v-h[b];v=wx(w,v,S)}const y=c.fn({...t,[p]:g,[f]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:o,[f]:l}}}}}},x8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=wi(e,t),d={x:n,y:r},h=Es(s),f=Ob(h);let p=d[f],g=d[h];const v=wi(l,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const w=f==="y"?"height":"width",S=i.reference[f]-i.floating[w]+y.mainAxis,_=i.reference[f]+i.reference[w]-y.mainAxis;p<S?p=S:p>_&&(p=_)}if(u){var x,b;const w=f==="y"?"width":"height",S=mR.has(_i(s)),_=i.reference[h]-i.floating[w]+(S&&((x=o.offset)==null?void 0:x[h])||0)+(S?0:y.crossAxis),E=i.reference[h]+i.reference[w]+(S?0:((b=o.offset)==null?void 0:b[h])||0)-(S?y.crossAxis:0);g<_?g=_:g>E&&(g=E)}return{[f]:p,[h]:g}}}},b8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=wi(e,t),d=await o.detectOverflow(t,u),h=_i(s),f=kc(s),p=Es(s)==="y",{width:g,height:v}=i.floating;let y,x;h==="top"||h==="bottom"?(y=h,x=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(x=h,y=f==="end"?"top":"bottom");const b=v-d.top-d.bottom,w=g-d.left-d.right,S=yo(v-d[y],b),_=yo(g-d[x],w),E=!t.middlewareData.shift;let R=S,A=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=b),E&&!f){const k=kr(d.left,0),T=kr(d.right,0),I=kr(d.top,0),F=kr(d.bottom,0);p?A=g-2*(k!==0||T!==0?k+T:kr(d.left,d.right)):R=v-2*(I!==0||F!==0?I+F:kr(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:R});const N=await o.getDimensions(l.floating);return g!==N.width||v!==N.height?{reset:{rects:!0}}:{}}}};function lm(){return typeof window<"u"}function Sc(e){return gR(e)?(e.nodeName||"").toLowerCase():"#document"}function jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bs(e){var t;return(t=(gR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gR(e){return lm()?e instanceof Node||e instanceof jr(e).Node:!1}function rs(e){return lm()?e instanceof Element||e instanceof jr(e).Element:!1}function Ci(e){return lm()?e instanceof HTMLElement||e instanceof jr(e).HTMLElement:!1}function eE(e){return!lm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jr(e).ShadowRoot}function Hd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ss(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function w8(e){return/^(table|td|th)$/.test(Sc(e))}function cm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _8=/transform|translate|scale|rotate|perspective|filter/,k8=/paint|layout|strict|content/,Uo=e=>!!e&&e!=="none";let tv;function Fb(e){const t=rs(e)?ss(e):e;return Uo(t.transform)||Uo(t.translate)||Uo(t.scale)||Uo(t.rotate)||Uo(t.perspective)||!$b()&&(Uo(t.backdropFilter)||Uo(t.filter))||_8.test(t.willChange||"")||k8.test(t.contain||"")}function S8(e){let t=xo(e);for(;Ci(t)&&!sc(t);){if(Fb(t))return t;if(cm(t))return null;t=xo(t)}return null}function $b(){return tv==null&&(tv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tv}function sc(e){return/^(html|body|#document)$/.test(Sc(e))}function ss(e){return jr(e).getComputedStyle(e)}function um(e){return rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xo(e){if(Sc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||eE(e)&&e.host||Bs(e);return eE(t)?t.host:t}function vR(e){const t=xo(e);return sc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ci(t)&&Hd(t)?t:vR(t)}
vendor: 10,452 bytes, line 542
542function pd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=vR(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=jr(s);if(i){const l=kx(o);return t.concat(o,o.visualViewport||[],Hd(s)?s:[],l&&n?pd(l):[])}else return t.concat(s,pd(s,[],n))}function kx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yR(e){const t=ss(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ci(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=Xf(n)!==i||Xf(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function Vb(e){return rs(e)?e:e.contextElement}function jl(e){const t=Vb(e);if(!Ci(t))return Ts(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=yR(t);let o=(i?Xf(n.width):n.width)/r,l=(i?Xf(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const E8=Ts(0);function xR(e){const t=jr(e);return!$b()||!t.visualViewport?E8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function N8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jr(e)?!1:t}function _a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Vb(e);let o=Ts(1);t&&(r?rs(r)&&(o=jl(r)):o=jl(e));const l=N8(i,n,r)?xR(i):Ts(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(i){const f=jr(i),p=r&&rs(r)?jr(r):r;let g=f,v=kx(g);for(;v&&r&&p!==g;){const y=jl(v),x=v.getBoundingClientRect(),b=ss(v),w=x.left+(v.clientLeft+parseFloat(b.paddingLeft))*y.x,S=x.top+(v.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,h*=y.y,c+=w,u+=S,g=jr(v),v=kx(g)}}return ep({width:d,height:h,x:c,y:u})}function dm(e,t){const n=um(e).scrollLeft;return t?t.left+n:_a(Bs(e)).left+n}function bR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-dm(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function C8(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Bs(r),l=t?cm(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Ts(1);const d=Ts(0),h=Ci(r);if((h||!h&&!i)&&((Sc(r)!=="body"||Hd(o))&&(c=um(r)),h)){const p=_a(r);u=jl(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const f=o&&!h&&!i?bR(o,c):Ts(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-c.scrollTop*u.y+d.y+f.y}}function j8(e){return Array.from(e.getClientRects())}function T8(e){const t=Bs(e),n=um(e),r=e.ownerDocument.body,s=kr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=kr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+dm(e);const l=-n.scrollTop;return ss(r).direction==="rtl"&&(o+=kr(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const tE=25;function P8(e,t){const n=jr(e),r=Bs(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const d=$b();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=dm(r);if(u<=0){const d=r.ownerDocument,h=d.body,f=getComputedStyle(h),p=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(r.clientWidth-h.clientWidth-p);g<=tE&&(i-=g)}else u<=tE&&(i+=u);return{width:i,height:o,x:l,y:c}}function A8(e,t){const n=_a(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ci(e)?jl(e):Ts(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function nE(e,t,n){let r;if(t==="viewport")r=P8(e,n);else if(t==="document")r=T8(Bs(e));else if(rs(t))r=A8(t,n);else{const s=xR(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ep(r)}function wR(e,t){const n=xo(e);return n===t||!rs(n)||sc(n)?!1:ss(n).position==="fixed"||wR(n,t)}function I8(e,t){const n=t.get(e);if(n)return n;let r=pd(e,[],!1).filter(l=>rs(l)&&Sc(l)!=="body"),s=null;const i=ss(e).position==="fixed";let o=i?xo(e):e;for(;rs(o)&&!sc(o);){const l=ss(o),c=Fb(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Hd(o)&&!c&&wR(e,o))?r=r.filter(d=>d!==o):s=l,o=xo(o)}return t.set(e,r),r}function R8(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?cm(t)?[]:I8(t,this._c):[].concat(n),r],l=nE(t,o[0],s);let c=l.top,u=l.right,d=l.bottom,h=l.left;for(let f=1;f<o.length;f++){const p=nE(t,o[f],s);c=kr(p.top,c),u=yo(p.right,u),d=yo(p.bottom,d),h=kr(p.left,h)}return{width:u-h,height:d-c,x:h,y:c}}function M8(e){const{width:t,height:n}=yR(e);return{width:t,height:n}}function O8(e,t,n){const r=Ci(t),s=Bs(t),i=n==="fixed",o=_a(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Ts(0);function u(){c.x=dm(s)}if(r||!r&&!i)if((Sc(t)!=="body"||Hd(s))&&(l=um(t)),r){const p=_a(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&u();i&&!r&&s&&u();const d=s&&!r&&!i?bR(s,l):Ts(0),h=o.left+l.scrollLeft-c.x-d.x,f=o.top+l.scrollTop-c.y-d.y;return{x:h,y:f,width:o.width,height:o.height}}function nv(e){return ss(e).position==="static"}function rE(e,t){if(!Ci(e)||ss(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Bs(e)===n&&(n=n.ownerDocument.body),n}function _R(e,t){const n=jr(e);if(cm(e))return n;if(!Ci(e)){let s=xo(e);for(;s&&!sc(s);){if(rs(s)&&!nv(s))return s;s=xo(s)}return n}let r=rE(e,t);for(;r&&w8(r)&&nv(r);)r=rE(r,t);return r&&sc(r)&&nv(r)&&!Fb(r)?n:r||S8(e)||n}const D8=async function(e){const t=this.getOffsetParent||_R,n=this.getDimensions,r=await n(e.floating);return{reference:O8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function L8(e){return ss(e).direction==="rtl"}const F8={convertOffsetParentRelativeRectToViewportRelativeRect:C8,getDocumentElement:Bs,getClippingRect:R8,getOffsetParent:_R,getElementRects:D8,getClientRects:j8,getDimensions:M8,getScale:jl,isElement:rs,isRTL:L8};function kR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $8(e,t){let n=null,r;const s=Bs(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(l||t(),!f||!p)return;const g=Ah(h),v=Ah(s.clientWidth-(d+f)),y=Ah(s.clientHeight-(h+p)),x=Ah(d),w={rootMargin:-g+"px "+-v+"px "+-y+"px "+-x+"px",threshold:kr(0,yo(1,c))||1};let S=!0;function _(E){const R=E[0].intersectionRatio;if(R!==c){if(!S)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!kR(u,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(_,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(_,w)}n.observe(e)}return o(!0),i}function V8(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Vb(e),d=s||i?[...u?pd(u):[],...t?pd(t):[]]:[];d.forEach(x=>{s&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const h=u&&l?$8(u,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,v=c?_a(e):null;c&&y();function y(){const x=_a(e);v&&!kR(v,x)&&n(),v=x,g=requestAnimationFrame(y)}return n(),()=>{var x;d.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),h==null||h(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const B8=v8,U8=y8,z8=p8,H8=b8,W8=m8,sE=f8,q8=x8,G8=(e,t,n)=>{const r=new Map,s={platform:F8,...n},i={...s.platform,_c:r};return h8(e,t,{...s,platform:i})};var K8=typeof document<"u",Y8=function(){},cf=K8?m.useLayoutEffect:Y8;function tp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!tp(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!tp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function SR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iE(e,t){const n=SR(e);return Math.round(t*n)/n}function rv(e){const t=m.useRef(e);return cf(()=>{t.current=e}),t}function Q8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);tp(f,r)||p(r);const[g,v]=m.useState(null),[y,x]=m.useState(null),b=m.useCallback(P=>{P!==E.current&&(E.current=P,v(P))},[]),w=m.useCallback(P=>{P!==R.current&&(R.current=P,x(P))},[]),S=i||g,_=o||y,E=m.useRef(null),R=m.useRef(null),A=m.useRef(d),N=c!=null,k=rv(c),T=rv(s),I=rv(u),F=m.useCallback(()=>{if(!E.current||!R.current)return;const P={placement:t,strategy:n,middleware:f};T.current&&(P.platform=T.current),G8(E.current,R.current,P).then(D=>{const C={...D,isPositioned:I.current!==!1};L.current&&!tp(A.current,C)&&(A.current=C,Ia.flushSync(()=>{h(C)}))})},[f,t,n,T,I]);cf(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[u]);const L=m.useRef(!1);cf(()=>(L.current=!0,()=>{L.current=!1}),[]),cf(()=>{if(S&&(E.current=S),_&&(R.current=_),S&&_){if(k.current)return k.current(S,_,F);F()}},[S,_,F,k,N]);const M=m.useMemo(()=>({reference:E,floating:R,setReference:b,setFloating:w}),[b,w]),$=m.useMemo(()=>({reference:S,floating:_}),[S,_]),j=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!$.floating)return P;const D=iE($.floating,d.x),C=iE($.floating,d.y);return l?{...P,transform:"translate("+D+"px, "+C+"px)",...SR($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:C}},[n,l,$.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:F,refs:M,elements:$,floatingStyles:j}),[d,F,M,$,j])}const Z8=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?sE({element:r.current,padding:s}).fn(n):{}:r?sE({element:r,padding:s}).fn(n):{}}}},X8=(e,t)=>{const n=B8(e);return{name:n.name,fn:n.fn,options:[e,t]}},J8=(e,t)=>
542{const n=U8(e);return{name:n.name,fn:n.fn,options:[e,t]}},e7=(e,t)=>({fn:q8(e).fn,options:[e,t]}),t7=(e,t)=>{const n=z8(e);return{name:n.name,fn:n.fn,options:[e,t]}},n7=(e,t)=>{const n=H8(e);return{name:n.name,fn:n.fn,options:[e,t]}},r7=(e,t)=>{const n=W8(e);return{name:n.name,fn:n.fn,options:[e,t]}},s7=(e,t)=>{const n=Z8(e);return{name:n.name,fn:n.fn,options:[e,t]}};var i7="Arrow",ER=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(we.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});ER.displayName=i7;var o7=ER;function Bb(e){const[t,n]=m.useState(void 0);return nn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ub="Popper",[NR,Po]=yn(Ub),[a7,CR]=NR(Ub),jR=e=>{const{__scopePopper:t,children:n}=e,[r,s]=m.useState(null),[i,o]=m.useState(void 0);return a.jsx(a7,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};jR.displayName=Ub;var TR="PopperAnchor",PR=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=CR(TR,n),o=m.useRef(null),l=i.onAnchorChange,c=m.useCallback(g=>{o.current=g,g&&l(g)},[l]),u=He(t,c),d=m.useRef(null);m.useEffect(()=>{if(!r)return;const g=d.current;d.current=r.current,g!==d.current&&l(d.current)});const h=i.placementState&&Hb(i.placementState),f=h==null?void 0:h[0],p=h==null?void 0:h[1];return r?null:a.jsx(we.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...s,ref:u})});PR.displayName=TR;var zb="PopperContent",[l7,c7]=NR(zb),AR=m.forwardRef((e,t)=>{var ne,re,J,ge,se,ke;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=e,y=CR(zb,n),[x,b]=m.useState(null),w=He(t,Me=>b(Me)),[S,_]=m.useState(null),E=Bb(S),R=(E==null?void 0:E.width)??0,A=(E==null?void 0:E.height)??0,N=r+(i!=="center"?"-"+i:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],I=T.length>0,F={padding:k,boundary:T.filter(d7),altBoundary:I},{refs:L,floatingStyles:M,placement:$,isPositioned:j,middlewareData:P}=Q8({strategy:"fixed",placement:N,whileElementsMounted:(...Me)=>V8(...Me,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[X8({mainAxis:s+A,alignmentAxis:o}),c&&J8({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?e7():void 0,...F}),c&&t7({...F}),n7({...F,apply:({elements:Me,rects:Be,availableWidth:$e,availableHeight:We})=>{const{width:Qt,height:Le}=Be.reference,dt=Me.floating.style;dt.setProperty("--radix-popper-available-width",`${$e}px`),dt.setProperty("--radix-popper-available-height",`${We}px`),dt.setProperty("--radix-popper-anchor-width",`${Qt}px`),dt.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),S&&s7({element:S,padding:l}),h7({arrowWidth:R,arrowHeight:A}),f&&r7({strategy:"referenceHidden",...F,boundary:I?F.boundary:void 0})]}),D=y.setPlacementState;nn(()=>(D($),()=>{D(void 0)}),[$,D]);const[C,H]=Hb($),V=tn(g);nn(()=>{j&&(V==null||V())},[j,V]);const O=(ne=P.arrow)==null?void 0:ne.x,G=(re=P.arrow)==null?void 0:re.y,Z=((J=P.arrow)==null?void 0:J.centerOffset)!==0,[ae,te]=m.useState();return nn(()=>{x&&te(window.getComputedStyle(x).zIndex)},[x]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:j?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(ge=P.transformOrigin)==null?void 0:ge.x,(se=P.transformOrigin)==null?void 0:se.y].join(" "),...((ke=P.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(l7,{scope:n,placedSide:C,placedAlign:H,onArrowChange:_,arrowX:O,arrowY:G,shouldHideArrow:Z,children:a.jsx(we.div,{"data-side":C,"data-align":H,...v,ref:w,style:{...v.style,animation:j?void 0:"none"}})})})});AR.displayName=zb;var IR="PopperArrow",u7={top:"bottom",right:"left",bottom:"top",left:"r
542ight"},RR=m.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=c7(IR,r),o=u7[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(o7,{...s,ref:n,style:{...s.style,display:"block"}})})});RR.displayName=IR;function d7(e){return e!==null}var h7=e=>({name:"transformOrigin",options:e,fn(t){var y,x,b;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=Hb(n),h={start:"0%",center:"50%",end:"100%"}[d],f=(((x=s.arrow)==null?void 0:x.x)??0)+l/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+c/2;let g="",v="";return u==="bottom"?(g=o?h:`${f}px`,v=`${-c}px`):u==="top"?(g=o?h:`${f}px`,v=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,v=o?h:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,v=o?h:`${p}px`),{data:{x:g,y:v}}}});function Hb(e){const[t,n="center"]=e.split("-");return[t,n]}var hm=jR,Wd=PR,fm=AR,pm=RR,f7="Portal",La=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=m.useState(!1);nn(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?Ia.createPortal(a.jsx(we.div,{...r,ref:t}),o):null});La.displayName=f7;function p7(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var hn=e=>{const{present:t,children:n}=e,r=m7(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=g7(r.ref,v7(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:i}):null};hn.displayName="Presence";function m7(e){const[t,n]=m.useState(),r=m.useRef(null),s=m.useRef(e),i=m.useRef("none"),o=e?"mounted":"unmounted",[l,c]=p7(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Ih(r.current);i.current=l==="mounted"?u:"none"},[l]),nn(()=>{const u=r.current,d=s.current;if(d!==e){const f=i.current,p=Ih(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),nn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=p=>{const v=Ih(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=p=>{p.target===t&&(i.current=Ih(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function oE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function g7(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const l=oE(o,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let o=0;o<i.length;o++){const l=i[o];typeof l=="function"?l():oE(r[o],null)}}},[])}function Ih(e){return(e==null?void 0:e.animationName)||"none"}function v7(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sv="rovingFocusGroup.onEntryFocus",y7={bubbles:!1,cancelable:!0},qd="RovingFocusGroup",[Sx,MR,x7]=_c(qd),[b7,mm]=yn(qd,[x7]),[w7,_7]=b7(qd),OR=m.forwardRef((e,t)=>
vendor: 1,313 bytes, line 542
542a.jsx(Sx.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Sx.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(k7,{...e,ref:t})})}));OR.displayName=qd;var k7=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,f=m.useRef(null),p=He(t,f),g=Oa(i),[v,y]=cr({prop:o,defaultProp:l??null,onChange:c,caller:qd}),[x,b]=m.useState(!1),w=tn(u),S=MR(n),_=m.useRef(!1),[E,R]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(sv,w),()=>A.removeEventListener(sv,w)},[w]),a.jsx(w7,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:v,onItemFocus:m.useCallback(A=>y(A),[y]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>R(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>R(A=>A-1),[]),children:a.jsx(we.div,{tabIndex:x||E===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:he(e.onMouseDown,()=>{_.current=!0}),onFocus:he(e.onFocus,A=>{const N=!_.current;if(A.target===A.currentTarget&&N&&!x){const k=new CustomEvent(sv,y7);if(A.currentTarget.dispatchEvent(k),!k.defaultPrevented){const T=S().filter($=>$.focusable),I=T.find($=>$.active),F=T.find($=>
vendor: 8,956 bytes, lines 542-557
542$.id===v),M=[I,F,...T].filter(Boolean).map($=>$.ref.current);FR(M,d)}}_.current=!1}),onBlur:he(e.onBlur,()=>b(!1))})})}),DR="RovingFocusGroupItem",LR=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=e,c=dn(),u=i||c,d=_7(DR,n),h=d.currentTabStopId===u,f=MR(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:v}=d;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),a.jsx(Sx.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:a.jsx(we.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:he(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:he(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:he(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=N7(y,d.orientation,d.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=f().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const S=w.indexOf(y.currentTarget);w=d.loop?C7(w,S+1):w.slice(S+1)}setTimeout(()=>FR(w))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:v!=null}):o})})});LR.displayName=DR;var S7={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function E7(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function N7(e,t,n){const r=E7(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return S7[r]}function FR(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function C7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $R=OR,VR=LR,j7=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},nl=new WeakMap,Rh=new WeakMap,Mh={},iv=0,BR=function(e){return e&&(e.host||BR(e.parentNode))},T7=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=BR(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},P7=function(e,t,n,r){var s=T7(t,Array.isArray(e)?e:[e]);Mh[n]||(Mh[n]=new WeakMap);var i=Mh[n],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))d(f);else try{var p=f.getAttribute(r),g=p!==null&&p!=="false",v=(nl.get(f)||0)+1,y=(i.get(f)||0)+1;nl.set(f,v),i.set(f,y),o.push(f),v===1&&g&&Rh.set(f,!0),y===1&&f.setAttribute(n,"true"),g||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return d(t),l.clear(),iv++,function(){o.forEach(function(h){var f=nl.get(h)-1,p=i.get(h)-1;nl.set(h,f),i.set(h,p),f||(Rh.has(h)||h.removeAttribute(r),Rh.delete(h)),p||h.removeAttribute(n)}),iv--,iv||(nl=new WeakMap,nl=new WeakMap,Rh=new WeakMap,Mh={})}},gm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=j7(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),P7(r,s,n,"aria-hidden")):function(){return null}},ks=function(){return ks=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ks.apply(this,arguments)};function UR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function A7(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var uf="right-scroll-bar-position",df="width-before-scroll-bar",I7="with-scroll-bars-hidden",R7="--removed-body-scroll-bar-size";function ov(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function M7(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var O7=typeof window<"u"?m.useLayoutEffect:m.useEffect,aE=new WeakMap;function D7(e,t){var n=M7(null,function(r){return e.forEach(function(s){return ov(s,r)})});return O7(function(){var r=aE.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||ov(l,null)}),i.forEach(function(l){s.has(l)||ov(l,o)})}aE.set(n,e)},[e]),n}function L7(e){return e}function F7(e,t){t===void 0&&(t=L7);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return s}function $7(e){e===void 0&&(e={});var t=F7(null);return t.options=ks({async:!0,ssr:!1},e),t}var zR=function(e){var t=e.sideCar,n=UR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,ks({},n))};zR.isSideCarExport=!0;function V7(e,t){return e.useMedium(t),zR}var HR=$7(),av=function(){},vm=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:av,onWheelCapture:av,onTouchMoveCapture:av}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,f=e.sideCar,p=e.noRelative,g=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=UR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=f,E=D7([n,t]),R=ks(ks({},S),s);return m.createElement(m.Fragment,null,d&&m.createElement(_,{sideCar:HR,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:v,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?m.cloneElement(m.Children.only(l),ks(ks({},R),{ref:E})):m.createElement(b,ks({},R,{className:c,ref:E}),l))});vm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vm.classNames={fullWidth:df,zeroRight:uf};var B7=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function U7(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=B7();return t&&e.setAttribute("nonce",t),e}function z7(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function H7(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var W7=function(){var e=0,t=null;return{add:function(n){e==0&&(t=U7())&&(z7(t,n),H7(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},q7=function(){var e=W7();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},WR=function(){var e=q7(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},G7={left:0,top:0,right:0,gap:0},lv=function(e){return parseInt(e||"",10)||0},K7=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[lv(n),lv(r),lv(s)]},Y7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return G7;var t=K7(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Q7=WR(),Tl="data-scroll-locked",Z7=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
543  .`.concat(I7,` {
544   overflow: hidden `).concat(r,`;
545   padding-right: `).concat(l,"px ").concat(r,`;
546  }
547  body[`).concat(Tl,`] {
548    overflow: hidden `).concat(r,`;
549    overscroll-behavior: contain;
550    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
551    padding-left: `.concat(s,`px;
552    padding-top: `).concat(i,`px;
553    padding-right: `).concat(o,`px;
554    margin-left:0;
555    margin-top:0;
556    margin-right: `).concat(l,"px ").concat(r,`;
557    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
557")].filter(Boolean).join(""),`
558  }
559  
560  .`).concat(uf,` {
561    right: `).concat(l,"px ").concat(r,`;
562  }
563  
564  .`).concat(df,` {
565    margin-right: `).concat(l,"px ").concat(r,`;
566  }
567  
568  .`).concat(uf," .").concat(uf,` {
569    right: 0 `).concat(r,`;
570  }
571  
572  .`).concat(df," .").concat(df,` {
573    margin-right: 0 `).concat(r,`;
574  }
575  
576  body[`).concat(Tl,`] {
577    `).concat(R7,": ").concat(l,`px;
578  }
579`)},lE=function(){var e=parseInt(document.body.getAttribute(Tl)||"0",10);return isFinite(e)?e:0},X7=function(){m.useEffect(function(){return document.body.setAttribute(Tl,(lE()+1).toString()),function(){var e=lE()-1;e<=0?document.body.removeAttribute(Tl):document.body.setAttribute(Tl,e.toString())}},[])},J7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;X7();var i=m.useMemo(function(){return Y7(s)},[s]);return m.createElement(Q7,{styles:Z7(i,!t,s,n?"":"!important")})},Ex=!1;if(typeof window<"u")try{var Oh=Object.defineProperty({},"passive",{get:function(){return Ex=!0,!0}});window.addEventListener("test",Oh,Oh),window.removeEventListener("test",Oh,Oh)}catch{Ex=!1}var rl=Ex?{passive:!1}:!1,eW=function(e){return e.tagName==="TEXTAREA"},qR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eW(e)&&n[t]==="visible")},tW=function(e){return qR(e,"overflowY")},nW=function(e){return qR(e,"overflowX")},cE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=GR(e,r);if(s){var i=KR(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},sW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},GR=function(e,t){return e==="v"?tW(t):nW(t)},KR=function(e,t){return e==="v"?rW(t):sW(t)},iW=function(e,t){return e==="h"&&t==="rtl"?-1:1},oW=function(e,t,n,r,s){var i=iW(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,d=o>0,h=0,f=0;do{if(!l)break;var p=KR(e,l),g=p[0],v=p[1],y=p[2],x=v-y-i*g;(g||x)&&GR(e,l)&&(h+=x,f+=g);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(h)<1||!d&&Math.abs(f)<1)&&(u=!0),u},Dh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uE=function(e){return[e.deltaX,e.deltaY]},dE=function(e){return e&&"current"in e?e.current:e},aW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lW=function(e){return`
580  .block-interactivity-`.concat(e,` {pointer-events: none;}
581  .allow-interactivity-`).concat(e,` {pointer-events: all;}
582`)},cW=0,sl=[];function uW(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(cW++)[0],i=m.useState(WR)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=A7([e.lockRef.current],(e.shards||[]).map(dE),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=Dh(v),b=n.current,w="deltaX"in v?v.deltaX:b[0]-x[0],S="deltaY"in v?v.deltaY:b[1]-x[1],_,E=v.target,R=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&R==="h"&&E.type==="range")return!1;var A=window.getSelection(),N=A&&A.anchorNode,k=N?N===E||N.contains(E):!1;if(k)return!1;var T=cE(R,E);if(!T)return!0;if(T?_=R:(_=R==="v"?"h":"v",T=cE(R,E)),!T)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=_),!_)return!0;var I=r.current||_;return oW(I,y,v,I==="h"?w:S)},[]),c=m.useCallback(function(v){var y=v;if(!(!sl.length||sl[sl.length-1]!==i)){var x="deltaY"in y?uE(y):Dh(y),b=t.current.filter(function(_){return _.name===y.type&&(_.target===y.target||y.target===_.shadowParent)&&aW(_.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}
vendor: 4,141 bytes, line 582
582if(!b){var w=(o.current.shards||[]).map(dE).filter(Boolean).filter(function(_){return _.contains(y.target)}),S=w.length>0?l(y,w[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=m.useCallback(function(v,y,x,b){var w={name:v,delta:y,target:x,should:b,shadowParent:dW(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=m.useCallback(function(v){n.current=Dh(v),r.current=void 0},[]),h=m.useCallback(function(v){u(v.type,uE(v),v.target,l(v,e.lockRef.current))},[]),f=m.useCallback(function(v){u(v.type,Dh(v),v.target,l(v,e.lockRef.current))},[]);m.useEffect(function(){return sl.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,rl),document.addEventListener("touchmove",c,rl),document.addEventListener("touchstart",d,rl),function(){sl=sl.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,rl),document.removeEventListener("touchmove",c,rl),document.removeEventListener("touchstart",d,rl)}},[]);var p=e.removeScrollBar,g=e.inert;return m.createElement(m.Fragment,null,g?m.createElement(i,{styles:lW(s)}):null,p?m.createElement(J7,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hW=V7(HR,uW);var Gd=m.forwardRef(function(e,t){return m.createElement(vm,ks({},e,{ref:t,sideCar:hW}))});Gd.classNames=vm.classNames;var Nx=["Enter"," "],fW=["ArrowDown","PageUp","Home"],YR=["ArrowUp","PageDown","End"],pW=[...fW,...YR],mW={ltr:[...Nx,"ArrowRight"],rtl:[...Nx,"ArrowLeft"]},gW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Kd="Menu",[md,vW,yW]=_c(Kd),[Fa,QR]=yn(Kd,[yW,Po,mm]),ym=Po(),ZR=mm(),[xW,$a]=Fa(Kd),[bW,Yd]=Fa(Kd),XR=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,l=ym(t),[c,u]=m.useState(null),d=m.useRef(!1),h=tn(i),f=Oa(s);return m.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;const p=()=>h(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,h]),a.jsx(hm,{...l,children:a.jsx(xW,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u,children:a.jsx(bW,{scope:t,onClose:m.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:r})})})};XR.displayName=Kd;var wW="MenuAnchor",Wb=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=ym(n);return a.jsx(Wd,{...s,...r,ref:t})});Wb.displayName=wW;var qb="MenuPortal",[_W,JR]=Fa(qb,{forceMount:void 0}),e2=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=$a(qb,t);return a.jsx(_W,{scope:t,forceMount:n,children:a.jsx(hn,{present:n||i.open,children:a.jsx(La,{asChild:!0,container:s,children:r})})})};e2.displayName=qb;var Br="MenuContent",[kW,Gb]=Fa(Br),t2=m.forwardRef((e,t)=>{const n=JR(Br,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=$a(Br,e.__scopeMenu),o=Yd(Br,e.__scopeMenu);return a.jsx(md.Provider,{scope:e.__scopeMenu,children:a.jsx(hn,{present:r||i.open,children:a.jsx(md.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(SW,{...s,ref:t}):a.jsx(EW,{...s,ref:t})})})})}),SW=m.forwardRef((e,t)=>{const n=$a(Br,e.__scopeMenu),r=m.useRef(null),s=He(t,r);return m.useEffect(()=>{const i=r.current;if(i)return gm(i)},[]),a.jsx(Kb,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:he(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),EW=m.forwardRef((e,t)=>{const n=$a(Br,e.__scopeMenu);return a.jsx(Kb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),NW=go("MenuContent.ScrollLock"),Kb=m.forwardRef((e,t)=>
vendor: 12,809 bytes, line 582
582{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,...v}=e,y=$a(Br,n),x=Yd(Br,n),b=ym(n),w=ZR(n),S=vW(n),[_,E]=m.useState(null),R=m.useRef(null),A=He(t,R,y.onContentChange),N=m.useRef(0),k=m.useRef(""),T=m.useRef(0),I=m.useRef(null),F=m.useRef("right"),L=m.useRef(0),M=g?Gd:m.Fragment,$=g?{as:NW,allowPinchZoom:!0}:void 0,j=D=>{var te,ne;const C=k.current+D,H=S().filter(re=>!re.disabled),V=document.activeElement,O=(te=H.find(re=>re.ref.current===V))==null?void 0:te.textValue,G=H.map(re=>re.textValue),Z=FW(G,C,O),ae=(ne=H.find(re=>re.textValue===Z))==null?void 0:ne.ref.current;(function re(J){k.current=J,window.clearTimeout(N.current),J!==""&&(N.current=window.setTimeout(()=>re(""),1e3))})(C),ae&&setTimeout(()=>ae.focus())};m.useEffect(()=>()=>window.clearTimeout(N.current),[]),am();const P=m.useCallback(D=>{var H,V;return F.current===((H=I.current)==null?void 0:H.side)&&VW(D,(V=I.current)==null?void 0:V.area)},[]);return a.jsx(kW,{scope:n,searchRef:k,onItemEnter:m.useCallback(D=>{P(D)&&D.preventDefault()},[P]),onItemLeave:m.useCallback(D=>{var C;P(D)||((C=R.current)==null||C.focus(),E(null))},[P]),onTriggerLeave:m.useCallback(D=>{P(D)&&D.preventDefault()},[P]),pointerGraceTimerRef:T,onPointerGraceIntentChange:m.useCallback(D=>{I.current=D},[]),children:a.jsx(M,{...$,children:a.jsx(zd,{asChild:!0,trapped:s,onMountAutoFocus:he(i,D=>{var C;D.preventDefault(),(C=R.current)==null||C.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(Da,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:a.jsx($R,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:he(c,D=>{x.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(fm,{role:"menu","aria-orientation":"vertical","data-state":v2(y.open),"data-radix-menu-content":"",dir:x.dir,...b,...v,ref:A,style:{outline:"none",...v.style},onKeyDown:he(v.onKeyDown,D=>{const H=D.target.closest("[data-radix-menu-content]")===D.currentTarget,V=D.ctrlKey||D.altKey||D.metaKey,O=D.key.length===1;H&&(D.key==="Tab"&&D.preventDefault(),!V&&O&&j(D.key));const G=R.current;if(D.target!==G||!pW.includes(D.key))return;D.preventDefault();const ae=S().filter(te=>!te.disabled).map(te=>te.ref.current);YR.includes(D.key)&&ae.reverse(),DW(ae)}),onBlur:he(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(N.current),k.current="")}),onPointerMove:he(e.onPointerMove,gd(D=>{const C=D.target,H=L.current!==D.clientX;if(D.currentTarget.contains(C)&&H){const V=D.clientX>L.current?"right":"left";F.current=V,L.current=D.clientX}}))})})})})})})});t2.displayName=Br;var CW="MenuGroup",Yb=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(we.div,{role:"group",...r,ref:t})});Yb.displayName=CW;var jW="MenuLabel",n2=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(we.div,{...r,ref:t})});n2.displayName=jW;var np="MenuItem",hE="menu.itemSelect",xm=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=m.useRef(null),o=Yd(np,e.__scopeMenu),l=Gb(np,e.__scopeMenu),c=He(t,i),u=m.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const f=new CustomEvent(hE,{bubbles:!0,cancelable:!0});h.addEventListener(hE,p=>r==null?void 0:r(p),{once:!0}),Rb(h,f),f.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(r2,{...s,ref:c,disabled:n,onClick:he(e.onClick,d),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),u.current=!0},onPointerUp:he(e.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:he(e.onKeyDown,h=>{const f=l.searchRef.current!=="";n||f&&h.key===" "||Nx.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});xm.displayName=np;var r2=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,o=Gb(np,n),l=ZR(n),c=m.useRef(null),u=He(t,c),[d,h]=m.useState(!1),[f,p]=m.useState("");return m.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(md.ItemSlot,{scope:n,disabled:r,textValue:s??f,children:a.jsx(VR,{asChild:!0,...l,focusable:!r,children:a.jsx(we.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:he(e.onPointerMove,gd(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:he(e.onPointerLeave,gd(g=>o.onItemLeave(g))),onFocus:he(e.onFocus,()=>h(!0)),onBlur:he(e.onBlur,()=>h(!1))})})})}),TW="MenuCheckboxItem",s2=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(c2,{scope:e.__scopeMenu,checked:n,children:a.jsx(xm,{role:"menuitemcheckbox","aria-checked":rp(n)?"mixed":n,...s,ref:t,"data-state":Zb(n),onSelect:he(s.onSelect,()=>r==null?void 0:r(rp(n)?!0:!n),{checkForDefaultPrevented:!1})})})});s2.displayName=TW;var i2="MenuRadioGroup",[PW,AW]=Fa(i2,{value:void 0,onValueChange:()=>{}}),o2=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=tn(r);return a.jsx(PW,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(Yb,{...s,ref:t})})});o2.displayName=i2;var a2="MenuRadioItem",l2=m.forwardRef((e,t)=>{const{value:n,...r}=e,s=AW(a2,e.__scopeMenu),i=n===s.value;return a.jsx(c2,{scope:e.__scopeMenu,checked:i,children:a.jsx(xm,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Zb(i),onSelect:he(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});l2.displayName=a2;var Qb="MenuItemIndicator",[c2,IW]=Fa(Qb,{checked:!1}),u2=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=IW(Qb,n);return a.jsx(hn,{present:r||rp(i.checked)||i.checked===!0,children:a.jsx(we.span,{...s,ref:t,"data-state":Zb(i.checked)})})});u2.displayName=Qb;var RW="MenuSeparator",d2=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});d2.displayName=RW;var MW="MenuArrow",h2=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=ym(n);return a.jsx(pm,{...s,...r,ref:t})});h2.displayName=MW;var OW="MenuSub",[s0e,f2]=Fa(OW),vu="MenuSubTrigger",p2=m.forwardRef((e,t)=>{const n=$a(vu,e.__scopeMenu),r=Yd(vu,e.__scopeMenu),s=f2(vu,e.__scopeMenu),i=Gb(vu,e.__scopeMenu),o=m.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=m.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return m.useEffect(()=>d,[d]),m.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),a.jsx(Wb,{asChild:!0,...u,children:a.jsx(r2,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?s.contentId:void 0,"data-state":v2(n.open),...e,ref:mo(t,s.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:he(e.onPointerMove,gd(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:he(e.onPointerLeave,gd(h=>{var p,g;d();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(g=n.content)==null?void 0:g.dataset.side,y=v==="right",x=y?-5:5,b=f[y?"left":"right"],w=f[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:b,y:f.top},{x:w,y:f.top},{x:w,y:f.bottom},{x:b,y:f.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:he(e.onKeyDown,h=>{var p;const f=i.searchRef.current!=="";e.disabled||f&&h.key===" "||mW[r.dir].includes(h.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),h.preventDefault())})})})});p2.displayName=vu;var m2="MenuSubContent",g2=m.forwardRef((e,t)=>{const n=JR(Br,e.__scopeMenu),{forceMount:r=n.forceMount,align:s="start",...i}=e,o=$a(Br,e.__scopeMenu),l=Yd(Br,e.__scopeMenu),c=f2(m2,e.__scopeMenu),u=m.useRef(null),d=He(t,u);return a.jsx(md.Provider,{scope:e.__scopeMenu,children:a.jsx(hn,{present:r||o.open,children:a.jsx(md.Slot,{scope:e.__scopeMenu,children:a.jsx(Kb,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:s,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var f;l.isUsingKeyboardRef.current&&((f=u.current)==null||f.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:he(e.onFocusOutside,h=>{h.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:he(e.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:he(e.onKeyDown,h=>{var g;const f=h.currentTarget.contains(h.target),p=gW[l.dir].includes(h.key);f&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),h.preventDefault())})})})})})});g2.displayName=m2;function v2(e){return e?"open":"closed"}function rp(e){return e==="indeterminate"}function Zb(e){return rp(e)?"indeterminate":e?"checked":"unchecked"}function DW(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function LW(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function FW(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=LW(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function $W(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,h=c.x,f=c.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function VW(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $W(n,t)}function gd(e){return t=>t.pointerType==="mouse"?e(t):void 0}var BW=XR,UW=Wb,zW=e2,HW=t2,WW=Yb,qW=n2,GW=xm,KW=s2,YW=o2,QW=l2,ZW=u2,XW=d2,JW=h2,eq=p2,tq=g2,bm="DropdownMenu",[nq]=yn(bm,[QR]),Xn=QR(),[rq,y2]=nq(bm),x2=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Xn(t),u=m.useRef(null),[d,h]=cr({prop:s,defaultProp:i??!1,onChange:o,caller:bm});return a.jsx(rq,{scope:t,triggerId:dn(),triggerRef:u,contentId:dn(),open:d,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(f=>!f),[h]),modal:l,children:a.jsx(BW,{...c,open:d,onOpenChange:h,dir:r,modal:l,children:n})})};x2.displayName=bm;var b2="DropdownMenuTrigger",w2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=y2(b2,n),o=Xn(n);return a.jsx(UW,{asChild:!0,...o,children:a.jsx(we.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:mo(t,i.triggerRef),onPointerDown:he(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:he(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});w2.displayName=b2;var sq="DropdownMenuPortal",_2=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Xn(t);return a.jsx(zW,{...r,...n})};_2.displayName=sq;var k2="DropdownMenuContent",S2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=y2(k2,n),i=Xn(n),o=m.useRef(!1);return a.jsx(HW,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:he(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:he(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S2.displayName=k2;var iq="DropdownMenuGroup",oq=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(WW,{...s,...r,ref:t})});oq.displayName=iq;var aq="DropdownMenuLabel",E2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(qW,{...s,...r,ref:t})});E2.displayName=aq;var lq="DropdownMenuItem",N2=m.forwardRef((e,t)=>
582{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(GW,{...s,...r,ref:t})});N2.displayName=lq;var cq="DropdownMenuCheckboxItem",C2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(KW,{...s,...r,ref:t})});C2.displayName=cq;var uq="DropdownMenuRadioGroup",dq=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(YW,{...s,...r,ref:t})});dq.displayName=uq;var hq="DropdownMenuRadioItem",j2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(QW,{...s,...r,ref:t})});j2.displayName=hq;var fq="DropdownMenuItemIndicator",T2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(ZW,{...s,...r,ref:t})});T2.displayName=fq;var pq="DropdownMenuSeparator",P2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(XW,{...s,...r,ref:t})});P2.displayName=pq;var mq="DropdownMenuArrow",gq=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(JW,{...s,...r,ref:t})});gq.displayName=mq;var vq="DropdownMenuSubTrigger",A2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(eq,{...s,...r,ref:t})});A2.displayName=vq;var yq="DropdownMenuSubContent",I2=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Xn(n);return a.jsx(tq,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});I2.displayName=yq;var xq=x2,bq=w2,wq=_2,R2=S2,M2=E2,O2=N2,D2=C2,L2=j2,F2=T2,$2=P2,V2=A2,B2=I2;const Xb=xq,Jb=bq,_q=m.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(V2,{ref:s,className:q("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(Ar,{className:"ml-auto h-4 w-4"})]}));_q.displayName=V2.displayName;const kq=m.forwardRef(({className:e,...t},n)=>a.jsx(B2,{ref:n,className:q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));kq.displayName=B2.displayName;const wm=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(wq,{children:a.jsx(R2,{ref:r,sideOffset:t,className:q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));wm.displayName=R2.displayName;const Pl=m.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(O2,{ref:r,className:q("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));
582Pl.displayName=O2.displayName;const Sq=m.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(D2,{ref:s,className:q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(F2,{children:a.jsx(bt,{className:"h-4 w-4"})})}),t]}));Sq.displayName=D2.displayName;const Eq=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(L2,{ref:r,className:q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(F2,{children:a.jsx(XI,{className:"h-2 w-2 fill-current"})})}),t]}));Eq.displayName=L2.displayName;const ew=m.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(M2,{ref:r,className:q("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));ew.displayName=M2.displayName;const sp=m.forwardRef(({className:e,...t},n)=>a.jsx($2,{ref:n,className:q("-mx-1 my-1 h-px bg-muted",e),...t}));sp.displayName=$2.displayName;var tw="Avatar",[Nq]=yn(tw),Cq=[0,()=>{}],[jq,U2]=Nq(tw),nw=m.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[s,i]=m.useState("idle"),[o,l]=Pq();return a.jsx(jq,{scope:n,imageLoadingStatus:s,setImageLoadingStatus:i,imageCount:o,setImageCount:l,children:a.jsx(we.span,{...r,ref:t})})});nw.displayName=tw;var z2="AvatarImage",rw=m.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s,...i}=e,o=U2(z2,n);Aq(o.setImageCount);const l=Tq(r,{referrerPolicy:i.referrerPolicy,crossOrigin:i.crossOrigin,loadingStatus:o.imageLoadingStatus,setLoadingStatus:o.setImageLoadingStatus}),c=tn(d=>{s==null||s(d)}),u=m.useRef(l);return nn(()=>{const d=u.current;u.current=l,l!==d&&c(l)},[l,c]),l==="loaded"?a.jsx(we.img,{...i,ref:t,src:r}):null});rw.displayName=z2;var H2="AvatarFallback",sw=m.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...s}=e,i=U2(H2,n),[o,l]=m.useState(r===void 0);return m.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(we.span,{...s,ref:t}):null});sw.displayName=H2;function Tq(e,{loadingStatus:t,setLoadingStatus:n,referrerPolicy:r,crossOrigin:s}){return nn(()=>{if(!e){n("error");return}const i=new window.Image,o=c=>{const u=c.currentTarget;n(fE(u))},l=()=>n("error");return i.addEventListener("load",o),i.addEventListener("error",l),r&&(i.referrerPolicy=r),i.crossOrigin=s??null,i.src=e,n(fE(i)),()=>{i.removeEventListener("load",o),i.removeEventListener("error",l),n("idle")}},[e,s,r,n]),t}function fE(e){return e.complete?e.naturalWidth>0?"loaded":"error":"loading"}function Pq(){let e=Cq;{e=m.useState(0);const[t]=e,n=m.useRef(!1);m.useEffect(()=>{t>1&&!n.current&&(n.current=!0,console.warn("Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."))},[t])}return e}function Aq(e){m.useEffect(()=>(e(t=>t+1),()=>{e(t=>t-1)}),[e])}const iw=m.forwardRef(({className:e,...t},n)=>a.jsx(nw,{ref:n,className:q("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));iw.displayName=nw.displayName;const W2=m.forwardRef(({className:e,src:t,...n},r)=>a.jsx(rw,{ref:r,className:q("aspect-square h-full w-full",e),src:t,crossOrigin:"anonymous",referrerPolicy:"no-referrer",loading:"eager",...n}));W2.displayName=rw.displayName;const ow=m.forwardRef(({className:e,...t},n)=>a.jsx(sw,{ref:n,className:q("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ow.displayName=sw.displayName;function q2({user:e,className:t,size:n="md",fallbackClassName:r}){const[s,i]=m.useState(e.profileImageUrl),[o,l]=m.useState(0),[c,u]=m.useState(),[d,h]=m.useState(!1),f={xs:"h-6 w-6",sm:"h-8 w-8",md:"h-10 w-10",lg:"h-24 w-24",xl:"h-32 w-32"}
582,p={sm:"text-sm",md:"text-base",lg:"text-xl",xl:"text-3xl"},v=((E,R,A)=>E&&R?`${E[0]}${R[0]}`.toUpperCase():E?E[0].toUpperCase():A?A[0].toUpperCase():"U")(e.firstName,e.lastName,e.email);m.useEffect(()=>{e.profileImageUrl&&e.profileImageUrl.startsWith("profiles/")&&(h(!0),fetch(`/api/user/profile-photo-url/${e.id}`,{credentials:"include"}).then(async E=>{if(E.ok){const R=await E.json();R.url&&(u(R.url),i(R.url),l(A=>A+1))}}).catch(E=>{console.error("Failed to fetch R2 profile photo:",E)}).finally(()=>{h(!1)}))},[e.profileImageUrl,e.id]),m.useEffect(()=>{var N;if(e.profileImageUrl&&(e.profileImageUrl.includes("accounts.google.com")||e.profileImageUrl.includes("oauth"))){y(""),i(void 0);return}if(e.profileImageUrl&&e.profileImageUrl.startsWith("profiles/"))return;if(e.profileImageUrl&&e.profileImageUrl.includes("/api/files/profile/")){i(e.profileImageUrl);return}if(e.authProvider!=="google"||!e.googleId){i(e.profileImageUrl);return}if(!/^[0-9]{15,25}$/.test(e.googleId)){i((N=e.profileImageUrl)!=null&&N.startsWith("http")?"/api/proxy/profile-image":e.profileImageUrl);return}const R=async()=>{try{const k=e.profileImageUrl&&e.profileImageUrl.includes("googleusercontent.com")?e.profileImageUrl.split("?")[0]:`https://lh3.googleusercontent.com/a/${e.googleId}=s96-c`,T=`${k}?t=${Date.now()}`,I=new Image;I.crossOrigin="anonymous",I.onload=()=>{i(T),l(F=>F+1),y(k)},I.onerror=()=>{var F;i((F=e.profileImageUrl)!=null&&F.startsWith("http")&&!e.profileImageUrl.includes("accounts.google.com")?"/api/proxy/profile-image":e.profileImageUrl)},I.src=T}catch{i(e.profileImageUrl)}};R();const A=setInterval(R,5*60*1e3);return()=>clearInterval(A)},[e.googleId,e.authProvider,e.profileImageUrl,e.id]);const y=async E=>{if(E!==e.profileImageUrl)try{await fetch("/api/user/profile",{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({profileImageUrl:E||null})}),typeof window<"u"&&window.queryClient&&window.queryClient.invalidateQueries({queryKey:["/api/auth/user"]})}catch{}},x=(s==null?void 0:s.includes("accounts.google.com"))||(s==null?void 0:s.includes("oauth")),b=s==null?void 0:s.includes(".r2.cloudflarestorage.com"),w=s==null?void 0:s.includes("googleusercontent.com"),S=x?void 0:s!=null&&s.startsWith("http")&&!w&&!b?"/api/proxy/profile-image":s,_=!b&&S!==void 0;return a.jsxs(iw,{className:`${f[n]} ${t||""}`,children:[a.jsx(W2,{src:S,alt:e.email||"User",crossOrigin:_?"anonymous":void 0,referrerPolicy:"no-referrer"},o),a.jsx(ow,{className:`${p[n]} ${r||""}`,children:v})]})}function Iq(){var i,o;const{user:e}=Wt(),t=e&&"teamMemberRole"in e?String(e.teamMemberRole):void 0,n=async()=>{try{const{queryClient:l}=await ve(async()=>{const{queryClient:c}=await Promise.resolve().then(()=>Z1);return{queryClient:c}},void 0);await Cs("/api/logout",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}}),await Ms(l,{force:!0}),Kl("/logout-success")}catch{const{queryClient:c}=await ve(async()=>{const{queryClient:u}=await Promise.resolve().then(()=>Z1);return{queryClient:u}},void 0);await Ms(c,{force:!0}),Kl("/logout-success")}},r=e?`${((i=e.firstName)==null?void 0:i[0])||""}${((o=e.lastName)==null?void 0:o[0])||""}`.toUpperCase():"U",s=e?{id:e.id,email:e.email,firstName:e.firstName,lastName:e.lastName,profileImageUrl:e.profileImageUrl||void 0,authProvider:e.authProvider,googleId:e.googleId||void 0}:null;return a.jsxs("div",{className:"h-16 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 px-4 sm:px-6 flex items-center justify-between",children:[a.jsx("div",{className:"md:hidden"}),a.jsx("div",{className:"ml-auto flex items-center space-x-2 sm:space-x-4",children:a.jsxs(Xb,{children:[a.jsx(Jb,{asChild:!0,children:a.jsx(ie,{variant:"ghost",className:"relative h-10 w-10 rounded-full touch-target",children:s?a.jsx(q2,{user:s,size:"md",className:"h-10 w-10",fallbackClassName:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100"}):a.jsx(iw,{className:"h-10 w-10",children:a.jsx(ow,{className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100",children:r})})})}),a.jsxs(wm,{align:"end",className:"w-56",children:[a.jsx(ew,{children:a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs("p",{className:"text-sm font-medium leading-none",children:[e==null?void 0:e.firstName," ",e==null?void 0:e.lastName]}),a.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:e==null?void 0:e.email}),t&&a.jsxs("p",{className:"text-xs leading-none text-muted-foreground mt-1",children:["Role: ",t]})]})}),a.jsx(sp,{}),a.jsxs(Pl,{onClick:n,children:[a.jsx(ud,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Log out"})]})]})]})})]})}const aw=m.createContext({});function Qd(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const _m=m.createContext(null),lw=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Rq extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Mq({children:e,isPresent:t}){const n=m.useId(),r=m.useRef(null),s=m.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=m.useContext(lw);return m.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:u}=s.current;if(t||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`
583          [data-motion-pop-id="${n}"] {
584            position: absolute !important;
585            width: ${o}px !important;
586            height: ${l}px !important;
587            top: ${c}px !important;
588            left: ${u}px !important;
589          }
590        `),()=>{document.head.removeChild(d)}},[t]),a.jsx(Rq,{isPresent:t,childRef:r,sizeRef:s,children:m.cloneElement(e,{ref:r})})}const Oq=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=Qd(Dq),c=m.useId(),u=m.useCallback(h=>{l.set(h,!0);for(const f of l.values())if(!f)return;r&&r()},[l,r]),d=m.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:h=>(l.set(h,!1),()=>l.delete(h))}),i?[Math.random(),u]:[n,u]);return m.useMemo(()=>{l.forEach((h,f)=>l.set(f,!1))},[n]),m.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(Mq,{isPresent:n,children:e})),a.jsx(_m.Provider,{value:d,children:e})};function Dq(){return new Map}function G2(e=!0){const t=m.useContext(_m);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=m.useId();m.useEffect(()=>{e&&s(i)},[e]);const o=m.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Lh=e=>e.key||"";function pE(e){const t=[];
vendor: 37,385 bytes, line 590
590return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const cw=typeof window<"u",uw=cw?m.useLayoutEffect:m.useEffect,K2=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=G2(o),u=m.useMemo(()=>pE(e),[e]),d=o&&!l?[]:u.map(Lh),h=m.useRef(!0),f=m.useRef(u),p=Qd(()=>new Map),[g,v]=m.useState(u),[y,x]=m.useState(u);uw(()=>{h.current=!1,f.current=u;for(let S=0;S<y.length;S++){const _=Lh(y[S]);d.includes(_)?p.delete(_):p.get(_)!==!0&&p.set(_,!1)}},[y,d.length,d.join("-")]);const b=[];if(u!==g){let S=[...u];for(let _=0;_<y.length;_++){const E=y[_],R=Lh(E);d.includes(R)||(S.splice(_,0,E),b.push(E))}i==="wait"&&b.length&&(S=b),x(pE(S)),v(u);return}const{forceRender:w}=m.useContext(aw);return a.jsx(a.Fragment,{children:y.map(S=>{const _=Lh(S),E=o&&!l?!1:u===y||d.includes(_),R=()=>{if(p.has(_))p.set(_,!0);else return;let A=!0;p.forEach(N=>{N||(A=!1)}),A&&(w==null||w(),x(f.current),o&&(c==null||c()),r&&r())};return a.jsx(Oq,{isPresent:E,initial:!h.current||n?void 0:!1,custom:E?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:E?void 0:R,children:S},_)})})},Qn=e=>e;let Lq=Qn,Y2=Qn;function dw(e){let t;return()=>(t===void 0&&(t=e()),t)}const ka=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},pi=e=>e*1e3,mi=e=>e/1e3,Fq={useManualTiming:!1};function $q(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,d=!1,h=!1)=>{const p=h&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Fh=["read","resolveKeyframes","update","preRender","render","postRender"],Vq=40;function Q2(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Fh.reduce((x,b)=>(x[b]=$q(i),x),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:h,postRender:f}=o,p=()=>{const x=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(x-s.timestamp,Vq),1),s.timestamp=x,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),f.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},g=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Fh.reduce((x,b)=>{const w=o[b];return x[b]=(S,_=!1,E=!1)=>(n||g(),w.schedule(S,_,E)),x},{}),cancel:x=>{for(let b=0;b<Fh.length;b++)o[Fh[b]].cancel(x)},state:s,steps:o}}const{schedule:Et,cancel:Ds,state:wn,steps:cv}=Q2(typeof requestAnimationFrame<"u"?requestAnimationFrame:Qn,!0),Z2=m.createContext({strict:!1}),mE={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ic={};for(const e in mE)ic[e]={isEnabled:t=>mE[e].some(n=>!!t[n])};function Bq(e){for(const t in e)ic[t]={...ic[t],...e[t]}}const Uq=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ip(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Uq.has(e)}let X2=e=>!ip(e);function zq(e){e&&(X2=t=>t.startsWith("on")?!ip(t):e(t))}try{zq(require("@emotion/is-prop-valid").default)}catch{}function Hq(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(X2(s)||n===!0&&ip(s)||!t&&!ip(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function Wq(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const km=m.createContext({});function vd(e){return typeof e=="string"||Array.isArray(e)}function Sm(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const hw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fw=["initial",...hw];function Em(e){return Sm(e.animate)||fw.some(t=>vd(e[t]))}function J2(e){return!!(Em(e)||e.variants)}function qq(e,t){if(Em(e)){const{initial:n,animate:r}=e;return{initial:n===!1||vd(n)?n:void 0,animate:vd(r)?r:void 0}}return e.inherit!==!1?t:{}}function Gq(e){const{initial:t,animate:n}=qq(e,m.useContext(km));return m.useMemo(()=>({initial:t,animate:n}),[gE(t),gE(n)])}function gE(e){return Array.isArray(e)?e.join(" "):e}const Kq=Symbol.for("motionComponentSymbol");function vl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Yq(e,t,n){return m.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):vl(n)&&(n.current=r))},[t])}const pw=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Qq="framerAppearId",eM="data-"+pw(Qq),{schedule:mw}=Q2(queueMicrotask,!1),tM=m.createContext({});function Zq(e,t,n,r,s){var i,o;const{visualElement:l}=m.useContext(km),c=m.useContext(Z2),u=m.useContext(_m),d=m.useContext(lw).reducedMotion,h=m.useRef(null);r=r||c.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const f=h.current,p=m.useContext(tM);f&&!f.projection&&s&&(f.type==="html"||f.type==="svg")&&Xq(h.current,n,s,p);const g=m.useRef(!1);m.useInsertionEffect(()=>{f&&g.current&&f.update(n,u)});const v=n[eM],y=m.useRef(!!v&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return uw(()=>{f&&(g.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),mw.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())}),m.useEffect(()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)===null||x===void 0||x.call(window,v)}),y.current=!1))}),f}function Xq(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:nM(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&vl(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function nM(e){if(e)return e.options.allowProjection!==!1?e.projection:nM(e.parent)}function Jq({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&Bq(e);function l(u,d){let h;const f={...m.useContext(lw),...u,layoutId:eG(u)},{isStatic:p}=f,g=Gq(u),v=r(u,p);if(!p&&cw){tG();const y=nG(f);h=y.MeasureLayout,g.visualElement=Zq(s,v,f,t,y.ProjectionNode)}return a.jsxs(km.Provider,{value:g,children:[h&&g.visualElement?a.jsx(h,{visualElement:g.visualElement,...f}):null,n(s,u,Yq(v,g.visualElement,d),v,p,g.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=m.forwardRef(l);return c[Kq]=s,c}function eG({layoutId:e}){const t=m.useContext(aw).id;return t&&e!==void 0?t+"-"+e:e}function tG(e,t){m.useContext(Z2).strict}function nG(e){const{drag:t,layout:n}=ic;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const rG=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gw(e){return typeof e!="string"||e.includes("-")?!1:!!(rG.indexOf(e)>-1||/[A-Z]/u.test(e))}function vE(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function vw(e,t,n,r){if(typeof t=="function"){const[s,i]=vE(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=vE(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Cx=e=>Array.isArray(e),sG=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),iG=e=>Cx(e)?e[e.length-1]||0:e,On=e=>!!(e&&e.getVelocity);function hf(e){const t=On(e)?e.get():e;return sG(t)?t.toValue():t}function oG({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:aG(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const rM=e=>(t,n)=>{const r=m.useContext(km),s=m.useContext(_m),i=()=>oG(e,t,r,s);return n?i():Qd(i)};function aG(e,t,n,r){const s={},i=r(e,{});for(const f in i)s[f]=hf(i[f]);let{initial:o,animate:l}=e;const c=Em(e),u=J2(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?l:o;if(h&&typeof h!="boolean"&&!Sm(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const g=vw(e,f[p]);if(g){const{transitionEnd:v,transition:y,...x}=g;for(const b in x){let w=x[b];if(Array.isArray(w)){const S=d?w.length-1:0;w=w[S]}w!==null&&(s[b]=w)}for(const b in v)s[b]=v[b]}}}return s}const Ec=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Va=new Set(Ec),sM=e=>t=>typeof t=="string"&&t.startsWith(e),iM=sM("--"),lG=sM("var(--"),yw=e=>lG(e)?cG.test(e.split("/*")[0].trim()):!1,cG=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,oM=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ls=(e,t,n)=>n>t?t:n<e?e:n,Nc={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},yd={...Nc,transform:e=>Ls(0,1,e)},$h={...Nc,default:1},Zd=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ui=Zd("deg"),Ps=Zd("%"),ze=Zd("px"),uG=Zd("vh"),dG=Zd("vw"),yE={...Ps,parse:e=>Ps.parse(e)/100,transform:e=>Ps.transform(e*100)},hG={borderWidth:ze,borderTopWidth:ze,borderRightWidth:ze,borderBottomWidth:ze,borderLeftWidth:ze,borderRadius:ze,radius:ze,borderTopLeftRadius:ze,borderTopRightRadius:ze,borderBottomRightRadius:ze,borderBottomLeftRadius:ze,width:ze,maxWidth:ze,height:ze,maxHeight:ze,top:ze,right:ze,bottom:ze,left:ze,padding:ze,paddingTop:ze,paddingRight:ze,paddingBottom:ze,paddingLeft:ze,margin:ze,marginTop:ze,marginRight:ze,marginBottom:ze,marginLeft:ze,backgroundPositionX:ze,backgroundPositionY:ze},fG={rotate:Ui,rotateX:Ui,rotateY:Ui,rotateZ:Ui,scale:$h,scaleX:$h,scaleY:$h,scaleZ:$h,skew:Ui,skewX:Ui,skewY:Ui,distance:ze,translateX:ze,translateY:ze,translateZ:ze,x:ze,y:ze,z:ze,perspective:ze,transformPerspective:ze,opacity:yd,originX:yE,originY:yE,originZ:ze},xE={...Nc,transform:Math.round},xw={...hG,...fG,zIndex:xE,size:ze,fillOpacity:yd,strokeOpacity:yd,numOctaves:xE},pG={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mG=Ec.length;function gG(e,t,n){let r="",s=!0;for(let i=0;i<mG;i++){const o=Ec[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=oM(l,xw[o]);if(!c){s=!1;const d=pG[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function bw(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Va.has(c)){o=!0;continue}else if(iM(c)){s[c]=u;continue}else{const d=oM(u,xw[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=gG(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const vG={offset:"stroke-dashoffset",array:"stroke-dasharray"},yG={offset:"strokeDashoffset",array:"strokeDasharray"};function xG(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?vG:yG;e[i.offset]=ze.transform(-r);const o=ze.transform(t),l=ze.transform(n);e[i.array]=`${o} ${l}`}function bE(e,t,n){return typeof e=="string"?e:ze.transform(t+n*e)}function bG(e,t,n){const r=bE(t,e.x,e.width),s=bE(n,e.y,e.height);return`${r} ${s}`}function ww(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,h){if(bw(e,u,h),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:p,dimensions:g}=e;f.transform&&(g&&(p.transform=f.transform),delete f.transform),g&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=bG(g,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&xG(f,o,l,c,!1)}const _w=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),aM=()=>({..._w(),attrs:{}}),kw=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lM(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const cM=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function uM(e,t,n,r){lM(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(cM.has(s)?s:pw(s),t.attrs[s])}const op={};function wG(e){Object.assign(op,e)}function dM(e,{layout:t,layoutId:n}){return Va.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!op[e]||e==="opacity")}function Sw(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(On(s[o])||t.style&&On(t.style[o])||dM(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function hM(e,t,n){const r=Sw(e,t,n);for(const s in e)if(On(e[s])||On(t[s])){const i=Ec.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function _G(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const wE=["x","y","width","height","cx","cy","r"],kG={useVisualState:rM({scrapeMotionValuesFromProps:hM,createRenderState:aM,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(Va.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<wE.length;l++){const c=wE[l];e[c]!==t[c]&&(o=!0)}o&&Et.read(()=>{_G(n,r),Et.render(()=>{ww(r,s,kw(n.tagName),e.transformTemplate),uM(n,r)})})}})},SG={useVisualState:rM({scrapeMotionValuesFromProps:Sw,createRenderState:_w})};function fM(e,t,n){for(const r in t)!On(t[r])&&!dM(r,n)&&(e[r]=t[r])}function EG({transformTemplate:e},t){return m.useMemo(()=>{const n=_w();return bw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function NG(e,t){const n=e.style||{},r={};return fM(r,n,e),Object.assign(r,EG(e,t)),r}function CG(e,t){const n={},r=NG(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function jG(e,t,n,r){const s=m.useMemo(()=>{const i=aM();return ww(i,t,kw(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};fM(i,e.style,e),s.style={...i,...s.style}}return s}function TG(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(gw(n)?jG:CG)(r,i,o,n),u=Hq(r,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:s}:{},{children:h}=r,f=m.useMemo(()=>On(h)?h.get():h,[h]);return m.createElement(n,{...d,children:f})}}function PG(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...gw(r)?kG:SG,preloadedFeatures:e,useRender:TG(s),createVisualElement:t,Component:r};return Jq(o)}}function pM(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Nm(e,t,n){const r=e.getProps();return vw(r,t,n!==void 0?n:r.custom,e)}const mM=dw(()=>window.ScrollTimeline!==void 0);class AG{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(mM()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class IG extends AG{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function Ew(e,t){return e?e[t]||e.default||e:void 0}const jx=2e4;function gM(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<jx;)t+=n,r=e.next(t);return t>=jx?1/0:t}function Nw(e){return typeof e=="function"}function _E(e,t){e.timeline=t,e.onfinish=null}const Cw=e=>Array.isArray(e)&&typeof e[0]=="number",RG={linearEasing:void 0};function MG(e,t){const n=dw(e);return()=>{var r;return(r=RG[t])!==null&&r!==void 0?r:n()}}const ap=MG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),vM=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(ka(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function yM(e){return!!(typeof e=="function"&&ap()||!e||typeof e=="string"&&(e in Tx||ap())||Cw(e)||Array.isArray(e)&&e.every(yM))}const yu=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Tx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:yu([0,.65,.55,1]),circOut:yu([.55,0,1,.45]),backIn:yu([.31,.01,.66,-.59]),backOut:yu([.33,1.53,.69,.99])};function xM(e,t){if(e)return typeof e=="function"&&ap()?vM(e,t):Cw(e)?yu(e):Array.isArray(e)?e.map(n=>xM(n,t)||Tx.easeOut):Tx[e]}const qr={x:!1,y:!1};function bM(){return qr.x||qr.y}function wM(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function _M(e,t){const n=wM(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function kE(e){return t=>{t.pointerType==="touch"||bM()||e(t)}}function OG(e,t,n={}){const[r,s,i]=_M(e,n),o=kE(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=kE(h=>{u(h),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const kM=(e,t)=>t?e===t?!0:kM(e,t.parentElement):!1,jw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,DG=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function LG(e){return DG.has(e.tagName)||e.tabIndex!==-1}const xu=new WeakSet;function SE(e){return t=>{t.key==="Enter"&&e(t)}}function uv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const FG=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=SE(()=>{if(xu.has(n))return;uv(n,"down");const s=SE(()=>{uv(n,"up")}),i=()=>uv(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function EE(e){return jw(e)&&!bM()}function $G(e,t,n={}){const[r,s,i]=_M(e,n),o=l=>{const c=l.currentTarget;if(!EE(l)||xu.has(c))return;xu.add(c);const u=t(l),d=(p,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),!(!EE(p)||!xu.has(c))&&(xu.delete(c),typeof u=="function"&&u(p,{success:g}))},h=p=>{d(p,n.useGlobalTarget||kM(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",f,s)};return r.forEach(l=>{!LG(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>FG(u,s),s)}),i}function VG(e){return e==="x"||e==="y"?qr[e]?null:(qr[e]=!0,()=>{qr[e]=!1}):qr.x||qr.y?null:(qr.x=qr.y=!0,()=>{qr.x=qr.y=!1})}const SM=new Set(["width","height","top","left","right","bottom",...Ec]);let ff;function BG(){ff=void 0}const As={now:()=>(ff===void 0&&As.set(wn.isProcessing||Fq.useManualTiming?wn.timestamp:performance.now()),ff),set:e=>{ff=e,queueMicrotask(BG)}};function Tw(e,t){e.indexOf(t)===-1&&e.push(t)}function Pw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Aw{constructor(){this.subscriptions=[]}add(t){return Tw(this.subscriptions,t),()=>Pw(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Iw(e,t){return t?e*(1e3/t):0}const NE=30,UG=e=>!isNaN(parseFloat(e)),CE={current:void 0};class zG{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=As.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=As.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=UG(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Aw);const r=this.events[t].add(n);return t==="change"?()=>{r(),Et.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return CE.current&&CE.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=As.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>NE)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,NE);return Iw(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function hi(e,t){return new zG(e,t)}function HG(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,hi(n))}function WG(e,t){const n=Nm(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=iG(i[o]);HG(e,o,l)}}function qG(e){return!!(On(e)&&e.add)}function Px(e,t){const n=e.getValue("willChange");if(qG(n))return n.add(t)}function EM(e){return e.props[eM]}const NM=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,GG=1e-7,KG=12;function YG(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=NM(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>GG&&++l<KG);return o}function Xd(e,t,n,r){if(e===t&&n===r)return Qn;const s=i=>YG(i,0,1,e,n);return i=>i===0||i===1?i:NM(s(i),t,r)}const CM=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jM=e=>t=>1-e(1-t),TM=Xd(.33,1.53,.69,.99),Rw=jM(TM),PM=CM(Rw),AM=e=>(e*=2)<1?.5*Rw(e):.5*(2-Math.pow(2,-10*(e-1))),Mw=e=>1-Math.sin(Math.acos(e)),IM=jM(Mw),RM=CM(Mw),MM=e=>/^0[^.\s]+$/u.test(e);function QG(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||MM(e):!0}const $u=e=>Math.round(e*1e5)/1e5,Ow=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZG(e){return e==null}const XG=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dw=(e,t)=>n=>!!(typeof n=="string"&&XG.test(n)&&n.startsWith(e)||t&&!ZG(n)&&Object.prototype.hasOwnProperty.call(n,t)),OM=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Ow);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},JG=e=>Ls(0,255,e),dv={...Nc,transform:e=>Math.round(JG(e))},ra={test:Dw("rgb","red"),parse:OM("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+dv.transform(e)+", "+dv.transform(t)+", "+dv.transform(n)+", "+$u(yd.transform(r))+")"};function eK(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Ax={test:Dw("#"),parse:eK,transform:ra.transform},yl={test:Dw("hsl","hue"),parse:OM("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ps.transform($u(t))+", "+Ps.transform($u(n))+", "+$u(yd.transform(r))+")"},An={test:e=>ra.test(e)||Ax.test(e)||yl.test(e),parse:e=>ra.test(e)?ra.parse(e):yl.test(e)?yl.parse(e):Ax.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ra.transform(e):yl.transform(e)},tK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function nK(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ow))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(tK))===null||n===void 0?void 0:n.length)||0)>0}const DM="number",LM="color",rK="var",sK="var(",jE="${}",iK=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function xd(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(iK,c=>(An.test(c)?(r.color.push(i),s.push(LM),n.push(An.parse(c))):c.startsWith(sK)?(r.var.push(i),s.push(rK),n.push(c)):(r.number.push(i),s.push(DM),n.push(parseFloat(c))),++i,jE)).split(jE);return{values:n,split:l,indexes:r,types:s}}function FM(e){return xd(e).values}function $M(e){const{split:t,types:n}=xd(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===DM?i+=$u(s[o]):l===LM?i+=An.transform(s[o]):i+=s[o]}return i}}const oK=e=>typeof e=="number"?0:e;function aK(e){const t=FM(e);return $M(e)(t.map(oK))}const bo={test:nK,parse:FM,createTransformer:$M,getAnimatableNone:aK},lK=new Set(["brightness","contrast","saturate","opacity"]);function cK(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ow)||[];if(!r)return e;const s=n.replace(r,"");let i=lK.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const uK=/\b([a-z-]*)\(.*?\)/gu,Ix={...bo,getAnimatableNone:e=>{const t=e.match(uK);return t?t.map(cK).join(" "):e}},dK={...xw,color:An,backgroundColor:An,outlineColor:An,fill:An,stroke:An,borderColor:An,borderTopColor:An,borderRightColor:An,borderBottomColor:An,borderLeftColor:An,filter:Ix,WebkitFilter:Ix},Lw=e=>dK[e];function VM(e,t){let n=Lw(e);return n!==Ix&&(n=bo),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const hK=new Set(["auto","none","0"]);function fK(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!hK.has(i)&&xd(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=VM(n,s)}const TE=e=>e===Nc||e===ze,PE=(e,t)=>parseFloat(e.split(", ")[t]),AE=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return PE(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?PE(i[1],e):0}},pK=new Set(["x","y","z"]),mK=Ec.filter(e=>!pK.has(e));function gK(e){const t=[];return mK.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const oc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:AE(4,13),y:AE(5,14)};oc.translateX=oc.x;oc.translateY=oc.y;const ga=new Set;let Rx=!1,Mx=!1;function BM(){if(Mx){const e=Array.from(ga).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=gK(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Mx=!1,Rx=!1,ga.forEach(e=>e.complete()),ga.clear()}function UM(){ga.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mx=!0)})}function vK(){UM(),BM()}class Fw{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ga.add(this),Rx||(Rx=!0,Et.read(UM),Et.resolveKeyframes(BM))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),ga.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ga.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const zM=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),yK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xK(e){const t=yK.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function HM(e,t,n=1){const[r,s]=xK(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return zM(o)?parseFloat(o):o}return yw(s)?HM(s,t,n+1):s}const WM=e=>t=>t.test(e),bK={test:e=>e==="auto",parse:e=>e},qM=[Nc,ze,Ps,Ui,dG,uG,bK],IE=e=>qM.find(WM(e));class GM extends Fw{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),yw(u))){const d=HM(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!SM.has(r)||t.length!==2)return;const[s,i]=t,o=IE(s),l=IE(i);if(o!==l)if(TE(o)&&TE(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)QG(t[s])&&r.push(s);r.length&&fK(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=oc[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=oc[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const RE=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(bo.test(e)||e==="0")&&!e.startsWith("url("));function wK(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function _K(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=RE(s,t),l=RE(i,t);return!o||!l?!1:wK(e)||(n==="spring"||Nw(n))&&r}const kK=e=>e!==null;function Cm(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(kK),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const SK=40;class KM{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=As.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>SK?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&vK(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=As.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!_K(t,r,s,i))if(o)this.options.duration=0;else{c&&c(Cm(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Kt=(e,t,n)=>e+(t-e)*n;function hv(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function EK({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=hv(c,l,e+1/3),i=hv(c,l,e),o=hv(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function lp(e,t){return n=>n>0?t:e}const fv=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},NK=[Ax,ra,yl],CK=e=>NK.find(t=>t.test(e));function ME(e){const t=CK(e);if(!t)return!1;let n=t.parse(e);return t===yl&&(n=EK(n)),n}const OE=(e,t)=>{const n=ME(e),r=ME(t);if(!n||!r)return lp(e,t);const s={...n};return i=>(s.red=fv(n.red,r.red,i),s.green=fv(n.green,r.green,i),s.blue=fv(n.blue,r.blue,i),s.alpha=Kt(n.alpha,r.alpha,i),ra.transform(s))},jK=(e,t)=>n=>t(e(n)),Jd=(...e)=>e.reduce(jK),Ox=new Set(["none","hidden"]);function TK(e,t){return Ox.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function PK(e,t){return n=>Kt(e,t,n)}function $w(e){return typeof e=="number"?PK:typeof e=="string"?yw(e)?lp:An.test(e)?OE:RK:Array.isArray(e)?YM:typeof e=="object"?An.test(e)?OE:AK:lp}function YM(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>$w(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function AK(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=$w(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function IK(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const RK=(e,t)=>{const n=bo.createTransformer(t),r=xd(e),s=xd(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Ox.has(e)&&!s.values.length||Ox.has(t)&&!r.values.length?TK(e,t):Jd(YM(IK(r,s),s.values),n):lp(e,t)};
vendor: 5,500 bytes, line 590
590function QM(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Kt(e,t,n):$w(e)(e,t)}const MK=5;function ZM(e,t,n){const r=Math.max(t-MK,0);return Iw(n-e(r),t-r)}const Jt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},pv=.001;function OK({duration:e=Jt.duration,bounce:t=Jt.bounce,velocity:n=Jt.velocity,mass:r=Jt.mass}){let s,i,o=1-t;o=Ls(Jt.minDamping,Jt.maxDamping,o),e=Ls(Jt.minDuration,Jt.maxDuration,mi(e)),o<1?(s=u=>{const d=u*o,h=d*e,f=d-n,p=Dx(u,o),g=Math.exp(-h);return pv-f/p*g},i=u=>{const h=u*o*e,f=h*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-h),v=Dx(Math.pow(u,2),o);return(-s(u)+pv>0?-1:1)*((f-p)*g)/v}):(s=u=>{const d=Math.exp(-u*e),h=(u-n)*e+1;return-pv+d*h},i=u=>{const d=Math.exp(-u*e),h=(n-u)*(e*e);return d*h});const l=5/e,c=LK(s,i,l);if(e=pi(e),isNaN(c))return{stiffness:Jt.stiffness,damping:Jt.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const DK=12;function LK(e,t,n){let r=n;for(let s=1;s<DK;s++)r=r-e(r)/t(r);return r}function Dx(e,t){return e*Math.sqrt(1-t*t)}const FK=["duration","bounce"],$K=["stiffness","damping","mass"];function DE(e,t){return t.some(n=>e[n]!==void 0)}function VK(e){let t={velocity:Jt.velocity,stiffness:Jt.stiffness,damping:Jt.damping,mass:Jt.mass,isResolvedFromDuration:!1,...e};if(!DE(e,$K)&&DE(e,FK))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ls(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Jt.mass,stiffness:s,damping:i}}else{const n=OK(e);t={...t,...n,mass:Jt.mass},t.isResolvedFromDuration=!0}return t}function XM(e=Jt.visualDuration,t=Jt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=VK({...n,velocity:-mi(n.velocity||0)}),g=f||0,v=u/(2*Math.sqrt(c*d)),y=o-i,x=mi(Math.sqrt(c/d)),b=Math.abs(y)<5;r||(r=b?Jt.restSpeed.granular:Jt.restSpeed.default),s||(s=b?Jt.restDelta.granular:Jt.restDelta.default);let w;if(v<1){const _=Dx(x,v);w=E=>{const R=Math.exp(-v*x*E);return o-R*((g+v*x*y)/_*Math.sin(_*E)+y*Math.cos(_*E))}}else if(v===1)w=_=>o-Math.exp(-x*_)*(y+(g+x*y)*_);else{const _=x*Math.sqrt(v*v-1);w=E=>{const R=Math.exp(-v*x*E),A=Math.min(_*E,300);return o-R*((g+v*x*y)*Math.sinh(A)+_*y*Math.cosh(A))/_}}const S={calculatedDuration:p&&h||null,next:_=>{const E=w(_);if(p)l.done=_>=h;else{let R=0;v<1&&(R=_===0?pi(g):ZM(w,_,E));const A=Math.abs(R)<=r,N=Math.abs(o-E)<=s;l.done=A&&N}return l.value=l.done?o:E,l},toString:()=>{const _=Math.min(gM(S),jx),E=vM(R=>S.next(_*R).value,_,30);return _+"ms "+E}};return S}function LE({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const h=e[0],f={done:!1,value:h},p=A=>l!==void 0&&A<l||c!==void 0&&A>c,g=A=>l===void 0?c:c===void 0||Math.abs(l-A)<Math.abs(c-A)?l:c;let v=n*t;const y=h+v,x=o===void 0?y:o(y);x!==y&&(v=x-h);const b=A=>-v*Math.exp(-A/r),w=A=>x+b(A),S=A=>{const N=b(A),k=w(A);f.done=Math.abs(N)<=u,f.value=f.done?x:k};let _,E;const R=A=>{p(f.value)&&(_=A,E=XM({keyframes:[f.value,g(f.value)],velocity:ZM(w,A,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return R(0),{calculatedDuration:null,next:A=>{let N=!1;return!E&&_===void 0&&(N=!0,S(A),R(A)),_!==void 0&&A>=_?E.next(A-_):(!N&&S(A),f)}}}const BK=Xd(.42,0,1,1),UK=Xd(0,0,.58,1),JM=Xd(.42,0,.58,1),zK=e=>Array.isArray(e)&&typeof e[0]!="number",HK={linear:Qn,easeIn:BK,easeInOut:JM,easeOut:UK,circIn:Mw,circInOut:RM,circOut:IM,backIn:Rw,backInOut:PM,backOut:TM,anticipate:AM},FE=e=>{if(Cw(e)){Y2(e.length===4);const[t,n,r,s]=e;return Xd(t,n,r,s)}else if(typeof e=="string")return HK[e];return e};function WK(e,t,n){const r=[],s=n||QM,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Qn:t;l=Jd(c,l)}r.push(l)}return r}function eO(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Y2(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=WK(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(d<e[h+1]);h++);const f=ka(e[h],e[h+1],d);return l[h](f)};return n?d=>u(Ls(e[0],e[i-1],d)):u}function qK(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=ka(0,t,r);e.push(Kt(n,1,s))}}function tO(e){const t=[0];return qK(t,e.length-1),t}function GK(e,t){return e.map(n=>n*t)}function KK(e,t){return e.map(()=>t||JM).splice(0,e.length-1)}function cp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=zK(r)?r.map(FE):FE(r),i={done:!1,value:t[0]},o=GK(n&&n.length===t.length?n:tO(t),e),l=eO(o,t,{ease:Array.isArray(s)?s:KK(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const YK=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Et.update(t,!0),stop:()=>Ds(t),now:()=>wn.isProcessing?wn.timestamp:As.now()}},QK={decay:LE,inertia:LE,tween:cp,keyframes:cp,spring:XM},ZK=e=>e/100;class Vw extends KM{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>
vendor: 4,322 bytes, line 590
590{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Fw,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=Nw(n)?n:QK[n]||cp;let c,u;l!==cp&&typeof t[0]!="number"&&(c=Jd(ZK,QM(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=gM(d));const{calculatedDuration:h}=d,f=h+s,p=f*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:h,resolvedDuration:f,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:A}=this.options;return{done:!0,value:A[A.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:h}=r;if(this.startTime===null)return i.next(0);const{delay:f,repeat:p,repeatType:g,repeatDelay:v,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const x=this.currentTime-f*(this.speed>=0?1:-1),b=this.speed>=0?x<0:x>d;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let w=this.currentTime,S=i;if(p){const A=Math.min(this.currentTime,d)/h;let N=Math.floor(A),k=A%1;!k&&A>=1&&(k=1),k===1&&N--,N=Math.min(N,p+1),!!(N%2)&&(g==="reverse"?(k=1-k,v&&(k-=v/h)):g==="mirror"&&(S=o)),w=Ls(0,1,k)*h}const _=b?{done:!1,value:c[0]}:S.next(w);l&&(_.value=l(_.value));let{done:E}=_;!b&&u!==null&&(E=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return R&&s!==void 0&&(_.value=Cm(c,this.options,s)),y&&y(_.value),R&&this.finish(),_}get duration(){const{resolved:t}=this;return t?mi(t.calculatedDuration):0}get time(){return mi(this.currentTime)}set time(t){t=pi(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=mi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=YK,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const XK=new Set(["opacity","clipPath","filter","transform"]);function JK(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:
vendor: 4,145 bytes, line 590
590o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=xM(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const eY=dw(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),up=10,tY=2e4;function nY(e){return Nw(e.type)||e.type==="spring"||!yM(e.ease)}function rY(e,t){const n=new Vw({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<tY;)r=n.sample(i),s.push(r.value),i+=up;return{times:void 0,keyframes:s,duration:i-up,ease:"linear"}}const nO={anticipate:AM,backInOut:PM,circInOut:RM};function sY(e){return e in nO}class $E extends KM{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new GM(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&ap()&&sY(i)&&(i=nO[i]),nY(this.options)){const{onComplete:h,onUpdate:f,motionValue:p,element:g,...v}=this.options,y=rY(t,v);t=y.keyframes,t.length===1&&(t[1]=t[0]),r=y.duration,s=y.times,i=y.ease,o="keyframes"}const d=JK(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(_E(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:h}=this.options;l.set(Cm(t,this.options,n)),h&&h(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return mi(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return mi(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=pi(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Qn;const{animation:r}=n;_E(r,t)}return Qn}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:h,element:f,...p}=this.options,g=new Vw({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),v=pi(this.time);u.setWithVelocity(g.sample(v-up).value,g.sample(v).value,up)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return eY()&&r&&XK.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const iY={type:"spring",stiffness:500,damping:25,restSpeed:10},oY=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),aY={type:"keyframes",duration:.8},lY={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},cY=(e,{keyframes:t})=>t.length>2?aY:Va.has(e)?e.startsWith("scale")?oY(t[1]):iY:lY;function uY({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:
vendor: 48,499 bytes, line 590
590o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Bw=(e,t,n,r={},s,i)=>o=>{const l=Ew(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-pi(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};uY(l)||(d={...d,...cY(e,d)}),d.duration&&(d.duration=pi(d.duration)),d.repeatDelay&&(d.repeatDelay=pi(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(h=!0)),h&&!i&&t.get()!==void 0){const f=Cm(d.keyframes,l);if(f!==void 0)return Et.update(()=>{d.onUpdate(f),d.onComplete()}),new IG([])}return!i&&$E.supports(d)?new $E(d):new Vw(d)};function dY({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function rO(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const h in c){const f=e.getValue(h,(i=e.latestValues[h])!==null&&i!==void 0?i:null),p=c[h];if(p===void 0||d&&dY(d,h))continue;const g={delay:n,...Ew(o||{},h)};let v=!1;if(window.MotionHandoffAnimation){const x=EM(e);if(x){const b=window.MotionHandoffAnimation(x,h,Et);b!==null&&(g.startTime=b,v=!0)}}Px(e,h),f.start(Bw(h,f,p,e.shouldReduceMotion&&SM.has(h)?{type:!1}:g,e,v));const y=f.animation;y&&u.push(y)}return l&&Promise.all(u).then(()=>{Et.update(()=>{l&&WG(e,l)})}),u}function Lx(e,t,n={}){var r;const s=Nm(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(rO(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=i;return hY(e,t,d+u,h,f,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function hY(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(fY).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(Lx(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function fY(e,t){return e.sortNodePosition(t)}function pY(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Lx(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Lx(e,t,n);else{const s=typeof t=="function"?Nm(e,t,n.custom):t;r=Promise.all(rO(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const mY=fw.length;function sO(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?sO(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<mY;n++){const r=fw[n],s=e.props[r];(vd(s)||s===!1)&&(t[r]=s)}return t}const gY=[...hw].reverse(),vY=hw.length;function yY(e){return t=>Promise.all(t.map(({animation:n,options:r})=>pY(e,n,r)))}function xY(e){let t=yY(e),n=VE(),r=!0;const s=c=>(u,d)=>{var h;const f=Nm(e,d,c==="exit"?(h=e.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(f){const{transition:p,transitionEnd:g,...v}=f;u={...u,...v,...g}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=sO(e.parent)||{},h=[],f=new Set;let p={},g=1/0;for(let y=0;y<vY;y++){const x=gY[y],b=n[x],w=u[x]!==void 0?u[x]:d[x],S=vd(w),_=x===c?b.isActive:null;_===!1&&(g=y);let E=w===d[x]&&w!==u[x]&&S;if(E&&r&&e.manuallyAnimateOnMount&&(E=!1),b.protectedKeys={...p},!b.isActive&&_===null||!w&&!b.prevProp||Sm(w)||typeof w=="boolean")continue;const R=bY(b.prevProp,w);let A=R||x===c&&b.isActive&&!E&&S||y>g&&S,N=!1;const k=Array.isArray(w)?w:[w];let T=k.reduce(s(x),{});_===!1&&(T={});const{prevResolvedValues:I={}}=b,F={...I,...T},L=j=>{A=!0,f.has(j)&&(N=!0,f.delete(j)),b.needsAnimating[j]=!0;const P=e.getValue(j);P&&(P.liveStyle=!1)};for(const j in F){const P=T[j],D=I[j];if(p.hasOwnProperty(j))continue;let C=!1;Cx(P)&&Cx(D)?C=!pM(P,D):C=P!==D,C?P!=null?L(j):f.add(j):P!==void 0&&f.has(j)?L(j):b.protectedKeys[j]=!0}b.prevProp=w,b.prevResolvedValues=T,b.isActive&&(p={...p,...T}),r&&e.blockInitialAnimation&&(A=!1),A&&(!(E&&R)||N)&&h.push(...k.map(j=>({animation:j,options:{type:x}})))}if(f.size){const y={};f.forEach(x=>{const b=e.getBaseTarget(x),w=e.getValue(x);w&&(w.liveStyle=!0),y[x]=b??null}),h.push({animation:y})}let v=!!h.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(v=!1),r=!1,v?t(h):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(f=>{var p;return(p=f.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const h=o(c);for(const f in n)n[f].protectedKeys={};return h}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=VE(),r=!0}}}function bY(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!pM(t,e):!1}function zo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function VE(){return{animate:zo(!0),whileInView:zo(),whileHover:zo(),whileTap:zo(),whileDrag:zo(),whileFocus:zo(),exit:zo()}}class Ao{constructor(t){this.isMounted=!1,this.node=t}update(){}}class wY extends Ao{constructor(t){super(t),t.animationState||(t.animationState=xY(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Sm(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let _Y=0;class kY extends Ao{constructor(){super(...arguments),this.id=_Y++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const SY={animation:{Feature:wY},exit:{Feature:kY}};function bd(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function eh(e){return{point:{x:e.pageX,y:e.pageY}}}const EY=e=>t=>jw(t)&&e(t,eh(t));function Vu(e,t,n,r){return bd(e,t,EY(n),r)}const BE=(e,t)=>Math.abs(e-t);function NY(e,t){const n=BE(e.x,t.x),r=BE(e.y,t.y);return Math.sqrt(n**2+r**2)}class iO{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=gv(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,p=NY(h.offset,{x:0,y:0})>=3;if(!f&&!p)return;const{point:g}=h,{timestamp:v}=wn;this.history.push({...g,timestamp:v});const{onStart:y,onMove:x}=this.handlers;f||(y&&y(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=mv(f,this.transformPagePoint),Et.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=gv(h.type==="pointercancel"?this.lastMoveEventInfo:mv(f,this.transformPagePoint),this.history);this.startEvent&&p&&p(h,y),g&&g(h,y)},!jw(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=eh(t),l=mv(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=wn;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,gv(l,this.history)),this.removeListeners=Jd(Vu(this.contextWindow,"pointermove",this.handlePointerMove),Vu(this.contextWindow,"pointerup",this.handlePointerUp),Vu(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ds(this.updatePoint)}}function mv(e,t){return t?{point:t(e.point)}:e}function UE(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gv({point:e},t){return{point:e,delta:UE(e,oO(t)),offset:UE(e,CY(t)),velocity:jY(t,.1)}}function CY(e){return e[0]}function oO(e){return e[e.length-1]}function jY(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=oO(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>pi(t)));)n--;if(!r)return{x:0,y:0};const i=mi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const aO=1e-4,TY=1-aO,PY=1+aO,lO=.01,AY=0-lO,IY=0+lO;function Ir(e){return e.max-e.min}function RY(e,t,n){return Math.abs(e-t)<=n}function zE(e,t,n,r=.5){e.origin=r,e.originPoint=Kt(t.min,t.max,e.origin),e.scale=Ir(n)/Ir(t),e.translate=Kt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=TY&&e.scale<=PY||isNaN(e.scale))&&(e.scale=1),(e.translate>=AY&&e.translate<=IY||isNaN(e.translate))&&(e.translate=0)}function Bu(e,t,n,r){zE(e.x,t.x,n.x,r?r.originX:void 0),zE(e.y,t.y,n.y,r?r.originY:void 0)}function HE(e,t,n){e.min=n.min+t.min,e.max=e.min+Ir(t)}function MY(e,t,n){HE(e.x,t.x,n.x),HE(e.y,t.y,n.y)}function WE(e,t,n){e.min=t.min-n.min,e.max=e.min+Ir(t)}function Uu(e,t,n){WE(e.x,t.x,n.x),WE(e.y,t.y,n.y)}function OY(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Kt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Kt(n,e,r.max):Math.min(e,n)),e}function qE(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function DY(e,{top:t,left:n,bottom:r,right:s}){return{x:qE(e.x,n,s),y:qE(e.y,t,r)}}function GE(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function LY(e,t){return{x:GE(e.x,t.x),y:GE(e.y,t.y)}}function FY(e,t){let n=.5;const r=Ir(e),s=Ir(t);return s>r?n=ka(t.min,t.max-r,e.min):r>s&&(n=ka(e.min,e.max-s,t.min)),Ls(0,1,n)}function $Y(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Fx=.35;function VY(e=Fx){return e===!1?e=0:e===!0&&(e=Fx),{x:KE(e,"left","right"),y:KE(e,"top","bottom")}}function KE(e,t,n){return{min:YE(e,t),max:YE(e,n)}}function YE(e,t){return typeof e=="number"?e:e[t]||0}const QE=()=>({translate:0,scale:1,origin:0,originPoint:0}),xl=()=>({x:QE(),y:QE()}),ZE=()=>({min:0,max:0}),rn=()=>({x:ZE(),y:ZE()});function Dr(e){return[e("x"),e("y")]}function cO({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function BY({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function UY(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function vv(e){return e===void 0||e===1}function $x({scale:e,scaleX:t,scaleY:n}){return!vv(e)||!vv(t)||!vv(n)}function Ko(e){return $x(e)||uO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function uO(e){return XE(e.x)||XE(e.y)}function XE(e){return e&&e!=="0%"}function dp(e,t,n){const r=e-n,s=t*r;return n+s}function JE(e,t,n,r,s){return s!==void 0&&(e=dp(e,s,r)),dp(e,n,r)+t}function Vx(e,t=0,n=1,r,s){e.min=JE(e.min,t,n,r,s),e.max=JE(e.max,t,n,r,s)}function dO(e,{x:t,y:n}){Vx(e.x,t.translate,t.scale,t.originPoint),Vx(e.y,n.translate,n.scale,n.originPoint)}const eN=.999999999999,tN=1.0000000000001;function zY(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&wl(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,dO(e,o)),r&&Ko(i.latestValues)&&wl(e,i.latestValues))}t.x<tN&&t.x>eN&&(t.x=1),t.y<tN&&t.y>eN&&(t.y=1)}function bl(e,t){e.min=e.min+t,e.max=e.max+t}function nN(e,t,n,r,s=.5){const i=Kt(e.min,e.max,s);Vx(e,t,n,i,r)}function wl(e,t){nN(e.x,t.x,t.scaleX,t.scale,t.originX),nN(e.y,t.y,t.scaleY,t.scale,t.originY)}function hO(e,t){return cO(UY(e.getBoundingClientRect(),t))}function HY(e,t,n){const r=hO(e,n),{scroll:s}=t;return s&&(bl(r.x,s.offset.x),bl(r.y,s.offset.y)),r}const fO=({current:e})=>e?e.ownerDocument.defaultView:null,WY=new WeakMap;class qY{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=rn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(eh(d).point)},i=(d,h)=>{const{drag:f,dragPropagation:p,onDragStart:g}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=VG(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Dr(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Ps.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const w=b.layout.layoutBox[y];w&&(x=Ir(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),g&&Et.postRender(()=>g(d,h)),Px(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(d,h)=>{const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:g,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=h;if(p&&this.currentDirection===null){this.currentDirection=GY(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),v&&v(d,h)},l=(d,h)=>this.stop(d,h),c=()=>Dr(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new iO(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:fO(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Et.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Vh(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=OY(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&vl(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=DY(s.layoutBox,n):this.constraints=!1,this.elastic=VY(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Dr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=$Y(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!vl(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=HY(r,s.root,this.visualElement.getTransformPagePoint());let o=LY(s.layout.layoutBox,i);if(n){const l=n(BY(o));this.hasMutatedConstraints=!!l,l&&(o=cO(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Dr(d=>{if(!Vh(d,n,this.currentDirection))return;let h=c&&c[d]||{};o&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Px(this.visualElement,t),r.start(Bw(t,r,0,n,this.visualElement,!1))}stopAnimation(){Dr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Dr(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Dr(n=>{const{drag:r}=this.getProps();if(!Vh(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-Kt(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!vl(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Dr(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=FY({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Dr(o=>{if(!Vh(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Kt(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;WY.set(this.visualElement,this);const t=this.visualElement.current,n=Vu(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();vl(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Et.read(r);const o=bd(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Dr(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Fx,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Vh(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function GY(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class KY extends Ao{constructor(t){super(t),this.removeGroupControls=Qn,this.removeListeners=Qn,this.controls=new qY(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Qn}unmount(){this.removeGroupControls(),this.removeListeners()}}const rN=e=>(t,n)=>{e&&Et.postRender(()=>e(t,n))};class YY extends Ao{constructor(){super(...arguments),this.removePointerDownListener=Qn}onPointerDown(t){this.session=new iO(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:fO(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:rN(t),onStart:rN(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&Et.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Vu(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const pf={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function sN(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Wc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ze.test(e))e=parseFloat(e);else return e;const n=sN(e,t.target.x),r=sN(e,t.target.y);return`${n}% ${r}%`}},QY={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=bo.parse(e);if(s.length>5)return r;const i=bo.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Kt(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class ZY extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;wG(XY),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),pf.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Et.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),mw.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function pO(e){const[t,n]=G2(),r=m.useContext(aw);return a.jsx(ZY,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(tM),isPresent:t,safeToRemove:n})}const XY={borderRadius:{...Wc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Wc,borderTopRightRadius:Wc,borderBottomLeftRadius:Wc,borderBottomRightRadius:Wc,boxShadow:QY};function JY(e,t,n){const r=On(e)?e:hi(e);return r.start(Bw("",r,t,n)),r.animation}function eQ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const tQ=(e,t)=>e.depth-t.depth;class nQ{constructor(){this.children=[],this.isDirty=!1}add(t){Tw(this.children,t),this.isDirty=!0}remove(t){Pw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(tQ),this.isDirty=!1,this.children.forEach(t)}}function rQ(e,t){const n=As.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Ds(r),e(i-t))};return Et.read(r,!0),()=>Ds(r)}const mO=["TopLeft","TopRight","BottomLeft","BottomRight"],sQ=mO.length,iN=e=>typeof e=="string"?parseFloat(e):e,oN=e=>typeof e=="number"||ze.test(e);function iQ(e,t,n,r,s,i){s?(e.opacity=Kt(0,n.opacity!==void 0?n.opacity:1,oQ(r)),e.opacityExit=Kt(t.opacity!==void 0?t.opacity:1,0,aQ(r))):i&&(e.opacity=Kt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<sQ;o++){const l=`border${mO[o]}Radius`;let c=aN(t,l),u=aN(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||oN(c)===oN(u)?(e[l]=Math.max(Kt(iN(c),iN(u),r),0),(Ps.test(u)||Ps.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Kt(t.rotate||0,n.rotate||0,r))}function aN(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const oQ=gO(0,.5,IM),aQ=gO(.5,.95,Qn);function gO(e,t,n){return r=>r<e?0:r>t?1:n(ka(e,t,r))}function lN(e,t){e.min=t.min,e.max=t.max}function Or(e,t){lN(e.x,t.x),lN(e.y,t.y)}function cN(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function uN(e,t,n,r,s){return e-=t,e=dp(e,1/n,r),s!==void 0&&(e=dp(e,1/s,r)),e}function lQ(e,t=0,n=1,r=.5,s,i=e,o=e){if(Ps.test(t)&&(t=parseFloat(t),t=Kt(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Kt(i.min,i.max,r);e===i&&(l-=t),e.min=uN(e.min,t,n,l,s),e.max=uN(e.max,t,n,l,s)}function dN(e,t,[n,r,s],i,o){lQ(e,t[n],t[r],t[s],t.scale,i,o)}const cQ=["x","scaleX","originX"],uQ=["y","scaleY","originY"];function hN(e,t,n,r){dN(e.x,t,cQ,n?n.x:void 0,r?r.x:void 0),dN(e.y,t,uQ,n?n.y:void 0,r?r.y:void 0)}function fN(e){return e.translate===0&&e.scale===1}function vO(e){return fN(e.x)&&fN(e.y)}function pN(e,t){return e.min===t.min&&e.max===t.max}function dQ(e,t){return pN(e.x,t.x)&&pN(e.y,t.y)}function mN(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yO(e,t){return mN(e.x,t.x)&&mN(e.y,t.y)}function gN(e){return Ir(e.x)/Ir(e.y)}function vN(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class hQ{constructor(){this.members=[]}add(t){Tw(this.members,t),t.scheduleRender()}remove(t){if(Pw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function fQ(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),f&&(r+=`rotateY(${f}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const Yo={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},bu=typeof window<"u"&&window.MotionDebug!==void 0,yv=["","X","Y","Z"],pQ={visibility:"hidden"},yN=1e3;let mQ=0;function xv(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function xO(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=EM(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Et,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&xO(r)}function bO({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=mQ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,bu&&(Yo.totalNodes=Yo.resolvedTargetDeltas=Yo.recalculatedProjection=0),this.nodes.forEach(yQ),this.nodes.forEach(kQ),this.nodes.forEach(SQ),this.nodes.forEach(xQ),bu&&window.MotionDebug.record(Yo)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new nQ)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Aw),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=eQ(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let h;const f=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=rQ(f,250),pf.hasAnimatedSinceResize&&(pf.hasAnimatedSinceResize=!1,this.nodes.forEach(bN))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||d.getDefaultTransition()||TQ,{onLayoutAnimationStart:y,onLayoutAnimationComplete:x}=d.getProps(),b=!this.targetLayout||!yO(this.targetLayout,g)||p,w=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||f&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,w);const S={...Ew(v,"layout"),onPlay:y,onComplete:x};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else f||bN(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ds(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(EQ),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(xN);return}this.isUpdating||this.nodes.forEach(wQ),this.isUpdating=!1,this.nodes.forEach(_Q),this.nodes.forEach(gQ),this.nodes.forEach(vQ),this.clearAllSnapshots();const l=As.now();wn.delta=Ls(0,1e3/60,l-wn.timestamp),wn.timestamp=l,wn.isProcessing=!0,cv.update.process(wn),cv.preRender.process(wn),cv.render.process(wn),wn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,mw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bQ),this.sharedNodes.forEach(NQ)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Et.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Et.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=rn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!vO(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||Ko(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),PQ(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return rn();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(AQ))){const{scroll:d}=this.root;d&&(bl(c.x,d.offset.x),bl(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=rn();if(Or(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:f}=d;d!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&Or(c,o),bl(c.x,h.offset.x),bl(c.y,h.offset.y))}return c}applyTransform(o,l=!1){const c=rn();Or(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&wl(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Ko(d.latestValues)&&wl(c,d.latestValues)}return Ko(this.latestValues)&&wl(c,this.latestValues),c}removeTransform(o){const l=rn();Or(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Ko(u.latestValues))continue;$x(u.latestValues)&&u.updateSnapshot();const d=rn(),h=u.measurePageBox();Or(d,h),hN(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Ko(this.latestValues)&&hN(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==wn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:f}=this.options;if(!(!this.layout||!(h||f))){if(this.resolvedRelativeTargetAt=wn.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rn(),this.relativeTargetOrigin=rn(),Uu(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Or(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=rn(),this.targetWithTransforms=rn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),MY(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Or(this.target,this.layout.layoutBox),dO(this.target,this.targetDelta)):Or(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rn(),this.relativeTargetOrigin=rn(),Uu(this.relativeTargetOrigin,this.target,p.target),Or(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}bu&&Yo.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||$x(this.parent.latestValues)||uO(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===wn.timestamp&&(u=!1),u)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;Or(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,p=this.treeScale.y;zY(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=rn());const{target:g}=l;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(cN(this.prevProjectionDelta.x,this.projectionDelta.x),cN(this.prevProjectionDelta.y,this.projectionDelta.y)),Bu(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==p||!vN(this.projectionDelta.x,this.prevProjectionDelta.x)||!vN(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),bu&&Yo.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=xl(),this.projectionDelta=xl(),this.projectionDeltaWithTransform=xl()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=xl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=rn(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,v=p!==g,y=this.getStack(),x=!y||y.members.length<=1,b=!!(v&&!x&&this.options.crossfade===!0&&!this.path.some(jQ));this.animationProgress=0;let w;this.mixTargetDelta=S=>{const _=S/1e3;wN(h.x,o.x,_),wN(h.y,o.y,_),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Uu(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),CQ(this.relativeTarget,this.relativeTargetOrigin,f,_),w&&dQ(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=rn()),Or(w,this.relativeTarget)),v&&(this.animationValues=d,iQ(d,u,this.latestValues,_,b,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ds(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Et.update(()=>{pf.hasAnimatedSinceResize=!0,this.currentAnimation=JY(0,yN,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(yN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&wO(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||rn();const h=Ir(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const f=Ir(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}Or(l,c),wl(l,d),Bu(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new hQ),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&xv("z",o,u,this.animationValues);for(let d=0;d<yv.length;d++)xv(`rotate${yv[d]}`,o,u,this.animationValues),xv(`skew${yv[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return pQ;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=hf(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const v={};return this.options.layoutId&&(v.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,v.pointerEvents=hf(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Ko(this.latestValues)&&(v.transform=d?d({},""):"none",this.hasProjected=!1),v}const f=h.animationValues||h.latestValues;this.applyTransformsToTarget(),u.transform=fQ(this.projectionDeltaWithTransform,this.treeScale,f),d&&(u.transform=d(f,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,h.animationValues?u.opacity=h===this?(c=(l=f.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:u.opacity=h===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const v in op){if(f[v]===void 0)continue;const{correct:y,applyTo:x}=op[v],b=u.transform==="none"?f[v]:y(f[v],h);if(x){const w=x.length;for(let S=0;S<w;S++)u[x[S]]=b}else u[v]=b}return this.options.layoutId&&(u.pointerEvents=h===this?hf(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(xN),this.root.sharedNodes.clear()}}}function gQ(e){e.updateLayout()}function vQ(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Dr(h=>{const f=o?n.measuredBox[h]:n.layoutBox[h],p=Ir(f);f.min=r[h].min,f.max=f.min+p}):wO(i,n.layoutBox,r)&&Dr(h=>{const f=o?n.measuredBox[h]:n.layoutBox[h],p=Ir(r[h]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+p)});const l=xl();Bu(l,r,n.layoutBox);const c=xl();o?Bu(c,e.applyTransform(s,!0),n.measuredBox):Bu(c,r,n.layoutBox);const u=!vO(l);let d=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const g=rn();Uu(g,n.layoutBox,f.layoutBox);const v=rn();Uu(v,r,p.layoutBox),yO(g,v)||(d=!0),h.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=g,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function yQ(e){bu&&Yo.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function xQ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bQ(e){e.clearSnapshot()}function xN(e){e.clearMeasurements()}function wQ(e){e.isLayoutDirty=!1}function _Q(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function bN(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function kQ(e){e.resolveTargetDelta()}function SQ(e){e.calcProjection()}
vendor: 6,595 bytes, line 590
590function EQ(e){e.resetSkewAndRotation()}function NQ(e){e.removeLeadSnapshot()}function wN(e,t,n){e.translate=Kt(t.translate,0,n),e.scale=Kt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function _N(e,t,n,r){e.min=Kt(t.min,n.min,r),e.max=Kt(t.max,n.max,r)}function CQ(e,t,n,r){_N(e.x,t.x,n.x,r),_N(e.y,t.y,n.y,r)}function jQ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const TQ={duration:.45,ease:[.4,0,.1,1]},kN=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),SN=kN("applewebkit/")&&!kN("chrome/")?Math.round:Qn;function EN(e){e.min=SN(e.min),e.max=SN(e.max)}function PQ(e){EN(e.x),EN(e.y)}function wO(e,t,n){return e==="position"||e==="preserve-aspect"&&!RY(gN(t),gN(n),.2)}function AQ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const IQ=bO({attachResizeListener:(e,t)=>bd(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bv={current:void 0},_O=bO({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!bv.current){const e=new IQ({});e.mount(window),e.setOptions({layoutScroll:!0}),bv.current=e}return bv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),RQ={pan:{Feature:YY},drag:{Feature:KY,ProjectionNode:_O,MeasureLayout:pO}};function NN(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Et.postRender(()=>i(t,eh(t)))}class MQ extends Ao{mount(){const{current:t}=this.node;t&&(this.unmount=OG(t,n=>(NN(this.node,n,"Start"),r=>NN(this.node,r,"End"))))}unmount(){}}class OQ extends Ao{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Jd(bd(this.node.current,"focus",()=>this.onFocus()),bd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function CN(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Et.postRender(()=>i(t,eh(t)))}class DQ extends Ao{mount(){const{current:t}=this.node;t&&(this.unmount=$G(t,n=>(CN(this.node,n,"Start"),(r,{success:s})=>CN(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Bx=new WeakMap,wv=new WeakMap,LQ=e=>{const t=Bx.get(e.target);t&&t(e)},FQ=e=>{e.forEach(LQ)};function $Q({root:e,...t}){const n=e||document;wv.has(n)||wv.set(n,{});const r=wv.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(FQ,{root:e,...t})),r[s]}function VQ(e,t,n){const r=$Q(t);return Bx.set(e,n),r.observe(e),()=>{Bx.delete(e),r.unobserve(e)}}const BQ={some:0,all:1};class UQ extends Ao{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:BQ[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(c)};return VQ(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(zQ(t,n))&&this.startObserver()}unmount(){}}function zQ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const HQ={inView:{Feature:UQ},tap:{Feature:DQ},focus:{Feature:OQ},hover:{Feature:MQ}},WQ={layout:{ProjectionNode:_O,MeasureLayout:pO}},Ux={current:null},kO={current:!1};function qQ(){if(kO.current=!0,!!cw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ux.current=e.matches;e.addListener(t),t()}else Ux.current=!1}const GQ=[...qM,An,bo],KQ=e=>GQ.find(WM(e)),jN=new WeakMap;function YQ(e,t,n){for(const r in t){const s=t[r],i=n[r];if(On(s))e.addValue(r,s);else if(On(i))e.addValue(r,hi(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,hi(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const TN=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class QQ{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Fw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=As.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,Et.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Em(n),this.isVariantNode=J2(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in f){const g=f[p];c[p]!==void 0&&On(g)&&g.set(c[p],!1)}}mount(t){this.current=t,jN.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEac
vendor: 6,037 bytes, line 590
590h((n,r)=>this.bindToMotionValue(r,n)),kO.current||qQ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ux.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){jN.delete(this.current),this.projection&&this.projection.unmount(),Ds(this.notifyUpdate),Ds(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Va.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Et.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ic){const n=ic[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):rn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<TN.length;r++){const s=TN[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=YQ(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=hi(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(zM(s)||MM(s))?s=parseFloat(s):!KQ(s)&&bo.test(n)&&(s=VM(t,n)),this.setBaseTarget(t,On(s)?s.get():s)),On(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=vw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!On(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Aw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class SO extends QQ{constructor(){super(...arguments),this.KeyframeResolver=GM}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;On(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZQ(e){return window.getComputedStyle(e)}class XQ extends SO{constructor(){super(...arguments),this.type="html",this.renderInstance=lM}readValueFromInstance(t,n){if(Va.has(n)){const r=Lw(n);return r&&r.default||0}else{const r=ZQ(t),s=(iM(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return hO(t,n)}build(t,n,r){bw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Sw(t,n,r)}}class JQ extends SO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=rn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Va.has(n)){const r=Lw(n);return r&&r.default||0}return n=cM.has(n)?n:pw(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return hM(t,n,r)}build(t,n,r){ww(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){uM(t,n,r,s)}mount(t){this.isSVGTag=kw(t.tagName),super.mount(t)}}const eZ=(e,t)=>gw(e)?new JQ(t):new XQ(t,{allowProjection:e!==m.Fragment}),tZ=PG({...SY,...HQ,...RQ,...WQ},eZ),kn=Wq(tZ);
590function nZ(e,t,n){m.useInsertionEffect(()=>e.on(t,n),[e,t,n])}function EO(e,t){let n;const r=()=>{const{currentTime:s}=t,o=(s===null?0:s.value)/100;n!==o&&e(o),n=o};return Et.update(r,!0),()=>Ds(r)}const mf=new WeakMap;let zi;function rZ(e,t){if(t){const{inlineSize:n,blockSize:r}=t[0];return{width:n,height:r}}else return e instanceof SVGElement&&"getBBox"in e?e.getBBox():{width:e.offsetWidth,height:e.offsetHeight}}function sZ({target:e,contentRect:t,borderBoxSize:n}){var r;(r=mf.get(e))===null||r===void 0||r.forEach(s=>{s({target:e,contentSize:t,get size(){return rZ(e,n)}})})}function iZ(e){e.forEach(sZ)}function oZ(){typeof ResizeObserver>"u"||(zi=new ResizeObserver(iZ))}function aZ(e,t){zi||oZ();const n=wM(e);return n.forEach(r=>{let s=mf.get(r);s||(s=new Set,mf.set(r,s)),s.add(t),zi==null||zi.observe(r)}),()=>{n.forEach(r=>{const s=mf.get(r);s==null||s.delete(t),s!=null&&s.size||zi==null||zi.unobserve(r)})}}const gf=new Set;let zu;function lZ(){zu=()=>{const e={width:window.innerWidth,height:window.innerHeight},t={target:window,size:e,contentSize:e};gf.forEach(n=>n(t))},window.addEventListener("resize",zu)}function cZ(e){return gf.add(e),zu||lZ(),()=>{gf.delete(e),!gf.size&&zu&&(zu=void 0)}}function uZ(e,t){return typeof e=="function"?cZ(e):aZ(e,t)}const dZ=50,PN=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),hZ=()=>({time:0,x:PN(),y:PN()}),fZ={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function AN(e,t,n,r){const s=n[t],{length:i,position:o}=fZ[t],l=s.current,c=n.time;s.current=e[`scroll${o}`],s.scrollLength=e[`scroll${i}`]-e[`client${i}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=ka(0,s.scrollLength,s.current);const u=r-c;s.velocity=u>dZ?0:Iw(s.current-l,u)}function pZ(e,t,n){AN(e,"x",t,n),AN(e,"y",t,n),t.time=n}function mZ(e,t){const n={x:0,y:0};let r=e;for(;r&&r!==t;)if(r instanceof HTMLElement)n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const s=r.getBoundingClientRect();r=r.parentElement;const i=r.getBoundingClientRect();n.x+=s.left-i.left,n.y+=s.top-i.top}else if(r instanceof SVGGraphicsElement){const{x:s,y:i}=r.getBBox();n.x+=s,n.y+=i;let o=null,l=r.parentNode;for(;!o;)l.tagName==="svg"&&(o=l),l=r.parentNode;r=o}else break;return n}const zx={start:0,center:.5,end:1};function IN(e,t,n=0){let r=0;if(e in zx&&(e=zx[e]),typeof e=="string"){const s=parseFloat(e);e.endsWith("px")?r=s:e.endsWith("%")?e=s/100:e.endsWith("vw")?r=s/100*document.documentElement.clientWidth:e.endsWith("vh")?r=s/100*document.documentElement.clientHeight:e=s}return typeof e=="number"&&(r=t*e),n+r}const gZ=[0,0];function vZ(e,t,n,r){let s=Array.isArray(e)?e:gZ,i=0,o=0;return typeof e=="number"?s=[e,e]:typeof e=="string"&&(e=e.trim(),e.includes(" ")?s=e.split(" "):s=[e,zx[e]?e:"0"]),i=IN(s[0],n,r),o=IN(s[1],t),i-o}const yZ={All:[[0,0],[1,1]]},xZ={x:0,y:0};function bZ(e){return"getBBox"in e&&e.tagName!=="svg"?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}function wZ(e,t,n){const{offset:r=yZ.All}=n,{target:s=e,axis:i="y"}=n,o=i==="y"?"height":"width",l=s!==e?mZ(s,e):xZ,c=s===e?{width:e.scrollWidth,height:e.scrollHeight}:bZ(s),u={width:e.clientWidth,height:e.clientHeight};t[i].offset.length=0;let d=!t[i].interpolate;const h=r.length;for(let f=0;f<h;f++){const p=vZ(r[f],u[o],c[o],l[i]);!d&&p!==t[i].interpolatorOffsets[f]&&(d=!0),t[i].offset[f]=p}d&&(t[i].interpolate=eO(t[i].offset,tO(r),{clamp:!1}),t[i].interpolatorOffsets=[...t[i].offset]),t[i].progress=Ls(0,1,t[i].interpolate(t[i].current))}function _Z(e,t=e,n){if(n.x.targetOffset=0,n.y.targetOffset=0,t!==e){let r=t;for(;r&&r!==e;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=t===e?t.scrollWidth:t.clientWidth,n.y.targetLength=t===e?t.scrollHeight:t.clientHeight,n.x.containerLength=e.clientWidth,n.y.containerLength=e.clientHeight}function kZ(e,t,n,r={}){return{measure:()=>_Z(e,r.target,n),update:s=>{pZ(e,n,s),(r.offset||r.target)&&wZ(e,n,r)},notify:()=>t(n)}}const qc=new WeakMap,RN=new WeakMap,_v=new WeakMap,MN=e=>e===document.documentElement?window:e;function Uw(e,{container:t=document.documentElement,...n}={}){let r=_v.get(t);r||(r=new Set,_v.set(t,r));const s=hZ(),i=kZ(t,e,s,n);if(r.add(i),!qc.has(t)){const l=()=>{for(const f of r)f.measure()},c=()=>{for(const f of r)f.update(wn.timestamp)},u=()=>{for(const f of r)f.notify()},d=()=>{Et.read(l,!1,!0),Et.read(c,!1,!0),Et.update(u,!1,!0)};qc.set(t,d);const h=MN(t);window.addEventListener("resize",d,{passive:!0}),t!==document.documentElement&&RN.set(t,uZ(t,d)),h.addEventListener("scroll",d,{passive:!0})}const o=qc.get(t);return Et.read(o,!1,!0),()=>{var l;Ds(o);const c=_v.get(t);if(!c||(c.delete(i),c.size))return;const u=qc.get(t);qc.delete(t),u&&(MN(t).removeEventListener("scroll",u),(l=RN.get(t))===null||l===void 0||l(),window.removeEventListener("resize",u))}}function SZ({source:e,container:t,axis:n="y"}){e&&(t=e);const r={value:0},s=Uw(i=>{r.value=i[n].progress*100},{container:t,axis:n});return{currentTime:r,cancel:s}}const kv=new Map;function NO({source:e,container:t=document.documentElement,axis:n="y"}={}){e&&(t=e),kv.has(t)||kv.set(t,{});const r=kv.get(t);return r[n]||(r[n]=mM()?new ScrollTimeline({source:t,axis:n}):SZ({source:t,axis:n})),r[n]}function EZ(e){return e.length===2}function CO(e){return e&&(e.target||e.offset)}function NZ(e,t){return EZ(e)||CO(t)?Uw(n=>{e(n[t.axis].progress,n)},t):EO(e,NO(t))}function CZ(e,t){if(e.flatten(),CO(t))return e.pause(),Uw(n=>{e.time=e.duration*n[t.axis].progress},t);{const n=NO(t);return e.attachTimeline?e.attachTimeline(n,r=>(r.pause(),EO(s=>{r.time=r.duration*s},n))):Qn}}function jZ(e,{axis:t="y",...n}={}){const r={axis:t,...n};return typeof e=="function"?NZ(e,r):CZ(e,r)}function ON(e,t){Lq(!!(!t||t.current))}const TZ=()=>({scrollX:hi(0),scrollY:hi(0),scrollXProgress:hi(0),scrollYProgress:hi(0)});function PZ({container:e,target:t,layoutEffect:n=!0,...r}={}){const s=Qd(TZ);return(n?uw:m.useEffect)(()=>(ON("target",t),ON("container",e),jZ((o,{x:l,y:c})=>{s.scrollX.set(l.current),s.scrollXProgress.set(l.progress),s.scrollY.set(c.current),s.scrollYProgress.set(c.progress)},{...r,container:(e==null?void 0:e.current)||void 0,target:(t==null?void 0:t.current)||void 0})),[e,t,JSON.stringify(r.offset)]),s}class AZ{constructor(){this.componentControls=new Set}subscribe(t){return this.componentControls.add(t),()=>this.componentControls.delete(t)}
590start(t,n){this.componentControls.forEach(r=>{r.start(t.nativeEvent||t,n)})}}const IZ=()=>new AZ;function RZ(){return Qd(IZ)}function wo(e){let t=e;!e.includes("?")&&window.location.search&&(t+=window.location.search),!e.includes("#")&&window.location.hash&&(t+=window.location.hash),window.history.pushState({},"",t);const n=e.split("?")[0].split("#")[0],r={"/":"Dashboard - REPSShield","/dashboard":"Dashboard - REPSShield","/activity-ledger":"Activity Ledger - REPSShield","/properties":"Properties - REPSShield","/files":"File Vault - REPSShield","/analytics":"Analytics - REPSShield","/calendar":"Calendar - REPSShield","/team":"Team - REPSShield","/super-admin":"Super Admin - REPSShield","/organization-admin":"Organization - REPSShield"};document.title=r[n]||"REPSShield"}function jO(){window.addEventListener("popstate",e=>{const t=window.location.pathname.split("?")[0].split("#")[0],n={"/":"Dashboard - REPSShield","/dashboard":"Dashboard - REPSShield","/activity-ledger":"Activity Ledger - REPSShield","/properties":"Properties - REPSShield","/files":"File Vault - REPSShield","/analytics":"Analytics - REPSShield","/calendar":"Calendar - REPSShield","/team":"Team - REPSShield","/super-admin":"Super Admin - REPSShield","/organization-admin":"Organization - REPSShield"};document.title=n[t]||"REPSShield"})}function TO(){const e=m.useCallback((l=10)=>{if(typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(l)}catch(c){console.debug("Haptic feedback error:",c)}},[]),t=m.useCallback(()=>e(20),[e]),n=m.useCallback(()=>e([50,50,50]),[e]),r=m.useCallback(()=>e(10),[e]),s=m.useCallback(()=>e(15),[e]),i=m.useCallback(()=>e(25),[e]),o=m.useCallback(()=>e(5),[e]);return{vibrate:e,success:t,error:n,impactLight:r,impactMedium:s,impactHeavy:i,selection:o}}const MZ=[{path:"/member/time-entries",label:"Entries",icon:JI},{path:"/member/stats",label:"Stats",icon:QI},{path:"/member/profile",label:"Profile",icon:rc}];function OZ(){const[e,t]=Pt(),{selection:n}=TO(),r=Ra(),s=i=>{n(),t(i),wo(i)};return a.jsx("nav",{className:q("fixed bottom-0 left-0 right-0 z-50","glass-bar bg-white/90 dark:bg-gray-950/90","border-t border-gray-200/50 dark:border-gray-800/50",!r&&"safe-area-bottom pb-safe-area-bottom"),style:r?{paddingBottom:"max(env(safe-area-inset-bottom), 6px)"}:void 0,role:"navigation","aria-label":"Member navigation",children:a.jsx("div",{className:q("flex items-center justify-around px-4",r?"h-[58px]":"h-16"),children:MZ.map(i=>{const o=i.icon,l=e===i.path||e.startsWith(`${i.path}/`);return a.jsxs(kn.button,{type:"button",onClick:()=>s(i.path),className:q("relative flex h-full flex-1 flex-col items-center justify-center",r&&"pb-1","touch-target touch-manipulation transition-colors duration-150",l?"text-primary":"text-gray-500 dark:text-gray-400"),whileTap:{scale:.9},transition:{type:"spring",stiffness:400,damping:17},"aria-current":l?"page":void 0,"aria-label":i.label,children:[a.jsx(kn.div,{initial:!1,animate:{scale:l?1.1:1,y:l?-2:0},transition:{type:"spring",stiffness:300,damping:20},children:a.jsx(o,{className:q("h-6 w-6 transition-all duration-150",l&&"stroke-[2.5]")})}),a.jsx("span",{className:q("mt-1 text-[10px] font-medium transition-all duration-150",l?"opacity-100":"opacity-70"),children:i.label}),l&&a.jsx(kn.div,{layoutId:"memberBottomNavIndicator",className:q("absolute h-1 w-1 rounded-full bg-primary",r?"bottom-1.5":"bottom-1"),transition:{type:"spring",stiffness:300,damping:30}})]},i.path)})})})}function DZ({children:e}){const[t]=Pt(),n=m.useRef(null);return m.useEffect(()=>{requestAnimationFrame(()=>{var r;(r=n.current)==null||r.scrollTo({top:0,left:0,behavior:"auto"}),window.scrollTo({top:0,left:0,behavior:"auto"})})},[t]),a.jsxs("div",{className:"flex h-screen h-[100dvh] flex-col overflow-hidden bg-gray-50 pt-3 dark:bg-gray-900",children:[a.jsx("main",{ref:n,className:"mx-auto flex min-h-0 w-full flex-1 container-mobile flex-col gap-4 overflow-y-auto overscroll-contain px-4 safe-area-left safe-area-right",children:e}),a.jsx(OZ,{})]})}const ht=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("rounded-xl border bg-card text-card-foreground shadow-sm transition-all duration-200",e),...t}));
590ht.displayName="Card";const hp=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("flex flex-col space-y-1.5 p-6",e),...t}));hp.displayName="CardHeader";const fp=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("text-2xl font-semibold leading-none tracking-tight",e),...t}));fp.displayName="CardTitle";const Hx=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Hx.displayName="CardDescription";const yt=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("p-6 pt-0",e),...t}));yt.displayName="CardContent";const PO=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("flex items-center p-6 pt-0",e),...t}));PO.displayName="CardFooter";const LZ=bc("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Is({className:e,variant:t,...n}){return a.jsx("div",{className:q(LZ({variant:t}),e),...n})}function Ot({className:e,...t}){return a.jsx("div",{className:q("animate-shimmer bg-muted rounded-md bg-[length:200%_100%]",e),style:{backgroundImage:"linear-gradient(90deg, var(--muted) 25%, var(--accent) 50%, var(--muted) 75%)"},...t})}function _t(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function ur(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function zn(e,t){const n=_t(e);return isNaN(t)?ur(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function is(e,t){const n=_t(e);if(isNaN(t))return ur(e,NaN);if(!t)return n;const r=n.getDate(),s=ur(e,n.getTime());s.setMonth(n.getMonth()+t+1,0);const i=s.getDate();return r>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const zw=6048e5,FZ=864e5,AO=6e4,IO=36e5,o0e=43200,a0e=1440;let $Z={};function th(){return $Z}function Fs(e,t){var l,c,u,d;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=_t(e),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Sa(e){return Fs(e,{weekStartsOn:1})}function RO(e){const t=_t(e),n=t.getFullYear(),r=ur(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=Sa(r),i=ur(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=Sa(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function ac(e){const t=_t(e);return t.setHours(0,0,0,0),t}function pp(e){const t=_t(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function $r(e,t){const n=ac(e),r=ac(t),s=+n-pp(n),i=+r-pp(r);return Math.round((s-i)/FZ)}function VZ(e){const t=RO(e),n=ur(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Sa(n)}function Wx(e,t){const n=t*7;return zn(e,n)}function BZ(e,t){return is(e,t*12)}function UZ(e){let t;return e.forEach(function(n){const r=_t(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function zZ(e){let t;return e.forEach(n=>{const r=_t(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function MO(e){return ur(e,Date.now())}function Dn(e,t){const n=ac(e),r=ac(t);return+n==+r}function Hw(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function HZ(e){if(!Hw(e)&&typeof e!="number")return!1;const t=_t(e);return!isNaN(Number(t))}function wd(e,t){const n=_t(e),r=_t(t),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function WZ(e,t,n){const r=Fs(e,n),s=Fs(t,n),i=+r-pp(r),o=+s-pp(s);return Math.round((i-o)/zw)}function Ww(e){const t=_t(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function lr(e){const t=_t(e);return t.setDate(1),t.setHours(0,0,0,0),t}function OO(e){const t=_t(e),n=ur(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qw(e,t){var l,c,u,d;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=_t(e),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function DO(e){return qw(e,{weekStartsOn:1}
vendor: 5,983 bytes, line 590
590)}const qZ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},GZ=(e,t,n)=>{let r;const s=qZ[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Sv(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const KZ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},YZ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},QZ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ZZ={date:Sv({formats:KZ,defaultWidth:"full"}),time:Sv({formats:YZ,defaultWidth:"full"}),dateTime:Sv({formats:QZ,defaultWidth:"full"})},XZ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},JZ=(e,t,n,r)=>XZ[e];function Gc(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const eX={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tX={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},nX={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},rX={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},sX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},iX={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},oX=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},aX={ordinalNumber:oX,era:Gc({values:eX,defaultWidth:"wide"}),quarter:Gc({values:tX,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Gc({values:nX,defaultWidth:"wide"}),day:Gc({values:rX,defaultWidth:"wide"}),dayPeriod:Gc({values:sX,defaultWidth:"wide",formattingValues:iX,defaultFormattingWidth:"wide"})};function Kc(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?cX(l,h=>h.test(o)):lX(l,h=>h.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function lX(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function cX(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function uX(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const dX=/^(\d+)(th|st|nd|rd)?/i,hX=/\d+/i,fX={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pX={any:[/^b/i,/^(a|c)/i]},mX={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},gX={any:[/1/i,/2/i,/3/i,/4/i]},vX={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},yX={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},xX={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i}
vendor: 7,723 bytes, line 590
590,bX={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},wX={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},_X={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},kX={ordinalNumber:uX({matchPattern:dX,parsePattern:hX,valueCallback:e=>parseInt(e,10)}),era:Kc({matchPatterns:fX,defaultMatchWidth:"wide",parsePatterns:pX,defaultParseWidth:"any"}),quarter:Kc({matchPatterns:mX,defaultMatchWidth:"wide",parsePatterns:gX,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Kc({matchPatterns:vX,defaultMatchWidth:"wide",parsePatterns:yX,defaultParseWidth:"any"}),day:Kc({matchPatterns:xX,defaultMatchWidth:"wide",parsePatterns:bX,defaultParseWidth:"any"}),dayPeriod:Kc({matchPatterns:wX,defaultMatchWidth:"any",parsePatterns:_X,defaultParseWidth:"any"})},LO={code:"en-US",formatDistance:GZ,formatLong:ZZ,formatRelative:JZ,localize:aX,match:kX,options:{weekStartsOn:0,firstWeekContainsDate:1}};function SX(e){const t=_t(e);return $r(t,OO(t))+1}function FO(e){const t=_t(e),n=+Sa(t)-+VZ(t);return Math.round(n/zw)+1}function $O(e,t){var d,h,f,p;const n=_t(e),r=n.getFullYear(),s=th(),i=(t==null?void 0:t.firstWeekContainsDate)??((h=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(f=s.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=ur(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=Fs(o,t),c=ur(e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=Fs(c,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function EX(e,t){var l,c,u,d;const n=th(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=$O(e,t),i=ur(e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Fs(i,t)}function VO(e,t){const n=_t(e),r=+Fs(n,t)-+EX(n,t);return Math.round(r/zw)+1}function jt(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Mi={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return jt(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):jt(n+1,2)},d(e,t){return jt(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return jt(e.getHours()%12||12,t.length)},H(e,t){return jt(e.getHours(),t.length)},m(e,t){return jt(e.getMinutes(),t.length)},s(e,t){return jt(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return jt(s,t.length)}},il={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},DN={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Mi.y(e,t)},Y:function(e,t,n,r){const s=$O(e,r),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return jt(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):jt(i,t.length)},R:function(e,t){const n=RO(e);return jt(n,t.length)},u:function(e,t){const n=e.getFullYear();return jt(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return jt(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return jt(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Mi.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return jt(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=VO(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):jt(s,t.length)},I:function(e,t,n){const r=FO(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):jt(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Mi.d(e,t)},D:function(e,t,n){const r=SX(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):jt(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return jt(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return jt(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return jt(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=il.noon:r===0?s=il.midnight:s=r/12>
vendor: 4,693 bytes, line 590
590=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=il.evening:r>=12?s=il.afternoon:r>=4?s=il.morning:s=il.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Mi.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Mi.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):jt(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):jt(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Mi.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Mi.s(e,t)},S:function(e,t){return Mi.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return FN(r);case"XXXX":case"XX":return Qo(r);case"XXXXX":case"XXX":default:return Qo(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return FN(r);case"xxxx":case"xx":return Qo(r);case"xxxxx":case"xxx":default:return Qo(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+LN(r,":");case"OOOO":default:return"GMT"+Qo(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+LN(r,":");case"zzzz":default:return"GMT"+Qo(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return jt(r,t.length)},T:function(e,t,n){const r=e.getTime();return jt(r,t.length)}};function LN(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+jt(i,2)}function FN(e,t){return e%60===0?(e>0?"-":"+")+jt(Math.abs(e)/60,2):Qo(e,t)}function Qo(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=jt(Math.trunc(r/60),2),i=jt(r%60,2);return n+s+t+i}const $N=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},BO=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},NX=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return $N(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",$N(r,t)).replace("{{time}}",BO(s,t))},CX={p:BO,P:NX},jX=/^D+$/,TX=/^Y+$/,PX=["D","DD","YY","YYYY"];function AX(e){return jX.test(e)}function IX(e){return TX.test(e)}function RX(e,t,n){const r=MX(e,t,n);if(console.warn(r),PX.includes(e))throw new RangeError(r)}function MX(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const OX=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DX=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,LX=/^'([^]*?)'?$/,FX=/''/g,$X=/[a-zA-Z]/;function Tr(e,t,n){var d,h,f,p,g,v,y,x;const r=th(),s=(n==null?void 0:n.locale)??r.locale??LO,i=(n==null?void 0:n.firstWeekContainsDate)??((h=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((v=(g=n==null?void 0:n.locale)==null?void 0:g.options)==null?void 0:v.weekStartsOn)??r.weekStartsOn??((x=(y=r.locale)==null?void 0:y.options)==null?void 0:x.weekStartsOn)??0,l=_t(e);if(!HZ(l))throw new RangeError("Invalid time value");let c=t.match(DX).map(b=>{const w=b[0];if(w==="p"||w==="P"){const S=CX[w];return S(b,s.formatLong)}return b}).join("").match(OX).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const w=b[0];if(w==="'")return{isToken:!1,value:VX(b)};if(DN[w])return{isToken:!0,value:b};
590if(w.match($X))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:b}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(b=>{if(!b.isToken)return b.value;const w=b.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&IX(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&AX(w))&&RX(w,t,String(e));const S=DN[w[0]];return S(l,w,s.localize,u)}).join("")}function VX(e){const t=e.match(LX);return t?t[1].replace(FX,"'"):e}function BX(e){const t=_t(e),n=t.getFullYear(),r=t.getMonth(),s=ur(e,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function UX(e){return Math.trunc(+_t(e)/1e3)}function zX(e){const t=_t(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function HX(e,t){return WZ(zX(e),lr(e),t)+1}function qx(e,t){const n=_t(e),r=_t(t);return n.getTime()>r.getTime()}function UO(e,t){const n=_t(e),r=_t(t);return+n<+r}function Gw(e,t){const n=_t(e),r=_t(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function WX(e,t){const n=_t(e),r=_t(t);return n.getFullYear()===r.getFullYear()}function Kw(e){return Dn(e,MO(e))}function vf(e,t){return zn(e,-t)}function Yw(e){return Dn(e,vf(MO(e),1))}function jm(e,t){const r=YX(e);let s;if(r.date){const c=QX(r.date,2);s=ZX(c.restDateString,c.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const i=s.getTime();let o=0,l;if(r.time&&(o=XX(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(l=JX(r.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),u=new Date(0);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return new Date(i+o+l)}const Bh={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},qX=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,GX=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,KX=/^([+-])(\d{2})(?::?(\d{2}))?$/;function YX(e){const t={},n=e.split(Bh.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Bh.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Bh.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const s=Bh.timezone.exec(r);s?(t.time=r.replace(s[1],""),t.timezone=s[1]):t.time=r}return t}function QX(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?s:i*100,restDateString:e.slice((r[1]||r[2]).length)}}function ZX(e,t){if(t===null)return new Date(NaN);const n=e.match(qX);if(!n)return new Date(NaN);const r=!!n[4],s=Yc(n[1]),i=Yc(n[2])-1,o=Yc(n[3]),l=Yc(n[4]),c=Yc(n[5])-1;if(r)return sJ(t,l,c)?eJ(t,l,c):new Date(NaN);{const u=new Date(0);return!nJ(t,i,o)||!rJ(t,s)?new Date(NaN):(u.setUTCFullYear(t,i,Math.max(s,o)),u)}}function Yc(e){return e?parseInt(e):1}function XX(e){const t=e.match(GX);if(!t)return NaN;const n=Ev(t[1]),r=Ev(t[2]),s=Ev(t[3]);return iJ(n,r,s)?n*IO+r*AO+s*1e3:NaN}function Ev(e){return e&&parseFloat(e.replace(",","."))||0}function JX(e){if(e==="Z")return 0;const t=e.match(KX);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return oJ(r,s)?n*(r*IO+s*AO):NaN}function eJ(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const s=r.getUTCDay()||7,i=(t-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+i),r}const tJ=[31,null,31,30,31,30,31,31,30,31,30,31];function zO(e){return e%400===0||e%4===0&&e%100!==0}function nJ(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(tJ[t]||(zO(e)?29:28))}function rJ(e,t){return t>=1&&t<=(zO(e)?366:365)}function sJ(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function iJ(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function oJ(e,t){return t>=0&&t<=59}function Nv(e,t){const n=_t(e),r=n.getFullYear(),s=n.getDate(),i=ur(e,0);i.setFullYear(r,t,15),i.setHours(0,0,0,0);const o=BX(i);return n.setMonth(t,Math.min(s,o)),n}function VN(e,t){const n=_t(e);return isNaN(+n)?ur(e,NaN):(n.setFullYear(t),n)}var Qw="Progress",Zw=100,[aJ]=yn(Qw),[lJ,cJ]=aJ(Qw),HO=m.forwardRef((e,t)=>
590{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=uJ,...o}=e;(s||s===0)&&!BN(s)&&console.error(dJ(`${s}`,"Progress"));const l=BN(s)?s:Zw;r!==null&&!UN(r,l)&&console.error(hJ(`${r}`,"Progress"));const c=UN(r,l)?r:null,u=mp(c)?i(c,l):void 0;return a.jsx(lJ,{scope:n,value:c,max:l,children:a.jsx(we.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":mp(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":GO(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});HO.displayName=Qw;var WO="ProgressIndicator",qO=m.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=cJ(WO,n);return a.jsx(we.div,{"data-state":GO(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});qO.displayName=WO;function uJ(e,t){return`${Math.round(e/t*100)}%`}function GO(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function mp(e){return typeof e=="number"}function BN(e){return mp(e)&&!isNaN(e)&&e>0}function UN(e,t){return mp(e)&&!isNaN(e)&&e<=t&&e>=0}function dJ(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Zw}\`.`}function hJ(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
591  - a positive number
592  - less than the value passed to \`max\` (or ${Zw} if no \`max\` prop is set)
593  - \`null\` or \`undefined\` if the progress is indeterminate.
594
595Defaulting to \`null\`.`}var KO=HO,fJ=qO;const pJ=m.forwardRef(({className:e,value:t,...n},r)=>a.jsx(KO,{ref:r,className:q("relative h-2 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(fJ,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pJ.displayName=KO.displayName;function Xw(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Tm="Switch",[mJ]=yn(Tm),[gJ,Jw]=mJ(Tm);function vJ(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[f,p]=cr({prop:n,defaultProp:s??!1,onChange:c,caller:Tm}),[g,v]=m.useState(null),[y,x]=m.useState(null),b=m.useRef(!1),w=g?!!o||!!g.closest("form"):!0,S={checked:f,setChecked:p,disabled:i,control:g,setControl:v,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:s,isFormControl:w,bubbleInput:y,setBubbleInput:x};return a.jsx(gJ,{scope:t,...S,children:yJ(h)?h(S):r})}var YO="SwitchTrigger",QO=m.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{const{value:s,disabled:i,checked:o,required:l,setControl:c,setChecked:u,hasConsumerStoppedPropagationRef:d,isFormControl:h,bubbleInput:f}=Jw(YO,e),p=He(r,c);return a.jsx(we.button,{type:"button",role:"switch","aria-checked":o,"aria-required":l,"data-state":tD(o),"data-disabled":i?"":void 0,disabled:i,value:s,...n,ref:p,onClick:he(t,g=>{u(v=>!v),f&&h&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})});QO.displayName=YO;var e_=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...h}=e;return a.jsx(vJ,{__scopeSwitch:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(QO,{...h,ref:t,__scopeSwitch:n}),f&&a.jsx(eD,{__scopeSwitch:n})]})})});e_.displayName=Tm;var ZO="SwitchThumb",XO=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=Jw(ZO,n);return a.jsx(we.span,{"data-state":tD(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});XO.displayName=ZO;var JO="SwitchBubbleInput",eD=m.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:f,setBubbleInput:p}=Jw(JO,e),g=He(n,p),v=Xw(i),y=Bb(r);m.useEffect(()=>{const b=f;if(!b)return;const w=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(w,"checked").set,E=!s.current;if(v!==i&&_){const R=new Event("click",{bubbles:E});_.call(b,i),b.dispatchEvent(R)}},[f,v,i,s]);const x=m.useRef(i);return a.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});eD.displayName=JO;function yJ(e){return typeof e=="function"}function tD(e){return e?"checked":"unchecked"}const _d=m.forwardRef(({className:e,...t},n)=>a.jsx(e_,{className:q("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:a.jsx(XO,{className:q("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}
595));_d.displayName=e_.displayName;const Uh=768;function Io(){const[e,t]=m.useState(()=>typeof window<"u"?window.innerWidth<Uh:!1);return m.useEffect(()=>{if(Ye()){t(!0);return}const n=window.matchMedia(`(max-width: ${Uh-1}px)`),r=()=>{t(window.innerWidth<Uh)};return n.addEventListener("change",r),t(window.innerWidth<Uh),()=>n.removeEventListener("change",r)},[]),!!e}function xJ({children:e}){return Io()?a.jsx(DZ,{children:e}):a.jsxs("div",{className:"flex h-screen bg-background",children:[a.jsx(TH,{}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx(Iq,{}),a.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:e})]})]})}const bJ=m.lazy(()=>ve(()=>import("./time-entries-DRwHCk_j.js"),__vite__mapDeps([80,1,81,82,83,84,85]))),wJ=m.lazy(()=>ve(()=>import("./stats-C4Qbhp6A.js"),__vite__mapDeps([86,81,1,10]))),_J=m.lazy(()=>ve(()=>import("./profile-Dfla2qZK.js"),__vite__mapDeps([87,1,82,81,88,89,5,43])));function kJ(){return a.jsxs("div",{className:"space-y-4 pt-2",children:[a.jsx("div",{className:"h-7 w-40 animate-pulse rounded-lg bg-gray-200 dark:bg-gray-800"}),a.jsx("div",{className:"grid grid-cols-3 gap-3",children:[1,2,3].map(e=>a.jsx("div",{className:"h-20 animate-pulse rounded-2xl bg-gray-200 dark:bg-gray-800"},e))}),a.jsx("div",{className:"h-64 animate-pulse rounded-2xl bg-gray-200 dark:bg-gray-800"})]})}function SJ({user:e,userData:t,location:n}){const r=(t==null?void 0:t.accountOwnerId)!=null;return!e||!r?null:n==="/"||n==="/dashboard"?(window.location.href="/member/time-entries",null):a.jsx(xJ,{children:a.jsx(m.Suspense,{fallback:a.jsx(kJ,{}),children:a.jsxs(Nf,{children:[a.jsx(it,{path:"/member/time-entries",children:()=>a.jsx(bJ,{})}),a.jsx(it,{path:"/member/stats",children:()=>a.jsx(wJ,{})}),a.jsx(it,{path:"/member/profile",children:()=>a.jsx(_J,{})})]})})})}function EJ({userData:e,location:t,children:n}){var l,c;const r=(e==null?void 0:e.accountOwnerId)!=null,s=!!((c=(l=window.Capacitor)==null?void 0:l.isNativePlatform)!=null&&c.call(l)),i=localStorage.getItem("repshield_onboarding_completed");return s&&!!e&&e.hasCompletedOnboardingForm===!0&&!r&&t!=="/welcome-tour"&&i!=="true"?(window.location.href="/welcome-tour",null):a.jsx(a.Fragment,{children:n})}function xe({className:e,...t}){return a.jsx("div",{className:q("animate-pulse rounded-md bg-muted",e),...t})}function NJ(){return a.jsxs("header",{children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(xe,{className:"h-3 w-32"}),a.jsx(xe,{className:"h-7 w-24"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xe,{className:"h-11 w-11 rounded-2xl"}),a.jsx(xe,{className:"h-11 w-11 rounded-full"})]})]}),a.jsx("div",{className:"mt-3",children:a.jsx(xe,{className:"h-8 w-36 rounded-lg"})})]})}function CJ(){return a.jsxs("div",{className:"flex min-h-14 items-center gap-3 rounded-2xl border border-amber-100 bg-amber-50 px-4 py-3 dark:border-amber-900/50 dark:bg-amber-950/40",children:[a.jsx(xe,{className:"h-9 w-9 rounded-xl"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(xe,{className:"h-3 w-40"}),a.jsx(xe,{className:"h-3 w-56"})]}),a.jsx(xe,{className:"h-5 w-5"})]})}function jJ(){return a.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-border dark:bg-card",children:[a.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[a.jsx(xe,{className:"h-3 w-20"}),a.jsx(xe,{className:"h-3 w-12"})]}),a.jsxs("div",{className:"flex items-center gap-5",children:[a.jsx(xe,{className:"h-28 w-28 rounded-full"}),a.jsxs("div",{className:"flex-1 space-y-3",children:[a.jsx(xe,{className:"h-6 w-28"}),a.jsx(xe,{className:"h-2 w-full rounded-full"}),a.jsx(xe,{className:"h-3 w-32"})]})]})]})}function TJ(){return a.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-border dark:bg-card",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx(xe,{className:"h-3 w-16"}),a.jsx(xe,{className:"h-3 w-14"})]}),a.jsxs("div",{className:"rounded-xl border border-gray-100 px-3 py-3 dark:border-border",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx(xe,{className:"h-10 w-10 rounded-full"}),a.jsx(xe,{className:"h-3 w-20"}),a.jsx(xe,{className:"h-10 w-10 rounded-full"})]}),a.jsx("div",{className:"grid grid-cols-7 gap-1",children:[...Array(7)].map((e,t)=>a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx(xe,{className:"h-2 w-3"}),a.jsx(xe,{className:"h-8 w-8 rounded-full"}),a.jsx(xe,{className:"h-1.5 w-1.5 rounded-full"})]},t))}),a.jsxs("div",{className:"mt-3 flex min-h-11 items-center justify-between border-t border-gray-100 pt-3 dark:border-border",children:[a.jsx(xe,{className:"h-2 w-40"}),a.jsx(xe,{className:"h-4 w-4"})]})]})]})}function PJ(){return a.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-border dark:bg-card",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx(xe,{className:"h-3 w-10"}),a.jsx(xe,{className:"h-3 w-14"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(xe,{className:"h-10 w-10 rounded-xl"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(xe,{className:"h-3 w-32"}),a.jsx(xe,{className:"h-3 w-48"})]}
595),a.jsx(xe,{className:"h-5 w-14 rounded-full"})]})]})}function AJ(){return a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm dark:border-border dark:bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-border",children:[a.jsx(xe,{className:"h-3 w-20"}),a.jsx(xe,{className:"h-3 w-12"})]}),[...Array(2)].map((e,t)=>a.jsx("div",{className:q(t>0&&"border-t border-gray-100 dark:border-border"),children:a.jsxs("div",{className:"flex min-h-14 items-center gap-3 px-3 py-2",children:[a.jsx(xe,{className:"h-10 w-10 rounded-xl"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(xe,{className:"h-3 w-24"}),a.jsx(xe,{className:"h-3 w-36"})]}),a.jsx(xe,{className:"h-5 w-16 rounded-full"}),a.jsx(xe,{className:"h-4 w-4"})]})},t))]})}function IJ(){return a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm dark:border-border dark:bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-border",children:[a.jsx(xe,{className:"h-3 w-36"}),a.jsx(xe,{className:"h-3 w-12"})]}),a.jsx("div",{className:"p-3",children:a.jsx("div",{className:"h-16 rounded-xl bg-muted"})})]})}function nD(){return a.jsx("div",{className:"min-h-screen bg-gray-50 px-4 pt-3 dark:bg-background","data-testid":"offline-mobile-dashboard",children:a.jsxs("div",{className:"mx-auto flex w-full container-mobile flex-col gap-4",children:[a.jsx(NJ,{}),a.jsx(CJ,{}),a.jsx(jJ,{}),a.jsx(TJ,{}),a.jsx(PJ,{}),a.jsx(AJ,{}),a.jsx(IJ,{})]})})}function RJ(){return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(xe,{className:"h-8 w-40 rounded-lg"}),a.jsx(xe,{className:"h-10 w-10 rounded-xl"})]})}function MJ(){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xe,{className:"h-10 flex-1 rounded-xl"}),a.jsx(xe,{className:"h-10 w-10 rounded-xl"}),a.jsx(xe,{className:"h-10 w-10 rounded-xl"})]})}function OJ(){return a.jsx(xe,{className:"h-10 w-full rounded-xl"})}function zN(){return a.jsxs("div",{children:[a.jsx("div",{className:"bg-gray-100 px-4 py-2",children:a.jsx(xe,{className:"h-3 w-24 rounded"})}),a.jsx("div",{className:"divide-y divide-gray-100 bg-white",children:[1,2,3].map(e=>a.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[a.jsx(xe,{className:"h-9 w-9 rounded-full flex-shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(xe,{className:"h-4 w-28 rounded"}),a.jsx(xe,{className:"h-3 w-40 rounded"}),a.jsx(xe,{className:"h-3 w-56 rounded"})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a.jsx(xe,{className:"h-4 w-8 rounded"}),a.jsx(xe,{className:"h-5 w-5 rounded-full"})]})]},e))})]})}function rD(){return a.jsx("div",{className:"min-h-screen bg-gray-50 pt-3 dark:bg-background container-mobile","data-testid":"offline-mobile-activity-ledger",children:a.jsxs("div",{className:"space-y-4 px-4",children:[a.jsx(RJ,{}),a.jsx(MJ,{}),a.jsx(OJ,{}),a.jsxs("div",{className:"mt-3 space-y-0",children:[a.jsx(zN,{}),a.jsx(zN,{})]})]})})}function DJ(){return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(xe,{className:"h-8 w-36 rounded-lg"}),a.jsx(xe,{className:"h-10 w-10 rounded-xl"})]})}function LJ(){return a.jsxs("div",{className:"flex items-center gap-1 rounded-2xl bg-white p-1 shadow-sm border border-gray-100",children:[a.jsx(xe,{className:"h-8 w-16 rounded-lg"}),a.jsx(xe,{className:"h-8 w-16 rounded-lg"})]})}function FJ(){return a.jsxs("div",{className:"flex items-center gap-2 rounded-2xl bg-white px-3 py-2.5 shadow-sm border border-gray-100",children:[a.jsx(xe,{className:"h-4 w-4 rounded"}),a.jsx(xe,{className:"h-4 flex-1 rounded"})]})}function Cv(){return a.jsxs("div",{className:"rounded-3xl border border-gray-100 bg-white shadow-sm overflow-hidden dark:border-gray-800 dark:bg-gray-900",children:[a.jsx(xe,{className:"h-44 w-full rounded-none"}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{className:"space-y-1.5 flex-1 mr-2",children:[a.jsx(xe,{className:"h-5 w-32 rounded"}),a.jsx(xe,{className:"h-3 w-48 rounded"})]}),a.jsx(xe,{className:"h-9 w-9 rounded-xl"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xe,{className:"h-5 w-20 rounded-full"}),a.jsx(xe,{className:"h-5 w-16 rounded-full"})]})]})]})}function sD(){return a.jsx("div",{className:"min-h-screen bg-gray-50 px-4 pt-3 dark:bg-background","data-testid":"offline-mobile-properties",children:a.jsxs("div",{className:"mx-auto flex w-full container-mobile flex-col gap-4",children:[a.jsx(DJ,{}),a.jsx(LJ,{}),a.jsx(FJ,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(Cv,{}),a.jsx(Cv,{}),a.jsx(Cv,{})]})]})})}function $J(){return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(xe,{className:"h-8 w-24 rounded-lg"}),a.jsx(xe,{className:"h-10 w-10 rounded-xl"})]})}function VJ(){return a.jsxs("div",{className:"flex items-center gap-1 rounded-2xl bg-white p-1 shadow-sm border border-gray-100",children:[a.jsx(xe,{className:"h-8 w-20 rounded-lg"}),a.jsx(xe,{className:"h-8 w-20 rounded-lg"}),a.jsx(xe,{className:"h-8 w-20 rounded-lg"})]})}function BJ(){return a.jsxs("div",{className:"flex items-center gap-2 rounded-2xl bg-white px-3 py-2.5 shadow-sm border border-gray-100",children:[a.jsx(xe,{className:"h-4 w-4 roun
595ded"}),a.jsx(xe,{className:"h-4 flex-1 rounded"})]})}function UJ(){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xe,{className:"h-9 w-28 rounded-xl"}),a.jsx(xe,{className:"h-9 w-28 rounded-xl"}),a.jsx("div",{className:"flex-1"}),a.jsx(xe,{className:"h-9 w-9 rounded-xl"})]})}function HN(){return a.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xe,{className:"h-11 w-11 rounded-xl flex-shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5 min-w-0",children:[a.jsx(xe,{className:"h-4 w-full rounded"}),a.jsx(xe,{className:"h-3 w-48 rounded"}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(xe,{className:"h-5 w-16 rounded-full"}),a.jsx(xe,{className:"h-5 w-20 rounded-full"})]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx(xe,{className:"h-8 w-8 rounded"}),a.jsx(xe,{className:"h-8 w-8 rounded"})]})]})})}function WN(){return a.jsxs("div",{children:[a.jsx("div",{className:"bg-gray-100 px-4 py-2",children:a.jsx(xe,{className:"h-3 w-28 rounded"})}),a.jsxs("div",{className:"space-y-3 p-4 bg-white",children:[a.jsx(HN,{}),a.jsx(HN,{})]})]})}function iD(){return a.jsx("div",{className:"min-h-screen bg-gray-50 px-4 pt-3 dark:bg-background","data-testid":"offline-mobile-files",children:a.jsxs("div",{className:"mx-auto flex w-full container-mobile flex-col gap-4",children:[a.jsx($J,{}),a.jsx(VJ,{}),a.jsx(BJ,{}),a.jsx(UJ,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(WN,{}),a.jsx(WN,{})]})]})})}function kd(e,[t,n]){return Math.min(n,Math.max(t,e))}var oD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zJ="VisuallyHidden",Pm=m.forwardRef((e,t)=>a.jsx(we.span,{...e,ref:t,style:{...oD,...e.style}}));Pm.displayName=zJ;var HJ=Pm,WJ=[" ","Enter","ArrowUp","ArrowDown"],qJ=[" ","Enter"],Ea="Select",[Am,Im,GJ]=_c(Ea),[Ba]=yn(Ea,[GJ,Po]),Rm=Po(),[KJ,Ro]=Ba(Ea),[YJ,QJ]=Ba(Ea),ZJ="SelectProvider";function aD(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:f,required:p,form:g,internal_do_not_use_render:v}=e,y=Rm(t),[x,b]=m.useState(null),[w,S]=m.useState(null),[_,E]=m.useState(!1),R=Oa(u),[A,N]=cr({prop:r,defaultProp:s??!1,onChange:i,caller:Ea}),[k,T]=cr({prop:o,defaultProp:l,onChange:c,caller:Ea}),I=m.useRef(null),F=x?!!g||!!x.closest("form"):!0,[L,M]=m.useState(new Set),$=dn(),j=Array.from(L).map(H=>H.props.value).join(";"),P=m.useCallback(H=>{M(V=>new Set(V).add(H))},[]),D=m.useCallback(H=>{M(V=>{const O=new Set(V);return O.delete(H),O})},[]),C={required:p,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:_,onValueNodeHasChildrenChange:E,contentId:$,value:k,onValueChange:T,open:A,onOpenChange:N,dir:R,triggerPointerDownPosRef:I,disabled:f,name:d,autoComplete:h,form:g,nativeOptions:L,nativeSelectKey:j,isFormControl:F};return a.jsx(hm,{...y,children:a.jsx(KJ,{scope:t,...C,children:a.jsx(Am.Provider,{scope:t,children:a.jsx(YJ,{scope:t,onNativeOptionAdd:P,onNativeOptionRemove:D,children:hee(v)?v(C):n})})})})}aD.displayName=ZJ;var lD=e=>{const{__scopeSelect:t,children:n,...r}=e;return a.jsx(aD,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>a.jsxs(a.Fragment,{children:[n,s?a.jsx(TD,{__scopeSelect:t}):null]})})};lD.displayName=Ea;var cD="SelectTrigger",t_=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Rm(n),o=Ro(cD,n),l=o.disabled||r,c=He(t,o.onTriggerChange),u=Im(n),d=m.useRef("touch"),[h,f,p]=PD(v=>{const y=u().filter(w=>!w.disabled),x=y.find(w=>w.value===o.value),b=AD(y,v,x);b!==void 0&&o.onValueChange(b.value)}),g=v=>{l||(o.onOpenChange(!0),p()),v&&(o.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return a.jsx(Wd,{asChild:!0,...i,children:a.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Mm(o.value)?"":void 0,...s,ref:c,onClick:he(s.onClick,v=>
595{v.currentTarget.focus(),d.current!=="mouse"&&g(v)}),onPointerDown:he(s.onPointerDown,v=>{d.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(g(v),v.preventDefault())}),onKeyDown:he(s.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(y&&v.key===" ")&&WJ.includes(v.key)&&(g(),v.preventDefault())})})})});t_.displayName=cD;var uD="SelectValue",dD=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=e,c=Ro(uD,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=He(t,c.onValueNodeChange);nn(()=>{u(d)},[u,d]);const f=Mm(c.value);return a.jsx(we.span,{...l,asChild:f?!1:l.asChild,ref:h,style:{pointerEvents:"none"},children:a.jsx(m.Fragment,{children:f?o:i},f?"placeholder":"value")})});dD.displayName=uD;var XJ="SelectIcon",hD=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(we.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});hD.displayName=XJ;var fD="SelectPortal",[JJ,eee]=Ba(fD,{forceMount:void 0}),pD=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return a.jsx(JJ,{scope:e.__scopeSelect,forceMount:n,children:a.jsx(La,{asChild:!0,...r})})};pD.displayName=fD;var _o="SelectContent",n_=m.forwardRef((e,t)=>{const n=eee(_o,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=Ro(_o,e.__scopeSelect),[o,l]=m.useState();return nn(()=>{l(new DocumentFragment)},[]),a.jsx(hn,{present:r||i.open,children:({present:c})=>c?a.jsx(vD,{...s,ref:t}):a.jsx(mD,{...s,fragment:o})})});n_.displayName=_o;var mD=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Ia.createPortal(a.jsx(gD,{scope:n,children:a.jsx(Am.Slot,{scope:n,children:a.jsx("div",{ref:t,children:r})})}),s):null});mD.displayName="SelectContentFragment";var Gr=10,[gD,Mo]=Ba(_o),tee="SelectContentImpl",nee=go("SelectContent.RemoveScroll"),vD=m.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:y,...x}=e,b=Ro(_o,n),[w,S]=m.useState(null),[_,E]=m.useState(null),R=He(t,te=>S(te)),[A,N]=m.useState(null),[k,T]=m.useState(null),I=Im(n),[F,L]=m.useState(!1),M=m.useRef(!1);m.useEffect(()=>{if(w)return gm(w)},[w]),am();const $=m.useCallback(te=>{const[ne,...re]=I().map(se=>se.ref.current),[J]=re.slice(-1),ge=document.activeElement;for(const se of te)if(se===ge||(se==null||se.scrollIntoView({block:"nearest"}),se===ne&&_&&(_.scrollTop=0),se===J&&_&&(_.scrollTop=_.scrollHeight),se==null||se.focus(),document.activeElement!==ge))return},[I,_]),j=m.useCallback(()=>$([A,w]),[$,A,w]);m.useEffect(()=>{F&&j()},[F,j]);const{onOpenChange:P,triggerPointerDownPosRef:D}=b;m.useEffect(()=>{if(w){let te={x:0,y:0};const ne=J=>{var ge,se;te={x:Math.abs(Math.round(J.pageX)-(((ge=D.current)==null?void 0:ge.x)??0)),y:Math.abs(Math.round(J.pageY)-(((se=D.current)==null?void 0:se.y)??0))}},re=J=>{te.x<=10&&te.y<=10?J.preventDefault():J.composedPath().includes(w)||P(!1),document.removeEventListener("pointermove",ne),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,P,D]),m.useEffect(()=>{const te=()=>P(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[P]);const[C,H]=PD(te=>{const ne=I().filter(ge=>!ge.disabled),re=ne.find(ge=>ge.ref.current===document.activeElement),J=AD(ne,te,re);J&&setTimeout(()=>{var ge;return(ge=J.ref.current)==null?void 0:ge.focus()})}),V=m.useCallback((te,ne,re)=>{const J=!M.current&&!re;(b.value!==void 0&&b.value===ne||J)&&(N(te),J&&(M.current=!0))},[b.value]),O=m.useCallback(()=>w==null?void 0:w.focus(),[w]),G=m.useCallback((te,ne,re)=>{const J=!M.current&&!re;(b.value!==void 0&&b.value===ne||J)&&T(te)},[b.value]),Z=r==="popper"?Gx:yD,ae=Z===Gx?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return a.jsx(gD,{scope:n,content:w,viewport:_,onViewportChange:E,itemRefCallback:V,selectedItem:A,onItemLeave:O,itemTextRefCallback:G,focusSelectedItem:j,selectedItemText:k,position:r,isPositioned:F,searchRef:C,children:a.jsx(Gd,{as:nee,allowPinchZoom:!0,children:a.jsx(zd,{asChild:!0,trapped:b.o
vendor: 8,567 bytes, line 595
595pen,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:he(s,te=>{var ne;(ne=b.trigger)==null||ne.focus({preventScroll:!0}),te.preventDefault()}),children:a.jsx(Da,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:a.jsx(Z,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:te=>te.preventDefault(),...x,...ae,onPlaced:()=>L(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:he(x.onKeyDown,te=>{const ne=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ne&&te.key.length===1&&H(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let J=I().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(te.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const ge=te.target,se=J.indexOf(ge);J=J.slice(se+1)}setTimeout(()=>$(J)),te.preventDefault()}})})})})})})});vD.displayName=tee;var ree="SelectItemAlignedPosition",yD=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Ro(_o,n),o=Mo(_o,n),[l,c]=m.useState(null),[u,d]=m.useState(null),h=He(t,R=>d(R)),f=Im(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:x,focusSelectedItem:b}=o,w=m.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&v&&y&&x){const R=i.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),k=x.getBoundingClientRect();if(i.dir!=="rtl"){const ge=k.left-A.left,se=N.left-ge,ke=R.left-se,Me=R.width+ke,Be=Math.max(Me,A.width),$e=window.innerWidth-Gr,We=kd(se,[Gr,Math.max(Gr,$e-Be)]);l.style.minWidth=Me+"px",l.style.left=We+"px"}else{const ge=A.right-k.right,se=window.innerWidth-N.right-ge,ke=window.innerWidth-R.right-se,Me=R.width+ke,Be=Math.max(Me,A.width),$e=window.innerWidth-Gr,We=kd(se,[Gr,Math.max(Gr,$e-Be)]);l.style.minWidth=Me+"px",l.style.right=We+"px"}const T=f(),I=window.innerHeight-Gr*2,F=v.scrollHeight,L=window.getComputedStyle(u),M=parseInt(L.borderTopWidth,10),$=parseInt(L.paddingTop,10),j=parseInt(L.borderBottomWidth,10),P=parseInt(L.paddingBottom,10),D=M+$+F+P+j,C=Math.min(y.offsetHeight*5,D),H=window.getComputedStyle(v),V=parseInt(H.paddingTop,10),O=parseInt(H.paddingBottom,10),G=R.top+R.height/2-Gr,Z=I-G,ae=y.offsetHeight/2,te=y.offsetTop+ae,ne=M+$+te,re=D-ne;if(ne<=G){const ge=T.length>0&&y===T[T.length-1].ref.current;l.style.bottom="0px";const se=u.clientHeight-v.offsetTop-v.offsetHeight,ke=Math.max(Z,ae+(ge?O:0)+se+j),Me=ne+ke;l.style.height=Me+"px"}else{const ge=T.length>0&&y===T[0].ref.current;l.style.top="0px";const ke=Math.max(G,M+v.offsetTop+(ge?V:0)+ae)+re;l.style.height=ke+"px",v.scrollTop=ne-G+v.offsetTop}l.style.margin=`${Gr}px 0`,l.style.minHeight=C+"px",l.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,l,u,v,y,x,i.dir,r]);nn(()=>w(),[w]);const[S,_]=m.useState();nn(()=>{u&&_(window.getComputedStyle(u).zIndex)},[u]);const E=m.useCallback(R=>{R&&g.current===!0&&(w(),b==null||b(),g.current=!1)},[w,b]);return a.jsx(iee,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(we.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});yD.displayName=ree;var see="SelectPopperPosition",Gx=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Gr,...i}=e,o=Rm(n);return a.jsx(fm,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gx.displayName=see;var[iee,r_]=Ba(_o,{}),Kx="SelectViewport",xD=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Mo(Kx,n),o=r_(Kx,n),l=He(t,i.onViewportChange),c=m.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(Am.Slot,{scope:n,children:a.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:he(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Gr*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),x=Math.max(v,y);if(x<g){const b=x+p,w=Math.min(g,b),S=b-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});xD.displayName=Kx;var bD="SelectGroup",[oee,aee]=Ba(bD),lee=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=dn();return a.jsx(oee,{scope:n,id:s,children:a.jsx(we.div,{role:"group","aria-labelledby":s,...r,ref:t})})});lee.displayName=bD;var wD="SelectLabel",s_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=aee(wD,n);return a.jsx(we.div,{id:s.id,...r,ref:t})});s_.displayName=wD;var gp="SelectItem",[cee,_D]=Ba(gp),i_=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,l=Ro(gp,n),c=Mo(gp,n),u=l.value===r,[d,h]=m.useState(i??""),[f,p]=m.useState(!1),g=He(t,b=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,b,r,s)}),v=dn(),y=m.useRef("touch"),x=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};return a.jsx(cee,{scope:n,value:r,disabled:s,textId:v,isSelected:u,onItemTextChange:m.useCallback(b=>{h(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:a.jsx(Am.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(we.div,{role:"option","aria-labelledby":v,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:he(o.onFocus,()=>p(!0)),onBlur:he(o.onBlur,()=>p(!1)),onClick:he(o.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:he(o.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:he(o.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:he(o.onPointerMove,b=>{var w;y.current=b.pointerType,s?(w=c.onItemLeave)==null||w.call(c):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:he(o.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:he(o.onKeyDown,b=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&b.key===" "||(qJ.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})});i_.displayName=gp;var wu="SelectItemText",kD=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=Ro(wu,n),l=Mo(wu,n),c=_D(wu,n),u=QJ(wu,n),[d,h]=m.useState(null),f=He(t,x=>h(x),c.onItemTextChange,x=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,x,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=m.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=u;return nn(()=>(v(g),()=>y(g)),[v,y,g]),a.jsxs(a.Fragment,{children:[a.jsx(we.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Mm(o.value)?Ia.createPortal(i.children,o.valueNode):null]})});kD.displayName=wu;var SD="SelectItemIndicator",ED=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return _D(SD,n).isSelected?a.jsx(we.span,{"aria-hidden":!0,...r,ref:t}):null});ED.displayName=SD;var Yx="SelectScrollUpButton",o_=m.forwardRef((e,t)=>{const n=Mo(Yx,e.__scopeSelect),r=r_(Yx,e.__scopeSelect),[s,i]=m.useState(!1),o=He(t,r.onScrollButtonChange);return nn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(ND,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});o_.displayName=Yx;var Qx="SelectScrollDownButton",a_=m.forwardRef((e,t)=>
595{const n=Mo(Qx,e.__scopeSelect),r=r_(Qx,e.__scopeSelect),[s,i]=m.useState(!1),o=He(t,r.onScrollButtonChange);return nn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(ND,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});a_.displayName=Qx;var ND=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Mo("SelectScrollButton",n),o=m.useRef(null),l=Im(n),c=m.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),nn(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(we.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:he(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:he(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:he(s.onPointerLeave,()=>{c()})})}),uee="SelectSeparator",l_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(we.div,{"aria-hidden":!0,...r,ref:t})});l_.displayName=uee;var CD="SelectArrow",dee=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Rm(n);return Mo(CD,n).position==="popper"?a.jsx(pm,{...s,...r,ref:t}):null});dee.displayName=CD;var jD="SelectBubbleInput",TD=m.forwardRef(({__scopeSelect:e,...t},n)=>{const r=Ro(jD,e),{value:s,onValueChange:i,required:o,disabled:l,name:c,autoComplete:u,form:d}=r,{nativeOptions:h,nativeSelectKey:f}=r,p=m.useRef(null),g=He(n,p),v=s??"",y=Xw(v),x=Array.from(h).some(b=>(b.props.value??"")==="");return m.useEffect(()=>{const b=p.current;if(!b)return;const w=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(w,"value").set;if(y!==v&&_){const E=new Event("change",{bubbles:!0});_.call(b,v),b.dispatchEvent(E)}},[y,v]),a.jsxs(we.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:l,form:d,onChange:b=>i(b.target.value),...t,style:{...oD,...t.style},ref:g,defaultValue:v,children:[Mm(s)&&!x?a.jsx("option",{value:""}):null,Array.from(h)]},f)});TD.displayName=jD;function hee(e){return typeof e=="function"}function Mm(e){return e===""||e===void 0}function PD(e){const t=tn(e),n=m.useRef(""),r=m.useRef(0),s=m.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function AD(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=fee(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function fee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const ko=lD,So=dD,ki=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(t_,{ref:r,className:q("flex h-12 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(hD,{asChild:!0,children:a.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));ki.displayName=t_.displayName;const ID=m.forwardRef(({className:e,...t},n)=>a.jsx(o_,{ref:n,className:q("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(K9,{className:"h-4 w-4"})}));ID.displayName=o_.displayName;const RD=m.forwardRef(({className:e,...t},n)=>a.jsx(a_,{ref:n,className:q("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ma,{className:"h-4 w-4"})}));
vendor: 9,918 bytes, line 595
595RD.displayName=a_.displayName;const Si=m.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(pD,{children:a.jsxs(n_,{ref:s,className:q("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(ID,{}),a.jsx(xD,{className:q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(RD,{})]})}));Si.displayName=n_.displayName;const pee=m.forwardRef(({className:e,...t},n)=>a.jsx(s_,{ref:n,className:q("py-3 pl-8 pr-2 text-base font-semibold",e),...t}));pee.displayName=s_.displayName;const Cn=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(i_,{ref:r,className:q("relative flex w-full cursor-default select-none items-center rounded-sm py-3 pl-8 pr-2 text-base outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ED,{children:a.jsx(bt,{className:"h-4 w-4"})})}),a.jsx(kD,{children:t})]}));Cn.displayName=i_.displayName;const mee=m.forwardRef(({className:e,...t},n)=>a.jsx(l_,{ref:n,className:q("-mx-1 my-1 h-px bg-muted",e),...t}));mee.displayName=l_.displayName;var[Om]=yn("Tooltip",[Po]),Dm=Po(),MD="TooltipProvider",gee=700,Zx="tooltip.open",[vee,c_]=Om(MD),OD=e=>{const{__scopeTooltip:t,delayDuration:n=gee,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(vee,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};OD.displayName=MD;var Sd="Tooltip",[yee,nh]=Om(Sd),DD=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=c_(Sd,e.__scopeTooltip),u=Dm(t),[d,h]=m.useState(null),f=dn(),p=m.useRef(0),g=o??c.disableHoverableContent,v=l??c.delayDuration,y=m.useRef(!1),[x,b]=cr({prop:r,defaultProp:s??!1,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(Zx))):c.onClose(),i==null||i(R)},caller:Sd}),w=m.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),S=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),_=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),E=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},v)},[v,b]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(hm,{...u,children:a.jsx(yee,{scope:t,contentId:f,open:x,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?E():S()},[c.isOpenDelayedRef,E,S]),onTriggerLeave:m.useCallback(()=>{g?_():(window.clearTimeout(p.current),p.current=0)},[_,g]),onOpen:S,onClose:_,disableHoverableContent:g,children:n})})};DD.displayName=Sd;var Xx="TooltipTrigger",LD=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=nh(Xx,n),i=c_(Xx,n),o=Dm(n),l=m.useRef(null),c=He(t,l,s.onTriggerChange),u=m.useRef(!1),d=m.useRef(!1),h=m.useCallback(()=>u.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(Wd,{asChild:!0,...o,children:a.jsx(we.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:he(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:he(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:he(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:he(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:he(e.onBlur,s.onClose),onClick:he(e.onClick,s.onClose)})})});LD.displayName=Xx;var u_="TooltipPortal",[xee,bee]=Om(u_,{forceMount:void 0}),FD=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=nh(u_,t);return a.jsx(xee,{scope:t,forceMount:n,children:a.jsx(hn,{present:n||i.open,children:a.jsx(La,{asChild:!0,container:s,children:r})})})};FD.displayName=u_;var lc="TooltipContent",$D=m.forwardRef((e,t)=>{const n=bee(lc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=nh(lc,e.__scopeTooltip);return a.jsx(hn,{present:r||o.open,children:o.disableHoverableContent?a.jsx(VD,{side:s,...i,ref:t}):a.jsx(wee,{side:s,...i,ref:t})})}),wee=m.forwardRef((e,t)=>{const n=nh(lc,e.__scopeTooltip),r=c_(lc,e.__scopeTooltip),s=m.useRef(null),i=He(t,s),[o,l]=m.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:h}=r,f=m.useCallback(()=>{l(null),h(!1)},[h]),p=m.useCallback((g,v)=>{const y=g.currentTarget,x={x:g.clientX,y:g.clientY},b=Nee(x,y.getBoundingClientRect()),w=Cee(x,b),S=jee(v.getBoundingClientRect()),_=Pee([...w,...S]);l(_),h(!0)},[h]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&d){const g=y=>p(y,d),v=y=>p(y,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",v)}}},[c,d,p,f]),m.useEffect(()=>{if(o){const g=v=>{const y=v.target,x={x:v.clientX,y:v.clientY},b=(c==null?void 0:c.contains(y))||(d==null?void 0:d.contains(y)),w=!Tee(x,o);b?f():w&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,f]),a.jsx(VD,{...e,ref:i})}),[_ee,kee]=Om(Sd,{isInside:!1}),See=Yz("TooltipContent"),VD=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=nh(lc,n),u=Dm(n),{onClose:d}=c;return m.useEffect(()=>(document.addEventListener(Zx,d),()=>document.removeEventListener(Zx,d)),[d]),m.useEffect(()=>{if(c.trigger){const h=f=>{f.target instanceof Node&&f.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(Da,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(fm,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(See,{children:r}),a.jsx(_ee,{scope:n,isInside:!0,children:a.jsx(HJ,{id:c.contentId,role:"tooltip",children:s||r})})]})})});$D.displayName=lc;var BD="TooltipArrow",Eee=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Dm(n);return kee(BD,n).isInside?null:a.jsx(pm,{...s,...r,ref:t})});Eee.displayName=BD;function Nee(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Cee(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function jee(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function Tee(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,h=c.x,f=c.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function Pee(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Aee(t)}function Aee(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Iee=OD,Ree=DD,Mee=LD,Oee=FD,UD=$D;const d_=Iee,Dee=Ree,Lee=Mee,zD=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(Oee,{children:a.jsx(UD,{ref:r,sideOffset:t,className:q("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
595de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));zD.displayName=UD.displayName;var Lm="Dialog",[HD,WD]=yn(Lm),[Fee,ds]=HD(Lm),rh=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=m.useRef(null),c=m.useRef(null),[u,d]=cr({prop:r,defaultProp:s??!1,onChange:i,caller:Lm});return a.jsx(Fee,{scope:t,triggerRef:l,contentRef:c,contentId:dn(),titleId:dn(),descriptionId:dn(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};rh.displayName=Lm;var qD="DialogTrigger",Fm=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ds(qD,n),i=He(t,s.triggerRef);return a.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":f_(s.open),...r,ref:i,onClick:he(e.onClick,s.onOpenToggle)})});Fm.displayName=qD;var h_="DialogPortal",[$ee,GD]=HD(h_,{forceMount:void 0}),sh=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=ds(h_,t);return a.jsx($ee,{scope:t,forceMount:n,children:m.Children.map(r,o=>a.jsx(hn,{present:n||i.open,children:a.jsx(La,{asChild:!0,container:s,children:o})}))})};sh.displayName=h_;var vp="DialogOverlay",Ua=m.forwardRef((e,t)=>{const n=GD(vp,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=ds(vp,e.__scopeDialog);return i.modal?a.jsx(hn,{present:r||i.open,children:a.jsx(Bee,{...s,ref:t})}):null});Ua.displayName=vp;var Vee=go("DialogOverlay.RemoveScroll"),Bee=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ds(vp,n),i=BH(),o=He(t,i);return a.jsx(Gd,{as:Vee,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(we.div,{"data-state":f_(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),cc="DialogContent",za=m.forwardRef((e,t)=>{const n=GD(cc,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=ds(cc,e.__scopeDialog);return a.jsx(hn,{present:r||i.open,children:i.modal?a.jsx(Uee,{...s,ref:t}):a.jsx(zee,{...s,ref:t})})});za.displayName=cc;var Uee=m.forwardRef((e,t)=>{const n=ds(cc,e.__scopeDialog),r=m.useRef(null),s=He(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return gm(i)},[]),a.jsx(KD,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:he(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:he(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:he(e.onFocusOutside,i=>i.preventDefault())})}),zee=m.forwardRef((e,t)=>{const n=ds(cc,e.__scopeDialog),r=m.useRef(!1),s=m.useRef(!1);return a.jsx(KD,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),KD=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=ds(cc,n);return am(),a.jsx(a.Fragment,{children:a.jsx(zd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(Da,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":f_(l.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),YD="DialogTitle",Cc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ds(YD,n);return a.jsx(we.h2,{id:s.titleId,...r,ref:t})});Cc.displayName=YD;var QD="DialogDescription",jc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ds(QD,n);return a.jsx(we.p,{id:s.descriptionId,...r,ref:t})});jc.displayName=QD;var ZD="DialogClose",ih=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ds(ZD,n);return a.jsx(we.button,{type:"button",...r,ref:t,onClick:he(e.onClick,()=>s.onOpenChange(!1))})});ih.displayName=ZD;function f_(e){return e?"open":"closed"}const $s=rh,l0e=Fm,Hee=sh,XD=m.forwardRef(({className:e,...t},n)=>a.jsx(Ua,{ref:n,className:q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));XD.displayName=Ua.displayName;const os=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Hee,{children:[a.jsx(XD,{}),a.jsxs(za,{ref:r,className:q("fixed inset-x-0 bottom-0 z-50 flex w-full flex-col border-t bg-background p-6 shadow-lg gap-4","rounded-t-2xl max-h-[90vh] overflow-y-auto","safe-area-bottom","duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom","sm:inset-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%]","sm:max-w-lg sm:rounded-lg sm:border sm:max-h-[85vh]","sm:data-[state=closed]:slide-out-to-left-1/2 sm:data-[state=closed]:slide-out-to-top-[48%]","sm:data-[state=open]:slide-in-from-left-1/2 sm:data-[state=open]:slide-in-from-top-[48%]","sm:data-[state=closed]:zoom-out-95 sm:data-[state=open]:zoom-in-95",e),...n,children:[a.jsx("div",{className:"sm:hidden flex justify-center -mt-2 mb-2",children:a.jsx("div",{className:"w-10 h-1 rounded-full bg-gray-300 dark:bg-gray-600"})}
595),t,a.jsxs(ih,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(vn,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));os.displayName=za.displayName;const as=({className:e,...t})=>a.jsx("div",{className:q("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});as.displayName="DialogHeader";const Ed=({className:e,...t})=>a.jsx("div",{className:q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ed.displayName="DialogFooter";const ls=m.forwardRef(({className:e,...t},n)=>a.jsx(Cc,{ref:n,className:q("text-lg font-semibold leading-none tracking-tight",e),...t}));ls.displayName=Cc.displayName;const Eo=m.forwardRef(({className:e,...t},n)=>a.jsx(jc,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Eo.displayName=jc.displayName;const qN=[{path:"/dashboard",label:"Dashboard",icon:Bd},{path:"/activity-ledger",label:"Activity",icon:rR},{path:"/properties",label:"Properties",icon:jo},{path:"/files",label:"Files",icon:Nr}];function Jx({offline:e=!1,isAuthChecking:t=!1}){const[n,r]=Pt(),{selection:s}=TO(),{openDialog:i}=rP(),o=d=>{s(),r(d),wo(d)},l=()=>{s(),i()},c=Ye()||typeof window<"u"&&window.innerWidth<768,u=Ra();return c?a.jsxs("nav",{className:q("fixed bottom-0 left-0 right-0 z-50","glass-bar bg-white/90 dark:bg-gray-950/90","border-t border-gray-200/50 dark:border-gray-800/50",!u&&"safe-area-bottom"),style:u?{paddingBottom:"max(env(safe-area-inset-bottom), 6px)"}:void 0,role:"navigation","aria-label":"Main navigation",children:[t&&a.jsxs("div",{className:"w-full bg-primary/10 dark:bg-primary/20 py-1 flex items-center justify-center gap-1.5",children:[a.jsx(ct,{className:"w-3 h-3 animate-spin text-primary"}),a.jsx("span",{className:"text-[10px] text-primary font-medium",children:"Verifying..."})]}),a.jsxs("div",{className:q("flex items-center justify-around px-2",u?"h-[58px]":"h-16"),children:[qN.slice(0,2).map(d=>{const h=d.icon,f=n===d.path||n.startsWith(d.path+"/");return a.jsxs(kn.button,{onClick:()=>o(d.path),className:q("flex h-full flex-1 flex-col items-center justify-center",u&&"relative pb-1","touch-target touch-manipulation","transition-colors duration-150",f?"text-primary":"text-gray-500 dark:text-gray-400"),whileTap:{scale:.9},transition:{type:"spring",stiffness:400,damping:17},"aria-current":f?"page":void 0,"aria-label":d.label,children:[a.jsx(kn.div,{initial:!1,animate:{scale:f?1.1:1,y:f?-2:0},transition:{type:"spring",stiffness:300,damping:20},children:a.jsx(h,{className:q("w-6 h-6 transition-all duration-150",f&&"stroke-[2.5]")})}),a.jsx("span",{className:q("text-[10px] mt-1 font-medium transition-all duration-150",f?"opacity-100":"opacity-70"),children:d.label}),f&&a.jsx(kn.div,{layoutId:"bottomNavIndicator",className:q("absolute h-1 w-1 rounded-full bg-primary",u?"bottom-1.5":"bottom-1"),transition:{type:"spring",stiffness:300,damping:30}})]},d.path)}),a.jsx(kn.button,{onClick:l,className:q("relative flex h-full flex-1 flex-col items-center justify-center","touch-target touch-manipulation","transition-colors duration-150","text-primary"),whileTap:{scale:.9},transition:{type:"spring",stiffness:400,damping:17},"aria-label":"Create new time entry",children:a.jsx(kn.div,{initial:!1,animate:{scale:1},transition:{type:"spring",stiffness:300,damping:20},className:q("absolute -top-3",u?"h-14 w-14 rounded-full":"w-16 h-16 rounded-full","bg-primary","shadow-lg","flex items-center justify-center","border-4 border-white dark:border-gray-950"),children:a.jsx(nc,{className:"w-6 h-6 text-white",strokeWidth:2.5})})}),qN.slice(2).map(d=>{const h=d.icon,f=n===d.path||n.startsWith(d.path+"/");return a.jsxs(kn.button,{onClick:()=>o(d.path),className:q("flex h-full flex-1 flex-col items-center justify-center",u&&"relative pb-1","touch-target touch-manipulation","transition-colors duration-150",f?"text-primary":"text-gray-500 dark:text-gray-400"),whileTap:{scale:.9},transition:{type:"spring",stiffness:400,damping:17},"aria-current":f?"page":void 0,"aria-label":d.label,children:[a.jsx(kn.div,{initial:!1,animate:{scale:f?1.1:1,y:f?-2:0},transition:{type:"spring",stiffness:300,damping:20},children:a.jsx(h,{className:q("w-6 h-6 transition-all duration-150",f&&"stroke-[2.5]")})}),a.jsx("span",{className:q("text-[10px] mt-1 font-medium transition-all duration-150",f?"opacity-100":"opacity-70"),children:d.label}),f&&a.jsx(kn.div,{layoutId:"bottomNavIndicator",className:q("absolute h-1 w-1 rounded-full bg-primary",u?"bottom-1.5":"bottom-1"),transition:{type:"spring",stiffness:300,damping:30}})]},d.path)})]})]}):null}function Wee({title:e,showBack:t,onBack:n,rightAction:r,className:s,forceShow:i=!1,transparent:o=!1}){Pt();const{scrollY:l}=PZ(),[c,u]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(0);return nZ(l,"change",g=>{if(i)return;const v=g;u(v>10),v>50&&v>f?h(!0):h(!1),p(v)}),m.useEffect(()=>
595{i&&(u(!0),h(!1))},[i]),a.jsx(kn.header,{className:q("fixed top-0 left-0 right-0 z-50 h-[60px]","flex items-center justify-between px-4 safe-area-top","transition-all duration-300 ease-in-out",o?"bg-transparent pointer-events-none":c||i?"glass-bar bg-white/80 dark:bg-gray-900/80 pointer-events-auto":"bg-transparent pointer-events-none",s,!Io()&&"hidden"),initial:{y:0},animate:{y:d&&!i?"-100%":0},transition:{duration:.3,ease:"easeInOut"},children:a.jsxs("div",{className:"flex items-center h-full w-full",children:[a.jsx("div",{className:"w-10 flex-shrink-0 pointer-events-auto",children:t&&a.jsx(ie,{variant:"ghost",size:"icon",className:"h-10 w-10 -ml-2 rounded-full active-scale",onClick:()=>n?n():window.history.back(),"aria-label":"Go back",children:a.jsx(To,{className:"w-6 h-6"})})}),a.jsx("div",{className:"flex-1 flex justify-center items-center overflow-hidden",children:a.jsx(kn.h1,{className:"text-[17px] font-semibold tracking-tight truncate font-system my-0 leading-none",animate:{opacity:c||i?1:0,y:c||i?0:5},children:e})}),a.jsx("div",{className:"w-10 flex justify-end flex-shrink-0 pointer-events-auto",children:r})]})})}let Qc=0,jv="";function qee({open:e,onOpenChange:t,children:n,title:r,showHandle:s=!0,swipeToDismiss:i=!0,handleDragToDismiss:o=!1,className:l,headerClassName:c,handleClassName:u,titleClassName:d,headerActions:h,headerLeading:f,centerTitle:p=!1}){const g=RZ(),v=i||o;m.useEffect(()=>{if(e)return Qc===0&&(jv=document.body.style.overflow,document.body.style.overflow="hidden"),Qc+=1,()=>{Qc=Math.max(0,Qc-1),Qc===0&&(document.body.style.overflow=jv,jv="")}},[e]);const y=(x,b)=>{v&&(b.offset.y>72||b.velocity.y>520)&&t(!1)};return a.jsx(K2,{children:e&&a.jsxs(a.Fragment,{children:[a.jsx(kn.div,{initial:{opacity:0}
595,animate:{opacity:1},exit:{opacity:0},onClick:()=>t(!1),className:"fixed inset-0 z-[100] bg-black/50 backdrop-blur-sm [overscroll-behavior:contain]"}),a.jsxs(kn.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:35,stiffness:400,mass:.8},drag:v?"y":!1,dragListener:i,dragControls:g,dragConstraints:{top:0,bottom:140},dragElastic:.08,onDragEnd:y,className:q("fixed inset-x-0 bottom-0 z-[101]","bg-white dark:bg-gray-900","rounded-t-[32px] shadow-2xl","max-h-[90vh] overflow-hidden","flex flex-col","safe-area-bottom",l),children:[s&&a.jsx("button",{type:"button","aria-label":"Drag down to close",className:q("relative z-10 flex touch-none cursor-grab justify-center pt-3 pb-2 active:cursor-grabbing",u),onPointerDown:x=>{o&&!i&&g.start(x.nativeEvent)},children:a.jsx("div",{className:"w-10 h-1 rounded-full bg-gray-300 dark:bg-gray-600"})}),r&&a.jsxs("div",{className:q("relative z-10 border-b border-gray-200 dark:border-gray-700",p?"grid h-[72px] grid-cols-[1fr_minmax(0,auto)_1fr] items-center px-5 py-0":"flex items-center justify-between px-4 py-3",c),children:[p&&a.jsx("div",{className:"flex h-10 items-center justify-self-start",children:f??a.jsx("div",{"aria-hidden":"true",className:"h-10 w-10"})}),p?a.jsx("div",{className:q("flex h-10 min-w-0 items-center justify-center justify-self-center text-lg font-semibold leading-none text-gray-900 dark:text-white",d),children:r}):a.jsx("h2",{className:q("text-lg font-semibold text-gray-900 dark:text-white",d),children:r}),a.jsxs("div",{className:q("flex items-center gap-1",p&&"h-10 justify-self-end"),children:[h,a.jsx(kn.button,{onClick:()=>t(!1),className:q("flex items-center justify-center",p?"h-10 w-10 rounded-full":"w-8 h-8 rounded-full","bg-transparent","text-gray-500 dark:text-gray-400","hover:bg-gray-100/70 dark:hover:bg-gray-800/70","transition-colors"),whileTap:{scale:.9},"aria-label":"Close",children:a.jsx(vn,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"relative z-10 flex flex-col overflow-y-auto scrollbar-hide flex-1","data-no-nav-clearance":"",style:{touchAction:"pan-y"},children:n})]})]})})}const Ct=m.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:q("flex w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","h-12 sm:h-10","text-base sm:text-sm","rounded-xl sm:rounded-md","touch-manipulation",e),ref:r,...n}));Ct.displayName="Input";var Gee="Label",JD=m.forwardRef((e,t)=>a.jsx(we.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));JD.displayName=Gee;var eL=JD;const Kee=bc("text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),at=m.forwardRef(({className:e,...t},n)=>a.jsx(eL,{ref:n,className:q(Kee(),e),...t}));at.displayName=eL.displayName;const Zc={async fetchGmailStatus(){const e=await fetch("/api/integrations/gmail/status");if(!e.ok)throw new Error("Failed to fetch Gmail status");return e.json()},async disconnectGmail(){const e=await fetch("/api/integrations/gmail/disconnect",{method:"POST"});if(!e.ok)throw new Error("Failed to disconnect Gmail");return e.json()},async triggerMailAutoSync(){const e=new Date(Date.now()-2592e6),t=new Date;await fetch("/api/mail/emails/unified",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({startDate:e.toISOString(),endDate:t.toISOString(),skipCache:!0})})},async fetchMicrosoftMailStatus(){const e=await fetch("/api/integrations/microsoft/mail/status");if(!e.ok)throw new Error("Failed to fetch Microsoft Mail status");return e.json()},async disconnectMicrosoftMail(){const e=await fetch("/api/integrations/microsoft/mail/disconnect",{method:"POST"});if(!e.ok)throw new Error("Failed to disconnect Microsoft Mail");return e.json()},async initiateMicrosoftMailConnect(e){sessionStorage.setItem("oauthPending","microsoftMail");const t=await fetch("/api/auth/microsoft/mail/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({returnUrl:e||window.location.pathname})}),{authUrl:n}=await t.json();if(n)window.location.href=n;else throw new Error("No auth URL received")}},ol={async fetchGoogleCalendarStatus(){const e=await fetch("/api/integrations/google-calendar/status");if(!e.ok)throw new Error("Failed to fetch Google Calendar status");return e.json()}
595,async disconnectGoogleCalendar(){const e=await fetch("/api/integrations/google-calendar/disconnect",{method:"POST"});if(!e.ok)throw new Error("Failed to disconnect Google Calendar");return e.json()},async fetchMicrosoftCalendarStatus(){const e=await fetch("/api/integrations/microsoft/calendar/status");if(!e.ok)throw new Error("Failed to fetch Microsoft Calendar status");return e.json()},async disconnectMicrosoftCalendar(){const e=await fetch("/api/integrations/microsoft/calendar/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok){const t=await e.json();throw new Error(t.message||"Failed to disconnect Microsoft Calendar")}return e.json()},async initiateGoogleCalendarConnect(e){const t=encodeURIComponent(e||window.location.pathname);window.location.href=`/api/auth/google/calendar?return_url=${t}`},async initiateMicrosoftCalendarConnect(e){sessionStorage.setItem("oauthPending","microsoftCalendar");const t=await fetch("/api/auth/microsoft/calendar/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({returnUrl:e||window.location.pathname})}),{authUrl:n}=await t.json();if(n)window.location.href=n;else throw new Error("No auth URL received")}},Xc={async fetchImapStatus(){const e=await fetch("/api/integrations/imap/status",{credentials:"include"});if(!e.ok)throw new Error(`Failed to fetch IMAP status: ${e.statusText}`);return e.json()},async connectImap(e){const t=await fetch("/api/integrations/imap/connect",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to connect IMAP account")}return t.json()},async disconnectImap(e){const t=await fetch("/api/integrations/imap/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accountId:e})});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to disconnect IMAP account")}return t.json()},async testImap(e){const t=await fetch("/api/integrations/imap/test",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)});return t.ok?t.json():{valid:!1,error:"Network error"}},async fetchProviders(){const e=await fetch("/api/integrations/imap/providers",{credentials:"include"});if(!e.ok)throw new Error("Failed to fetch providers");return e.json()}};function Yee(){const e=Lt(),{toast:t}=sn(),{isCapacitor:n,openCalendarAuth:r}=tP(),[s,i]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(!1),[g,v]=m.useState(!1),[y,x]=m.useState(!1),[b,w]=m.useState(!1),S=tt({queryKey:["gmail","status"],queryFn:Zc.fetchGmailStatus,staleTime:0}),_=tt({queryKey:["microsoft-mail","status"],queryFn:Zc.fetchMicrosoftMailStatus,staleTime:0}),E=tt({queryKey:["google-calendar","status"],queryFn:ol.fetchGoogleCalendarStatus,staleTime:0}),R=tt({queryKey:["microsoft-calendar","status"],queryFn:ol.fetchMicrosoftCalendarStatus,staleTime:0}),A=tt({queryKey:["imap","status"],queryFn:Xc.fetchImapStatus,staleTime:0}),N=tt({queryKey:["imap","providers"],queryFn:Xc.fetchProviders}),k=gt({mutationFn:Zc.disconnectGmail,onMutate:async()=>{await e.cancelQueries({queryKey:["gmail","status"]});const C=e.getQueryData(["gmail","status"]);return e.setQueryData(["gmail","status"],{connected:!1,message:"Gmail not connected"}),{previousStatus:C}},onSuccess:()=>{e.invalidateQueries({queryKey:["gmail","status"]}),e.invalidateQueries({queryKey:["mail","status"]}),e.refetchQueries({queryKey:["gmail","status"]}),t({title:"Gmail Disconnected",description:"Your Gmail account has been disconnected successfully."}),p(!1)},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["gmail","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to disconnect Gmail",variant:"destructive"})}}),T=gt({mutationFn:Zc.disconnectMicrosoftMail,onMutate:async()=>{await e.cancelQueries({queryKey:["microsoft-mail","status"]});const C=e.getQueryData(["microsoft-mail","status"]);return e.setQueryData(["microsoft-mail","status"],{connected:!1,message:"Microsoft Mail not connected"}),{previousStatus:C}},onSuccess:()=>
595{e.invalidateQueries({queryKey:["microsoft-mail","status"]}),e.invalidateQueries({queryKey:["mail","unified"]}),e.invalidateQueries({queryKey:["mail","status"]}),e.refetchQueries({queryKey:["microsoft-mail","status"]}),t({title:"Outlook Disconnected",description:"Your Outlook account has been disconnected successfully."}),v(!1)},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["microsoft-mail","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to disconnect Outlook",variant:"destructive"})}}),I=gt({mutationFn:ol.disconnectGoogleCalendar,onMutate:async()=>{await e.cancelQueries({queryKey:["google-calendar","status"]});const C=e.getQueryData(["google-calendar","status"]);return e.setQueryData(["google-calendar","status"],{connected:!1,message:"Calendar not connected"}),{previousStatus:C}},onSuccess:()=>{e.invalidateQueries({queryKey:["google-calendar","status"]}),e.invalidateQueries({queryKey:["calendar","events"]}),e.refetchQueries({queryKey:["google-calendar","status"]}),t({title:"Google Calendar Disconnected",description:"Your Google Calendar has been disconnected successfully."}),x(!1)},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["google-calendar","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to disconnect Google Calendar",variant:"destructive"})}}),F=gt({mutationFn:ol.disconnectMicrosoftCalendar,onMutate:async()=>{await e.cancelQueries({queryKey:["microsoft-calendar","status"]});const C=e.getQueryData(["microsoft-calendar","status"]);return e.setQueryData(["microsoft-calendar","status"],{connected:!1,message:"Microsoft Calendar not connected"}),{previousStatus:C}},onSuccess:()=>{e.invalidateQueries({queryKey:["microsoft-calendar","status"]}),e.invalidateQueries({queryKey:["calendar","events"]}),e.refetchQueries({queryKey:["microsoft-calendar","status"]}),t({title:"Microsoft Calendar Disconnected",description:"Your Microsoft Calendar has been disconnected successfully."}),w(!1)},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["microsoft-calendar","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to disconnect Microsoft Calendar",variant:"destructive"})}}),L=gt({mutationFn:C=>Xc.testImap(C),onSuccess:C=>{C.valid?t({title:"Connection Test Successful",description:"IMAP connection is working correctly."}):t({title:"Connection Test Failed",description:C.error||"Unable to connect to IMAP server.",variant:"destructive"})},onError:C=>{t({title:"Error",description:C.message||"Failed to test IMAP connection",variant:"destructive"})}}),M=gt({mutationFn:C=>Xc.connectImap(C),onMutate:async C=>{await e.cancelQueries({queryKey:["imap","status"]});const H=e.getQueryData(["imap","status"]);return e.setQueryData(["imap","status"],{connected:!0,accounts:[{id:-1,username:C.username,lastSync:null}]}),{previousStatus:H}},onSuccess:()=>{e.invalidateQueries({queryKey:["imap","status"]}),e.invalidateQueries({queryKey:["mail","status"]}),t({title:"IMAP Account Connected",description:"Your IMAP email account has been connected successfully."}),sessionStorage.setItem("mailShouldSync","true"),h(!1)},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["imap","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to connect IMAP account",variant:"destructive"}),h(!1)}}),$=gt({mutationFn:C=>Xc.disconnectImap(C),onMutate:async()=>{await e.cancelQueries({queryKey:["imap","status"]});const C=e.getQueryData(["imap","status"]);return e.setQueryData(["imap","status"],{connected:!1,accounts:[]}),{previousStatus:C}},onSuccess:()=>{e.invalidateQueries({queryKey:["imap","status"]}),e.invalidateQueries({queryKey:["mail","status"]}),e.invalidateQueries({queryKey:["mail","unified"]}),t({title:"IMAP Account Disconnected",description:"Your IMAP account has been disconnected successfully."})},onError:(C,H,V)=>{V!=null&&V.previousStatus&&e.setQueryData(["imap","status"],V.previousStatus),t({title:"Error",description:C.message||"Failed to disconnect IMAP account",variant:"destructive"})}});return{gmailStatusQuery:S,microsoftMailStatusQuery:_,googleCalendarStatusQuery:E,microsoftCalendarStatusQuery:R,imapStatusQuery:A,imapProvidersQuery:N,disconnectGmailMutation:k,disconnectMicrosoftMailMutation:T,disconnectGoogleCalendarMutation:I,disconnectMicrosoftCalendarMutation:F,testImapMutation:L,connectImapMutation:M,disconnectImapMutation:$,handleMicrosoftMailConnect:async()=>{i(!0);try{n?(await My("mail",window.location.pathname),i(!1)):await Zc.initiateMicrosoftMailConnect()}catch(C){t({title:"Error",description:C.message||"Failed to initiate Outlook connection",variant:"destructive"}),i(!1)}},handleGoogleCalendarConnect:async()=>
595{l(!0);try{n?(await r(window.location.pathname),l(!1)):await ol.initiateGoogleCalendarConnect()}catch(C){t({title:"Error",description:C.message||"Failed to initiate Google Calendar connection",variant:"destructive"}),l(!1)}},handleMicrosoftCalendarConnect:async()=>{u(!0);try{n?(await My("calendar",window.location.pathname),u(!1)):await ol.initiateMicrosoftCalendarConnect()}catch(C){t({title:"Error",description:C.message||"Failed to initiate Microsoft Calendar connection",variant:"destructive"}),u(!1)}},isMicrosoftMailConnecting:s,isGoogleCalendarConnecting:o,isMicrosoftCalendarConnecting:c,isImapConnecting:d,setIsImapConnecting:h,isGmailDisconnectDialogOpen:f,setIsGmailDisconnectDialogOpen:p,isMicrosoftMailDisconnectDialogOpen:g,setIsMicrosoftMailDisconnectDialogOpen:v,isGoogleCalendarDisconnectDialogOpen:y,setIsGoogleCalendarDisconnectDialogOpen:x,isMicrosoftCalendarDisconnectDialogOpen:b,setIsMicrosoftCalendarDisconnectDialogOpen:w}}const Us=m.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:q("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-3 ring-offset-background","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","text-base","rounded-xl sm:rounded-md","touch-manipulation","resize-none sm:resize-y",e),ref:n,...t}));Us.displayName="Textarea";function p_({value:e,onChange:t,label:n="Hours",required:r=!1,className:s="",disabled:i=!1,readOnly:o=!1,placeholder:l="0.0167",showQuickButtons:c=!0,showConversion:u=!0,suggestedHours:d,onBlur:h,onKeyDown:f,autoFocus:p}){const[g,v]=m.useState("0"),[y,x]=m.useState("0"),b=E=>{const R=parseFloat(E)||0,A=Math.floor(R),N=Math.round((R-A)*60);return{hours:A.toString(),minutes:N.toString()}},w=(E,R)=>{const A=parseInt(E)||0,N=parseInt(R)||0;return(A+N/60).toFixed(3)};m.useEffect(()=>{if(e){const{hours:E,minutes:R}=b(e);v(E),x(R)}},[e]);const S=(E,R)=>{v(E),x(R);const A=w(E,R);t(A)},_=E=>{setTimeout(()=>{var T,I;const R=document.activeElement,A=(I=(T=E.currentTarget)==null?void 0:T.closest)==null?void 0:I.call(T,".space-y-3"),N=A&&A.contains(R),k=(R==null?void 0:R.type)==="number"&&((R==null?void 0:R.placeholder)==="0"||(R==null?void 0:R.min)==="0");!N&&!k&&(h==null||h())},200)};return a.jsxs("div",{className:`space-y-3 ${s}`,children:[n&&a.jsxs(at,{className:"flex items-center gap-2 text-sm",children:[a.jsx(Cb,{className:"h-4 w-4"}),n,r&&a.jsx("span",{className:"text-red-500",children:"*"}),d&&a.jsxs(Is,{variant:"outline",className:"text-xs",children:["Suggested: ",d]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"min-w-[70px]",children:[a.jsx(Ct,{type:"number",min:"0",max:"23",placeholder:"0",value:g,onChange:E=>S(E.target.value,y),disabled:i,readOnly:o,className:"font-mono text-center",onBlur:_,onKeyDown:f,autoFocus:p}),a.jsx("div",{className:"text-xs text-muted-foreground text-center mt-1",children:"Hours"})]}),a.jsx("div",{className:"text-muted-foreground font-bold text-lg",children:":"}),a.jsxs("div",{className:"min-w-[70px]",children:[a.jsx(Ct,{type:"number",min:"0",max:"59",placeholder:"0",value:y,onChange:E=>S(g,E.target.value),disabled:i,readOnly:o,className:"font-mono text-center",onBlur:_,onKeyDown:f}),a.jsx("div",{className:"text-xs text-muted-foreground text-center mt-1",children:"Minutes"})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(ts,{className:"h-4 w-4"}),a.jsxs("span",{className:"font-mono",children:[w(g,y)," hrs"]})]})]}),e&&a.jsxs("div",{className:"text-xs text-gray-500",children:[parseFloat(e)<.0167&&a.jsx("span",{className:"text-amber-600",children:"⚠️ Minimum is 1 minute (0.0167 hours)"}),parseFloat(e)>24&&a.jsx("span",{className:"text-red-600",children:"⚠️ Maximum is 24 hours per entry"})]})]})}const Qee="https://repsshield.com",fo=[{value:"approving-new-tenants",label:"Approving new tenants",duration:"1-2 hours",defaultHours:1.5},{value:"reviewing-tenant-applications",label:"Reviewing tenant applications",duration:"0.5-1 hour",defaultHours:.75},{value:"responding-to-tenant-inquiries",label:"Responding to tenant inquiries",duration:"0.25-0.5 hour",defaultHours:.25},{value:"handling-tenant-complaints",label:"Handling tenant complaints",duration:"0.5-2 hours",defaultHours:1},{value:"handling-tenant-evictions",label:"Handling tenant evictions",duration:"2-4 hours",defaultHours:3},{value:"conducting-tenant-move-in-inspections",label:"Conducting tenant move-in inspections",duration:"1-2 hours",defaultHours:1.5},{value:"conducting-tenant-move-out-inspections",label:"Conducting tenant move-out inspections",duration:"1-2 hours",defaultHours:1.5},{value:"performing-routine-maintenance",label:"Performing routine maintenance",duration:"1-4 hours",defaultHours:2.5},{value:"overseeing-major-repairs",label:"Overseeing major repairs",duration:"2-6 hours",defaultHours:4},{value:"inspecting-properties-for-maintenance-needs",label:"Inspecting properties for maintenance needs",duration:"1-3 hours",defaultHours:2},{value:"arranging-contractors-for-repairs",label:"Arranging contractors for repairs",duration:"0.5-2 hours",defaultHours:1},{value:"collecting-rent-payments",label:"Collecting rent payments",duration:"0.5-1 hour",defaultHours:.75},{value:"preparing-financial-statements",label:"Preparing financial statements",duration:"2-4 hours",defaultHours:3},{value:"reviewing-property-budgets",label:"Reviewing property budgets",duration:"1-2 hours",defaultHours:1.5},{value:"property-visits-for-inspections",label:"Property visits for inspections",duration:"1-3 hours",defaultHours:2},{value:"tenant-communication-phone-calls",label:"Tenant communication phone calls",duration:"0.25-1 hour",defaultHours:.5},{value:"tenant-communication-emails",label:"Tenant communication emails",duration:"0.25-0.5 hour",defaultHours:.25},{value:"marketing-vacant-properties",label:"Marketing vacant properties",duration:"1-3 hours",defaultHours:2},{value:"showing-properties-to-prospects",label:"Showing properties to prospects",duration:"1-2 hours",defaultHours:1.5},{value:"real-estate-education-seminars",label:"Real estate education seminars",duration:"2-8 hours",defaultHours:4},{value:"rental-property-research",label:"Rental property research",duration:"1-4 hours",defaultHours:2.5},{value:"tenant-screening-background-checks",label:"Tenant screening background checks",duration:"0.5-1 hour",defaultHours:.75},{value:"property-management-software-updates",label:"Property management software updates",duration:"0.5-2 hours",defaultHours:1},{value:"insurance-claim-processing",label:"Insurance claim processing",duration:"1-3 hours",defaultHours:2},{value:"legal-consultation-meetings",label:"Legal consultation meetings",duration:"1-2 hours",defaultHours:1.5},{value:"tax-preparation-property-related",label:"Tax preparation property related",duration:"2-6 hours",defaultHours:4},{value:"property-acquisition-analysis",label:"Property acquisition analysis",duration:"2-8 hours",defaultHours:5},{value:"rental-market-analysis",label:"Rental market analysis",duration:"1-4 hours",defaultHours:2.5},{value:"property-photography-listing",label:"Property photography listing",duration:"1-2 hours",defaultHours:1.5},{value:"lease-agreement-preparation",label:"Lease agreement preparation",duration:"0.5-1 hour",defaultHours:.75}],c0e=[{id:1,state:"false",name:"Qualified Non-Material"},{id:2,state:"true",name:"Material Participation Activity"}];function Zee(e){const t=fo.find(n=>n.value===e);return t||{value:e,label:e.replace(/-/g," ").replace(/\b\w/g,n=>n.toUpperCase()),duration:"1-2 hours",defaultHours:1.5}}const GN={TOTAL_HOURS:750,MATERIAL_PARTICIPATION_HOURS:100}
vendor: 19,051 bytes, line 595
595,u0e={"approving-new-tenants":{autoEnable:!1,riskLevel:"moderate",explanation:"Tenant approval typically involves administrative tasks that may not qualify as material participation."},"reviewing-tenant-applications":{autoEnable:!1,riskLevel:"moderate",explanation:"Application review is often administrative and may not qualify for material participation."},"responding-to-tenant-inquiries":{autoEnable:!1,riskLevel:"low",explanation:"Routine inquiries can qualify as material participation if they involve property management decisions."},"handling-tenant-complaints":{autoEnable:!0,riskLevel:"low",explanation:"Resolving tenant complaints typically qualifies as material participation as it involves active property management."},"conducting-tenant-move-in-inspections":{autoEnable:!0,riskLevel:"low",explanation:"Physical property inspections clearly qualify as material participation."},"conducting-tenant-move-out-inspections":{autoEnable:!0,riskLevel:"low",explanation:"Physical property inspections clearly qualify as material participation."},"performing-routine-maintenance":{autoEnable:!0,riskLevel:"low",explanation:"Hands-on maintenance work clearly qualifies as material participation."},"overseeing-major-repairs":{autoEnable:!0,riskLevel:"low",explanation:"Supervising repairs involves active property management and qualifies as material participation."},"property-visits-for-inspections":{autoEnable:!0,riskLevel:"low",explanation:"Physical property visits for inspections clearly qualify as material participation."},"showing-properties-to-prospects":{autoEnable:!0,riskLevel:"low",explanation:"Property showings involve active participation in rental activities."},"marketing-vacant-properties":{autoEnable:!0,riskLevel:"moderate",explanation:"Marketing activities may qualify if they involve substantial management decisions."}};function d0e(e,t,n){const r=GN.TOTAL_HOURS,s=n==="shortTerm"?GN.MATERIAL_PARTICIPATION_HOURS:0,i=e/r*100,o=n==="shortTerm"?t/s*100:100,l=Math.min(i,o);return l>=90?{level:"low",color:"green"}:l>=70?{level:"moderate",color:"yellow"}:{level:"high",color:"red"}}var KN=1,Xee=.9,Jee=.8,ete=.17,Tv=.1,Pv=.999,tte=.9999,nte=.99,rte=/[\\\/_+.#"@\[\(\{&]/,ste=/[\\\/_+.#"@\[\(\{&]/g,ite=/[\s-]/,tL=/[\s-]/g;function e0(e,t,n,r,s,i,o){if(i===t.length)return s===e.length?KN:nte;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=r.charAt(i),u=n.indexOf(c,s),d=0,h,f,p,g;u>=0;)h=e0(e,t,n,r,u+1,i+1,o),h>d&&(u===s?h*=KN:rte.test(e.charAt(u-1))?(h*=Jee,p=e.slice(s,u-1).match(ste),p&&s>0&&(h*=Math.pow(Pv,p.length))):ite.test(e.charAt(u-1))?(h*=Xee,g=e.slice(s,u-1).match(tL),g&&s>0&&(h*=Math.pow(Pv,g.length))):(h*=ete,s>0&&(h*=Math.pow(Pv,u-s))),e.charAt(u)!==t.charAt(i)&&(h*=tte)),(h<Tv&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(f=e0(e,t,n,r,u+1,i+2,o),f*Tv>h&&(h=f*Tv)),h>d&&(d=h),u=n.indexOf(c,u+1);return o[l]=d,d}function YN(e){return e.toLowerCase().replace(tL," ")}function ote(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,e0(e,t,YN(e),YN(t),0,0,{})}var Jc='[cmdk-group=""]',Av='[cmdk-group-items=""]',ate='[cmdk-group-heading=""]',nL='[cmdk-item=""]',QN=`${nL}:not([aria-disabled="true"])`,t0="cmdk-item-select",ll="data-value",lte=(e,t,n)=>ote(e,t,n),rL=m.createContext(void 0),oh=()=>m.useContext(rL),sL=m.createContext(void 0),m_=()=>m.useContext(sL),iL=m.createContext(void 0),oL=m.forwardRef((e,t)=>{let n=cl(()=>{var V,O;return{search:"",value:(O=(V=e.value)!=null?V:e.defaultValue)!=null?O:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=cl(()=>new Set),s=cl(()=>new Map),i=cl(()=>new Map),o=cl(()=>new Set),l=aL(e),{label:c,children:u,value:d,onValueChange:h,filter:f,shouldFilter:p,loop:g,disablePointerSelection:v=!1,vimBindings:y=!0,...x}=e,b=dn(),w=dn(),S=dn(),_=m.useRef(null),E=xte();Na(()=>{if(d!==void 0){let V=d.trim();n.current.value=V,R.emit()}},[d]),Na(()=>{E(6,F)},[]);let R=m.useMemo(()=>({subscribe:V=>(o.current.add(V),()=>o.current.delete(V)),snapshot:()=>n.current,setState:(V,O,G)=>{var Z,ae,te,ne;if(!Object.is(n.current[V],O)){if(n.current[V]=O,V==="search")I(),k(),E(1,T);else if(V==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(S);re?re.focus():(Z=document.getElementById(b))==null||Z.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=L())==null?void 0:re.id,R.emit()}),G||E(5,F),((ae=l.current)==null?void 0:ae.value)!==void 0){let re=O??"";(ne=(te=l.current).onValueChange)==null||ne.call(te,re);return}}R.emit()}},emit:()=>{o.current.forEach(V=>V())}}),[]),A=m.useMemo(()=>({value:(V,O,G)=>{var Z;O!==((Z=i.current.get(V))==null?void 0:Z.value)&&(i.current.set(V,{value:O,keywords:G}),n.current.filtered.items.set(V,N(O,G)),E(2,()=>{k(),R.emit()}))},item:(V,O)=>(r.current.add(V),O&&(s.current.has(O)?s.current.get(O).add(V):s.current.set(O,new Set([V]))),E(3,()=>{I(),k(),n.current.value||T(),R.emit()}),()=>{i.current.delete(V),r.current.delete(V),n.current.filtered.items.delete(V);let G=L();E(4,()=>{I(),(G==null?void 0:G.getAttribute("id"))===V&&T(),R.emit()})}),group:V=>(s.current.has(V)||s.current.set(V,new Set),()=>{i.current.delete(V),s.current.delete(V)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:w,listInnerRef:_}),[]);function N(V,O){var G,Z;let ae=(Z=(G=l.current)==null?void 0:G.filter)!=null?Z:lte;return V?ae(V,n.current.search,O):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let V=n.current.filtered.items,O=[];n.current.filtered.groups.forEach(Z=>{let ae=s.current.get(Z),te=0;ae.forEach(ne=>{let re=V.get(ne);te=Math.max(re,te)}),O.push([Z,te])});let G=_.current;M().sort((Z,ae)=>{var te,ne;let re=Z.getAttribute("id"),J=ae.getAttribute("id");return((te=V.get(J))!=null?te:0)-((ne=V.get(re))!=null?ne:0)}).forEach(Z=>{let ae=Z.closest(Av);ae?ae.appendChild(Z.parentElement===ae?Z:Z.closest(`${Av} > *`)):G.appendChild(Z.parentElement===G?Z:Z.closest(`${Av} > *`))}),O.sort((Z,ae)=>ae[1]-Z[1]).forEach(Z=>{var ae;let te=(ae=_.current)==null?void 0:ae.querySelector(`${Jc}[${ll}="${encodeURIComponent(Z[0])}"]`);te==null||te.parentElement.appendChild(te)})}function T(){let V=M().find(G=>G.getAttribute("aria-disabled")!=="true"),O=V==null?void 0:V.getAttribute(ll);R.setState("value",O||void 0)}function I(){var V,O,G,Z;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ae=0;for(let te of r.current){let ne=(O=(V=i.current.get(te))==null?void 0:V.value)!=null?O:"",re=(Z=(G=i.current.get(te))==null?void 0:G.keywords)!=null?Z:[],J=N(ne,re);n.current.filtered.items.set(te,J),J>0&&ae++}for(let[te,ne]of s.current)for(let re of ne)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=ae}function F(){var V,O,G;let Z=L();Z&&(((V=Z.parentElement)==null?void 0:V.firstChild)===Z&&((G=(O=Z.closest(Jc))==null?void 0:O.querySelector(ate))==null||G.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function L(){var V;return(V=_.current)==null?void 0:V.querySelector(`${nL}[aria-selected="true"]`)}function M(){var V;return Array.from(((V=_.current)==null?void 0:V.querySelectorAll(QN))||[])}function $(V){let O=M()[V];O&&R.setState("value",O.getAttribute(ll))}function j(V){var O;let G=L(),Z=M(),ae=Z.findIndex(ne=>ne===G),te=Z[ae+V];(O=l.current)!=null&&O.loop&&(te=ae+V<0?Z[Z.length-1]:ae+V===Z.length?Z[0]:Z[ae+V]),te&&R.setState("value",te.getAttribute(ll))}function P(V){let O=L(),G=O==null?void 0:O.closest(Jc),Z;for(;G&&!Z;)G=V>0?vte(G,Jc):yte(G,Jc),Z=G==null?void 0:G.querySelector(QN);Z?R.setState("value",Z.getAttribute(ll)):j(V)}let D=()=>$(M().length-1),C=V=>{V.preventDefault(),V.metaKey?D():V.altKey?P(1):j(1)},H=V=>{V.preventDefault(),V.metaKey?$(0):V.altKey?P(-1):j(-1)};return m.createElement(we.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:V=>{var O;(O=x.onKeyDown)==null||O.call(x,V);let G=V.nativeEvent.isComposing||V.keyCode===229;if(!(V.defaultPrevented||G))switch(V.key){case"n":case"j":{y&&V.ctrlKey&&C(V);break}case"ArrowDown":{C(V);break}case"p":case"k":{y&&V.ctrlKey&&H(V);break}case"ArrowUp":{H(V);break}case"Home":{V.preventDefault(),$(0);break}case"End":{V.preventDefault(),D();break}case"Enter":{V.preventDefault();let Z=L();if(Z){let ae=new Event(t0);Z.dispatchEvent(ae)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:wte},c),$m(e,V=>m.createElement(sL.Provider,{value:R},m.createElement(rL.Provider,{value:A},V))))}),cte=m.forwardRef((e,t)=>{var n,r;let s=dn(),i=m.useRef(null),o=m.useContext(iL),l=oh(),c=aL(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Na(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let d=lL(s,i,[e.value,e.children,i],e.keywords),h=m_(),f=No(E=>E.value&&E.value===d.current),p=No(E=>u||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);m.useEffect(()=>{let E=i.current;if(!(!E||e.disabled))return E.addEventListener(t0,g),()=>E.removeEventListener(t0,g)},[p,e.onSelect,e.disabled]);function g(){var E,R;v(),(R=(E=c.current).onSelect)==null||R.call(E,d.current)}function v(){h.setState("value",d.current,!0)}if(!p)return null;let{disabled:y,value:x,onSelect:b,forceMount:w,keywords:S,..._}=e;return m.createElement(we.div,{ref:mo(i,t),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!f,"data-disabled":!!y,"data-selected":!!f,onPointerMove:y||l.getDisablePointerSelection()?void 0:v,onClick:y?void 0:g},e.children)}),ute=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=dn(),l=m.useRef(null),c=m.useRef(null),u=dn(),d=oh(),h=No(p=>s||d.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);Na(()=>d.group(o),[]),lL(o,l,[e.value,e.heading,c]);let f=m.useMemo(()=>({id:o,forceMount:s}),[s]);return m.createElement(we.div,{ref:mo(l,t),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&m.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),$m(e,p=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},m.createElement(iL.Provider,{value:f},p))))}),dte=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=m.useRef(null),i=No(o=>!o.search);return!n&&!i?null:m.createElement(we.div,{ref:mo(s,t),...r,"cmdk-separator":"",role:"separator"})}),hte=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=m_(),o=No(u=>u.search),l=No(u=>u.selectedItemId),c=oh();return m.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),m.createElement(we.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),fte=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=m.useRef(null),o=m.useRef(null),l=No(u=>u.selectedItemId),c=oh();return m.useEffect(()=>{if(o.current&&i.current){let u=o.current,d=i.current,h,f=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(h),f.unobserve(u)}}},[]),m.createElement(we.div,{ref:mo(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},$m(e,u=>m.createElement("div",{ref:mo(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),pte=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return m.createElement(rh,{open:n,onOpenChange:r},m.createElement(sh,{container:o},m.createElement(Ua,{"cmdk-overlay":"",className:s}),m.createElement(za,{"aria-label":e.label,"cmdk-dialog":"",className:i},m.createElement(oL,{ref:t,...l}))))}),mte=m.forwardRef((e,t)=>No(n=>n.filtered.count===0)?m.createElement(we.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),gte=m.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return m.createElement(we.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},$m(e,o=>m.createElement("div",{"aria-hidden":!0},o)))}),hr=Object.assign(oL,{List:fte,Item:cte,Input:hte,Group:ute,Separator:dte,Dialog:pte,Empty:mte,Loading:gte});function vte(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function yte(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function aL(e){let t=m.useRef(e);return Na(()=>{t.current=e}),t}var Na=typeof window>"u"?m.useEffect:m.useLayoutEffect;function cl(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function No(e){let t=m_(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function lL(e,t,n,r=[]){let s=m.useRef(),i=oh();return Na(()=>{var o;let l=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(ll,l),s.current=l}),s}var xte=()=>{let[e,t]=m.useState(),n=cl(()=>new Map);return Na(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function bte(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function $m({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(bte(t),{ref:t.ref},n(t.props.children)):n(t)}var wte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const cL=m.forwardRef(({className:e,...t},n)=>a.jsx(hr,{ref:n,className:q("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));cL.displayName=hr.displayName;const uL=m.forwardRef(({className:e,...t},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(hd,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(hr.Input,{ref:n,className:q("flex w-full rounded-md bg-transparent text-base placeholder:text-base outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));uL.displayName=hr.Input.displayName;const dL=m.forwardRef(({className:e,...t},n)=>a.jsx(hr.List,{ref:n,className:q("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));dL.displayName=hr.List.displayName;const hL=m.forwardRef((e,t)=>a.jsx(hr.Empty,{ref:t,className:"py-6 text-center text-base",...e}));hL.displayName=hr.Empty.displayName;const yf=m.forwardRef(({className:e,...t},n)=>a.jsx(hr.Group,{ref:n,className:q("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));yf.displayName=hr.Group.displayName;const _te=m.forwardRef(({className:e,...t},n)=>a.jsx(hr.Separator,{ref:n,className:q("-mx-1 h-px bg-border",e),...t}));_te.displayName=hr.Separator.displayName;const xf=m.forwardRef(({className:e,...t},n)=>a.jsx(hr.Item,{ref:n,className:q("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-base outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));xf.displayName=hr.Item.displayName;var Vm="Popover",[fL]=yn(Vm,[Po]),ah=Po(),[kte,Oo]=fL(Vm),pL=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=ah(t),c=m.useRef(null),[u,d]=m.useState(!1),[h,f]=cr({prop:r,defaultProp:s??!1,onChange:i,caller:Vm});return a.jsx(hm,{...l,children:a.jsx(kte,{scope:t,contentId:dn(),triggerRef:c,open:h,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:u,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:o,children:n})})};pL.displayName=Vm;var mL="PopoverAnchor",Ste=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Oo(mL,n),i=ah(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return m.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(Wd,{...i,...r,ref:t})});Ste.displayName=mL;var gL="PopoverTrigger",vL=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Oo(gL,n),i=ah(n),o=He(t,s.triggerRef),l=a.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":_L(s.open),...r,ref:o,onClick:he(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(Wd,{asChild:!0,...i,children:l})});vL.displayName=gL;var g_="PopoverPortal",[Ete,Nte]=fL(g_,{forceMount:void 0}),yL=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=Oo(g_,t);return a.jsx(Ete,{scope:t,forceMount:n,children:a.jsx(hn,{present:n||i.open,children:a.jsx(La,{asChild:!0,container:s,children:r})})})};yL.displayName=g_;var uc="PopoverContent",xL=m.forwardRef((e,t)=>{const n=Nte(uc,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=Oo(uc,e.__scopePopover);return a.jsx(hn,{present:r||i.open,children:i.modal?a.jsx(jte,{...s,ref:t}):a.jsx(Tte,{...s,ref:t})})});xL.displayName=uc;var Cte=go("PopoverContent.RemoveScroll"),jte=m.forwardRef((e,t)=>{const n=Oo(uc,e.__scopePopover),r=m.useRef(null),s=He(t,r),i=m.useRef(!1);return m.useEffect(()=>{const o=r.current;if(o)return gm(o)},[]),a.jsx(Gd,{as:Cte,allowPinchZoom:!0,children:a.jsx(bL,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:he(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:he(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:he(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Tte=m.forwardRef((e,t)=>{const n=Oo(uc,e.__scopePopover),r=m.useRef(!1),s=m.useRef(!1);return a.jsx(bL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),bL=m.forwardRef((e,t)=>
595{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=e,f=Oo(uc,n),p=ah(n);return am(),a.jsx(zd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(Da,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:a.jsx(fm,{"data-state":_L(f.open),role:"dialog",id:f.contentId,...p,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),wL="PopoverClose",Pte=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Oo(wL,n);return a.jsx(we.button,{type:"button",...r,ref:t,onClick:he(e.onClick,()=>s.onOpenChange(!1))})});Pte.displayName=wL;var Ate="PopoverArrow",Ite=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ah(n);return a.jsx(pm,{...s,...r,ref:t})});Ite.displayName=Ate;function _L(e){return e?"open":"closed"}var Rte=pL,Mte=vL,Ote=yL,kL=xL;const SL=Rte,EL=Mte,v_=m.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>a.jsx(Ote,{children:a.jsx(kL,{ref:s,align:t,sideOffset:n,className:q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));v_.displayName=kL.displayName;function y_({value:e,onValueChange:t,placeholder:n="Select activity type...",className:r,popoverContentClassName:s,disabled:i=!1}){const[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,h]=m.useState(!1),[f,p]=m.useState(!1),[g,v]=m.useState(null),[y,x]=m.useState(null),[b,w]=m.useState(""),[S,_]=m.useState(!1),E=Lt(),{data:R=[]}=tt({queryKey:["custom-activity-types"],queryFn:async()=>{const j=await fetch("/api/activity-types");if(!j.ok)throw new Error("Failed to fetch custom activity types");return j.json()},staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0}),A=m.useMemo(()=>{const j=new Set(fo.map(P=>P.value));return R.filter(P=>!j.has(P.activityType)).map(P=>({id:P.id,label:P.activityType,value:P.activityType,duration:"",defaultHours:0}))},[R]),N=j=>j?Zee(j).label:n,k=c.trim()&&!fo.some(j=>j.label.toLowerCase()===c.toLowerCase()||j.value.toLowerCase()===c.toLowerCase())&&!A.some(j=>j.label.toLowerCase()===c.toLowerCase()||j.value.toLowerCase()===c.toLowerCase()),T=j=>{t(j),l(!1),u("")},I=async()=>{if(c.trim()){const j=c.trim().toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-");_(!0);try{if(!(await fetch("/api/activity-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({activityType:j})})).ok)throw new Error("Failed to create activity type");await E.invalidateQueries({queryKey:["custom-activity-types"],refetchType:"all"}),T(j)}catch(P){console.error("Error creating activity type:",P),T(j)}finally{_(!1)}}},F=(j,P)=>{j.stopPropagation(),v(R.find(D=>D.id===P.id)||null),w(P.label),h(!0)},L=(j,P)=>{j.stopPropagation(),x(R.find(D=>D.id===P.id)||null),p(!0)},M=async()=>{if(!(!g||!b.trim())){_(!0);try{if(!(await fetch(`/api/activity-types/${g.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({activityType:b.trim()})})).ok)throw new Error("Failed to update activity type");e===g.activityType&&t(b.trim()),await E.invalidateQueries({queryKey:["custom-activity-types"],refetchType:"all"}),h(!1),v(null),w("")}catch(j){console.error("Error updating activity type:",j)}finally{_(!1)}}},$=async()=>
595{if(y){_(!0);try{if(!(await fetch(`/api/activity-types/${y.id}`,{method:"DELETE"})).ok)throw new Error("Failed to delete activity type");e===y.activityType&&t(""),await E.invalidateQueries({queryKey:["custom-activity-types"],refetchType:"all"}),p(!1),x(null)}catch(j){console.error("Error deleting activity type:",j)}finally{_(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsxs(SL,{open:o,onOpenChange:l,children:[a.jsx(EL,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":o,className:q("w-full justify-between",r),disabled:i,children:[a.jsx("span",{className:"truncate",children:N(e)}),a.jsx(Y9,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(v_,{className:q("w-full max-w-[400px] p-0",s),align:"start",sideOffset:4,children:a.jsxs(cL,{children:[a.jsx(uL,{placeholder:"Search activity types...",value:c,onValueChange:u,className:"text-base font-normal h-7 py-1"}),a.jsxs(dL,{children:[a.jsx(hL,{children:c.trim()?a.jsxs("div",{className:"text-center py-4",children:[a.jsx("p",{children:"No activity types found."}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try typing a custom activity name"})]}):"No activity types found."}),A.length>0&&a.jsx(yf,{heading:"Custom Activity Types",children:A.map(j=>a.jsxs(xf,{value:j.value,onSelect:()=>T(j.value),className:"group",children:[a.jsx(bt,{className:q("mr-2 h-4 w-4",e===j.value?"opacity-100":"opacity-0")}),a.jsxs("div",{className:"flex flex-col flex-1",children:[a.jsx("span",{children:j.label}),a.jsx("span",{className:"text-xs text-muted-foreground",children:j.duration})]}),a.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:P=>F(P,j),children:a.jsx(Tb,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive hover:text-destructive",onClick:P=>L(P,j),children:a.jsx(Ib,{className:"h-3 w-3"})})]})]},j.value))}),a.jsx(yf,{heading:"Predefined Activity Types",children:fo.map(j=>a.jsxs(xf,{value:j.value,onSelect:()=>T(j.value),children:[a.jsx(bt,{className:q("mr-2 h-4 w-4",e===j.value?"opacity-100":"opacity-0")}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{children:j.label}),a.jsx("span",{className:"text-xs text-muted-foreground",children:j.duration})]})]},j.value))}),k&&a.jsx(yf,{heading:"Custom Activity Type",children:a.jsxs(xf,{onSelect:I,value:`add-custom-${c}`,disabled:S,children:[S?a.jsx(nc,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(nc,{className:"mr-2 h-4 w-4"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{children:S?"Creating...":`Add "${c}" as custom activity`}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"Create a new activity type"})]})]})})]})]})})]}),a.jsx($s,{open:d,onOpenChange:h,children:a.jsxs(os,{children:[a.jsxs(as,{children:[a.jsx(ls,{children:"Edit Activity Type"}),a.jsx(Eo,{children:"Update the name of this custom activity type."})]}),a.jsx("div",{className:"py-4",children:a.jsx(Ct,{value:b,onChange:j=>w(j.target.value),placeholder:"Activity type name",autoFocus:!0})}),a.jsxs(Ed,{children:[a.jsx(ie,{variant:"outline",onClick:()=>{h(!1),v(null),w("")},disabled:S,children:"Cancel"}),a.jsx(ie,{onClick:M,disabled:!b.trim()||S,children:S?"Saving...":"Save"})]})]})}),a.jsx($s,{open:f,onOpenChange:p,children:a.jsxs(os,{children:[a.jsxs(as,{children:[a.jsx(ls,{children:"Delete Activity Type"}),a.jsxs(Eo,{children:['Are you sure you want to delete "',y==null?void 0:y.activityType,'"? This action cannot be undone.']})]}),a.jsxs(Ed,{children:[a.jsx(ie,{variant:"outline",onClick:()=>{p(!1),x(null)},disabled:S,children:"Cancel"}),a.jsx(ie,{variant:"destructive",onClick:$,disabled:S,children:S?"Deleting...":"Delete"})]})]})})]})}function Jn(e){try{window.dataLayer=window.dataLayer||[],e.timestamp||(e.timestamp=new Date().toISOString()),window.dataLayer.push(e)}catch(t){console.warn("Failed to track GA4 event:",t)}}function er(){try{const e=localStorage.getItem("user");if(e){const t=JSON.parse(e);return t.id||t.email}}catch{}}function NL(e,t){Jn({event:e,user_id:(t==null?void 0:t.user_id)||er(),...t})}function Dte(e,t){Jn({event:"started_trial",user_id:e||er(),plan_type:"trial",trial_length_days:30,...t})}function Lte(e,t){Jn({event:"logged_time",user_id:e||er(),entry_method:(t==null?void 0:t.entry_method)||"manual",hours_logged:t==null?void 0:t.hours_logged,activity_type:t==null?void 0:t.activity_type,...t})}function Fte(e,t){Jn({event:"generated_report",user_id:e||er(),report_type:(t==null?void 0:t.report_type)||"csv_export",entries_count:t==null?void 0:t.entries_count,...t})}function $te(e,t){Jn({event:"stopwatch_log_started",user_id:e||er(),entry_method:"stopwatch",...t})}function Vte(e,t){Jn({event:"property_added",user_id:e||er(),property_type:t==null?void 0:t.property_type,...t})}function Bte(e,t){Jn({event:"import_button_clicked",user_id:e||er(),import_type:(t==null?void 0:t.import_type)||"csv",...t})}function Ute(e,t){Jn({event:"export_button_clicked",user_id:e||er(),export_type:(t==null?void 0:t.export_type)||"csv",...t})}function zte(e,t){Jn({event:"ai_enhance_description_time_entry_form",user_id:e||er(),enhancement_location:"time_entry_form",...t})}function Hte(e,t){Jn({event:"file_import_data_mapping_success",user_id:e||er(),file_type:(t==null?void 0:t.file_type)||"csv",rows_imported:t==null?void 0:t.rows_imported,...t})}function Wte(e,t,n){Jn({event:e,user_id:t||er(),...n})}function CL(e){Jn({event:"cost_seg_estimate_generated",user_id:er(),address:e.address,property_type:e.propertyType,estimated_value:e.estimatedValue,total_savings_midpoint:e.totalSavings
595Midpoint})}function n0(e){Jn({event:"cost_seg_data_edited",user_id:er(),field:e.field,estimate_id:e.estimateId})}function jL(e){Jn({event:"cost_seg_full_estimate_viewed",user_id:er(),estimate_id:e.estimateId,is_authenticated:e.isAuthenticated})}function TL(e){Jn({event:"cost_seg_partner_cta_clicked",user_id:er(),estimate_id:e.estimateId,partner_id:e.partnerId??"none"})}const h0e=Object.freeze(Object.defineProperty({__proto__:null,trackAIEnhanceDescriptionTimeEntryForm:zte,trackCostSegDataEdited:n0,trackCostSegEstimateGenerated:CL,trackCostSegFullEstimateViewed:jL,trackCostSegPartnerCtaClicked:TL,trackCustomEvent:Wte,trackExportButtonClicked:Ute,trackFileImportDataMappingSuccess:Hte,trackGA4Event:NL,trackImportButtonClicked:Bte,trackPropertyAdded:Vte,trackReportGenerated:Fte,trackStopwatchLogStarted:$te,trackTimeLogged:Lte,trackTrialStarted:Dte},Symbol.toStringTag,{value:"Module"}));var Ke=function(){return Ke=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ke.apply(this,arguments)};function qte(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function PL(e,t,n){for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function lh(e){return e.mode==="multiple"}function ch(e){return e.mode==="range"}function Bm(e){return e.mode==="single"}var Gte={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Kte(e,t){return Tr(e,"LLLL y",t)}function Yte(e,t){return Tr(e,"d",t)}function Qte(e,t){return Tr(e,"LLLL",t)}function Zte(e){return"".concat(e)}function Xte(e,t){return Tr(e,"cccccc",t)}function Jte(e,t){return Tr(e,"yyyy",t)}var ene=Object.freeze({__proto__:null,formatCaption:Kte,formatDay:Yte,formatMonthCaption:Qte,formatWeekNumber:Zte,formatWeekdayName:Xte,formatYearCaption:Jte}),tne=function(e,t,n){return Tr(e,"do MMMM (EEEE)",n)},nne=function(){return"Month: "},rne=function(){return"Go to next month"},sne=function(){return"Go to previous month"},ine=function(e,t){return Tr(e,"cccc",t)},one=function(e){return"Week n. ".concat(e)},ane=function(){return"Year: "},lne=Object.freeze({__proto__:null,labelDay:tne,labelMonthDropdown:nne,labelNext:rne,labelPrevious:sne,labelWeekNumber:one,labelWeekday:ine,labelYearDropdown:ane});function cne(){var e="buttons",t=Gte,n=LO,r={},s={},i=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:ene,labels:lne,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:l,mode:"default"}}function une(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,s=e.toMonth,i=e.fromDate,o=e.toDate;return r?i=lr(r):t&&(i=new Date(t,0,1)),s?o=Ww(s):n&&(o=new Date(n,11,31)),{fromDate:i?ac(i):void 0,toDate:o?ac(o):void 0}}var AL=m.createContext(void 0);function dne(e){var t,n=e.initialProps,r=cne(),s=une(n),i=s.fromDate,o=s.toDate,l=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(Bm(n)||lh(n)||ch(n))&&(c=n.onSelect);var u=Ke(Ke(Ke({},r),n),{captionLayout:l,classNames:Ke(Ke({},r.classNames),n.classNames),components:Ke({}
595,n.components),formatters:Ke(Ke({},r.formatters),n.formatters),fromDate:i,labels:Ke(Ke({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Ke(Ke({},r.modifiers),n.modifiers),modifiersClassNames:Ke(Ke({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:Ke(Ke({},r.styles),n.styles),toDate:o});return a.jsx(AL.Provider,{value:u,children:e.children})}function Ft(){var e=m.useContext(AL);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function IL(e){var t=Ft(),n=t.locale,r=t.classNames,s=t.styles,i=t.formatters.formatCaption;return a.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function hne(e){return a.jsx("svg",Ke({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:a.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function RL(e){var t,n,r=e.onChange,s=e.value,i=e.children,o=e.caption,l=e.className,c=e.style,u=Ft(),d=(n=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:hne;return a.jsxs("div",{className:l,style:c,children:[a.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),a.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:s,onChange:r,children:i}),a.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,a.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function fne(e){var t,n=Ft(),r=n.fromDate,s=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,u=n.components,d=n.labels.labelMonthDropdown;if(!r)return a.jsx(a.Fragment,{});if(!s)return a.jsx(a.Fragment,{});var h=[];if(WX(r,s))for(var f=lr(r),p=r.getMonth();p<=s.getMonth();p++)h.push(Nv(f,p));else for(var f=lr(new Date),p=0;p<=11;p++)h.push(Nv(f,p));var g=function(y){var x=Number(y.target.value),b=Nv(lr(e.displayMonth),x);e.onChange(b)},v=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:RL;return a.jsx(v,{name:"months","aria-label":d(),className:c.dropdown_month,style:i.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:h.map(function(y){return a.jsx("option",{value:y.getMonth(),children:l(y,{locale:o})},y.getMonth())})})}function pne(e){var t,n=e.displayMonth,r=Ft(),s=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,c=r.classNames,u=r.components,d=r.formatters.formatYearCaption,h=r.labels.labelYearDropdown,f=[];if(!s)return a.jsx(a.Fragment,{});if(!i)return a.jsx(a.Fragment,{});for(var p=s.getFullYear(),g=i.getFullYear(),v=p;v<=g;v++)f.push(VN(OO(new Date),v));var y=function(b){var w=VN(lr(n),Number(b.target.value));e.onChange(w)},x=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:RL;return a.jsx(x,{name:"years","aria-label":h(),className:c.dropdown_year,style:l.dropdown_year,onChange:y,value:n.getFullYear(),caption:d(n,{locale:o}),children:f.map(function(b){return a.jsx("option",{value:b.getFullYear(),children:d(b,{locale:o})},b.getFullYear())})})}function mne(e,t){var n=m.useState(e),r=n[0],s=n[1],i=t===void 0?r:t;return[i,s]}function gne(e){var t=e.month,n=e.defaultMonth,r=e.today,s=t||n||r||new Date,i=e.toDate,o=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(i&&wd(i,s)<0){var u=-1*(c-1);s=is(i,u)}return o&&wd(s,o)<0&&(s=o),lr(s)}function vne(){var e=Ft(),t=gne(e),n=mne(t,e.month),r=n[0],s=n[1],i=function(o){var l;if(!e.disableNavigation){var c=lr(o);s(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[r,i]}function yne(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,s=lr(e),i=lr(is(s,r)),o=wd(i,s),l=[],c=0;c<o;c++){var u=is(s,c);l.push(u)}return n&&(l=l.reverse()),l}function xne(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,s=t.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=lr(e);if(!n)return is(l,o);var c=wd(n,e);if(!(c<i))return is(l,o)}}function bne(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,s=t.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=lr(e);if(!n)return is(l,-o);var c=wd(l,n);if(!(c<=0))return is(l,-o)}}var ML=m.createContext(void 0);function wne(e){var t=Ft(),n=vne(),r=n[0],s=n[1],i=yne(r,t),o=xne(r,t),l=bne(r,t),c=function(h){return i.some(function(f){return Gw(h,f)})},u=function(h,f){c(h)||(f&&UO(h,f)?s(is(h,1+t.numberOfMonths*-1)):s(h))},d={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:u,previousMonth:l,nextMonth:o,isDateDisplayed:c};return a.jsx(ML.Provider,{value:d,children:e.children})}function uh(){var e=m.useContext(ML);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function ZN(e){var t,n=Ft(),r=n.classNames,s=n.styles,i=n.components,o=uh().goToMonth,l=function(d){o(is(d,e.displayIndex?-e.dis
595playIndex:0))},c=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:IL,u=a.jsx(c,{id:e.id,displayMonth:e.displayMonth});return a.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[a.jsx("div",{className:r.vhidden,children:u}),a.jsx(fne,{onChange:l,displayMonth:e.displayMonth}),a.jsx(pne,{onChange:l,displayMonth:e.displayMonth})]})}function _ne(e){return a.jsx("svg",Ke({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:a.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function kne(e){return a.jsx("svg",Ke({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:a.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var yp=m.forwardRef(function(e,t){var n=Ft(),r=n.classNames,s=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var o=i.join(" "),l=Ke(Ke({},s.button_reset),s.button);return e.style&&Object.assign(l,e.style),a.jsx("button",Ke({},e,{ref:t,type:"button",className:o,style:l}))});function Sne(e){var t,n,r=Ft(),s=r.dir,i=r.locale,o=r.classNames,l=r.styles,c=r.labels,u=c.labelPrevious,d=c.labelNext,h=r.components;if(!e.nextMonth&&!e.previousMonth)return a.jsx(a.Fragment,{});var f=u(e.previousMonth,{locale:i}),p=[o.nav_button,o.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:i}),v=[o.nav_button,o.nav_button_next].join(" "),y=(t=h==null?void 0:h.IconRight)!==null&&t!==void 0?t:kne,x=(n=h==null?void 0:h.IconLeft)!==null&&n!==void 0?n:_ne;return a.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&a.jsx(yp,{name:"previous-month","aria-label":f,className:p,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:s==="rtl"?a.jsx(y,{className:o.nav_icon,style:l.nav_icon}):a.jsx(x,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&a.jsx(yp,{name:"next-month","aria-label":g,className:v,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:s==="rtl"?a.jsx(x,{className:o.nav_icon,style:l.nav_icon}):a.jsx(y,{className:o.nav_icon,style:l.nav_icon})})]})}function XN(e){var t=Ft().numberOfMonths,n=uh(),r=n.previousMonth,s=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(g){return Gw(e.displayMonth,g)}),c=l===0,u=l===o.length-1,d=t>1&&(c||!u),h=t>1&&(u||!c),f=function(){r&&i(r)},p=function(){s&&i(s)};return a.jsx(Sne,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:h,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:p})}function Ene(e){var t,n=Ft(),r=n.classNames,s=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:IL,u;return s?u=a.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=a.jsx(ZN,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=a.jsxs(a.Fragment,{children:[a.jsx(ZN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),a.jsx(XN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=a.jsxs(a.Fragment,{children:[a.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),a.jsx(XN,{displayMonth:e.displayMonth,id:e.id})]}),a.jsx("div",{className:r.caption,style:i.caption,children:u})}function Nne(e){var t=Ft(),n=t.footer,r=t.styles,s=t.classNames.tfoot;return n?a.jsx("tfoot",{className:s,style:r.tfoot,children:a.jsx("tr",{children:a.jsx("td",{colSpan:8,children:n})})}):a.jsx(a.Fragment,{})}function Cne(e,t,n){for(var r=n?Sa(new Date):Fs(new Date,{locale:e,weekStartsOn:t}),s=[],i=0;i<7;
595i++){var o=zn(r,i);s.push(o)}return s}function jne(){var e=Ft(),t=e.classNames,n=e.styles,r=e.showWeekNumber,s=e.locale,i=e.weekStartsOn,o=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=Cne(s,i,o);return a.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&a.jsx("td",{style:n.head_cell,className:t.head_cell}),u.map(function(d,h){return a.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":c(d,{locale:s}),children:l(d,{locale:s})},h)})]})}function Tne(){var e,t=Ft(),n=t.classNames,r=t.styles,s=t.components,i=(e=s==null?void 0:s.HeadRow)!==null&&e!==void 0?e:jne;return a.jsx("thead",{style:r.head,className:n.head,children:a.jsx(i,{})})}function Pne(e){var t=Ft(),n=t.locale,r=t.formatters.formatDay;return a.jsx(a.Fragment,{children:r(e.date,{locale:n})})}var x_=m.createContext(void 0);function Ane(e){if(!lh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return a.jsx(x_.Provider,{value:t,children:e.children})}return a.jsx(Ine,{initialProps:e.initialProps,children:e.children})}function Ine(e){var t=e.initialProps,n=e.children,r=t.selected,s=t.min,i=t.max,o=function(u,d,h){var f,p;(f=t.onDayClick)===null||f===void 0||f.call(t,u,d,h);var g=!!(d.selected&&s&&(r==null?void 0:r.length)===s);if(!g){var v=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var y=r?PL([],r):[];if(d.selected){var x=y.findIndex(function(b){return Dn(u,b)});
595y.splice(x,1)}else y.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,y,u,d,h)}}},l={disabled:[]};r&&l.disabled.push(function(u){var d=i&&r.length>i-1,h=r.some(function(f){return Dn(f,u)});return!!(d&&!h)});var c={selected:r,onDayClick:o,modifiers:l};return a.jsx(x_.Provider,{value:c,children:n})}function b_(){var e=m.useContext(x_);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Rne(e,t){var n=t||{},r=n.from,s=n.to;return r&&s?Dn(s,e)&&Dn(r,e)?void 0:Dn(s,e)?{from:s,to:void 0}:Dn(r,e)?void 0:qx(r,e)?{from:e,to:s}:{from:r,to:e}:s?qx(e,s)?{from:s,to:e}:{from:e,to:s}:r?UO(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var w_=m.createContext(void 0);function Mne(e){if(!ch(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return a.jsx(w_.Provider,{value:t,children:e.children})}return a.jsx(One,{initialProps:e.initialProps,children:e.children})}function One(e){var t=e.initialProps,n=e.children,r=t.selected,s=r||{},i=s.from,o=s.to,l=t.min,c=t.max,u=function(p,g,v){var y,x;(y=t.onDayClick)===null||y===void 0||y.call(t,p,g,v);var b=Rne(p,r);(x=t.onSelect)===null||x===void 0||x.call(t,b,p,g,v)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],Dn(i,o)||(d.range_middle=[{after:i,before:o}])):d.range_end=[i]):o&&(d.range_start=[o],d.range_end=[o]),l&&(i&&!o&&d.disabled.push({after:vf(i,l-1),before:zn(i,l-1)}),i&&o&&d.disabled.push({after:i,before:zn(i,l-1)}),!i&&o&&d.disabled.push({after:vf(o,l-1),before:zn(o,l-1)})),c){if(i&&!o&&(d.disabled.push({before:zn(i,-c+1)}),d.disabled.push({after:zn(i,c-1)})),i&&o){var h=$r(o,i)+1,f=c-h;d.disabled.push({before:vf(i,f)}),d.disabled.push({after:zn(o,f)})}!i&&o&&(d.disabled.push({before:zn(o,-c+1)}),d.disabled.push({after:zn(o,c-1)}))}return a.jsx(w_.Provider,{value:{selected:r,onDayClick:u,modifiers:d},children:n})}function __(){var e=m.useContext(w_);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function bf(e){return Array.isArray(e)?PL([],e):e!==void 0?[e]:[]}function Dne(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],s=n[1];t[r]=bf(s)}),t}var cs;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(cs||(cs={}));var Lne=cs.Selected,Ys=cs.Disabled,Fne=cs.Hidden,$ne=cs.Today,Iv=cs.RangeEnd,Rv=cs.RangeMiddle,Mv=cs.RangeStart,Vne=cs.Outside;function Bne(e,t,n){var r,s=(r={},r[Lne]=bf(e.selected),r[Ys]=bf(e.disabled),r[Fne]=bf(e.hidden),r[$ne]=[e.today],r[Iv]=[],r[Rv]=[],r[Mv]=[],r[Vne]=[],r);return e.fromDate&&s[Ys].push({before:e.fromDate}),e.toDate&&s[Ys].push({after:e.toDate}),lh(e)?s[Ys]=s[Ys].concat(t.modifiers[Ys]):ch(e)&&(s[Ys]=s[Ys].concat(n.modifiers[Ys]),s[Mv]=n.modifiers[Mv],s[Rv]=n.modifiers[Rv],s[Iv]=n.modifiers[Iv]),s}var OL=m.createContext(void 0);function Une(e){var t=Ft(),n=b_(),r=__(),s=Bne(t,n,r),i=Dne(t.modifiers),o=Ke(Ke({},s),i);return a.jsx(OL.Provider,{value:o,children:e.children})}function DL(){var e=m.useContext(OL);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function zne(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Hne(e){return!!(e&&typeof e=="object"&&"from"in e)}function Wne(e){return!!(e&&typeof e=="object"&&"after"in e)}function qne(e){return!!(e&&typeof e=="object"&&"before"in e)}function Gne(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Kne(e,t){var n,r=t.from,s=t.to;if(r&&s){var i=$r(s,r)<0;i&&(n=[s,r],r=n[0],s=n[1]);var o=$r(e,r)>=0&&$r(s,e)>=0;return o}return s?Dn(s,e):r?Dn(r,e):!1}function Yne(e){return Hw(e)}function Qne(e){return Array.isArray(e)&&e.every(Hw)}function Zne(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(Yne(n))return Dn(e,n);if(Qne(n))return n.includes(e);if(Hne(n))return Kne(e,n);if(Gne(n))return n.dayOfWeek.includes(e.getDay());if(zne(n)){var r=$r(n.before,e),s=$r(n.after,e),i=r>0,o=s<0,l=qx(n.before,n.after);return l?o&&i:i||o}return Wne(n)?$r(e,n.after)>0:qne(n)?$r(n.before,e)>0:typeof n=="function"?n(e):!1})}function k_(e,t,n){var r=Object.keys(t).reduce(function(i,o){var l=t[o];return Zne(e,l)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),n&&!Gw(e,n)&&(s.outside=!0),s}function Xne(e,t){for(var n=lr(e[0]),r=Ww(e[e.length-1]),s,i,o=n;o<=r;){var l=k_(o,t),c=!l.disabled&&!l.hidden;if(!c){o=zn(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),s||(s=o),o=zn(o,1)}return i||s}var Jne=365;function LL(e,t){var n=t.moveBy,r=t.direction,s=t.context,i=t.modifiers,o=t.retry,l=o===void 0?{count:0,lastFocused:e}:o,c=s.weekStartsOn,u=s.fromDate,d=s.toDate,h=s.locale,f={day:zn,week:Wx,month:is,year:BZ,startOfWeek:function(y){return s.ISOWeek?Sa(y):Fs(y,{locale:h,weekStartsOn:c})},endOfWeek:function(y){return s.ISOWeek?DO(y):qw(y,{locale:h,weekStartsOn:c})}},p=f[n](e,r==="after"?1:-1);r==="before"&&u?p=UZ([u,p]):r==="after"&&d&&(p=zZ([d,p]));var g=!0;if(i){var v=k_(p,i);g=!v.disabled&&!v.hidden}return g?p:l.count>Jne?l.lastFocused:LL(p,{moveBy:n,direction:r,context:s,modifiers:i,retry:Ke(Ke({},l),{count:l.count+1})})}var FL=m.createContext(void 0);function ere(e){var t=uh(),n=DL(),r=m.useState(),s=r[0],i=r[1],o=m.useState(),l=o[0],c=o[1],u=Xne(t.displayMonths,n),d=s??(l&&t.isDateDisplayed(l))?l:u,h=function(){c(s),i(void 0)},f=function(y){i(y)},p=Ft(),g=function(y,x){if(s){var b=LL(s,{moveBy:y,direction:x,context:p,modifiers:n});Dn(s,b)||(t.goToDate(b,s),f(b))}},v={focusedDay:s,focusTarget:d,blur:h,focus:f,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return a.jsx(FL.Provider,{value:v,children:e.children})}function S_(){var e=m.useContext(FL);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function tre(e,t){var n=DL(),r=k_(e,n,t);return r}var E_=m.createContext(void 0);function nre(e){if(!Bm(e.initialProps)){var t={selected:void 0};return a.jsx(E_.Provider,{value:t,children:e.children})}return a.jsx(rre,{initialProps:e.initialProps,children:e.children})}function rre(e){var t=e.initialProps,n=e.children,r=function(i,o,l){var c,u,d;
595if((c=t.onDayClick)===null||c===void 0||c.call(t,i,o,l),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,i,o,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,i,i,o,l)},s={selected:t.selected,onDayClick:r};return a.jsx(E_.Provider,{value:s,children:n})}function $L(){var e=m.useContext(E_);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function sre(e,t){var n=Ft(),r=$L(),s=b_(),i=__(),o=S_(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,h=o.blur,f=o.focus,p=o.focusMonthBefore,g=o.focusMonthAfter,v=o.focusYearBefore,y=o.focusYearAfter,x=o.focusStartOfWeek,b=o.focusEndOfWeek,w=function(j){var P,D,C,H;Bm(n)?(P=r.onDayClick)===null||P===void 0||P.call(r,e,t,j):lh(n)?(D=s.onDayClick)===null||D===void 0||D.call(s,e,t,j):ch(n)?(C=i.onDayClick)===null||C===void 0||C.call(i,e,t,j):(H=n.onDayClick)===null||H===void 0||H.call(n,e,t,j)},S=function(j){var P;f(e),(P=n.onDayFocus)===null||P===void 0||P.call(n,e,t,j)},_=function(j){var P;h(),(P=n.onDayBlur)===null||P===void 0||P.call(n,e,t,j)},E=function(j){var P;(P=n.onDayMouseEnter)===null||P===void 0||P.call(n,e,t,j)},R=function(j){var P;(P=n.onDayMouseLeave)===null||P===void 0||P.call(n,e,t,j)},A=function(j){var P;(P=n.onDayPointerEnter)===null||P===void 0||P.call(n,e,t,j)},N=function(j){var P;(P=n.onDayPointerLeave)===null||P===void 0||P.call(n,e,t,j)},k=function(j){var P;(P=n.onDayTouchCancel)===null||P===void 0||P.call(n,e,t,j)},T=function(j){var P;(P=n.onDayTouchEnd)===null||P===void 0||P.call(n,e,t,j)},I=function(j){var P;(P=n.onDayTouchMove)===null||P===void 0||P.call(n,e,t,j)},F=function(j){var P;(P=n.onDayTouchStart)===null||P===void 0||P.call(n,e,t,j)},L=function(j){var P;(P=n.onDayKeyUp)===null||P===void 0||P.call(n,e,t,j)},M=function(j){var P;switch(j.key){case"ArrowLeft":j.preventDefault(),j.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":j.preventDefault(),j.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":j.preventDefault(),j.stopPropagation(),u();break;case"ArrowUp":j.preventDefault(),j.stopPropagation(),d();break;case"PageUp":j.preventDefault(),j.stopPropagation(),j.shiftKey?v():p();break;case"PageDown":j.preventDefault(),j.stopPropagation(),j.shiftKey?y():g();break;case"Home":j.preventDefault(),j.stopPropagation(),x();break;case"End":j.preventDefault(),j.stopPropagation(),b();break}(P=n.onDayKeyDown)===null||P===void 0||P.call(n,e,t,j)},$={onClick:w,onFocus:S,onBlur:_,onKeyDown:M,onKeyUp:L,onMouseEnter:E,onMouseLeave:R,onPointerEnter:A,onPointerLeave:N,onTouchCancel:k,onTouchEnd:T,onTouchMove:I,onTouchStart:F};return $}function ire(){var e=Ft(),t=$L(),n=b_(),r=__(),s=Bm(e)?t.selected:lh(e)?n.selected:ch(e)?r.selected:void 0;return s}function ore(e){return Object.values(cs).includes(e)}function are(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var s=e.modifiersClassNames[r];if(s)n.push(s);else if(ore(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function lre(e,t){var n=Ke({},e.styles.day);return Object.keys(t).forEach(function(r){var s;n=Ke(Ke({},n),(s=e.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function cre(e,t,n){var r,s,i,o=Ft(),l=S_(),c=tre(e,t),u=sre(e,c),d=ire(),h=!!(o.onDayCl
595ick||o.mode!=="default");m.useEffect(function(){var E;c.outside||l.focusedDay&&h&&Dn(l.focusedDay,e)&&((E=n.current)===null||E===void 0||E.focus())},[l.focusedDay,e,n,h,c.outside]);var f=are(o,c).join(" "),p=lre(o,c),g=!!(c.outside&&!o.showOutsideDays||c.hidden),v=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:Pne,y=a.jsx(v,{date:e,displayMonth:t,activeModifiers:c}),x={style:p,className:f,children:y,role:"gridcell"},b=l.focusTarget&&Dn(l.focusTarget,e)&&!c.outside,w=l.focusedDay&&Dn(l.focusedDay,e),S=Ke(Ke(Ke({},x),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=w||b?0:-1,r)),u),_={isButton:h,isHidden:g,activeModifiers:c,selectedDays:d,buttonProps:S,divProps:x};return _}function ure(e){var t=m.useRef(null),n=cre(e.date,e.displayMonth,t);return n.isHidden?a.jsx("div",{role:"gridcell"}):n.isButton?a.jsx(yp,Ke({name:"day",ref:t},n.buttonProps)):a.jsx("div",Ke({},n.divProps))}function dre(e){var t=e.number,n=e.dates,r=Ft(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,u=r.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!s)return a.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var h=c(Number(t),{locale:l}),f=function(p){s(t,n,p)};return a.jsx(yp,{name:"week-number","aria-label":h,className:o.weeknumber,style:i.weeknumber,onClick:f,children:d})}function hre(e){var t,n,r=Ft(),s=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:ure,u=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:dre,d;return o&&(d=a.jsx("td",{className:i.cell,style:s.cell,children:a.jsx(u,{number:e.weekNumber,dates:e.dates})})),a.jsxs("tr",{className:i.row,style:s.row,children:[d,e.dates.map(function(h){return a.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:a.jsx(c,{displayMonth:e.displayMonth,date:h})},UX(h))})]})}function JN(e,t,n){for(var r=n!=null&&n.ISOWeek?DO(t):qw(t,n),s=n!=null&&n.ISOWeek?Sa(e):Fs(e,n),i=$r(r,s),o=[],l=0;l<=i;l++)o.push(zn(s,l));var c=o.reduce(function(u,d){var h=n!=null&&n.ISOWeek?FO(d):VO(d,n),f=u.find(function(p){return p.weekNumber===h});return f?(f.dates.push(d),u):(u.push({weekNumber:h,dates:[d]}),u)},[]);return c}function fre(e,t){var n=JN(lr(e),Ww(e),t);if(t!=null&&t.useFixedWeeks){var r=HX(e,t);if(r<6){var s=n[n.length-1],i=s.dates[s.dates.length-1],o=Wx(i,6-r),l=JN(Wx(i,1),o,t);n.push.apply(n,l)}}return n}function pre(e){var t,n,r,s=Ft(),i=s.locale,o=s.classNames,l=s.styles,c=s.hideHead,u=s.fixedWeeks,d=s.components,h=s.weekStartsOn,f=s.firstWeekContainsDate,p=s.ISOWeek,g=fre(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:i,weekStartsOn:h,firstWeekContainsDate:f}),v=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:Tne,y=(n=d==null?void 0:d.Row)!==null&&n!==void 0?n:hre,x=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:Nne;return a.jsxs("table",{id:e.id,className:o.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&a.jsx(v,{}),a.jsx("tbody",{className:o.tbody,style:l.tbody,children:g.map(function(b){return a.jsx(y,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),a.jsx(x,{displayMonth:e.displayMonth})]})}function mre(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var gre=mre()?m.useLayoutEffect:m.useEffect,Ov=!1,vre=0;function eC(){return"react-day-picker-".concat(++vre)}function yre(e){var t,n=e??(Ov?eC():null),r=m.useState(n),s=r[0],i=r[1];return gre(function(){s===null&&i(eC())},[]),m.useEffect(function(){Ov===!1&&(Ov=!0)},[]),(t=e??s)!==null&&t!==void 0?t:void 0}function xre(e){var t,n,r=Ft(),s=r.dir,i=r.classNames,o=r.styles,l=r.components,c=uh().displayMonths,u=yre(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,h=[i.month],f=o.month,p=e.displayIndex===0,g=e.displayIndex===c.length-1,v=!p&&!g;s==="rtl"&&(t=[p,g],g=t[0],p=t[1]),p&&(h.push(i.caption_start),f=Ke(Ke({},f),o.caption_start)),g&&(h.push(i.caption_end),f=Ke(Ke({},f),o.caption_end)),v&&(h.push(i.caption_between),f=Ke(Ke({},f),o.caption_between));var y=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:Ene;return a.jsxs("div",{className:h.join(" "),style:f,children:[a.jsx(y,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),a.jsx(pre,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function bre(e){var t=Ft(),n=t.classNames,r=t.styles;return a.jsx("div",{className:n.months,style:r.months,children:e.children})}function wre(e){var t,n,r=e.initialProps,s=Ft(),i=S_(),o=uh(),l=m.useState(!1),c=l[0],u=l[1];m.useEffect(function(){s.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),u(!0)))},[s.initialFocus,c,i.focus,i.focusTarget,i]);var d=[s.classNames.root,s.className];s.numberOfMonths>1&&d.push(s.classNames.multiple_months),s.showWeekNumber&&d.push(s.classNames.with_weeknumber);var h=Ke(Ke({},s.styles.root),s.style),f=Object.keys(r).filter(function(g){return g.startsWith("data-")}).reduce(function(g,v){var y;return Ke(Ke({},g),(y={},y[v]=r[v],y))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:bre;return a.jsx("div",Ke({className:d.join(" "),style:h,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:a.jsx(p,{children:o.displayMonths.map(function(g,v){return a.jsx(xre,{displayIndex:v,displayMonth:g},v)})})}))}function _re(e){var t=e.children,n=qte(e,["children"]);return a.jsx(dne,{initialProps:n,children:a.jsx(wne,{children:a.jsx(nre,{initialProps:n,children:a.jsx(Ane,{initialProps:n,children:a.jsx(Mne,{initialProps:n,children:a.jsx(Une,{children:a.jsx(ere,{children:t})})})})})})})}function kre(e){return a.jsx(_re,Ke({},e,{children:a.jsx(wre,{initialProps:e})}))}function Sre({className:e,classNames:t,showOutsideDays:n=!0,...r}){return a.jsx(kre,{showOutsideDays:n,className:q("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
595ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:q(cd({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:q(cd({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:s,...i})=>a.jsx(To,{className:q("h-4 w-4",s),...i}),IconRight:({className:s,...i})=>a.jsx(Ar,{className:q("h-4 w-4",s),...i})},...r})}Sre.displayName="Calendar";var VL="AlertDialog",[Ere]=yn(VL,[WD]),ji=WD(),BL=e=>{const{__scopeAlertDialog:t,...n}=e,r=ji(t);return a.jsx(rh,{...r,...n,modal:!0})};BL.displayName=VL;var Nre="AlertDialogTrigger",UL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=ji(n);return a.jsx(Fm,{...s,...r,ref:t})});UL.displayName=Nre;var Cre="AlertDialogPortal",zL=e=>{const{__scopeAlertDialog:t,...n}=e,r=ji(t);return a.jsx(sh,{...r,...n})};zL.displayName=Cre;var jre="AlertDialogOverlay",HL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=ji(n);return a.jsx(Ua,{...s,...r,ref:t})});HL.displayName=jre;var WL="AlertDialogContent",[Tre,Pre]=Ere(WL),qL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=ji(n),o=m.useRef(null),l=He(t,o),c=m.useRef(null);return a.jsx(Tre,{scope:n,cancelRef:c,children:a.jsx(za,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:he(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:r})})});qL.displayName=WL;var Are="AlertDialogTitle",GL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=ji(n);return a.jsx(Cc,{...s,...r,ref:t})});GL.displayName=Are;var Ire="AlertDialogDescription",KL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=ji(n);return a.jsx(jc,{...s,...r,ref:t})});KL.displayName=Ire;var Rre="AlertDialogAction",YL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=ji(n);return a.jsx(ih,{...s,...r,ref:t})});YL.displayName=Rre;var QL="AlertDialogCancel",ZL=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=Pre(QL,n),i=ji(n),o=He(t,s);return a.jsx(ih,{...i,...r,ref:o})});ZL.displayName=QL;var Mre=BL,Ore=UL,Dre=zL,XL=HL,JL=qL,eF=YL,tF=ZL,nF=GL,rF=KL;const Lre=Mre,f0e=Ore,Fre=Dre,sF=m.forwardRef(({className:e,...t},n)=>a.jsx(XL,{className:q("fixed inset-0 z-[10000] bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));sF.displayName=XL.displayName;const iF=m.forwardRef(({className:e,...t},n)=>a.jsxs(Fre,{children:[a.jsx(sF,{}),a.jsx(JL,{ref:n,className:q("fixed left-[50%] top-[50%] z-[10001] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
595nded-lg",e),...t})]}));iF.displayName=JL.displayName;const oF=({className:e,...t})=>a.jsx("div",{className:q("flex flex-col space-y-2 text-center sm:text-left",e),...t});oF.displayName="AlertDialogHeader";const aF=({className:e,...t})=>a.jsx("div",{className:q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});aF.displayName="AlertDialogFooter";const lF=m.forwardRef(({className:e,...t},n)=>a.jsx(nF,{ref:n,className:q("text-lg font-semibold",e),...t}));lF.displayName=nF.displayName;const cF=m.forwardRef(({className:e,...t},n)=>a.jsx(rF,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));cF.displayName=rF.displayName;const uF=m.forwardRef(({className:e,...t},n)=>a.jsx(eF,{ref:n,className:q(cd(),e),...t}));uF.displayName=eF.displayName;const dF=m.forwardRef(({className:e,...t},n)=>a.jsx(tF,{ref:n,className:q(cd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));dF.displayName=tF.displayName;function $re({onFilesSelected:e,maxFiles:t=5,acceptedFileTypes:n={"image/*":[".png",".jpg",".jpeg"],"application/pdf":[".pdf"]},className:r,initialFiles:s=[]}){const[i,o]=m.useState(!1),l=m.useRef(null),[c,u]=m.useState(s);m.useEffect(()=>{u(s)},[s]);const d=y=>{y.preventDefault(),y.stopPropagation(),y.type==="dragenter"||y.type==="dragover"?o(!0):y.type==="dragleave"&&o(!1)},h=y=>{y.preventDefault(),y.stopPropagation(),o(!1),y.dataTransfer.files&&y.dataTransfer.files.length>0&&f(Array.from(y.dataTransfer.files))},f=y=>{const x=[],b=Object.values(n).flat();if(y.forEach(w=>{var _;const S="."+((_=w.name.split(".").pop())==null?void 0:_.toLowerCase());b.includes(S)&&x.push(w)}),x.length>0){const S=[...c,...x].slice(0,t);u(S),e(S)}},p=y=>{y.target.files&&y.target.files.length>0&&f(Array.from(y.target.files)),l.current&&(l.current.value="")},g=y=>{const x=c.filter((b,w)=>w!==y);u(x),e(x)},v=()=>{var y;(y=l.current)==null||y.click()};return a.jsxs("div",{className:q("w-full space-y-3",r),children:[a.jsxs("div",{className:q("flex flex-col items-center justify-center px-6 py-8 border-2 border-dashed rounded-lg transition-colors cursor-pointer bg-gray-50/50 hover:bg-gray-50",i?"border-primary bg-primary/5":"border-gray-300 hover:border-primary/50"),onDragEnter:d,onDragLeave:d,onDragOver:d,onDrop:h,onClick:v,children:[a.jsx(fd,{className:"h-10 w-10 text-gray-400 mb-3"}),a.jsxs("div",{className:"text-sm text-center text-gray-600",children:[a.jsx("span",{className:"font-semibold text-primary hover:text-primary/80",children:"Click to upload"})," ","or drag and drop"]}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Supported formats:"," ",Object.values(n).flat().join(", ")]})]}),c.length>0&&a.jsx("div",{className:"space-y-2",children:c.map((y,x)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-white border border-gray-200 rounded-lg shadow-sm",children:[a.jsxs("div",{className:"flex items-center space-x-3 overflow-hidden",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-md",children:a.jsx(Nr,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 truncate",children:y.name}),a.jsxs("p",{className:"text-xs text-gray-500",children:[(y.size/1024).toFixed(1)," KB"]})]})]}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),g(x)},className:"text-gray-400 hover:text-red-500 hover:bg-red-50",children:a.jsx(vn,{className:"h-4 w-4"})})]},`${y.name}-${x}`))}),a.jsx("input",{ref:l,type:"file",className:"sr-only",multiple:!0,accept:Object.values(n).flat().join(","),onChange:p})]})}var Um="Tabs",[Vre]=yn(Um,[mm]),hF=mm(),[Bre,N_]=Vre(Um),fF=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Oa(l),[h,f]=cr({prop:r,onChange:s,defaultProp:i??"",caller:Um});return a.jsx(Bre,{scope:n,baseId:dn(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:c,children:a.jsx(we.div,{dir:d,"data-orientation":o,...u,ref:t})})});fF.displayName=Um;var pF="TabsList",mF=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=N_(pF,n),o=hF(n);return a.jsx($R,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(we.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});mF.displayName=pF;var gF="TabsTrigger",vF=m.forwardRef((e,t)=>
595{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=N_(gF,n),l=hF(n),c=bF(o.baseId,r),u=wF(o.baseId,r),d=r===o.value;return a.jsx(VR,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(we.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:he(e.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:he(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:he(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(r)})})})});vF.displayName=gF;var yF="TabsContent",xF=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,l=N_(yF,n),c=bF(l.baseId,r),u=wF(l.baseId,r),d=r===l.value,h=m.useRef(d);return m.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),a.jsx(hn,{present:s||d,children:({present:f})=>a.jsx(we.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});xF.displayName=yF;function bF(e,t){return`${e}-trigger-${t}`}function wF(e,t){return`${e}-content-${t}`}var Ure=fF,_F=mF,kF=vF,SF=xF;const p0e=Ure,zre=m.forwardRef(({className:e,...t},n)=>a.jsx(_F,{ref:n,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));zre.displayName=_F.displayName;const Hre=m.forwardRef(({className:e,...t},n)=>a.jsx(kF,{ref:n,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Hre.displayName=kF.displayName;const Wre=m.forwardRef(({className:e,...t},n)=>a.jsx(SF,{ref:n,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wre.displayName=SF.displayName;function EF({title:e,subtitle:t,onBack:n,rightAction:r}){return a.jsxs("header",{className:"flex items-center gap-3 py-3",children:[a.jsx(ie,{type:"button",variant:"ghost",size:"icon",onClick:n,className:"h-11 w-11 flex-shrink-0 rounded-full hover:bg-muted active:scale-95","aria-label":"Go back to dashboard",children:a.jsx(To,{className:"h-6 w-6"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h1",{className:"m-0 truncate text-xl font-bold tracking-tight text-gray-900 dark:text-white",children:e}),t&&a.jsx("p",{className:"truncate text-xs font-medium text-gray-500 dark:text-gray-400",title:t,children:t})]}),r&&a.jsx("div",{className:"flex-shrink-0",children:r})]})}function qre({onBack:e}){return a.jsx("div",{className:"min-h-screen bg-gray-50 pb-24 pt-3 dark:bg-background",children:a.jsxs("div",{className:"mx-auto flex w-full container-mobile flex-col gap-4",children:[a.jsx(EF,{title:"Team",subtitle:"Workspace members and access",onBack:e}),a.jsx("section",{className:"rounded-3xl border border-gray-100 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Ot,{className:"h-3 w-24 rounded-full"}),a.jsx(Ot,{className:"mt-3 h-7 w-44 rounded-xl"}),a.jsx(Ot,{className:"mt-3 h-4 w-full rounded-lg"}),a.jsx(Ot,{className:"mt-2 h-4 w-3/4 rounded-lg"})]}),a.jsx(Ot,{className:"h-12 w-12 rounded-2xl"})]})}),a.jsx("section",{className:"grid grid-cols-3 gap-2",children:[1,2,3].map(t=>a.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[a.jsx(Ot,{className:"h-6 w-14 rounded-full"}),a.jsx(Ot,{className:"mt-4 h-8 w-10 rounded-xl"})]},t))}),a.jsx("div",{className:"rounded-2xl bg-gray-200/70 p-1 dark:bg-gray-800/80",children:a.jsx("div",{className:"grid grid-cols-3 gap-1",children:[1,2,3].map(t=>a.jsx(Ot,{className:"h-10 rounded-xl"},t))})}),a.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>a.jsxs("div",{className:"rounded-3xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ot,{className:"h-12 w-12 rounded-2xl"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ot,{className:"h-5 w-36 rounded-lg"}),a.jsx(Ot,{className:"mt-2 h-3 w-52 rounded-lg"}),a.jsxs("div",{className:"mt-4 flex gap-2",children:[a.jsx(Ot,{className:"h-6 w-20 rounded-full"}),a.jsx(Ot,{className:"h-6 w-16 rounded-full"})]})]})]}),a.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[a.jsx(Ot,{className:"h-11 rounded-2xl"}),a.jsx(Ot,{className:"h-11 rounded-2xl"})]})]},t))})]})})}function Gre({onBack:e}){return a.jsx("div",{className:"min-h-screen bg-gray-50 pb-24 pt-3 dark:bg-background",children:a.jsxs("div",{className:"mx-auto flex w-full container-mobile flex-col gap-4",children:[a.jsx(EF,{title:"Settings",subtitle:"Manage your account",onBack:e}),a.jsx("section",{className:"rounded-3xl border border-gray-100 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx(Ot,{className:"h-20 w-20 rounded-full"}),a.jsx(Ot,{className:"mt-4 h-6 w-40 rounded-xl"}),a.jsx(Ot,{className:"mt-2 h-4 w-56 rounded-lg"})]})}),a.jsx("section",{className:"space-y-3",children:[1,2,3,4].map(t=>a.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ot,{className:"h-10 w-10 rounded-xl"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ot,{className:"h-4 w-32 rounded-lg"}),a.jsx(Ot,{className:"mt-1.5 h-3 w-48 rounded-lg"})]}),a.jsx(Ot,{className:"h-5 w-5 rounded"})]})},t))}),a.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[a.jsx(Ot,{className:"h-4 w-28 rounded-lg"}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsx(Ot,{className:"h-3 w-full rounded-lg"}),a.jsx(Ot,{className:"h-3 w-4/5 rounded-lg"}),a.jsx(Ot,{className:"h-3 w-3/5 rounded-lg"})]})]})]})})}const Kre=m.lazy(()=>ve(()=>import("./dashboard-C0hhBF8c.js"),__vite__mapDeps([90,1,91,92,93,78,7,94,43,10,95,96,97,98,76,77,79,99,100,101,102,103,104,105,106,107,108,6,83,109]))),Yre=m.lazy(()=>ve(()=>import("./mobile-dashboard-calendar-BfM5YGIH.js"),__vite__mapDeps([110,1,101,102,92,93,78,7,94,43,10,99,103]))),Qre=m.lazy(()=>ve(()=>import("./mobile-dashboard-mail-giqHvrEA.js"),__vite__mapDeps([111,1,98,78,94,43,76,77,79,97,96,99,10,100]
595))),Zre=m.lazy(()=>ve(()=>import("./mobile-sync-settings-Cf6Iq4yL.js"),__vite__mapDeps([112,1,109,77,78,79]))),Xre=m.lazy(()=>ve(()=>import("./files-BeCv8a7K.js"),__vite__mapDeps([113,1,114,84,115,50,83,43,116,11]))),Jre=m.lazy(()=>ve(()=>import("./file-history-zy9TPtNn.js"),__vite__mapDeps([117,1,118,43]))),ese=m.lazy(()=>ve(()=>import("./super-admin-DsEb7_e5.js"),__vite__mapDeps([119,1,120,56,108,10,121,122,105,103,43,99,21,123,6,39,40,124,11,79,66,31,25,26,89,125]))),tse=m.lazy(()=>ve(()=>import("./organization-admin-XhFMe27z.js"),__vite__mapDeps([126,1,95]))),nse=m.lazy(()=>ve(()=>import("./analytics-DZfAxZm8.js"),__vite__mapDeps([127,1,91,11,39,124,40,48]))),rse=m.lazy(()=>ve(()=>import("./properties-new-BCkoiK3W.js"),__vite__mapDeps([128,1,129,130,14]))),sse=m.lazy(()=>ve(()=>import("./PropertyDetailPage-C5mhyUfM.js"),__vite__mapDeps([131,1,129,130]))),ise=m.lazy(()=>ve(()=>import("./activity-ledger-enhanced-zmIdZqQG.js"),__vite__mapDeps([132,1,99,45,118,103,107,114,84,115,50,83,43,5,85]))),ose=m.lazy(()=>ve(()=>import("./team-BYOL3eP8.js"),__vite__mapDeps([133,1,99,71,33,93,23]))),ase=m.lazy(()=>ve(()=>import("./automation-mhZxDjX1.js"),__vite__mapDeps([134,1,96,97,99,125]))),lse=m.lazy(()=>ve(()=>import("./rules-management-CuTKPrt9.js"),__vite__mapDeps([135,1,136,78,6,71]))),cse=m.lazy(()=>ve(()=>import("./rules-management-test-B4ffN99y.js"),__vite__mapDeps([137,1,136,78,6,71]))),use=m.lazy(()=>ve(()=>import("./RulesManagementSimplified-Y5US3rNH.js"),__vite__mapDeps([138,1,99,97,125]))),dse=m.lazy(()=>ve(()=>import("./TestCalendar-BoXQfkDv.js"),__vite__mapDeps([139,1,102,99,92,93,78,7,94,43,10,103,116])).then(e=>({default:e.TestCalendar}))),hse=m.lazy(()=>ve(()=>import("./test-dashboard-0jowPzQU.js"),__vite__mapDeps([140,1,78,100,102,99,116,103,104,11,123]))),fse=m.lazy(()=>ve(()=>import("./affiliate-dashboard-CfSbolsf.js"),__vite__mapDeps([141,1,33,21]))),pse=m.lazy(()=>ve(()=>import("./affiliate-settings-Dn90sCnG.js"),__vite__mapDeps([142,1,6,121]))),mse=m.lazy(()=>ve(()=>import("./test-fixes-BFb1bUgW.js"),__vite__mapDeps([143,1,43]))),gse=m.lazy(()=>ve(()=>import("./file-preview-demo-BhyjUpDO.js"),__vite__mapDeps([144,1,84,115,50,83]))),vse=m.lazy(()=>ve(()=>import("./AcceptInvitePage-DoLwZuFU.js"),__vite__mapDeps([64,1]))),yse=m.lazy(()=>ve(()=>import("./settings-CnyRVw3g.js"),__vite__mapDeps([145,1,45,11,99,23,88,89,122]))),xse=m.lazy(()=>ve(()=>import("./manage-subscription-CfEBFgen.js"),__vite__mapDeps([146,1,106,105]))),bse=m.lazy(()=>ve(()=>import("./welcome-tour-DT1Afc98.js"),__vite__mapDeps([147,1]))),wse=m.lazy(()=>ve(()=>import("./BlogAdminPage-BlfTy_uY.js"),__vite__mapDeps([120,1,56,108,10,121,122,105])));function _se(){const[e,t]=Pt(),n=Io(),r=()=>{t("/dashboard"),wo("/dashboard")};if(n){if(e==="/dashboard")return a.jsx(nD,{});if(e==="/activity-ledger")return a.jsx(rD,{});if(e==="/properties")return a.jsx(sD,{});if(e==="/files")return a.jsx(iD,{});if(e==="/team")return a.jsx(qre,{onBack:r});if(e==="/settings")return a.jsx(Gre,{onBack:r})}else return a.jsx("div",{className:"min-h-screen"})}function kse(){const{isAdmin:e,user:t}=Wt();return a.jsx(m.Suspense,{fallback:a.jsx(_se,{}),children:a.jsxs(Nf,{children:[a.jsx(it,{path:"/dashboard/calendar",component:Yre}),a.jsx(it,{path:"/dashboard/mail",component:Qre}),a.jsx(it,{path:"/dashboard/sync-settings",component:Zre}),a.jsx(it,{path:"/dashboard",component:Kre}),a.jsx(it,{path:"/test-dashboard",component:hse}),a.jsx(it,{path:"/properties",component:rse}),a.jsx(it,{path:"/properties/:id",component:sse}),a.jsx(it,{path:"/activity-ledger",component:ise}),a.jsx(it,{path:"/analytics",children:a.jsx(Fy,{children:a.jsx(nse,{})})}),a.jsx(it,{path:"/files",component:Xre}),a.jsx(it,{path:"/file-history",component:Jre}),a.jsx(it,{path:"/team",component:ose}),a.jsx(it,{path:"/accept-invite/:token",component:vse}),a.jsx(it,{path:"/settings",component:yse}),a.jsx(it,{path:"/automation",component:ase}),a.jsx(it,{path:"/rules-management",component:lse}),a.jsx(it,{path:"/rules-management-test",component:cse}),a.jsx(it,{path:"/rules-simplified",component:use}),a.jsx(it,{path:"/manage-subscription",component:xse}),a.jsx(it,{path:"/affiliate/dashboard",component:fse}),((t==null?void 0:t.role)==="org_admin"||(t==null?void 0:t.role)==="super_admin")&&a.jsx(it,{path:"/organization-admin",component:tse}),e&&a.jsx(it,{path:"/super-admin",component:ese}),e&&a.jsx(it,{path:"/super-admin/affiliate-settings",component:pse}),e&&a.jsx(it,{path:"/admin/blog",component:wse}),a.jsx(it,{path:"/test-fixes",component:mse}),a.jsx(it,{path:"/test-analytics",component:m.lazy(()=>ve(()=>import("./test-analytics-B3fyExw1.js"),__vite__mapDeps([148,1])))}),a.jsx(it,{path:"/test-calendar",component:dse}),a.jsx(it,{path:"/file-preview-demo",component:gse}),a.jsx(it,{path:"/onboarding",children:()=>null}),a.jsx(it,{path:"/welcome-tour",component:bse}),a.jsx(it,{component:()=>Ye()?a.jsx(du,{to:"/dashboard"}):a.jsx(uR,{})})]})})}const Sse=m.lazy(()=>ve(()=>import("./AgenticOnboarding-O2_iyJeC.js"),__vite__mapDeps([75,1,76,77,78,79,10,33])));function tC(){return a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-primary border-t-transparent roun
595ded-full"})})}function Ese({userData:e,isUserDataLoading:t,location:n}){const[r]=Pt(),s=n??r;return t||!e?a.jsx(it,{path:"/onboarding",children:()=>a.jsx(tC,{})}):e.hasCompletedOnboardingForm===!0?(s==="/onboarding"&&window.location.replace("/dashboard"),null):a.jsx(it,{path:"/onboarding",children:()=>a.jsx(m.Suspense,{fallback:a.jsx(tC,{}),children:a.jsx(Sse,{onComplete:()=>{window.location.href="/dashboard"}})})})}function Nse({items:e,isExpanded:t,location:n,setLocation:r}){return a.jsx("nav",{className:"space-y-4 mt-4",role:"navigation",children:e.map(s=>{const i=s.icon,o=n===s.path;return s.disabled?a.jsxs("div",{className:`flex items-center rounded-md text-base font-medium transition-colors group
596                ${t?"px-3 py-2.5":"px-0 py-2 justify-center"}
597                ${o?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100":"text-blue-700 dark:text-blue-200"}
598                opacity-50 cursor-not-allowed
599              `,children:[a.jsx(i,{className:"w-5 h-5 flex-shrink-0"}),t&&a.jsxs("span",{className:"ml-2.5 truncate flex items-center gap-2",children:[s.label,a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-gray-300 dark:bg-gray-700 rounded-md",children:"Coming Soon"})]})]},s.path):a.jsxs(De,{href:s.path,className:`flex items-center rounded-md text-base font-medium transition-colors group ${t?"px-3 py-2.5":"px-0 py-2 justify-center"} ${o?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100 hover:no-underline focus:no-underline":"text-blue-700 hover:bg-blue-50 hover:text-blue-800 dark:text-blue-200 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline"}`,onClick:l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.button!==0||(l.preventDefault(),r(s.path),wo(s.path))},"aria-current":o?"page":void 0,"aria-label":t?void 0:s.label,"data-testid":"nav-"+s.path.replace("/","")||"dashboard",title:t?void 0:s.label,children:[a.jsx(i,{className:"w-5 h-5 flex-shrink-0"}),t&&a.jsx("span",{className:"ml-2.5 truncate",children:s.label})]},s.path)})})}const Cse="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAD21JREFUeJztnWmUFcUVgL8ZhmVYlAFUREXCorJolBhjREFiYow5RBP33agct4gSzAlRT0KI0bjEJRoFE02MGuMalyxyXDAooLgrsioqioogIDsyzMuP+x5036ru1/1ed795Q33n1NHHdFfdrq6u5da9t8DhcDgcDofD4XA4HA6Hw+FwOBwOh8PhcDgcDofD0aKoqbQAMegGHAAMAXYHdgN6Ak3AtcD4jOW5Cjgf2AQsAOYBbwNTgReANRnL0+KoB34ETEQqtgnIhaQ9MpRt3yKybEQawbXAIUBdhrJVNfXACOBvwErCK1mnEzKUc2RM2T5HnmkE0DZDOauCdsCJwD+BdcSrWG/6ZYYyX1WGnCuAu4EfAK0zlLnZMRi4GVhO9MpbBDwIjMF8CXdlKPtDquyrgZ/mZVsU4TkK6ZP8vVkOXz6yngS2Bo4BRiPjaDE+BR4B/gdMAxZ6/jYEeN7z+1XgZKBrPnXJ/7cb0JAvu2P+2nqk5/GyHumBAFYBjcAypPvW6WGgv+feocBznt89kQnrMOBIoHuEZ50C3Ag8ikwsWxSdgZ8DHxLtK78JqbzagPzqgeMj5JVVOjEvk43a/LPcRLTe4V3gIqBTQH5VxbbAryjeza8AbgUOJPil90Z6jieAtUXyq0Ram5dtdF5WG7X5Z7w1/8xh+S0FfkGVNoSOyKRsGeEP+SxwCsFfzw7ABcB0ii8Dm1uaDowiuPtvD5yKDG9RGkKHgHzKIuk5QC1wOnA5sGPANRuAe4EbgDcsf28HHAuchKyhW8UofxmwGFiCzB8K/78e+CJ/zdq8DE2ef9s2L3tb5MUU/q0dsB3SELt7/r9LDJk2Ac8A9wD35WXR7I10+8cTvExcBFyKTHabYpSfGQciE7GglvwF8FukAm30Qmb2S0Py8KYFwASkofQC2iT+RMG0AXZFdA+3AO9ElHkp8oy9AvLtDlxBuA7kFaSumxXfRFq2TeDlwK8J/mr6I0qSjQH3F1IT8DJwGbBXSs9RDoOAS4AZFB+uNiLP3N+ak9TVeILnCeuROm82PIUp5DpkjdsQcE9fpEvcZLnXm2Yg84Cd0xM/cXog+wQvEv5sm5A66BuQTwNwDfaP66n0xI+HTS9+D8HdXAPwe2QcDqqYzxE9+sAU5c6KAchLDBvaNgDXEfyx9ELqVN8XRZeSOg/gF+rJkGtPQCZlQRUxFziXLROxlkR74BxgDsHPvwTRKQTxpLr+/hTljUQ/RGPmFeq7lut2QLRnQQ8+E9GYBekAWhK1yLO+RXB9PIJ9+Xiouq6R4OEjEyYqgV7HXFr2QZZktgd9D1kLbw0vXlOLPPt72OtmMfaX+5q6bkIWwtrYEXP37mTLdeMxH24DoiHMcunWXGmD1IVtTmQzcjlRXbOO4KV1qvxOCfIB9u1NLfCLyJLJ4WcgYkTirauTLNfVYfYaV2Qk42bqMdW8owOurQEuBiYhE7w4mr2tjVbIRHESUmdBmtpRmKumIHV6KpymBFhGlW5aVCntMVdTp2QpwFRV+LVZFu4AzCH4+fDLk2NPVXCOYJWmIz16Y2pRM5lb3awKfTaLQh1WtAr+xrQLtE3+bDNVRzYci/9dLCdlLeoZlgIznX06fLTBVLKdlmaB01VhN6RZmCMSejI4La2C+mBO/lrCbl21Y5sM9ot6cxwd/PHq93TEZctRWRZgTsSPSaMgvXt1QRqFOEriLPzvxmZrWRb9VQGbEKsXR/OgAXMzaUCUG6MOAdpIYQrwcVTpHKmzHNMQ59gkC5iLv3Wdk2TmjkQ4Bf87mpNUxoNVxo3A9kll7kiMTpgeU18tdlOUIUDPKCcDn8WVzpE6qxDXNC+JDANv4m9VZyWRqSMVtGr49XIz3Bm/k0MTFTI/ckSiI34fgiZgp7Abig0Bh+G3SnkVMVZ0NE9WI7YaBWqwW2lvJkoD8PLfEoRyZIt+R/odRqYO06//gNLlcmTEQPzvbAUhsYjC3MOHIr7rBZYjy7/G8mWMTWckZNwByJjWCfgI8cp9kAQmOyUyOC9XX2S+tCov1zQk6NWKCsn1PuK9XOAgSjAZuwJ/S7ovCcli0oC4Xwd5Hnt138MzlOtbmKsjndYj1lOdM5SrwK1KlstLyeRllcmPk5IuIsMRfUNYJes0kXSDMtYBf4op02IkRlCWjFAyvBw3g06YPn9Zbv4cQekxAx/FjACWBO2Ax0uUaR0SFzArOuDfHGokptm+dkKcl7CAYeyFPQjUQmRYOgY4HHEymYQ9vsAtKcil/SALu6JP5GU5HFHEXIk9GtpaxKI6K7T11nfi3DxO3XxHwsIFUQ/MVmU3IaFlgmLnDEFCq+kKPzJBuY625P9Ovmwb7ZCGoCOFvE06vZONa1TZ4+LcrP3Qz0hYuCB+glnRUXYeeyC9lPe+uSTjhlaHGQNoHtGGxPMxn+e8BGSKwpGq3LC4DT5aIQGdvDfvloKAmtZIN19qzzMY0ygiiQDSJ6k8NwD7xLj/TnV/kBNt0nTD3wOtIuIEeR/8An9GNiFlh6ty1yBh2eKgx+lHE5DrXyrPuPOL7THnNEMTkCsK2o7DaLg2VbAe157L35w2h6rf/0AcIONwk/o9nPJiELQBDlb/9seYeXyGGcolVD+fIFr5Y8xZbA1Aq3uzcjrcT/2eVEIeM5GAigU6UZ7f4kD8ETo/pDRLaL1P/42SJYrHVPU7UgPQF2XVAHRk0VItW98skm8cdJwenXdU9H1RoocngX53B+kLdAPYCQl1XmAN2enZu6nfy0rMZ6n6HXce4aU5yhSH+fitt3YCdvFeoBuADkH6AhLVMgtWqd+lOjnqoMorS8wHZH/dS3OQKQ45igwDugFUavwH09BkF+tVxdH3lWO/qGUqNVppkjLFpawG8ELi4gQzV/0uZam0Df6lThPSDZbKPPyRuQez5dSROAxTvxMz2Y6AfodB2kvqMQM2ZzVWgRlNbDbx4weerfJ4KQG5XlF5xtWK1iArB28exyUgV1Q64N/YayRgKNsPv5AfZCRggW6Y+/5Hxbi/PeaeQBIniY1Tec4h3tFvtrh+XROQKw4zlQz72y7SX8/DWUnnYYKSYTHRl3HaCGI1yfRg2yOrIW/e10W8tydmkOi4iqQk0Oroc20X6cq/NCvpPPTCVJvOwW/epKkDrlf35JDACUlxtSX/cYSryHdHXLe1ert
599nyD1poeMKTrRdpKNUZqWu1JyDWdkrkVPHvD4JbZEhwnZKyesku+1ajyimdDnPISps765jb8QEy2bTMDJBmeIwRMkxQ1/QCrOby3ICqLkDs/IKE5gPkVCp2mLJO2ykcRDjHvm8bWWuRnqqsJPA/pyCTFFpj7++1qF2JAfgFzbrCaCmBgk+GVSZQel9pOtNi95EPx/Im/5A5SOi64mgL6ag3vOuxATQxgjkpRar4CbkDB6tuk2DBiQeX1AP5E2LkJDwzQE9EfSFltVf27iMhQujA2KRPAlRF3uHg/nIKVyViD4+KF/2fPyNoeClezopnfVXImPwv2PfSuZp9cdUggwlRAOikk3T/DsudYhMlfABiMph+N/xZO8f9eTGhX9reeyC/x1vNrbprP7wJe4kj5ZIDeYqpUst5qx5PtIISqE7cuDRa2Sr727pnI0sfSdTuiIph+yveNkNZJbqbRXlHEX2d5XXlVR++VPN1GGquB8oI7/bVV6n1mKafOtt2Tjo/fKxiGVu1psfLYEeSDh47RdRTl1aewB98GM5TqCHYPfpWwh8u4x8tzaOwu4Yu5Lyzgz+IZbeXu93DyujAJCtxo8xhc8Bd+NiDIWxK8EOqO9Svr5jL5XnS2DGm0/iJMqdMd3LC2kZMqlxp4dtoS3wM2RPwVZnz5DMMNqg8l0EZpf9PMGHGMehHXJIdNDp4LMRFfTW3BDaIr6C2iWukDYg2/JJKL06IBpKb/6rAR6zFPwG5dnTexmKuS+uG8LJbF26h46I42jQi88hvgR7J1ReN8zt/hwy3LANW9y/9JjTJyEBOiK+/WFBHz4BfkPp1sDVwADEfU0733rTCuTQyKQ+iJ6YLvc5pEFs7uk7YLqE55D5QZKxd3oDD1nK8aZG4N/IbtU2CZZdKXogFjnTCH/ujcBtJBuH+SBknNdlTcYSMaQd9uGgERmHklTo7JsvSwdQ0GkdolkcSZGIl82MPRELpikEz4EK6UvEACap3hZE7TsW08o7B/yHkIO+WmNq87w3Jq3Q2Qe4i+JRwAppLlJZ5yJeu5W0WgL5KPog8X/GIr1bkNWQrau/HvhKwjJ1xXRpL6QHiDC0FA57trWejxBlQtLsAFyGPdRLsbQE6dL+gtgxnInY6Q3I5xvHhFvTCRlDByMveRRiO3E/oj/RZnRR0gxEu1eKg0kxjkbeUVAvHivOwzBMHUEhPUY61q01yLg1kWBlUilpDVIx8xH9RCFNRyZDhd9vI41wMdI1J1X+W0ico0jHuJRAb6SHDvpAYgWI8tID0QvYMl6N9BTlfGFh1ABfB8YDswJkaM7pFWA0yY7tmvZIz2mzQM4BL5LAh9oa6T6ClnALEWVGWg0BpMv1lrkM8dtL8istNa1Heg7tAPJ4KjUhdEA0h0HzjQ3IkjrRd9IX87DiLBrCwZayCgaNrZFDEr8PXIjY6N2FzAlmA58TzXgzKG1ANmVm5Z/9TqQrPx/xm+jNFk2mdgHLAd9LsiKQZfFYpFsPknkK6Q01gFR+WAjXJciRskXPq4lAK0yHjKnED1rVEVlG9gO+5kn7I+FaCr/3Rl7qjsQ/E7kGU6E2h/IVOjWINvWvBO8VFHrFkWQT0IsGZGwOc4QojIOjKF27d57KbxOiQ2iuDMZc948pMa9BiHNrMT+E1UhQyIosiTsDv8I8Ul6nJmTr8RKiG5x2wRxXK+ldE5Xb8Mv8BdG2wFsh8RmuRlYrxYanVYj/Y6V1IYCMTZcgHkVRxtZFiG3AWQQfdHyzumcF1XFc3XaYB23cbrmuFdKbXYwobsL2B7zpU8T3MAsnmNjUIpOj+4iu3cshs9lJSIs+Dpk8aUXU6Ayfo1wuwhy6TkDsICYguoc4SqSNiGndEWQTZTQRuiKxf5/GrlWMk2ZRRQ+OyKqjgsRNmxAdzBiyCyuXGl0Q6+MHCZ/JBiUdRbQa0CH3o6S1yJd+JtUx3JVEHbLkuhBR8IStaXPI2TvVyiOEP9tKZBt+HGI0m1Uo+c1ksmYsQg3inDIIWSEUUj9k5XA0YixSjWwH3IsEaFiADAuz8v+diexuNgXe7XA4HA6Hw+FwOBwOh8PhcDgcDofD4XA4HA6Hw+FwxOX/dU2LFzKT2tUAAAAASUVORK5CYII=",jse="/assets/darkdc-DS6cy02Z.png";function NF(e){return e==="premium"?"Shield Advisor":"Shield Essential"}function Tse(e,t){const n=t==="year"||t==="annual"?"Annual":"Monthly";return`${NF(e)} ${n}`}const Pse="[email protected]",Ase="REPSShield Support: [one-line summary of your issue]";function Nd(e){if(!e||typeof e!="object")return{};const t=e,n=r=>typeof r=="string"&&r.trim()?r:void 0;return{accountEmail:n(t.email),userId:n(t.id),accountOwnerId:n(t.accountOwnerId),subscriptionTier:n(t.subscriptionTier)??n(t.planType),subscriptionStatus:n(t.subscriptionStatus),isOnTrial:typeof t.isOnTrial=="boolean"?t.isOnTrial:void 0,trialEndDate:n(t.trialEndDate)}}function Ise(e){const t=[],n=(r,s)=>{s&&t.push(`${r}: ${s}`)};return n("Reported at",e.reportedAt),n("User ID",e.userId),e.accountOwnerId&&e.accountOwnerId!==e.userId&&n("Account owner ID",e.accountOwnerId),e.subscriptionTier&&n("Plan",`${NF(e.subscriptionTier)} (${e.subscriptionTier})`),n("Subscription status",e.subscriptionStatus),e.isOnTrial!==void 0&&n("On trial",e.isOnTrial?`Yes${e.trialEndDate?`, ends ${e.trialEndDate.slice(0,10)}`:""}`:"No"),n("Platform",e.platform),n("Viewport",e.viewport),e.online!==void 0&&n("Connectivity",e.online?"Online":"Offline"),e.routeHistory&&e.routeHistory.length>0&&n("Recent pages",e.routeHistory.slice(-5).join(" → ")),n("PostHog session replay",e.sessionReplayUrl),t}function Rse(e={}){var o,l,c;const t=(o=e.pageUrl)==null?void 0:o.trim(),n=(l=e.userAgent)==null?void 0:l.trim(),r=(c=e.accountEmail)==null?void 0:c.trim(),s=["Hi REPSShield Support team,","","BRIEF DESCRIPTION OF THE ISSUE:","[What happened, in 1-2 sentences]","",`PAGE URL: ${t||"[Paste the REPSShield page you were on]"}`,"","WHAT I WAS TRYING TO DO:","","","WHAT HAPPENED INSTEAD:","","","STEPS TO REPRODUCE:","1.","2.","3.","","WHEN DID THIS HAPPEN?","[Date and approximate time]","",`DEVICE / BROWSER: ${n||"[e.g. Windows / Chrome, Mac / Safari, iPhone]"}`,"","SCREENSHOT OR SCREEN RECORDING:","Please attach it to this email if you can — it helps a lot.","","ANYTHING ELSE THAT MIGHT HELP?","","","---",`REPSShield ACCOUNT EMAIL: ${r||"[the email you sign in with]"}`],i=Ise(e);return i.length>0&&s.push("","TECHNICAL DETAILS (auto-filled — please don't edit):",...i),e.diagnosticsLines&&e.diagnosticsLines.length>0&&s.push("",...e.diagnosticsLines),s.join(`
600`)}function Mse(e={}){const t=encodeURIComponent(Ase),n=encodeURIComponent(Rse(e));return`https://mail.google.com/mail/?view=cm&fs=1&to=${Pse}&su=${t}&body=${n}`}const nC="repsshield.support.sessionStart.v1",rC="repsshield.support.sessionId.v1",CF="repsshield.support.routeHistory.v1",Ose=10;function zm(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}let eu=null;function Dse(){return`support-${typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}`}
600function C_(){if(jF(),eu)return eu;const e=zm(),t=e==null?void 0:e.getItem(rC);if(eu=t||Dse(),e&&!t)try{e.setItem(rC,eu)}catch{}return eu}function jF(){const e=zm();if(!e)return Date.now();const t=Number(e.getItem(nC));if(t>0)return t;const n=Date.now();try{e.setItem(nC,String(n))}catch{}return n}function TF(e){const t=zm();if(C_(),!(!t||!e))try{const n=j_();if(n[n.length-1]===e)return;n.push(e),t.setItem(CF,JSON.stringify(n.slice(-Ose)))}catch{}}function j_(){const e=zm();if(!e)return[];try{const t=JSON.parse(e.getItem(CF)||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function Lse(e=Date.now()){return Math.max(0,e-jF())}function Fse(){return Ye()?Ra()?"Native app — iOS":Gp()?"Native app — Android":"Native app":"Web browser"}function $se(e){let t="";try{t=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{t=""}return t?`${e.toISOString()} (${t})`:e.toISOString()}function PF(e={}){var n;const t={...e};if(typeof window<"u"&&(t.pageUrl??(t.pageUrl=window.location.href),t.viewport??(t.viewport=`${window.innerWidth}x${window.innerHeight}`+(typeof screen<"u"?` (screen ${screen.width}x${screen.height})`:"")),t.platform??(t.platform=Fse()),t.routeHistory??(t.routeHistory=j_()),t.sessionDurationMs??(t.sessionDurationMs=Lse())),typeof navigator<"u"&&(t.userAgent??(t.userAgent=navigator.userAgent),t.online??(t.online=navigator.onLine),t.language??(t.language=navigator.language),t.connectionType??(t.connectionType=((n=navigator.connection)==null?void 0:n.effectiveType)||void 0)),t.reportedAt??(t.reportedAt=$se(new Date)),t.sessionId??(t.sessionId=C_()),t.sessionReplayUrl??(t.sessionReplayUrl=OI()??void 0),!t.diagnosticsLines)try{t.diagnosticsLines=cP()}catch{}window.open(Mse(t),"_blank")}let sC=null;function Vse(){if(typeof window>"u")return null;if(typeof window.clarity!="function"){const e=[],t=(...n)=>{e.push([...n])};t.q=e,window.clarity=t}return window.clarity}function Bse(e){return e&&e.split(/[?#]/)[0]||void 0}function AF(e,t){if(e.userId)try{const n=C_(),r=Bse(t),s=[];e.subscriptionTier&&s.push(["subscription_tier",e.subscriptionTier]),e.subscriptionStatus&&s.push(["subscription_status",e.subscriptionStatus]);const i=JSON.stringify([e.userId,n,r,s]);if(i===sC)return;const o=Vse();if(!o)return;o("identify",e.userId,n,r);for(const[l,c]of s)o("set",l,c);sC=i}catch{}}function Use({isExpanded:e,onSupportClick:t}){const{user:n}=Wt(),[r]=Pt();return m.useEffect(()=>{TF(r),AF(Nd(n),r)},[r,n]),a.jsx("div",{className:"mt-auto pt-4 border-t border-gray-200 dark:border-gray-700",children:a.jsxs("div",{className:"space-y-2 pt-2",children:[a.jsxs("button",{className:`flex items-center w-full rounded-md text-sm font-medium normal-case tracking-normal text-[#44958c] hover:bg-gray-50 hover:text-[#367068] dark:hover:bg-gray-700 transition-colors group hover:no-underline focus:no-underline ${e?"px-3 py-1.5":"px-0 py-2 justify-center"}`,onClick:t,"data-testid":"button-support-feedback","aria-label":e?void 0:"Submit Bug / Feedback",title:e?void 0:"Submit Bug / Feedback",children:[a.jsx(sR,{className:"w-4 h-4 flex-shrink-0"}),e&&a.jsx("span",{className:"ml-2.5 truncate",children:"Submit Bug / Feedback"})]}),a.jsxs("button",{className:`flex items-center w-full rounded-md text-sm font-medium normal-case tracking-normal text-[#44958c] hover:bg-gray-50 hover:text-[#367068] dark:hover:bg-gray-700 transition-colors group hover:no-underline focus:no-underline ${e?"px-3 py-1.5":"px-0 py-2 justify-center"}`,onClick:()=>{PF(Nd(n))},"data-testid":"button-email-support","aria-label":e?void 0:"Email Support",title:e?void 0:"Email Support",children:[a.jsx(nm,{className:"w-4 h-4 flex-shrink-0"}),e&&a.jsx("span",{className:"ml-2.5 truncate",children:"Email Support"})]}),a.jsxs("button",{className:`flex items-center w-full rounded-md text-sm font-medium normal-case tracking-normal text-[#44958c] hover:bg-gray-50 hover:text-[#367068] dark:hover:bg-gray-700 transition-colors group hover:no-underline focus:no-underline mb-8 ${e?"px-3 py-1.5":"px-0 py-2 justify-center"}`,onClick:()=>{window.open("https://discord.gg/FG5sCYYXmd","_blank","noopener,noreferrer")},"data-testid":"button-discord-community","aria-label":e?void 0:"Join Discord Community",title:e?void 0:"Join Discord Community",children:[a.jsx("img",{src:Cse,alt:"","aria-hidden":"true",className:"w-4 h-4 flex-shrink-0 dark:hidden"}),a.jsx("img",{src:jse,alt:"","aria-hidden":"true",className:"w-4 h-4 flex-shrink-0 hidden dark:block"}),e&&a.jsx("span",{className:"ml-2.5 truncate",children:"Join Discord Community"}),e&&a.jsx(Cl,{className:"w-3 h-3 ml-auto flex-shrink-0 opacity-60"})]}),a.jsxs("a",{href:"/docs/api",target:"_blank",rel:"noopener noreferrer",className:`flex items-center w-full rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-gray-100 transition-colors group hover:no-underline focus:no-underline mb-8 ${e?"px-3 py-1.5":"px-0 py-2 justify-center"}`,"data-testid":"link-api-guide","aria-label":e?void 0:"API Guide",title:e?void 0:"API Guide",children:[a.jsx(J9,{className:"w-4 h-4 flex-shrink-0"}),e&&a.jsx("span",{className:"ml-2.5 truncate",children:"API Guide"}),e&&a.jsx(Cl,{className:"w-3 h-3 ml-auto flex-shrink-0 opacity-60"})]}),a.jsxs("a",{href:"/changelog",target:"_blank",rel:"noopener noreferrer",className:`flex items-center w-full rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-gray-100 transition-colors group hover:no-underline focus:no-underline mb-8 ${e?"px-3 py-1.5":"px-0 py-2 justify-center"}`,"data-testid":"link-changelog","aria-label":e?void 0:"Change Log",title:e?void 0:"Change Log",children:[a.jsx(Nr,{className:"w-4 h-4 flex-shrink-0"}),e&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"ml-2.5 truncate",children:"Change Log"}),a.jsx(Cl,{className:"w-3 h-3 ml-auto flex-shrink-0 opacity-60"})]})]})]})})}const Oi={async getMembers(){const e=await Xe("GET","/api/team/members");if(!e.ok)throw e.status===403?new Error("Access denied"):new Error("Failed to fetch team members");return e.json()},async getInvitations(){const e=await Xe("GET","/api/team/invitations");
600if(!e.ok)throw new Error("Failed to fetch invitations");return e.json()},async inviteMember(e){const t={email:e.email,teamMemberRole:e.teamMemberRole,canCreateTimeEntries:e.canCreateTimeEntries,canViewAllTimeEntries:e.canViewAllTimeEntries},n=await Xe("POST","/api/team/invite",t);if(!n.ok){const r=await n.json();throw new Error(r.message||"Failed to send invitation")}return n.json()},async updateMemberPermissions(e,t){const n=await Xe("PATCH",`/api/team/members/${e}`,t);if(!n.ok){const r=await n.json();throw new Error(r.message||"Failed to update permissions")}return n.json()},async removeMember(e){const t=await Xe("DELETE",`/api/team/members/${e}`);if(!t.ok){const n=await t.json();throw new Error(n.message||"Failed to remove team member")}return t.json()},async cancelInvitation(e){const t=await Xe("DELETE",`/api/team/invitations/${e}`);if(!t.ok){const n=await t.json();throw new Error(n.message||"Failed to cancel invitation")}return t.json()},async removeInvitation(e){const t=await Xe("DELETE",`/api/team/invitations/${e}/remove`);if(!t.ok){const n=await t.json();throw new Error(n.message||"Failed to remove invitation")}return t.json()},async restoreMember(e){const t=await Xe("POST",`/api/team/restore/${e}`);if(!t.ok){const n=await t.json();throw new Error(n.message||"Failed to restore team member")}return t.json()},async getInvitationDetails(e){const t=await Xe("GET",`/api/team/invitations/${e}/details`);if(!t.ok){const n=await t.json();throw new Error(n.message||"Failed to load invitation details")}return t.json()},async acceptInvitation(e,t){const n=await Xe("POST",`/api/team/accept-invite/${e}`,t);if(!n.ok){const r=await n.json();throw new Error(r.message||"Failed to accept invitation")}return n.json()}};function zse(){var p,g;const e=Lt(),{toast:t}=sn(),{user:n,isLoading:r,isAuthenticated:s}=Wt();m.useEffect(()=>{console.group("🔍 [useTeam] Authentication State"),console.groupEnd()},[r,n,s]);const i=tt({queryKey:["/api/team/members"],queryFn:()=>Oi.getMembers(),retry:!1});m.useEffect(()=>{i.error&&console.error("❌ [useTeam] Members query failed:",i.error)},[i.error]);const o=tt({queryKey:["/api/team/invitations"],queryFn:()=>Oi.getInvitations(),retry:!1});m.useEffect(()=>{o.error&&console.error("❌ [useTeam] Invitations query failed:",o.error)},[o.error]);const l=gt({mutationFn:Oi.inviteMember,onSuccess:()=>{e.invalidateQueries({queryKey:["/api/team/invitations"]}),e.invalidateQueries({queryKey:["/api/team/members"]}),t({title:"Invitation Sent",description:"Team member invitation has been sent successfully."})},onError:v=>{t({title:"Failed to Send Invitation",description:v.message,variant:"destructive"})}}),c=gt({mutationFn:({id:v,data:y})=>Oi.updateMemberPermissions(v,y),onMutate:async({id:v,data:y})=>{await e.cancelQueries({queryKey:["/api/team/members"]});const x=e.getQueryData(["/api/team/members"]);return x&&e.setQueryData(["/api/team/members"],{...x,members:x.members.map(b=>b.id===v?{...b,...y}:b)}),{previousData:x}},onSuccess:()=>{e.invalidateQueries({queryKey:["/api/team/members"]}),t({title:"Permissions Updated",description:"Team member permissions have been updated successfully."})},onError:(v,y,x)=>{x!=null&&x.previousData&&e.setQueryData(["/api/team/members"],x.previousData),t({title:"Update Failed",description:v.message,variant:"destructive"})}}),u=gt({mutationFn:Oi.removeMember,onSuccess:async(v,y)=>{var w,S;await Promise.all([e.invalidateQueries({queryKey:["/api/team/members"]}),e.invalidateQueries({queryKey:["/api/team/invitations"]})]);const x=((S=(w=v==null?void 0:v.data)==null?void 0:w.deletedInvitations)==null?void 0:S.length)||0,b=x>0?`Team member permanently removed. ${x} pending invitation(s) also deleted.`:"The team member has been permanently removed from your workspace.";t({title:"Team Member Deleted",description:b})},onError:v=>{t({title:"Remove Failed",description:v.message,variant:"destructive"})}}),d=gt({mutationFn:Oi.cancelInvitation,onSuccess:()=>{e.invalidateQueries({queryKey:["/api/team/invitations"]}),t({title:"Invitation Cancelled",description:"The invitation has been cancelled successfully."})},onError:v=>{t({title:"Cancel Failed",description:v.message,variant:"destructive"})}}),h=gt({mutationFn:Oi.removeInvitation,onSuccess:()=>
600{e.invalidateQueries({queryKey:["/api/team/invitations"]}),t({title:"Invitation Removed",description:"The invitation has been permanently removed."})},onError:v=>{t({title:"Remove Failed",description:v.message,variant:"destructive"})}}),f=gt({mutationFn:Oi.restoreMember,onSuccess:()=>{e.invalidateQueries({queryKey:["/api/team/members"]}),e.invalidateQueries({queryKey:["/api/team/invitations"]}),t({title:"Team Member Restored",description:"The team member has been successfully restored."})},onError:v=>{t({title:"Restore Failed",description:v.message,variant:"destructive"})}});return{members:((p=i.data)==null?void 0:p.members)||[],membersLoading:i.isLoading,membersError:i.error,membersSuccess:(g=i.data)==null?void 0:g.success,invitations:o.data||[],invitationsLoading:o.isLoading,inviteMember:l.mutate,isInviting:l.isPending,updatePermissions:c.mutate,isUpdatingPermissions:c.isPending,removeMember:u.mutate,isRemovingMember:u.isPending,cancelInvitation:d.mutate,isCancellingInvitation:d.isPending,removeInvitation:h.mutate,isRemovingInvitation:h.isPending,restoreMember:f.mutate,isRestoringMember:f.isPending}}const r0="automation-settings-viewed";function IF(e,t){return e?`automation_settings_viewed_${t}_${e}`:null}function zh(e,t){const n=IF(e,t);return!!n&&localStorage.getItem(n)==="true"}function m0e(e,t){const n=IF(e,t);n&&(localStorage.setItem(n,"true"),window.dispatchEvent(new Event(r0)))}function Hse(e){return window.addEventListener(r0,e),()=>window.removeEventListener(r0,e)}const Wse=new Date("2026-09-29T00:00:00.000Z");function qse(){var $,j,P,D,C;const{user:e}=Wt(),t=e==null?void 0:e.id,n=e!=null&&e.createdAt?new Date(e.createdAt).getTime():NaN,r=!Number.isNaN(n)&&n<Wse.getTime(),{data:s}=tt({queryKey:["/api/properties"],queryFn:async()=>{const H=await fetch("/api/properties",{credentials:"include"});if(!H.ok)throw new Error("Failed to fetch properties");return H.json()},enabled:!!t,staleTime:1e3*60*5}),i=Array.isArray(s)?s.length:0,{data:o}=tt({queryKey:["/api/time-entries/pending-count"],queryFn:async()=>{const H=await fetch("/api/time-entries/pending-count",{credentials:"include"});
600if(!H.ok)throw new Error("Failed to fetch pending entries count");return H.json()},enabled:!!t,staleTime:1e3*30}),l=(o==null?void 0:o.count)||0,{gmailStatusQuery:c,microsoftMailStatusQuery:u,imapStatusQuery:d,googleCalendarStatusQuery:h,microsoftCalendarStatusQuery:f}=Yee(),p=!!(($=c.data)!=null&&$.connected||(j=u.data)!=null&&j.connected||(P=d.data)!=null&&P.connected||(D=h.data)!=null&&D.connected||(C=f.data)!=null&&C.connected),{members:g,invitations:v}=zse(),y=t?`getting_started_csv_import_clicked_${t}`:null,[x,b]=m.useState(()=>!!y&&localStorage.getItem(y)==="true"),w=t?`getting_started_review_entries_clicked_${t}`:null,[S,_]=m.useState(()=>!!w&&localStorage.getItem(w)==="true"),E=t?`getting_started_tax_profile_clicked_${t}`:null,[R,A]=m.useState(()=>!!E&&localStorage.getItem(E)==="true"),[N,k]=m.useState(()=>zh(t,"mail")&&zh(t,"calendar"));m.useEffect(()=>{const H=()=>k(zh(t,"mail")&&zh(t,"calendar"));return H(),Hse(H)},[t]);const T=m.useMemo(()=>{const H=[{id:"add-property",label:"Add a property",complete:i>0,href:"/properties"},{id:"connect-integrations",label:"Connect your calendar & email",complete:p,hint:"Connect below"}];return(l>0||S)&&H.push({id:"review-entries",label:"Review your first AI-found entries",complete:S,href:"/activity-ledger?status=pending",onAction:()=>{w&&localStorage.setItem(w,"true"),_(!0)}}),H.push({id:"import-csv",label:"Import past records (CSV)",complete:x,href:"/activity-ledger",onAction:()=>{y&&localStorage.setItem(y,"true"),b(!0)}},{id:"automation",label:"Review your automation settings",complete:N,href:"/dashboard?openAutomationSettings=1"},{id:"invite-team",label:"Invite a team member",complete:g.length>0||v.length>0,href:"/team"},{id:"tax-profile",label:"Review your tax profile",complete:R,href:"/dashboard?openTaxProfile=1",onAction:()=>{E&&localStorage.setItem(E,"true"),A(!0)}}),H},[i,p,l,S,w,x,y,N,g.length,v.length,R,E]),I=T.filter(H=>H.complete).length,F=T.length>0&&I===T.length,L=m.useRef(null),M=m.useRef(!1);return m.useEffect(()=>{if(!t||r)return;if(!F){L.current===null&&(L.current=Date.now());return}if(M.current||L.current===null||Date.now()-L.current<3e3)return;M.current=!0;const H=`posthog_checklist_completed_${t}`;try{if(sessionStorage.getItem(H))return;sessionStorage.setItem(H,"1")}catch{}wa("checklist_completed",{})},[F,r,t]),{items:T,completedCount:I,totalCount:T.length,allComplete:F,isPreLaunchAccount:r}}function Gse({isExpanded:e,onExpand:t}){const[,n]=Pt(),[r,s]=m.useState(!1),{items:i,completedCount:o,totalCount:l,allComplete:c,isPreLaunchAccount:u}=qse();if(c||u)return null;const d=l-o;if(!e)return a.jsxs("button",{type:"button",onClick:t,className:"relative mx-auto mt-6 flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-primary transition-colors","aria-label":`Getting Started: ${d} item${d===1?"":"s"} remaining`,title:`Getting Started: ${d} item${d===1?"":"s"} remaining`,children:[a.jsx(yx,{className:"h-4 w-4"}),a.jsx("span",{className:"absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[9px] font-semibold leading-none text-primary-foreground",children:d})]});const h=f=>{var p;(p=f.onAction)==null||p.call(f),f.href&&n(f.href)};return a.jsxs("div",{className:"mt-6 rounded-lg border border-border bg-muted/40 p-3",children:[a.jsxs("button",{type:"button",onClick:()=>s(f=>!f),className:"flex w-full items-center gap-1.5 text-left normal-case tracking-normal",children:[a.jsx(yx,{className:"h-3.5 w-3.5 text-primary flex-shrink-0"}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground truncate",children:"Getting Started"}),a.jsxs("span",{className:"ml-auto text-xs text-muted-foreground flex-shrink-0",children:[o,"/",l]})]}),!r&&a.jsx("div",{className:"mt-2 space-y-0.5",children:i.map(f=>a.jsxs("button",{type:"button",onClick:()=>h(f),disabled:f.complete,className:`flex w-full items-start gap-2 rounded px-1.5 py-1 text-left text-xs normal-case tracking-normal transition-colors ${f.complete?"text-muted-foreground/70 cursor-default":"text-foreground
600/80 hover:bg-background/80"}`,children:[f.complete?a.jsx(Nb,{className:"h-3 w-3 flex-shrink-0 mt-0.5 text-primary"}):a.jsx(XI,{className:"h-3 w-3 flex-shrink-0 mt-0.5 text-muted-foreground/50"}),a.jsx("span",{className:`leading-snug ${f.complete?"line-through":""}`,children:f.label})]},f.id))})]})}function Kse({navigationItems:e,isExpanded:t,onToggle:n,showSupportDialog:r,onSupportClick:s,location:i,setLocation:o}){return a.jsxs("aside",{className:`hidden md:flex flex-col bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 transition-[width] duration-200 overflow-hidden ${t?"w-72":"w-16"}`,children:[a.jsxs("div",{className:"h-16 px-4 flex items-center justify-between border-b border-gray-200 dark:border-gray-700",children:[t&&a.jsxs(De,{href:"/dashboard",className:"flex items-center gap-3 min-w-0 hover:opacity-80 transition-opacity hover:no-underline focus:no-underline",onClick:()=>{o("/dashboard"),wo("/dashboard")},children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield Logo",className:"w-8 h-8 flex-shrink-0"}),a.jsx("span",{className:"font-semibold text-lg text-gray-900 dark:text-white truncate",children:"REPSShield"})]}),a.jsx(ie,{variant:"ghost",size:"icon",className:t?"ml-auto":"mx-auto",onClick:n,"aria-expanded":t,"aria-label":t?"Collapse sidebar":"Expand sidebar","data-testid":"button-sidebar-toggle",children:a.jsx(sm,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 flex flex-col p-4 overflow-y-auto",children:[a.jsx(Nse,{items:e,isExpanded:t,location:i,setLocation:o}),a.jsx(Gse,{isExpanded:t,onExpand:n}),a.jsx(Use,{isExpanded:t,onSupportClick:s})]})]})}const Yse=rh,Qse=Fm,Zse=sh,RF=m.forwardRef(({className:e,...t},n)=>a.jsx(Ua,{className:q("fixed inset-0 z-[9998] bg-black/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));RF.displayName=Ua.displayName;const Xse=bc("fixed z-[9999] gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),MF=m.forwardRef(({side:e="right",className:t,children:n,...r},s)=>a.jsxs(Zse,{children:[a.jsx(RF,{}),a.jsxs(za,{ref:s,className:q(Xse({side:e}),t),...r,children:[n,a.jsxs(ih,{className:"absolute right-4 top-4 roun
600ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(vn,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));MF.displayName=za.displayName;const Jse=m.forwardRef(({className:e,...t},n)=>a.jsx(Cc,{ref:n,className:q("text-lg font-semibold text-foreground",e),...t}));Jse.displayName=Cc.displayName;const eie=m.forwardRef(({className:e,...t},n)=>a.jsx(jc,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));eie.displayName=jc.displayName;var tie="Separator",iC="horizontal",nie=["horizontal","vertical"],OF=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=iC,...s}=e,i=rie(r)?r:iC,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(we.div,{"data-orientation":i,...l,...s,ref:t})});OF.displayName=tie;function rie(e){return nie.includes(e)}var DF=OF;const T_=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(DF,{ref:s,decorative:n,orientation:t,className:q("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));T_.displayName=DF.displayName;function sie(e){const t={};try{const n=Nd(e);t.subscriptionTier=n.subscriptionTier,t.subscriptionStatus=n.subscriptionStatus,t.isOnTrial=n.isOnTrial,t.trialEndDate=n.trialEndDate}catch{}try{typeof window<"u"&&(t.pageUrl=window.location.href,t.viewport=`${window.innerWidth}x${window.innerHeight}`,t.routeHistory=j_(),t.sessionReplayUrl=OI()??void 0,t.diagnosticsLines=cP()),typeof navigator<"u"&&(t.userAgent=navigator.userAgent)}catch{}return t}function LF({open:e,onOpenChange:t}){const[n,r]=m.useState("bug"),[s,i]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(""),{user:d}=Wt(),{toast:h}=sn(),f=gt({mutationFn:async v=>await Xe("POST","/api/support/feedback",v),onSuccess:()=>{h({title:"Feedback Submitted",description:"Thank you for your feedback! We'll review it and get back to you if needed."}),i(""),l(""),u(""),r("bug"),t(!1)},onError:v=>{h({title:"Submission Failed",description:"Failed to submit feedback. Please try the email option or contact us directly.",variant:"destructive"})}}),p=v=>{if(v.preventDefault(),!s.trim()||!o.trim()){h({title:"Missing Information",description:"Please fill in both the subject and description fields.",variant:"destructive"});return}f.mutate({type:n,subject:s.trim(),description:o.trim(),userEmail:(d==null?void 0:d.email)||c.trim(),diagnostics:sie(d)})},g=v=>{switch(v){case"bug":return a.jsx(FS,{className:"h-4 w-4"});case"feature_request":return a.jsx(VS,{className:"h-4 w-4"});case"issue":return a.jsx(bi,{className:"h-4 w-4"});default:return a.jsx(Xg,{className:"h-4 w-4"})}};return a.jsx($s,{open:e,onOpenChange:t,children:a.jsxs(os,{className:"sm:max-w-[500px]","data-testid":"dialog-support-feedback",children:[a.jsx(as,{children:a.jsxs(ls,{className:"flex items-center gap-2",children:[a.jsx(Xg,{className:"h-5 w-5"}),"Submit Bug Report / Feedback"]})}),a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(at,{htmlFor:"feedback-type",children:"Type of Feedback"}),a.jsxs(ko,{value:n,onValueChange:v=>r(v),children:[a.jsx(ki,{"data-testid":"select-feedback-type",children:a.jsx(So,{})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"bug",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(FS,{className:"h-4 w-4"}),"Bug Report"]})}),a.jsx(Cn,{value:"feature_request",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(VS,{className:"h-4 w-4"}),"Feature Request"]})}),a.jsx(Cn,{value:"issue",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(bi,{className:"h-4 w-4"}),"Technical Issue"]})}),a.jsx(Cn,{value:"general_feedback",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Xg,{className:"h-4 w-4"}),"General Feedback"]})})]})]})]}),!(d!=null&&d.email)&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(at,{htmlFor:"contact-email",children:"Your Email"}),a.jsx(Ct,{id:"contact-email",type:"email",value:c,onChange:v=>u(v.target.value),placeholder:"[email protected]",required:!(d!=null&&d.email),"data-testid":"input-contact-email"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(at,{htmlFor:"feedback-subject",children:"Subject"}),a.jsx(Ct,{id:"feedback-subject",value:s,onChange:v=>i(v.target.value),placeholder:"Brief description of the issue or suggestion",required:!0,"data-testid":"input-feedback-subject"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(at,{htmlFor:"feedback-description",children:"Description"}),a.jsx(Us,{id:"feedback-description",value:o,onChange:v=>l(v.target.value),placeholder:n==="bug"?"Please describe what happened, what you expected to happen, and steps to reproduce the issue...":"Please provide details about your feedback or suggestion...",className:"min-h-[120px]",required:!0,"data-testid":"textarea-feedback-description"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(ie,{type:"button",variant:"outline",onClick:()=>t(!1),"data-testid":"button-cancel-feedback",children:"Cancel"}),a.jsx(ie,{type:"submit",disabled:f.isPending,"data-testid":"button-submit-feedback",children:f.isPending?"Submitting...":a.jsxs(a.Fragment,{children:[g(n),"Submit Feedback"]})})]})]})]})})}function iie(){const{user:e}=Wt(),{showForLogout:t,hide:n}=iP(),[,r]=Pt(),s=Lt();if(Re.useEffect(()=>{const o=l=>{};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}},[]),!e)return null;const i=async o=>{o&&(o.preventDefault(),o.stopPropagation());const l=t();try{if(localStorage.getItem("demoMode")==="true"){await Ms(s,{force:!0}),n(l),Kl("/login");return}await Cs("/api/logout",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})}catch{}await Ms(s,{force:!0}),n(l),Kl("/logout-success")};return a.jsxs(Xb,{children:[a.jsx(Jb,{asChild:!0,children:a.jsx("button",{className:"relative h-8 w-8 rounded-full p-0 border-0 bg-transparent cursor-pointer focus:outline-none hover:opacity-80",children:a.jsx(q2,{user:e,size:"sm",className:"border-2 border-[#49b422]"})})}),a.jsxs(wm,{className:"w-56",align:"end",forceMount:!0,children:[a.jsx(ew,{className:"font-normal",children:a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsx("p",{className:"text-sm font-medium leading-none truncate",children:e.firstName&&e.lastName?`${e.firstName} ${e.lastName}`:e.email}),a.jsx("p",{className:"text-xs leading-none text-muted-foreground truncate",children:e.email})]})}),a.jsx(sp,{}),a.jsxs(Pl,{onClick:()=>r("/team"),children:[a.jsx(lR,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Team"})]}),a.jsxs(Pl,{onClick:()=>r("/settings"),children:[a.jsx(yH,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Settings"})]}),a.jsx(sp,{}),a.jsxs(Pl,{onClick:o=>{o.preventDefault(),i(o)},onSelect:o=>{o.preventDefault()},children:[a.jsx(ud,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Log out"})]})]})]})}const oie=[{path:"/dashboard",label:"Dashboard",icon:Bd},{path:"/properties",label:"Properties",icon:jo},{path:"/activity-ledger",label:"Activity Ledger",icon:rR},{path:"/files",label:"File Vault",icon:Nr}],oC=[{path:"/organization-admin",label:"Organization",icon:jo,requiredRole:"org_admin"},{path:"/super-admin",label:"Super Admin",icon:Cr,requiredRole:"super_admin"},{path:"/admin/blog",label:"Blog",icon:iR,requiredRole:"super_admin"}];function FF(e,t){const n=[...oie];return e&&(e.role==="org_admin"||e.role==="super_admin")&&n.push(oC[0]),t&&n.push(oC[1]),n}function aie({location:e,setLocation:t,showSupportDialog:n=!1,setShowSupportDialog:r}){const s=Io(),[i,o]=m.useState(!1),[l,c]=m.useState(new Set),{user:u,isAdmin:d}=Wt();m.useEffect(()=>{TF(e),AF(Nd(u),e)},[e,u]);const h=FF(u,d);return a.jsx("div",{className:`lg:border-b ${s?"bg-white dark:bg-gray-800":"bg-transparent dark:bg-transparent"} md:bg-white md:dark:bg-gray-800 safe-area-top mobile-optimized z-10 border-b border-gray-100 dark:border-gray-800`,children:a.jsxs("div",{className:"flex min-h-12 sm:min-h-16 items-center container-mobile container-safe",children:[a.jsxs(Yse,{open:i,onOpenChange:o,children:[a.jsx(Qse,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"icon",className:"hidden touch-target",children:a.jsx(sm,{className:"h-5 w-5"})})}),a.jsx(MF,{side:"left",className:"w-60 sm:w-64 safe-area-left pl-4",children:a.jsxs("div",{className:"flex flex-col h-full py-3",children:[a.jsx("div",{className:"pr-2",children:a.jsxs(De,{href:"/dashboard",className:"flex items-center mb-3 cursor-pointer hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded-md py-2 px-2 transition-colors hover:no-underline focus:no-underline",onClick:()=>o(!1),children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield Logo",className:"w-6 h-6 flex-shrink-0 hover:opacity-80 transition-opacity"}),a.jsx("span",{className:"ml-2.5 font-semibold text-lg hover:text-blue-700 dark:hover:text-blue-100 transition-colors",children:"REPSShield"})]})}),a.jsx("div",{className:"space-y-3",children:h.map(f=>{var x;const p=f.icon,g=l.has(f.path),v=f.subItems&&f.subItems.length>0,y=e===f.path||v&&f.subItems.some(b=>e===b.path);return a.jsxs("div",{children:[v?a.jsxs(ie,{variant:"ghost",className:`w-full justify-start px-4 py-3 text-base font-medium transition-colors touch-target ${y?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100":"text-gray-700 dark:text-gray-200 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100"}`,"data-tour":`nav-${f.path.replace("/","")||"dashboard"}`,onClick:()=>{c(b=>{const w=new Set(b);return w.has(f.path)?w.delete(f.path):w.add(f.path),w})},children:[a.jsx(p,{className:"mr-4 h-6 w-6 flex-shrink-0"}),f.label,g?a.jsx(Ma,{className:"ml-auto h-4 w-4"}):a.jsx(Ar,{className:"ml-auto h-4 w-4"})]}):a.jsxs(De,{href:f.path,className:`flex items-center w-full px-4 py-3 rounded-md text-base font-medium transition-colors touch-target  ${y?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100 hover:no-underline focus:no-underline":"text-gray-700 dark:text-gray-200 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline"}`,"data-tour":`nav-${f.path.replace("/","")||"dashboard"}`,onClick:b=>{b.metaKey||b.ctrlKey||b.shiftKey||b.altKey||b.button!==0||(b.preventDefault(),t(f.path),wo(f.path),o(!1))},children:[a.jsx(p,{className:"mr-4 h-6 w-6 flex-shrink-0"}),a.jsx("span",{className:"flex-1",children:f.label})]}),v&&g&&a.jsx("div",{className:"ml-9 space-y-2 mt-2",children:(x=f.subItems)==null?void 0:x.map(b=>{const w=b.icon,S=e===b.path;return a.jsxs(De,{href:b.path,className:`flex items-center w-full px-3 py-2.5 rounded-md text-base font-medium transition-colors touch-target  ${S?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100 hover:no-underline focus:no-underline":"text-gray-600 dark:text-gray-300 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline"}`,onClick:_=>{_.metaKey||_.ctrlKey||_.shiftKey||_.altKey||_.button!==0||(_.preventDefault(),t(b.path),wo(b.path),o(!1))},children:[w?a.jsx(w,{className:"mr-4 h-5 w-5 flex-shrink-0"}):null,a.jsx("span",{className:"flex-1",children:b.label})]},b.path)})})]},f.path)})}),a.jsxs("div",{className:"mt-auto pt-6",children:[a.jsx(T_,{className:"mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(ie,{variant:"ghost",className:"w-full justify-start px-4 py-3 text-base font-medium transition-colors touch-target text-gray-700 dark:text-gray-200 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline",onClick:()=>{r==null||r(!0),o(!1)},"data-testid":"button-support-feedback",children:[a.jsx(sR,{className:"mr-4 h-5 w-5 flex-shrink-0"}),a.jsx("span",{className:"flex-1 text-left truncate",children:"Submit Bug / Feedback"})]}),a.jsxs(ie,{variant:"ghost",className:"w-full justify-start px-4 py-3 text-base font-medium transition-colors touch-target text-gray-700 dark:text-gray-200 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline",onClick:()=>{PF(Nd(u)),o(!1)},"data-testid":"button-email-support",children:[a.jsx(nm,{className:"mr-4 h-5 w-5 flex-shrink-0"}),a.jsx("span",{className:"flex-1 text-left truncate",children:"Email Support"})]}),a.jsxs(ie,{variant:"ghost",className:"w-full justify-start px-4 py-3 text-base font-medium transition-colors touch-target text-gray-700 dark:text-gray-200 hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-blue-900/50 dark:hover:text-blue-100 hover:no-underline focus:no-underline",onClick:()=>{window.open("https://discord.gg/3xN78P8D","_blank","noopener,noreferrer"),o(!1)},"data-testid":"button-discord-community",children:[a.jsx(ZI,{className:"mr-4 h-5 w-5 flex-shrink-0"}),a.jsx("span",{className:"flex-1 text-left truncate",children:"Join Discord Community"}),a.jsx(Cl,{className:"ml-2 h-3 w-3 flex-shrink-0"})]})]})]})]})})]}),a.jsx(LF,{open:n,onOpenChange:r}),a.jsx("div",{className:"ml-2 sm:ml-4"}),a.jsx("div",{className:"ml-auto flex items-center space-x-2 sm:space-x-4",children:a.jsx("div",{className:"touch-target",children:a.jsx(iie,{})})})]})})}function Hm(){const{toast:e}=sn(),t=Lt(),{user:n}=Wt(),[r,s]=m.useState(null),[i,o]=m.useState(!1),[l,c]=m.useState(null),u=async $=>new Promise(j=>{let P=0;const D=30,C=()=>{P++;const H=t.getQueryData(["/api/subscription/status"]),V=t.getQueryData(["/api/subscription/freeze-status"]),O=$.freezeActive===void 0||(V==null?void 0:V.freezeActive)===$.freezeActive,G=$.subscriptionStatus===void 0||(H==null?void 0:H.subscriptionStatus)===$.subscriptionStatus;if(O&&G&&H&&V){j();return}if(P>=D){j();return}setTimeout(C,500)};C()}),d=async $=>(t.removeQueries({predicate:j=>{const P=j.queryKey[0];return typeof P=="string"&&(P.includes("subscription")||P.includes("freeze")||P.includes("auth")||P.includes("user")||P.includes("pricing"))}}),await t.invalidateQueries({predicate:j=>{const P=j.queryKey[0];return typeof P=="string"&&(P.includes("subscription")||P.includes("freeze")||P.includes("auth")||P.includes("user")||P.includes("pricing"))}}),await u($),!0),{data:h,isLoading:f}=tt({queryKey:["/api/subscription/status"],retry:!1,enabled:!!n,staleTime:0,gcTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0}),p=r?{...h,subscriptionStatus:r.subscriptionStatus||(h==null?void 0:h.subscriptionStatus),freezeActive:r.freezeActive??(h==null?void 0:h.freezeActive)}:h,g=gt({mutationFn:async()=>(await Xe("POST","/api/create-subscription")).json(),onSuccess:$=>{$.url&&(window.location.href=$.url)},onError:$=>
600{e({title:"Subscription Error",description:$.message||"Failed to create subscription",variant:"destructive"})}}),v=gt({mutationFn:async()=>{if(Ye()){const P=await(await Xe("POST","/api/subscription/billing-portal",{mobile:!0,callback_url:"com.repsshield.app://subscription"})).json();if(P.portalUrl)return await eb(P.portalUrl),{handledNatively:!0};throw new Error("Failed to get billing portal URL")}return(await Xe("POST","/api/create-portal-session")).json()},onSuccess:$=>{!Ye()&&($!=null&&$.url)?window.location.href=$.url:Ye()&&(t.invalidateQueries({queryKey:["/api/subscription/status"]}),t.invalidateQueries({queryKey:["/api/subscription/freeze-status"]}))},onError:$=>{e({title:"Portal Error",description:$.message||"Failed to open billing portal",variant:"destructive"})}}),{data:y,isLoading:x}=tt({queryKey:["/api/subscription/freeze-status"],retry:!1,enabled:!!n,staleTime:0,gcTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0}),b=r?{...y,freezeActive:r.freezeActive??(y==null?void 0:y.freezeActive)}:y,w=gt({mutationFn:async $=>(s({freezeActive:!0,subscriptionStatus:"suspended",isFrozen:!0}),o(!0),c({freezeActive:!0,subscriptionStatus:"suspended"}),(await Xe("POST","/api/subscription/freeze",$)).json()),onSuccess:async()=>{try{await d({freezeActive:!0,subscriptionStatus:"suspended"}),s(null),o(!1),c(null),e({title:"Subscription Paused",description:"Your subscription has been paused successfully."})}catch($){console.error("Failed to sync fresh data after freeze:",$),o(!1),c(null)}},onError:$=>{s(null),o(!1),e({title:"Pause Failed",description:$.message||"Failed to pause subscription",variant:"destructive"})}}),S=gt({mutationFn:async()=>(s({freezeActive:!1,subscriptionStatus:"active",isFrozen:!1}),o(!0),c({freezeActive:!1,subscriptionStatus:"active"}),(await Xe("POST","/api/subscription/resume")).json()),onSuccess:async $=>{try{await d({freezeActive:!1,subscriptionStatus:"active"}),s(null),o(!1),c(null),$.resumeType==="expired_with_credits"?e({title:"Subscription Renewed with Credits",description:$.message||`Your subscription has been renewed for ${$.serviceMonths} months using your available credits.`}):e({title:"Subscription Resumed",description:"Your subscription has been resumed successfully."})}catch(j){console.error("Failed to sync fresh data after resume:",j),o(!1),c(null)}},onError:$=>{s(null),o(!1),e({title:"Resume Failed",description:$.message||"Failed to resume subscription",variant:"destructive"})}}),_=()=>g.mutate(),E=()=>v.mutate(),R=$=>w.mutate($),A=()=>S.mutate(),N=(b==null?void 0:b.freezeActive)||!1,k=(p==null?void 0:p.isOnTrial)||!1,T=(p==null?void 0:p.isAdmin)||(n==null?void 0:n.isAdmin)||(p==null?void 0:p.hasActiveSubscription)&&!N||(p==null?void 0:p.hasManualPremiumAccess)||k&&!N||!1,I=(p==null?void 0:p.subscriptionTier)==="premium"||(p==null?void 0:p.isAdmin)||(n==null?void 0:n.isAdmin)||(p==null?void 0:p.hasManualPremiumAccess)||k&&!N||!1,F=w.isPending||i,L=S.isPending||i,M=w.isPending||S.isPending||i;return{subscription:p,isLoading:f,hasActiveSubscription:T,canAccessPremiumFeatures:T,hasPremiumTierAccess:I,isAdmin:(p==null?void 0:p.isAdmin)||(n==null?void 0:n.isAdmin)||!1,subscribe:_,manageBilling:E,isSubscribing:g.isPending,isManaging:v.isPending,isOnTrial:k,isFrozen:N,freezeStatus:b,freezeLoading:x,freezeSubscription:R,resumeSubscription:A,isFreezing:F,isResuming:L,isProcessingSubscriptionChange:M}}async function $F(e){return(await Xe("POST","/api/subscription/preview-upgrade",{priceType:e.priceType,tier:e.tier||"base"})).json()}async function xp(){if(Ye()){const r=await(await Xe("POST","/api/subscription/billing-portal",{mobile:!0,callback_url:"com.repsshield.app://subscription"})).json();if(r.portalUrl){await eb(r.portalUrl);return}throw new Error("Failed to get billing portal URL")}const t=await(await Xe("POST","/api/create-portal-session",{})).json();if(t.url)return t.url;throw new Error("Failed to get billing portal URL")}async function dc(e){const t=Ye();wa("checkout_started",{tier:e.tier||"base",interval:e.priceType});const r=await(await Xe("POST","/api/subscription/create-checkout",{priceType:e.priceType,tier:e.tier||"base",...t&&{mobile:!0,callback_url:"com.repss
600hield.app://subscription"},...!t&&e.successUrl&&{successUrl:e.successUrl},...!t&&e.cancelUrl&&{cancelUrl:e.cancelUrl}})).json();if(r.upgraded)return{upgraded:!0,plan:r.plan,message:r.message};if(r.checkoutUrl){if(t){if((await JT(r.checkoutUrl)).status==="success")return{upgraded:!0,plan:r.plan,message:"Subscription created successfully"};throw new Error("Subscription checkout was cancelled.")}return{upgraded:!1,checkoutUrl:r.checkoutUrl}}throw new Error("Unexpected response from subscription endpoint")}function P_(){return tt({queryKey:["/api/pricing"],staleTime:5*60*1e3,gcTime:10*60*1e3,retry:3})}const lie=bc("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),va=m.forwardRef(({className:e,variant:t,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:q(lie({variant:t}),e),...n}));va.displayName="Alert";const VF=m.forwardRef(({className:e,...t},n)=>a.jsx("h5",{ref:n,className:q("mb-1 font-medium leading-none tracking-tight",e),...t}));VF.displayName="AlertTitle";const Al=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:q("text-sm [&_p]:leading-relaxed",e),...t}));Al.displayName="AlertDescription";function Qs(e,t="usd"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e)}function aC(e,t){return Tse(e,t)}function BF({isOpen:e,onClose:t,targetPriceType:n,targetTier:r,onSuccess:s}){const{toast:i}=sn(),o=Lt(),[l,c]=m.useState(!1),[u,d]=m.useState(null),{data:h,isLoading:f,error:p}=tt({queryKey:["subscription","preview-upgrade",n,r],queryFn:()=>$F({priceType:n,tier:r}),enabled:e,retry:!1,staleTime:0,gcTime:0}),g=p?(p==null?void 0:p.message)||"Unable to calculate plan change preview. Please try again.":null,v=async()=>{if(h){c(!0);try{const T=await dc({priceType:n,tier:r,prorationDate:h.prorationDate});if(T.upgraded){const I=h.isDowngrade;i({title:"Plan Updated",description:T.message||(I?"Your subscription has been downgraded.":"Your subscription has been upgraded.")}),t(),s==null||s()}else T.checkoutUrl&&(window.location.href=T.checkoutUrl)}catch(T){if((T==null?void 0:T.status)===402){d((T==null?void 0:T.message)||"Your card was declined.");return}const I=h==null?void 0:h.isDowngrade;i({title:I?"Downgrade Failed":"Upgrade Failed",description:(T==null?void 0:T.message)||"Something went wrong. Please try again.",variant:"destructive"})}finally{c(!1)}}},y=async()=>{try{const T=await xp();T?window.location.href=T:window.location.reload()}catch{i({title:"Error",description:"Failed to open billing portal. Please try again.",variant:"destructive"})}},x=()=>{d(null),v()},b=T=>{!T&&!l&&(o.removeQueries({queryKey:["subscription","preview-upgrade",n,r]}),d(null),t())},w=(h==null?void 0:h.preview.currency)??"usd",S=aC(r,n),_=h?aC(h.currentPlan.tier,h.currentPlan.interval):"Current Plan",E=(h==null?void 0:h.isDowngrade)??!1,R=(h==null?void 0:h.isTierDowngrade)??!1,A=(h==null?void 0:h.preview.amountDue)??0,N=(h==null?void 0:h.preview.total)??0,k=(h==null?void 0:h.preview.creditAmount)??0;return a.jsx($s,{open:e,onOpenChange:b,children:a.jsxs(os,{className:"sm:max-w-[520px] p-0 gap-0 overflow-hidden",children:[a.jsxs("div",{className:`px-6 pt-6 pb-5 ${E?"bg-gradient-to-b from-amber-50/80 to-background dark:from-amber-950/20 dark:to-background":"bg-gradient-to-b from-emerald-50/80 to-background dark:from-emerald-950/20 dark:to-background"}`,children:[a.jsx(as,{className:"pb-0",children:a.jsxs("div",{className:"flex items-center gap-2.5 mb-1",children:[E?a.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-amber-100 dark:bg-amber-900/40",children:a.jsx(kH,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"})}):a.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-emerald-100 dark:bg-emerald-900/40",children:a.jsx(vo,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"})}),a.jsx(ls,{className:"text-lg font-semibold tracking-tight",children:E?"Confirm Plan Change":"Confirm Upgrade"})]})}),a.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[a.jsxs("div",{className:"flex-1 rounded-lg border bg-background/80 backdrop-blur-sm px-3 py-2.5",children:[a.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground
600/70 mb-0.5",children:"Current"}),a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:_})]}),a.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-8 h-8 rounded-full border-2 border-dashed border-muted-foreground/20",children:a.jsx(ts,{className:"h-3.5 w-3.5 text-muted-foreground/50"})}),a.jsxs("div",{className:`flex-1 rounded-lg border-2 px-3 py-2.5 ${E?"border-amber-200 bg-amber-50/50 dark:border-amber-800 dark:bg-amber-950/30":"border-emerald-200 bg-emerald-50/50 dark:border-emerald-800 dark:bg-emerald-950/30"}`,children:[a.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground/70 mb-0.5",children:"New Plan"}),a.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:S})]})]})]}),a.jsxs("div",{className:"px-6 pb-6",children:[f&&a.jsxs("div",{className:"py-12 flex flex-col items-center gap-3 text-muted-foreground",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-ping"}),a.jsx(ct,{className:"h-7 w-7 animate-spin relative"})]}),a.jsx("p",{className:"text-sm font-medium",children:"Calculating your proration..."})]}),g&&!f&&a.jsx("div",{className:"py-4",children:a.jsxs(va,{variant:"destructive",children:[a.jsx(bi,{className:"h-4 w-4"}),a.jsx(Al,{children:g})]})}),u&&!f&&a.jsxs("div",{className:"py-4 space-y-4",children:[a.jsxs(va,{variant:"destructive",children:[a.jsx($S,{className:"h-4 w-4"}),a.jsx(VF,{children:"Your card was declined"}),a.jsx(Al,{children:u})]}),a.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-3",children:[a.jsx(ie,{variant:"outline",onClick:t,className:"w-full sm:w-auto h-11 px-5 text-sm font-medium",children:"Cancel"}),a.jsx(ie,{variant:"outline",onClick:x,disabled:l,className:"w-full sm:w-auto h-11 px-5 text-sm font-medium",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-4 w-4 mr-2 animate-spin"}),"Retrying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dd,{className:"h-4 w-4 mr-2"}),"Try Again"]})}),a.jsxs(ie,{onClick:y,className:"w-full sm:w-auto h-11 px-6 text-sm font-semibold",children:[a.jsx($S,{className:"h-4 w-4 mr-2"}),"Update Payment Method"]})]})]}),h&&!f&&!u&&a.jsxs("div",{className:"space-y-5 pt-5",children:[R&&a.jsxs(va,{variant:"destructive",className:"border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-800 dark:bg-amber-950/50 dark:text-amber-200 [&>svg]:text-amber-600 dark:[&>svg]:text-amber-400",children:[a.jsx(bi,{className:"h-4 w-4"}),a.jsxs(Al,{className:"text-sm",children:["You will lose access to ",a.jsx("span",{className:"font-semibold",children:"Shield Advisor features"})," including AI Tax Advisor immediately after confirming."]})]}),a.jsx("div",{className:"rounded-xl border bg-card px-5 py-5 text-center",children:A===0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"No charge today"}),a.jsx("p",{className:"text-4xl font-bold tracking-tight text-foreground",children:"$0.00"}),k>0&&a.jsxs("p",{className:"text-sm text-emerald-600 dark:text-emerald-400 mt-2 font-medium",children:[E?`You'll receive a ${Qs(k,w)} credit`:`${Qs(k,w)} credit applied`,a.jsx("br",{}),a.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"Applied automatically to future invoices"})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:E?"Amount due today":"You'll be charged today"}),a.jsx("p",{className:"text-4xl sm:text-5xl font-bold tracking-tight text-foreground",children:Qs(A,w)}),k>0&&a.jsx("p",{className:"text-sm text-emerald-600 dark:text-emerald-400 mt-2 font-medium",children:E?`Includes ${Qs(k,w)} credit for unused time`:`${Qs(k,w)} credit applied`})]})}),h.preview.lineItems.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground mb-3",children:"Breakdown"}),a.jsxs("div",{className:"rounded-xl border bg-card divide-y divide-border",children:[h.preview.lineItems.map((T,I)=>a.jsxs("div",{className:"flex items-start justify-between gap-3 px-4 py-3 text-sm",children:[a.jsx("span",{className:"text-muted-foreground leading-snug break-words min-w-0 flex-1",children:T.description}),a.jsx("span",{className:`flex-shrink-0 font-semibold tabular-nums ${T.amount<0?"text-emerald-600 dark:text-emerald-400":"text-foreground"}`,children:T.amount<0?`−${Qs(Math.abs(T.amount),T.currency)}`:Qs(T.amount,T.currency)})]},I)),a.jsx("div",{className:"flex items-center justify-between px-4 py-3 bg-muted/30",children:N<0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Net credit"}),a.jsx("span",{className:"text-sm tabular-nums font-bold text-emerald-600 dark:text-emerald-400",children:Qs(Math.abs(N),w)})]}):N===0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Total"}),a.jsx("span",{className:"text-sm tabular-nums font-bold",children:"No charge"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Total due today"}),a.jsx("span",{className:"text-base tabular-nums font-bold text-foreground",children:Qs(N,w)})]})})]})]}),a.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg bg-muted/30 px-4 py-3",children:[a.jsx(Ud,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-muted-foreground
600/60"}),a.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:E?"Credits apply automatically to future invoices. Your plan changes take effect immediately. You can upgrade again at any time.":"Secured by Stripe. Your billing date won't change. You can adjust your plan anytime from your subscription settings."})]})]}),!u&&a.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-3 pt-6",children:[a.jsx(ie,{variant:"outline",onClick:t,disabled:l,className:"w-full sm:w-auto h-11 px-5 text-sm font-medium",children:"Cancel"}),E?a.jsx(ie,{variant:"outline",onClick:v,disabled:!h||f||l||!!g,className:"w-full sm:w-auto h-11 px-6 text-sm font-medium",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):"Confirm Downgrade"}):a.jsx(ie,{onClick:v,disabled:!h||f||l||!!g,className:"w-full sm:w-auto h-11 px-6 text-sm font-semibold bg-emerald-600 hover:bg-emerald-700 text-white shadow-md shadow-emerald-600/20 hover:shadow-lg hover:shadow-emerald-600/30 transition-all",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-4 w-4 mr-2 animate-spin"}),"Upgrading..."]}):a.jsxs("span",{className:"inline-flex items-center",children:[a.jsx(Jo,{className:"h-4 w-4 mr-2"}),"Confirm Upgrade"]})})]})]})]})})}function cie({isOpen:e,onClose:t,trialDaysRemaining:n,tier:r}){const[s,i]=m.useState(null),[o,l]=m.useState(null),{toast:c}=sn(),{data:u,isLoading:d}=P_(),h=async(S,_)=>{const E=`${_}_${S}`;i(E);try{await $F({priceType:S,tier:_}),i(null),l({priceType:S,tier:_})}catch{try{const A=window.location.origin,N=await dc({priceType:S,tier:_,successUrl:`${A}/?payment=success&upgraded=true`,cancelUrl:`${A}/?payment=cancelled`});N.upgraded?(c({title:"Plan Updated",description:N.message}),t(),window.location.reload()):N.checkoutUrl&&(window.location.href=N.checkoutUrl)}catch(A){const N=A;if((N==null?void 0:N.status)===409){c({title:"Already Subscribed",description:"Opening your billing portal…"});try{const k=await xp();k?window.location.href=k:window.location.reload();return}catch{}i(null);return}console.error("Upgrade error:",A),c({title:"Upgrade Error",description:(N==null?void 0:N.message)||"Failed to start upgrade process. Please try again.",variant:"destructive"}),i(null)}}},f=["Smart time tracking with AI","Audit-ready documentation","Gmail & Calendar sync","Voice-to-text logging","CSV & evidence exports","Analytics dashboard","REST API — connect your tools"],p=["AI Tax Advisor — ask REPS questions, get answers with IRS citations","Audit readiness score — know your risk before the IRS does","Personalized analysis based on your properties & hours","Full API Integration — build custom workflows and sync with your CPA's tools","Priority support from our team"],g=(u==null?void 0:u.monthlyPrice)??10,v=(u==null?void 0:u.annualPriceMin)??100,y=(u==null?void 0:u.premiumMonthlyPrice)??29,x=(u==null?void 0:u.premiumAnnualPrice)??279,b=y*12-x,w=s!==null;return a.jsxs(a.Fragment,{children:[o&&a.jsx(BF,{isOpen:o!==null,onClose:()=>l(null),targetPriceType:o.priceType,targetTier:o.tier,onSuccess:()=>{l(null),t(),window.location.reload()}}),a.jsx($s,{open:e,onOpenChange:t,children:a.jsxs(os,{className:"w-full max-w-4xl p-0 max-h-[90vh] flex flex-col",children:[a.jsxs(as,{className:"p-6 pb-0 flex-shrink-0",children:[a.jsx(ls,{className:"text-2xl font-bold",children:"Choose Your Plan"}),a.jsx(Eo,{className:"text-base",children:n!==void 0?a.jsx("span",{className:"text-orange-600 font-medium",children:n>0?`${n} days left in your trial • Upgrade now to keep your progress!`:"Your trial has ended • Choose a plan to continue"}):"Select the perfect plan for your real estate tracking needs"})]}),a.jsxs("div",{className:"p-6 overflow-y-auto flex-1 min-h-0",children:[a.jsxs("div",{className:"grid md:grid-cols-2 gap-4 items-stretch",children:[a.jsxs("div",{className:"relative flex flex-col rounded-xl border-2 border-border hover:border-green-300 hover:shadow-md transition-all duration-200 bg-card",children:[a.jsxs("div",{className:"p-5 pb-4 border-b border-border",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-1",children:"Shield Essential"}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"text-3xl font-bold text-foreground",children:d?"$--":`$${g}`}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d?"Loading...":`or $${v}/yr`}),a.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"Track hours, stay organized, and generate audit-ready reports."})]})]}),a.jsxs("div",{className:"p-5 flex flex-col flex-grow",children:[a.jsx("ul",{className:"space-y-2.5 flex-grow text-sm mb-5",children:f.map((S,_)=>a.jsxs("li",{className:"flex items-start gap-2.5",children:[a.jsx(Jo,{className:"h-4 w-4 text-green-500 flex-shrink-0 mt-0.5"}),a.jsx("span",{children:S})]},_))}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",className:"w-full text-sm border-green-600 text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 whitespace-normal h-auto py-2.5 min-h-[2.5rem]",onClick:()=>h("monthly","base"),disabled:w,children:s==="base_monthly"?"Processing...":`Monthly — $${g}/mo`}),a.jsx(ie,{className:"w-full text-sm bg-green-600 hover:bg-green-700 text-white whitespace-normal h-auto py-2.5 min-h-[2.5rem]",onClick:()=>h("annual","base"),disabled:w,children:s==="base_annual"?"Processing...":`Annual — $${v}/yr`})]})]})]}),a.jsxs("div",{className:"relative flex flex-col rounded-xl border-2 border-green-200 hover:border-green-400 hover:shadow-md transition-all duration-200 bg-gradient-to-br from-green-50/50 to-blue-50/50 dark:from-green-900/10 dark:to-blue-900/10",children:[a.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:a.jsxs(Is,{className:"bg-green-600 text-white px-3 py-0.5 text-xs flex items-center gap-1",children:[a.jsx(wH,{className:"h-3 w-3"}),"Most Popular"]})}),a.jsxs("div",{className:"p-5 pb-4 border-b border-green-200 dark:border-green-700 pt-7",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-green-700 dark:text-green-400 mb-1",children:"Shield Advisor"}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"text-3xl font-bold text-foreground",children:d?"$--":`$${y}`}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo"})]}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:d?"Loading...":`or $${x}/yr (save $${b})`}),a.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"AI advisor + audit scoring — know 
600where you stand before the IRS does."})]})]}),a.jsxs("div",{className:"p-5 flex flex-col flex-grow",children:[a.jsx("p",{className:"text-xs font-semibold text-green-700 dark:text-green-400 mb-2.5 uppercase tracking-wide",children:"Everything in Shield Essential, plus:"}),a.jsx("ul",{className:"space-y-2.5 flex-grow text-sm mb-5",children:p.map((S,_)=>a.jsxs("li",{className:"flex items-start gap-2.5",children:[a.jsx("div",{className:"flex items-center justify-center h-5 w-5 rounded-full bg-yellow-400 flex-shrink-0 mt-0.5",children:a.jsx(vo,{className:"h-3 w-3 text-white"})}),a.jsx("span",{children:S})]},_))}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",className:"w-full text-sm border-green-300 text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 whitespace-normal h-auto py-2.5 min-h-[2.5rem]",onClick:()=>h("monthly","premium"),disabled:w,children:s==="premium_monthly"?"Processing...":`Monthly — $${y}/mo`}),a.jsx(ie,{className:"w-full text-sm bg-green-600 hover:bg-green-700 text-white whitespace-normal h-auto py-2.5 min-h-[2.5rem]",onClick:()=>h("annual","premium"),disabled:w,children:s==="premium_annual"?"Processing...":`Annual — $${x}/yr`})]})]})]})]}),a.jsx("div",{className:"mt-6 text-center text-sm text-gray-600",children:a.jsx("p",{children:"✓ Secure payment via Stripe • ✓ Cancel anytime • ✓ No hidden fees"})})]})]})})]})}function uie(){const{user:e}=Wt(),{subscription:t}=Hm(),[n,r]=Pt(),[s,i]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(!1);m.useEffect(()=>{new URLSearchParams(n.split("?")[1]||"").get("upgrade")==="started"&&!o&&l(!0)},[n,o]),m.useEffect(()=>{const x=new URLSearchParams(n.split("?")[1]||""),b=n.split("?")[0];if(o)x.set("upgrade","started"),r(`${b}?${x.toString()}`);else{x.delete("upgrade");const w=x.toString();r(w?`${b}?${w}`:b)}},[o,r,n]),m.useEffect(()=>{const x=localStorage.getItem("trialBannerDismissed")==="true";u(x)},[]),m.useEffect(()=>{const x=t==null?void 0:t.isOnTrial,b=t==null?void 0:t.trialEndDate;if(x&&b){const w=new Date(b),S=new Date,_=w.getTime()-S.getTime(),E=Math.floor(_/(1e3*60*60*24));i(Math.max(0,E))}else i(null)},[t]);const h=!(t!=null&&t.isOnTrial)&&(t==null?void 0:t.hasUsedTrial)&&!(t!=null&&t.hasActiveSubscription)||s===1?{bgColor:"bg-destructive/10 border-destructive/20",textColor:"text-destructive",buttonColor:"bg-destructive hover:bg-destructive/90",icon:xi,iconColor:"text-destructive"}:s!==null&&s<=3?{bgColor:"bg-yellow-50 border-yellow-200 dark:bg-yellow-950/20 dark:border-yellow-800/30",textColor:"text-yellow-800 dark:text-yellow-300",buttonColor:"bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-700 dark:hover:bg-yellow-600",icon:bi,iconColor:"text-yellow-600 dark:text-yellow-400"}:{bgColor:"bg-blue-50 border-blue-200 dark:bg-blue-950/20 dark:border-blue-800/30",textColor:"text-blue-800 dark:text-blue-300",buttonColor:"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600",icon:YI,iconColor:"text-blue-600 dark:text-blue-400"},f=h.icon,p=()=>{u(!0),localStorage.setItem("trialBannerDismissed","true")},g=!(t!=null&&t.isOnTrial)&&(t==null?void 0:t.hasUsedTrial)&&!(t!=null&&t.hasActiveSubscription),v=(t==null?void 0:t.isOnTrial)&&s!==null,y=!(e!=null&&e.isAdmin)&&(v||g)&&!c;return a.jsxs(a.Fragment,{children:[y&&a.jsx("div",{className:`border-b ${h.bgColor}`,children:a.jsx("div",{className:"flex h-16 items-center container-mobile container-safe",children:a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(f,{className:`h-4 w-4 ${h.iconColor}`}),a.jsx("span",{className:`text-sm font-medium ${h.textColor}`,children:g?"Trial Expired • Choose a plan to continue":`${s} days remaining in your free trial`})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{size:"sm",onClick:()=>l(!0),className:`${h.buttonColor} text-white font-semibold rounded-md px-4 py-1`,children:[a.jsx(Cr,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]}),a.jsx("button",{onClick:p,className:"p-1 hover:bg-black/5 text-gray-400 hover:text-gray-600 dark:hover:bg-white/5 dark:hover:text-gray-300 rounded transition-colors","aria-label":"Dismiss banner",children:a.jsx(vn,{className:"h-4 w-4"})})]})]})})}),a.jsx(cie,{isOpen:o,onClose:()=>l(!1),trialDaysRemaining:g?0:s??void 0})]})}const lC="repsshield-sidebar-expanded";function die(){const[e,t]=m.useState(()=>{if(typeof window>"u")return!0;const s=localStorage.getItem(lC);return s!==null?JSON.parse(s):!0}),[n,r]=m.useState(!1);return m.useEffect(()=>{localStorage.setItem(lC,JSON.stringify(e))},[e]),{isSidebarExpanded:e,setIsSidebarExpanded:t,showSupportDialog:n,setShowSupportDialog:r}}function hie({children:e,offline:t=!1}){const[n,r]=Pt(),s=Io(),i=Ye()||s,{user:o,isAdmin:l}=Wt(),c=m.useRef(null),{isSidebarExpanded:u,setIsSidebarExpanded:d,showSupportDialog:h,setShowSupportDialog:f}=die();m.useEffect(()=>{jO()},[]),m.useEffect(()=>(document.body.classList.add("app"),document.documentElement.classList.add("app"),()=>{document.body.classList.remove("app"),document.documentElement.classList.remove("app")}),[]),m.useEffect(()=>{i&&requestAnimationFrame(()=>{var g;(g=c.current)==null||g.scrollTo({top:0,left:0,behavior:"auto"}),window.scrollTo({top:0,left:0,behavior:"auto"})})},[i,n]);const p=FF(o,l);return t?a.jsx(Jx,{}):a.jsxs("div",{className:"flex h-screen w-full overflow-hidden bg-gray-50 dark:bg-gray-900",children:[!i&&a.jsx(Kse,{navigationItems:p,isExpanded:u,onToggle:()=>d(!u),showSupportDialog:h,onSupportClick:()=>f(!0),location:n,setLocation:r}),a.jsxs("main",{className:q("flex-1 flex flex-col min-w-0 min-h-0",i&&"pt-safe-top"),children:[a.jsx(uie,{}),i?null:a.jsx(aie,{location:n,setLocation:r,showSupportDialog:h,setShowSupportDialog:f}),a.jsx("div",{ref:c,className:q("flex-1 overflow-y-auto overflow-x-hidden px-0 pt-0 md:p-4 min-h-0","pb-safe-bottom md:pb-4"),children:e})]}),a.jsx(Jx,{}),a.jsx(LF,{open:h,onOpenChange:f})]})}function fie(){var l,c,u,d,h,f;const{toast:e}=sn(),t=Lt(),{data:n}=tt({queryKey:["/api/auth/user"],refetchInterval:3e4,retry:!1,refetchOnWindowFocus:!0,staleTime:0}),r=n==null?void 0:n.impersonationStatus;m.useEffect(()=>{r!=null&&r.isImpersonating},[n,r]);const s=gt({mutationFn:async()=>{try{return await Xe("POST","/api/admin/exit-impersonation")}catch(p){throw console.error("Exit impersonation error:",p),p}},onSuccess:p=>{var g;t.invalidateQueries({queryKey:["/api/admin/impersonation-status"]}),t.invalidateQueries({queryKey:["/api/auth/user"]}
600),e({title:"Impersonation Ended",description:(g=p==null?void 0:p.originalUser)!=null&&g.email?`Returned to ${p.originalUser.email}`:"Successfully exited impersonation"}),setTimeout(()=>{window.location.reload()},1e3)},onError:p=>{console.error("Exit impersonation failed:",p),e({title:"Exit Failed",description:(p==null?void 0:p.message)||"Failed to exit impersonation. Please try again.",variant:"destructive"})}}),i=r;if(!(r!=null&&r.isImpersonating))return null;const o=p=>{const g=new Date(p),y=new Date().getTime()-g.getTime(),x=Math.floor(y/6e4);if(x<60)return`${x} minute${x!==1?"s":""}`;const b=Math.floor(x/60),w=x%60;return`${b} hour${b!==1?"s":""} ${w} minute${w!==1?"s":""}`};return a.jsx("div",{className:"sticky top-0 left-0 right-0 z-[100] bg-amber-50 border-b border-amber-200 shadow-sm mobile-optimized safe-area-top",children:a.jsx("div",{className:"max-w-7xl mx-auto px-2 sm:px-4 lg:px-8",children:a.jsxs(va,{className:"border-0 bg-transparent shadow-none p-2 sm:p-3",children:[a.jsxs("div",{className:"flex items-center justify-between sm:hidden",children:[a.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[a.jsx("div",{className:"bg-amber-100 p-1.5 rounded-full",children:a.jsx(rc,{className:"h-3 w-3 text-amber-600"})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("span",{className:"font-medium text-amber-900 text-xs truncate block",children:["Impersonating: ",((l=i.targetUser)==null?void 0:l.firstName)||((c=i.targetUser)==null?void 0:c.email)]})})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>s.mutate(),disabled:s.isPending,className:"bg-white hover:bg-amber-50 border-amber-300 text-amber-700 hover:text-amber-800 text-xs px-2 py-1 h-7 ml-2 flex-shrink-0",children:[a.jsx(ud,{className:"h-3 w-3 mr-1"}),"Exit"]})]}),a.jsxs("div",{className:"hidden sm:flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full",children:a.jsx(bi,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(rc,{className:"h-4 w-4 text-amber-600"}),a.jsx("span",{className:"font-medium text-amber-900",children:"Impersonating User"})]}),a.jsxs("div",{className:"text-sm text-amber-800",children:["You are logged in as"," ",a.jsx("strong",{children:(u=i.targetUser)!=null&&u.firstName?`${i.targetUser.firstName} ${i.targetUser.lastName||""}`.trim():(d=i.targetUser)==null?void 0:d.email})," ","(",(h=i.targetUser)==null?void 0:h.email,")",i.startedAt&&a.jsxs("span",{className:"ml-2 text-amber-700",children:["• Active for ",o(i.startedAt)]})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("div",{className:"text-xs text-amber-700 hidden lg:block",children:["Original: ",(f=i.originalUser)==null?void 0:f.email]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>s.mutate(),disabled:s.isPending,className:"bg-white hover:bg-amber-50 border-amber-300 text-amber-700 hover:text-amber-800",children:[a.jsx(ud,{className:"h-4 w-4 mr-2"}),"Exit Impersonation"]})]})]})]})})})}function pie(){const{isDemoMode:e,demoSubscriptionTier:t,exitDemoMode:n,toggleDemoSubscription:r,resetDemo:s}=HT();return e?a.jsx(ht,{className:"m-4 border-2 border-blue-500 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950 dark:to-indigo-950 shadow-lg",children:a.jsxs(yt,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Is,{variant:"secondary",className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 font-semibold px-3 py-1",children:"🎭 DEMO MODE"}),a.jsx(Is,{variant:t==="premium"?"default":"outline",className:t==="premium"?"bg-purple-100 dark:bg-purple-900 text-purple-800 dark:text-purple-200":"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200",children:t==="premium"?"💎 Premium User":"🆓 Free User"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(at,{htmlFor:"demo-tier-toggle",className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Subscription Tier:"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Free"}),a.jsx(_d,{id:"demo-tier-toggle",checked:t==="premium",onCheckedChange:r,className:"data-[state=checked]:bg-purple-600 dar
600k:data-[state=checked]:bg-purple-500"}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Premium"})]})]}),a.jsxs("div",{className:"hidden md:flex items-center gap-3 pl-4 border-l border-blue-200 dark:border-blue-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-blue-200 dark:bg-blue-800 flex items-center justify-center",children:a.jsx("span",{className:"text-xs font-medium text-blue-800 dark:text-blue-200",children:"SM"})}),a.jsxs("div",{className:"text-sm",children:[a.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:"Sarah Martinez"}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Real Estate Professional"})]})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{children:"🏢 12 Properties"}),a.jsx("span",{children:"📊 642 Hours"}),a.jsx("span",{children:"📈 85% REP Goal"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:s,className:"gap-2 hover:bg-blue-50 dark:hover:bg-blue-900 touch-target",children:[a.jsx(Pb,{className:"h-4 w-4"}),"Reset Demo"]}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:n,className:"gap-2 text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-950 touch-target",children:[a.jsx(vn,{className:"h-4 w-4"}),"Exit Demo"]})]})]}),a.jsx("div",{className:"mt-3 p-3 bg-white/50 dark:bg-gray-800/50 rounded-lg border border-blue-200 dark:border-blue-700",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(tR,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 mt-0.5"}),a.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:a.jsxs("p",{children:[a.jsx("strong",{children:"Demo Environment Active:"})," Experiencing REPSShield as Sarah Martinez with rich, realistic data spanning 12 properties and comprehensive time tracking history. Toggle subscription tiers to see feature differences. No real data will be affected."]})})]})})]})}):null}function mie(){Fz(),Lz();const[e]=Pt(),{user:t,isAuthenticated:n,isLoading:r}=Wt(),s=kb(e),{data:i,isLoading:o}=tt({queryKey:["/api/auth/user"],enabled:!!t,retry:!1,refetchOnMount:!1});if(m.useEffect(()=>{const l=AS(e);document.body.className=n&&!l?"app":"public-site"},[n,e]),n&&!r&&(e==="/login"||e==="/register"||e==="/"))return a.jsx(du,{to:"/dashboard"});if(!r&&!n&&!s){const l=encodeURIComponent(e);return a.jsx(du,{to:`/login?redirectTo=${l}`})}return r&&!s?null:n?a.jsx(m.Suspense,{fallback:a.jsx("div",{className:"min-h-screen"}),children:a.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 ${t&&i&&i.hasCompletedOnboardingForm!==!0,"min-h-screen"}`,children:[a.jsx(fie,{}),a.jsx(pie,{}),a.jsxs(jH,{user:t,userData:i,location:e,children:[t&&(i==null?void 0:i.accountOwnerId)!=null&&a.jsx(SJ,{user:t,userData:i,location:e}),t&&a.jsx(Ese,{userData:i,isUserDataLoading:o,location:e}),a.jsx(EJ,{userData:i,location:e,children:(!t||!i&&!o||i&&i.hasCompletedOnboardingForm===!0&&!i.accountOwnerId)&&(AS(e)?a.jsxs(Nf,{children:[ld.filter(l=>l.isLandingPage).map(({path:l,component:c})=>a.jsx(it,{path:l,component:c},l)),a.jsx(it,{component:()=>Ye()?a.jsx(du,{to:"/login"}):a.jsx(uR,{})})]}):a.jsx(hie,{children:a.jsx(kse,{})}))})]})]})}):a.jsx(m.Suspense,{fallback:a.jsx("div",{className:"min-h-screen"}),children:a.jsxs(Nf,{children:[ld.map(({path:l,component:c})=>a.jsx(it,{path:l,component:c},l)),a.jsx(it,{path:"*",children:()=>a.jsx(du,{to:Ye()?"/login":"/"})})]})})}function UF(){return a.jsx(mie,{})}const gie=Object.freeze(Object.defineProperty({__proto__:null,RouterShell:UF},Symbol.toStringTag,{value:"Module"}));function cC(e,t,n){t(n),e("offline")}function vie(e){const{onAuthenticated:t,onUnauthenticated:n,skipInitialCheck:r=!1}=e,s=Lt(),[i,o]=m.useState("offline"),[l,c]=m.useState(null),u=m.useRef(!0),d=m.useRef(!1),h=m.useRef(!1),f=m.useRef(!1),p=m.useRef(t),g=m.useRef(n);p.current=t,g.current=n;const v=m.useCallback(async()=>
600{if(!d.current){d.current=!0;try{if(!Z0()){h.current=!0,o("unauthenticated"),g.current(),d.current=!1;return}o("validating");const x=await fetch("/api/auth/user",{credentials:"include",cache:"no-cache"});if(!u.current)return;if(x.ok){const b=await x.json().catch(()=>null);b&&s.setQueryData(["/api/auth/user"],b),f.current=!0,o("live"),p.current()}else x.status===401?(await BT(),h.current=!0,o("unauthenticated"),g.current()):cC(o,c,`Server error: ${x.status}`)}catch(x){if(!u.current)return;cC(o,c,x instanceof Error?x.message:"Network error")}finally{d.current=!1}}},[s]);m.useEffect(()=>{if(!r)return v(),()=>{u.current=!1}},[v,r]),m.useEffect(()=>{const x=()=>h.current||f.current,b=()=>{document.visibilityState==="visible"&&(x()||v())},w=()=>{x()||v()};return document.addEventListener("visibilitychange",b),window.addEventListener("online",w),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("online",w)}},[v]);const y=m.useCallback(()=>{o("offline"),c(null),f.current=!1,h.current=!1,setTimeout(v,0)},[v]);return{phase:i,validationError:l,revalidate:y}}function yie({children:e,isAuthChecking:t=!1,showMobileNav:n=!0}){return m.useEffect(()=>{jO()},[]),m.useEffect(()=>(document.body.classList.add("app"),document.documentElement.classList.add("app"),()=>{document.body.classList.remove("app"),document.documentElement.classList.remove("app")}),[]),a.jsxs("div",{className:"flex h-screen w-full overflow-hidden bg-gray-50 dark:bg-gray-900",children:[a.jsx("main",{className:"flex-1 flex flex-col min-w-0 min-h-0 pt-safe-top",children:a.jsx("div",{className:q("flex-1 overflow-y-auto overflow-x-hidden px-0 pt-0 md:p-4 min-h-0","pb-safe-bottom md:pb-4"),children:e})}),n&&a.jsx(Jx,{offline:!0,isAuthChecking:t})]})}function xie(){return a.jsx("div",{className:"fixed bottom-16 md:bottom-4 left-0 right-0 z-40 pointer-events-none",children:a.jsxs("div",{className:"bg-black/60 backdrop-blur-sm text-white text-sm py-2 px-4 flex items-center justify-center gap-2",children:[a.jsx(bie,{className:"animate-spin h-4 w-4"}),a.jsx("span",{children:"Checking authentication..."})]})})}function bie({className:e}){return a.jsxs("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),a.jsx("path",{d:"M21 3v5h-5"})]})}function A_(){return a.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-40 pointer-events-none","data-testid":"minimal-loading",role:"status","aria-live":"polite","aria-label":"Loading content",children:a.jsxs("div",{className:"mascot-container",children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield",className:"bouncing-mascot"}),a.jsx("div",{className:"mascot-shadow"})]})})}var dh=e=>e.type==="checkbox",sa=e=>e instanceof Date,Sn=e=>e==null;const zF=e=>typeof e=="object";var Yt=e=>!Sn(e)&&!Array.isArray(e)&&zF(e)&&!sa(e),s0=e=>Yt(e)&&e.target?dh(e.target)?e.target.checked:e.target.value:e,HF=(e,t)=>t.split(".").some((n,r,s)=>!isNaN(Number(n))&&e.has(s.slice(0,r).join("."))),WF=e=>{const t=e.constructor&&e.constructor.prototype;return Yt(t)&&t.hasOwnProperty("isPrototypeOf")},Wm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Zt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Wm&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Yt(e)&&WF(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=Zt(e[s]));return r}const Hi={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Jr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Kr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},qF="root",GF=["__proto__","constructor","prototype"],wie=/^\w*$/;var hh=e=>wie.test(e),Dt=e=>e===void 0;const _ie=/[.[\]'"]/;var qm=e=>
vendor: 6,086 bytes, line 600
600e.split(_ie).filter(Boolean),ye=(e,t,n)=>{if(!t||!Yt(e))return n;const r=hh(t)?[t]:qm(t);if(r.some(i=>GF.includes(i)))return n;const s=r.reduce((i,o)=>Sn(i)?void 0:i[o],e);return Dt(s)||s===e?Dt(e[t])?n:e[t]:s},br=e=>typeof e=="boolean",In=e=>typeof e=="function",St=(e,t,n)=>{let r=-1;const s=hh(t)?[t]:qm(t),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let c=n;if(r!==o){const u=e[l];c=Yt(u)||Array.isArray(u)?u:isNaN(+s[r+1])?{}:[]}if(GF.includes(l))return;e[l]=c,e=e[l]}};const I_=Re.createContext(null);I_.displayName="HookFormControlContext";const R_=()=>Re.useContext(I_);var KF=(e,t,n,r=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Jr.all&&(t._proxyFormState[o]=!r||Jr.all),n&&(n[o]=!0),e[o]}});return s};const M_=Wm?Re.useLayoutEffect:Re.useEffect;function kie(e){const t=R_(),{control:n=t,disabled:r,name:s,exact:i}=e||{},[o,l]=Re.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=Re.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return M_(()=>n._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!r&&l({...n._formState,...u,defaultValues:n._defaultValues})}}),[s,r,i]),Re.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),Re.useMemo(()=>KF(o,n,c.current,!1),[o,n])}var Rn=e=>typeof e=="string",i0=(e,t,n,r,s)=>Rn(e)?(r&&t.watch.add(e),ye(n,e,s)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ye(n,i))):(r&&(t.watchAll=!0),n),o0=e=>Sn(e)||!zF(e);const uC=(e,t)=>t.length===0&&!Array.isArray(e)&&!WF(e);function wr(e,t,n=new WeakMap){if(e===t)return!0;if(o0(e)||o0(t))return Object.is(e,t);if(sa(e)&&sa(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;if(uC(e,r)||uC(t,s))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=n.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const o=new WeakSet;o.add(t),n.set(e,o)}for(const o of r){const l=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(sa(l)&&sa(c)||(Yt(l)||Array.isArray(l))&&(Yt(c)||Array.isArray(c))?!wr(l,c,n):!Object.is(l,c))return!1}}return!0}function YF(e){const t=R_(),{control:n=t,name:r,defaultValue:s,disabled:i,exact:o,compute:l}=e||{},c=Re.useRef(s),u=Re.useRef(l),d=Re.useRef(void 0),h=Re.useRef(n),f=Re.useRef(r);u.current=l;const[p,g]=Re.useState(()=>{const S=n._getWatch(r,c.current);return u.current?u.current(S):S}),v=Re.useCallback(S=>{const _=i0(r,n._names,S||n._formValues,!1,c.current);return u.current?u.current(_):_},[n._formValues,n._names,r]),y=Re.useCallback(S=>{if(!i){const _=i0(r,n._names,S||n._formValues,!1,c.current);if(u.current){const E=u.current(_);wr(E,d.current)||(g(E),d.current=E)}else g(_)}},[n._formValues,n._names,i,r]);M_(()=>((h.current!==n||!wr(f.current,r))&&(h.current=n,f.current=r,y()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:S=>{y(S.values)}})),[n,o,r,y]),Re.useEffect(()=>n._removeUnmounted());const x=h.current!==n,b=f.current,w=Re.useMemo(()=>{if(i)return null;const S=!x&&!wr(b,r);return x||S?v():null},[i,x,r,b,v]);return w!==null?w:p}function Sie(e){const t=R_(),{name:n,disabled:r,control:s=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=HF(s._names.array,n),u=Re.useMemo(()=>ye(s._formValues,n,ye(s._defaultValues,n,o)),[s,n,o]),d=YF({control:s,name:n,defaultValue:u,exact:l}),h=kie({control:s,name:n,exact:l}),f=Re.useRef(e),p=Re.useRef(null),g=Re.useRef(s.register(n,{...e.rules,value:d,...br(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const v=Re.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ye(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!ye(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ye(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ye(h.validatingFields,n)},error:{enumerable:!0,get:()=>ye(h.errors,n)}}),[h,n]),y=Re.useCallback(S=>{const _=s0(S);return ye(s._fields,n)||(g.current=s.register(n,{...f.current.rules,value:_})),g.current.onChange({target:{value:s0(S),name:n},type:Hi.CHANGE})},[n,s]),x=Re.useCallback(()=>g.current.onBlur({target:{value:ye(s._formValues,n),name:n},type:Hi.BLUR}),[n,s._formValues]),b=Re.useCallback(S=>{S&&(p.current={focus:()=>In(S.focus)&&S.focus(),select:()=>In(S.select)&&S.select(),setCustomValidity:E=>In(S.setCustomValidity)&&S.setCustomValidity(E),reportValidity:()=>In(S.reportValidity)&&S.reportValidity()});const _=ye(s._fields,n);_&&_._f&&S&&(_._f.ref=p.current)},[s._fields,n]),w=Re.useMemo(()=>({name:n,value:d,...br(r)||h.disabled?{disabled:h.disabled||r}:{},onChange:y,onBlur:x,ref:b}),[n,r,h.disabled,y,x,b,d]);return Re.useEffect(()=>{const S=s._options.shouldUnregister||i;s.register(n,{...f.current.rules,...br(f.current.disabled)?{disabled:f.current.disabled}:{}});const _=(E,R)=>{const A=ye(s._fields,E);A&&A._f&&(A._f.mount=R)};if(_(n,!0),S){const E=Zt(ye(i?s._defaultValues:s._options.values||s._defaultValues,n,ye(s._options.defaultValues,n,f.current.defaultValue)));St(s._defaultValues,n,E),Dt(ye(s._formValues,n))&&St(s._formValues,n,E)}if(!c&&s.register(n),p.current){const E=ye(s._fields,n);E&&E._f&&(E._f.ref=p.current)}return()=>{(c?S&&!s._state.action:S)?s.unregister(n):_(n,!1)}},[n,s,c,i]),Re.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),Re.useMemo(()=>({field:w,formState:h,fieldState:v}),[w,h,v])}const Eie=e=>e.render(Sie(e)),O_=Re.createContext(null);O_.displayName="HookFormContext";const Nie=()=>Re.useContext(O_),Cie=({children:e,watch:t,getValues:n,getFieldState:r,setError:s,clearErrors:i,setValue:o,setValues:l,trigger:c,formState:u,resetField:d,reset:h,handleSubmit:f,unregister:p,control:g,register:v,setFocus:y,subscribe:x})=>{const b=Re.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:s,clearErrors:i,setValue:o,setValues:l,trigger:c,formState:u,resetField:d,reset:h,handleSubmit:f,unregister:p,control:g,register:v,setFocus:y,subscribe:x}),[i,g,u,r,n,f,v,h,d,s,y,o,l,x,c,p,t]);return Re.createElement(O_.Provider,{value:b},Re.createElement(I_.Provider,{value:b.control},e))};
600var QF=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},ZF=e=>Array.isArray(e)?e.filter(Boolean):[],wf=e=>Array.isArray(e)?e:[e],dC=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function XF(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const s=e[r],i=t[r];if(s&&Yt(s)&&i){const o=XF(s,i);Yt(o)&&(n[r]=o)}else e[r]&&(n[r]=i)}return n}var _n=e=>Yt(e)&&!Object.keys(e).length,D_=e=>e.type==="file",bp=e=>{if(!Wm)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},JF=e=>e.type==="select-multiple",L_=e=>e.type==="radio",jie=e=>L_(e)||dh(e),Dv=e=>bp(e)&&e.isConnected;function Tie(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;){if(Sn(e)){e=void 0;break}e=e[t[r]],r++}return e}function Pie(e){for(const t in e)if(e.hasOwnProperty(t)&&!Dt(e[t]))return!1;return!0}function ln(e,t){if(Rn(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:hh(t)?[t]:qm(t),r=n.length===1?e:Tie(e,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(Yt(r)&&_n(r)||Array.isArray(r)&&Pie(r))&&ln(e,n.slice(0,-1)),e}var Aie=e=>{for(const t in e)if(In(e[t]))return!0;return!1};function e5(e){return Array.isArray(e)||Yt(e)&&!Aie(e)}function a0(e,t={}){for(const n in e){const r=e[n];e5(r)?(t[n]=Array.isArray(r)?[]:{},a0(r,t[n])):Dt(r)||(t[n]=!0)}return t}function l0(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(n=>l0(n));return t.some(n=>n!==void 0)?t:void 0}if(Yt(e)){const t={};for(const n in e){const r=l0(e[n]);Dt(r)||(t[n]=r)}return Object.keys(t).length?t:void 0}}}function Zo(e,t,n){n||(n=a0(t));for(const r in e){const s=e[r];if(e5(s))Dt(t)||o0(n[r])?n[r]=a0(s,Array.isArray(s)?[]:{}):Zo(s,Sn(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!wr(s,i)}}return l0(n)||{}}const hC={value:!1,isValid:!1},fC={value:!0,isValid:!0};var t5=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Dt(e[0].attributes.value)?Dt(e[0].value)||e[0].value===""?fC:{value:e[0].value,isValid:!0}:fC:hC}return hC},n5=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Dt(e)?e:t?e===""?NaN:e&&+e:n&&Rn(e)?new Date(e):r?r(e):e;const pC={isValid:!1,value:null};var r5=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,pC):pC;function mC(e){const t=e.ref;return D_(t)?t.files:L_(t)?r5(e.refs).value:JF(t)?[...t.selectedOptions].map(({value:n})=>n):dh(t)?t5(e.refs).value:n5(Dt(t.value)?e.ref.value:t.value,e)}var Iie=(e,t,n,r)=>{const s={};for(const i of e){const o=ye(t,i);o&&St(s,i,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},wp=e=>e instanceof RegExp,tu=e=>Dt(e)?e:wp(e)?e.source:Yt(e)?wp(e.value)?e.value.source:e.value:e,Hh=e=>({isOnSubmit:!e||e===Jr.onSubmit,isOnBlur:e===Jr.onBlur,isOnChange:e===Jr.onChange,isOnAll:e===Jr.all,isOnTouch:e===Jr.onTouched});const gC="AsyncFunction";var Rie=e=>{if(!e||!e.validate)return!1;if(In(e.validate))return e.validate.constructor.name===gC;if(Yt(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===gC)return!0}return!1},Mie=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Lv=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&e.charAt(r.length)===".")return!0;return!1};const Hu=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const i=ye(e,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Hu(l,t))break}else if(Yt(l)&&Hu(l,t))break}}};function vC(e,t,n){const r=ye(e,n);if(r||hh(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=ye(t,i),l=ye(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:n}}var Oie=(e,t,n,r)=>{n(e);const{name:s,...i}=e,o=Object.keys(i);return!o.length||r&&o.length>=Object.keys(t).length||o.find(l=>t[l]===(!r||Jr.all))},Die=(e,t,n)=>!e||!t||e===t||wf(e).some(r=>
600r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),Lie=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,Fie=(e,t)=>!ZF(ye(e,t)).length&&ln(e,t),yC=(e,t,n)=>{const r=ye(e,n),s=Array.isArray(r)?r:[];return St(s,qF,t[n]),St(e,n,s),e};function xC(e,t,n="validate"){if(Rn(e)||Array.isArray(e)&&e.every(Rn)||br(e)&&!e)return{type:n,message:Rn(e)?e:"",ref:t}}var al=e=>Yt(e)&&!wp(e)?e:{value:e,message:""},bC=async(e,t,n,r,s,i)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:d,min:h,max:f,pattern:p,validate:g,name:v,valueAsNumber:y,mount:x}=e._f,b=ye(n,v);if(!x||t.has(v))return{};const w=l?l[0]:o,S=I=>{if(s&&w.reportValidity){const F=br(I)?"":I||"";l?l.forEach(L=>L.setCustomValidity(F)):w.setCustomValidity(F),w.reportValidity()}},_={},E=L_(o),R=dh(o),A=E||R,N=(y||D_(o))&&Dt(o.value)&&Dt(b)||bp(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,k=QF.bind(null,v,r,_),T=(I,F,L,M=Kr.maxLength,$=Kr.minLength)=>{const j=I?F:L;_[v]={type:I?M:$,message:j,ref:o,...k(I?M:$,j)}};if(i?!Array.isArray(b)||!b.length:c&&(!A&&(N||Sn(b))||br(b)&&!b||R&&!t5(l).isValid||E&&!r5(l).isValid)){const{value:I,message:F}=Rn(c)?{value:!!c,message:c}:al(c);if(I&&(_[v]={type:Kr.required,message:F,ref:w,...k(Kr.required,F)},!r))return S(F),_}if(!N&&(!Sn(h)||!Sn(f))){let I,F;const L=al(f),M=al(h);if(!Sn(b)&&!isNaN(b)){const $=o.valueAsNumber||b&&+b;Sn(L.value)||(I=$>L.value),Sn(M.value)||(F=$<M.value)}else{const $=o.valueAsDate||new Date(b),j=C=>new Date(new Date().toDateString()+" "+C),P=o.type=="time",D=o.type=="week";Rn(L.value)&&b&&(I=P?j(b)>j(L.value):D?b>L.value:$>new Date(L.value)),Rn(M.value)&&b&&(F=P?j(b)<j(M.value):D?b<M.value:$<new Date(M.value))}if((I||F)&&(T(!!I,L.message,M.message,Kr.max,Kr.min),!r))return S(_[v].message),_}if((u||d)&&!N&&(Rn(b)||i&&Array.isArray(b))){const I=al(u),F=al(d),L=!Sn(I.value)&&b.length>+I.value,M=!Sn(F.value)&&b.length<+F.value;if((L||M)&&(T(L,I.message,F.message),!r))return S(_[v].message),_}if(p&&!N&&Rn(b)){const{value:I,message:F}=al(p);if(wp(I)&&!b.match(I)&&(_[v]={type:Kr.pattern,message:F,ref:o,...k(Kr.pattern,F)},!r))return S(F),_}if(g){if(In(g)){const I=await g(b,n),F=xC(I,w);if(F&&(_[v]={...F,...k(Kr.validate,F.message)},!r))return S(F.message),_}else if(Yt(g)){let I={};for(const F in g){if(!_n(I)&&!r)break;const L=xC(await g[F](b,n),w,F);L&&(I={...L,...k(F,L.message)},S(L.message),r&&(_[v]=I))}if(!_n(I)&&(_[v]={ref:w,...I},!r))return _}}return S(!0),_};const $ie={mode:Jr.onSubmit,reValidateMode:Jr.onChange,shouldFocusError:!0},Fv="form",s5={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Vie(e={}){let t={...$ie,...e},n={...Zt(s5),isLoading:In(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},s=Yt(t.defaultValues)||Yt(t.values)?Zt(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Zt(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,u=0,d=0,h=Hh(t.mode),f=Hh(t.reValidateMode);const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...p};let v={...g};const y={array:dC(),state:dC()},x=t.criteriaMode===Jr.all,b=B=>W=>{clearTimeout(u),u=setTimeout(B,W)},w=async B=>{if(!o.keepIsValid&&!t.disabled&&(g.isValid||v.isValid||B)){let W;t.resolver?(W=_n((await F()).errors),S()):W=await $({fields:r,onlyCheckValid:!0,eventType:Hi.VALID}),W!==n.isValid&&y.state.next({isValid:W})}},S=(B,W)=>{!t.disabled&&(g.isValidating||g.validatingFields||v.isValidating||v.validatingFields)&&((B||Array.from(l.mount)).forEach(Y=>{Y&&(W?St(n.validatingFields,Y,W):ln(n.validatingFields,Y))}),y.state.next({validatingFields:n.validatingFields,isValidating:!_n(n.validatingFields)}))},_=()=>{n.dirtyFields=Zo(s,i)},E=(B,W=[],Y,oe,de=!0,be=!0)=>{if(oe&&Y&&!t.disabled){if(o.action=!0,be&&Array.isArray(ye(r,B))){const fe=Y(ye(r,B),oe.argA,oe.argB);de&&St(r,B,fe)}if(be&&Array.isArray(ye(n.errors,B))){const fe=Y(ye(n.errors,B),oe.argA,oe.argB);de&&St(n.errors,B,fe),Fie(n.errors,B)}if((g.touchedFields||v.touchedFields)&&be&&Array.isArray(ye(n.touchedFields,B))){const fe=Y(ye(n.touchedFields,B),oe.argA,oe.argB);de&&St(n.touchedFields,B,fe)}(g.dirtyFields||v.dirtyFields)&&_(),y.state.next({name:B,isDirty:P(B,W),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else St(i,B,W)},R=(B,W)=>{St(n.errors,B,W),n.errors={...n.errors},y.state.next({errors:n.errors})},A=B=>{n.errors=B,y.state.next({errors:n.errors,isValid:!1})},N=B=>{const W=hh(B)?[B]:qm(B);let Y=i,oe=s;for(let de=0;de<W.length-1;de++){const be=W[de];if(Y=Sn(Y)?Y:Y[be],oe=Sn(oe)?oe:oe[be],Y===null&&oe!==null)return!0}return!1},k=(B,W,Y,oe)=>{const de=ye(r,B);if(de){if(N(B))return;const be=Dt(ye(i,B)),fe=ye(i,B,Dt(Y)?ye(s,B):Y);Dt(fe)||oe&&oe.defaultChecked||W?St(i,B,W?fe:mC(de._f)):H(B,fe),o.mount&&!o.action&&(w(),be&&n.isDirty&&(g.isDirty||v.isDirty)&&
600(P()||(n.isDirty=!1,y.state.next({...n}))),e.shouldUnregister&&be&&!Dt(ye(i,B))&&Lv(B,l)&&(o.watch=!0))}},T=(B,W,Y,oe,de)=>{let be=!1,fe=!1;const _e={name:B};if(!t.disabled){if(!Y||oe){const Oe=wr(ye(s,B),W);(g.isDirty||v.isDirty)&&(fe=n.isDirty,n.isDirty=_e.isDirty=!Oe||P(),be=fe!==_e.isDirty),fe=!!ye(n.dirtyFields,B),Oe!==n.isDirty?n.dirtyFields=Zo(s,i):Oe?ln(n.dirtyFields,B):St(n.dirtyFields,B,!0),_e.dirtyFields=n.dirtyFields,be=be||(g.dirtyFields||v.dirtyFields)&&fe!==!Oe}if(Y){const Oe=ye(n.touchedFields,B);Oe||(St(n.touchedFields,B,Y),_e.touchedFields=n.touchedFields,be=be||(g.touchedFields||v.touchedFields)&&Oe!==Y)}be&&de&&y.state.next(_e)}return be?_e:{}},I=(B,W,Y,oe)=>{const de=ye(n.errors,B),be=(g.isValid||v.isValid)&&br(W)&&n.isValid!==W;if(t.delayError&&Y?(c=b(()=>R(B,Y)),c(t.delayError)):(clearTimeout(u),c=null,Y?St(n.errors,B,Y):ln(n.errors,B),n.errors={...n.errors}),(Y?!wr(de,Y):de)||!_n(oe)||be){const fe={...oe,...be&&br(W)?{isValid:W}:{},errors:n.errors,name:B};n={...n,...fe},y.state.next(fe)}},F=async B=>(S(B,!0),await t.resolver(i,t.context,Iie(B||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),L=async B=>{const{errors:W}=await F(B);if(S(B),B){for(const Y of B){const oe=ye(W,Y);oe?l.array.has(Y)&&Yt(oe)&&!Object.keys(oe).some(de=>!Number.isNaN(Number(de)))?yC(n.errors,{[Y]:oe},Y):St(n.errors,Y,oe):ln(n.errors,Y)}n.errors={...n.errors}}else n.errors=W;return W},M=async({name:B,eventType:W})=>{if(e.validate){const Y=await e.validate({formValues:i,formState:n,name:B,eventType:W});if(Yt(Y))for(const oe in Y){const de=Y[oe];de&&se(`${Fv}.${oe}`,{message:Rn(de.message)?de.message:"",type:de.type||Kr.validate})}else Rn(Y)||!Y?se(Fv,{message:Y||"",type:Kr.validate}):ge(Fv);return Y}return!0},$=async({fields:B,onlyCheckValid:W,name:Y,eventType:oe,context:de={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(de.runRootValidation=!0,!await M({name:Y,eventType:oe})&&(de.valid=!1,W)))return de.valid;for(const be in B){const fe=B[be];if(fe){const{_f:_e,...Oe}=fe;if(_e){const qt=l.array.has(_e.name),mr=fe._f&&Rie(fe._f),qa=g.validatingFields||g.isValidating||v.validatingFields||v.isValidating;mr&&qa&&S([_e.name],!0);const Ws=await bC(fe,l.disabled,i,x,t.shouldUseNativeValidation&&!W,qt);if(mr&&qa&&S([_e.name]),Ws[_e.name]&&(de.valid=!1,W)||(!W&&(ye(Ws,_e.name)?qt?yC(n.errors,Ws,_e.name):St(n.errors,_e.name,Ws[_e.name]):ln(n.errors,_e.name)),e.shouldUseNativeValidation&&Ws[_e.name]))break}!_n(Oe)&&await $({context:de,onlyCheckValid:W,fields:Oe,name:be,eventType:oe})}}return de.valid},j=()=>{for(const B of l.unMount){const W=ye(r,B);W&&(W._f.refs?W._f.refs.every(Y=>!Dv(Y)):!Dv(W._f.ref))&&$e(B)}l.unMount=new Set},P=(B,W)=>!t.disabled&&(B&&W&&St(i,B,W),!wr(o.mount?i:s,s)),D=(B,W,Y)=>i0(B,l,{...o.mount?i:Dt(W)?s:Rn(B)?{[B]:W}:W},Y,W),C=B=>ZF(ye(o.mount?i:s,B,t.shouldUnregister?ye(s,B,[]):[])),H=(B,W,Y={},oe=!1,de=!1)=>{const be=ye(r,B);let fe=W;if(be){const _e=be._f;_e&&(!_e.disabled&&St(i,B,n5(W,_e)),fe=bp(_e.ref)&&Sn(W)?"":W,JF(_e.ref)?[..._e.ref.options].forEach(Oe=>Oe.selected=fe.includes(Oe.value)):_e.refs?dh(_e.ref)?_e.refs.forEach(Oe=>{(!Oe.defaultChecked||!Oe.disabled)&&(Array.isArray(fe)?Oe.checked=!!fe.find(qt=>qt===Oe.value):Oe.checked=fe===Oe.value||!!fe)}):_e.refs.forEach(Oe=>Oe.checked=Oe.value===fe):D_(_e.ref)?_e.ref.value="":(_e.ref.value=fe,!_e.ref.type&&!de&&y.state.next({name:B,values:oe?i:Zt(i)})))}(Y.shouldDirty||Y.shouldTouch)&&T(B,fe,Y.shouldTouch,Y.shouldDirty,!de),Y.shouldValidate&&ne(B)},V=(B,W,Y,oe=!1,de=!1)=>{for(const be in W){if(!W.hasOwnProperty(be))return;const fe=W[be],_e=B+"."+be,Oe=ye(r,_e);(l.array.has(B)||Yt(fe)||Oe&&!Oe._f)&&!sa(fe)?V(_e,fe,Y,oe,de):H(_e,fe,Y,oe,de)}},O=(B,W,Y,oe,de=!1)=>{const be=ye(r,B),fe=l.array.has(B),_e=oe?W:Zt(W),Oe=ye(i,B),qt=wr(Oe,_e);if(qt||St(i,B,_e),fe)y.array.next({name:B,values:oe?i:Zt(i)}),(g.isDirty||g.dirtyFields||v.isDirty||v.dirtyFields)&&Y.shouldDirty&&(_(),de||y.state.next({name:B,dirtyFields:n.dirtyFields,isDirty:P(B,_e)}));else{const mr=Array.isArray(_e)&&!_e.length||_n(_e);!be||be._f||Sn(_e)||mr?H(B,_e,Y,oe,de):V(B,_e,Y,oe,de)}if(!qt&&!de){const mr=Lv(B,l),qa=oe?i:Zt(i);y.state.next({...mr&&n,name:o.mount||mr?B:void 0,values:qa})}},G=(B,W,Y={})=>O(B,W,Y,!1),Z=(B,W={})=>{const Y=In(B)?B(i):B;if(!wr(i,Y)){i={...i,...Y};for(const oe of l.mount)O(oe,ye(Y,oe),W,!0,!0);y.state.next({...n,name:void 0,type:void 0,...d?{values:i}:{}}),W.shouldValidate&&w()}},ae=async B=>{o.mount=!0;const W=B.target;let Y=W.name,oe=!0;const de=ye(r,Y),be=fe=>{oe=Number.isNaN(fe)||sa(fe)&&isNaN(fe.getTime())||wr(fe,ye(i,Y,fe))};if(de){let fe,_e;const Oe=W.type?mC(de._f):s0(B),qt=B.type===Hi.BLUR||B.type===Hi.FOCUS_OUT,mr=!Mie(de._f)&&!e.validate&&!t.resolver&&!ye(n.errors,Y)&&!de._f.deps,qa=mr||Lie(qt,ye(n.touchedFields,Y),n.isSubmitted,f,h),Ws=Lv(Y,l,qt);
600St(i,Y,Oe),qt?(!W||!W.readOnly)&&(de._f.onBlur&&de._f.onBlur(B),c&&c(0)):de._f.onChange&&de._f.onChange(B);const Rc=T(Y,Oe,qt),y$=!_n(Rc)||Ws;if(!qt&&y.state.next({name:Y,type:B.type,...d?{values:Zt(i)}:{}}),qa)return(!mr||!n.isValid)&&(g.isValid||v.isValid)&&(t.mode==="onBlur"?qt&&w():qt||w()),y$&&y.state.next({name:Y,...Ws?{}:Rc});if(!t.resolver&&e.validate&&await M({name:Y,eventType:B.type}),!qt&&Ws&&y.state.next({...n}),t.resolver){const{errors:A1}=await F([Y]);if(S([Y]),be(Oe),!oe){!_n(Rc)&&y.state.next(Rc);return}const x$=vC(n.errors,r,Y),I1=vC(A1,r,x$.name||Y);fe=I1.error,Y=I1.name,_e=_n(A1)}else S([Y],!0),fe=(await bC(de,l.disabled,i,x,t.shouldUseNativeValidation))[Y],S([Y]),be(Oe),oe&&(fe?_e=!1:(g.isValid||v.isValid)&&(_e=await $({fields:r,onlyCheckValid:!0,name:Y,eventType:B.type})));oe&&(de._f.deps&&(!Array.isArray(de._f.deps)||de._f.deps.length>0)&&ne(de._f.deps),I(Y,_e,fe,Rc))}},te=(B,W)=>{if(ye(n.errors,W)&&B.focus)return B.focus(),1},ne=async(B,W={})=>{let Y,oe;const de=wf(B);if(t.resolver){const be=await L(Dt(B)?B:de);Y=_n(be),oe=B?!de.some(fe=>ye(be,fe)):Y}else B?(oe=(await Promise.all(de.map(async be=>{const fe=ye(r,be);return await $({fields:fe&&fe._f?{[be]:fe}:fe,eventType:Hi.TRIGGER})}))).every(Boolean),!(!oe&&!n.isValid)&&w()):oe=Y=await $({fields:r,name:B,eventType:Hi.TRIGGER});return y.state.next({...!Rn(B)||(g.isValid||v.isValid)&&Y!==n.isValid?{}:{name:B},...t.resolver||!B?{isValid:Y}:{},errors:n.errors}),W.shouldFocus&&!oe&&Hu(r,te,B?de:l.mount),oe},re=(B,W)=>{let Y={...o.mount?i:s};return W&&(Y=XF(W.dirtyFields?n.dirtyFields:n.touchedFields,Y)),Dt(B)?Y:Rn(B)?ye(Y,B):B.map(oe=>ye(Y,oe))},J=(B,W)=>({invalid:!!ye((W||n).errors,B),isDirty:!!ye((W||n).dirtyFields,B),error:ye((W||n).errors,B),isValidating:!!ye(n.validatingFields,B),isTouched:!!ye((W||n).touchedFields,B)}),ge=B=>{const W=B?wf(B):void 0;W==null||W.forEach(Y=>ln(n.errors,Y)),W?W.forEach(Y=>{y.state.next({name:Y,errors:n.errors})}):y.state.next({errors:{}})},se=(B,W,Y)=>{const oe=(ye(r,B,{_f:{}})._f||{}).ref,de=ye(n.errors,B)||{},{ref:be,message:fe,type:_e,...Oe}=de;St(n.errors,B,{...Oe,...W,ref:oe}),y.state.next({name:B,errors:n.errors,isValid:!1}),Y&&Y.shouldFocus&&oe&&oe.focus&&oe.focus()},ke=(B,W)=>{if(In(B)){d++;const{unsubscribe:Y}=y.state.subscribe({next:de=>"values"in de&&B(de.values||D(void 0,W),de)});let oe=!1;return{unsubscribe:()=>{oe||(oe=!0,d--,Y())}}}return D(B,W,!0)},Me=B=>{var W;const Y=!!(!((W=B.formState)===null||W===void 0)&&W.values);Y&&d++;const{unsubscribe:oe}=y.state.subscribe({next:be=>{if(Die(B.name,be.name,B.exact)&&Oie(be,B.formState||g,X,B.reRenderRoot)){const fe={...i};B.callback({values:fe,...n,...be,defaultValues:s})}}});if(!Y)return oe;let de=!1;return()=>{de||(de=!0,d--,oe())}},Be=B=>(o.mount=!0,v={...v,...B.formState},Me({...B,formState:{...p,...B.formState}})),$e=(B,W={})=>{for(const Y of B?wf(B):l.mount)l.mount.delete(Y),l.array.delete(Y),W.keepValue||(ln(r,Y),ln(i,Y)),!W.keepError&&ln(n.errors,Y),!W.keepDirty&&ln(n.dirtyFields,Y),!W.keepTouched&&ln(n.touchedFields,Y),!W.keepIsValidating&&ln(n.validatingFields,Y),!t.shouldUnregister&&!W.keepDefaultValue&&ln(s,Y);y.state.next({values:Zt(i)}),y.state.next({...n,...W.keepDirty?{isDirty:P()}:{}}),!W.keepIsValid&&w()},We=({disabled:B,name:W})=>{if(br(B)&&o.mount||B||l.disabled.has(W)){const de=l.disabled.has(W)!==!!B;B?l.disabled.add(W):l.disabled.delete(W),de&&o.mount&&!o.action&&w()}},Qt=(B,W={})=>{let Y=ye(r,B);const oe=br(W.disabled)||br(t.disabled),de=!l.registerName.has(B)&&Y&&Y._f&&!Y._f.mount;return St(r,B,{...Y||{},_f:{...Y&&Y._f?Y._f:{ref:{name:B}},name:B,mount:!0,...W}}),l.mount.add(B),Y&&!de?We({disabled:br(W.disabled)?W.disabled:t.disabled,name:B}):k(B,!0,W.value),{...oe?{disabled:W.disabled||t.disabled}:{},...t.progressive?{required:!!W.required,min:tu(W.min),max:tu(W.max),minLength:tu(W.minLength),maxLength:tu(W.maxLength),pattern:tu(W.pattern)}:{},name:B,onChange:ae,onBlur:ae,ref:be=>{if(be){l.registerName.add(B),Qt(B,W),l.registerName.delete(B),Y=ye(r,B);const fe=Dt(be.value)&&be.querySelectorAll&&be.querySelectorAll("input,select,textarea")[0]||be,_e=jie(fe),Oe=Y._f.refs||[];if(_e?Oe.find(qt=>qt===fe):fe===Y._f.ref)return;St(r,B,{_f:{...Y._f,..._e?{refs:[...Oe.filter(Dv),fe,...Array.isArray(ye(s,B))?[{}]:[]],ref:{type:fe.type,name:B}}:{ref:fe}}}),k(B,!1,void 0,fe)}else Y=ye(r,B,{}),Y._f&&(Y._f.mount=!1),(t.shouldUnregister||W.shouldUnregister)&&!(HF(l.array,B)&&o.action)&&l.unMount.add(B)}}},Le=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Hu(r,te,l.mount),dt=B=>{br(B)&&(y.state.next({disabled:B}),Hu(r,(W,Y)=>{const oe=ye(r,Y);oe&&(W.disabled=oe._f.disabled||B,Array.isArray(oe._f.refs)&&oe._f.refs.forEac
600h(de=>{de.disabled=oe._f.disabled||B}))},0,!1))},jn=(B,W)=>async Y=>{let oe;Y&&(Y.preventDefault&&Y.preventDefault(),Y.persist&&Y.persist());let de=Zt(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:be,values:fe}=await F();S(),n.errors=be,de=Zt(fe)}else await $({fields:r,eventType:Hi.SUBMIT});if(l.disabled.size)for(const be of l.disabled)ln(de,be);if(ln(n.errors,qF),_n(n.errors)){y.state.next({errors:{}});try{await B(de,Y)}catch(be){oe=be}}else W&&await W({...n.errors},Y),Le(),setTimeout(Le);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:_n(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},pr=(B,W={})=>{ye(r,B)&&(Dt(W.defaultValue)?G(B,Zt(ye(s,B))):(G(B,W.defaultValue),St(s,B,Zt(W.defaultValue))),W.keepTouched||ln(n.touchedFields,B),W.keepDirty||(ln(n.dirtyFields,B),n.isDirty=W.defaultValue?P(B,Zt(ye(s,B))):P()),W.keepError||(ln(n.errors,B),g.isValid&&w()),y.state.next({...n}))},fn=(B,W={})=>{const Y=B?Zt(B):s,oe=Zt(Y),de=_n(B),be=oe;if(W.keepDefaultValues||(s=Y),!W.keepValues){if(W.keepDirtyValues){const fe=new Set([...l.mount,...Object.keys(Zo(s,i))]);for(const _e of Array.from(fe)){const Oe=ye(n.dirtyFields,_e),qt=ye(i,_e),mr=ye(be,_e);Oe&&!Dt(qt)?St(be,_e,qt):!Oe&&!Dt(mr)&&G(_e,mr)}}else{if(Wm&&Dt(B))for(const fe of l.mount){const _e=ye(r,fe);if(_e&&_e._f){const Oe=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(bp(Oe)){const qt=Oe.closest("form");if(qt){qt.reset();break}}}}if(W.keepFieldsRef)for(const fe of l.mount)G(fe,ye(be,fe));else r={}}if(t.shouldUnregister){if(i=W.keepDefaultValues?Zt(s):{},W.keepFieldsRef)for(const fe of l.mount)St(i,fe,ye(be,fe))}else i=Zt(be);y.array.next({values:{...be}}),y.state.next({values:{...be}})}l={mount:W.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!g.isValid||!!W.keepIsValid||!!W.keepDirtyValues||!t.shouldUnregister&&!_n(be),o.watch=!!t.shouldUnregister,o.keepIsValid=!!W.keepIsValid,o.action=!1,W.keepErrors||(n.errors={}),y.state.next({submitCount:W.keepSubmitCount?n.submitCount:0,isDirty:de?!1:W.keepDirty?n.isDirty:W.keepValues?P():!!(W.keepDefaultValues&&!wr(B,s)),isSubmitted:W.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:de?{}:W.keepDirtyValues?W.keepDefaultValues&&i?Zo(s,i):n.dirtyFields:W.keepDefaultValues&&B?Zo(s,B):W.keepDirty?n.dirtyFields:{},touchedFields:W.keepTouched?n.touchedFields:{},errors:W.keepErrors?n.errors:{},isSubmitSuccessful:W.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},fs=(B,W)=>fn(In(B)?B(i):B,{...t.resetOptions,...W}),on=(B,W={})=>{const Y=ye(r,B),oe=Y&&Y._f;if(oe){const de=oe.refs?oe.refs[0]:oe.ref;de.focus&&setTimeout(()=>{de.focus(),W.shouldSelect&&In(de.select)&&de.select()})}},X=B=>{n={...n,...B}},Ge={control:{register:Qt,unregister:$e,getFieldState:J,handleSubmit:jn,setError:se,_subscribe:Me,_runSchema:F,_updateIsValidating:S,_focusError:Le,_getWatch:D,_getDirty:P,_setValid:w,_setFieldArray:E,_setDisabledField:We,_setErrors:A,_getFieldArray:C,_reset:fn,_resetDefaultValues:()=>In(t.defaultValues)&&t.defaultValues().then(B=>{fs(B,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:j,_disableForm:dt,_subjects:y,_proxyFormState:g,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(B){o=B},get _defaultValues(){return s},get _names(){return l},set _names(B){l=B},get _formState(){return n},get _options(){return t},set _options(B){t={...t,...B},h=Hh(t.mode),f=Hh(t.reValidateMode)}},subscribe:Be,trigger:ne,register:Qt,handleSubmit:jn,watch:ke,setValue:G,setValues:Z,getValues:re,reset:fs,resetField:pr,resetDefaultValues:(B,W={})=>{if(s=Zt(B),!W.keepDirty){const Y=Zo(s,i);n.dirtyFields=Y,n.isDirty=!_n(Y)}W.keepIsValid||w(),y.state.next({...n,defaultValues:s})},clearErrors:ge,unregister:$e,setError:se,setFocus:on,getFieldState:J};return{...Ge,formControl:Ge}}function F_(e={}){const t=Re.useRef(void 0),n=Re.useRef(void 0),r=Re.useRef(e.formControl),[s,i]=Re.useState(()=>({...Zt(s5),isLoading:In(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:In(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!In(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...c}=Vie(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,M_(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,l},[o]),Re.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),Re.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),Re.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),Re.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),Re.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),Re.useEffect(()=>{var l;e.values&&!wr(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),n.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),Re.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Re.useMemo(()=>KF(s,o),[o,s]),t.current}const wC=(e,t,n)=>{if(e&&"reportValidity"in e){const r=ye(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},i5=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?wC(r.ref,n,e):r.refs&&r.refs.forEac
vendor: 4,613 bytes, line 600
600h(s=>wC(s,n,e))}},Bie=(e,t)=>{t.shouldUseNativeValidation&&i5(e,t);const n={};for(const r in e){const s=ye(t.fields,r),i=Object.assign(e[r]||{},{ref:s&&s.ref});if(Uie(t.names||Object.keys(e),r)){const o=Object.assign({},ye(n,r));St(o,"root",i),St(n,r,o)}else St(n,r,i)}return n},Uie=(e,t)=>e.some(n=>n.startsWith(t+"."));var zie=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(h){return e.push(h)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=QF(o,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},$_=function(e,t,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return i.shouldUseNativeValidation&&i5({},i),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:Bie(zie(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}};const V_=Cie,o5=m.createContext({}),Sr=({...e})=>a.jsx(o5.Provider,{value:{name:e.name},children:a.jsx(Eie,{...e})}),Gm=()=>{const e=m.useContext(o5),t=m.useContext(a5),{getFieldState:n,formState:r}=Nie(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},a5=m.createContext({}),Wn=m.forwardRef(({className:e,...t},n)=>{const r=m.useId();return a.jsx(a5.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:q("space-y-2",e),...t})})});Wn.displayName="FormItem";const qn=m.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=Gm();return a.jsx(at,{ref:n,className:q(r&&"text-destructive",e),htmlFor:s,...t})});qn.displayName="FormLabel";const ir=m.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:i}=Gm();return a.jsx(FI,{ref:t,id:r,"aria-describedby":n?`${s} ${i}`:`${s}`,"aria-invalid":!!n,...e})});ir.displayName="FormControl";const B_=m.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Gm();return a.jsx("p",{ref:n,id:r,className:q("text-base text-muted-foreground",e),...t})});B_.displayName="FormDescription";const or=m.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:i}=Gm(),o=s?String((s==null?void 0:s.message)??""):t;return o?a.jsx("p",{ref:r,id:i,className:q("text-base font-medium text-destructive",e),...n,children:o}):null});or.displayName="FormMessage";var wt;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(wt||(wt={}));var _C;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(_C||(_C={}));const Ne=wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wi=e=>{switch(typeof e){case"undefined":return Ne.undefined;case"string":return Ne.string;case"number":return Number.isNaN(e)?Ne.nan:Ne.number;case"boolean":return Ne.boolean;case"function":return Ne.function;case"bigint":return Ne.bigint;case"symbol":return Ne.symbol;case"object":return Array.isArray(e)?Ne.array:e===null?Ne.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ne.promise:typeof Map<"u"&&e instanceof Map?Ne.map:typeof Set<"u"&&e instanceof Set?Ne.set:typeof Date<"u"&&e instanceof Date?Ne.date:Ne.object;default:return Ne.unknown}}
vendor: 4,785 bytes, line 600
600,pe=wt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),g0e=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ur extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(this),r}static assert(t){if(!(t instanceof Ur))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ur.create=e=>new Ur(e);const Cd=(e,t)=>{let n;switch(e.code){case pe.invalid_type:e.received===Ne.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case pe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,wt.jsonStringifyReplacer)}`;break;case pe.unrecognized_keys:n=`Unrecognized key(s) in object: ${wt.joinValues(e.keys,", ")}`;break;case pe.invalid_union:n="Invalid input";break;case pe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${wt.joinValues(e.options)}`;break;case pe.invalid_enum_value:n=`Invalid enum value. Expected ${wt.joinValues(e.options)}, received '${e.received}'`;break;case pe.invalid_arguments:n="Invalid function arguments";break;case pe.invalid_return_type:n="Invalid function return type";break;case pe.invalid_date:n="Invalid date";break;case pe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:wt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case pe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case pe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case pe.custom:n="Invalid input";break;case pe.invalid_intersection_types:n="Intersection results could not be merged";break;case pe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case pe.not_finite:n="Number must be finite";break;default:n=t.defaultError,wt.assertNever(e)}return{message:n}};let l5=Cd;function v0e(e){l5=e}function c0(){return l5}const u0=e=>
vendor: 17,905 bytes, line 600
600{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:i,message:l}},y0e=[];function Ee(e,t){const n=c0(),r=u0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Cd?void 0:Cd].filter(s=>!!s)});e.common.issues.push(r)}class Zn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return qe;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Zn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return qe;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const qe=Object.freeze({status:"aborted"}),_u=e=>({status:"dirty",value:e}),dr=e=>({status:"valid",value:e}),kC=e=>e.status==="aborted",SC=e=>e.status==="dirty",hc=e=>e.status==="valid",_p=e=>typeof Promise<"u"&&e instanceof Promise;var je;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(je||(je={}));class Vs{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const EC=(e,t)=>{if(hc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ur(e.common.issues);return this._error=n,this._error}}};function nt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:s}}class ut{get description(){return this._def.description}_getType(t){return Wi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Zn,ctx:{common:t.parent.common,data:t.data,parsedType:Wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(_p(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wi(t)},s=this._parseSync({data:t,path:r.path,parent:r});return EC(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wi(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return hc(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>hc(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wi(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(_p(s)?s:Promise.resolve(s));return EC(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),l=()=>i.addIssue({code:pe.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ni({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return gi.create(this,this._def)}nullable(){return Pa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rs.create(this)}promise(){return Td.create(this,this._def)}or(t){return Np.create([this,t],this._def)}and(t){return Cp.create(this,t,this._def)}transform(t){return new Ni({...nt(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ip({...nt(this._def),innerType:this,defaultValue:n,typeName:Qe.ZodDefault})}brand(){return new h5({typeName:Qe.ZodBranded,type:this,...nt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Rp({...nt(this._def),innerType:this,catchValue:n,typeName:Qe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Km.create(this,t)}readonly(){return Mp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hie=/^c[^\s-]{8,}$/i,Wie=/^[0-9a-z]+$/,qie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Kie=/^[a-z0-9_-]{21}$/i,Yie=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qie=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zie=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xie="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $v;const Jie=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eoe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,toe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,noe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,roe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,soe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,c5="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ioe=new RegExp(`^${c5}$`);function u5(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ooe(e){return new RegExp(`^${u5(e)}$`)}function aoe(e){let t=`${c5}T${u5(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function loe(e,t){return!!((t==="v4"||!t)&&Jie.test(e)||(t==="v6"||!t)&&toe.test(e))}function coe(e,t){if(!Yie.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function uoe(e,t){return!!((t==="v4"||!t)&&eoe.test(e)||(t==="v6"||!t)&&noe.test(e))}class Ns extends ut{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ne.string){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:Ne.string,received:i.parsedType}),qe}const r=new Zn;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(t,s),o?Ee(s,{code:pe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&Ee(s,{code:pe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Zie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"email",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")$v||($v=new RegExp(Xie,"u")),$v.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"emoji",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Gie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"uuid",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Kie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"nanoid",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Hie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"cuid",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Wie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"cuid2",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")qie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"ulid",code:pe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),Ee(s,{validation:"url",code:pe.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"regex",code:pe.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?aoe(i).test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?ioe.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ooe(i).test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Qie.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"duration",code:pe.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?loe(t.data,i.version)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"ip",code:pe.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?coe(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"jwt",code:pe.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?uoe(t.data,i.version)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"cidr",code:pe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?roe.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"base64",code:pe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?soe.test(t.data)||(s=this._getOrReturnCtx(t,s),Ee(s,{validation:"base64url",code:pe.invalid_string,message:i.message}),r.dirty()):wt.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:pe.invalid_string,...je.errToObj(r)})}_addCheck(t){return new Ns({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...je.errToObj(t)})}url(t){return this._addCheck({kind:"url",...je.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...je.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...je.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...je.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...je.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...je.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...je.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...je.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...je.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...je.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...je.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...je.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...je.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...je.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...je.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...je.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...je.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...je.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...je.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...je.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...je.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...je.errToObj(n)})}nonempty(t){return this.min(1,je.errToObj(t))}trim(){return new Ns({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ns({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ns({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}
vendor: 4,672 bytes, line 600
600get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ns.create=e=>new Ns({checks:[],typeName:Qe.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...nt(e)});function doe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class Ca extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ne.number){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:Ne.number,received:i.parsedType}),qe}let r;const s=new Zn;for(const i of this._def.checks)i.kind==="int"?wt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?doe(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_finite,message:i.message}),s.dirty()):wt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,je.toString(n))}setLimit(t,n,r,s){return new Ca({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:je.toString(s)}]})}_addCheck(t){return new Ca({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:je.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:je.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:je.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&wt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}
vendor: 4,896 bytes, line 600
600}Ca.create=e=>new Ca({checks:[],typeName:Qe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...nt(e)});class ja extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ne.bigint)return this._getInvalidInput(t);let r;const s=new Zn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):wt.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Ee(n,{code:pe.invalid_type,expected:Ne.bigint,received:n.parsedType}),qe}gte(t,n){return this.setLimit("min",t,!0,je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,je.toString(n))}setLimit(t,n,r,s){return new ja({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:je.toString(s)}]})}_addCheck(t){return new ja({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:je.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ja.create=e=>new ja({checks:[],typeName:Qe.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...nt(e)});class kp extends ut{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ne.boolean){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.boolean,received:r.parsedType}),qe}return dr(t.data)}}kp.create=e=>new kp({typeName:Qe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...nt(e)});class fc extends ut{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ne.date){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:Ne.date,received:i.parsedType}),qe}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_date}),qe}const r=new Zn;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),Ee(s,{code:pe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):wt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new fc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:je.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:je.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}fc.create=e=>new fc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...nt(e)});class d0 extends ut{_parse(t){if(this._getType(t)!==Ne.symbol){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.symbol,received:r.parsedType}),qe}return dr(t.data)}}d0.create=e=>new d0({typeName:Qe.ZodSymbol,...nt(e)});class Sp extends ut{_parse(t){if(this._getType(t)!==Ne.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.undefined,received:r.parsedType}),qe}return dr(t.data)}}Sp.create=e=>new Sp({typeName:Qe.ZodUndefined,...nt(e)});class Ep extends ut{_parse(t){if(this._getType(t)!==Ne.null){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.null,received:r.parsedType}),qe}return dr(t.data)}}Ep.create=e=>new Ep({typeName:Qe.ZodNull,...nt(e)});
vendor: 5,687 bytes, line 600
600class jd extends ut{constructor(){super(...arguments),this._any=!0}_parse(t){return dr(t.data)}}jd.create=e=>new jd({typeName:Qe.ZodAny,...nt(e)});class Il extends ut{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dr(t.data)}}Il.create=e=>new Il({typeName:Qe.ZodUnknown,...nt(e)});class Co extends ut{_parse(t){const n=this._getOrReturnCtx(t);return Ee(n,{code:pe.invalid_type,expected:Ne.never,received:n.parsedType}),qe}}Co.create=e=>new Co({typeName:Qe.ZodNever,...nt(e)});class h0 extends ut{_parse(t){if(this._getType(t)!==Ne.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.void,received:r.parsedType}),qe}return dr(t.data)}}h0.create=e=>new h0({typeName:Qe.ZodVoid,...nt(e)});class Rs extends ut{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Ne.array)return Ee(n,{code:pe.invalid_type,expected:Ne.array,received:n.parsedType}),qe;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(Ee(n,{code:o?pe.too_big:pe.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(Ee(n,{code:pe.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(Ee(n,{code:pe.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Vs(n,o,n.path,l)))).then(o=>Zn.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Vs(n,o,n.path,l)));return Zn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Rs({...this._def,minLength:{value:t,message:je.toString(n)}})}max(t,n){return new Rs({...this._def,maxLength:{value:t,message:je.toString(n)}})}length(t,n){return new Rs({...this._def,exactLength:{value:t,message:je.toString(n)}})}nonempty(t){return this.min(1,t)}}Rs.create=(e,t)=>new Rs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...nt(t)});function ul(e){if(e instanceof en){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=gi.create(ul(r))}return new en({...e._def,shape:()=>t})}else return e instanceof Rs?new Rs({...e._def,type:ul(e.element)}):e instanceof gi?gi.create(ul(e.unwrap())):e instanceof Pa?Pa.create(ul(e.unwrap())):e instanceof Ei?Ei.create(e.items.map(t=>ul(t))):e}class en extends ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=wt.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ne.object){const u=this._getOrReturnCtx(t);return Ee(u,{code:pe.invalid_type,expected:Ne.object,received:u.parsedType}),qe}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Co&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=i[u],h=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Vs(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Co){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Ee(s,{code:pe.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const h=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Vs(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const h=await d.key,f=await d.value;u.push({key:h,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>Zn.mergeObjectSync(r,u)):Zn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return je.errToObj,new en({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:je.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new en({...this._def,unknownKeys:"strip"})}passthrough(){return new en({...this._def,unknownKeys:"passthrough"})}extend(t){return new en({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new en({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Qe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new en({...this._def,catchall:t})}pick(t){const n={};for(const r of wt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}omit(t){const n={};for(const r of wt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}deepPartial(){return ul(this)}partial(t){const n={};for(const r of wt.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new en({...this._def,shape:()=>n})}required(t){const n={};for(const r of wt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof gi;)i=i._def.innerType;n[r]=i}return new en({...this._def,shape:()=>n})}keyof(){return d5(wt.objectKeys(this.shape))}}en.create=(e,t)=>
vendor: 6,193 bytes, line 600
600new en({shape:()=>e,unknownKeys:"strip",catchall:Co.create(),typeName:Qe.ZodObject,...nt(t)});en.strictCreate=(e,t)=>new en({shape:()=>e,unknownKeys:"strict",catchall:Co.create(),typeName:Qe.ZodObject,...nt(t)});en.lazycreate=(e,t)=>new en({shape:e,unknownKeys:"strip",catchall:Co.create(),typeName:Qe.ZodObject,...nt(t)});class Np extends ut{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new Ur(l.ctx.common.issues));return Ee(n,{code:pe.invalid_union,unionErrors:o}),qe}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new Ur(c));return Ee(n,{code:pe.invalid_union,unionErrors:l}),qe}}get options(){return this._def.options}}Np.create=(e,t)=>new Np({options:e,typeName:Qe.ZodUnion,...nt(t)});const ri=e=>e instanceof Tp?ri(e.schema):e instanceof Ni?ri(e.innerType()):e instanceof Pp?[e.value]:e instanceof Ta?e.options:e instanceof Ap?wt.objectValues(e.enum):e instanceof Ip?ri(e._def.innerType):e instanceof Sp?[void 0]:e instanceof Ep?[null]:e instanceof gi?[void 0,...ri(e.unwrap())]:e instanceof Pa?[null,...ri(e.unwrap())]:e instanceof h5||e instanceof Mp?ri(e.unwrap()):e instanceof Rp?ri(e._def.innerType):[];class U_ extends ut{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ne.object)return Ee(n,{code:pe.invalid_type,expected:Ne.object,received:n.parsedType}),qe;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ee(n,{code:pe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),qe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const i of n){const o=ri(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);s.set(l,i)}}return new U_({typeName:Qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...nt(r)})}}function f0(e,t){const n=Wi(e),r=Wi(t);if(e===t)return{valid:!0,data:e};if(n===Ne.object&&r===Ne.object){const s=wt.objectKeys(t),i=wt.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=f0(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Ne.array&&r===Ne.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],l=t[i],c=f0(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Ne.date&&r===Ne.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Cp extends ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(kC(i)||kC(o))return qe;const l=f0(i.value,o.value);return l.valid?((SC(i)||SC(o))&&n.dirty(),{status:n.value,value:l.data}):(Ee(r,{code:pe.invalid_intersection_types}),qe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Cp.create=(e,t,n)=>new Cp({left:e,right:t,typeName:Qe.ZodIntersection,...nt(n)});class Ei extends ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.array)return Ee(r,{code:pe.invalid_type,expected:Ne.array,received:r.parsedType}),qe;if(r.data.length<this._def.items.length)return Ee(r,{code:pe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),qe;!this._def.rest&&r.data.length>this._def.items.length&&(Ee(r,{code:pe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Vs(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Zn.mergeArray(n,o)):Zn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Ei({...this._def,rest:t})}}Ei.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ei({items:e,typeName:Qe.ZodTuple,rest:null,...nt(t)})};class jp extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.object)return Ee(r,{code:pe.invalid_type,expected:Ne.object,received:r.parsedType}),qe;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Vs(r,l,r.path,l)),value:o._parse(new Vs(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?Zn.mergeObjectAsync(n,s):Zn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ut?new jp({keyType:t,valueType:n,typeName:Qe.ZodRecord,...nt(r)}):new jp({keyType:Ns.create(),valueType:t,typeName:Qe.ZodRecord,...nt(n)})}}class p0 extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.map)return Ee(r,{code:pe.invalid_type,expected:Ne.map,received:r.parsedType}),qe;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>
vendor: 9,305 bytes, line 600
600({key:s._parse(new Vs(r,l,r.path,[u,"key"])),value:i._parse(new Vs(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return qe;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return qe;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}p0.create=(e,t,n)=>new p0({valueType:t,keyType:e,typeName:Qe.ZodMap,...nt(n)});class pc extends ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.set)return Ee(r,{code:pe.invalid_type,expected:Ne.set,received:r.parsedType}),qe;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Ee(r,{code:pe.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Ee(r,{code:pe.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return qe;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>i._parse(new Vs(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new pc({...this._def,minSize:{value:t,message:je.toString(n)}})}max(t,n){return new pc({...this._def,maxSize:{value:t,message:je.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}pc.create=(e,t)=>new pc({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...nt(t)});class Wu extends ut{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ne.function)return Ee(n,{code:pe.invalid_type,expected:Ne.function,received:n.parsedType}),qe;function r(l,c){return u0({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,c0(),Cd].filter(u=>!!u),issueData:{code:pe.invalid_arguments,argumentsError:c}})}function s(l,c){return u0({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,c0(),Cd].filter(u=>!!u),issueData:{code:pe.invalid_return_type,returnTypeError:c}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof Td){const l=this;return dr(async function(...c){const u=new Ur([]),d=await l._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(r(c,p)),u}),h=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(h,i).catch(p=>{throw u.addIssue(s(h,p)),u})})}else{const l=this;return dr(function(...c){const u=l._def.args.safeParse(c,i);if(!u.success)throw new Ur([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),h=l._def.returns.safeParse(d,i);if(!h.success)throw new Ur([s(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Wu({...this._def,args:Ei.create(t).rest(Il.create())})}returns(t){return new Wu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Wu({args:t||Ei.create([]).rest(Il.create()),returns:n||Il.create(),typeName:Qe.ZodFunction,...nt(r)})}}class Tp extends ut{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Tp.create=(e,t)=>new Tp({getter:e,typeName:Qe.ZodLazy,...nt(t)});class Pp extends ut{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ee(n,{received:n.data,code:pe.invalid_literal,expected:this._def.value}),qe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Pp.create=(e,t)=>new Pp({value:e,typeName:Qe.ZodLiteral,...nt(t)});function d5(e,t){return new Ta({values:e,typeName:Qe.ZodEnum,...nt(t)})}class Ta extends ut{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{expected:wt.joinValues(r),received:n.parsedType,code:pe.invalid_type}),qe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{received:n.data,code:pe.invalid_enum_value,options:r}),qe}return dr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ta.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ta.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ta.create=d5;class Ap extends ut{_parse(t){const n=wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ne.string&&r.parsedType!==Ne.number){const s=wt.objectValues(n);return Ee(r,{expected:wt.joinValues(s),received:r.parsedType,code:pe.invalid_type}),qe}if(this._cache||(this._cache=new Set(wt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=wt.objectValues(n);return Ee(r,{received:r.data,code:pe.invalid_enum_value,options:s}),qe}return dr(t.data)}get enum(){return this._def.values}}Ap.create=(e,t)=>new Ap({values:e,typeName:Qe.ZodNativeEnum,...nt(t)});class Td extends ut{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ne.promise&&n.common.async===!1)return Ee(n,{code:pe.invalid_type,expected:Ne.promise,received:n.parsedType}),qe;const r=n.parsedType===Ne.promise?n.data:Promise.resolve(n.data);return dr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Td.create=(e,t)=>new Td({type:e,typeName:Qe.ZodPromise,...nt(t)});class Ni extends ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{Ee(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return qe;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?qe:c.status==="dirty"||n.value==="dirty"?_u(c.value):c});{if(n.value==="aborted")return qe;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?qe:l.status==="dirty"||n.value==="dirty"?_u(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?qe:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?qe:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hc(o))return qe;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>hc(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):qe);wt.assertNever(s)}}Ni.create=(e,t,n)=>new Ni({schema:e,typeName:Qe.ZodEffects,effect:t,...nt(n)});Ni.createWithPreprocess=(e,t,n)=>new Ni({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...nt(n)});class gi extends ut{_parse(t){return this._getType(t)===Ne.undefined?dr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}gi.create=(e,t)=>new gi({innerType:e,typeName:Qe.ZodOptional,...nt(t)});class Pa extends ut{_parse(t){return this._getType(t)===Ne.null?dr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Pa.create=(e,t)=>new Pa({innerType:e,typeName:Qe.ZodNullable,...nt(t)});class Ip extends ut{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ip.create=(e,t)=>new Ip({innerType:e,typeName:Qe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...nt(t)});class Rp extends ut{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return _p(s)?s.then(i=>
vendor: 2,064 bytes, line 600
600({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ur(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ur(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Rp.create=(e,t)=>new Rp({innerType:e,typeName:Qe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...nt(t)});class m0 extends ut{_parse(t){if(this._getType(t)!==Ne.nan){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:Ne.nan,received:r.parsedType}),qe}return{status:"valid",value:t.data}}}m0.create=e=>new m0({typeName:Qe.ZodNaN,...nt(e)});const x0e=Symbol("zod_brand");class h5 extends ut{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Km extends ut{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?qe:i.status==="dirty"?(n.dirty(),_u(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?qe:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Km({in:t,out:n,typeName:Qe.ZodPipeline})}}class Mp extends ut{_parse(t){const n=this._def.innerType._parse(t),r=s=>(hc(s)&&(s.value=Object.freeze(s.value)),s);return _p(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Mp.create=(e,t)=>new Mp({innerType:e,typeName:Qe.ZodReadonly,...nt(t)});function NC(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function hoe(e,t={},n){return e?jd.create().superRefine((r,s)=>{const i=e(r);if(i instanceof Promise)return i.then(o=>{if(!o){const l=NC(t,r),c=l.fatal??n??!0;
600s.addIssue({code:"custom",...l,fatal:c})}});if(!i){const o=NC(t,r),l=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:l})}}):jd.create()}const b0e={object:en.lazycreate};var Qe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Qe||(Qe={}));const w0e=(e,t={message:`Input not instance of ${e.name}`})=>hoe(n=>n instanceof e,t),Gn=Ns.create,foe=Ca.create,_0e=m0.create,k0e=ja.create,Pd=kp.create,S0e=fc.create,E0e=d0.create,N0e=Sp.create,C0e=Ep.create,j0e=jd.create,T0e=Il.create,P0e=Co.create,A0e=h0.create,I0e=Rs.create,z_=en.create,R0e=en.strictCreate,M0e=Np.create,O0e=U_.create,D0e=Cp.create,L0e=Ei.create,F0e=jp.create,$0e=p0.create,V0e=pc.create,B0e=Wu.create,U0e=Tp.create,z0e=Pp.create,H0e=Ta.create,W0e=Ap.create,q0e=Td.create,G0e=Ni.create,K0e=gi.create,Y0e=Pa.create,Q0e=Ni.createWithPreprocess,Z0e=Km.create,X0e=()=>Gn().optional(),J0e=()=>foe().optional(),ebe=()=>Pd().optional(),tbe={string:e=>Ns.create({...e,coerce:!0}),number:e=>Ca.create({...e,coerce:!0}),boolean:e=>kp.create({...e,coerce:!0}),bigint:e=>ja.create({...e,coerce:!0}),date:e=>fc.create({...e,coerce:!0})},nbe=qe,poe=[{items:[{href:"/",label:"Home",icon:Bd}]},{label:"Features",items:[{href:"/features/time-tracking",label:"Time Tracker",icon:Cb},{href:"/features/material-participation",label:"Material Participation",icon:lR},{href:"/features/audit-ready-reporting",label:"Audit Reports",icon:im},{href:"/features/goal-progress-tracker",label:"Goal Tracker",icon:aR},{href:"/features/multi-property-support",label:"Multi-Property",icon:jo},{href:"/features/premium-features",label:"AI Features",icon:vo}]},{label:"Free Tools",items:[{href:"/tools/rental-calculator",label:"Rental Calculator",icon:W9},{href:"/tools/brrr-calculator",label:"BRRR Calculator",icon:mH},{href:"/tools/rep-status-calculator",label:"REP Status Calculator",icon:X9},{href:"/tools/rep-status-audit-scan",label:"REP Audit Scan",icon:oR},{href:"/tools/rep-hours-tracker",label:"REP Hours Tracker",icon:q9},{href:"/tools/1031-exchange-timer",label:"1031 Exchange Timer",icon:V9},{href:"/tools/cost-seg-estimator",label:"Cost Seg Estimator",icon:G9}]},{label:"Explore",items:[{href:"/pricing",label:"Pricing",icon:_H},{href:"/why-reps-shield",label:"Why REPSShield?",icon:ZI},{href:"/blog",label:"Blog",icon:iR},{href:"/about",label:"About",icon:uH}]}];function moe(){const[e,t]=m.useState(!1),[n,r]=Pt(),i=["/","/login","/register","/forgot-password","/reset-password","/features","/tools","/pricing","/about","/why-reps-shield","/blog","/repstracker-alternative","/terms","/privacy","/privacy-updated","/changelog"].includes(n)||n.startsWith("/features/")||n.startsWith("/tools/"),o=Wt({enabled:!i}),l=i?!1:o.isAuthenticated,c=()=>{t(!e)},u=()=>{t(!1)};m.useEffect(()=>{window.location.hostname.includes("picard.replit.dev")},[e]);const d=f=>!!(f==="/"&&n==="/"||f!=="/"&&n.startsWith(f)),h=(f,p)=>{f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||f.button!==0||(f.preventDefault(),r(p),wo(p),u())};return a.jsxs(a.Fragment,{children:[a.jsx("div",{children:a.jsx(ie,{variant:"ghost",size:"sm",onClick:c,className:"p-2 touch-target","aria-label":"Toggle navigation menu",children:e?a.jsx(vn,{className:"h-5 w-5 transition-transform duration-200"}):a.jsx(sm,{className:"h-5 w-5 transition-transform duration-200"})})}),e&&a.jsxs("div",{className:"fixed inset-0 z-50 safe-area-top",children:[a.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-20 backdrop-blur-sm",onClick:u}),a.jsxs("div",{className:"absolute inset-x-0 top-0 flex max-h-full flex-col bg-white shadow-lg animate-in slide-in-from-top-2 duration-200",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[a.jsxs(De,{href:"/",onClick:u,className:"flex items-center space-x-2",children:[a.jsx("img",{src:"/repsshield-logo-icon.png",alt:"REPSShield",className:"h-10 w-10"}),a.jsx("span",{className:"text-base font-semibold text-gray-900",children:"REPSShield"})]}),a.jsx("button",{onClick:u,className:"flex h-10 w-10 items-center justify-center rounded-lg border border-gray-300 text-gray-700 touch-target","aria-label":"Close menu",children:a.jsx(vn,{className:"h-5 w-5"})})]}),a.jsx("div",{className:"px-5 pb-2",children:l?a.jsx(De,{href:"/dashboard",onClick:u,className:"block",children:a.jsx("span",{className:"flex h-12 items-center justify-center rounded-lg bg-[linear-gradient(90deg,#44958C,#43A047)] text-base font-semibold !text-white",children:"Go to Dashboard"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx(De,{href:"/register",onClick:u,className:"flex-1",children:a.jsx("span",{className:"flex h-12 items-center justify-center rounded-lg bg-[linear-gradient(90deg,#44958C,#43A047)] text-base font-semibold !text-white",children:"Sign Up Free"})}),a.jsx(De,{href:"/login",onClick:u,className:"flex-1",children:a.jsx("span",{className:"flex h-12 items-center justify-center rounded-lg border border-[#44958C] bg-white text-base font-semibold !text-[#44958C]",children:"Login"})})]}),a.jsxs("p",{className:"mt-3 flex items-center justify-center gap-1.5 text-center text-xs text-gray-500",children:[a.jsx(jb,{className:"h-3.5 w-3.5 text-[#44958C]"}),a.jsxs("span",{children:["Try it"," ",a.jsx("span",{className:"bg-[linear-gradient(transparent_62%,#FFD05C_62%)] px-0.5 font-medium text-gray-700",children:"free for 14 days"}),". No credit card required."]})]})]})}),a.jsx("nav",{className:"overflow-y-auto px-5 pb-8",children:poe.map(f=>a.jsxs("div",{children:[f.label&&a.jsx("p",{className:"mb-1 mt-6 border-b border-gray-100 pb-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:f.label}),a.jsx("ul",{children:f.items.map(p=>{const g=p.icon,v=d(p.href);return a.jsx("li",{children:a.jsxs(De,{href:p.href,className:`flex items-center gap-3.5 rounded-lg px-1 py-2.5 text-[15px] transition-colors touch-target ${v?"font-semibold !text-[#44958C]":"font-medium !text-gray-700"}`,onClick:y=>h(y,p.href),children:[a.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${v?"bg-[linear-gradient(135deg,#44958C,#43A047)]":"bg-[#FDF8EC]"}`,children:a.jsx(g,{className:`h-[18px] w-[18px] ${v?"!text-white":"!text-[#44958C]"}`})}),p.label]})},p.href)})})]},f.label??"main"))})]})]})]})}function goe({isAuthenticated:e}){return a.jsx("header",{className:"bg-transparent safe-area-top mt-6",children:a.jsx("div",{className:"lm-container",children:a.jsxs("div",{className:"flex justify-between items-center h-16",children:[a.jsxs(De,{href:"/",className:"flex items-center hover:opacity-80 transition-opacity",children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield Logo",className:"h-6 w-6 sm:h-8 sm:w-8 mr-2 sm:mr-3"}),a.jsx("span",{className:"text-base font-semibold",style:{color:"var(--color-text)",margin:0,lineHeight:"1.5"},children:"REPSShield"})]}),a.jsx("nav",{className:"hidden md:flex items-center space-x-6",role:"navigation","aria-label":"Main navigation",children:a.jsxs("ul",{className:"flex items-center space-x-6 list-none m-0 p-0",children:[a.jsxs("li",{className:"relative group",children:[a.jsxs(De,{href:"/features",className:"lm-nav-link flex items-center","aria-haspopup":"true","aria-expanded":"false",children:["Features",a.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),a.jsxs("ul",{className:"absolute left-0 mt-2 w-56 bg-white rounded-md shadow-lg op
600acity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 border list-none p-2",role:"menu","aria-label":"Features submenu",children:[a.jsx("li",{children:a.jsx(De,{href:"/features/time-tracking",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"REP Time Tracking"})}),a.jsx("li",{children:a.jsx(De,{href:"/features/material-participation",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"Material Participation Tests"})}),a.jsx("li",{children:a.jsx(De,{href:"/features/audit-ready-reporting",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"Audit-Ready Reports"})}),a.jsx("li",{children:a.jsx(De,{href:"/features/goal-progress-tracker",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"REP Goal Tracker"})}),a.jsx("li",{children:a.jsx(De,{href:"/features/multi-property-support",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"Multi-Property Management"})}),a.jsx("li",{children:a.jsx(De,{href:"/features/premium-features",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"AI-Powered Features"})})]})]}),a.jsxs("li",{className:"relative group",children:[a.jsxs(De,{href:"/tools",className:"lm-nav-link flex items-center","aria-haspopup":"true","aria-expanded":"false",children:["Tools",a.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),a.jsxs("ul",{className:"absolute left-0 mt-2 w-56 bg-white rounded-md shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 border list-none p-2",role:"menu","aria-label":"Tools submenu",children:[a.jsx("li",{children:a.jsx(De,{href:"/tools/rental-calculator",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"Rental Property Calculator"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/brrr-calculator",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"BRRR Strategy Calculator"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/rep-status-calculator",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"REP Status Calculator"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/rep-status-audit-scan",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"REP Audit Scan"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/rep-hours-tracker",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"REP Hours Tracker"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/1031-exchange-timer",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"1031 Exchange Timer"})}),a.jsx("li",{children:a.jsx(De,{href:"/tools/cost-seg-estimator",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded",role:"menuitem",children:"Cost Seg Estimator"})})]})]}),a.jsx("li",{children:a.jsx(De,{href:"/pricing",className:"lm-nav-link",children:"Pricing"})}),a.jsx("li",{children:a.jsx(De,{href:"/why-reps-shield",className:"lm-nav-link",children:"Why REPSShield?"})}),a.jsx("li",{children:a.jsx(De,{href:"/blog",className:"lm-nav-link",children:"Blog"})}),a.jsx("li",{children:a.jsx(De,{href:"/about",className:"lm-nav-link",children:"About"})}),a.jsx("li",{children:e?a.jsx(De,{href:"/dashboard",children:a.jsx(ie,{className:"border border-[#44958C] text-[#44958C] bg-white hover:bg-[#44958C] hover:text-white transition-colors","aria-label":"Go to your dashboard",children:"Dashboard"})}):a.jsx(De,{href:"/login",children:a.jsx(ie,{className:"border border-[#44958C] text-[#44958C] bg-white hover:bg-[#44958C] hover:text-white transition-colors","aria-label":"Sign in to your account",children:"Login"})})})]})}),a.jsx("div",{className:"md:hidden",children:a.jsx(moe,{})})]})})})}const voe=()=>
600a.jsx("footer",{className:"bg-white border-t mt-12 sm:mt-16 spacing-responsive-lg safe-area-bottom",children:a.jsxs("div",{className:"container-mobile container-safe",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-6 gap-8 lg:gap-12",children:[a.jsxs("div",{className:"lg:col-span-1 max-w-md",children:[a.jsxs("div",{className:"flex items-center mb-3 sm:mb-4",children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield Logo",className:"h-6 w-6 sm:h-8 sm:w-8 mr-2 sm:mr-3"}),a.jsx("span",{className:"text-responsive-base sm:text-xl font-semibold",style:{color:"var(--color-text)"},children:"REPSShield"})]}),a.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-3 sm:mb-4 text-responsive-xs",children:"Professional time tracking for Real Estate Professional status qualification. IRS-compliant, audit-ready, AI-powered."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-responsive-sm font-semibold mb-3 sm:mb-4",style:{color:"var(--color-text)"},children:"Features"}),a.jsxs("div",{className:"space-y-1 sm:space-y-2",children:[a.jsx(De,{href:"/features/time-tracking",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Time Tracking"}),a.jsx(De,{href:"/features/material-participation",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Material Participation"}),a.jsx(De,{href:"/features/audit-ready-reporting",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Audit Reports"}),a.jsx(De,{href:"/features/goal-progress-tracker",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Goal Tracker"}),a.jsx(De,{href:"/features/multi-property-support",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Multi Property"}),a.jsx(De,{href:"/features/premium-features",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"AI Features"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-responsive-sm font-semibold mb-3 sm:mb-4",style:{color:"var(--color-text)"},children:"Tools"}),a.jsxs("div",{className:"space-y-1 sm:space-y-2",children:[a.jsx(De,{href:"/tools/rental-calculator",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Rental Calculator"}),a.jsx(De,{href:"/tools/brrr-calculator",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"BRRR Calculator"}),a.jsx(De,{href:"/tools/rep-status-calculator",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"REP Status Calculator"}),a.jsx(De,{href:"/tools/rep-status-audit-scan",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Audit Scan"}),a.jsx(De,{href:"/tools/rep-hours-tracker",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Hours Tracker"}),a.jsx(De,{href:"/tools/1031-exchange-timer",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"1031 Exchange Timer"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-responsive-sm font-semibold mb-3 sm:mb-4",style:{color:"var(--color-text)"},children:"Evaluate"}),a.jsx("div",{className:"space-y-1 sm:space-y-2",children:a.jsx(De,{href:"/repstracker-alternative",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"REPSTracker Alternative"})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-responsive-sm font-semibold mb-3 sm:mb-4",style:{color:"var(--color-text)"},children:"Company"}),a.jsxs("div",{className:"space-y-1 sm:space-y-2",children:[a.jsx(De,{href:"/about",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"About"}),a.jsx(De,{href:"/pricing",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Pricing"}),a.jsx(De,{href:"/why-reps-shield",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Why REPSShield?"}),a.jsx(De,{href:"/changelog",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Change Log"}),a.jsx(De,{href:"/docs/api",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Developer API"}),a.jsx("a",{href:"mailto:[email protected]",className:"block text-gray-600 hover:text-blue-600 text-responsive-xs touch-target",children:"Email"})]})]})]}
600),a.jsx("div",{className:"border-t mt-6 sm:mt-8 pt-6 sm:pt-8 text-center text-gray-500 text-responsive-xs",children:a.jsxs("p",{className:"px-4",children:["© 2025 REPSShield. All rights reserved. |"," ",a.jsx(De,{href:"/privacy",className:"hover:text-blue-600 touch-target",children:"Privacy Policy"})," ","|"," ",a.jsx(De,{href:"/terms",className:"hover:text-blue-600 touch-target",children:"Terms of Service"})]})})]})}),yoe=[{emoji:"🏠",className:"left-[5%] top-10 -rotate-6 bg-sky-100"},{emoji:"🔑",className:"right-[6%] top-12 rotate-6 bg-amber-100"},{emoji:"⏱️",className:"left-[9%] bottom-24 -rotate-3 bg-teal-100"},{emoji:"📅",className:"right-[8%] bottom-28 rotate-3 bg-rose-100"},{emoji:"🛡️",className:"left-[16%] top-24 rotate-2 bg-emerald-100"},{emoji:"📋",className:"right-[17%] top-28 -rotate-2 bg-violet-100"}];function xoe(){const[e,t]=m.useState(""),[,n]=Pt(),{isAuthenticated:r}=Wt();m.useEffect(()=>{},[r]);const s=async i=>{i.preventDefault();try{if((await fetch("/api/auth/user",{credentials:"include"})).ok)n("/dashboard");else{const l=new URLSearchParams;e.trim()&&l.set("email",e.trim()),n(`/register${l.toString()?"?"+l.toString():""}`)}}catch{const l=new URLSearchParams;e.trim()&&l.set("email",e.trim()),n(`/register${l.toString()?"?"+l.toString():""}`)}};return a.jsxs("section",{className:"relative overflow-hidden border-b-[3px] border-[#44958C] bg-[#FDF8EC]",children:[yoe.map(i=>a.jsx("span",{"aria-hidden":"true",className:`absolute z-0 hidden h-14 w-14 items-center justify-center rounded-2xl text-[26px] shadow-sm ring-1 ring-black/5 md:flex ${i.className}`,children:i.emoji},i.emoji)),a.jsx("div",{className:"lm-container relative z-10",children:a.jsxs("div",{className:"mx-auto max-w-2xl px-6 py-16 text-center sm:py-20",children:[a.jsx("p",{className:"text-[13px] font-semibold uppercase tracking-[0.18em] text-[#44958C]",children:"Built for real estate professionals"}),a.jsxs("h2",{className:"mt-4 font-['Playfair_Display'] text-4xl font-bold leading-tight tracking-tight text-gray-900 sm:text-5xl",children:["A thoughtful tool for serious"," ",a.jsxs("span",{className:"relative inline-block whitespace-nowrap",children:[a.jsx("span",{"aria-hidden":"true",className:"absolute inset-x-0 bottom-1 h-[0.32em] rounded-sm bg-yellow-300/80"}),a.jsx("span",{className:"relative",children:"REP clarity"})]}),"."]}),a.jsx("p",{className:"mx-auto mt-5 max-w-xl text-lg leading-relaxed text-gray-600",children:"Join thousands of real estate professionals who track hours effortlessly, stay audit-ready, and protect their REP status with confidence."}),a.jsxs("form",{onSubmit:s,className:"mx-auto mt-9 max-w-lg",children:[a.jsxs("div",{className:"flex flex-col gap-2 rounded-[2rem] border border-gray-200 bg-white p-2 shadow-md shadow-amber-900/5 sm:flex-row sm:items-center sm:rounded-full",children:[a.jsx(Ct,{type:"email",placeholder:"Enter your email",value:e,onChange:i=>t(i.target.value),className:"h-12 flex-1 rounded-full border-0 bg-transparent px-4 text-gray-900 placeholder-gray-400 shadow-none focus-visible:ring-0",required:!0}),a.jsxs(ie,{type:"submit",className:"h-12 w-full shrink-0 justify-center rounded-full bg-[#44958C] px-6 font-medium text-white transition-colors hover:bg-[#3A7F76] sm:w-auto",children:["Get Started Free",a.jsx(ts,{className:"ml-2 h-4 w-4"})]})]}),a.jsxs("p",{className:"mt-4 text-sm text-gray-500",children:["14-day free trial ·"," ",a.jsx("span",{className:"font-medium text-gray-700 underline decoration-yellow-400 decoration-2 underline-offset-4",children:"No credit card required"})," ","· Cancel anytime"]})]})]})})]})}function boe(){const[e]=Pt();m.useEffect(()=>{const t=e.startsWith("/tools/cost-seg-estimator/chat"),n=e==="/tools/cost-seg-estimator",r=["/","/login","/forgot-password","/reset-password","/pricing","/features","/tools","/privacy-updated","/privacy","/terms","/repstracker-alternative"].includes(e)||e.startsWith("/features")||e.startsWith("/tools");let s="";t||n?s="clean-bg":r?s="wallpaper-bg":e.startsWith("/dashboard")||e.startsWith("/app")||e.startsWith("/analytics")||e.startsWith("/activity-ledger")||e.startsWith("/properties")||e.startsWith("/files")||e.startsWith("/team")||e.startsWith("/settings")?s="app":s="clean-bg",["wallpaper-bg","clean-bg","public-site"].forEach(o=>{o!==s&&document.body.classList.remove(o)}),s&&!document.body.classList.contains(s)&&document.body.classList.add(s)},[e])}function woe({children:e,hideEmailIntake:t=!1,hideHeader:n=!1,hideFooter:r=!1}){boe();const{isAuthenticated:s}=Wt({enabled:!1});return a.jsxs("div",{className:"min-h-screen flex flex-col","data-prerendered":!0,children:[!n&&a.jsx(goe,{isAuthenticated:s}),a.jsx("main",{className:"flex-1",children:e}),!t&&a.jsx(xoe,{}),!r&&a.jsx(voe,{})]})}var Ym="Collapsible",[_oe,f5]=yn(Ym),[koe,H_]=_oe(Ym),p5=m.forwardRef((e,t)=>
600{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...l}=e,[c,u]=cr({prop:r,defaultProp:s??!1,onChange:o,caller:Ym});return a.jsx(koe,{scope:n,disabled:i,contentId:dn(),open:c,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),children:a.jsx(we.div,{"data-state":q_(c),"data-disabled":i?"":void 0,...l,ref:t})})});p5.displayName=Ym;var m5="CollapsibleTrigger",g5=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=H_(m5,n);return a.jsx(we.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":q_(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:he(e.onClick,s.onOpenToggle)})});g5.displayName=m5;var W_="CollapsibleContent",v5=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=H_(W_,e.__scopeCollapsible);return a.jsx(hn,{present:n||s.open,children:({present:i})=>a.jsx(Soe,{...r,ref:t,present:i})})});v5.displayName=W_;var Soe=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=H_(W_,n),[l,c]=m.useState(r),u=m.useRef(null),d=He(t,u),h=m.useRef(0),f=h.current,p=m.useRef(0),g=p.current,v=o.open||l,y=m.useRef(v),x=m.useRef(void 0);return m.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),nn(()=>{const b=u.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();h.current=w.height,p.current=w.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),c(r)}},[o.open,r]),a.jsx(we.div,{"data-state":q_(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!v,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&s})});function q_(e){return e?"open":"closed"}var Eoe=p5,Noe=g5,Coe=v5,hs="Accordion",joe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[G_,Toe,Poe]=_c(hs),[Qm]=yn(hs,[Poe,f5]),K_=f5(),y5=m.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return a.jsx(G_.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?a.jsx(Moe,{...i,ref:t}):a.jsx(Roe,{...s,ref:t})})});y5.displayName=hs;var[x5,Aoe]=Qm(hs),[b5,Ioe]=Qm(hs,{collapsible:!1}),Roe=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[l,c]=cr({prop:n,defaultProp:r??"",onChange:s,caller:hs});return a.jsx(x5,{scope:e.__scopeAccordion,value:m.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:m.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(b5,{scope:e.__scopeAccordion,collapsible:i,children:a.jsx(w5,{...o,ref:t})})})}),Moe=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,l]=cr({prop:n,defaultProp:r??[],onChange:s,caller:hs}),c=m.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=m.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(x5,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(b5,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(w5,{...i,ref:t})})})}),[Ooe,Zm]=Qm(hs),w5=m.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,l=m.useRef(null),c=He(l,t),u=Toe(n),h=Oa(s)==="ltr",f=he(e.onKeyDown,p=>{var A;if(!joe.includes(p.key))return;const g=p.target,v=u().filter(N=>{var k;return!((k=N.ref.current)!=null&&k.disabled)}),y=v.findIndex(N=>N.ref.current===g),x=v.length;if(y===-1)return;p.preventDefault();let b=y;const w=0,S=x-1,_=()=>{b=y+1,b>S&&(b=w)},E=()=>{b=y-1,b<w&&(b=S)};switch(p.key){case"Home":b=w;break;case"End":b=S;break;case"ArrowRight":i==="horizontal"&&(h?_():E());break;case"ArrowDown":i==="vertical"&&_();break;case"ArrowLeft":i==="horizontal"&&(h?E():_());break;case"ArrowUp":i==="vertical"&&E();break}const R=b%x;(A=v[R].ref.current)==null||A.focus()});return a.jsx(Ooe,{scope:n,disabled:r,direction:s,orientation:i,children:a.jsx(G_.Slot,{scope:n,children:a.jsx(we.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:f})})})}),Op="AccordionItem",[Doe,Y_]=Qm(Op),_5=m.forwardRef((e,t)=>
600{const{__scopeAccordion:n,value:r,...s}=e,i=Zm(Op,n),o=Aoe(Op,n),l=K_(n),c=dn(),u=r&&o.value.includes(r)||!1,d=i.disabled||e.disabled;return a.jsx(Doe,{scope:n,open:u,disabled:d,triggerId:c,children:a.jsx(Eoe,{"data-orientation":i.orientation,"data-state":j5(u),...l,...s,ref:t,disabled:d,open:u,onOpenChange:h=>{h?o.onItemOpen(r):o.onItemClose(r)}})})});_5.displayName=Op;var k5="AccordionHeader",S5=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Zm(hs,n),i=Y_(k5,n);return a.jsx(we.h3,{"data-orientation":s.orientation,"data-state":j5(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});S5.displayName=k5;var g0="AccordionTrigger",E5=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Zm(hs,n),i=Y_(g0,n),o=Ioe(g0,n),l=K_(n);return a.jsx(G_.ItemSlot,{scope:n,children:a.jsx(Noe,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...r,ref:t})})});E5.displayName=g0;var N5="AccordionContent",C5=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Zm(hs,n),i=Y_(N5,n),o=K_(n);return a.jsx(Coe,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});C5.displayName=N5;function j5(e){return e?"open":"closed"}var Loe=y5,Foe=_5,$oe=S5,T5=E5,P5=C5;const rbe=Loe,Voe=m.forwardRef(({className:e,...t},n)=>a.jsx(Foe,{ref:n,className:q("border-b",e),...t}));Voe.displayName="AccordionItem";const Boe=m.forwardRef(({className:e,children:t,...n},r)=>a.jsx($oe,{className:"flex",children:a.jsxs(T5,{ref:r,className:q("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,a.jsx(Ma,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Boe.displayName=T5.displayName;const Uoe=m.forwardRef(({className:e,children:t,...n},r)=>a.jsx(P5,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:q("pb-4 pt-0",e),children:t})}));Uoe.displayName=P5.displayName;const zoe=({siteKey:e,action:t})=>{const[n,r]=m.useState(!1),[s,i]=m.useState(null),o=m.useRef(!1);return m.useEffect(()=>{var d;if((d=window.grecaptcha)!=null&&d.enterprise&&o.current){r(!0);return}const c=document.querySelector('script[src*="recaptcha"]');if(c&&!o.current){c.addEventListener("load",()=>{var h;(h=window.grecaptcha)!=null&&h.enterprise&&window.grecaptcha.enterprise.ready(()=>{r(!0),o.current=!0})});return}const u=document.createElement("script");return u.src=`https://www.google.com/recaptcha/enterprise.js?render=${e}`,u.async=!0,u.defer=!0,u.onload=()=>{var h;(h=window.grecaptcha)!=null&&h.enterprise?window.grecaptcha.enterprise.ready(()=>{r(!0),o.current=!0}):i("Failed to initialize reCAPTCHA")},u.onerror=()=>{i("Failed to load reCAPTCHA script")},document.head.appendChild(u),()=>{}},[e]),{isLoaded:n,error:s,executeRecaptcha:async()=>{var c;if(!n)return i("reCAPTCHA is not loaded yet"),null;if(!((c=window.grecaptcha)!=null&&c.enterprise))return i("reCAPTCHA is not available"),null;try{const u=await window.grecaptcha.enterprise.execute(e,{action:t});return i(null),u}catch(u){const d=u instanceof Error?u.message:"Failed to execute reCAPTCHA";return i(d),null}}}},Hoe=z_({email:Gn().min(1,"Email is required").email(),password:Gn().min(1,"Password is required"),recaptchaToken:Gn().optional()});function Woe(e,t){if(Ye()){e(t,{replace:!0});return}setTimeout(()=>{e(t)},100)}function A5(){const[,e]=Pt(),t=Lt(),{openGoogleAuth:n,openAppleAuth:r,isAuthenticating:s}=tP(),[i,o]=m.useState(!1),[l,c]=m.useState(""),[u,d]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState({scale:1,height:0}),v=m.useRef(null),y=m.useRef(null),[x,b]=m.useState(null),[w,S]=m.useState(null),[_,E]=m.useState(null),R="6LdyvaorAAAAACV4Fsr2EadWDEICggtxuL2gjdI6",{isLoaded:A,error:N,executeRecaptcha:k}=zoe({siteKey:R,action:"LOGIN"}),T=!Ye()||Z0(),{data:I,isLoading:F}=tt({queryKey:["/api/auth/user"],retry:!1,enabled:T&&!h});m.useEffect(()=>{if(!F&&(I!=null&&I.isAuthenticated)&&!h){f(!0);const H=new URLSearchParams(window.location.search).get("redirectTo"),V=H?decodeURIComponent(H):"/dashboard";setTimeout(()=>{e(V)},100)}},[F,I==null?void 0:I.isAuthenticated,h,e]);const L=m.useRef(!1);m.useEffect(()=>{if(L.current||F||I!=null&&I.isAuthenticated||h)return;let C=!1;return L.current=!0,(async()=>{var H;try{const V=await fetch("/api/auth/local-login",{method:"POST",credentials:"include"});if(!V.ok||C)return;const O=await V.json();if(C||!O.success||!((H=O.tokens)!=null&&H.accessToken))return;await co(O.tokens.accessToken),O.user&&t.setQueryData(["/api/auth/user"],O.user),f(!0),setTimeout(()=>e("/dashboard"),100)}catch{}})(),()=>{C=!0}},[F,I,h,t,e]),m.useEffect(()=>{const C=new URLSearchParams(window.location.search),H=C.get("error"),V=C.get("plan"),O=C.get("annualPrice");V&&(b(V),O&&S(O));const G=C.get("redirect");if(G&&E(G),H){const ne={google_not_configured:"Google sign-in is currently unavailable. Please use email login or try again later.",google_failed:"Google sign-in failed. This may be due to configuration issues. Please try again or c
600ontact support.",google_no_user:"Unable to retrieve your Google account information. Please try again.",google_callback_error:"There was an error completing Google sign-in. Please try again.",apple_not_configured:"Apple sign-in is currently unavailable. Please use email login or try again later.",apple_failed:"Apple sign-in failed. Please try again.",google:"Google sign-in was unsuccessful. Please try again.",apple:"Apple sign-in was unsuccessful. Please try again."},re=C.get("message");c(re||ne[H]||"Authentication failed. Please try again."),window.history.replaceState({},document.title,window.location.pathname)}const Z=C.get("demo"),ae=C.get("message");if(Z==="true"&&ae==="google_preview_unavailable"&&(c("Google sign-in callback URL needs to be configured in Google Cloud Console for this preview environment."),window.history.replaceState({},document.title,window.location.pathname)),C.get("login")==="success"){f(!0);const ne=new URL(window.location.href);ne.searchParams.delete("login"),window.history.replaceState({},document.title,ne.pathname+ne.search),setTimeout(_==="checkout"&&x?async()=>{try{const re=window.location.origin,J=await dc({priceType:x,successUrl:`${re}/?payment=success`,cancelUrl:`${re}/pricing?payment=cancelled`});J.checkoutUrl?window.location.href=J.checkoutUrl:J.upgraded?window.location.href="/dashboard?payment=success":window.location.href="/pricing?error=checkout_failed"}catch(re){console.error("Checkout redirect error:",re),window.location.href="/pricing?error=checkout_failed"}}:()=>{e("/dashboard")},100)}},[e]);const M=F_({resolver:$_(Hoe),defaultValues:{email:"",password:""}}),{showForLogin:$,hide:j}=iP(),P=async C=>{var V;const H=$();d(!0),c("");try{const O=await k();if(!O){console.error("🚨 LOGIN: reCAPTCHA failed",{recaptchaError:N}),c(N||"Security verification failed. Please try again."),j(H),d(!1);return}const G=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:C.email,password:C.password,recaptchaToken:O}),credentials:"include"});if(G.ok){const Z=await G.json();if(Z.success){(V=Z.tokens)!=null&&V.accessToken&&await co(Z.tokens.accessToken),Z.user&&t.setQueryData(["/api/auth/user"],Z.user),f(!0);const te=new URLSearchParams(window.location.search).get("redirectTo"),ne=te?decodeURIComponent(te):Z.redirectUrl||"/dashboard";Woe(e,ne)}else c(Z.message||"Login failed")}else{const Z=await G.json();c(Z.message||"Login failed. Please try again.")}}catch{c("Network error. Please check your connection and try again.")}finally{j(H),d(!1)}},D=async C=>{if(C==="google"){c(""),sessionStorage.setItem("oauthFlowInitiated","true");const H=Date.now();sessionStorage.setItem("oauthStartTime",H.toString());const O=new URLSearchParams(window.location.search).get("redirectTo");try{await n(O||void 0)}catch(G){G.name==="OAuthCancelledError"||(console.error("Google auth error:",G),c("Failed to open Google authentication. Please try again."))}}else if(C==="apple"){c(""),sessionStorage.setItem("oauthFlowInitiated","true");const V=new URLSearchParams(window.location.search).get("redirectTo");try{await r(V||void 0)}catch(O){O.name==="OAuthCancelledError"||(console.error("Apple auth error:",O),c("Failed to open Apple authentication. Please try again."))}}else if(C==="replit"){f(!0),c(""),sessionStorage.setItem("oauthFlowInitiated","true");const H="https://repsshield.com";window.location.href=`${H}/api/auth/replit`}};return m.useEffect(()=>{const C=H=>{const V=new URLSearchParams(window.location.search);if(V.has("login")||V.has("error")){const O=new URL(window.location.href);O.searchParams.delete("login"),O.searchParams.delete("error"),window.history.replaceState({},document.title,O.pathname+O.search)}};return window.addEventListener("popstate",C),()=>{window.removeEventListener("popstate",C)}},[]),m.useLayoutEffect(()=>{var O,G;let C=0;const H=()=>{cancelAnimationFrame(C),C=requestAnimationFrame(()=>{var ke;const Z=y.current,ae=v.current;if(!Z||!ae)return;const te=((ke=window.visualViewport)==null?void 0:ke.height)??window.innerHeight,ne=window.getComputedStyle(ae),re=parseFloat(ne.paddingTop||"0")+parseFloat(ne.paddingBottom||"0"),J=Math.max(320,te-re),ge=Z.scrollHeight,se=Math.min(1,J/ge);g(Me=>Math.abs(Me.scale-se)<.005&&Math.abs(Me.height-ge)<1?Me:{scale:se,height:ge})})},V=typeof ResizeObserver<"u"&&y.current?new ResizeObserver(H):null;return y.current&&(V==null||V.observe(y.current)),H(),window.addEventListener("resize",H),(O=window.visualVie
600wport)==null||O.addEventListener("resize",H),(G=window.visualViewport)==null||G.addEventListener("scroll",H),()=>{var Z,ae;cancelAnimationFrame(C),V==null||V.disconnect(),window.removeEventListener("resize",H),(Z=window.visualViewport)==null||Z.removeEventListener("resize",H),(ae=window.visualViewport)==null||ae.removeEventListener("scroll",H)}},[l,A,N,s,u]),h?null:a.jsx(woe,{hideHeader:!0,hideEmailIntake:!0,hideFooter:!0,children:a.jsx("div",{ref:v,className:"h-[100dvh] min-h-[100dvh] w-full flex items-center justify-center overflow-hidden px-4 py-3 sm:p-4",style:{background:"transparent",paddingTop:"max(0.75rem, env(safe-area-inset-top))",paddingBottom:"max(0.75rem, env(safe-area-inset-bottom))"},children:a.jsx("div",{className:"w-full max-w-md",style:{height:p.height?`${p.height*p.scale}px`:void 0},children:a.jsxs(ht,{ref:y,className:"w-full shadow-lg border border-gray-200",style:{transform:`scale(${p.scale})`,transformOrigin:"top center"},children:[a.jsxs(hp,{className:"text-center pb-3 sm:pb-6",children:[a.jsxs("div",{className:"mascot-container login-mascot-container",children:[a.jsx("img",{src:"/repsshield-logo-main.png",alt:"REPSShield",className:"bouncing-mascot login-mascot"}),a.jsx("div",{className:"mascot-shadow"})]}),a.jsx(fp,{className:"text-2xl sm:text-3xl font-bold",children:"Welcome Back!"})]}),a.jsxs(yt,{className:"space-y-3 sm:space-y-6",children:[l&&a.jsxs(va,{variant:"destructive",children:[a.jsx(xi,{className:"h-4 w-4"}),a.jsx(Al,{children:l})]}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsxs(ie,{variant:"outline",className:"w-full",onClick:()=>D("google"),disabled:u||h||s,children:[h||s?a.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsxs("svg",{className:"w-4 h-4 mr-2",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),a.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),a.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),a.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),h||s?"Authenticating...":"Continue with Google"]}),a.jsxs(ie,{variant:"outline",className:"w-full",onClick:()=>D("apple"),disabled:u||h||s,children:[h||s?a.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx("svg",{className:"w-4 h-4 mr-2",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z",fill:"
600currentColor"})}),h||s?"Authenticating...":"Continue with Apple"]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx(T_,{className:"w-full"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-white px-2 text-gray-500",children:"Or continue with email"})})]}),a.jsx(V_,{...M,children:a.jsxs("form",{onSubmit:M.handleSubmit(P),className:"space-y-3 sm:space-y-4",children:[a.jsx(Sr,{control:M.control,name:"email",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Email"}),a.jsx(ir,{children:a.jsx(Ct,{type:"email",placeholder:"[email protected]",autoComplete:"email",...C})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:M.control,name:"password",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Password"}),a.jsx(ir,{children:a.jsxs("div",{className:"relative",children:[a.jsx(Ct,{type:i?"text":"password",placeholder:"Enter your password",...C}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>o(!i),children:i?a.jsx(rH,{className:"h-4 w-4"}):a.jsx(tR,{className:"h-4 w-4"})})]})}),a.jsx(or,{})]})}),a.jsx("div",{className:"text-right",children:a.jsx("button",{type:"button",onClick:()=>e("/forgot-password"),className:"text-sm text-[#44958c] hover:text-[#367068] underline",children:"Forgot password?"})}),a.jsxs("div",{className:"flex items-center justify-center space-x-2 py-1 sm:py-2",children:[N&&a.jsxs(va,{variant:"destructive",className:"mb-2",children:[a.jsx(xi,{className:"h-4 w-4"}),a.jsxs(Al,{children:["reCAPTCHA Error: ",N]})]}),A?a.jsxs("div",{className:"flex items-center space-x-2 text-green-600",children:[a.jsx(Ud,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:"Protected by reCAPTCHA"})]}):a.jsxs("div",{className:"flex items-center space-x-2 text-gray-400",children:[a.jsx(ct,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading security verification..."})]})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:u||h,children:u?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}),"Signing in..."]}):h?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}),"Redirecting..."]}):"Sign In"})]})}),a.jsx("div",{className:"text-center",children:a.jsx("button",{type:"button",onClick:()=>e("/register"),className:"text-sm text-[#44958c] hover:text-[#367068] underline",children:"Don't have an account? Sign up"})})]})]})})})})}const qoe=Object.freeze(Object.defineProperty({__proto__:null,default:A5},Symbol.toStringTag,{value:"Module"})),Q_=m.lazy(()=>ve(()=>Promise.resolve().then(()=>gie),void 0).then(e=>({default:e.RouterShell})));function Z_(e){const t=e.split(/[?#]/,1)[0]||"/";return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function _f({onPhaseChange:e,to:t="/login"}){const n=m.useRef(!1);return m.useLayoutEffect(()=>{e==null||e("unauthenticated"),`${window.location.pathname}${window.location.search}`!==t&&(n.current||(n.current=!0,window.history.replaceState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))))},[e,t]),a.jsx(A5,{})}function Goe({onPhaseChange:e}){const[t]=Pt();return m.useEffect(()=>{e==null||e("unauthenticated")},[e]),Z_(t)==="/login"?a.jsx(_f,{onPhaseChange:e,to:t}):a.jsx(m.Suspense,{fallback:a.jsx(A_,{}),children:a.jsx(Q_,{})})}function Koe({onPhaseChange:e}){return m.useEffect(()=>{e==null||e("live")},[e]),a.jsx(m.Suspense,{fallback:a.jsx(A_,{}),children:a.jsx(Q_,{})})}function Yoe(e){return e==="/activity-ledger"?a.jsx(rD,{}):e==="/properties"?a.jsx(sD,{}):e==="/files"?a.jsx(iD,{}):a.jsx(nD,{})}function Qoe({onPhaseChange:e}){const[t,n]=Pt(),[r,s]=m.useState(!1),i=m.useRef(!1),o=m.useRef(!1),l=()=>{Ye()&&(o.current||(o.current=!0,e==null||e("live"),s(!0),(Z_(t)==="/"||kb(t))&&n("/dashboard",{replace:!0})))},c=()=>{i.current||(i.current=!0,e==null||e("unauthenticated"),Ye()&&n("/login",{replace:!0}))},{phase:u}=vie({onAuthenticated:l,onUnauthenticated:c});return m.useEffect(()=>{e==null||e(u)},[u,e]),u==="unauthenticated"?null:r&&u==="live"?a.jsx(m.Suspense,{fallback:a.jsx(A_,{}),children:a.jsx(Q_,{})}):a.jsxs(yie,{isAuthChecking:u==="validating",children:[Yoe(t),u==="validating"&&a.jsx(xie,{})]})}function Zoe(e){return a.jsx(Xoe,{...e})}function Xoe({onPhaseChange:e}){const[t]=Pt(),n=Lt(),r=Z_(t),s=Z0(),i=n.getQueryData(["/api/auth/user"])!=null;if(!Ye())return null;
600if(!s){if(r==="/login")return a.jsx(_f,{onPhaseChange:e,to:t});if(r==="/"||r==="/logout-success")return a.jsx(_f,{onPhaseChange:e,to:"/login"});if(kb(t))return a.jsx(Goe,{onPhaseChange:e});const o=encodeURIComponent(t);return a.jsx(_f,{onPhaseChange:e,to:`/login?redirectTo=${o}`})}return i?a.jsx(Koe,{onPhaseChange:e}):a.jsx(Qoe,{onPhaseChange:e})}const I5=({user:e})=>(m.useEffect(()=>{!e||Ye()||window.innerWidth<768||window.Tawk_API||(window.Tawk_API=window.Tawk_API||{},window.Tawk_API.visitor={name:e.firstName+" "+e.lastName,email:e.email},window.Tawk_API.customStyle={visibility:{desktop:{xOffset:"10px",yOffset:"10px"}},zIndex:2147483647},window.Tawk_API.onLoad=function(){window.Tawk_API.setAttributes({userId:e.id,plan:e.isOnTrial?"Trial":e.subscriptionPlan||"Paid",isAdmin:e.isAdmin?"Yes":"No",trialStartDate:e.trialStartDate||"N/A",trialEndDate:e.trialEndDate||"N/A"},function(n){})},window.Tawk_LoadStart=new Date,function(){var n=document.createElement("script"),r=document.getElementsByTagName("script")[0];n.async=!0,n.src="https://embed.tawk.to/69323993f66a4c198b426eb1/1jbm31qi4",n.charset="UTF-8",n.setAttribute("crossorigin","*"),r.parentNode.insertBefore(n,r)}())},[e]),null);function Joe(e){const t=e.substring(0,10),[n,r,s]=t.split("-").map(Number);return new Date(Date.UTC(n,r-1,s,12,0,0))}function sbe(e,t="MMM dd, yyyy"){return e?Tr(Joe(e),t):""}function Vv(e=new Date){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function ibe(e){const t=Math.floor(e),n=Math.round((e-t)*60);return`${t.toString().padStart(1,"0")}:${n.toString().padStart(2,"0")}`}function obe(e){return e?e.replace(/<[^>]*>/g,""):""}const eae=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{className:"relative w-full",children:a.jsx("table",{ref:n,className:q("w-full caption-bottom text-sm",e),...t})}));eae.displayName="Table";const tae=m.forwardRef(({className:e,...t},n)=>a.jsx("thead",{ref:n,className:q("[&_tr]:border-b",e),...t}));tae.displayName="TableHeader";const nae=m.forwardRef(({className:e,...t},n)=>a.jsx("tbody",{ref:n,className:q("[&_tr:last-child]:border-0",e),...t}));nae.displayName="TableBody";const rae=m.forwardRef(({className:e,...t},n)=>a.jsx("tfoot",{ref:n,className:q("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));rae.displayName="TableFooter";const sae=m.forwardRef(({className:e,...t},n)=>a.jsx("tr",{ref:n,className:q("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));
vendor: 16,941 bytes, lines 600-613
600sae.displayName="TableRow";const iae=m.forwardRef(({className:e,...t},n)=>a.jsx("th",{ref:n,className:q("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));iae.displayName="TableHead";const oae=m.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:q("p-4 align-middle border-r border-gray-200 dark:border-gray-700 [&:has([role=checkbox])]:pr-0 [&:last-child]:border-r-0",e),...t}));oae.displayName="TableCell";const aae=m.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:q("mt-4 text-sm text-muted-foreground",e),...t}));aae.displayName="TableCaption";var R5={exports:{}};/* @license
601Papa Parse
602v5.5.4
603https://github.com/mholt/PapaParse
604License: MIT
605*/(function(e,t){((n,r)=>{e.exports=r()})(Yu,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},s,i=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(N){return N.charCodeAt(0)===65279?N.slice(1):N}function h(N){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(k){var T=E(k);T.chunkSize=parseInt(T.chunkSize),k.step||k.chunk||(T.chunkSize=null),this._handle=new y(T),(this._handle.streamer=this)._config=T}).call(this,N),this.parseChunk=function(k,T){var I=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<I){let L=this._config.newline;L||(F=this._config.quoteChar||'"',L=this._handle.guessLineEndings(k,F)),k=[...k.split(L).slice(I)].join(L)}this.isFirstChunk&&A(this._config.beforeFirstChunk)&&(F=this._config.beforeFirstChunk(k))!==void 0&&(k=F),this.isFirstChunk=!1,this._halted=!1;var I=this._partialLine+k,F=(this._partialLine="",this._handle.parse(I,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(k=F.meta.cursor,I=(this._finished||(this._partialLine=I.substring(k-this._baseIndex),this._baseIndex=k),F&&F.data&&(this._rowCount+=F.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)r.postMessage({results:F,workerId:u.WORKER_ID,finished:I});else if(A(this._config.chunk)&&!T){if(this._config.chunk(F,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=F=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(F.data),this._completeResults.errors=this._completeResults.errors.concat(F.errors),this._completeResults.meta=F.meta),this._completed||!I||!A(this._config.complete)||F&&F.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),I||F&&F.meta.paused||this._nextChunk(),F}this._halted=!0},this._sendError=function(k){A(this._config.error)?this._config.error(k):o&&this._config.error&&r.postMessage({workerId:u.WORKER_ID,error:k,finished:!1})}}function f(N){var k;(N=N||{}).chunkSize||(N.chunkSize=u.RemoteChunkSize),h.call(this,N),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(T){this._input=T,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(k=new XMLHttpRequest,this._config.withCredentials&&(k.withCredentials=this._config.withCredentials),i||(k.onload=R(this._chunkLoaded,this),k.onerror=R(this._chunkError,this)),k.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var T,I=this._config.downloadRequestHeaders;for(T in I)k.setRequestHeader(T,I[T])}var F;this._config.chunkSize&&(F=this._start+this._config.chunkSize-1,k.setRequestHeader("Range","bytes="+this._start+"-"+F));try{k.send(this._config.downloadRequestBody)}catch(L){this._chunkError(L.message)}i&&k.status===0&&this._chunkError()}},this._chunkLoaded=function(){k.readyState===4&&(k.status<200||400<=k.status?this._chunkError():(this._start+=this._config.chunkSize||k.responseText.length,this._finished=!this._config.chunkSize||this._start>=(T=>(T=T.getResponseHeader("Content-Range"))!==null?parseInt(T.substring(T.lastIndexOf("/")+1)):-1)(k),this.parseChunk(k.responseText)))},this._chunkError=function(T){T=k.statusText||T,this._sendError(new Error(T))}}function p(N){(N=N||{}).chunkSize||(N.chunkSize=u.LocalChunkSize),h.call(this,N);var k,T,I=typeof FileReader<"u";this.stream=function(F){this._input=F,T=F.slice||F.webkitSlice||F.mozSlice,I?((k=new FileReader).onload=R(this._chunkLoaded,this),k.onerror=R(this._chunkError,this)):k=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var F=this._input,L=(this._config.chunkSize&&(L=Math.min(this._start+this._config.chunkSize,this._input.size),F=T.call(F,this._start,L)),k.readAsText(F,this._config.encoding));I||this._chunkLoaded({target:{result:L}})},this._chunkLoaded=function(F){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(F.target.result)},this._chunkError=function(){this._sendError(k.error)}}function g(N){var k;h.call(this,N=N||{}),this.stream=function(T){return k=T,this._nextChunk()},this._nextChunk=function(){var T,I;if(!this._finished)return T=this._config.chunkSize,k=T?(I=k.substring(0,T),k.substring(T)):(I=k,""),this._finished=!k,this.parseChunk(I)}}function v(N){h.call(this,N=N||{});var k=[],T=!0,I=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(F){this._input=F,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){I&&k.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),k.length?this.parseChunk(k.shift()):T=!0},this._streamData=R(function(F){try{k.push(typeof F=="string"?F:F.toString(this._config.encoding)),T&&(T=!1,this._checkIsFinished(),this.parseChunk(k.shift()))}catch(L){this._streamError(L)}},this),this._streamError=R(function(F){this._streamCleanUp(),this._sendError(F)},this),this._streamEnd=R(function(){this._streamCleanUp(),I=!0,this._streamData("")},this),this._streamCleanUp=R(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(N){var k,T,I,F,L=Math.pow(2,53),M=-L,$=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,j=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,P=this,D=0,C=0,H=!1,V=!1,O=[],G={data:[],errors:[],meta:{}};function Z(re){return N.skipEmptyLines==="greedy"?re.join("").trim()==="":re.length===1&&re[0].length===0}function ae(){if(G&&I&&(ne("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),I=!1),N.skipEmptyLines&&(G.data=G.data.filter(function(se){return!Z(se)})),te()){let se=function(ke,Me){ke=d(ke),A(N.transformHeader)&&(ke=N.transformHeader(ke,Me)),O.push(ke)};if(G)if(Array.isArray(G.data[0])){for(var re=0;te()&&re<G.data.length;re++)G.data[re].forEach(se);G.data.splice(0,1)}else G.data.forEach(se)}function J(se,ke){for(var Me=N.header?{}:[],Be=0;Be<se.length;Be++){var $e=Be,We=se[Be],We=((Qt,Le)=>(dt=>(N.dynamicTypingFunction&&N.dynamicTyping[dt]===void 0&&(N.dynamicTyping[dt]=N.dynamicTypingFunction(dt)),(N.dynamicTyping[dt]||N.dynamicTyping)===!0))(Qt)?Le==="true"||Le==="TRUE"||Le!=="false"&&Le!=="FALSE"&&((dt=>{if($.test(dt)&&(dt=parseFloat(dt),M<dt&&dt<L))return 1})(Le)?parseFloat(Le):j.test(Le)?new Date(Le):Le===""?null:Le):Le)($e=N.header?Be>=O.length?"__parsed_extra":O[Be]:$e,We=N.transform?N.transform(We,$e):We);$e==="__parsed_extra"?(Me[$e]=Me[$e]||[],Me[$e].push(We)):Me[$e]=We}return N.header&&(Be>O.length?ne("FieldMismatch","TooManyFields","Too many fields: expected "+O.length+" fields but parsed "+Be,C+ke):Be<O.length&&ne("FieldMismatch","TooFewFields","Too few fields: expected "+O.length+" fields but parsed "+Be,C+ke)),Me}var ge;G&&(N.header||N.dynamicTyping||N.transform)&&(ge=1,!G.data.length||Array.isArray(G.data[0])?(G.data=G.data.map(J),ge=G.data.length):G.data=J(G.data,0),N.header&&G.meta&&(G.meta.fields=O),C+=ge)}function te(){return N.header&&O.length===0}function ne(re,J,ge,se){re={type:re,code:J,message:ge},se!==void 0&&(re.row=se),G.errors.push(re)}A(N.step)&&(F=N.step,N.step=function(re){G=re,te()?ae():(ae(),G.data.length!==0&&(D+=re.data.length,N.preview&&D>N.preview?T.abort():(G.data=G.data[0],F(G,P))))}),this.parse=function(re,J,ge){var se=N.quoteChar||'"',se=(N.newline||(N.newline=this.guessLineEndings(re,se)),I=!1,N.delimiter?A(N.delimiter)&&(N.delimiter=N.delimiter(re),G.meta.delimiter=N.delimiter):((se=((ke,Me,Be,$e,We)=>{var Qt,Le,dt,jn;We=We||[",","	","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var pr=0;pr<We.length;pr++){for(var fn,fs=We[pr],on=0,X=0,ce=0,Te=(dt=void 0,new b({comments:$e,delimiter:fs,newline:Me,preview:10}).parse(ke)),Ge=0;Ge<Te.data.length;Ge++)Be&&Z(Te.data[Ge])?ce++:(fn=Te.data[Ge].length,X+=fn,dt===void 0?dt=fn:0<fn&&(on+=Math.abs(fn-dt),dt=fn));0<Te.data.length&&(X/=Te.data.length-ce),(Le===void 0||on<=Le)&&(jn===void 0||jn<X)&&1.99<X&&(Le=on,Qt=fs,jn=X)}return{successful:!!(N.delimiter=Qt),bestDelimiter:Qt}})(re,N.newline,N.skipEmptyLines,N.comments,N.delimitersToGuess)).successful?N.delimiter=se.bestDelimiter:(I=!0,N.delimiter=u.DefaultDelimiter),G.meta.delimiter=N.delimiter),E(N));return N.preview&&N.header&&se.preview++,k=re,T=new b(se),G=T.parse(k,J,ge),ae(),H?{meta:{paused:!0}}:G||{meta:{paused:!1}}},this.paused=function(){return H},this.pause=function(){H=!0,T.abort(),k=A(N.chunk)?"":k.substring(T.getCharIndex())},this.resume=function(){P.streamer._halted?(H=!1,P.streamer.parseChunk(k,!0)):setTimeout(P.resume,3)},this.aborted=function(){return V},this.abort=function(){V=!0,T.abort(),G.meta.aborted=!0,A(N.complete)&&N.complete(G),k=""},this.guessLineEndings=function(ke,se){ke=ke.substring(0,1048576);var se=new RegExp(x(se)+"([^]*?)"+x(se),"gm"),ge=(ke=ke.replace(se,"")).split("\r"),se=ke.split(`
606`),ke=1<se.length&&se[0].length<ge[0].length;if(ge.length===1||ke)return`
607`;for(var Me=0,Be=0;Be<ge.length;Be++)ge[Be][0]===`
608`&&Me++;return Me>=ge.length/2?`\r
609`:"\r"}}function x(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(N){var k=(N=N||{}).delimiter,T=N.newline,I=N.comments,F=N.step,L=N.preview,M=N.fastMode,$=null,j=!1,P=N.quoteChar==null?'"':N.quoteChar,D=P;if(N.escapeChar!==void 0&&(D=N.escapeChar),(typeof k!="string"||-1<u.BAD_DELIMITERS.indexOf(k))&&(k=","),I===k)throw new Error("Comment character same as delimiter");I===!0?I="#":(typeof I!="string"||-1<u.BAD_DELIMITERS.indexOf(I))&&(I=!1),T!==`
610`&&T!=="\r"&&T!==`\r
611`&&(T=`
612`);var C=0,H=!1;this.parse=function(V,O,G){if(typeof V!="string")throw new Error("Input must be a string");var Z=V.length,ae=k.length,te=T.length,ne=I.length,re=A(F),J=[],ge=[],se=[],ke=C=0;if(!V)return on();if(M||M!==!1&&V.indexOf(P)===-1){for(var Me=V.split(T),Be=0;Be<Me.length;Be++){if(se=Me[Be],C+=se.length,Be!==Me.length-1)C+=T.length;else if(G)return on();if(!I||se.substring(0,ne)!==I){if(re){if(J=[],jn(se.split(k)),X(),H)return on()}else jn(se.split(k));if(L&&L<=Be)return J=J.slice(0,L),on(!0)}}return on()}for(var $e=V.indexOf(k,C),We=V.indexOf(T,C),Qt=new RegExp(x(D)+x(P),"g"),Le=V.indexOf(P,C);;)if(V[C]===P)for(Le=C,C++;;){if((Le=V.indexOf(P,Le+1))===-1)return G||ge.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:J.length,index:C}),fn();if(Le===Z-1)return fn(V.substring(C,Le).replace(Qt,P));if(P===D&&V[Le+1]===D)Le++;else if(P===D||Le===0||V[Le-1]!==D){$e!==-1&&$e<Le+1&&($e=V.indexOf(k,Le+1));var dt=pr((We=We!==-1&&We<Le+1?V.indexOf(T,Le+1):We)===-1?$e:Math.min($e,We));if(V.substr(Le+1+dt,ae)===k){se.push(V.substring(C,Le).replace(Qt,P)),V[C=Le+1+dt+ae]!==P&&(Le=V.indexOf(P,C)),$e=V.indexOf(k,C),We=V.indexOf(T,C);break}if(dt=pr(We),V.substring(Le+1+dt,Le+1+dt+te)===T){if(se.push(V.substring(C,Le).replace(Qt,P)),fs(Le+1+dt+te),$e=V.indexOf(k,C),Le=V.indexOf(P,C),re&&(X(),H))return on();if(L&&J.length>=L)return on(!0);break}ge.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:J.length,index:C}),Le++}}else if(I&&se.length===0&&V.substring(C,C+ne)===I){if(We===-1)return on();C=We+te,We=V.indexOf(T,C),$e=V.indexOf(k,C)}else if($e!==-1&&($e<We||We===-1))se.push(V.substring(C,$e)),C=$e+ae,$e=V.indexOf(k,C);else{if(We===-1)break;if(se.push(V.substring(C,We)),fs(We+te),re&&(X(),H))return on();if(L&&J.length>=L)return on(!0)}return fn();function jn(ce){J.push(ce),ke=C}function pr(ce){var Te=0;return Te=ce!==-1&&(ce=V.substring(Le+1,ce))&&ce.trim()===""?ce.length:Te}function fn(ce){return G||(ce===void 0&&(ce=V.substring(C)),se.push(ce),C=Z,jn(se),re&&X()),on()}function fs(ce){C=ce,jn(se),se=[],We=V.indexOf(T,C)}function on(ce){if(N.header&&!O&&J.length&&!j){var Te=J[0],Ge=Object.create(null),B=new Set(Te);let W=!1;for(let Y=0;Y<Te.length;Y++){let oe=d(Te[Y]);if(Ge[oe=A(N.transformHeader)?N.transformHeader(oe,Y):oe]){let de,be=Ge[oe];for(;de=oe+"_"+be,be++,B.has(de););B.add(de),Te[Y]=de,Ge[oe]++,W=!0,($=$===null?{}:$)[de]=oe}else Ge[oe]=1,Te[Y]=oe;B.add(oe)}W&&console.warn("Duplicate headers found and renamed."),j=!0}return{data:J,errors:ge,meta:{delimiter:k,linebreak:T,aborted:H,truncated:!!ce,cursor:ke+(O||0),renamedHeaders:$}}}function X(){F(on()),J=[],ge=[]}},this.abort=function(){H=!0},this.getCharIndex=function(){return C}}function w(N){var k=N.data,T=l[k.workerId],I=!1;if(k.error)T.userError(k.error,k.file);else if(k.results&&k.results.data){var F={abort:function(){I=!0,S(k.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_,resume:_};if(A(T.userStep)){for(var L=0;L<k.results.data.length&&(T.userStep({data:k.results.data[L],errors:k.results.errors,meta:k.results.meta},F),!I);L++);delete k.results}else A(T.userChunk)&&(T.userChunk(k.results,F,k.file),delete k.results)}k.finished&&!I&&S(k.workerId,k.results)}function S(N,k){var T=l[N];A(T.userComplete)&&T.userComplete(k),T.terminate(),delete l[N]}function _(){throw new Error("Not implemented.")}function E(N){if(typeof N!="object"||N===null)return N;var k,T=Array.isArray(N)?[]:{};for(k in N)T[k]=E(N[k]);return T}function R(N,k){return function(){N.apply(k,arguments)}}function A(N){return typeof N=="function"}return u.parse=function(N,k){var T=(k=k||{}).dynamicTyping||!1;if(A(T)&&(k.dynamicTypingFunction=T,T={}),k.dynamicTyping=T,k.transform=!!A(k.transform)&&k.transform,!k.worker||!u.WORKERS_SUPPORTED)return T=null,u.NODE_STREAM_INPUT,typeof N=="string"?(N=d(N),T=new(k.download?f:g)(k)):N.readable===!0&&A(N.read)&&A(N.on)?T=new v(k):(r.File&&N instanceof File||N instanceof Object)&&(T=new p(k)),T.stream(N);(T=(()=>{var I;return!!u.WORKERS_SUPPORTED&&(I=(()=>{var F=r.URL||r.webkitURL||null,L=n.toString();return u.BLOB_URL||(u.BLOB_URL=F.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",L,")();"],{type:"text/javascript"})))})(),(I=new r.Worker(I)).onmessage=w,I.id=c++,l[I.id]=I)})()).userStep=k.step,T.userChunk=k.chunk,T.userComplete=k.complete,T.userError=k.error,k.step=A(k.step),k.chunk=A(k.chunk),k.complete=A(k.complete),k.error=A(k.error),delete k.worker,T.postMessage({input:N,config:k,workerId:T.id})},u.unparse=function(N,k){var T=!1,I=!0,F=",",L=`\r
613`,M='"',$=M+M,j=!1,P=null,D=!1,C=((()=>{if(typeof k=="object"){if(typeof k.delimiter!="string"||u.BAD_DELIMITERS.filter(function(O){return k.delimiter.indexOf(O)!==-1}).length||(F=k.delimiter),typeof k.quotes!="boolean"&&typeof k.quotes!="function"&&!Array.isArray(k.quotes)||(T=k.quotes),typeof k.skipEmptyLines!="boolean"&&typeof k.skipEmptyLines!="string"||(j=k.skipEmptyLines),typeof k.newline=="string"&&(L=k.newline),typeof k.quoteChar=="string"&&(M=k.quoteChar,$=M+M),typeof k.header=="boolean"&&(I=k.header),Array.isArray(k.columns)){if(k.columns.length===0)throw new Error("Option columns is empty");P=k.columns}k.escapeChar!==void 0&&($=k.escapeChar+M),k.escapeFormulae instanceof RegExp?D=k.escapeFormulae:typeof k.escapeFormulae=="boolean"&&k.escapeFormulae&&(D=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(M),"g"));if(typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(N)){if(!N.length||Array.isArray(N[0]))return H(null,N,j);if(typeof N[0]=="object")return H(P||Object.keys(N[0]),N,j)}
613else if(typeof N=="object")return typeof N.data=="string"&&(N.data=JSON.parse(N.data)),Array.isArray(N.data)&&(N.fields||(N.fields=N.meta&&N.meta.fields||P),N.fields||(N.fields=Array.isArray(N.data[0])?N.fields:typeof N.data[0]=="object"?Object.keys(N.data[0]):[]),Array.isArray(N.data[0])||typeof N.data[0]=="object"||(N.data=[N.data])),H(N.fields||[],N.data||[],j);throw new Error("Unable to serialize unrecognized input");function H(O,G,Z){var ae="",te=(typeof O=="string"&&(O=JSON.parse(O)),typeof G=="string"&&(G=JSON.parse(G)),Array.isArray(O)&&0<O.length),ne=!Array.isArray(G[0]);if(te&&I){for(var re=0;re<O.length;re++)0<re&&(ae+=F),ae+=V(O[re],re);0<G.length&&(ae+=L)}for(var J=0;J<G.length;J++){var ge=(te?O:G[J]).length,se=!1,ke=te?Object.keys(G[J]).length===0:G[J].length===0;if(Z&&!te&&(se=Z==="greedy"?G[J].join("").trim()==="":G[J].length===1&&G[J][0].length===0),Z==="greedy"&&te){for(var Me=[],Be=0;Be<ge;Be++){var $e=ne?O[Be]:Be;Me.push(G[J][$e])}se=Me.join("").trim()===""}if(!se){for(var We=0;We<ge;We++){0<We&&!ke&&(ae+=F);var Qt=te&&ne?O[We]:We;ae+=V(G[J][Qt],We)}J<G.length-1&&(!Z||0<ge&&!ke)&&(ae+=L)}}return ae}function V(O,G){var Z,ae,te;return O==null?"":O.constructor===Date?JSON.stringify(O).slice(1,25):(te=!1,D&&typeof O=="string"&&D.test(O)&&(O="'"+O,te=!0),ae=(Z=O.toString()).replace(C,$),(te=te||T===!0||typeof T=="function"&&T(O,G)||Array.isArray(T)&&T[G]||((ne,re)=>{for(var J=0;J<re.length;J++)if(-1<ne.indexOf(re[J]))return!0;return!1})(ae,u.BAD_DELIMITERS)||-1<ae.indexOf(F)||-1<Z.indexOf(M)||ae.charAt(0)===" "||ae.charAt(ae.length-1)===" ")?M+ae+M:ae)}},u.RECORD_SEP="�",u.UNIT_SEP="�",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
614`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=b,u.ParserHandle=y,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=g,u.ReadableStreamStreamer=v,r.jQuery&&((s=r.jQuery).fn.parse=function(N){var k=N.config||{},T=[];return this.each(function(L){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var M=0;M<this.files.length;M++)T.push({file:this.files[M],inputElem:this,instanceConfig:s.extend({},k)})}),I(),this;function I(){if(T.length===0)A(N.complete)&&N.complete();else{var L,M,$,j,P=T[0];if(A(N.before)){var D=N.before(P.file,P.inputElem);if(typeof D=="object"){if(D.action==="abort")return L="AbortError",M=P.file,$=P.inputElem,j=D.reason,void(A(N.error)&&N.error({name:L},M,$,j));if(D.action==="skip")return void F();typeof D.config=="object"&&(P.instanceConfig=s.extend(P.instanceConfig,D.config))}else if(D==="skip")return void F()}var C=P.instanceConfig.complete;P.instanceConfig.complete=function(H){A(C)&&C(H,P.file,P.inputElem),F()},u.parse(P.file,P.instanceConfig)}}function F(){T.splice(0,1),I()}}),o&&(r.onmessage=function(N){N=N.data,u.WORKER_ID===void 0&&N&&(u.WORKER_ID=N.workerId),typeof N.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(N.input,N.config),finished:!0}):(r.File&&N.input instanceof File||N.input instanceof Object)&&(N=u.parse(N.input,N.config))&&r.postMessage({workerId:u.WORKER_ID,results:N,finished:!0})}),(f.prototype=Object.create(h.prototype)).constructor=f,(p.prototype=Object.create(h.prototype)).constructor=p,(g.prototype=Object.create(g.prototype)).constructor=g,(v.prototype=Object.create(h.prototype)).constructor=v,u})})(R5);var lae=R5.exports;const abe=H0(lae),cae=[{icon:a.jsx(vo,{className:"w-4 h-4"}),text:"AI Tax Advisor that answers your REPS questions and cites the exact IRS publications"},{icon:a.jsx(Ud,{className:"w-4 h-4"}),text:"Know your audit risk before the IRS does — real-time readiness scoring"},{icon:a.jsx(vx,{className:"w-4 h-4"}),text:"Personalized compliance analysis based on your properties and hours"},{icon:a.jsx(pH,{className:"w-4 h-4"}),text:"Full API Integration — build custom workflows and sync with your CPA's tools"},{icon:a.jsx(oH,{className:"w-4 h-4"}),text:"Priority support from our team"}],X_=({isOpen:e,open:t,onClose:n,onOpenChange:r,feature:s,upgradeReason:i,onSubscribe:o,isSubscribing:l,targetTier:c})=>{const u=e??t??!1,d=m.useRef(!1);m.useEffect(()=>{if(!u){d.current=!1;return}d.current||(d.current=!0,wa("paywall_viewed",{target_tier:c??"base",...s?{feature:s}:{},...i?{upgrade_reason:i}:{}}))},[u,s,i,c]);const h=n||(()=>r==null?void 0:r(!1)),{user:f}=Wt(),{subscription:p}=Hm(),{toast:g}=sn(),[v,y]=m.useState(!1),[x,b]=m.useState("annual"),[w,S]=m.useState(!1),{data:_}=P_(),E=p==null?void 0:p.subscriptionStatus,R=(p==null?void 0:p.subscriptionTier)||"base",N=(E==="active"||E==="suspended")&&R!=="premium",k=(p==null?void 0:p.isOnTrial)||(f==null?void 0:f.isOnTrial),T=c==="premium"?(_==null?void 0:_.premiumMonthlyPrice)||29:(_==null?void 0:_.monthlyPrice)||10,I=c==="premium"?(_==null?void 0:_.premiumAnnualPrice)||279:(_==null?void 0:_.annualPriceMin)||100,F=Math.round(I/12*100)/100,L=T*12-I,M=async D=>{if(!f){g({title:"Authentication Required",description:"Please sign in to start your trial.",variant:"destructive"});return}y(!0);try{const C=window.location.origin,H=await dc({priceType:D,tier:c||"base",successUrl:`${C}/?payment=success`,cancelUrl:`${C}/?payment=cancelled`});H.upgraded?(g({title:"Plan Updated",description:H.message}),h(),window.location.reload()):H.checkoutUrl&&(window.location.href=H.checkoutUrl)}catch(C){if((C==null?void 0:C.status)===409){g({title:"Already Subscribed",description:"Opening your billing portal…"});try{const H=await xp();H?window.location.href=H:window.location.reload();return}catch{}return}console.error("Checkout error:",C),g({title:"Checkout Error",description:C.message||"Failed to start checkout process. Please try again.",variant:"destructive"})}finally{y(!1)}},$=async()=>
614{if(!f){g({title:"Authentication Required",description:"Please sign in to upgrade your account.",variant:"destructive"});return}y(!0);try{if(o)await o(x);else{const D=window.location.origin,C=await dc({priceType:x,tier:c||"base",successUrl:`${D}/?payment=success`,cancelUrl:`${D}/?payment=cancelled`});C.upgraded?(g({title:"Plan Updated",description:C.message}),h(),window.location.reload()):C.checkoutUrl&&(window.location.href=C.checkoutUrl)}}catch(D){if((D==null?void 0:D.status)===409){g({title:"Already Subscribed",description:"Opening your billing portal…"});try{const C=await xp();C?window.location.href=C:window.location.reload();return}catch{}return}console.error("Upgrade error:",D),g({title:"Upgrade Error",description:D.message||"Failed to start upgrade process. Please try again.",variant:"destructive"})}finally{y(!1)}},j=()=>{if(N){S(!0);return}if(k){$();return}f!=null&&f.hasUsedTrial?$():M(x)},P=v||l;return a.jsxs(a.Fragment,{children:[w&&a.jsx(BF,{isOpen:w,onClose:()=>S(!1),targetPriceType:x,targetTier:c||"premium",onSuccess:()=>{S(!1),h(),window.location.reload()}}),a.jsx($s,{open:u,onOpenChange:h,children:a.jsxs(os,{className:"max-w-md p-0 overflow-hidden gap-0",children:[a.jsx("div",{className:"bg-gradient-to-br from-green-600 to-green-700 px-6 pt-6 pb-5",children:a.jsxs(as,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"p-1.5 bg-white/20 rounded-md",children:a.jsx(Cr,{className:"w-4 h-4 text-white"})}),a.jsx(Is,{className:"bg-white/20 text-white border-0 text-xs font-medium hover:bg-white/20",children:"Shield Advisor"})]}),a.jsx(ls,{className:"text-white text-xl font-semibold leading-snug",children:s?`${s} requires Shield Advisor`:"Upgrade to Shield Advisor"}),i&&a.jsx("p",{className:"text-green-100 text-sm mt-1 leading-relaxed",children:i})]})}),a.jsxs("div",{className:"px-6 py-5 space-y-5",children:[a.jsxs("div",{className:"flex items-center gap-2 p-1 bg-muted rounded-lg",children:[a.jsx("button",{onClick:()=>b("monthly"),className:q("flex-1 text-sm font-medium py-1.5 px-3 rounded-md transition-all duration-150",x==="monthly"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"Monthly"}),a.jsxs("button",{onClick:()=>b("annual"),className:q("flex-1 text-sm font-medium py-1.5 px-3 rounded-md transition-all duration-150 flex items-center justify-center gap-1.5",x==="annual"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:["Annual",a.jsxs("span",{className:"text-xs text-green-600 font-semibold",children:["Save $",L]})]})]}),a.jsx("div",{className:"text-center",children:x==="monthly"?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-4xl font-bold text-foreground",children:["$",T]}),a.jsx("span",{className:"text-muted-foreground text-sm ml-1",children:"/month"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-4xl font-bold text-foreground",children:["$",I]}),a.jsx("span",{className:"text-muted-foreground text-sm ml-1",children:"/year"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:["$",F,"/mo — billed annually"]})]})}),a.jsxs("div",{className:"space-y-2.5",children:[cae.map((D,C)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-green-50 dark:bg-green-900/30 flex items-center justify-center text-green-600 dark:text-green-400",children:D.icon}),a.jsx("span",{className:"text-sm text-foreground",children:D.text})]},C)),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-green-50 dark:bg-green-900/30 flex items-center justify-center text-green-600 dark:text-green-400",children:a.jsx(bt,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-sm text-foreground",children:"Everything in Shield Essential, included"})]})]}),a.jsxs("div",{className:"pt-1 space-y-3",children:[a.jsx(ie,{onClick:j,disabled:!!P,className:"w-full bg-green-600 hover:bg-green-700 text-white font-semibold h-11 text-base shadow-sm transition-all duration-150",children:P?"Processing...":N||k?"Upgrade to Shield Advisor":f!=null&&f.hasUsedTrial?"Subscribe Now":"Start 14-Day Free Trial"}),a.jsxs("div",{className:"flex items-center justify-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Ud,{className:"w-3 h-3"}),"Cancel anytime"]}),!(f!=null&&f.hasUsedTrial)&&!N&&!k&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground
614/40",children:"·"}),a.jsx("span",{children:"No credit card for trial"})]})]})]})]}),a.jsx("div",{className:"px-6 pb-4",children:a.jsx(ie,{variant:"ghost",onClick:h,className:"w-full text-muted-foreground hover:text-foreground text-sm h-9",children:"Maybe later"})})]})})]})};function M5({children:e,tooltipText:t,feature:n,disabled:r=!0,showUpgradeButton:s=!0,customTooltipPosition:i="top",className:o="",onUpgradeClick:l}){const{user:c}=Wt(),{canAccessPremiumFeatures:u}=Hm(),[d,h]=m.useState(!1),[f,p]=m.useState(!1);if(u||c!=null&&c.isOnTrial)return a.jsx(a.Fragment,{children:e});const g=()=>{l?l():h(!0)};return a.jsx(d_,{children:a.jsxs("div",{className:`relative inline-block ${o}`,children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{onClick:g,className:"cursor-pointer",children:e}),a.jsx("div",{className:"absolute top-1 right-1 text-yellow-400 z-10 pointer-events-none",children:a.jsx(Cr,{className:"h-3 w-3 drop-shadow-lg"})}),a.jsx("div",{className:"absolute inset-0 z-20",children:a.jsxs(Dee,{children:[a.jsx(Lee,{asChild:!0,children:a.jsx("div",{className:"w-full h-full cursor-pointer"})}),a.jsx(zD,{side:i,className:"max-w-xs",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"font-medium",children:n}),a.jsx("p",{className:"text-sm text-gray-600",children:t}),a.jsxs(ie,{size:"sm",onClick:g,className:"w-full bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white",children:[a.jsx(Cr,{className:"h-3 w-3 mr-1"}),"Upgrade to Shield Advisor"]})]})})]})})]}),s&&a.jsxs(ie,{onClick:g,className:"ml-4 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-md flex items-center gap-2 shrink-0",size:"sm",children:[a.jsx(Cr,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Upgrade to Shield Advisor"}),a.jsx("span",{className:"sm:hidden",children:"Upgrade"})]}),a.jsx(X_,{isOpen:d,onClose:()=>h(!1),onOpenChange:h,feature:n,upgradeReason:t})]})})}function O5({onFilesSelected:e,maxFiles:t=5,acceptedFileTypes:n={"image/*":[".png",".jpg",".jpeg"],"application/pdf":[".pdf"]},className:r}){const[s,i]=m.useState(!1),o=m.useRef(null),[l,c]=m.useState([]),u=v=>{v.preventDefault(),v.stopPropagation(),v.type==="dragenter"||v.type==="dragover"?i(!0):v.type==="dragleave"&&i(!1)},d=v=>{v.preventDefault(),v.stopPropagation(),i(!1),v.dataTransfer.files&&v.dataTransfer.files.length>0&&h(Array.from(v.dataTransfer.files))},h=v=>{const y=[],x=Object.values(n).flat();if(v.forEach(b=>{var S;const w="."+((S=b.name.split(".").pop())==null?void 0:S.toLowerCase());x.includes(w)&&y.push(b)}),y.length>0){const b=[...l,...y].slice(0,t);c(b),e(b)}},f=v=>{v.target.files&&v.target.files.length>0&&h(Array.from(v.target.files))},p=v=>{const y=l.filter((x,b)=>b!==v);c(y),e(y)},g=()=>{var v;(v=o.current)==null||v.click()};return a.jsxs("div",{className:q("w-full space-y-3",r),children:[a.jsxs("div",{className:q("flex flex-col items-center justify-center px-6 py-8 border-2 border-dashed rounded-lg transition-colors cursor-pointer bg-gray-50/50 hover:bg-gray-50",s?"border-primary bg-primary/5":"border-gray-300 hover:border-primary/50"),onDragEnter:u,onDragLeave:u,onDragOver:u,onDrop:d,onClick:g,children:[a.jsx(fd,{className:"h-10 w-10 text-gray-400 mb-3"}),a.jsxs("div",{className:"text-sm text-center text-gray-600",children:[a.jsx("span",{className:"font-semibold text-primary hover:text-primary/80",children:"Click to upload"})," ","or drag and drop"]}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Supported formats:"," ",Object.values(n).flat().join(", ")]})]}),l.length>0&&a.jsx("div",{className:"space-y-2",children:l.map((v,y)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-white border border-gray-200 rounded-lg shadow-sm",children:[a.jsxs("div",{className:"flex items-center space-x-3 overflow-hidden",children:[a.jsx("div",{className:"p-2 bg-blue-50 rounded-md",children:a.jsx(Nr,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-700 truncate",children:v.name}),a.jsxs("p",{className:"text-xs text-gray-500",children:[(v.size/1024).toFixed(1)," KB"]}
614)]})]}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:x=>{x.stopPropagation(),p(y)},className:"text-gray-400 hover:text-red-500 hover:bg-red-50",children:a.jsx(vn,{className:"h-4 w-4"})})]},y))}),a.jsx("input",{ref:o,type:"file",className:"sr-only",multiple:!0,accept:Object.values(n).flat().join(","),onChange:f})]})}const uae=z_({date:Gn().min(1,"Date is required"),hours:Gn().min(1,"Hours is required"),activityType:Gn().min(1,"Activity type is required"),description:Gn().optional(),propertyId:Gn().optional(),isMaterialParticipation:Pd(),isQualifiedNonMaterial:Pd()}).refine(e=>!(e.isMaterialParticipation&&e.isQualifiedNonMaterial),{path:["isQualifiedNonMaterial"],message:"Choose only one classification type"});function lbe({open:e,onClose:t,onSubmit:n,properties:r,entry:s,isSubmitting:i=!1}){const{toast:o}=sn(),{user:l}=Wt(),[c,u]=m.useState(!1),[d,h]=m.useState([]),f=(l==null?void 0:l.repType)==="longTerm",p=Io(),g=F_({resolver:$_(uae),defaultValues:{date:"",hours:"",activityType:"",description:"",propertyId:"none",isMaterialParticipation:!1,isQualifiedNonMaterial:!1}});m.useEffect(()=>{if(s&&e){const w=s.date?s.date.substring(0,10):"";g.reset({date:w,hours:s.hours.toString(),activityType:s.activityType||"",description:s.description||"",propertyId:s.propertyId?s.propertyId.toString():"none",isMaterialParticipation:s.isMaterialParticipation||!1,isQualifiedNonMaterial:s.isQualifiedNonMaterial||!1})}},[s,e,g]);const v=async()=>{const w=g.getValues("description");if(!(w!=null&&w.trim())){o({title:"No Description",description:"Please enter a description first",variant:"destructive"});return}u(!0);const S=g.getValues("propertyId"),_=r.find(E=>E.id===S);y.mutate({originalDescription:w,activityType:g.getValues("activityType"),propertyNickname:_==null?void 0:_.nickname})},y=gt({mutationFn:async w=>(await Xe("POST","/api/ai/enhance-description",w)).json(),onSuccess:w=>{w.success&&(g.setValue("description",w.result.enhancedDescription),o({title:"Description Enhanced",description:`AI improvements applied with ${Math.round(w.result.confidence*100)}% confidence`}))},onError:w=>{o({title:"Enhancement Failed",description:w.message||"Failed to enhance description",variant:"destructive"})},onSettled:()=>{u(!1)}}),x=async w=>{if(s)try{const S=parseFloat(w.hours);if(S<.0167||S>24){o({title:"Validation Error",description:"Hours must be between 1 minute and 24 hours",variant:"destructive"});return}await n(s.id,w,d),h([]),t(),o({title:"Success",description:"Time entry updated successfully"})}catch(S){o({title:"Error",description:S.message||"Failed to update entry",variant:"destructive"})}};if(!s)return null;const b=a.jsx(V_,{...g,children:a.jsxs("form",{onSubmit:g.handleSubmit(x),className:"min-w-0 max-w-full space-y-4 overflow-x-hidden",children:[a.jsx(Sr,{control:g.control,name:"date",render:({field:w})=>a.jsxs(Wn,{className:"min-w-0",children:[a.jsx(qn,{children:"Date"}),a.jsx(ir,{children:a.jsx(Ct,{type:"date",...w,className:"min-w-0 max-w-full appearance-none overflow-hidden"})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:g.control,name:"hours",render:({field:w})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Hours"}),a.jsx(ir,{children:a.jsx(p_,{value:w.value,onChange:w.onChange,placeholder:"Enter hours (e.g., 2.5)"})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:g.control,name:"activityType",render:({field:w})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Activity Type"}),a.jsx(ir,{children:a.jsx(y_,{value:w.value,onValueChange:w.onChange,placeholder:"Select activity type..."})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:g.control,name:"propertyId",render:({field:w})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Property (Optional)"}),a.jsx(ir,{children:a.jsxs(ko,{value:w.value,onValueChange:w.onChange,children:[a.jsx(ki,{children:a.jsx(So,{placeholder:"Select a property..."})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"none",children:"No property"}),r.map(S=>{var E;const _=((E=S.id)==null?void 0:E.toString())||`property-fallback-${Date.now()}`;return!_||_===""||_==="undefined"||_==="null"?(console.error("Invalid property ID detected:",S),null):a.jsx(Cn,{value:_,children:S.nickname||S.address||"Unnamed Property"},_)}
614).filter(Boolean)]})]})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:g.control,name:"description",render:({field:w})=>a.jsxs(Wn,{children:[a.jsxs(qn,{className:"flex items-center justify-between text-sm font-normal",children:["Description",w.value&&a.jsx(M5,{feature:"AI Description Enhancement",tooltipText:"Enhance your time entry descriptions with AI to make them IRS audit-ready and professional. Premium feature for compliance.",showUpgradeButton:!1,children:a.jsx(ie,{type:"button",variant:"outline",size:"sm",onClick:v,disabled:c,className:"h-7 px-2 text-xs",children:c?a.jsxs(a.Fragment,{children:[a.jsx(dd,{className:"w-3 h-3 mr-1 animate-spin"}),"Enhancing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(cR,{className:"w-3 h-3 mr-1"}),"Enhance with AI"]})})})]}),a.jsx(ir,{children:a.jsx(Us,{placeholder:"Briefly describe the activity: type, property address, date & duration, tasks performed, purpose, outcome, and reference any attached documents.",rows:3,...w})}),a.jsx(or,{})]})}),a.jsxs(Wn,{children:[a.jsx(qn,{children:"Category"}),a.jsxs(ko,{value:g.watch("isQualifiedNonMaterial")?"qualified":g.watch("isMaterialParticipation")?"material":"passive",onValueChange:w=>{w==="material"?(g.setValue("isMaterialParticipation",!0),g.setValue("isQualifiedNonMaterial",!1)):w==="qualified"?(g.setValue("isMaterialParticipation",!1),g.setValue("isQualifiedNonMaterial",!0)):(g.setValue("isMaterialParticipation",!1),g.setValue("isQualifiedNonMaterial",!1))},children:[a.jsx(ki,{children:a.jsx(So,{placeholder:"Select classification"})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"material",children:"Material Participation"}),f&&a.jsx(Cn,{value:"qualified",children:"Qualified Non-Material"})]})]}),a.jsx(B_,{children:"Select how this activity relates to your REP status."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Evidence Files"}),s.evidenceFiles&&s.evidenceFiles.length>0&&a.jsxs("div",{className:"space-y-2 mb-4",children:[a.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Attached Files"}),s.evidenceFiles.map((w,S)=>!w.isDeleted&&a.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted/50 rounded-md text-sm border",children:[a.jsxs("div",{className:"flex items-center gap-2 truncate",children:[a.jsx(Nr,{className:"h-4 w-4 text-blue-500"}),a.jsx("span",{className:"truncate max-w-[200px]",children:w.fileName||w.originalName})]}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>window.open(w.fileUrl,"_blank"),children:a.jsx(Cl,{className:"h-3.5 w-3.5"})})]},S))]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider mb-2",children:"Upload New Files"}),a.jsx(O5,{onFilesSelected:h,maxFiles:5,acceptedFileTypes:{"image/*":[".png",".jpg",".jpeg"],"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/msword":[".doc"]}})]})]}),p?a.jsx("div",{className:"pt-6 pb-safe-bottom",children:a.jsx(ie,{type:"submit",className:"w-full",disabled:i,children:i?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update Entry"})}):a.jsxs(Ed,{children:[a.jsx(ie,{type:"button",variant:"outline",onClick:t,disabled:i,children:"Cancel"}),a.jsx(ie,{type:"submit",disabled:i,children:i?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update Entry"})]})]})});return p?a.jsx(K2,{children:e&&a.jsxs(kn.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300,mass:.8},className:"fixed inset-0 z-[60] bg-white dark:bg-gray-950 overflow-hidden flex flex-col",children:[a.jsx(Wee,{title:"Modify Entry",showBack:!0,onBack:t,forceShow:!0,className:"bg-white/80 dark:bg-gray-950/80 backdrop-blur-md border-b border-gray-100 dark:border-gray-800"}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden px-4 pb-safe-bottom pt-[calc(env(safe-area-inset-top)+64px)]","data-no-nav-clearance":"",children:b})]})}):a.jsx($s,{open:e,onOpenChange:t,children:a.jsxs(os,{className:"max-w-2xl w-[95vw] sm:w-full max-h-[90vh] overflow-y-auto overflow-x-hidden",children:[a.jsxs(as,{children:[a.jsx(ls,{children:"Modify Time Entry"}),a.jsx(Eo,{children:"Update the details for this time entry."})]}),b]})})}const dae=/^(thanks?( you)?( so much| a lot)?|thx|ty|ok(ay)?|k+|got ?it(,?\s*thanks)?|gotcha|sounds (good|great)(,?\s*thanks)?|perfect|great|nice( one)?|cool|awesome|sure|yep|yup|yes|no problem|np|no worries|all good|that works|makes sense|nope|no thanks|nvm|never ?mind)[\s!.,]*$/i;function D5(e){const t=e.trim();return t?dae.test(t):!1}const hae=new Set(["prepareTimeEntry","presentSelectForm","presentQuestionnaire","presentRemediation","presentLogTimeForm","presentAddPropertyForm","presentTaxProfileForm","presentDisplayProperties","presentUnloggedSignals","presentCostSegEstimate","presentMultiCostSegEstimate","presentRentEstimate","redirectToAdvisor"]);async function fae(e){const t=await e.arrayBuffer(),n=btoa(new Uint8Array(t).reduce((r,s)=>r+String.fromCharCode(s),""));return{type:"file",mediaType:e.type,filename:e.name,url:`data:${e.type};base64,${n}`}}function pae(e){return e.parts.filter(t=>t.type==="text").map(t=>t.text).join("")}function L5(){const[e,t]=m.useState([]),n=m.useRef([]);n.current=e;const[r,s]=m.useState(!1),[i,o]=m.useState(!1),l=m.useRef(!1);l.current=r;const[c,u]=m.useState(null),[d,h]=m.useState(null),[f,p]=m.useState(null),g=m.useRef(null),v=m.useRef(null),y=m.useRef(null),x=m.useCallback(async(A,
614N,k=[])=>{var F,L;const T=n.current.find(M=>M.id===A),I=((L=(F=T==null?void 0:T.parts)==null?void 0:F.filter(M=>M.type==="text"))==null?void 0:L.map(M=>M.text).join(""))??"";if(!(!I||!N)){y.current=A,t(M=>M.map($=>$.id===A?{...$,metadata:{...$.metadata,suggestionsLoading:!0}}:$));try{const M=localStorage.getItem("accessToken"),$={"Content-Type":"application/json"};M&&($.Authorization=`Bearer ${M}`);const j=v.current??new AbortController;v.current=j;const P=await fetch("/api/agent/suggestions",{method:"POST",headers:$,body:JSON.stringify({fullText:I,userQuery:N,mode:"logger",toolsUsed:k}),signal:j.signal});if(!P.ok)throw new Error(`Suggestions HTTP ${P.status}`);const C=(await P.json()).suggestions??[];if(y.current!==A)return;t(H=>H.map(V=>V.id===A?{...V,metadata:{...V.metadata,suggestions:C.length>0?C:void 0,suggestionsLoading:!1}}:V))}catch(M){if(M instanceof Error&&M.name==="AbortError")return;console.error("[Agent] Suggestions fetch failed:",M),t($=>$.map(j=>j.id===A?{...j,metadata:{...j.metadata,suggestionsLoading:!1}}:j))}}},[]),b=m.useCallback(async(A,N)=>{var L;s(!0),o(!0),u(null),h(null),p(null);const k=`assistant-${Date.now()}`,T={id:k,role:"assistant",parts:[],metadata:{status:"streaming"}};t(M=>[...M,T]);const I=new AbortController;g.current=I;const F=[];try{const M=localStorage.getItem("accessToken"),$={"Content-Type":"application/json"};M&&($.Authorization=`Bearer ${M}`);const j=await fetch("/api/agent/chat",{method:"POST",headers:$,body:JSON.stringify({messages:N}),signal:I.signal});if(!j.ok)throw new Error(`HTTP error: ${j.status}`);const P=(L=j.body)==null?void 0:L.getReader();if(!P)throw new Error("No response body");const D=new TextDecoder;let C="",H="";for(;;){const{done:V,value:O}=await P.read();if(V)break;C+=D.decode(O,{stream:!0});const G=C.split(`
615
616`);C=G.pop()||"";for(const Z of G){const ae=Z.split(`
617`);for(const te of ae)if(te.startsWith("data: "))try{const ne=JSON.parse(te.slice(6));if(ne.type==="text")H+=ne.content,h(null),p(null),t(re=>re.map(J=>J.id===k?{...J,parts:[...J.parts.filter(ge=>ge.type!=="text"),{type:"text",text:H}]}:J));else if(ne.type==="status")h(ne.status),p(ne.label);else if(ne.type==="tool-call"){if(h("tool-call"),p(ne.toolName),ne.actualToolName&&F.push(ne.actualToolName),ne.actualToolName&&hae.has(ne.actualToolName)){const re={type:`tool-${ne.actualToolName}`,toolCallId:ne.toolCallId,input:ne.input,state:"complete"};t(J=>J.map(ge=>ge.id===k?{...ge,parts:[...ge.parts,re]}:ge))}}else if(ne.type==="done"){h(null),p(null);const re=new Date().toISOString();t(J=>J.map(ge=>ge.id===k?{...ge,metadata:{...ge.metadata,provider:ne.provider,mode:ne.mode,status:"done",completedAt:re}}:ge)),v.current&&(v.current.abort(),v.current=null),D5(A)||x(k,A,F)}else ne.type==="error"&&u(new Error(ne.error))}catch(ne){console.error("[Agent] Failed to parse SSE data:",ne)}}}}catch(M){M instanceof Error&&M.name==="AbortError"?t($=>$.map(j=>j.id===k?{...j,metadata:{...j.metadata,status:"stopped"}}:j)):(console.error("[Agent] Stream error:",M),u(M instanceof Error?M:new Error("Stream failed")))}finally{s(!1),o(!1),g.current=null}},[x]),w=m.useCallback(async(A,N)=>{let k=[];N&&N.length>0&&(k=await Promise.all(N.map(fae)));const T={id:`user-${Date.now()}`,role:"user",parts:k.length>0?[...k,{type:"text",text:A}]:[{type:"text",text:A}]},I=[...n.current,T];n.current=I,t(I),await b(A,I)},[b]),S=m.useCallback(()=>{var A;(A=g.current)==null||A.abort()},[]),_=m.useCallback(()=>{if(l.current)return;const A=n.current;let N=-1;for(let I=A.length-1;I>=0;I--)if(A[I].role==="user"){N=I;break}if(N===-1)return;const k=pae(A[N]);if(!k)return;const T=A.slice(0,N+1);n.current=T,t(T),b(k,T)},[b]);function E(){t([]),u(null),h(null),p(null)}return{messages:e,isLoading:r,isStreaming:i,error:c,send:w,stop:S,regenerate:_,clearMessages:E,setMessages:t,metadata:{},pipelineStatusLabel:f,pipelineStatus:d}}const mae=new Set(["prepareTimeEntry","presentSelectForm","presentQuestionnaire","presentRemediation","presentLogTimeForm","presentAddPropertyForm","presentTaxProfileForm","presentDisplayProperties","presentCostSegEstimate","presentRentEstimate"]);function gae(e){return e.parts.filter(t=>t.type==="text").map(t=>t.text).join("")}function F5({mode:e}={}){const t=m.useRef(e);t.current=e;const[n,r]=m.useState([]),s=m.useRef([]);s.current=n;const[i,o]=m.useState(!1),[l,c]=m.useState(!1),u=m.useRef(!1);u.current=i;const[d,h]=m.useState(),[f,p]=m.useState(null),[g,v]=m.useState(null),y=m.useRef(null),x=m.useRef(null),b=m.useRef(null),w=m.useCallback(async(N,k,T,I=[])=>{var M,$;const F=s.current.find(j=>j.id===N),L=(($=(M=F==null?void 0:F.parts)==null?void 0:M.filter(j=>j.type==="text"))==null?void 0:$.map(j=>j.text).join(""))??"";if(!(!L||!k)){b.current=N,r(j=>j.map(P=>P.id===N?{...P,metadata:{...P.metadata,suggestionsLoading:!0}}:P));try{const j=localStorage.getItem("accessToken"),P={"Content-Type":"application/json"};j&&(P.Authorization=`Bearer ${j}`);const D=x.current??new AbortController;x.current=D;const C=await fetch("/api/advisor/suggestions",{method:"POST",headers:P,body:JSON.stringify({fullText:L,userQuery:k,mode:T??"advisor",toolsUsed:I}),signal:D.signal});if(!C.ok)throw new Error(`Suggestions HTTP ${C.status}`);const V=(await C.json()).suggestions??[];if(b.current!==N)return;r(O=>O.map(G=>
617G.id===N?{...G,metadata:{...G.metadata,suggestions:V.length>0?V:void 0,suggestionsLoading:!1}}:G))}catch(j){if(j instanceof Error&&j.name==="AbortError")return;console.error("[Advisor] Suggestions fetch failed:",j),r(P=>P.map(D=>D.id===N?{...D,metadata:{...D.metadata,suggestionsLoading:!1}}:D))}}},[]),S=m.useCallback(async(N,k)=>{var $;const T=t.current;o(!0),c(!0),h(void 0),p("streaming"),v("Thinking…");const I=`assistant-${Date.now()}`,F={id:I,role:"assistant",parts:[],metadata:{status:"streaming"}};r(j=>[...j,F]);const L=new AbortController;y.current=L;const M=[];try{const j=localStorage.getItem("accessToken"),P={"Content-Type":"application/json"};j&&(P.Authorization=`Bearer ${j}`);const D=await fetch("/api/advisor/chat",{method:"POST",headers:P,body:JSON.stringify({messages:k,mode:T}),signal:L.signal});if(!D.ok)throw new Error(`HTTP error: ${D.status}`);const C=($=D.body)==null?void 0:$.getReader();if(!C)throw new Error("No response body");const H=new TextDecoder;let V="",O="";for(;;){const{done:G,value:Z}=await C.read();if(G)break;V+=H.decode(Z,{stream:!0});const ae=V.split(`
618
619`);V=ae.pop()||"";for(const te of ae){const ne=te.split(`
620`);for(const re of ne)if(re.startsWith("data: "))try{const J=JSON.parse(re.slice(6));if(J.type==="text")O+=J.content,p(null),v(null),r(ge=>ge.map(se=>se.id===I?{...se,parts:[...se.parts.filter(ke=>(ke==null?void 0:ke.type)!=="text"),{type:"text",text:O}]}:se));else if(J.type==="status")p(J.status),v(J.label);else if(J.type==="tool-call"){if(p("tool-call"),v(J.toolName),J.actualToolName&&M.push(J.actualToolName),J.actualToolName&&mae.has(J.actualToolName)){const ge={type:`tool-${J.actualToolName}`,toolCallId:J.toolCallId,input:J.input,state:"complete"};r(se=>se.map(ke=>ke.id===I?{...ke,parts:[...ke.parts,ge]}:ke))}}else if(J.type==="done"){p(null),v(null);const ge=new Date().toISOString();r(se=>se.map(ke=>ke.id===I?{...ke,metadata:{...ke.metadata,provider:J.provider,traceId:J.traceId,mode:J.mode,status:"done",completedAt:ge}}:ke)),x.current&&(x.current.abort(),x.current=null),D5(N)||w(I,N,T,M)}else J.type==="error"&&h(J.error)}catch(J){console.error("[Advisor] Failed to parse SSE data:",J)}}}}catch(j){j instanceof Error&&j.name==="AbortError"?r(P=>P.map(D=>D.id===I?{...D,metadata:{...D.metadata,status:"stopped"}}:D)):(console.error("[Advisor] Stream error:",j),h(j instanceof Error?j.message:"Stream failed"))}finally{o(!1),c(!1),y.current=null}},[w]),_=m.useCallback(async N=>{const k={id:`user-${Date.now()}`,role:"user",parts:[{type:"text",text:N}]},T=[...s.current,k];s.current=T,r(T),await S(N,T)},[S]),E=m.useCallback(()=>{var N;(N=y.current)==null||N.abort()},[]),R=m.useCallback(()=>{if(u.current)return;const N=s.current;let k=-1;for(let F=N.length-1;F>=0;F--)if(N[F].role==="user"){k=F;break}if(k===-1)return;const T=gae(N[k]);if(!T)return;const I=N.slice(0,k+1);s.current=I,r(I),S(T,I)},[S]);function A(){r([]),h(void 0),p(null),v(null)}return{messages:n,isLoading:i,isStreaming:l,error:d,send:_,stop:E,regenerate:R,clearMessages:A,setMessages:r,metadata:{},pipelineStatusLabel:g,pipelineStatus:f}}async function vae(){return(await Xe("GET","/api/advisor/mode")).json()}async function yae(){return(await Xe("GET","/api/advisor/tax-profile")).json()}async function J_(e){await Xe("PATCH","/api/advisor/tax-profile",e)}async function xae(e){try{await Xe("PUT","/api/advisor/mode",{mode:e})}catch(t){if(t instanceof ro){if(t.status===403){const n=t.body;throw new ro((n==null?void 0:n.error)||"Shield Advisor required for Advisor mode.",403,{requiresUpgrade:!0})}if(t.status===503)throw new ro("AI Advisor Mode is not currently available.",503,{retryable:!1})}throw t}}async function bae(){const e=await fetch("/api/advisor/tax-profile/suggestions",{credentials:"include"});if(!e.ok)throw new Error("Failed to fetch suggestions");return e.json()}async function wae(e){return(await Xe("POST","/api/advisor/audit/drafts",e)).json()}async function _ae(e){return(await Xe("POST",`/api/advisor/audit/drafts/${e}/apply`)).json()}async function kae(e){return(await Xe("POST",`/api/advisor/audit/drafts/${e}/discard`)).json()}async function Sae(e){const n=new URLSearchParams().toString(),r=`/api/advisor/audit/drafts${n?`?${n}`:""}`;return(await Xe("GET",r)).json()}const Eae={logger:"Quick",advisor:"Advisor",compliance:"Compliance"},CC={logger:"Log time entries, check hours, or manage your properties.",advisor:"Ask about REPS qualification, tax rules, or audit preparation.",compliance:"Review your IRS compliance posture, run audits, and prepare for examinations."},Dp={logger:[{text:"Log a time entry",primary:!0},{text:"What did I miss logging?"},{text:"Show me tax savings"},{text:"Email me IRS report"}],advisor:[{text:"Do I qualify for REPS this year?",primary:!0},{text:"How many hours do I have left to hit 750?"},{text:"What activities qualify for material participation?"}],compliance:[{text:"Run a compliance audit on my entries",primary:!0},{text:"Am I ready for an audit this year?"}]},jC=["/api/advisor/mode"];function Nae(){const e=Lt(),{data:t,isLoading:n}=tt({queryKey:jC,queryFn:vae,staleTime:5*60*1e3,retry:(s,i)=>i instanceof Error&&/403|503/.test(i.message)?!1:s<1}),r=gt({mutationFn:xae,onSuccess:(s,i)=>{e.setQueryData(jC,o=>o?{...o,mode:i}:{mode:i,isPremium:!0})}});return{mode:(t==null?void 0:t.mode)??"logger",isPremium:(t==null?void 0:t.isPremium)??!1,isLoading:n,setMode:r.mutate,isSwitching:r.isPending,error:r.error}}const mc={all:["conversations"],list:e=>["conversations","list",e],messages:e=>["conversations",e,"messages"]};async function Tc(e,t){const n=localStorage.getItem("accessToken"),r={"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{}},s=await fetch(e,{credentials:"include",...t,headers:{...r,...t==null?void 0:t.headers}});if(!s.ok){const i=await s.json().catch(()=>({}));throw Object.assign(new Error(i.message??s.statusText),{status:s.status})}if(s.status!==204)return s.json()}function Cae(e=1){return tt({queryKey:mc.list(e),queryFn:()=>Tc(`/api/conversations?page=${e}`),staleTime:1e3*30,retry:(t,n)=>{const r=n==null?void 0:n.status;return r===401||r===403?!1:t<2}})}function $5(e){return tt({queryKey:mc.messages(e??""),queryFn:()=>Tc(`/api/conversations/${e}/messages`),enabled:!!e,staleTime:1e3*10})}function V5(){const e=Lt();return gt({mutationFn:t=>Tc("/api/conversations",{method:"POST",body:JSON.stringify(t?{mode:t}:{})}),onSuccess:()=>
620{e.invalidateQueries({queryKey:mc.all})}})}function Lp(){const e=Lt();return gt({mutationFn:({conversationId:t,content:n,role:r})=>Tc(`/api/conversations/${t}/messages`,{method:"POST",body:JSON.stringify({content:n,role:r})}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:mc.messages(n.conversationId)}),e.invalidateQueries({queryKey:mc.all})}})}function jae(){const e=Lt();return gt({mutationFn:t=>Tc(`/api/conversations/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:mc.all})}})}function Tae(e,t){return tt({queryKey:["conversations","search",e],queryFn:()=>Tc(`/api/conversations/search?q=${encodeURIComponent(e)}`),enabled:t&&e.length>=3,staleTime:1e3*30,retry:(n,r)=>{const s=r==null?void 0:r.status;return s===401||s===403||s===400?!1:n<2}})}function Pae(e){let t=-1;for(let s=0;s<e.length;s++){const i=e[s];typeof i.type=="string"&&i.type.startsWith("tool-")&&(t=s)}if(t===-1)return e.filter(s=>s.type==="text").map(s=>s.text).join("");let n=-1;for(let s=t+1;s<e.length;s++)if(e[s].type==="step-start"){n=s;break}const r=n!==-1?n:t;return e.slice(r+1).filter(s=>s.type==="text").map(s=>s.text).join("")}const TC=/^\[QUESTIONNAIRE_SUBMIT questionnaire_id="([^"]+)" answers=({.*})\]$/s;function Aae(e,t){const n=e[t];if(n.role!=="assistant"||n.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-")))return!1;const s=e[t+1];return!s||s.role!=="assistant"?!1:s.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-"))}const Iae=/^\[FORM_SUBMIT [\s\S]*\]$/,Rae=/^\[REMEDIATION_SUBMIT [^\]]+\]$/,Mae=/\[PRESENT_COST_SEG_ESTIMATE propertyId=(\d+) status="(none|pending|complete|failed)"\]/,Oae=/\[PRESENT_MULTI_COST_SEG_ESTIMATE propertyIds=(\[[^\]]*\])\]/,Dae=/\[PRESENT_RENT_ESTIMATE propertyId=(\d+)\]/;function Lae(e){if(TC.test(e)){const t=e.match(TC);if(t)return{type:"tool-formSubmit",questionnaireId:t[1]}}if(Iae.test(e)){const t=e.match(/form_id="([^"]+)"/);if(t){const n=e.match(/selected_id="([^"]+)"/);return{type:"tool-formSubmit",questionnaireId:t[1],selectedId:n==null?void 0:n[1]}}}return Rae.test(e)?{type:"tool-formSubmit",questionnaireId:"remediation"}:null}function Fae(e){const t=e.match(Mae);return t?{type:"tool-presentCostSegEstimate",toolCallId:"hydrated",state:"complete",input:{propertyId:Number(t[1]),status:t[2]}}:null}function $ae(e){const t=e.match(Oae);if(!t)return null;try{return{type:"tool-presentMultiCostSegEstimate",toolCallId:"hydrated",state:"complete",input:{propertyIds:JSON.parse(t[1])}}}catch{return null}}function Vae(e){const t=e.match(Dae);return t?{type:"tool-presentRentEstimate",toolCallId:"hydrated",state:"complete",input:{propertyId:Number(t[1])}}:null}function Bae(e){const t=e.role,n={type:"text",text:e.content};if(t==="user"){const r=Lae(e.content);if(r)return{id:e.id,role:t,parts:[r,n],content:e.content}}if(t==="assistant"){const r=Fae(e.content);if(r)return{id:e.id,role:t,parts:[r],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}};const s=$ae(e.content);if(s)return{id:e.id,role:t,parts:[s],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}};const i=Vae(e.content);if(i)return{id:e.id,role:t,parts:[i],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}}}return{id:e.id,role:t,parts:[n],content:e.content,...t==="assistant"&&e.createdAt?{metadata:{completedAt:e.createdAt}}:{}}}function Uae({activeConversationId:e,onConversationCreated:t}){const n=L5(),r=V5(),[s,i]=m.useState(null),o=$5(e),l=m.useRef(e),c=m.useRef(0),u=m.useRef(!1);m.useEffect(()=>{l.current=e},[e]),m.useEffect(()=>{var x;if(e===null){s!==null&&(n.clearMessages(),c.current=0,i(null));return}if(e===s||o.isLoading)return;if(o.isError){i(e);return}const y=(((x=o.data)==null?void 0:x.data)??[]).map(Bae);n.setMessages(y),c.current=y.length,i(e)},[e,s,o.isLoading,o.isError,o.data]);const d=Lp(),h=Lp();m.useEffect(()=>{var b,w,S;const v=u.current&&!n.isLoading;if(u.current=n.isLoading,!v)return;const y=l.current;if(!y)return;const x=n.messages;for(let _=c.current;_<x.length;_++){const E=x[_];if(E.role!=="assistant"||Aae(x,_))continue;const R=E.parts.find(T=>typeof T.type=="string"&&T.type==="tool-presentCostSegEstimate"),A=E.parts.find(T=>typeof T.type=="string"&&T.type==="tool-presentMultiCostSegEstimate"),N=E.parts.find(T=>typeof T.type=="string"&&T.type==="tool-presentRentEstimate");let k;if(R&&((b=R.input)==null?void 0:b.propertyId)!=null){const{propertyId:T,status:I="complete"}=R.input;k=`[PRESENT_COST_SEG_ESTIMATE propertyId=${T} status="${I}"]`}else A&&((w=A.input)==null?void 0:w.propertyIds)!=null?k=`[PRESENT_MULTI_COST_SEG_ESTIMATE propertyIds=${JSON.stringify(A.input.propertyIds)}]`:N&&((S=N.input)==null?void 0:S.propertyId)!=null?k=`[PRESENT_RENT_ESTIMATE propertyId=${N.input.propertyId}]`:k=Pae(E.parts);k&&h.mutate({conversationId:y,content:k,role:"assistant"})}c.current=x.length},[n.isLoading,n.messages]);const f=m.useCallback(async(v,y)=>{let x=l.current;if(!x)try{const b=await r.mutateAsync("logger");wa("ai_chat_started",{mode:"quick"}),x=b.id,l.current=x,i(x),t(x)}catch{}x&&(d.mutate({conversationId:x,content:v,role:"user"}),c.current=n.messages.length),n.send(v,y)},[n,r,t,d]),p=m.useCallback(()=>{const v=n.messages;let y=-1;for(let x=v.length-1;x>=0;x--)if(v[x].role==="user"){y=x;break}y!==-1&&(c.current=Math.min(c.current,y+1)),n.regenerate()},[n]),g=e!==null&&e!==s&&o.isLoading;return{messages:n.messages,isLoading:n.isLoading,isStreaming:n.isStreaming,error:n.error,send:f,stop:n.stop,regenerate:p,clearMessages:n.clearMessages,pipelineStatusLabel:n.pipelineStatusLabel,pipelineStatus:n.pipelineStatus,activeConversationId:l.current,isLoadingSession:g}}function zae(e){let t=-1;for(let s=0;s<e.length;s++){const i=e[s];typeof i.type=="string"&&i.type.startsWith("tool-")&&(t=s)}if(t===-1)return e.filter(s=>s.type==="text").map(s=>s.text).join("");let n=-1;for(let s=t+1;
620s<e.length;s++)if(e[s].type==="step-start"){n=s;break}const r=n!==-1?n:t;return e.slice(r+1).filter(s=>s.type==="text").map(s=>s.text).join("")}const PC=/^\[QUESTIONNAIRE_SUBMIT questionnaire_id="([^"]+)" answers=({.*})\]$/s,Hae=/^\[FORM_SUBMIT [\s\S]*\]$/,Wae=/^\[REMEDIATION_SUBMIT [^\]]+\]$/,qae=/\[PRESENT_COST_SEG_ESTIMATE propertyId=(\d+) status="(none|pending|complete|failed)"\]/,Gae=/\[PRESENT_MULTI_COST_SEG_ESTIMATE propertyIds=(\[[^\]]*\])\]/,Kae=/\[PRESENT_RENT_ESTIMATE propertyId=(\d+)\]/;function Yae(e){if(PC.test(e)){const t=e.match(PC);if(t)return{type:"tool-formSubmit",questionnaireId:t[1]}}if(Hae.test(e)){const t=e.match(/form_id="([^"]+)"/);if(t){const n=e.match(/selected_id="([^"]+)"/);return{type:"tool-formSubmit",questionnaireId:t[1],selectedId:n==null?void 0:n[1]}}}return Wae.test(e)?{type:"tool-formSubmit",questionnaireId:"remediation"}:null}function Qae(e){const t=e.match(qae);return t?{type:"tool-presentCostSegEstimate",toolCallId:"hydrated",state:"complete",input:{propertyId:Number(t[1]),status:t[2]}}:null}function Zae(e){const t=e.match(Gae);if(!t)return null;try{return{type:"tool-presentMultiCostSegEstimate",toolCallId:"hydrated",state:"complete",input:{propertyIds:JSON.parse(t[1])}}}catch{return null}}function Xae(e){const t=e.match(Kae);return t?{type:"tool-presentRentEstimate",toolCallId:"hydrated",state:"complete",input:{propertyId:Number(t[1])}}:null}function Jae(e){const t=e.role,n={type:"text",text:e.content};if(t==="user"){const r=Yae(e.content);if(r)return{id:e.id,role:t,parts:[r,n],content:e.content}}if(t==="assistant"){const r=Qae(e.content);if(r)return{id:e.id,role:t,parts:[r],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}};const s=Zae(e.content);if(s)return{id:e.id,role:t,parts:[s],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}};const i=Xae(e.content);if(i)return{id:e.id,role:t,parts:[i],content:e.content,...e.createdAt?{metadata:{completedAt:e.createdAt}}:{}}}return{id:e.id,role:t,parts:[n],content:e.content,...t==="assistant"&&e.createdAt?{metadata:{completedAt:e.createdAt}}:{}}}function ele(e,t){const n=e[t];if(n.role!=="assistant"||n.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-")))return!1;const s=e[t+1];return!s||s.role!=="assistant"?!1:s.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-"))}function AC({activeConversationId:e,onConversationCreated:t,mode:n}){const r=F5({mode:n}),s=V5(),i=n==="compliance"?"compliance":"advisor",[o,l]=m.useState(null),c=$5(e),u=m.useRef(e),d=m.useRef(0),h=m.useRef(!1);m.useEffect(()=>{u.current=e},[e]),m.useEffect(()=>{var w;if(e===null){o!==null&&(r.clearMessages(),d.current=0,l(null));return}if(e===o||c.isLoading)return;if(c.isError){l(e);return}const b=(((w=c.data)==null?void 0:w.data)??[]).map(Jae);r.setMessages(b),d.current=b.length,l(e)},[e,o,c.isLoading,c.isError,c.data]);const f=Lp(),p=Lp();m.useEffect(()=>{var S,_,E;const x=h.current&&!r.isLoading;if(h.current=r.isLoading,!x)return;const b=u.current;if(!b)return;const w=r.messages;for(let R=d.current;R<w.length;R++){const A=w[R];if(A.role!=="assistant"||ele(w,R))continue;const N=A.parts.find(F=>typeof F.type=="string"&&F.type==="tool-presentCostSegEstimate"),k=A.parts.find(F=>typeof F.type=="string"&&F.type==="tool-presentMultiCostSegEstimate"),T=A.parts.find(F=>typeof F.type=="string"&&F.type==="tool-presentRentEstimate");let I;if(N&&((S=N.input)==null?void 0:S.propertyId)!=null){const{propertyId:F,status:L="complete"}=N.input;I=`[PRESENT_COST_SEG_ESTIMATE propertyId=${F} status="${L}"]`}else k&&((_=k.input)==null?void 0:_.propertyIds)!=null?I=`[PRESENT_MULTI_COST_SEG_ESTIMATE propertyIds=${JSON.stringify(k.input.propertyIds)}]`:T&&((E=T.input)==null?void 0:E.propertyId)!=null?I=`[PRESENT_RENT_ESTIMATE propertyId=${T.input.propertyId}]`:I=zae(A.parts);I&&p.mutate({conversationId:b,content:I,role:"assistant"})}d.current=w.length},[r.isLoading,r.messages]);const g=m.useCallback(async(x,b)=>{let w=u.current;if(!w)try{const S=await s.mutateAsync(i);wa("ai_chat_started",{mode:i}),w=S.id,u.current=w,l(w),t(w)}catch{}w&&(f.mutate({conversationId:w,content:x,role:"user"}),d.current=r.messages.length),r.send(x,b)},[r,s,i,t,f]),v=m.useCallback(()=>{const x=r.messages;let b=-1;for(let w=x.length-1;w>=0;w--)if(x[w].role==="user"){b=w;break}b!==-1&&(d.current=Math.min(d.current,b+1)),r.regenerate()},[r]),y=e!==null&&e!==o&&c.isLoading;return{messages:r.messages,isLoading:r.isLoading,isStreaming:r.isStreaming,error:r.error,send:g,stop:r.stop,regenerate:v,clearMessages:r.clearMessages,metadata:r.metadata,pipelineStatusLabel:r.pipelineStatusLabel,pipelineStatus:r.pipelineStatus,activeConversationId:u.current,isLoadingSession:y}}function B5(){const e=L5(),t=F5(),{mode:n,isPremium:r,setMode:s,isSwitching:i}=Nae(),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,h]=m.useState(null),f=n==="advisor"?c:n==="compliance"?d:o,p=m.useCallback(b=>{n==="advisor"?u(b):n==="compliance"?h(b):l(b)},[n]),g=Uae({activeConversationId:o,onConversationCreated:l}),v=AC({activeConversationId:c,onConversationCreated:u,mode:"advisor"}),y=AC({activeConversationId:d,onConversationCreated:h,mode:"compliance"}),x=m.useCallback(()=>{n==="advisor"?(u(null),v.clearMessages()):n==="compliance"?(h(null),y.clearMessages()):(l(null),g.clearMessages())},[n,v,y,g]);return{agent:e,advisor:t,mode:n,isPremium:r,setMode:s,isSwitching:i,activeConversationId:f,setActiveConversationId:p,startNewConversation:x,loggerConversationId:o,setLoggerConversationId:l,advisorConversationId:c,setAdvisorConversationId:u,complianceConversationId:d,setComplianceConversationId:h,agentWithSession:g,advisorChat:v,complianceChat:y}}function tle(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var e1="ScrollArea",[U5]=yn(e1),[nle,zr]=U5(e1),z5=m.forwardRef((e,t)=>
vendor: 8,539 bytes, line 620
620{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=e,[l,c]=m.useState(null),[u,d]=m.useState(null),[h,f]=m.useState(null),[p,g]=m.useState(null),[v,y]=m.useState(null),[x,b]=m.useState(0),[w,S]=m.useState(0),[_,E]=m.useState(!1),[R,A]=m.useState(!1),N=He(t,T=>c(T)),k=Oa(s);return a.jsx(nle,{scope:n,type:r,dir:k,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:R,onScrollbarYEnabledChange:A,onCornerWidthChange:b,onCornerHeightChange:S,children:a.jsx(we.div,{dir:k,...o,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});z5.displayName=e1;var H5="ScrollAreaViewport",W5=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=e,o=zr(H5,n),l=m.useRef(null),c=He(t,l,o.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx(rle,{nonce:s}),a.jsx(we.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});W5.displayName=H5;var rle=m.memo(({nonce:e})=>a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e}),(e,t)=>e.nonce===t.nonce),zs="ScrollAreaScrollbar",t1=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=zr(zs,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=e.orientation==="horizontal";return m.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(sle,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(ile,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(q5,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(n1,{...r,ref:t,"data-state":"visible"}):null});t1.displayName=zs;var sle=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=zr(zs,e.__scopeScrollArea),[i,o]=m.useState(!1);return m.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(hn,{present:n||i,children:a.jsx(q5,{"data-state":i?"visible":"hidden",...r,ref:t})})}),ile=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=zr(zs,e.__scopeScrollArea),i=e.orientation==="horizontal",o=Jm(()=>c("SCROLL_END"),100),[l,c]=tle("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),m.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const p=u[d];h!==p&&(c("SCROLL"),o()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,i,c,o]),a.jsx(hn,{present:n||l!=="hidden",children:a.jsx(n1,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:he(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:he(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),q5=m.forwardRef((e,t)=>{const n=zr(zs,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,o]=m.useState(!1),l=e.orientation==="horizontal",c=Jm(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(l?u:d)}},10);return gc(n.viewport,c),gc(n.content,c),a.jsx(hn,{present:r||i,children:a.jsx(n1,{"data-state":i?"visible":"hidden",...s,ref:t})})}),n1=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=zr(zs,e.__scopeScrollArea),i=m.useRef(null),o=m.useRef(0),[l,c]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Z5(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function h(f,p){return dle(f,o.current,l,p)}return n==="horizontal"?a.jsx(ole,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollLeft,p=IC(f,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):n==="vertical"?a.jsx(ale,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollTop,p=IC(f,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),ole=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=zr(zs,e.__scopeScrollArea),[o,l]=m.useState(),c=m.useRef(null),u=He(t,c,i.onScrollbarXChange);return m.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(K5,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Xm(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(f),J5(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:$p(o.paddingLeft),paddingEnd:$p(o.paddingRight)}})}})}),ale=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=zr(zs,e.__scopeScrollArea),[o,l]=m.useState(),c=m.useRef(null),u=He(t,c,i.onScrollbarYChange);return m.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(K5,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Xm(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(f),J5(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:$p(o.paddingTop),paddingEnd:$p(o.paddingBottom)}})}})}),[lle,G5]=U5(zs),K5=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=e,p=zr(zs,n),[g,v]=m.useState(null),y=He(t,N=>v(N)),x=m.useRef(null),b=m.useRef(""),w=p.viewport,S=r.content-r.viewport,_=tn(d),E=tn(c),R=Jm(h,10);function A(N){if(x.current){const k=N.clientX-x.current.left,T=N.clientY-x.current.top;u({x:k,y:T})}}return m.useEffect(()=>{const N=k=>{const T=k.target;(g==null?void 0:g.contains(T))&&_(k,S)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[w,g,S,_]),m.useEffect(E,[r,E]),gc(g,R),gc(p.content,R),a.jsx(lle,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:tn(i),onThumbPointerUp:tn(o),onThumbPositionChange:E,onThumbPointerDown:tn(l),children:a.jsx(we.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:he(e.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),x.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(N))}),onPointerMove:he(e.onPointerMove,A),onPointerUp:he(e.onPointerUp,N=>{const k=N.target;k.hasPointerCapture(N.pointerId)&&k.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),x.current=null})})})}),Fp="ScrollAreaThumb",Y5=m.forwardRef((e,t)=>
620{const{forceMount:n,...r}=e,s=G5(Fp,e.__scopeScrollArea);return a.jsx(hn,{present:n||s.hasThumb,children:a.jsx(cle,{ref:t,...r})})}),cle=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=zr(Fp,n),o=G5(Fp,n),{onThumbPositionChange:l}=o,c=He(t,h=>o.onThumbChange(h)),u=m.useRef(void 0),d=Jm(()=>{u.current&&(u.current(),u.current=void 0)},100);return m.useEffect(()=>{const h=i.viewport;if(h){const f=()=>{if(d(),!u.current){const p=hle(h,l);u.current=p,l()}};return l(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,d,l]),a.jsx(we.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:he(e.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),g=h.clientX-p.left,v=h.clientY-p.top;o.onThumbPointerDown({x:g,y:v})}),onPointerUp:he(e.onPointerUp,o.onThumbPointerUp)})});Y5.displayName=Fp;var r1="ScrollAreaCorner",Q5=m.forwardRef((e,t)=>{const n=zr(r1,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(ule,{...e,ref:t}):null});Q5.displayName=r1;var ule=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=zr(r1,n),[i,o]=m.useState(0),[l,c]=m.useState(0),u=!!(i&&l);return gc(s.scrollbarX,()=>{var h;const d=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),gc(s.scrollbarY,()=>{var h;const d=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?a.jsx(we.div,{...r,ref:t,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function $p(e){return e?parseInt(e,10):0}function Z5(e,t){const n=e/t;return isNaN(n)?0:n}function Xm(e){const t=Z5(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function dle(e,t,n,r="ltr"){const s=Xm(n),i=s/2,o=t||i,l=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return X5([c,u],h)(e)}function IC(e,t,n="ltr"){const r=Xm(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,o]:[o*-1,0],u=kd(e,c);return X5([0,o],[0,l])(u)}function X5(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function J5(e,t){return e>0&&e<t}var hle=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,l=n.top!==i.top;(o||l)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function Jm(e,t){const n=tn(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function gc(e,t){const n=tn(t);nn(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var e4=z5,fle=W5,ple=Q5;const t4=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(e4,{ref:r,className:q("relative overflow-hidden",e),...n,children:[a.jsx(fle,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(n4,{}),a.jsx(ple,{})]}));t4.displayName=e4.displayName;const n4=m.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(t1,{ref:r,orientation:t,className:q("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(Y5,{className:"relative flex-1 rounded-full bg-border"})}));n4.displayName=t1.displayName;function r4(e,t){const[n,r]=m.useState(()=>t?0:e.length),s=m.useRef(),i=m.useRef(0),o=m.useRef(t),l=m.useRef(e),c=m.useRef(n),u=m.useRef(t);l.current=e,c.current=n,u.current=t,m.useLayoutEffect(()=>{t&&!o.current&&(r(0),c.current=0,i.current=0),o.current=t},[t]);const d=m.useCallback((f,p)=>{let g=p+1;for(;g<f.length&&f[g]!==" "&&f[g]!==`
621`;)g++;return g<f.length&&(f[g]===" "||f[g]===`
622`)&&g++,Math.min(g,f.length)},[]),h=m.useCallback(f=>{const p=l.current,g=c.current,v=u.current;if(!(g>=p.length&&!v)){if(!v&&g<p.length){let y=g;y=d(p,y),y<p.length&&(y=d(p,y)),y=Math.min(y,p.length),c.current=y,r(y),y<p.length&&(s.current=requestAnimationFrame(h));return}if(v){if(g<p.length){if(f-i.current<30){s.current=requestAnimationFrame(h);return}i.current=f;const y=d(p,g);c.current=y,r(y)}(v||c.current<p.length)&&(s.current=requestAnimationFrame(h))}}},[d]);return m.useEffect(()=>((c.current<e.length||t)&&(cancelAnimationFrame(s.current),s.current=requestAnimationFrame(h)),()=>cancelAnimationFrame(s.current)),[e,t,h]),e.slice(0,n)}function mle(e){let t=-1;for(let s=0;s<e.length;s++){const i=e[s];typeof i.type=="string"&&i.type.startsWith("tool-")&&(t=s)}if(t===-1)return e.filter(s=>s.type==="text").map(s=>s.text).join("");let n=-1;for(let s=t+1;
622s<e.length;s++)if(e[s].type==="step-start"){n=s;break}const r=n!==-1?n:t;return e.slice(r+1).filter(s=>s.type==="text").map(s=>s.text).join("")}const gle=/\[(PRESENT_COST_SEG_ESTIMATE|PRESENT_MULTI_COST_SEG_ESTIMATE|PRESENT_RENT_ESTIMATE)\b[\s\S]*\]/,vle="[EVIDENCE_SCAN_CONTEXT]";function yle(){return a.jsx("span",{className:"inline-block w-[3px] h-[14px] bg-current opacity-80 rounded-sm align-text-bottom ml-0.5",style:{animation:"cursor-blink 1s steps(2) infinite"}})}function xle(){return a.jsx("span",{className:"inline-flex items-center gap-0.5 h-4","aria-label":"Loading",children:[0,1,2].map(e=>a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current opacity-60",style:{animation:`pulse 1.2s ease-in-out ${e*.2}s infinite`}},e))})}function ble(e){return e.replace(/<tools_ready>[\s\S]*?<\/tools_ready>/g,"").replace(/<think>[\s\S]*?<\/think>/g,"").replace(/<\/?function\b[^>]*>/g,"").replace(/<\/?[a-zA-Z][a-zA-Z0-9_-]*(?:\s[^>]*)?\s*\/?>/g,"").replace(/\n{3,}/g,`
623
624`).trim()}function wle({message:e,isStreaming:t=!1}){var h;const n=e.role==="user",r=(n?e.parts.filter(f=>f.type==="text").map(f=>f.text).join(""):mle(e.parts)).replace(/\[ADVISOR_REDIRECT\]\n?/g,"").replace(/\n?\[\/ADVISOR_REDIRECT\]/g,""),s=n?r.split(vle)[0].trim():ble(r),i=r4(s,t),o=n?s:i,l=t||i.length<s.length,c=e.parts.filter(f=>f.type==="file");if(n&&(s.startsWith("[FORM_SUBMIT ")||s.startsWith("[QUESTIONNAIRE_SUBMIT ")||s.startsWith("[REMEDIATION_SUBMIT "))||!n&&gle.test(s)||!s&&c.length===0&&!t)return null;const u=n?"":GI((h=e.metadata)==null?void 0:h.completedAt),d=a.jsxs(a.Fragment,{children:[c.length>0&&a.jsx("div",{className:q("flex flex-wrap gap-1.5",s&&"mb-2"),children:c.map((f,p)=>f.mediaType.startsWith("image/")?a.jsx("img",{src:f.url,alt:f.filename||"Attached image",className:"rounded-md max-h-32 max-w-full object-cover"},p):a.jsxs("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs bg-gray-100 dark:bg-gray-800",children:[a.jsx(Nr,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate max-w-[120px]",children:f.filename||"File"})]},p))}),o&&(n?a.jsx("span",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:o}):a.jsxs("span",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:[o,l&&a.jsx(yle,{})]})),!o&&!n&&t&&a.jsx(xle,{})]});return n?a.jsx("div",{className:"flex flex-col items-end",children:a.jsx("div",{className:"min-w-0 max-w-[85%] overflow-hidden rounded-[22px] bg-[#E9F3F1] px-4 py-2.5 text-[15px] leading-relaxed text-foreground break-words [overflow-wrap:anywhere] whitespace-pre-wrap",children:d})}):a.jsxs("div",{className:"flex flex-col",children:[a.jsx("div",{className:"min-w-0 text-[15px] leading-relaxed text-foreground break-words [overflow-wrap:anywhere]",children:d}),!l&&u&&a.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/70 select-none",children:u})]})}function _le(e){var o;const[t,n]=e.split(","),r=((o=t.match(/:(.*?);/))==null?void 0:o[1])||"application/octet-stream",s=atob(n),i=new Uint8Array(s.length);for(let l=0;l<s.length;l++)i[l]=s.charCodeAt(l);return new Blob([i],{type:r})}async function RC(e,t){if(t&&t.length>0){const n=new FormData;n.append("date",e.date),n.append("hours",String(e.hours)),n.append("activityType",e.activityType),n.append("activityTypeLabel",e.activityTypeLabel),n.append("propertyId",e.propertyId!=null?String(e.propertyId):""),n.append("description",e.description||""),n.append("isMaterialParticipation",String(e.isMaterialParticipation));for(const s of t){const i=_le(s.url);n.append("files",i,s.filename||"file")}return(await Xe("POST","/api/agent/confirm-entry",n)).json()}else return(await Xe("POST","/api/agent/confirm-entry",e)).json()}async function s1(e){const t=new FormData;for(const r of e)r instanceof File?t.append("files",r):t.append("files",r.blob,r.filename);return(await Xe("POST","/api/evidence-files/extract",t)).json()}const s4=m.createContext(null);function MC({children:e}){const t=m.useRef(new Map),[,n]=m.useState(0),r=m.useCallback(i=>t.current.get(i),[]),s=m.useCallback((i,o)=>{t.current.set(i,o),n(l=>l+1)},[]);return a.jsx(s4.Provider,{value:{getCardState:r,setCardState:s},children:e})}function Do(){const e=m.useContext(s4);return e||{getCardState:()=>{},setCardState:()=>{}}}var kt={BOOT:"boot",TERMINATE:"terminate",LOCATION:"location",HTTP:"http",MOTIONCHANGE:"motionchange",PROVIDERCHANGE:"providerchange",HEARTBEAT:"heartbeat",ACTIVITYCHANGE:"activitychange",GEOFENCE:"geofence",GEOFENCESCHANGE:"geofenceschange",SCHEDULE:"schedule",CONNECTIVITYCHANGE:"connectivitychange",ENABLEDCHANGE:"enabledchange",POWERSAVECHANGE:"powersavechange",NOTIFICATIONACTION:"notificationaction",AUTHORIZATION:"authorization"},OC=function(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}
624return new(n||(n=Promise))(function(i,o){function l(d){try{u(r.next(d))}catch(h){o(h)}}function c(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},DC=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,s&&(i=u[0]&2?s.return:u[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,u[1])).done)return i;switch(s=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){n.label=u[1];break}if(u[0]===6&&n.label<i[1]){n.label=i[1],i=u;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(u);break}i[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],s=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Ue=us("BackgroundGeolocation"),kle="debug",Sle="notice",Ele="info",Nle="warn",Cle="error",jle=1,Tle=-1;function nu(e,t){return Ue.log({level:e,message:t})}function Bv(e){if(typeof e!="object")return{};if(e.hasOwnProperty("start")&&isNaN(e.start))throw new Error("Invalid SQLQuery.start.  Expected unix timestamp but received: "+e.start);if(e.hasOwnProperty("end")&&isNaN(e.end))throw new Error("Invalid SQLQuery.end.  Expected unix timestamp but received: "+e.end);return e}var Ple=function(){function e(){}return Object.defineProperty(e,"ORDER_ASC",{get:function(){return jle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ORDER_DESC",{get:function(){return Tle},enumerable:!1,configurable:!0}),e.debug=function(t){return nu(kle,t)},e.error=function(t){return nu(Cle,t)},e.warn=function(t){return nu(Nle,t)},e.info=function(t){return nu(Ele,t)},e.notice=function(t){return nu(Sle,t)},e.getLog=function(t){return t=Bv(t),new Promise(function(n,r){Ue.getLog({options:t}).then(function(s){n(s.log)}).catch(function(s){r(s.message)})})},e.destroyLog=function(){return new Promise(function(t,n){Ue.destroyLog().then(function(){t()}).catch(function(r){n(r.message)})})},e.emailLog=function(t,n){return n=Bv(n),new Promise(function(r,s){Ue.emailLog({email:t,query:n}).then(function(i){r(i)}).catch(function(i){s(i.message)})})},e.uploadLog=function(t,n){return n=Bv(n),new Promise(function(r,s){Ue.uploadLog({url:t,query:n}).then(function(){r()}).catch(function(i){s(i.message)})})},e}(),LC="http://tracker.transistorsoft.com",FC="DUMMY_TOKEN",Ale={refresh_token:"{refreshToken}"},Ile="/api/locations",Rle="/api/refresh_token",v0=function(){function e(){}return e.findOrCreate=function(t,n,r){return r===void 0&&(r=LC),new Promise(function(s,i){Ue.getTransistorToken({org:t,username:n,url:r}).then(function(o){if(o.success){var l=o.token;l.url=r,s(l)}else{if(console.warn("[TransistorAuthorizationToken findOrCreate] ERROR: ",o),o.status=="403"){i(o);return}s({accessToken:FC,refreshToken:FC,expires:-1,url:r})}}).catch(function(o){i(o)})})},e.destroy=function(t){return t===void 0&&(t=LC),new Promise(function(n,r){Ue.destroyTransistorToken({url:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.applyIf=function(t){if(!t.transistorAuthorizationToken)return t;var n=t.transistorAuthorizationToken;return delete t.transistorAuthorizationToken,t.url=n.url+Ile,t.authorization={strategy:"JWT",accessToken:n.accessToken,refreshToken:n.refreshToken,refreshUrl:n.url+Rle,refreshPayload:Ale,expires:n.expires},t},e}(),Mle="IGNORE_BATTERY_OPTIMIZATIONS",Ole="POWER_MANAGER",$C=function(e,t){t.lastSeenAt>0&&(t.lastSeenAt=new Date(t.lastSeenAt)),e(t)},Dle=function(){function e(){}return e.isIgnoringBatteryOptimizations=function(){return new Promise(function(t,n){Ue.isIgnoringBatteryOptimizations().then(function(r){t(r.isIgnoringBatteryOptimizations)}).catch(function(r){n(r.message)})})},e.showIgnoreBatteryOptimizations=function(){return new Promise(function(t,n){var r={action:Mle};Ue.requestSettings(r).then(function(s){$C(t,s)}).catch(function(s){n(s.message)})})},e.showPowerManager=function(){return new Promise(function(t,n){var r={action:Ole};Ue.requestSettings(r).then(function(s){$C(t,s)}).catch(function(s){n(s.message)})})},e.show=function(t){return new Promise(function(n,r){var s={action:t.action};Ue.showSettings(s).then(function(){n()}).catch(function(i){r(i.message)})})},e}(),VC="TSLocationManager",Zs=[],Uv=[],Lle=function(){function e(t,n,r){this.event=t,this.subscription=n,this.callback=r}return e}(),zv=function(e){return(e.notificationPriority||e.notificationText||e.notificationTitle||e.notificationChannelName||e.notificationColor||e.notificationSmallIcon||e.notificationLargeIcon)&&(console.warn('[Backgroun
624dGeolocation] WARNING: Config.notification* fields (eg: notificationText) are all deprecated in favor of notification: {title: "My Title", text: "My Text"}  See docs for "Notification" class'),e.notification={text:e.notificationText,title:e.notificationTitle,color:e.notificationColor,channelName:e.notificationChannelName,smallIcon:e.notificationSmallIcon,largeIcon:e.notificationLargeIcon,priority:e.notificationPriority}),e=v0.applyIf(e),e},Fle=0,$le=1,Vle=2,Ble=3,Ule=4,zle=5,Hle=-2,Wle=-1,qle=10,Gle=100,Kle=1e3,Yle=3e3,Qle=0,Zle=1,Xle=2,Jle=3,ece=4,tce=0,nce=1,rce=-1,sce=2,ice=-2,oce=1,ace=2,lce=3,cce=4,uce=5,dce="Always",hce="WhenInUse",fce="Any",pce=2,mce=1,gce=-1,vce=0,yce=0,xce=1,vr=function(){function e(){}return Object.defineProperty(e,"EVENT_BOOT",{get:function(){return kt.BOOT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_TERMINATE",{get:function(){return kt.TERMINATE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_LOCATION",{get:function(){return kt.LOCATION},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_MOTIONCHANGE",{get:function(){return kt.MOTIONCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_HTTP",{get:function(){return kt.HTTP},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_HEARTBEAT",{get:function(){return kt.HEARTBEAT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_PROVIDERCHANGE",{get:function(){return kt.PROVIDERCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_ACTIVITYCHANGE",{get:function(){return kt.ACTIVITYCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_GEOFENCE",{get:function(){return kt.GEOFENCE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_GEOFENCESCHANGE",{get:function(){return kt.GEOFENCESCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_ENABLEDCHANGE",{get:function(){return kt.ENABLEDCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_CONNECTIVITYCHANGE",{get:function(){return kt.CONNECTIVITYCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_SCHEDULE",{get:function(){return kt.SCHEDULE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_POWERSAVECHANGE",{get:function(){return kt.POWERSAVECHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_NOTIFICATIONACTION",{get:function(){return kt.NOTIFICATIONACTION},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EVENT_AUTHORIZATION",{get:function(){return kt.AUTHORIZATION},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_OFF",{get:function(){return Fle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_ERROR",{get:function(){return $le},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_WARNING",{get:function(){return Vle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_INFO",{get:function(){return Ble},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_DEBUG",{get:function(){return Ule},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOG_LEVEL_VERBOSE",{get:function(){return zle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACTIVITY_TYPE_OTHER",{get:function(){return oce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION",{get:function(){return ace},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACTIVITY_TYPE_FITNESS",{get:function(){return lce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACTIVITY_TYPE_OTHER_NAVIGATION",{get:function(){return cce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACTIVITY_TYPE_AIRBORNE",{get:function(){return uce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_NAVIGATION",{get:function(){return Hle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_HIGH",{get:function(){return Wle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_MEDIUM",{get:function(){return qle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_LOW",{get:function(){return Gle}
624,enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_VERY_LOW",{get:function(){return Kle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DESIRED_ACCURACY_LOWEST",{get:function(){return Yle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AUTHORIZATION_STATUS_NOT_DETERMINED",{get:function(){return Qle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AUTHORIZATION_STATUS_RESTRICTED",{get:function(){return Zle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AUTHORIZATION_STATUS_DENIED",{get:function(){return Xle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AUTHORIZATION_STATUS_ALWAYS",{get:function(){return Jle},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AUTHORIZATION_STATUS_WHEN_IN_USE",{get:function(){return ece},enumerable:!1,configurable:!0}),Object.defineProperty(e,"NOTIFICATION_PRIORITY_DEFAULT",{get:function(){return tce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"NOTIFICATION_PRIORITY_HIGH",{get:function(){return nce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"NOTIFICATION_PRIORITY_LOW",{get:function(){return rce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"NOTIFICATION_PRIORITY_MAX",{get:function(){return sce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"NOTIFICATION_PRIORITY_MIN",{get:function(){return ice},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOCATION_AUTHORIZATION_ALWAYS",{get:function(){return dce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOCATION_AUTHORIZATION_WHEN_IN_USE",{get:function(){return hce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LOCATION_AUTHORIZATION_ANY",{get:function(){return fce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"PERSIST_MODE_ALL",{get:function(){return pce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"PERSIST_MODE_LOCATION",{get:function(){return mce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"PERSIST_MODE_GEOFENCE",{get:function(){return gce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"PERSIST_MODE_NONE",{get:function(){return vce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACCURACY_AUTHORIZATION_FULL",{get:function(){return yce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ACCURACY_AUTHORIZATION_REDUCED",{get:function(){return xce},enumerable:!1,configurable:!0}),Object.defineProperty(e,"logger",{get:function(){return Ple},enumerable:!1,configurable:!0}),Object.defineProperty(e,"deviceSettings",{get:function(){return Dle},enumerable:!1,configurable:!0}),e.ready=function(t){return Ue.ready({options:zv(t)})},e.reset=function(t){return Ue.reset({options:zv(t)})},e.start=function(){return Ue.start()},e.stop=function(){return Ue.stop()},e.startSchedule=function(){return Ue.startSchedule()},e.stopSchedule=function(){return Ue.stopSchedule()},e.startGeofences=function(){return Ue.startGeofences()},e.setConfig=function(t){return Ue.setConfig({options:zv(t)})},e.getState=function(){return Ue.getState()},e.changePace=function(t){return new Promise(function(n,r){Ue.changePace({isMoving:t}).then(function(){n()}).catch(function(s){r(s.errorMessage)})})},e.getCurrentPosition=function(t){return t=t||{},new Promise(function(n,r){Ue.getCurrentPosition({options:t}).then(function(s){n(s)}).catch(function(s){r(s.code)})})},e.watchPosition=function(t,n,r){var s=this;return r=r||{},new Promise(function(i,o){return OC(s,void 0,void 0,function(){var l,c;return DC(this,function(u){switch(u.label){case 0:return l=function(d){d.hasOwnProperty("error")&&d.error!=null?typeof n=="function"?n(d.error.code):console.warn("[BackgroundGeolocation watchPostion] DEFAULT ERROR HANDLER.  Provide an onError handler to watchPosition to receive this message: ",d.error):t(d)},[4,Ue.addListener("watchposition",l)];case 1:return c=u.sent(),Ue.watchPosition({options:r}).then(function(){Uv.push(c),i()}).catch(function(d){c.remove(),o(d.message)}),[2]}})})})},e.stopWatchPosition=function(){for(var t=0;t<Uv.length;t++){var n=Uv[t];n.remove()}return Ue.stopWatchPosition()},e.requestPermission=function(){return new Promise(function(t,n){Ue.requestPermission().then(function(r){r.success?t(r.status):n(r.status)})})},e.requestTemporaryFullAccuracy=function(t){return new Promise(function(n,r){Ue.requestTemporaryFullAccuracy({purpose:t}).then(function(s){n(s.accuracyAuthorization)}).catch(function(s){r(s.message)})})},e.getProviderState=function(){return Ue.getProviderState()},e.getLocations=function(){return new Promise(function(t,n){Ue.getLocations().then(function(r){t(r.locations)}).catch(function(r){n(r.message)})})},e.insertLocation=function(t){return new Promise(function(n,r){Ue.insertLocation({options:t}).then(function(s){n(s.uuid)}).catch(function(s){r(s.message)})})},e.destroyLocations=function(){return new Promise(function(t,n){Ue.destroyLocations().then(function(){t()}).catch(function(r){n(r.message)})})},e.destroyLocation=function(t){return new Promise(function(n,r){Ue.destroyLocation({uuid:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.getCount=function(){return new Promise(function(t,n){Ue.getCount().then(function(r){t(r.count)}).catch(function(r){n(r.message)})})},e.sync=function(){return new Promise(function(t,n){Ue.sync().then(function(r){t(r.locations)}).catch(function(r){n(r.message)})})},e.addGeofence=function(t){return new Promise(function(n,r){Ue.addGeofence({o
624ptions:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.addGeofences=function(t){return new Promise(function(n,r){Ue.addGeofences({options:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.getGeofences=function(){return new Promise(function(t,n){Ue.getGeofences().then(function(r){t(r.geofences)}).catch(function(r){n(r.message)})})},e.getGeofence=function(t){return new Promise(function(n,r){if(t===null){r("identifier is null");return}Ue.getGeofence({identifier:t}).then(function(s){n(s)}).catch(function(s){r(s.message)})})},e.geofenceExists=function(t){return new Promise(function(n,r){if(t===null){r("identifier is null");return}Ue.geofenceExists({identifier:t}).then(function(s){n(s.exists)}).catch(function(s){r(s.message)})})},e.removeGeofence=function(t){return new Promise(function(n,r){if(t===null){r("identifier is null");return}Ue.removeGeofence({identifier:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.removeGeofences=function(t){return t=t||[],new Promise(function(n,r){Ue.removeGeofences({identifiers:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.getOdometer=function(){return new Promise(function(t,n){Ue.getOdometer().then(function(r){t(r.odometer)}).catch(function(r){n(r.message)})})},e.setOdometer=function(t){return new Promise(function(n,r){Ue.setOdometer({odometer:t}).then(function(s){n(s)}).catch(function(s){r(s.message)})})},e.resetOdometer=function(){return e.setOdometer(0)},e.startBackgroundTask=function(){return new Promise(function(t,n){Ue.startBackgroundTask().then(function(r){t(r.taskId)}).catch(function(r){n(r.message)})})},e.stopBackgroundTask=function(t){return new Promise(function(n,r){Ue.stopBackgroundTask({taskId:t}).then(function(){n()}).catch(function(s){r(s.message)})})},e.finish=function(t){return e.stopBackgroundTask(t)},e.getDeviceInfo=function(){return Ue.getDeviceInfo()},e.playSound=function(t){return Ue.playSound({soundId:t})},e.isPowerSaveMode=function(){return new Promise(function(t,n){Ue.isPowerSaveMode().then(function(r){t(r.isPowerSaveMode)}).catch(function(r){n(r.message)})})},e.getSensors=function(){return Ue.getSensors()},e.findOrCreateTransistorAuthorizationToken=function(t,n,r){return v0.findOrCreate(t,n,r)},e.destroyTransistorAuthorizationToken=function(t){return v0.destroy(t)},e.onLocation=function(t,n){return e.addListener(kt.LOCATION,t,n)},e.onMotionChange=function(t){return e.addListener(kt.MOTIONCHANGE,t)},e.onHttp=function(t){return e.addListener(kt.HTTP,t)},e.onHeartbeat=function(t){return e.addListener(kt.HEARTBEAT,t)},e.onProviderChange=function(t){return e.addListener(kt.PROVIDERCHANGE,t)},e.onActivityChange=function(t){return e.addListener(kt.ACTIVITYCHANGE,t)},e.onGeofence=function(t){return e.addListener(kt.GEOFENCE,t)},e.onGeofencesChange=function(t){return e.addListener(kt.GEOFENCESCHANGE,t)},e.onSchedule=function(t){return e.addListener(kt.SCHEDULE,t)},e.onEnabledChange=function(t){return e.addListener(kt.ENABLEDCHANGE,t)},e.onConnectivityChange=function(t){return e.addListener(kt.CONNECTIVITYCHANGE,t)},e.onPowerSaveChange=function(t){return e.addListener(kt.POWERSAVECHANGE,t)},e.onNotificationAction=function(t){return e.addListener(kt.NOTIFICATIONACTION,t)},e.onAuthorization=function(t){return e.addListener(kt.AUTHORIZATION,t)},e.addListener=function(t,n,r){if(!kt[t.toUpperCase()])throw VC+"#addListener - Unknown event '"+t+"'";var s=function(l){l.hasOwnProperty("value")&&(l=l.value),l.hasOwnProperty("error")&&l.error!=null&&typeof r=="function"?r(l.error):n(l)},i=!1,o={remove:function(){i=!0,console.warn("[BackgroundGeolocation.addListener] Unexpected call to subscription.remove() on subscriptionProxy.  Waiting for NativeModule.addListener to resolve.")}};return Ue.addListener(t,s).then(function(l){var c=new Lle(t,l,n);Zs.push(c),o.remove=function(){l.remove(),Zs.indexOf(c)>=0&&Zs.splice(Zs.indexOf(c),1)},i&&o.remove()}),o},e.removeListener=function(t,n){return console.warn(`BackgroundGeolocation.removeListener is deprecated.  Event-listener methods (eg: onLocation) now return a Subscription instance.  Call subscription.remove() on the returned subscription instead.  Eg:
625const subscription = BackgroundGeolocation.onLocation(myLocationHandler)
626...
627subscription.remove()`),new Promise(function(r,s){for(var i=null,o=0,l=Zs.length;o<l;o++){var c=Zs[o];if(c.event===t&&c.callback===n){i=c;break}}i!==null?(Zs.splice(Zs.indexOf(i),1),i.subscription.remove(),r()):(console.warn(VC+" Failed to find listener for event "+t),s())})},e.removeListeners=function(){var t=this;return new Promise(function(n){return OC(t,void 0,void 0,function(){return DC(this,function(r){switch(r.label){case 0:return Zs=[],[4,Ue.removeAllEventListeners()];case 1:return r.sent(),n(),[2]}})})})},e}(),BC;(function(e){e[e.Sunday=1]="Sunday",e[e.Monday=2]="Monday",e[e.Tuesday=3]="Tuesday",e[e.Wednesday=4]="Wednesday",e[e.Thursday=5]="Thursday",e[e.Friday=6]="Friday",e[e.Saturday=7]="Saturday"})(BC||(BC={}));const bce=us("LocalNotifications",{web:()=>ve(()=>import("./web-BPWlRdnm.js"),__vite__mapDeps([149,1])).then(e=>new e.LocalNotificationsWeb)}),UC=100,i4="geofence_optin_cache",o4="geofence_properties_cache",zC="geofence_device_token_cache";function wce(e,t,n,r){const i=u=>u*Math.PI/180,o=i(n-e),l=i(r-t),c=Math.sin(o/2)**2+Math.cos(i(e))*Math.cos(i(n))*Math.sin(l/2)**2;return 6371e3*2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))}let ru=!1,Xs=null,Js=null;const y0=new Map,HC=3e4;function _ce(){try{const e=localStorage.getItem(i4);return e!==null?JSON.parse(e):null}catch{return null}}function kce(e){try{localStorage.setItem(i4,JSON.stringify(e))}catch{}}function Sce(){try{const e=localStorage.getItem(o4);return e?JSON.parse(e):null}catch{return null}}function Ece(e){try{localStorage.setItem(o4,JSON.stringify(e))}catch{}}async function Nce(){var e;try{const t=await fetch("/api/user/preferences",{credentials:"include"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.json(),r=((e=n==null?void 0:n.preferences)==null?void 0:e.locationTrackingEnabled)===!0;return kce(r),r}catch{const t=_ce();return t!==null?(console.log("[GeofenceService] Offline – using cached opt-in preference:",t),t):(console.log("[GeofenceService] Offline and no cached opt-in – defaulting to false."),!1)}}async function WC(){try{const e=await fetch("/api/geofence/properties",{credentials:"include"});if(!e.ok)throw new Error(`Failed to fetch geofenceable properties: ${e.status}`);const t=await e.json();return Ece(t),t}catch{const e=Sce();return e&&e.length>0?(console.log(`[GeofenceService] Offline – using ${e.length} cached property/properties.`),e):(console.log("[GeofenceService] Offline and no cached properties – no geofences to register."),[])}}async function Cce(){try{const e=await fetch("/api/geofence/device-token",{credentials:"include"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.json();return localStorage.setItem(zC,t.token),t.token}catch{const e=localStorage.getItem(zC);return e?(console.log("[GeofenceService] Offline – using cached device token."),e):(console.warn("[GeofenceService] No device token available – native HTTP sync disabled."),null)}}async function qC(e){if(e.length===0){console.log("[GeofenceService] No geocoded properties to register.");return}const t=e.map(n=>({identifier:String(n.id),radius:n.radius??UC,latitude:Number(n.latitude),longitude:Number(n.longitude),notifyOnEntry:!0,notifyOnExit:!0,loiteringDelay:3e4}));await vr.addGeofences(t),console.log(`[GeofenceService] Registered ${t.length} geofence(s).`);try{const n=await vr.getCurrentPosition({timeout:10,maximumAge:3e4,desiredAccuracy:50,samples:1}),{latitude:r,longitude:s}=n.coords,i=Date.now();for(const o of e){const l=o.radius??UC,c=wce(r,s,Number(o.latitude),Number(o.longitude));c<=l&&(y0.set(o.id,{eventType:"enter",timestamp:i}),console.log(`[GeofenceService] Already inside property #${o.id} (${c.toFixed(0)}m ≤ ${l}m) — reconciling startup ENTER.`),await jce(o.id,"enter",n.timestamp,{source:"startup-reconciliation",distanceMetres:Math.round(c),radiusMetres:l}))}}catch{console.warn("[GeofenceService] Could not get current position for pre-seeding — spurious ENTERs may occur on re-registration.")}}async function jce(e,t,n,r){try{const s=await fetch("/api/geofence/event",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({propertyId:e,eventType:t,timestamp:n??new Date().toISOString(),rawPayload:r})});if(!s.ok){const o=await s.text().catch(()=>"");console.warn(`[GeofenceService] Startup ${t.toUpperCase()} reconciliation failed for property #${e}: ${s.status} ${o}`);return}const i=await s.json().catch(()=>null);console.log(`[GeofenceService] Startup ${t.toUpperCase()} reconciliation for property #${e}:`,i)}catch(s){console.warn(`[GeofenceService] Startup ${t.toUpperCase()} reconciliation error for property #${e}:`,s)}}async function Tce(e){const t=parseInt(e.identifier,10);if(isNaN(t)){console.warn("[GeofenceService] Unknown geofence identifier:",e.identifier);return}const n=e.action==="ENTER"?"enter":"exit",r=Date.now(),s=y0.get(t);if(s&&s.eventType!==n&&r-s.timestamp<HC){console.log(`[GeofenceService] Oscillation suppressed: ${n.toUpperCase()} for property #${t} arrived ${((r-s.timestamp)/1e3).toFixed(1)}s after ${s.eventType.toUpperCase()} (cooldown: ${HC/1e3}s).`);return}if(y0.set(t,{eventType:n,timestamp:r}),console.log(`[GeofenceService] ${n.toUpperCase()} → property #${t}`),n==="exit")try{await vr.changePace(!0)}catch{}}
627const ku={async start(){if(ru){console.log("[GeofenceService] Already running.");return}if(!await Nce()){console.log("[GeofenceService] Location tracking is disabled. User has not opted in.");return}try{(await bce.requestPermissions()).display!=="granted"&&console.warn("[GeofenceService] Notification permission not granted – foreground service may be killed by Android.");const n=await Cce(),r=await vr.ready({stopOnTerminate:!1,startOnBoot:!0,foregroundService:!0,notification:{title:"REPSShield",text:"Tracking active - monitoring your properties.",channelName:"REPSShield Location",smallIcon:"ic_stat_notification",sticky:!0},locationAuthorizationRequest:"Always",backgroundPermissionRationale:{title:"Background Location Required",message:"REPSShield uses background location to automatically detect when you arrive at or leave your monitored properties.",positiveAction:"Allow All the Time",negativeAction:"Cancel"},...n?{url:`${Qee.replace(/\/$/,"")}/api/geofence/native-sync`,method:"POST",autoSync:!0,autoSyncThreshold:0,batchSync:!1,persistMode:vr.PERSIST_MODE_GEOFENCE,httpRootProperty:"location",authorization:{strategy:"JWT",accessToken:n}}:{},desiredAccuracy:vr.DESIRED_ACCURACY_HIGH,distanceFilter:25,disableElasticity:!0,locationUpdateInterval:5e3,fastestLocationUpdateInterval:5e3,stopTimeout:60,disableMotionActivityUpdates:!0,geofenceInitialTriggerEntry:!0,preventSuspend:!0,heartbeatInterval:60,logLevel:vr.LOG_LEVEL_VERBOSE,debug:!1});await vr.requestPermission(),r.enabled||await vr.start(),Js==null||Js.remove(),Xs==null||Xs.remove(),Js=null,Xs=null;const s=await WC();await qC(s),Js=vr.onGeofence(Tce),Xs=vr.onLocation(i=>{ku._lastLocation=i,ku._locationListeners.forEach(o=>o(i))},i=>console.error("[GeofenceService] Location error:",i)),ru=!0,console.log("[GeofenceService] Started.")}catch(t){throw console.error("[GeofenceService] Failed to start:",t),t}},async stop(){ru&&(Js==null||Js.remove(),Xs==null||Xs.remove(),Js=null,Xs=null,await vr.stop(),ru=!1,console.log("[GeofenceService] Stopped."))},async refreshGeofences(){try{await vr.removeGeofences();const e=await WC();await qC(e),console.log("[GeofenceService] Geofences refreshed.")}catch(e){throw console.error("[GeofenceService] Failed to refresh geofences:",e),e}},get isRunning(){return ru},_lastLocation:null,_locationListeners:new Set,onLocation(e){return this._locationListeners.add(e),this._lastLocation&&e(this._lastLocation),()=>this._locationListeners.delete(e)},startGeofenceMonitoring:async()=>ku.start(),stopGeofenceMonitoring:async()=>ku.stop()};function Pce({onEnabled:e,onDismiss:t}){const{toast:n}=sn(),r=Lt(),[s,i]=m.useState(!1),o=gt({mutationFn:async()=>{const c=await fetch("/api/user/preferences",{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({locationTrackingEnabled:!0})});if(!c.ok)throw new Error("Failed to update preference");try{localStorage.setItem("geofence_optin_cache",JSON.stringify(!0))}catch{}return c.json()},onSuccess:async()=>{r.invalidateQueries({queryKey:["/api/user/preferences"]}),await ku.start(),n({title:"Visit detection enabled",description:"We'll detect visits to your properties and create pending time entries for your review."}),e==null||e()},onError:()=>{n({title:"Error",description:"Failed to enable visit detection. Please try again.",variant:"destructive"})}});function l(){i(!0),t==null||t()}return a.jsx("div",{className:"mt-2 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-900/40 dark:bg-amber-950/20 p-3",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("div",{className:"mt-0.5 shrink-0 rounded-full bg-amber-100 dark:bg-amber-900/30 p-1.5",children:a.jsx(rm,{className:"h-3.5 w-3.5 text-amber-600 dark:text-amber-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-medium text-amber-900 dark:text-amber-100",children:"Enable automatic visit logging?"}),a.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-300/80 mt-0.5 leading-relaxed",children:"We'll detect when you arrive at your properties and create pending time entries for your review."}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsxs(ie,{size:"sm",className:"h-7 px-2.5 text-xs bg-amber-600 hover:bg-amber-700 text-white",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?a.jsx(ct,{className:"h-3 w-3 animate-spin mr-1"}):null,"Enable"]}),a.jsx(ie,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs text-amber-700 dark:text-amber-300 hover:text-amber-900 dark:hover:text-amber-100",onClick:l,disabled:o.isPending,children:"Not now"})]})]})]})})}function Vp({title:e="Extracting evidence details",label:t="REPS evidence scan",description:n="Reading your upload to suggest a date, activity type, and description. Hours and property stay ready for you to confirm.",variant:r="full"}){return r==="compact"?a.jsx("div",{className:"rounded-lg border border-border/70 bg-background px-3 py-2 shadow-sm",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"relative mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:[a.jsx(vx,{className:"h-4 w-4"}),a.jsx(vo,{className:"absolute -right-1 -top-1 h-3 w-3 animate-pulse text-primary"})]}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:e}),a.jsx("span",{className:"rounded-full border border-primary/20 bg-primary/5 px-2 py-0.5 text-[10px] font-medium leading-none text-primary",children:t})]}),a.jsx("p",{className:"text-[11px] leading-snug text-muted-foreground",children:n}),a.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full w-1/2 animate-[evidence-scan_1.4s_ease-in-out_infinite] rounded-full bg-gradient-to-r from-primary via-pink-500 to-blue-500"})})]})]})}):a.jsx("div",{className:"rounded-xl border border-border/70 bg-background p-4 shadow-lg shadow-black/10",children:a.jsxs("div",{className:"space-y-4 text-center",children:[a.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),a.jsxs("div",{className:"mx-auto w-full max-w-[260px] rounded-lg border border-border bg-muted/30 p-3 text-left",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"relative flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:[a.jsx(vx,{className:"h-4 w-4"}),a.jsx(vo,{className:"absolute -right-1 -top-1 h-3 w-3 animate-pulse text-primary"})]}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[a.jsx("div",{className:"h-2.5 w-24 animate-pulse rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2.5 w-20 animate-pulse rounded-full bg-slate-500"})]})]}),a.jsxs("div",{className:"mt-4 space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-[32px_1fr] items-center gap-2",children:[a.jsx("div",{className:"h-1.5 rounded-full bg-muted-foreground
627/20"}),a.jsx("div",{className:"h-1.5 animate-pulse rounded-full bg-muted-foreground/45"})]}),a.jsxs("div",{className:"grid grid-cols-[32px_1fr] items-center gap-2",children:[a.jsx("div",{className:"h-1.5 rounded-full bg-muted-foreground/20"}),a.jsx("div",{className:"h-1.5 w-4/5 animate-pulse rounded-full bg-muted-foreground/30"})]}),a.jsxs("div",{className:"grid grid-cols-[32px_1fr] items-center gap-2",children:[a.jsx("div",{className:"h-1.5 rounded-full bg-muted-foreground/20"}),a.jsx("div",{className:"h-1.5 animate-pulse rounded-full bg-muted-foreground/45"})]}),a.jsxs("div",{className:"grid grid-cols-[32px_1fr] items-center gap-2",children:[a.jsx("div",{className:"h-1.5 rounded-full bg-muted-foreground/20"}),a.jsx("div",{className:"h-1.5 w-4/5 animate-pulse rounded-full bg-muted-foreground/30"})]})]}),a.jsx("div",{className:"mt-4 flex justify-end",children:a.jsx("div",{className:"h-2.5 w-14 animate-pulse rounded-full bg-slate-600"})}),a.jsx("div",{className:"mt-3 h-1 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full w-1/2 animate-[evidence-scan_1.4s_ease-in-out_infinite] rounded-full bg-gradient-to-r from-primary via-pink-500 to-blue-500"})})]}),a.jsx("div",{className:"inline-flex max-w-full items-center justify-center rounded-full border border-primary/20 bg-primary/5 px-3 py-1 text-xs font-medium text-primary",children:t}),a.jsx("p",{className:"mx-auto max-w-[360px] text-xs leading-relaxed text-muted-foreground",children:n})]})})}function Ace({toolCallId:e,entry:t,attachedFiles:n,skipAttachedFileExtraction:r=!1,onCancel:s}){const i=Lt(),{getCardState:o,setCardState:l}=Do(),c={date:t.date,hours:String(t.hours),activityType:t.activityType,propertyId:t.propertyId!=null?String(t.propertyId):"none",description:t.description??"",isMaterialParticipation:t.isMaterialParticipation??!0,isQualifiedNonMaterial:!1},u=o(e),d=(u==null?void 0:u.status)??"pending",h=(u==null?void 0:u.editMode)??!1,f=(u==null?void 0:u.editState)??c,p=(u==null?void 0:u.isSaving)??!1,g=(u==null?void 0:u.cardFiles)??[];function v(j){const P=o(e);l(e,{status:(P==null?void 0:P.status)??"pending",editMode:(P==null?void 0:P.editMode)??!1,editState:(P==null?void 0:P.editState)??c,isSaving:(P==null?void 0:P.isSaving)??!1,cardFiles:(P==null?void 0:P.cardFiles)??[],locationTrackingEnabled:P==null?void 0:P.locationTrackingEnabled,visitPromptDismissed:P==null?void 0:P.visitPromptDismissed,isExtractingEvidence:(P==null?void 0:P.isExtractingEvidence)??!1,evidenceExtractionMessage:P==null?void 0:P.evidenceExtractionMessage,extractedFileSignature:P==null?void 0:P.extractedFileSignature,...j})}const{data:y=[]}=tt({queryKey:["/api/properties"],staleTime:5*60*1e3,enabled:h}),x=m.useRef(null),b=10,w=10*1024*1024;function S(j){return new Promise((P,D)=>{const C=new FileReader;C.onload=()=>{P({type:"file",mediaType:j.type||"application/octet-stream",url:C.result,filename:j.name})},C.onerror=()=>D(C.error),C.readAsDataURL(j)})}async function _(j){if(!j||j.length===0)return;const P=Array.from(j);x.current&&(x.current.value="");const D=P.find(V=>V.size>w);if(D){alert(`"${D.name}" exceeds the 10 MB limit.`);return}if([...g,...P].length>b){alert(`You can attach at most ${b} files total.`);return}const H=await Promise.all(P.map(S));v({cardFiles:[...g,...H]}),k(P,P.map(V=>`${V.name}:${V.type}:${V.size}:${V.lastModified}`).join("|"))}function E(j){v({cardFiles:g.filter((P,D)=>D!==j)})}const R=(n==null?void 0:n.length)??0;function A(j){var O;const[P,D]=j.split(","),C=((O=P.match(/:(.*?);/))==null?void 0:O[1])||"application/octet-stream",H=atob(D),V=new Uint8Array(H.length);for(let G=0;G<H.length;G++)V[G]=H.charCodeAt(G);return new Blob([V],{type:C})}function N(j){const P=j.mappedFields,D={...f},C=[];return P.date.value&&P.date.confidence>=.65&&(D.date=P.date.value,C.push("date")),P.activityType.value&&P.activityType.confidence>=.7&&(D.activityType=P.activityType.value,C.push("activity")),P.description.value&&P.description.confidence>=.6&&!D.description.trim()&&(D.description=P.description.value,C.push("description")),v(C.length>0?{editMode:!0,editState:D,evidenceExtractionMessage:`Filled ${C.join(", ")} from uploaded evidence.`}:{evidenceExtractionMessage:"Scan complete. Please fill any missing details manually."}),C}async function k(j,P){if(!(j.length===0||d!=="pending")){v({isExtractingEvidence:!0,evidenceExtractionMessage:"Scanning evidence...",extractedFileSignature:P});try{const D=await s1(j);N(D)}catch(D){console.error("Evidence extraction failed:",D),v({evidenceExtractionMessage:"We couldn't scan this evidence. You can still review and confirm manually."})}finally{v({isExtractingEvidence:!1})}}}m.useEffect(()=>{if(r||!n||n.length===0||d!=="pending")return;const j=n.map(C=>`${C.filename||"file"}:${C.mediaType}:${C.url.length}`).join("|"),P=o(e);if((P==null?void 0:P.extractedFileSignature)===j)return;const D=n.map((C,H)=>({blob:A(C.url),filename:C.filename||`evidence-${H+1}`}));k(D,j)},[n,d,e]);async function T(){v({status:"confirming"});try{const j=[...n??[],...g],P=await RC({date:t.date,hours:t.hours,activityType:t.activityType,activityTypeLabel:t.activityTypeLabel,propertyId:t.propertyId,description:t.description,isMaterialParticipation:t.isMaterialParticipation??!0},j.length>0?j:void 0);v({status:"confirmed",locationTrackingEnabled:P.locationTrackingEnabled??!1}),M()}catch{v({status:"pending"})}}async function I(){v({isSaving:!0});try{const j=parseFloat(f.hours),P=f.propertyId!=="none"?parseInt(f.propertyId,10):null,D=[...n??[],...g],C=await RC({date:f.date,hours:isNaN(j)?t.hours:j,activityType:f.activityType,activityTypeLabel:f.activityType,propertyId:P,description:f.description.trim()||void 0,isMaterialParticipation:f.isMaterialParticipation},D.length>0?D:void 0);v({editMode:!1,status:"confirmed",isSaving:!1,locationTrackingEnabled:C.locationTrackingEnabled??!1}),M()}catch{v({isSaving:!1})}}function F(){v({status:"cancelled"}),s()}function L(){v({editMode:!1,editState:c})}function M(){i.invalidateQueries({queryKey:["/api/time-entries"]}),i.invalidateQueries({queryKey:["/api/stats"]}),i.invalidateQueries({queryKey:["/api/stats/rep-progress"]}),i.invalidateQueries({queryKey:["/api/stats/rep-requirements"]})}function $(j,P){v({editState:{...f,[j]:P}}
627)}return h?a.jsx(ht,{children:a.jsxs(yt,{className:"p-4 space-y-3 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"font-medium text-sm",children:"Edit Activity"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{size:"sm",variant:"outline",onClick:L,disabled:p,children:"Cancel"}),a.jsx(ie,{size:"sm",onClick:I,disabled:p||!f.date||!f.activityType||!f.hours,className:"bg-primary text-primary-foreground hover:bg-primary/90",children:p?a.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):"Save"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(at,{className:"text-xs text-muted-foreground",children:"(optional)"}),a.jsxs(ko,{value:f.propertyId,onValueChange:j=>$("propertyId",j),children:[a.jsx(ki,{className:"text-xs h-9",children:a.jsx(So,{placeholder:"Select property..."})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"none",className:"text-xs",children:"No property"}),y.map(j=>a.jsx(Cn,{value:String(j.id),className:"text-xs",children:j.nickname??j.address??`Property ${j.id}`},j.id))]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(at,{className:"text-xs text-muted-foreground",children:"Date"}),a.jsx(Ct,{type:"date",value:f.date,onChange:j=>$("date",j.target.value),className:"h-9 text-xs"})]}),a.jsx(p_,{value:f.hours,onChange:j=>$("hours",j),label:"Duration (hrs)",showQuickButtons:!1,showConversion:!1}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(at,{className:"text-xs text-muted-foreground",children:"Activity Type"}),a.jsx(y_,{value:f.activityType,onValueChange:j=>$("activityType",j),placeholder:"Select or type activity type...",className:"text-xs"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_d,{id:`edit-mp-${e}`,checked:f.isMaterialParticipation,onCheckedChange:j=>{$("isMaterialParticipation",j),j&&$("isQualifiedNonMaterial",!1)}}),a.jsx(at,{htmlFor:`edit-mp-${e}`,className:"text-xs font-normal",children:"Material Participation Activity"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_d,{id:`edit-qnm-${e}`,checked:f.isQualifiedNonMaterial,onCheckedChange:j=>{$("isQualifiedNonMaterial",j),j&&$("isMaterialParticipation",!1)}}),a.jsx(at,{htmlFor:`edit-qnm-${e}`,className:"text-xs font-normal",children:"Qualified Non-Material Activity"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(at,{className:"text-xs text-muted-foreground",children:"Description"}),a.jsx(Us,{value:f.description,onChange:j=>$("description",j.target.value),placeholder:"Describe your activity...",className:"text-xs min-h-[72px] resize-none"})]}),R>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(at,{className:"text-xs text-muted-foreground",children:[a.jsx(tl,{className:"h-3 w-3 inline mr-1"}),R," file",R!==1?"s":""," from chat"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:n.map((j,P)=>{const D=j.mediaType.startsWith("image/"),C=j.filename||`File ${P+1}`;return D?a.jsx("img",{src:j.url,alt:C,className:"h-12 w-12 rounded-md object-cover border"},P):a.jsxs("div",{className:"flex items-center gap-1.5 bg-muted rounded-md px-2 py-1 text-xs max-w-[140px]",children:[a.jsx(Nr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:C})]},P)})})]}),a.jsxs("div",{className:"space-y-1.5 border-t border-border/50 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(at,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(tl,{className:"h-3 w-3"}),"Attach Evidence",a.jsx("span",{className:"text-xs text-muted-foreground/70",children:"(optional)"})]}),a.jsxs(ie,{type:"button",size:"sm",variant:"outline",className:"h-6 px-2 text-xs gap-1",onClick:()=>{var j;return(j=x.current)==null?void 0:j.click()},disabled:p,children:[a.jsx(fd,{className:"h-3 w-3"}),"Add"]})]}),(u==null?void 0:u.isExtractingEvidence)&&a.jsx("div",{className:"pt-1",children:a.jsx(Vp,{title:"Extracting evidence details",label:"Rep Assistant evidence",description:"Reading the attachment to update the preview with a date, activity type, and description before you confirm."})}),!(u!=null&&u.isExtractingEvidence)&&(u==null?void 0:u.evidenceExtractionMessage)&&a.jsx("p",{className:"text-xs text-muted-foreground",children:u.evidenceExtractionMessage}),g.length>0&&a.jsx("div",{className:"space-y-1",children:g.map((j,P)=>{const D=j.mediaType.startsWith("image/"),C=j.filename||`File ${P+1}`;return a.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/60 rounded-md px-2 py-1 text-xs",children:[D?a.jsx(tl,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):a.jsx(Nr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate flex-1 max-w-[160px]",children:C}),a.jsx("button",{type:"button",onClick:()=>E(P),disabled:p,className:"shrink-0 text-muted-foreground hover:text-destructive transition-colors ml-auto","aria-label":`Remove ${C}`,children:a.jsx(vn,{className:"h-3 w-3"})})]},P)})})]})]})}):a.jsx(ht,{className:d==="confirmed"?"border-green-500/50":d==="cancelled"?"opacity-50":"",children:a.jsxs(yt,{className:"p-4 space-y-2 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"font-medium",children:"Time Entry Preview"}),d==="pending"&&a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>v({editMode:!0}),className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground","aria-label":"Edit entry",children:a.jsx(Tb,{className:"h-3.5 w-3.5"})})]}),a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:[a.jsx("span",{className:"text-muted-foreground",children:"Date"}),a.jsx("span",{children:t.date}),a.jsx("span",{className:"text-muted-foreground",children:"Hours"}),a.jsx("span",{children:t.hours}),a.jsx("span",{className:"text-muted-foreground",children:"Activity"}),a.jsx("span",{children:t.activityTypeLabel}),t.propertyName&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:"Property"}),a.jsxs("span",{children:[t.propertyName,t.propertyAddress?` — ${t.propertyAddress}`:""]})]}),t.description&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:"Description"}),a.jsx("span",{children:t.description})]}),R>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:"Evidence"}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(tl,{className:"h-3 w-3"}),R," file",R!==1?"s":""," attached"]})]})]}),R>0&&a.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:n.map((j,P)=>{const D=j.mediaType.startsWith("image/"),C=j.filename||`File ${P+1}`;
627return D?a.jsx("img",{src:j.url,alt:C,className:"h-14 w-14 rounded-md object-cover border"},P):a.jsxs("div",{className:"flex items-center gap-1.5 bg-muted rounded-md px-2 py-1 text-xs max-w-[140px]",children:[a.jsx(Nr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:C})]},P)})}),a.jsx("input",{ref:x,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.csv,.txt",className:"sr-only",onChange:j=>_(j.target.files)}),d==="pending"&&a.jsxs("div",{className:"space-y-2 pt-1 border-t border-border/50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(tl,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs font-medium",children:"Attach Evidence"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),a.jsxs(ie,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs gap-1",onClick:()=>{var j;return(j=x.current)==null?void 0:j.click()},children:[a.jsx(fd,{className:"h-3 w-3"}),"Add Files"]})]}),(u==null?void 0:u.isExtractingEvidence)&&a.jsx("div",{className:"pt-1",children:a.jsx(Vp,{title:"Extracting evidence details",label:"Rep Assistant evidence",description:"Reading the attachment to update the preview with a date, activity type, and description before you confirm."})}),!(u!=null&&u.isExtractingEvidence)&&(u==null?void 0:u.evidenceExtractionMessage)&&a.jsx("p",{className:"text-xs text-muted-foreground",children:u.evidenceExtractionMessage}),g.length>0&&a.jsxs("div",{className:"space-y-1",children:[g.some(j=>j.mediaType.startsWith("image/"))&&a.jsx("div",{className:"flex flex-wrap gap-2",children:g.filter(j=>j.mediaType.startsWith("image/")).map((j,P)=>a.jsx("img",{src:j.url,alt:j.filename||`Image ${P+1}`,className:"h-14 w-14 rounded-md object-cover border"},P))}),g.map((j,P)=>{const D=j.mediaType.startsWith("image/"),C=j.filename||`File ${P+1}`;return a.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/60 rounded-md px-2 py-1 text-xs",children:[D?a.jsx(tl,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):a.jsx(Nr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate flex-1 max-w-[160px]",children:C}),a.jsx("button",{type:"button",onClick:()=>E(P),className:"shrink-0 text-muted-foreground hover:text-destructive transition-colors ml-auto","aria-label":`Remove ${C}`,children:a.jsx(vn,{className:"h-3 w-3"})})]},P)})]})]}),d==="confirmed"&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs text-green-600 flex items-center gap-1",children:[a.jsx(bt,{className:"h-3 w-3"})," Entry created",R+g.length>0?" with evidence":""]}),Ye()&&(u==null?void 0:u.locationTrackingEnabled)!==!0&&!(u!=null&&u.visitPromptDismissed)&&a.jsx(Pce,{onEnabled:()=>v({locationTrackingEnabled:!0}),onDismiss:()=>v({visitPromptDismissed:!0})})]}),d==="pending"&&a.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[a.jsxs(ie,{size:"sm",onClick:T,className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1"})," Confirm"]}),a.jsxs(ie,{size:"sm",variant:"ghost",onClick:F,className:"h-8 px-2 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(vn,{className:"h-3.5 w-3.5 mr-1"})," Cancel"]})]}),d==="confirming"&&a.jsxs("div",{className:"flex items-center gap-2 pt-2 text-xs text-muted-foreground",children:[a.jsx(ct,{className:"h-3 w-3 animate-spin"})," Creating entry",R+g.length>0?" & uploading evidence":"","..."]})]})})}function x0(e){return`[FORM_SUBMIT form_id="${e.formId}" selected_id="${e.selectedId}" selected_label="${e.selectedLabel}"]`}function eg(e){const t=JSON.stringify(e.answers);return`[QUESTIONNAIRE_SUBMIT questionnaire_id="${e.questionnaireId}" answers=${t}]`}function GC(e){return`[REMEDIATION_SUBMIT finding_number="${e.findingNumber}" wizard_type="${e.wizardType}" result="${e.result}" reaudit_status="${e.reauditStatus??"unknown"}" entry_id="${e.entryId}"]`}function Ice(e){const t=n=>n.replace(/"/g,'\\"');return`[UNLOGGED_SIGNAL_LOG candidate_id="${e.candidateId}" date="${e.date}" duration_hint="${e.durationHint??""}" property_id="${e.propertyId??""}" property_name="${t(e.propertyName??"")}" summary="${t(e.summary)}" source="${e.source}"]`}function Ha({icon:e,title:t,subtitle:n,step:r,trailing:s}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e&&a.jsx(e,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm leading-snug",children:t}),n&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:n})]})]}),s&&a.jsx("div",{className:"shrink-0",children:s})]}),r&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:r.totalSteps}).map((i,o)=>a.jsx("div",{className:q("h-1 flex-1 rounded-full transition-colors",o<=r.currentIndex?"bg-primary":"bg-border")},o))}),a.jsxs("p",{className:"text-xs text-muted-foreground -mt-1",children:["Step ",r.currentIndex+1," of ",r.totalSteps,":"," ",a.jsx("span",{className:"font-medium text-foreground",children:r.currentLabel})]})]})]})}function Rce({toolCallId:e,schema:t,onSubmit:n}){const r=m.useId(),{getCardState:s,setCardState:i}=Do(),o=s(e),l=(o==null?void 0:o.query)??"",c=(o==null?void 0:o.selectedId)??null,u=(o==null?void 0:o.status)??"pending";function d(x){const b=s(e);i(e,{query:(b==null?void 0:b.query)??"",selectedId:(b==null?void 0:b.selectedId)??null,status:(b==null?void 0:b.status)??"pending",...x})}const h=t.options.length>8,f=l.trim()?t.options.filter(x=>{var b;return x.label.toLowerCase().includes(l.toLowerCase())||((b=x.description)==null?void 0:b.toLowerCase().includes(l.toLowerCase()))}):t.options,p=t.options.find(x=>x.id===c)??null;function g(){if(!p)return;const x={formId:t.formId,selectedId:p.id,selectedLabel:p.label};d({status:"submitted"}
627),n(x0(x))}function v(){d({status:"cancelled"}),n("Cancel that selection.")}function y(x){d({selectedId:x})}return u==="submitted"&&p?a.jsx(ht,{className:"border-green-500/50",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"text-muted-foreground",children:t.title}),a.jsx("span",{className:"font-medium",children:p.label})]})}):u==="cancelled"?a.jsx(ht,{className:"opacity-50",children:a.jsx(yt,{className:"p-3 text-sm text-muted-foreground",children:"Selection cancelled."})}):a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-0",children:[a.jsx("div",{className:"px-4 pt-4 pb-3 border-b border-border/60",children:a.jsx(Ha,{title:t.title,subtitle:t.instruction,trailing:a.jsx("button",{type:"button","aria-label":"Cancel selection",onClick:v,className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors shrink-0",children:a.jsx(vn,{className:"h-4 w-4"})})})}),a.jsxs("div",{className:"px-4 py-3 space-y-3",children:[h&&a.jsxs("div",{className:"relative",children:[a.jsx(hd,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),a.jsx(Ct,{id:r,value:l,onChange:x=>d({query:x.target.value}),placeholder:"Search…",className:"pl-8 h-8 text-sm","aria-label":"Search options"})]}),a.jsxs("ul",{role:"listbox","aria-label":t.title,className:"space-y-1 max-h-60 overflow-y-auto",children:[f.length===0&&a.jsx("li",{className:"text-xs text-muted-foreground py-2 text-center",children:"No matches"}),f.map((x,b)=>a.jsx(Mce,{option:x,number:b+1,isSelected:c===x.id,onSelect:y},x.id))]})]}),a.jsx("div",{className:"flex justify-end px-4 pb-4 pt-1",children:a.jsxs(ie,{size:"sm",disabled:!c,onClick:g,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1"}),"Select"]})})]})})}function Mce({option:e,number:t,isSelected:n,onSelect:r}){return a.jsxs("li",{role:"option","aria-selected":n,tabIndex:0,onClick:()=>r(e.id),onKeyDown:s=>(s.key==="Enter"||s.key===" ")&&r(e.id),className:q("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm cursor-pointer select-none transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"bg-muted/80 text-foreground":"hover:bg-muted/50 text-foreground"),children:[a.jsx("span",{className:q("shrink-0 h-6 w-6 rounded-full flex items-center justify-center text-xs font-medium transition-colors",n?"bg-foreground text-background":"bg-muted-foreground/15 text-muted-foreground"),"aria-hidden":!0,children:t}),a.jsxs("span",{className:"flex flex-col min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium leading-snug",children:e.label}),e.description&&a.jsx("span",{className:"text-xs text-muted-foreground leading-snug",children:e.description})]}),n&&a.jsx(Ar,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":!0})]})}function Oce({toolCallId:e,schema:t,onSubmit:n}){var M,$;const{toast:r}=sn(),{getCardState:s,setCardState:i}=Do(),o=s(e),l=(o==null?void 0:o.answers)??{},c=(o==null?void 0:o.stepIndex)??0,u=(o==null?void 0:o.status)??"pending",d=(o==null?void 0:o.numberInput)??"",h=(o==null?void 0:o.textInput)??"",f=(o==null?void 0:o.dateInput)??"",p=(o==null?void 0:o.multiTextInputs)??{};function g(j){const P=s(e);i(e,{answers:(P==null?void 0:P.answers)??{},stepIndex:(P==null?void 0:P.stepIndex)??0,status:(P==null?void 0:P.status)??"pending",numberInput:(P==null?void 0:P.numberInput)??"",textInput:(P==null?void 0:P.textInput)??"",dateInput:(P==null?void 0:P.dateInput)??"",multiTextInputs:(P==null?void 0:P.multiTextInputs)??{},...j})}const v=Dce(t.steps,l),y=v[c]??null,x=(y==null?void 0:y.type)==="select"&&y.field==="propertyId"&&(((M=y.options)==null?void 0:M.length)??0)===0,{data:b=[],isLoading:w}=tt({queryKey:["/api/properties"],enabled:x,staleTime:1e3*60*5,queryFn:async()=>{const j=await fetch("/api/properties",{credentials:"include"});if(!j.ok)throw new Error("Failed to fetch properties");return j.json()}}),S=b.map(j=>({id:String(j.id),label:j.nickname??j.address??`Property ${j.id}
627`,description:[j.address,j.city,j.state].filter(Boolean).join(", ")})),_=v.length,E=c===_-1,R=c===0;m.useEffect(()=>{if(!y)return;const j=l[y.field];if(y.type==="number")g({numberInput:j!==void 0?String(j):""});else if(y.type==="text")g({textInput:j!==void 0?String(j):""});else if(y.type==="date")g({dateInput:j!==void 0?String(j):""});else if(y.type==="multi-text"&&y.fields){const P={};for(const D of y.fields){const C=l[D.key];P[D.key]=C!==void 0?String(C):""}g({multiTextInputs:P})}},[c]);function A(j){if(!y)return;const P={...l,[y.field]:j};g({answers:P}),E||g({stepIndex:c+1})}function N(){if(y){if(y.type==="number"){const j=parseFloat(d);if(!d||isNaN(j))return;const P=y.min??.25,D=y.max??9999;if(j<P||j>D)return;const C={...l,[y.field]:j};if(g({answers:C,numberInput:""}),E){T(C);return}}else if(y.type==="text"){const j=h.trim();if(!j)return;const P={...l,[y.field]:j};if(g({answers:P,textInput:""}),E){T(P);return}}else if(y.type==="date"){const j=f.trim();if(!j)return;const P={...l,[y.field]:j};if(g({answers:P,dateInput:""}),E){T(P);return}}else if(y.type==="multi-text"&&y.fields){if(!y.fields.every(D=>(p[D.key]??"").trim().length>0))return;const P={...l};for(const D of y.fields)P[D.key]=p[D.key].trim();if(g({answers:P,multiTextInputs:{}}),E){T(P);return}}else{if(!l[y.field])return;if(E){T(l);return}}g({stepIndex:c+1})}}function k(){R||g({stepIndex:c-1})}function T(j){g({status:"submitted"}),t.questionnaireId==="taxProfile"&&J_(j).catch(P=>{console.error("[QuestionnaireCard] Failed to persist tax profile:",P),r({title:"Could not save profile",description:"Your answers were submitted but could not be saved. Please try again.",variant:"destructive"})}),n(eg({questionnaireId:t.questionnaireId,answers:j}))}function I(){g({status:"cancelled"}),n("Cancel that questionnaire.")}if(u==="submitted")return a.jsx(ht,{className:"border-green-500/50",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsxs("span",{className:"font-medium",children:[t.title," — completed"]})]})});if(u==="cancelled")return a.jsx(ht,{className:"opacity-50",children:a.jsx(yt,{className:"p-3 text-sm text-muted-foreground",children:"Questionnaire cancelled."})});if(!y)return null;const F=y.type==="select"?l[y.field]??null:null,L=y.type==="number"?Lce(d,y.min,y.max):y.type==="text"?h.trim().length>0:y.type==="date"?f.trim().length>0:y.type==="multi-text"?(y.fields??[]).every(j=>(p[j.key]??"").trim().length>0):F!==null;return a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-0",children:[a.jsx("div",{className:"px-4 pt-4 pb-3 border-b border-border/60",children:a.jsx(Ha,{title:t.title,trailing:a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("button",{type:"button","aria-label":"Previous question",disabled:R,onClick:k,className:q("h-6 w-6 flex items-center justify-center rounded transition-colors",R?"text-muted-foreground/30 cursor-not-allowed":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:a.jsx(To,{className:"h-4 w-4"})}),a.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums min-w-[40px] text-center",children:[c+1," of ",_]}),a.jsx("button",{type:"button","aria-label":"Next question",disabled:!L,onClick:L?N:void 0,className:q("h-6 w-6 flex items-center justify-center rounded transition-colors",L?"text-muted-foreground hover:text-foreground hover:bg-muted/50":"text-muted-foreground/30 cursor-not-allowed"),children:a.jsx(Ar,{className:"h-4 w-4"})}),a.jsx("span",{className:"mx-1 h-4 w-px bg-border/60","aria-hidden":!0}),a.jsx("button",{type:"button","aria-label":"Cancel questionnaire",onClick:I,className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",children:a.jsx(vn,{className:"h-4 w-4"})})]})})}),a.jsxs("div",{className:"px-4 py-4 space-y-3",children:[t.instruction&&c===0&&a.jsx("p",{className:"text-xs text-muted-foreground -mt-1",children:t.instruction}),a.jsx("p",{className:"text-sm font-medium",children:y.question}),y.type==="select"&&y.options?a.jsx(Fce,{options:y.options,selectedId:F,onSelect:A,allowCustomOption:y.field==="activityType",fallbackOptions:y.field==="propertyId"?S:void 0,isLoadingOptions:y.field==="propertyId"&&w},y.field):y.type==="text"?a.jsx(Bce,{value:h,onChange:j=>g({textInput:j}),placeholder:y.placeholder,onEnter:L?N:void 0}):y.type==="date"?a.jsx(Uce,{value:f,onChange:j=>g({dateInput:j}),onEnter:L?N:void 0}):y.type==="multi-text"&&y.fields?a.jsx(zce,{fields:y.fields,values:p,onChange:(j,P)=>g({multiTextInputs:{...p,[j]:P}}),onEnter:L?N:void 0}):a.jsx(Vce,{value:d,onChange:j=>
627g({numberInput:j}),min:y.min,max:y.max,onEnter:L?N:void 0})]}),(y.type!=="select"||E)&&a.jsxs("div",{className:"flex items-center justify-between px-4 pb-4 pt-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:y.type==="text"&&!(($=y.placeholder)!=null&&$.includes("required"))&&a.jsxs("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{const j={...l};E?T(j):g({stepIndex:c+1})},children:[a.jsx(Tb,{className:"h-3 w-3"}),"Skip"]})}),a.jsx(ie,{size:"sm",disabled:!L,onClick:N,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:E?a.jsxs(a.Fragment,{children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1"}),"Finish"]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Ar,{className:"h-3.5 w-3.5 ml-1"})]})})]})]})})}function Dce(e,t){return e.filter(n=>{if(!n.condition)return!0;const r=t[n.condition.field];return r!==void 0&&n.condition.values.includes(String(r))})}function Lce(e,t,n){if(!e.trim())return!1;const r=parseFloat(e);return!(isNaN(r)||r<(t??.25)||n!==void 0&&r>n)}function Fce({options:e,selectedId:t,onSelect:n,allowCustomOption:r=!1,fallbackOptions:s,isLoadingOptions:i=!1}){const[o,l]=m.useState(""),c=e.length>0?e:s&&s.length>0?s:r?fo.map(v=>({id:v.value,label:v.label,description:v.duration})):e,u=o.trim().toLowerCase(),d=u?c.filter(v=>{var w;const y=v.label.toLowerCase(),x=((w=v.description)==null?void 0:w.toLowerCase())??"",b=v.id.toLowerCase();return y.includes(u)||x.includes(u)||b.includes(u)}):c,h=c.length>8||r,f=c.some(v=>{const y=v.label.toLowerCase(),x=v.id.toLowerCase();return y===u||x===u}),p=$ce(o),g=r&&o.trim().length>0&&!f&&p.length>0;return a.jsxs("div",{className:"space-y-2",children:[h&&a.jsxs("div",{className:"relative",children:[a.jsx(hd,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),a.jsx(Ct,{value:o,onChange:v=>l(v.target.value),placeholder:r?"Search or type a custom activity...":"Search options...",className:"pl-8 h-8 text-sm","aria-label":"Search options"})]}),a.jsxs("ul",{role:"listbox",className:"space-y-1 max-h-60 overflow-y-auto",children:[d.length===0&&!g&&a.jsx("li",{className:"text-xs text-muted-foreground py-2 text-center",children:i?"Loading options...":"No matches found"}),d.map((v,y)=>a.jsx(KC,{option:v,number:y+1,isSelected:t===v.id,onSelect:n},v.id)),g&&a.jsx(KC,{option:{id:p,label:`Use "${o.trim()}"`,description:"Custom activity type"},number:d.length+1,isSelected:t===p,onSelect:n})]})]})}function $ce(e){return e.trim().toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}function KC({option:e,number:t,isSelected:n,onSelect:r}){return a.jsxs("li",{role:"option","aria-selected":n,tabIndex:0,onClick:()=>r(e.id),onKeyDown:s=>(s.key==="Enter"||s.key===" ")&&r(e.id),className:q("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm cursor-pointer select-none transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"bg-muted/80 text-foreground":"hover:bg-muted/50 text-foreground"),children:[a.jsx("span",{className:q("shrink-0 h-6 w-6 rounded-full flex items-center justify-center text-xs font-medium transition-colors",n?"bg-foreground text-background":"bg-muted-foreground/15 text-muted-foreground"),"aria-hidden":!0,children:t}),a.jsxs("span",{className:"flex flex-col min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium leading-snug",children:e.label}),e.description&&a.jsx("span",{className:"text-xs text-muted-foreground leading-snug",children:e.description})]}),n&&a.jsx(Ar,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":!0})]})}function Vce({value:e,onChange:t,min:n,max:r,onEnter:s}){return a.jsx(Ct,{type:"number",value:e,onChange:i=>t(i.target.value),onKeyDown:i=>i.key==="Enter"&&(s==null?void 0:s()),min:n,max:r,placeholder:n!==void 0&&r!==void 0?`${n}–${r}`:n!==void 0?`Min ${n}`:"Enter a number",className:"h-9 text-sm w-36","aria-label":"Numeric input",autoFocus:!0})}function Bce({value:e,onChange:t,placeholder:n,onEnter:r}){const s=m.useRef(null);return m.useEffect(()=>{const i=setTimeout(()=>{var o;return(o=s.current)==null?void 0:o.focus()},50);return()=>clearTimeout(i)}
627,[]),a.jsx(Ct,{ref:s,type:"text",value:e,onChange:i=>t(i.target.value),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r()),placeholder:n??"Type your answer…",className:"h-9 text-sm","aria-label":"Text input"})}function Uce({value:e,onChange:t,onEnter:n}){const r=m.useRef(null);return m.useEffect(()=>{const s=setTimeout(()=>{var i;return(i=r.current)==null?void 0:i.focus()},50);return()=>clearTimeout(s)},[]),a.jsx(Ct,{ref:r,type:"date",value:e,onChange:s=>t(s.target.value),onKeyDown:s=>s.key==="Enter"&&(n==null?void 0:n()),className:"h-9 text-sm w-48","aria-label":"Date input"})}function zce({fields:e,values:t,onChange:n,onEnter:r}){const s=m.useRef(null);return m.useEffect(()=>{const i=setTimeout(()=>{var o;return(o=s.current)==null?void 0:o.focus()},50);return()=>clearTimeout(i)},[]),a.jsx("div",{className:"space-y-2.5",children:e.map((i,o)=>a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i.label}),a.jsx(Ct,{ref:o===0?s:void 0,type:"text",value:t[i.key]??"",onChange:l=>n(i.key,l.target.value),onKeyDown:l=>{l.key==="Enter"&&o===e.length-1&&(r==null||r())},placeholder:i.placeholder??"",className:"h-9 text-sm","aria-label":i.label})]},i.key))})}const Wh=["/api/advisor/audit/drafts"],Hce=["/api/advisor/audit/latest"];function Wce(){const e=Lt(),{toast:t}=sn(),{data:n,isLoading:r}=tt({queryKey:Wh,queryFn:async()=>(await Sae()).drafts}),s=gt({mutationFn:wae,onSuccess:()=>{e.invalidateQueries({queryKey:Wh})},onError:()=>{t({title:"Failed to create draft",variant:"destructive"})}}),i=gt({mutationFn:_ae,onSuccess:c=>{e.invalidateQueries({queryKey:Wh}),e.invalidateQueries({queryKey:Hce});const u=c.reauditStatus==="fixed"?"Finding resolved!":c.reauditStatus==="still-flagged"?"Applied, but finding still active. Additional changes may be needed.":"Changes applied. Run a fresh audit to see updated results.";t({title:u})},onError:()=>{t({title:"Failed to apply draft",variant:"destructive"})}}),o=gt({mutationFn:kae,onSuccess:()=>{e.invalidateQueries({queryKey:Wh}),t({title:"Draft discarded"})},onError:()=>{t({title:"Failed to discard draft",variant:"destructive"})}});async function l(c){try{const d=(await s.mutateAsync(c)).draft.id;return await i.mutateAsync(d)}catch{return}}return{drafts:n??[],isLoading:r,createAndApply:l,create:c=>s.mutate(c),apply:c=>i.mutate(c),discard:c=>o.mutate(c),isCreating:s.isPending,isApplying:i.isPending,isCreatingAndApplying:s.isPending||i.isPending,isDiscarding:o.isPending,lastApplyResult:i.data??null}}function qce(e){return e==="CRITICAL"?"border-transparent bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400":e==="WARNING"?"border-transparent bg-amber-100 text-amber-800 dark:bg-amber-900/20 dark:text-amber-400":"border-transparent bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400"}function Gce(e){return e==="CRITICAL"?"Critical":e==="WARNING"?"Warning":"Info"}const Kce={"approving-new-tenants":"Approving new tenants","reviewing-tenant-applications":"Reviewing tenant applications","responding-to-tenant-inquiries":"Responding to tenant inquiries","handling-tenant-complaints":"Handling tenant complaints","handling-tenant-evictions":"Handling tenant evictions","conducting-tenant-move-in-inspections":"Conducting tenant move-in inspections","conducting-tenant-move-out-inspections":"Conducting tenant move-out inspections","performing-routine-maintenance":"Performing routine maintenance","overseeing-major-repairs":"Overseeing major repairs","inspecting-properties-for-maintenance-needs":"Inspecting properties for maintenance needs","arranging-contractors-for-repairs":"Arranging contractors for repairs","collecting-rent-payments":"Collecting rent payments","preparing-financial-statements":"Preparing financial statements","reviewing-property-budgets":"Reviewing property budgets","property-visits-for-inspections":"Property visits for inspections","tenant-communication-phone-calls":"Tenant communication phone calls","tenant-communication-emails":"Tenant communication emails","marketing-vacant-properties":"Marketing vacant properties","showing-properties-to-prospects":"Showing properties to prospects","real-estate-education-seminars":"Real estate education seminars","rental-property-research":"Rental property research","tenant-screening-background-checks":"Tenant screening background checks","property-management-software-updates":"Property management software updates","insurance-claim-processing":"Insurance claim processing","legal-consultation-meetings":"Legal consultation meetings","tax-preparation-property-related":"Tax preparation property related","property-acquisition-analysis":"Property acquisition analysis","rental-market-analysis":"Rental market analysis","property-photography-listing":"Property photography listing","lease-agreement-preparation":"Lease agreement preparation"},Yce=Object.entries(Kce).map(([e,t])=>({slug:e,label:t}));function Qce({toolCallId:e,schema:t,onSubmit:n}){const{getCardState:r,setCardState:s}=Do(),{createAndApply:i,isCreatingAndApplying:o}=Wce(),l=r(e),c=(l==null?void 0:l.status)??"pending",u=(l==null?void 0:l.errorMessage)??null,d=(l==null?void 0:l.reauditStatus)??void 0,h=(l==null?void 0:l.panelData)??{},f=(l==null?void 0:l.panelValid)??!1;function p(b){const w=r(e);s(e,{status:(w==null?void 0:w.status)??"pending",errorMessage:(w==null?void 0:w.errorMessage)??null,reauditStatus:(w==null?void 0:w.reauditStatus)??void 0,panelData:(w==null?void 0:w.panelData)??{},panelValid:(w==null?void 0:w.panelValid)??!1,...b})}async function g(){if(!f)return;p({status:"submitting",errorMessage:null});const b=await i({findingNumber:t.findingNumber,entryId:t.entryId,draftType:t.wizardType,proposedChanges:h,auditTraceId:t.auditTraceId}),w={findingNumber:t.findingNumber,wizardType:t.wizardType,entryId:t.entryId,result:b?"applied":"failed",reauditStatus:b==null?void 0:b.reauditStatus};b?(p({reauditStatus:b.reauditStatus,status:"submitted"}),n(GC(w))):p({status:"failed",errorMessage:"The fix could not be applied. Please try again."})}function v(){p({status:"cancelled"}),n(GC({findingNumber:t.findingNumber,wizardType:t.wizardType,entryId:t.entryId,result:"cancelled"}))}function y(){p({status:"pending",errorMessage:null})}if(c==="submitted"){const b=d==="fixed"?"Finding resolved":d==="still-flagged"?"Applied — finding still active":"Applied";return a.jsx(ht,{className:"border-green-500/50",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsxs("span",{className:"font-medium",children:["Finding #",t.findingNumber," — ",b]})]})})}if(c==="cancelled")return a.jsx(ht,{className:"opacity-50",children:a.jsx(yt,{className:"p-3 text-sm text-muted-foreground",children:"Remediation cancelled."})});const x=c==="submitting"||o;return a.jsx(ht,{className:q("w-full shadow-sm",c==="failed"&&"border-red-500/50"),children:a.jsxs(yt,{className:"p-0",children:[a.jsxs("div",{className:"flex items-start justify-between px-4 pt-4 pb-3 border-b border-border/60",children:[a.jsxs("div",{className:"flex flex-col gap-1.5 pr-4 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(Is,{variant:"outline",className:q("text-[10px] font-semibold px-1.5 py-0",qce(t.severity)
627),children:Gce(t.severity)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Finding #",t.findingNumber]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t.entryDate}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.entryHours,"h"]}),t.propertyName&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t.propertyName})]})]}),a.jsx("p",{className:"text-sm font-semibold leading-snug",children:t.violationSummary}),a.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:t.recommendation})]}),a.jsx("button",{type:"button","aria-label":"Cancel remediation",onClick:v,disabled:x,className:"h-6 w-6 shrink-0 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:a.jsx(vn,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"px-4 py-4",children:[t.wizardType==="enhance_description"&&a.jsx(Zce,{currentDescription:t.currentDescription??null,onChange:(b,w)=>{p({panelData:b,panelValid:w})}}),t.wizardType==="adjust_duration"&&a.jsx(Xce,{currentHours:t.entryHours,onChange:(b,w)=>{p({panelData:b,panelValid:w})}}),t.wizardType==="reclassify_activity"&&a.jsx(Jce,{currentActivityType:t.activityType,currentActivityTypeLabel:t.activityTypeLabel,onChange:(b,w)=>{p({panelData:b,panelValid:w})}}),t.wizardType==="add_evidence"&&a.jsx(eue,{entryId:t.entryId,onChange:(b,w)=>{p({panelData:b,panelValid:w})}}),c==="failed"&&u&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-red-600 dark:text-red-400",children:[a.jsx(bi,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:u})]})]}),a.jsxs("div",{className:"flex items-center justify-between px-4 pb-4 pt-1",children:[a.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:v,disabled:x,className:"text-muted-foreground hover:text-foreground",children:"Cancel"}),a.jsxs("div",{className:"flex items-center gap-2",children:[c==="failed"&&a.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:y,className:"gap-1.5",children:[a.jsx(Pb,{className:"h-3.5 w-3.5"}),"Retry"]}),a.jsx(ie,{type:"button",size:"sm",disabled:!f||x,onClick:g,className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1.5",children:x?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(bt,{className:"h-3.5 w-3.5"}),"Apply Fix"]})})]})]})]})})}function Zce({currentDescription:e,onChange:t}){const[n,r]=m.useState(""),[s,i]=m.useState("append");function o(l,c){const u=l.trim().length>0;t({newDescription:l,mode:c},u)}return a.jsxs("div",{className:"space-y-3",children:[e&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(at,{className:"text-xs text-muted-foreground",children:"Current description"}),a.jsx("p",{className:"text-xs bg-muted/50 rounded-md px-3 py-2 text-foreground leading-relaxed",children:e})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"new-description",className:"text-sm font-medium",children:s==="append"?"Additional detail to add":"New description"}),a.jsx(Us,{id:"new-description",value:n,onChange:l=>{r(l.target.value),o(l.target.value,s)},placeholder:"Describe the activity with specifics: what you did, which property, outcome...",className:"text-sm min-h-[80px] resize-none",autoFocus:!0})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Mode:"}),a.jsx("button",{type:"button",onClick:()=>{i("append"),o(n,"append")},className:q("text-xs px-2.5 py-1 rounded-full border transition-colors",s==="append"?"bg-primary/10 border-primary/30 text-primary font-medium":"border-border text-muted-foreground hover:text-foreground"),children:"Append"}),a.jsx("button",{type:"button",onClick:()=>{i("replace"),o(n,"replace")},className:q("text-xs px-2.5 py-1 rounded-full border transition-colors",s==="replace"?"bg-primary/10 border-primary/30 text-primary font-medium":"border-border text-muted-foreground hover:text-foreground"),children:"Replace"})]})]})}function Xce({currentHours:e,onChange:t}){const[n,r]=m.useState(String(e)),[s,i]=m.useState("");function o(u,d){const h=parseFloat(u),f=!isNaN(h)&&h>0&&h<=24&&h!==e&&d.trim().length>0;isNaN(h)?t({newHours:e,justification:d},!1):t({newHours:h,justification:d},f)}const l=parseFloat(n),c=n!==""&&!isNaN(l)&&l===e?"New duration must differ from the current hours.":null;return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Current:"}),a.jsxs("span",{className:"font-semibold text-base",children:[e,"h"]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"new-hours",className:"text-sm font-medium",children:"Corrected hours"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{id:"new-hours",type:"number",min:.25,max:24,step:.25,value:n,onChange:u=>{r(u.target.value),o(u.target.value,s)},className:"w-24 h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",autoFocus:!0}),a.jsx("input",{type:"range",min:.25,max:24,step:.25,value:isNaN(l)?e:l,onCh
627ange:u=>{r(u.target.value),o(u.target.value,s)},className:"flex-1 accent-primary","aria-label":"Duration slider"})]}),c&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(at,{htmlFor:"duration-justification",className:"text-sm font-medium",children:["Justification ",a.jsx("span",{className:"text-muted-foreground font-normal",children:"(required)"})]}),a.jsx(Us,{id:"duration-justification",value:s,onChange:u=>{i(u.target.value),o(n,u.target.value)},placeholder:"Explain why the duration is being adjusted (e.g. original entry included travel time)...",className:"text-sm min-h-[72px] resize-none"})]})]})}function Jce({currentActivityType:e,currentActivityTypeLabel:t,onChange:n}){const[r,s]=m.useState(""),[i,o]=m.useState(""),l=Yce.filter(u=>u.slug!==e);function c(u,d){const h=u.length>0&&u!==e&&d.trim().length>0;n({newActivityType:u,justification:d},h)}return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Current:"}),a.jsx("span",{className:"font-medium",children:t})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"new-activity-type",className:"text-sm font-medium",children:"New activity type"}),a.jsxs(ko,{value:r,onValueChange:u=>{s(u),c(u,i)},children:[a.jsx(ki,{id:"new-activity-type",className:"text-sm h-9",children:a.jsx(So,{placeholder:"Select a new activity type..."})}),a.jsx(Si,{children:l.map(u=>a.jsx(Cn,{value:u.slug,className:"text-sm",children:u.label},u.slug))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(at,{htmlFor:"reclassify-justification",className:"text-sm font-medium",children:["Justification ",a.jsx("span",{className:"text-muted-foreground font-normal",children:"(required)"})]}),a.jsx(Us,{id:"reclassify-justification",value:i,onChange:u=>{o(u.target.value),c(r,u.target.value)},placeholder:"Explain why this activity was misclassified and what it actually represents...",className:"text-sm min-h-[72px] resize-none"})]})]})}function eue({entryId:e,onChange:t}){const[n,r]=m.useState([]),[s,i]=m.useState(""),o=m.useRef(null);function l(h,f){t({evidenceFileIds:[],note:f,uploadedFiles:h},h.length>0)}function c(h){const f=Array.from(h.target.files??[]);if(f.length>0){const p=[...n,...f];r(p),l(p,s)}o.current&&(o.current.value="")}function u(h){const f=n.filter((p,g)=>g!==h);r(f),l(f,s)}function d(h){i(h),l(n,h)}return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(at,{className:"text-xs font-medium text-muted-foreground",children:"Upload evidence files"}),a.jsx("input",{ref:o,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.eml",className:"hidden",onChange:c}),a.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"w-full mt-1.5",onClick:()=>{var h;return(h=o.current)==null?void 0:h.click()},children:[a.jsx(fd,{className:"h-4 w-4 mr-2"}),"Choose Files"]}),n.length>0&&a.jsx("div",{className:"space-y-1 mt-2 border rounded-md p-2",children:n.map((h,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-xs p-1",children:[a.jsx(iH,{className:"h-3 w-3 text-muted-foreground shrink-0"}),a.jsx("span",{className:"truncate flex-1",children:h.name}),a.jsx("button",{type:"button",className:"text-muted-foreground hover:text-destructive text-xs",onClick:()=>u(f),children:"Remove"})]},f))})]}),a.jsxs("div",{children:[a.jsx(at,{className:"text-xs font-medium text-muted-foreground",children:"Note (optional)"}),a.jsx(Us,{placeholder:"Describe how this evidence supports the activity...",value:s,onChange:h=>d(h.target.value),rows:2,className:"mt-1 text-sm"})]})]})}const tue={logTime:{heading:"Time Entry Logged",summary:"Your time entry has been recorded."},addProperty:{heading:"Property Added",summary:"The new property has been added to your account."},taxProfile:{heading:"Tax Profile Updated",summary:"Your tax profile has been saved."}};function nue({questionnaireId:e}){const t=tue[e]??{heading:"Form Submitted",summary:"Your information has been recorded."};return a.jsx(ht,{className:"border-green-500/50 shadow-sm mt-1",children:a.jsxs(yt,{className:"p-2.5 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 shrink-0",children:a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:t.heading}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.summary})]})]})})}async function rue(){const e=await fetch("/api/activity-types");if(!e.ok)throw new Error("Failed to fetch custom activity types");return e.json()}function sue(){const e=Lt(),{data:t=[],isLoading:n,refetch:r}=tt({queryKey:["custom-activity-types"],queryFn:rue,staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0});async function s(i){const o=i.trim().toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-");if(!(await fetch("/api/activity-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({activityType:o})})).ok)throw new Error("Failed to create custom activity type");
627return await e.invalidateQueries({queryKey:["custom-activity-types"],refetchType:"all"}),o}return{customTypes:t,isLoading:n,refetch:r,createCustomType:s}}const Hv={zero:0,a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,half:.5,quarter:.25};function iue(e){let t=e.toLowerCase().trim();return t=t.replace(/\bhalf\s+(?:an?\s+)?hour\b/g,"0.5 hours"),t=t.replace(/\bquarter\s+(?:of\s+an?\s+)?hour\b/g,"0.25 hours"),t=t.replace(/\b(twenty|thirty|forty|fifty|sixty)\s+(one|two|three|four|five|six|seven|eight|nine)\b/g,(n,r,s)=>{const i=Hv[r]??0,o=Hv[s]??0;return String(i+o)}),t=t.replace(/\b(zero|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|half|quarter)\b/g,n=>{const r=Hv[n];return r!==void 0?String(r):n}),t}function dl(e){return isNaN(e)||e<.0167||e>24?null:e}function YC(e){return e.match(/^\s*\.?(\d+\.?\d*|\.\d+)\s*$/)?dl(parseFloat(e.trim())):null}function QC(e){const t=/^\s*(\d*\.\d+)\s*h(?:r|rs|our|ours)?\s*$/i,n=e.match(t);if(n)return dl(parseFloat(n[1]));const r=/^\s*(\d+(?:\.\d+)?)\s*h(?:r|rs|our|ours)?\s*(?:and\s+)?(\d+(?:\.\d+)?)?\s*m(?:in|ins|inute|inutes)?\s*$/i,s=e.match(r);if(s){const h=parseFloat(s[1]),f=s[2]!==void 0?parseFloat(s[2]):0;return dl(h+f/60)}const i=/^\s*(\d+(?:\.\d+)?)\s*h(?:r|rs|our|ours)?\s*$/i,o=e.match(i);if(o)return dl(parseFloat(o[1]));const l=/^\s*(\d+(?:\.\d+)?)\s*m(?:in|ins|inute|inutes)?\s*$/i,c=e.match(l);if(c)return dl(parseFloat(c[1])/60);const u=/^\s*(\d+(?:\.\d+)?)\s*h(?:r|rs|our|ours)?\s+(\d+(?:\.\d+)?)\s*$/i,d=e.match(u);if(d){const h=parseFloat(d[1]),f=parseFloat(d[2]);return dl(h+f/60)}return null}function b0(e){if(!e||e.trim()==="")return null;const t=e.trim(),n=YC(t);if(n!==null)return n;const r=QC(t);if(r!==null)return r;const s=iue(t);if(s!==t){const i=YC(s);if(i!==null)return i;const o=QC(s);if(o!==null)return o}return null}const su=[{key:"basic",label:"Basic Info",icon:Cb},{key:"activity",label:"Activity",icon:hH},{key:"property",label:"Property",icon:jo},{key:"details",label:"Details",icon:Nr}];function oue(e,t){if(e==="basic"){const r=b0(t.hours.trim())!==null;return t.date.trim()!==""&&r}return e==="activity"?t.activityType!=="":e==="property"?!0:e==="details"?t.description.trim()!=="":!0}function aue(e){return e.trim().toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-")}function ZC({label:e,options:t,selectedId:n,onSelect:r,isLoading:s=!1,placeholder:i="Search…",allowCustomCreate:o=!1,onCreateCustom:l,isCreating:c=!1}){const[u,d]=m.useState(""),h=u.trim()?t.filter(g=>{var v;return g.label.toLowerCase().includes(u.toLowerCase())||(((v=g.description)==null?void 0:v.toLowerCase().includes(u.toLowerCase()))??!1)}):t,f=t.some(g=>g.label.toLowerCase()===u.toLowerCase()||g.id.toLowerCase()===u.toLowerCase()),p=o&&u.trim()&&!f&&l;return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{className:"text-xs font-medium text-foreground/80",children:e}),s?a.jsxs("div",{className:"flex items-center gap-2 h-9 text-xs text-muted-foreground",children:[a.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}),"Loading…"]}):a.jsxs("div",{className:"space-y-1.5",children:[t.length>6&&a.jsx(Ct,{value:u,onChange:g=>d(g.target.value),placeholder:i,className:"h-8 text-xs"}),a.jsxs("div",{className:"max-h-44 overflow-y-auto space-y-0.5 rounded-md border border-border/50 p-1",children:[h.length===0&&!p&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:"No matches"}),h.map(g=>a.jsxs("button",{type:"button",onClick:()=>r(g.id),className:q("w-full text-left px-2.5 py-1.5 rounded text-xs transition-colors",n===g.id?"bg-primary/10 text-primary font-medium":"hover:bg-muted/60 text-foreground"),children:[a.jsx("span",{className:"block font-medium leading-snug",children:g.label}),g.description&&a.jsx("span",{className:"text-muted-foreground text-[10px] leading-snug",children:g.description})]},g.id)),p&&a.jsx("button",{type:"button",onClick:()=>
627l(u.trim()),disabled:c,className:q("w-full text-left px-2.5 py-1.5 rounded text-xs transition-colors flex items-center gap-1.5",c?"text-muted-foreground cursor-not-allowed":"text-primary hover:bg-primary/10 font-medium"),children:c?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-3 w-3 animate-spin shrink-0"}),"Creating…"]}):a.jsxs(a.Fragment,{children:['+ Create "',u.trim(),'"']})})]})]})]})}function a4({toolCallId:e,onSubmit:t,defaultDate:n,defaults:r}){const s=new Date().toISOString().split("T")[0],{getCardState:i,setCardState:o}=Do(),{toast:l}=sn(),{customTypes:c,isLoading:u,createCustomType:d}=sue(),h=m.useRef(null),f={date:(r==null?void 0:r.date)??n??s,hours:(r==null?void 0:r.hours)!==void 0?String(r.hours):"",activityType:(r==null?void 0:r.activityType)??"",propertyId:(r==null?void 0:r.propertyId)!==void 0?String(r.propertyId):"",description:(r==null?void 0:r.description)??""},p=i(e),g=(p==null?void 0:p.currentStep)??0,v=(p==null?void 0:p.formStatus)??"idle",y=(p==null?void 0:p.submittedValues)??null,x=(p==null?void 0:p.values)??f;function b(D){const C=i(e);o(e,{currentStep:(C==null?void 0:C.currentStep)??0,formStatus:(C==null?void 0:C.formStatus)??"idle",submittedValues:(C==null?void 0:C.submittedValues)??null,values:(C==null?void 0:C.values)??f,...D})}const{data:w=[],isLoading:S}=tt({queryKey:["/api/properties"],staleTime:5*60*1e3}),_=m.useMemo(()=>new Set(fo.map(D=>D.value)),[]),R=[...c.filter(D=>!_.has(D.activityType)).map(D=>({id:D.activityType,label:D.activityType.split("-").map(C=>C.charAt(0).toUpperCase()+C.slice(1)).join(" "),description:"Custom"})),...fo.map(D=>({id:D.value,label:D.label,description:D.duration}))],A=w.map(D=>({id:String(D.id),label:D.nickname??D.address??`Property ${D.id}`,description:[D.address,D.city,D.state].filter(Boolean).join(", ")})),N=su[g].key,k=oue(N,x),T=g===su.length-1,I=su[g].icon,F=m.useCallback((D,C)=>{const H=i(e),V=(H==null?void 0:H.values)??f;b({values:{...V,[D]:C}})},[e]);m.useEffect(()=>{var O;const D=(O=r==null?void 0:r.customActivityLabel)==null?void 0:O.trim();if(!D||x.activityType||u)return;const C=aue(D);if(!C||h.current===C)return;const H=fo.find(G=>G.value===C||G.label.toLowerCase()===D.toLowerCase());if(H){F("activityType",H.value);return}const V=c.find(G=>G.activityType===C||G.activityType.toLowerCase()===D.toLowerCase());if(V){F("activityType",V.activityType);return}h.current=C,d(D).then(G=>{F("activityType",G)}).catch(G=>{console.error("Failed to create evidence custom activity type:",G),F("activityType",C)})},[d,c,r==null?void 0:r.customActivityLabel,F,u,x.activityType]);const[L,M]=m.useState(!1),$=async D=>{M(!0);try{const C=await d(D);F("activityType",C)}catch{l({title:"Failed to create activity type",description:"Please try again.",variant:"destructive"})}finally{M(!1)}};async function j(){if(k)if(T){b({formStatus:"submitting"});const D=b0(x.hours.trim())??0,C={date:x.date,hours:D,activityType:x.activityType,description:x.description.trim()};x.propertyId&&(C.propertyId=x.propertyId),t(eg({questionnaireId:"logTime",answers:C})),b({submittedValues:x,formStatus:"submitted"})}else b({currentStep:g+1})}function P(){g>0&&b({currentStep:g-1})}return v==="submitted"||y?a.jsx(ht,{className:"border-green-500/50 shadow-sm",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"font-medium",children:"Time entry logged"})]})}):a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-4",children:[a.jsx(Ha,{icon:I,title:"Log Time Entry",step:{currentIndex:g,totalSteps:su.length,currentLabel:su[g].label}}),N==="basic"&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"lt-date",className:"text-xs font-medium text-foreground/80",children:"Date"}),a.jsx(Ct,{id:"lt-date",type:"date",value:x.date,onChange:D=>F("date",D.target.value),className:"h-9 text-sm"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"lt-hours",className:"text-xs font-medium text-foreground
627/80",children:"Hours"}),a.jsx(Ct,{id:"lt-hours",type:"text",value:x.hours,onChange:D=>F("hours",D.target.value),placeholder:"e.g. 2h30m or 45 min",className:"h-9 text-sm"}),x.hours.trim()!==""&&b0(x.hours.trim())===null&&a.jsx("p",{className:"text-xs text-destructive mt-1",children:'Unrecognised format — try "2h 30m", "45 min", or "1.5"'})]})]}),N==="activity"&&a.jsx(ZC,{label:"Activity Type",options:R,selectedId:x.activityType,onSelect:D=>F("activityType",D),isLoading:u,placeholder:"Search activity types…",allowCustomCreate:!0,onCreateCustom:$,isCreating:L}),N==="property"&&a.jsxs(a.Fragment,{children:[S||w.length>0?a.jsx(ZC,{label:"Property (optional)",options:A,selectedId:x.propertyId,onSelect:D=>F("propertyId",D),isLoading:S,placeholder:"Search properties…"}):a.jsx("p",{className:"text-xs text-muted-foreground italic py-2",children:"No properties found. Skip this step if not applicable."}),a.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>{F("propertyId",""),b({currentStep:g+1})},className:"text-xs",children:"Skip — no property"})]}),N==="details"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"lt-desc",className:"text-xs font-medium text-foreground/80",children:"Description"}),a.jsx(Ct,{id:"lt-desc",type:"text",value:x.description,onChange:D=>F("description",D.target.value),placeholder:"e.g. Coordinated HVAC repair with contractor",className:"h-9 text-sm"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[a.jsxs(ie,{variant:"ghost",size:"sm",onClick:P,disabled:g===0,className:"h-8 px-2 text-xs",children:[a.jsx(To,{className:"h-3.5 w-3.5 mr-0.5"}),"Back"]}),a.jsx(ie,{size:"sm",onClick:j,disabled:!k||v==="submitting",className:"h-8 px-3 text-xs",children:v==="submitting"?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Saving…"]}):T?a.jsxs(a.Fragment,{children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1.5"}),"Submit"]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Ar,{className:"h-3.5 w-3.5 ml-0.5"})]})})]})]})})}const lue=[{id:"smart",title:"Smart Assistant",description:"Upload evidence (optional) and our scanner will pre-fill the date, activity, and description for you.",icon:oR},{id:"manual",title:"Manual Entry",description:"Type the details yourself. AI Enhance stays available for your description, and you can attach evidence files — nothing is auto-filled from them.",icon:fH}];function cue({onSelect:e}){return a.jsxs("div",{className:"space-y-3","data-testid":"log-entry-mode-chooser",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-semibold",children:"Log Time Entry"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose how you want to log this activity."})]}),lue.map(t=>{const n=t.icon;return a.jsx("button",{type:"button",onClick:()=>e(t.id),"data-mode":t.id,className:q("group w-full text-left rounded-lg border border-border/70 bg-card p-3 transition-colors","hover:border-primary/50 hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:a.jsxs("span",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-muted text-muted-foreground transition-colors group-hover:text-primary",children:a.jsx(n,{className:"h-4 w-4"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-medium",children:t.title}),a.jsx("span",{className:"mt-0.5 block text-xs leading-snug text-muted-foreground",children:t.description})]})]})},t.id)})]})}function uue({onClick:e}){return a.jsxs("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[a.jsx(Eb,{className:"h-3.5 w-3.5"}),"Entry methods"]})}const Wv=[{key:"logger",label:"Quick",subtitle:"For simple logging and basic questions",icon:om,requiresPremium:!1,iconChipClass:"bg-[#E8F5E9] text-[#43A047]",iconFilled:!0}
627,{key:"advisor",label:"Advisor",subtitle:"For tax-aware guidance and cited answers",icon:Ab,requiresPremium:!0,iconChipClass:"bg-[#FDF3D8] text-[#B45309]"},{key:"compliance",label:"Compliance",subtitle:"For compliance and defensibility",icon:im,requiresPremium:!0,iconChipClass:"bg-[#FDF3D8] text-[#B45309]"}];function l4({mode:e,isPremium:t,isSwitching:n,isStreaming:r,onModeChange:s,onUpgradeClick:i,onPreviewMode:o}){const[l,c]=m.useState(!1),u=r||n,d=Wv.find(f=>f.key===e)??Wv[0];function h(f){if(f.requiresPremium&&!t){c(!1),o?o(f.key):i();return}e!==f.key&&s(f.key),c(!1)}return a.jsxs(SL,{open:l,onOpenChange:f=>!u&&c(f),children:[a.jsx(EL,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:u,"aria-label":`Current mode: ${d.label}. Click to change.`,"data-tour":"chat-mode-selector",className:q("inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-medium","bg-muted/60 hover:bg-muted border border-border/60","transition-colors duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u&&"opacity-50 pointer-events-none"),children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsx("span",{className:q("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",d.iconChipClass),children:a.jsx(d.icon,{className:"h-3.5 w-3.5",...d.iconFilled?{fill:"currentColor"}:{}})}),d.label]}),a.jsx(Ma,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),a.jsxs(v_,{align:"end",sideOffset:8,className:"w-72 p-1 overflow-hidden",children:[!t&&a.jsxs("button",{type:"button",onClick:()=>{c(!1),i()},className:"w-full flex items-center justify-between gap-2 px-3 py-1.5 mb-1 rounded-md text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 transition-colors",children:[a.jsx("span",{children:"Unlock Pro modes"}),a.jsx(ts,{className:"h-3 w-3 shrink-0"})]}),Wv.map(f=>{const p=e===f.key,g=f.requiresPremium&&!t,v=f.icon;return a.jsxs("button",{type:"button",onClick:()=>h(f),className:q("w-full flex items-center gap-2 px-3 py-2 rounded-md text-left","hover:bg-muted/70 transition-colors duration-100","focus-visible:outline-none focus-visible:bg-muted/70",p&&"bg-muted/50"),children:[a.jsx("span",{className:q("flex h-7 w-7 shrink-0 items-center justify-center rounded-full",f.iconChipClass),children:a.jsx(v,{className:"h-4 w-4",...f.iconFilled?{fill:"currentColor"}:{}})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:q("block text-sm leading-none",p?"text-foreground":"text-foreground/75"),children:f.label}),a.jsx("span",{className:"block text-[10px] leading-tight text-muted-foreground mt-0.5",children:f.subtitle})]}),p?a.jsx(bt,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):g?a.jsx(jb,{className:"h-3 w-3 shrink-0 text-muted-foreground/50"}):null]},f.key)})]})]})}const due=10*1024*1024,XC=10,hue="[EVIDENCE_SCAN_CONTEXT]";function fue(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function c4(e,t){const n=e.mappedFields,r=[n.date.value?`date: ${n.date.value} (${Math.round(n.date.confidence*100)}% confidence)`:null,n.activityType.value?`activity type: ${n.activityType.value} (${Math.round(n.activityType.confidence*100)}% confidence)`:null,n.customActivityLabel.value?`custom activity label: ${n.customActivityLabel.value} (${Math.round(n.customActivityLabel.confidence*100)}% confidence)`:null,n.description.value?`description: ${n.description.value} (${Math.round(n.description.confidence*100)}% confidence)`:null].filter(Boolean),s=n.unmappedFields.map(i=>`${i.label}: ${i.value}`).join("; ");return[t||"Evidence attached for a time entry.",hue,"Gemini scanned the upload for time-entry details.",r.length>0?`Suggested fields: ${r.join("; ")}.`:null,s?`Other details found, but leave these for manual review if there is no matching field: ${s}.`:null,"Continue to the time log entry flow. Use confident scan results where helpful. If there is a custom activity label, pass it as customActivityLabel so the form can create and select it. Ask me to fill any missing required fields such as hours or property."].filter(
627Boolean).join(`
628`)}function pue({onSubmit:e,isLoading:t,onStop:n,placeholder:r="How can I help you today?",showFileUpload:s=!0,mode:i,isPremium:o,isSwitching:l,onModeToggle:c,onUpgradeClick:u,onPreviewMode:d,onFilesChange:h,onEvidenceScanChange:f,autoSubmitEvidenceUploads:p=!1,variant:g="default"}){const[v,y]=m.useState(""),[x,b]=m.useState([]),[w,S]=m.useState(null),_=m.useRef(null),E=m.useRef(null),R=m.useRef(0),A=m.useCallback(()=>{const j=_.current;j&&(j.style.height="auto",j.style.height=`${Math.min(j.scrollHeight,64)}px`)},[]);m.useEffect(()=>{A()},[v,A]),m.useEffect(()=>{A()},[A]);function N(){R.current+=1,y(""),b([]),h==null||h(!1),f==null||f("idle"),S(null),requestAnimationFrame(()=>{var j;_.current&&(_.current.style.height="auto"),(j=_.current)==null||j.focus()})}async function k(j,P){const D=R.current+1;R.current=D,f==null||f("scanning");try{const C=await s1(j);if(D!==R.current)return;f==null||f("complete"),p&&(e(c4(C,P),j),N())}catch(C){if(console.error("Chat evidence scan failed:",C),D!==R.current)return;f==null||f("failed"),p&&(e(P||"Create a time log entry from the attached evidence. If the scan missed anything, ask me to fill it in.",j),N())}}function T(j){if(!j)return;S(null);const P=Array.from(j),D=P.find(H=>H.size>due);if(D){S(`${D.name} exceeds 10MB limit`);return}const C=[...x,...P];if(C.length>XC){S(`Maximum ${XC} files allowed`);return}b(C),h==null||h(C.length>0),p&&k(C,v.trim()),E.current&&(E.current.value="")}function I(j){const P=x.filter((D,C)=>C!==j);b(P),h==null||h(P.length>0),P.length===0&&(R.current+=1,f==null||f("idle")),S(null)}function F(j){j==null||j.preventDefault();const P=v.trim();!P&&x.length===0||t||(e(P||"Attached files",x.length>0?x:void 0),N())}function L(j){j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),F())}const M=j=>j.type.startsWith("image/"),$=v.trim().length>0||x.length>0;return a.jsxs("div",{className:"pt-0 space-y-0 shrink-0",children:[w&&a.jsx("p",{className:"text-xs text-destructive",children:w}),a.jsxs("form",{onSubmit:F,children:[s&&a.jsx("input",{ref:E,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.csv,.txt",className:"hidden",onChange:j=>T(j.target.files)}),a.jsxs("div",{className:q("transition-colors duration-200 focus-within:border-ring","rounded-[26px] border border-[#D8DFDA] bg-white px-[7px] py-[7px] shadow-[0_10px_28px_-12px_rgba(16,24,40,0.20)] dark:border-border/70 dark:bg-background"),children:[x.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 pt-1 pb-1.5",children:x.map((j,P)=>a.jsxs("div",{className:"flex items-center gap-1.5 bg-background rounded-md px-2 py-1 text-xs max-w-[180px] border",children:[M(j)?a.jsx(lH,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):a.jsx(Nr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:j.name}),a.jsx("span",{className:"text-muted-foreground shrink-0",children:fue(j.size)}),a.jsx("button",{type:"button",onClick:()=>I(P),className:"shrink-0 text-muted-foreground hover:text-destructive transition-colors",children:a.jsx(vn,{className:"h-3 w-3"})})]},`${j.name}-${P}`))}),a.jsxs("div",{className:"flex items-end gap-1",children:[s&&a.jsx("button",{type:"button",className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-full bg-muted/70 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",onClick:()=>{var j;return(j=E.current)==null?void 0:j.click()},disabled:t,title:"Attach files","aria-label":"Attach files",children:a.jsx(nc,{className:"h-5 w-5"})}),a.jsx(Us,{ref:_,value:v,onChange:j=>y(j.target.value),onKeyDown:L,placeholder:r,disabled:t,rows:1,style:{height:"36px"},className:"flex-1 min-w-0 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent !min-h-0 px-1.5 pt-2 pb-1 !resize-none text-base"}),g!=="sheet"&&a.jsx("div",{className:"flex h-[38px] shrink-0 items-center pl-1",children:a.jsx(l4,{mode:i,isPremium:o,isSwitching:l,isStreaming:t,onModeChange:c,onUpgradeClick:u,onPreviewMode:d})}),a.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center",children:t&&n?a.jsx("button",{type:"button","aria-label":"Stop generating",onClick:n,className:"flex h-[38px] w-[38px] items-center justify-center rounded-full bg-foreground text-background transition-colors hover:bg-foreground
628/90",children:a.jsx(xx,{className:"h-3.5 w-3.5 fill-current"})}):a.jsx("button",{type:"submit","aria-label":"Send message",disabled:t||!$,className:q("flex h-[38px] w-[38px] items-center justify-center rounded-full transition-colors",$?"bg-[linear-gradient(135deg,#44958C_0%,#43A047_100%)] text-white shadow-sm":"bg-muted text-muted-foreground/50"),children:a.jsx(U9,{className:"h-5 w-5"})})})]})]})]})]})}const mue=e=>`${e}:logTimeMode`;function gue({toolCallId:e,defaults:t,onSubmit:n}){const{getCardState:r,setCardState:s}=Do(),{toast:i}=sn(),o=mue(e),l=r(o)??{mode:"chooser"},c=l.mode,u=l.scanStatus??"idle",d=f=>{const p=r(o)??{mode:"chooser"};s(o,{...p,...f})},h={toolCallId:e,onSubmit:f=>n(f),defaults:t};return c==="manual"?a.jsx(a4,{...h}):c==="smart"?a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"font-semibold text-sm",children:"Smart Assistant"}),a.jsx(uue,{onClick:()=>d({mode:"chooser",scanStatus:"idle"})})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload evidence (optional) and our scanner will pre-fill the date, activity, and description for you to review."}),a.jsx($re,{onFilesSelected:async f=>{if(f.length!==0){d({scanStatus:"scanning"});try{const p=await s1(f);d({scanStatus:"complete"}),n(c4(p,""),f)}catch(p){console.error("Chat log-time evidence scan failed:",p),d({scanStatus:"failed"}),i({title:"Evidence scan failed",description:"We couldn't scan this evidence. You can still log the entry manually.",variant:"destructive"})}}},maxFiles:5,acceptedFileTypes:{"image/*":[".png",".jpg",".jpeg"],"application/pdf":[".pdf"]}}),u==="scanning"&&a.jsx(Vp,{title:"Extracting evidence details",label:"Time entry evidence",description:"Reading your upload to suggest a date, activity type, and description."}),u==="complete"&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600",children:[a.jsx(Nb,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:"Evidence scanned — opening your pre-filled form to review."})]}),u==="failed"&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600",children:[a.jsx(bi,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:"We couldn't scan this evidence. You can still log the entry manually."})]}),u!=="scanning"&&a.jsx(ie,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>d({mode:"manual"}),children:"Skip evidence — type the details manually"})]})}):a.jsx(cue,{onSelect:f=>d({mode:f,scanStatus:"idle"})})}function vue(e){return e?!["hours","activityType","customActivityLabel","description","propertyId"].some(n=>{const r=e[n];return r!=null&&r!==""}):!0}const i1={alabama:"AL",alaska:"AK",arizona:"AZ",arkansas:"AR",california:"CA",colorado:"CO",connecticut:"CT",delaware:"DE",florida:"FL",georgia:"GA",hawaii:"HI",idaho:"ID",illinois:"IL",indiana:"IN",iowa:"IA",kansas:"KS",kentucky:"KY",louisiana:"LA",maine:"ME",maryland:"MD",massachusetts:"MA",michigan:"MI",minnesota:"MN",mississippi:"MS",missouri:"MO",montana:"MT",nebraska:"NE",nevada:"NV","new hampshire":"NH","new jersey":"NJ","new mexico":"NM","new york":"NY","north carolina":"NC","north dakota":"ND",ohio:"OH",oklahoma:"OK",oregon:"OR",pennsylvania:"PA","rhode island":"RI","south carolina":"SC","south dakota":"SD",tennessee:"TN",texas:"TX",utah:"UT",vermont:"VT",virginia:"VA",washington:"WA","west virginia":"WV",wisconsin:"WI",wyoming:"WY","district of columbia":"DC"},yue=Object.fromEntries(Object.entries(i1).map(([e,t])=>[t,e])),xue=new Set(["aly","alley","ave","avenue","blvd","boulevard","cir","circle","ct","court","cv","cove","dr","drive","hwy","highway","ln","lane","loop","pkwy","parkway","pl","place","rd","road","st","street","ter","terrace","trl","trail","way"]),Gi=e=>(e==null?void 0:e.replace(/\s+/g," ").trim())??"",bue=(e,t)=>{const n=Gi(e).toUpperCase();if(/^[A-Z]{2}$/.test(n))return n;const r=Gi(t).toLowerCase();return i1[r]??""},JC=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wue=(e,t)=>
628{const n=yue[t],r=[t,n].filter(Boolean).map(JC),s=r.length?r.join("|"):Object.entries(i1).flatMap(([o,l])=>[o,l]).map(JC).join("|");return Array.from(e.matchAll(new RegExp(`\\b(${s})\\b(?=\\s+\\d{5}(?:-\\d{4})?\\b|\\s*$)`,"gi"))).at(-1)},_ue=e=>e.split(" ").map(t=>/^[A-Z]{2}$/.test(t)?t:t===t.toLowerCase()||t===t.toUpperCase()?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():t).join(" "),kue=(e,t)=>{const n=Gi(e.replace(/,/g," "));if(!n)return"";const r=wue(n,t);if(!r||r.index===void 0)return"";const i=n.slice(0,r.index).trim().split(/\s+/).filter(Boolean),o=i.map(l=>l.replace(/\./g,"").toLowerCase()).findLastIndex(l=>xue.has(l));return o<0||o>=i.length-1?"":_ue(i.slice(o+1).join(" "))},Sue=(e,t)=>{const n=e.properties,r=bue(n.state_code,n.state);return{address:Gi(n.address_line1)||Gi([n.housenumber,n.street].filter(Boolean).join(" "))||Gi(n.formatted),city:Gi(n.city)||kue(t,r),state:r,zipCode:Gi(n.postcode)}};function Eue({value:e,onChange:t,onSelect:n,required:r=!1}){const[s,i]=m.useState([]),[o,l]=m.useState(!1),c=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{const p=g=>{u.current&&!u.current.contains(g.target)&&l(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const d=async p=>{const g=window.__GEOAPIFY_KEY__??"068184098df04e2e8460f461097031d0"??"";if(!g||p.length<5){i([]);return}try{const v=`https://api.geoapify.com/v1/geocode/autocomplete?text=${encodeURIComponent(p)}&filter=countrycode:us&format=geojson&limit=6&apiKey=${g}`,y=await fetch(v);if(!y.ok)return;const x=await y.json();i(x.features??[])}catch{i([])}},h=p=>{const g=p.target.value;t(g),l(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{d(g)},280)},f=p=>{const g=Sue(p,e);t(g.address),i([]),l(!1),n(g)};return a.jsxs("div",{ref:u,className:"relative",children:[a.jsx(at,{htmlFor:"address",children:"Address *"}),a.jsx(Ct,{id:"address",value:e,onChange:h,onFocus:()=>s.length>0&&l(!0),placeholder:"123 Main Street, Springfield, IL",required:r,autoComplete:"off"}),o&&s.length>0&&a.jsx("ul",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg max-h-56 overflow-y-auto",children:s.map((p,g)=>a.jsx("li",{className:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100",onMouseDown:()=>f(p),children:p.properties.formatted},g))})]})}const Nue=["Long-term Rental","Short-term Rental"],iu=[{key:"basic",label:"Basic Info",icon:jo},{key:"type",label:"Property Type",icon:Bd}];function Cue(e,t){return e==="basic"?t.nickname.trim()!==""&&t.address.trim()!=="":!0}function jue({onSubmit:e}){const[t,n]=m.useState(0),[r,s]=m.useState("idle"),[i,o]=m.useState(null),[l,c]=m.useState({nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"}),u=iu[t].key,d=Cue(u,l),h=t===iu.length-1,f=iu[t].icon,p=m.useCallback((x,b)=>{c(w=>({...w,[x]:b}))},[]),g=m.useCallback(x=>{c(b=>({...b,address:x.address,city:x.city,state:x.state,zipCode:x.zipCode}))},[]);function v(){if(d)if(h){s("submitted");const x={nickname:l.nickname.trim(),address:l.address.trim(),city:l.city.trim(),state:l.state.trim().toUpperCase(),zipCode:l.zipCode.trim(),propertyType:l.propertyType};e(eg({questionnaireId:"addProperty",answers:x})),o(l)}else n(x=>x+1)}function y(){t>0&&n(x=>x-1)}return r==="submitted"||i?a.jsx(ht,{className:"border-green-500/50 shadow-sm",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"font-medium",children:"Property added"})]})}):a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-4",children:[a.jsx(Ha,{icon:f,title:"Add a New Property",step:{currentIndex:t,totalSteps:iu.length,currentLabel:iu[t].label}}),u==="basic"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:"ap-nickname",className:"text-xs font-medium text-foreground/80",children:"Property Nickname"}),a.jsx(Ct,{id:"ap-nickname",type:"text",value:l.nickname,onChange:x=>p("nickname",x.target.value),placeholder:"e.g. Beach House",className:"h-9 text-sm"})]}),a.jsx(Eue,{value:l.address,onChange:x=>p("address",x),onSelect:g,required:!0}),(l.city||l.state||l.zipCode)&&a.jsx("p",{className:"text-xs text-muted-foreground -mt-1",children:[l.city,l.state,l.zipCode].filter(
628Boolean).join(", ")})]}),u==="type"&&a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{className:"text-xs font-medium text-foreground/80",children:"Property Type"}),a.jsx("div",{className:"flex gap-2",children:Nue.map(x=>a.jsx("button",{type:"button",onClick:()=>p("propertyType",x),className:q("flex-1 text-xs px-3 py-3 rounded border transition-colors text-center font-medium",l.propertyType===x?"bg-primary/10 border-primary/50 text-primary":"border-border text-muted-foreground hover:bg-muted/50"),children:x==="Long-term Rental"?"🏠 Long-term Rental (LTR)":"🏄 Short-term Rental (STR)"},x))})]})}),a.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[a.jsxs(ie,{variant:"ghost",size:"sm",onClick:y,disabled:t===0,className:"h-8 px-2 text-xs",children:[a.jsx(To,{className:"h-3.5 w-3.5 mr-0.5"}),"Back"]}),a.jsx(ie,{size:"sm",onClick:v,disabled:!d,className:"h-8 px-3 text-xs",children:h?a.jsxs(a.Fragment,{children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1.5"}),"Add Property"]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Ar,{className:"h-3.5 w-3.5 ml-0.5"})]})})]})]})})}const ej=["/api/advisor/tax-profile"],Tue=600;function Pue(e=!0){const t=Lt(),n=m.useRef(null),{data:r,isLoading:s,isError:i,refetch:o}=tt({queryKey:ej,queryFn:yae,enabled:e,staleTime:1e3*60*5}),l=gt({mutationFn:d=>J_(d),onSuccess:()=>{t.invalidateQueries({queryKey:ej})}}),c=m.useCallback((d,h)=>{l.mutate({[d]:h})},[l]),u=m.useCallback((d,h)=>{n.current!==null&&clearTimeout(n.current),n.current=setTimeout(()=>{l.mutate({[d]:h}),n.current=null},Tue)},[l]);return{profile:(r==null?void 0:r.profile)??null,completeness:(r==null?void 0:r.completeness)??null,isLoading:s,isError:i,refetch:o,updateField:c,debouncedUpdateField:u,isUpdating:l.isPending}}const Aue=["/api/advisor/tax-profile/suggestions"];function cbe(e=!0){const{data:t,isLoading:n}=tt({queryKey:Aue,queryFn:bae,enabled:e,staleTime:3e5});return{suggestions:t??null,isLoading:n}}const qv=[{key:"filing",label:"Tax Filing"},{key:"employment",label:"Employment & Hours"},{key:"involvement",label:"Real Estate Involvement"},{key:"goals",label:"Goals & History"},{key:"preferences",label:"Advisor Preferences"}],w0=[{key:"taxYearGoal",label:"Tax Year Goal",type:"select",group:"filing",options:[{value:"current_year",label:"Current Year"},{value:"retroactive",label:"Retroactive Claim"},{value:"future_planning",label:"Future Planning"}]},{key:"filingStatus",label:"Filing Status",type:"select",group:"filing",options:[{value:"single",label:"Single"},{value:"mfj",label:"Married Filing Jointly"},{value:"mfs",label:"Married Filing Separately"},{value:"hoh",label:"Head of Household"}]},{key:"agiRange",label:"Adjusted Gross Income Range",type:"select",group:"filing",options:[{value:"under_100k",label:"Under $100K"},{value:"100k_150k",label:"$100K – $150K"},{value:"150k_250k",label:"$150K – $250K"},{value:"over_250k",label:"Over $250K"}]},{key:"employmentType",label:"Employment Type",type:"select",group:"employment",options:[{value:"w2",label:"W-2 Employee"},{value:"self_employed",label:"Self-Employed"},{value:"business_owner",label:"Business Owner"},{value:"retired",label:"Retired"},{value:"full_time_re",label:"Full-Time Real Estate"}]},{key:"w2HoursPerWeek",label:"W-2 Hours Per Week",type:"number",group:"employment",min:1,max:168,placeholder:"e.g. 40",condition:{field:"employmentType",values:["w2"]}},{key:"otherWorkHoursPerWeek",label:"Other Work Hours Per Week",type:"number",group:"employment",min:0,placeholder:"e.g. 20",condition:{field:"employmentType",values:["self_employed","business_owner"]}},{key:"spouseEmploymentStatus",label:"Spouse Employment Status",type:"select",group:"employment",options:[{value:"full_time",label:"Full-Time"},{value:"part_time",label:"Part-Time"},{value:"not_employed",label:"Not Employed"},{value:"na",label:"N/A"}],condition:{field:"filingStatus",values:["mfj"]}},{key:"spouseHoursPerWeek",label:"Spouse Work Hours Per Week",type:"number",group:"employment",min:1,max:168,placeholder:"e.g. 40",condition:{field:"spouseEmploymentStatus",values:["full_time","part_time"]}},{key:"involvementStyle",label:"Involvement Style",type:"select",group:"involvement",options:[{value:"self_manage",label:"Self
628-Managed"},{value:"hybrid",label:"Hybrid (Self + PM)"},{value:"pm_runs_most",label:"PM Runs Most Operations"},{value:"mostly_passive",label:"Mostly Passive"}]},{key:"pmHoursEstimate",label:"PM Hours Estimate (Weekly)",type:"number",group:"involvement",min:0,placeholder:"e.g. 10",condition:{field:"involvementStyle",values:["hybrid","pm_runs_most"]}},{key:"netRentalIncomeLoss",label:"Net Rental Income / Loss",type:"select",group:"involvement",options:[{value:"significant_losses",label:"Significant Losses"},{value:"small_losses",label:"Small Losses"},{value:"break_even",label:"Break Even"},{value:"net_income",label:"Net Income"},{value:"varies",label:"Varies by Property"}]},{key:"groupingElectionMade",label:"Grouping Election Made?",type:"boolean",group:"involvement",description:"Whether you have filed a formal election to group multiple rental activities together for REPS purposes."},{key:"passiveLossCarryforward",label:"Passive Loss Carryforward",type:"number",group:"involvement",min:0,placeholder:"e.g. 15000",description:"Suspended passive losses carried forward from prior years, if any."},{key:"primaryGoal",label:"Primary Goal",type:"select",group:"goals",options:[{value:"qualify_this_year",label:"Qualify This Year"},{value:"defend_prior_year",label:"Defend Prior Year"},{value:"optimize_tax_strategy",label:"Optimize Tax Strategy"},{value:"explore_options",label:"Explore Options"}]},{key:"priorityFocus",label:"Priority Focus",type:"select",group:"goals",options:[{value:"qualify",label:"Qualify for REPS"},{value:"document",label:"Document Hours"},{value:"audit_risk",label:"Minimize Audit Risk"}]},{key:"trackingHabit",label:"Time Tracking Habit",type:"select",group:"goals",options:[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"quarterly",label:"Quarterly"},{value:"starting_now",label:"Starting Now"}]},{key:"priorYearRepsQualified",label:"Previously Qualified as REP?",type:"boolean",group:"goals"},{key:"primaryQualifier",label:"Primary REPS Qualifier",type:"select",group:"goals",options:[{value:"self",label:"Self"},{value:"spouse",label:"Spouse"},{value:"both_independently",label:"Both Independently"}],condition:{field:"filingStatus",values:["mfj"]}},{key:"hasActiveCpa",label:"Have an Active CPA?",type:"boolean",group:"preferences"},{key:"allowPushback",label:"Allow AI Pushback",type:"boolean",group:"preferences",description:"When enabled, the AI advisor will proactively flag activities that may not hold up under audit."}];function Iue(e,t){if(!e.condition)return!0;const n=t[e.condition.field];return e.condition.values.includes(n)}function u4(e,t){return w0.filter(n=>n.group===e&&Iue(n,t))}function ube(e,t){const n=u4(e,t);return{answered:n.filter(s=>{const i=t[s.key];return!(i==null||typeof i=="string"&&i.trim()==="")}).length,total:n.length}}const Rue=[Z9,H9,jo,aR,vH];function Mue({field:e,value:t,onChange:n}){var r;return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:e.key,className:"text-xs font-medium text-foreground/80",children:e.label}),a.jsxs(ko,{value:t??"",onValueChange:s=>n(e.key,s),children:[a.jsx(ki,{id:e.key,className:"h-8 text-sm w-full",children:a.jsx(So,{placeholder:"Select…"})}),a.jsx(Si,{children:(r=e.options)==null?void 0:r.map(s=>a.jsx(Cn,{value:s.value,children:s.label},s.value))})]})]})}function Oue({field:e,value:t,onChange:n}){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(at,{htmlFor:e.key,className:"text-xs font-medium text-foreground/80",children:e.label}),a.jsx(Ct,{id:e.key,type:"number",min:e.min,max:e.max,value:t??"",placeholder:e.placeholder??"",onChange:r=>{const s=r.target.value;if(s==="")return;const i=parseInt(s,10);isNaN(i)||n(e.key,i)},className:"h-8 text-sm"})]})}function Due({field:e,value:t,onChange:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-border/50 bg-muted/20 px-3 py-2.5",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(at,{htmlFor:e.key,className:"text-xs font-medium leading-snug cursor-pointer",children:e.label}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.description})]}),a.jsx(_d,{id:e.key,checked:t??!1,onCheckedChange:r=>n(e.key,r),className:"shrink-0 mt-0.5"})]})}const Lue={filing:["taxYearGoal","filingStatus","agiRange"],employment:["employmentType"],involvement:["involvementStyle"],goals:["primaryGoal"],preferences:[]};function Fue(e,t){return(Lue[e]??[]).every(r=>{const s=t[r];return s!=null&&s!==""})}function $ue({onSubmit:e}){const{profile:t,isLoading:n,updateField:r}=Pue(),[s,i]=m.useState(0),[o,l]=m.useState("idle"),[c,u]=m.useState(null),d=m.useRef(!1),[h,f]=m.useState(()=>{const _={};return w0.forEach(E=>{_[E.key]=null}),_});m.useEffect(()=>{if(!t||d.current)return;d.current=!0;const _={};w0.forEach(E=>{_[E.key]=t[E.key]??null}),f(_)},[t]);const p=qv[s],g=u4(p.key,h),v=Fue(p.key,h),y=s===qv.length-1,x=Rue[s],b=m.useCallback((_,E)=>{f(R=>({...R,[_]:E})),r(_,E)},[r]);async function w(){if(v)if(y){l("submitting");const _={};for(const[R,A]of Object.entries(h))A!==null&&(_[R]=A);let E=!1;try{await J_(_)}catch(R){E=!0,console.error("[TaxProfileForm] patchTaxProfile failed:",R)}e(eg({questionnaireId:"taxProfile",answers:_})),u(h),l(E?"save-failed":"submitted")}else i(_=>_+1)}function S(){s>0&&i(_=>_-1)}return o==="submitted"||c?a.jsx(ht,{className:"border-green-500/50 shadow-sm",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"font-medium",children:"Tax profile updated"})]})}):o==="save-failed"?a.jsx(ht,{className:"border-amber-500/50 shadow-sm",children:a.jsxs(yt,{className:"p-3 flex items-center gap-2 text-sm",children:[a.jsx(bt,{className:"h-3.5 w-3.5 text-amber-600 shrink-0"}),a.jsx("span",{className:"font-medium",children:"Profile update submitted — could not save directly."})]})}):n?a.jsx(ht,{className:"shadow-sm",children:a.jsxs(yt,{className:"p-4 flex items-center justify-center gap-2",children:[a.jsx(ct,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading profile…"})]})}):a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-4",children:[a.jsx(Ha,{icon:x,title:"Your Tax Profile",step:{currentIndex:s,totalSteps:qv.length,currentLabel:p.label}}),a.jsxs("div",{className:"space-y-3",children:[g.map(_=>{const E=h[_.key];return _.type==="boolean"?a.jsx(Due,{field:_,value:E,onChange:b},_.key):_.type==="number"?a.jsx(Oue,{field:_,value:E,onChange:b},_.key):a.jsx(Mue,{field:_,value:E,onChange:b},_.key)}),g.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground italic py-2",children:"No fields apply based on your previous answers."})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[a.jsxs(ie,{variant:"ghost",size:"sm",onClick:S,disabled:s===0,className:"h-8 px-2 text-xs",children:[a.jsx(To,{className:"h-3.5 w-3.5 mr-0.5"}),"Back"]}),a.jsx(ie,{size:"sm",onClick:w,disabled:!v||o==="submitting",className:"h-8 px-3 text-xs",children:o==="submitting"?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Saving…"]}):y?a.jsxs(a.Fragment,{children:[a.jsx(bt,{className:"h-3.5 w-3.5 mr-1.5"}),"Save Profile"]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Ar,{className:"h-3.5 w-3.5 ml-0.5"})]})})]})]})})}function Vue({formId:e,onSubmit:t,mode:n="single"}){const[r,s]=m.useState(null),[i,o]=m.useState(new Set),l=e!=null&&e.toLowerCase().includes("rent")?"Show Rental Comps":"Show Cost Seg Estimates",{data:c=[],isLoading:u}=tt({queryKey:["/api/properties"],staleTime:5*60*1e3});function d(v){if(!e||!t)return;const y=String(v.id);s(y),t(x0({formId:e,selectedId:y,selectedLabel:v.nickname??v.address??`Property ${v.id}`}))}function h(v){o(y=>{const x=new Set(y);return x.has(v)?x.delete(v):x.add(v),x})}const f=c.length>0&&i.size===c.length;function p(){o(f?new Set:new Set(c.map(v=>v.id)))}function g(){if(!e||!t||i.size===0)return;const v=[...i],y=c.filter(x=>i.has(x.id)).map(x=>x.nickname??x.address??`Property ${x.id}`).join(", ");t(x0({formId:e,selectedId:JSON.stringify(v),selectedLabel:y}))}return a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-3",children:[a.jsx(Ha,{icon:jo,title:"Your Properties"}),u?a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}),"Loading…"]}):c.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No properties found. Add one to get started."}):a.jsxs(a.Fragment,{children:[n==="multi"&&e&&a.jsxs("button",{type:"button",onClick:p,className:"w-full flex items-center gap-2.5 p-2 rounded-lg text-xs font-medium text-muted-foreground hover:bg-muted/50 transition-colors",children:[f?a.jsx(BS,{className:"h-4 w-4 text-primary shrink-0"}):a.jsx(xx,{className:"h-4 w-4 shrink-0"}),f?"Deselect All":"Select All"]}
628),a.jsx("div",{className:"space-y-1.5",children:c.map(v=>{const y=n==="multi"?i.has(v.id):r===String(v.id);return a.jsx("button",{type:"button",disabled:!e,onClick:()=>{n==="multi"?h(v.id):d(v)},className:q("w-full text-left p-2.5 rounded-lg border text-xs transition-colors",e?"cursor-pointer hover:bg-muted/60":"cursor-default",y?"bg-primary/10 border-primary/40":"border-border/60"),children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[n==="multi"&&e&&a.jsx("span",{className:"mt-0.5 shrink-0",children:y?a.jsx(BS,{className:"h-3.5 w-3.5 text-primary"}):a.jsx(xx,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground leading-snug",children:v.nickname??"Unnamed Property"}),v.address&&a.jsxs("p",{className:"text-muted-foreground flex items-center gap-1 mt-0.5",children:[a.jsx(rm,{className:"h-3 w-3 shrink-0"}),[v.address,v.city,v.state].filter(Boolean).join(", ")]})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5",children:v.propertyType==="Short-term Rental"?"STR":"LTR"}),n==="single"&&y&&a.jsx(bt,{className:"h-3.5 w-3.5 text-primary"})]})]})},v.id)})}),n==="multi"&&e&&a.jsxs(ie,{size:"sm",className:"w-full mt-1",disabled:i.size===0,onClick:g,children:[l,i.size>0&&a.jsx("span",{className:"ml-1.5 bg-primary-foreground/20 text-primary-foreground rounded px-1.5 py-0.5 text-[10px] font-semibold",children:i.size})]})]})]})})}const dbe={nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"};async function hbe(e){return Xe("POST","/api/properties",e)}async function fbe(e){const t=await fetch(`/api/properties/${e}`,{credentials:"include"});if(!t.ok)throw new Error("Failed to fetch property");return t.json()}async function pbe(e,t){return Xe("PATCH",`/api/properties/${e}`,t)}async function d4(e,t){const n=t!=null?JSON.stringify({purchasePrice:t}):void 0,r=await fetch(`/api/properties/${e}/cost-seg`,{method:"POST",credentials:"include",headers:n?{"Content-Type":"application/json"}:void 0,body:n});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.message??"Cost seg failed")}return r.json()}async function mbe(e,t,n){return Xe("PATCH",`/api/properties/${e}/enrichment/${t}`,{value:n})}async function h4(e){const t=await fetch(`/api/properties/${e}/cost-seg-estimate`,{credentials:"include"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message??"Failed to fetch estimate")}return t.json()}async function gbe(e){const t=await fetch(`/api/properties/${e}/geocode`,{method:"POST",credentials:"include"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message??"Geocoding failed")}return t.json()}async function vbe(e){const t=await fetch(`/api/properties/${e}`,{method:"DELETE",credentials:"include"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message??"Failed to delete property")}}async function Bue(e,t=!1){const n=`/api/properties/${e}/rent-estimate${t?"?force=true":""}`,r=await fetch(n,{credentials:"include"});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.message??"Failed to fetch rent estimate")}return r.json()}const Uue=.24,zue=.37;function Hue(e){const{propertyValue:t,landShare:n,classification:r,bonusDepreciationRate:s,stateConfig:i}=e,o=t*(1-n),l=o*r.baselineReclass,c=o*r.upperReclass,u=l*s,d=c*s,h=(o-l)/27.5/2,f=(o-c)/27.5/2,p=u+h,g=d+f,v=Math.round(p*Uue),y=Math.round(g*zue),x=Math.round((v+y)/2);let b=0,w=0;i.conformity==="full"?(b=Math.round(p*i.topRate),w=Math.round(g*i.topRate)):i.conformity==="partial"&&(b=Math.round(p*.85*i.topRate),w=Math.round(g*.85*i.topRate));const S=Math.round((b+w)/2);return{depreciableBasis:Math.round(o),reclassifiedBasisBaseline:Math.round(l),reclassifiedBasisUpper:Math.round(c),totalYr1DeductionBaseline:Math.round(p),totalYr1DeductionUpper:Math.round(g),federalSavings:{low:v,high:y,midpoint:x},stateSavings:{low:b,high:w,midpoint:S},totalSavings:{low:v+b,high:y+w,midpoint:x+S},bonusDepreciationRate:s,landShare:n,conformityStatus:i.conformity}}function Wue(e){return e>=2025?1:e===2024?.6:e===2023?.8:e>=2017&&e<=2022?1:0}function Tn(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function que({input:e,onSubmit:t,prefillAddress:n}){const[r,s]=m.useState(""),[i,o]=m.useState([]),[l,c]=m.useState(!1),[u,d]=m.useState(!1),h=m.useRef(null),f=m.useRef(!1),p=m.useRef(t);m.useEffect(()=>{p.current=t},[t]),m.useEffect(()=>{const b=n==null?void 0:n.trim();if(!b||f.current)return;f.current=!0,s(b);const w=setTimeout(()=>{d(!0),c(!1),p.current(b)},140);return()=>clearTimeout(w)},[n]);const g=async b=>{const w=window.__GEOAPIFY_KEY__??"068184098df04e2e8460f461097031d0"??"";if(!w||b.length<5){o([]);return}try{const S=`https://api.geoapify.com/v1/geocode/autocomplete?text=${encodeURIComponent(b)}&filter=countrycode:us&format=geojson&limit=6&apiKey=${w}`,_=await fetch(S);if(!_.ok)return;const E=await _.json();o(E.features??[]),c(!0)}catch{o([])}},v=b=>{const w=b.target.value;s(w),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>g(w),300)},y=b=>{s(b.properties.formatted),o([]),c(!1)},x=()=>{r.trim()&&(d(!0),c(!1),t(r.trim()))};return a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm p-5 max-w-lg w-full",children:[a.jsx("p",{className:"text-base font-semibold text-gray-900 mb-1",children:e.headline??"Enter your property address"}),e.subtext&&a.jsx("p",{className:"text-sm text-gray-500 mb-3",children:e.subtext}),a.jsxs("div",{className:"relative",children:[a.jsx(Ct,{value:r,onChange:v,onFocus:()=>i.length>0&&c(!0),onBlur:()=>setTimeout(()=>c(!1),150),placeholder:"726 N River Blvd, Independence, MO 64050",className:"pr-4",onKeyDown:b=>b.key==="Enter"&&x(),disabled:u}),l&&i.length>0&&a.jsx("ul",{className:"absolute z-50 w-full bg-white border border-gray-200 rounded-lg mt-1 
628shadow-lg overflow-hidden",children:i.map(b=>a.jsx("li",{className:"px-4 py-2 text-sm text-gray-800 hover:bg-green-50 cursor-pointer",onMouseDown:()=>y(b),children:b.properties.formatted},b.properties.formatted))})]}),a.jsx(ie,{className:"mt-3 w-full bg-green-600 hover:bg-green-700 text-white font-semibold",onClick:x,disabled:!r.trim()||u,children:u?"Looking up…":"Get My Estimate"})]})}function Gue({input:e,onViewFullEstimate:t}){const n=e,r=n.result??e,s=r&&r.sourcedData&&r.classification&&r.calculation?r:null,i=(typeof n.estimateId=="number"?n.estimateId:null)??null,o={low:0,high:0,midpoint:0},l=s??{sourcedData:{address:"Unknown address",propertyType:null,estimatedValue:0},classification:{label:"Unknown"},calculation:{totalSavings:o},yearPlacedInService:new Date().getFullYear()},c=l.calculation.totalSavings??o,[u,d]=m.useState(l.sourcedData.estimatedValue),[h,f]=m.useState(l.yearPlacedInService),[p,g]=m.useState(null),v=m.useRef(!1);m.useEffect(()=>{v.current||s&&(v.current=!0,CL({address:l.sourcedData.address,propertyType:l.sourcedData.propertyType??l.classification.label,estimatedValue:l.sourcedData.estimatedValue,totalSavingsMidpoint:c.midpoint}))},[s,c.midpoint,l.sourcedData.address,l.sourcedData.propertyType,l.classification.label,l.sourcedData.estimatedValue]),m.useEffect(()=>{if(!s){g(null);return}const b=s.calculation.conformityStatus,w=["full","partial","none","no_tax"].includes(b)?b:"none",S=Hue({propertyValue:u,landShare:s.landShare,classification:{baselineReclass:s.classification.baselineReclass,upperReclass:s.classification.upperReclass,label:s.classification.label},bonusDepreciationRate:Wue(h),stateConfig:{conformity:w,topRate:s.calculation.stateSavings.high?s.calculation.stateSavings.high/s.calculation.totalYr1DeductionUpper:0}});g(S)},[u,h,s]);const x=(p??l.calculation).totalSavings??c;return s?a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm p-5 max-w-lg w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("p",{className:"text-sm font-medium text-gray-500 truncate max-w-xs",children:s.sourcedData.address}),a.jsx("span",{className:"text-xs bg-green-100 text-green-700 font-semibold px-2 py-0.5 rounded-full",children:s.classification.label})]}),a.jsxs("div",{className:"bg-green-50 rounded-xl p-4 text-center mb-4",children:[a.jsx("p",{className:"text-xs font-semibold text-green-600 uppercase tracking-wide mb-1",children:"Estimated Year-1 Tax Savings"}),a.jsx("p",{className:"text-4xl font-black text-green-700",children:Tn(x.midpoint)}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Range: ",Tn(x.low)," – ",Tn(x.high)]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[a.jsxs("div",{children:[a.jsx(at,{className:"text-xs text-gray-500 mb-1 block",children:"Property Value"}),a.jsx(Ct,{type:"number",value:u,onChange:b=>{d(Number(b.target.value)),n0({field:"propertyValue",estimateId:i})},className:"text-sm"})]}),a.jsxs("div",{children:[a.jsx(at,{className:"text-xs text-gray-500 mb-1 block",children:"Year Placed in Service"}),a.jsx(Ct,{type:"number",min:2017,max:2030,value:h,onChange:b=>{f(Number(b.target.value)),n0({field:"yearPlacedInService",estimateId:i})},className:"text-sm"})]})]}),a.jsx(ie,{className:"w-full bg-green-600 hover:bg-green-700 text-white font-semibold",onClick:t,children:"View Full Estimate"}),a.jsx("p",{className:"text-xs text-gray-400 text-center mt-2",children:"Editing updates savings instantly — no page reload needed."})]}):a.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 shadow-sm p-5 max-w-lg w-full",children:[a.jsx("p",{className:"text-sm font-semibold text-red-700",children:"Preview data unavailable"}),a.jsx("p",{className:"text-sm text-red-600 mt-1",children:"We couldn't render the savings preview from this tool response. Please try the address again."})]})}function Kue({input:e,onSubmit:t}){const[n,r]=m.useState(""),[s,i]=m.useState(!1),[o,l]=m.useState(""),c=()=>{const u=n.trim();if(!u||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)){l("Please enter a valid email address.");return}l(""),i(!0),t(u)};return a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm p-5 max-w-lg w-full",children:[a.jsx("p",{className:"text-base font-semibold text-gray-900 mb-1",children:"Unlock Your Full Breakdown"}),a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Enter your email to see the complete cost segregation analysis — we'll also send you a copy."}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ct,{type:"email",value:n,onChange:u=>{r(u.target.value),l("")},placeholder:"[email protected]",onKeyDown:u=>u.key==="Enter"&&c(),disabled:s}),o&&a.jsx("p",{className:"text-xs text-red-500",children:o})]}),a.jsx(ie,{className:"mt-3 w-full bg-green-600 hover:bg-green-700 text-white font-semibold",onClick:c,disabled:!n.trim()||s,children:s?"Sending…":"See My Full Estimate"}),a.jsx("p",{className:"text-xs text-gray-400 text-center mt-2",children:"No spam. Unsubscribe anytime."})]})}function Di({label:e,value:t}){return a.jsxs("div",{className:"flex justify-between items-baseline gap-3 py-2 border-b border-gray-100 last:border-0",children:[a.jsx("span",{className:"text-sm text-gray-600 min-w-0 leading-snug",children:e}),a.jsx("span",{className:"text-sm font-semibold text-gray-900 shrink-0 text-right leading-snug",children:t})]})}function _0({input:e,isAuthenticated:t=!1,context:n}){const r=e,s=r.result??e,i=s&&s.sourcedData&&s.classification&&s.calculation?s:null,o=typeof r.stateNote=="string"?r.stateNote:"",l=typeof r.estimateId=="number"?r.estimateId:null,c={low:0,high:0,midpoint:0},u=i??{classification:{baselineReclass:0,upperReclass:0},calculation:{depreciableBasis:0,reclassifiedBasisBaseline:0,reclassifiedBasisUpper:0,totalYr1DeductionBaseline:0,totalYr1DeductionUpper:0,federalSavings:c,stateSavings:c,totalSavings:c,bonusDepreciationRate:0,disclaimerText:""},yearPlacedInService:new Date().getFullYear()},d=u.calculation,h=m.useRef(!1);m.useEffect(()=>
628{i&&(h.current||(h.current=!0,jL({estimateId:l,isAuthenticated:t})))},[l,t,i]);const f=Math.round(d.bonusDepreciationRate*100),p=Math.round(u.classification.baselineReclass*100),g=Math.round(u.classification.upperReclass*100);return i?a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm p-3 sm:p-5 w-full",children:[a.jsx("div",{className:"flex items-center justify-end gap-2 mb-1",children:a.jsx("span",{className:"text-xs bg-green-100 text-green-700 font-semibold px-2 py-0.5 rounded-full shrink-0",children:i.classification.label})}),a.jsx("p",{className:"text-sm text-gray-400 mb-4 truncate",children:i.sourcedData.address}),a.jsxs("div",{className:"bg-green-50 rounded-xl p-4 text-center mb-4",children:[a.jsx("p",{className:"text-xs font-semibold text-green-600 uppercase tracking-wide mb-1",children:"Total Year-1 Tax Savings"}),a.jsx("p",{className:"text-4xl font-black text-green-700",children:Tn(d.totalSavings.midpoint)}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[Tn(d.totalSavings.low)," – ",Tn(d.totalSavings.high)]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Calculation Steps"}),a.jsx(Di,{label:"Property Value",value:Tn(i.sourcedData.estimatedValue)}),a.jsx(Di,{label:"Land Share",value:`${Math.round(i.landShare*100)}%`}),a.jsx(Di,{label:"Depreciable Basis",value:Tn(d.depreciableBasis)}),a.jsx(Di,{label:"Reclassified Basis",value:`${Tn(d.reclassifiedBasisBaseline)} – ${Tn(d.reclassifiedBasisUpper)}`}),a.jsx(Di,{label:"Reclassification %",value:`${p}% – ${g}%`}),a.jsx(Di,{label:`Bonus Depreciation (${f}%)`,value:`${Tn(d.totalYr1DeductionBaseline)} – ${Tn(d.totalYr1DeductionUpper)}`}),a.jsx(Di,{label:"Federal Savings (24%–37%)",value:`${Tn(d.federalSavings.low)} – ${Tn(d.federalSavings.high)}`}),a.jsx(Di,{label:"State Savings",value:`${Tn(d.stateSavings.low)} – ${Tn(d.stateSavings.high)}`})]}),o&&a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 mb-4 text-xs text-amber-800",children:o}),a.jsx(ie,{className:"w-full bg-green-600 hover:bg-green-700 text-white font-semibold mb-2",onClick:()=>{TL({estimateId:l}),window.open("https://rentalpropertyrefund.com/?rfsn=8928736.a5e206","_blank")},children:"Get a Formal Cost Seg Study"}),n!=="property-tab"&&a.jsx(ie,{variant:"outline",className:"w-full border-green-600 text-green-700 hover:bg-green-50 font-semibold",onClick:()=>window.open("https://repsshield.com/register","_blank"),children:"Track REPS Hours with REPSShield"}),a.jsx("p",{className:"text-xs text-gray-400 mt-4 leading-relaxed",children:d.disclaimerText})]}):a.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 shadow-sm p-5 w-full",children:[a.jsx("p",{className:"text-sm font-semibold text-red-700",children:"Estimate data unavailable"}),a.jsx("p",{className:"text-sm text-red-600 mt-1",children:"We couldn't render the full estimate from this tool response."})]})}function ybe({type:e,input:t,onAddressSubmit:n,onViewFullEstimate:r,onEmailSubmit:s,isAuthenticated:i=!1,autoSubmitAddress:o}){return e==="tool-showAddressInput"?a.jsx(que,{input:t,onSubmit:n,prefillAddress:o}):e==="tool-showPreviewCard"?a.jsx(Gue,{input:t,onViewFullEstimate:r}):e==="tool-showEmailGate"?a.jsx(Kue,{input:t,onSubmit:s}):e==="tool-showFullEstimate"?a.jsx(_0,{input:t,isAuthenticated:i}):null}const Yue="No property value found";function Que(e){const t=e.calculationResult;return{estimateId:e.id,addressHash:e.addressHash,sourcedData:e.sourcedData,classification:e.classification??{},calculation:t,stateNote:t.stateNote??"",landShare:t.landShare??0,bonusDepreciationRate:t.bonusDepreciationRate??0,yearPlacedInService:new Date().getFullYear()}}function tg({propertyId:e,propertyNickname:t,status:n}){var f;const{toast:r}=sn(),s=m.useRef(!1),[i,o]=m.useState(!1),[l,c]=m.useState(""),u=tt({queryKey:["costSegEstimate",e],queryFn:()=>h4(e),enabled:n==="complete",staleTime:5*60*1e3,retry:1}),d=gt({mutationFn:p=>d4(e,p),onSuccess:()=>{o(!1),c("")},onError:p=>{p.message.includes(Yue)?o(!0):r({title:"Cost segregation failed",description:p.message||"Something went wrong. Please try again.",variant:"destructive"})}});if(m.useEffect(()=>{s.current||(n==="none"||n==="failed")&&(s.current=!0,d.mutate(void 0))},[n]),n==="complete"){if(u.isLoading)return a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-3 text-muted-foreground",children:[t&&a.jsx("p",{className:"text-xs font-medium text-foreground self-start",children:t}),a.jsx(ct,{className:"h-7 w-7 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Loading estimate…"})]});if(u.isError||!u.data)return a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-3",children:[t&&a.jsx("p",{className:"text-xs font-medium text-foreground self-start",children:t}),a.jsx(xi,{className:"h-7 w-7 text-destructive"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load the cost segregation estimate."}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>u.refetch(),className:"gap-2",children:"Retry"})]});const p=Que(u.data);return a.jsxs("div",{className:"space-y-3",children:[t&&a.jsxs("p",{className:"text-xs font-medium text-foreground",children:[t," — Tax Savings Estimate"]}),a.jsx(_0,{input:{result:p,stateNote:p.stateNote,estimateId:p.estimateId??null},isAuthenticated:!0,context:"property-tab"})]})}if(d.isPending||n==="pending")return a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-3 text-muted-foreground",children:[t&&a.jsx("p",{className:"text-xs font-medium text-foreground self-start",children:t}),a.jsx(ct,{className:"h-7 w-7 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Running cost segregation estimate…"}
628),a.jsx("p",{className:"text-xs text-muted-foreground/70",children:"This typically takes 10–20 seconds."})]});if(i){const p=g=>{g.preventDefault();const v=parseFloat(l.replace(/[^0-9.]/g,""));if(!v||v<=0){r({title:"Invalid price",description:"Please enter a valid purchase price.",variant:"destructive"});return}d.mutate(v)};return a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-4 max-w-sm",children:[t&&a.jsx("p",{className:"text-xs font-medium text-foreground self-start",children:t}),a.jsx("div",{className:"flex items-center justify-center h-11 w-11 rounded-full bg-amber-100 dark:bg-amber-900/30",children:a.jsx(eR,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),a.jsxs("div",{className:"text-center space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"Purchase price required"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"We couldn't find a property value. Enter the purchase price to run the estimate."})]}),a.jsxs("form",{onSubmit:p,className:"w-full space-y-3",children:[a.jsxs("div",{children:[a.jsx(at,{htmlFor:"costseg-purchase-price",children:"Purchase Price"}),a.jsxs("div",{className:"relative mt-1",children:[a.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),a.jsx(Ct,{id:"costseg-purchase-price",type:"text",inputMode:"numeric",value:l,onChange:g=>c(g.target.value),placeholder:"1,500,000",className:"pl-7",required:!0})]})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:d.isPending,children:d.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-4 w-4 mr-2 animate-spin"}),"Running…"]}):"Run Cost Seg Estimate"})]})]})}if(n==="failed"&&!d.data)return a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-3",children:[t&&a.jsx("p",{className:"text-xs font-medium text-foreground self-start",children:t}),a.jsx(xi,{className:"h-7 w-7 text-destructive"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The cost segregation estimate failed."}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>d.mutate(void 0),className:"gap-2",children:"Retry"}),a.jsx("button",{type:"button",className:"text-xs text-muted-foreground/70 hover:text-muted-foreground underline",onClick:()=>o(!0),children:"Enter purchase price manually"})]});const h=((f=d.data)==null?void 0:f.costSegResult)??null;return h?a.jsxs("div",{className:"space-y-3",children:[t&&a.jsxs("p",{className:"text-xs font-medium text-foreground",children:[t," — Tax Savings Estimate"]}),a.jsx(_0,{input:{result:h,stateNote:h.stateNote,estimateId:h.estimateId??null},isAuthenticated:!0,context:"property-tab"})]}):a.jsxs("div",{className:"rounded-xl border bg-card p-5 flex flex-col items-center gap-3 text-muted-foreground",children:[a.jsx(ct,{className:"h-7 w-7 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Loading estimate…"})]})}const Zue={geo:rm,calendar:YI,mail:nm},Xue={geo:"GeoSync",calendar:"Calendar",mail:"Mail"};async function Jue(e){if(!(await fetch("/api/geo-sync/approve",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e})})).ok)throw new Error("Failed to approve entry")}function ede(e){const t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function tde({toolCallId:e,framingSummary:t,signals:n,onSubmit:r}){const{getCardState:s,setCardState:i}=Do(),o=s(e),l=(o==null?void 0:o.rowStatus)??{},[c,u]=m.useState(!1);function d(y,x){const b=s(e);i(e,{rowStatus:{...(b==null?void 0:b.rowStatus)??{},[y]:x}})}const h=gt({mutationFn:y=>Jue(y)});async function f(y){if(y.existingEntryId!=null){d(y.candidateId,"pending");try{await h.mutateAsync(y.existingEntryId),d(y.candidateId,"done")}catch{d(y.candidateId,"error")}}}async function p(){const y=n.filter(x=>x.resolvableBy==="approve"&&x.existingEntryId!=null&&l[x.candidateId]!=="done");if(y.length!==0){u(!0);for(const x of y)await f(x);u(!1)}}function g(y){d(y.candidateId,"done"),r(Ice({candidateId:y.candidateId,date:y.date,durationHint:y.durationHint,propertyId:y.propertyId,propertyName:y.propertyName,summary:y.summary,source:y.source}))}const v=n.filter(y=>y.resolvableBy==="approve"&&l[y.candidateId]!=="done").length;return a.jsx(ht,{className:"w-full shadow-sm",children:a.jsxs(yt,{className:"p-4 space-y-3",children:[a.jsx(Ha,{icon:yx,title:"Unlogged Activity"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),v>1&&a.jsx(ie,{size:"sm",variant:"outline",className:"w-full text-xs h-8",disabled:c,onClick:p,children:c?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Approving…"]}):`Approve all ${v}
628 pending`}),a.jsx("div",{className:"space-y-1.5",children:n.map(y=>{const x=l[y.candidateId]??"idle",b=Zue[y.source]??cH,w=y.resolvableBy==="approve";return a.jsxs("div",{className:q("flex items-start gap-2.5 p-2.5 rounded-lg border text-xs",x==="done"?"border-border/40 bg-muted/30":"border-border/60"),children:[a.jsx(b,{className:"h-3.5 w-3.5 mt-0.5 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:"font-medium text-foreground",children:ede(y.date)}),a.jsxs("span",{className:"text-muted-foreground",children:["· ",Xue[y.source]]}),y.propertyName&&a.jsxs("span",{className:"text-muted-foreground truncate",children:["· ",y.propertyName]}),y.olderThanRequestedRange&&a.jsx("span",{className:"text-[10px] text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5",children:"Older"})]}),a.jsx("p",{className:"text-muted-foreground leading-snug mt-0.5",children:y.summary}),x==="error"&&a.jsx("p",{className:"text-destructive mt-1",children:"Failed to approve — try again."})]}),a.jsx("div",{className:"shrink-0",children:x==="done"?a.jsxs("span",{className:"flex items-center gap-1 text-primary text-[11px] font-medium",children:[a.jsx(bt,{className:"h-3.5 w-3.5"}),w?"Approved":"Sent"]}):a.jsx(ie,{size:"sm",variant:w?"outline":"default",className:"h-7 px-2.5 text-[11px]",disabled:x==="pending",onClick:()=>w?f(y):g(y),children:x==="pending"?a.jsx(ct,{className:"h-3 w-3 animate-spin"}):w?"Approve":"Log this"})})]},y.candidateId)})})]})})}const Bp=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0});function f4(e,t){return`${Bp.format(e)} – ${Bp.format(t)}`}function nde(e){const t=e.calculationResult,n=t==null?void 0:t.totalSavings;if(!n)return null;const r=Number(n.low),s=Number(n.high),i=Number(n.midpoint??(r+s)/2);return isNaN(r)||isNaN(s)?null:{low:r,high:s,midpoint:i}}function p4(e){var h,f;const t=m.useRef(!1),{data:n=[]}=tt({queryKey:["/api/properties"],staleTime:5*60*1e3}),r=n.find(p=>p.id===e)??null,s=(r==null?void 0:r.costSegStatus)??"none",i=(r==null?void 0:r.nickname)??(r==null?void 0:r.address)??`Property ${e}`,o=tt({queryKey:["costSegEstimate",e],queryFn:()=>h4(e),enabled:s==="complete",staleTime:5*60*1e3,retry:1}),l=gt({mutationFn:()=>d4(e)});m.useEffect(()=>{t.current||(s==="none"||s==="failed")&&(t.current=!0,l.mutate())},[s]);let c=null,u=!1,d=!1;if(s==="complete")u=o.isLoading,d=o.isError,o.data&&(c=nde(o.data));else if(s==="pending"||l.isPending)u=!0;else if(l.isSuccess){const p=l.data,g=(f=(h=p==null?void 0:p.costSegResult)==null?void 0:h.calculation)==null?void 0:f.totalSavings;if(g){const v=Number(g.low),y=Number(g.high),x=Number(g.midpoint??(v+y)/2);!isNaN(v)&&!isNaN(y)&&(c={low:v,high:y,midpoint:x})}}else l.isError&&(d=!0);return{displayName:i,status:s,savings:c,isLoading:u,isError:d}}function rde({propertyId:e}){const{data:t=[]}=tt({queryKey:["/api/properties"],staleTime:3e5}),n=t.find(i=>i.id===e)??null,r=(n==null?void 0:n.costSegStatus)??"none",s=(n==null?void 0:n.nickname)??(n==null?void 0:n.address)??void 0;return a.jsx(tg,{propertyId:e,status:r,propertyNickname:s})}function sde({propertyId:e,isExpanded:t,onToggle:n}){const{displayName:r,status:s,savings:i,isLoading:o,isError:l}=p4(e);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:"border-b border-border/40 last:border-0 hover:bg-muted/30 transition-colors cursor-pointer select-none",onClick:n,"aria-expanded":t,children:[a.jsx("td",{className:"py-3 px-4 text-sm font-medium text-foreground",children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[t?a.jsx(Ma,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):a.jsx(Ar,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),r]})}),a.jsx("td",{className:"py-3 px-4 text-sm text-muted-foreground",children:o?a.jsx(ct,{className:"h-4 w-4 animate-spin text-muted-foreground"}):l?a.jsxs("span",{className:"text-destructive text-xs flex items-center gap-1",children:[a.jsx(xi,{className:"h-3.5 w-3.5"}),"Failed"]}):i?f4(i.low,i.high):a.jsx("span",{className:"text-muted-foreground
628/50 text-xs",children:"—"})}),a.jsx("td",{className:"py-3 px-4 text-sm font-semibold text-emerald-600 dark:text-emerald-400",children:o?"…":l?"—":i?Bp.format(i.midpoint):"—"})]}),t&&a.jsx("tr",{className:"border-b border-border/40",children:a.jsx("td",{colSpan:3,className:"px-4 py-4 bg-muted/20",children:a.jsx(tg,{propertyId:e,status:s,propertyNickname:r})})})]})}function ide({propertyId:e,isExpanded:t,onToggle:n}){const{displayName:r,status:s,savings:i,isLoading:o,isError:l}=p4(e);return a.jsxs("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[a.jsxs("button",{type:"button",className:"w-full p-3 text-left space-y-2 hover:bg-muted/30 transition-colors",onClick:n,"aria-expanded":t,children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground leading-snug",children:r}),t?a.jsx(Ma,{className:"h-4 w-4 text-muted-foreground shrink-0"}):a.jsx(Ar,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),o?a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}),"Calculating…"]}):l?a.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[a.jsx(xi,{className:"h-3.5 w-3.5"}),"Estimate failed"]}):i?a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide font-medium",children:"Range"}),a.jsx("p",{className:"text-xs text-foreground",children:f4(i.low,i.high)})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide font-medium",children:"Est. Value"}),a.jsx("p",{className:"text-sm font-semibold text-emerald-600 dark:text-emerald-400",children:Bp.format(i.midpoint)})]})]}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No data"})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-1 border-t border-border/40 bg-muted/20",children:a.jsx(tg,{propertyId:e,status:s,propertyNickname:r})})]})}function tj({propertyIds:e}){const[t,n]=m.useState(null);if(e.length===0)return null;if(e.length===1)return a.jsx(rde,{propertyId:e[0]});function r(s){n(i=>i===s?null:s)}return a.jsx(ht,{className:"w-full shadow-sm overflow-hidden",children:a.jsxs(yt,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border/40",children:[a.jsx(SH,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400 shrink-0"}),a.jsx("p",{className:"font-semibold text-sm",children:"Cost Segregation Estimates"})]}),a.jsx("div",{className:"hidden sm:block",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border/40 bg-muted/30",children:[a.jsx("th",{className:"py-2 px-4 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Property"}),a.jsx("th",{className:"py-2 px-4 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Estimated Range"}),a.jsx("th",{className:"py-2 px-4 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Estimated Value"})]})}),a.jsx("tbody",{children:e.map(s=>a.jsx(sde,{propertyId:s,isExpanded:t===s,onToggle:()=>r(s)},s))})]})}),a.jsx("div",{className:"sm:hidden p-3 space-y-2",children:e.map(s=>a.jsx(ide,{propertyId:s,isExpanded:t===s,onToggle:()=>r(s)},s))}),a.jsx("p",{className:"px-4 py-2.5 text-[10px] text-muted-foreground/60 border-t border-border/30",children:"Estimates are illustrative only and not tax advice. Consult a qualified CPA or cost seg specialist."})]})})}function ou(e){return e==null?"—":"$"+e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}function ode(e){return e==null?"—":e<.1?(e*5280).toFixed(0)+" ft":e.toFixed(1)+" mi"}function nj({propertyId:e,propertyNickname:t}){const{data:n,isLoading:r,isError:s,error:i,refetch:o}=tt({queryKey:["/api/properties",e,"rent-estimate"],queryFn:()=>Bue(e),staleTime:1/0});if(r)return a.jsx(ht,{className:"max-w-md",children:a.jsxs(yt,{className:"flex items-center justify-center py-10 gap-3",children:[a.jsx(ct,{className:"h-5 w-5 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading rent estimate…"})]})});if(s)return a.jsx(ht,{className:"max-w-md",children:a.jsxs(yt,{className:"flex flex-col items-center gap-3 py-8",children:[a.jsx(xi,{className:"h-6 w-6 text-destructive"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(i==null?void 0:i.message)??"Failed to load rent estimate."}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>o(),className:"gap-2",children:[a.jsx(dd,{className:"h-4 w-4"}),"Retry"]})]})});const l=!n||n.comps.length===0,c=n&&n.rent==null&&n.rentRangeLow==null&&n.rentRangeHigh==null;if(l&&c)return a.jsx(ht,{className:"max-w-md",children:a.jsxs(yt,{className:"flex flex-col items-center gap-3 py-8",children:[a.jsx(rm,{className:"h-8 w-8 text-muted-foreground
628/50"}),a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Not enough market data to generate a rent estimate for this property."}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>o(),className:"gap-2",children:[a.jsx(dd,{className:"h-4 w-4"}),"Retry"]})]})});const u=(n==null?void 0:n.comps)??[],d=(n==null?void 0:n.rent)??null,h=(n==null?void 0:n.rentRangeLow)??null,f=(n==null?void 0:n.rentRangeHigh)??null;return a.jsxs(ht,{className:"max-w-md overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3 p-4",children:[a.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:a.jsx(eR,{className:"h-5 w-5 text-green-600 dark:text-green-400"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[t&&a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:t}),a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-0.5",children:"Estimated Rent Range"}),a.jsx("p",{className:"text-lg font-bold text-foreground break-words leading-tight",children:h!=null&&f!=null?`${ou(h)} – ${ou(f)} / month`:d!=null?`${ou(d)} / month`:"—"}),d!=null&&(h!=null||f!=null)&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Median: ",ou(d)," / month"]})]})]}),u.length>0&&a.jsxs("div",{className:"border-t",children:[a.jsx("div",{className:"px-4 pt-3 pb-2",children:a.jsxs("p",{className:"text-xs font-semibold text-foreground",children:["Comparable Properties (",u.length,")"]})}),a.jsx("div",{className:"overflow-x-auto max-h-48",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted/50 text-left text-muted-foreground font-medium",children:[a.jsx("th",{className:"px-4 py-1.5",children:"Address"}),a.jsx("th",{className:"px-2 py-1.5 text-right",children:"Dist"}),a.jsx("th",{className:"px-2 py-1.5 text-right",children:"Beds"}),a.jsx("th",{className:"px-2 py-1.5 text-right hidden sm:table-cell",children:"Baths"}),a.jsx("th",{className:"px-2 py-1.5 text-right hidden sm:table-cell",children:"Sqft"}),a.jsx("th",{className:"px-4 py-1.5 text-right",children:"Rent"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:u.map((p,g)=>a.jsxs("tr",{className:"text-foreground",children:[a.jsx("td",{className:"max-w-[120px] truncate px-4 py-1.5",title:p.formattedAddress,children:p.formattedAddress||"—"}),a.jsx("td",{className:"whitespace-nowrap px-2 py-1.5 text-right",children:ode(p.distance)}),a.jsx("td",{className:"px-2 py-1.5 text-right",children:p.bedrooms!=null?p.bedrooms:"—"}),a.jsx("td",{className:"px-2 py-1.5 text-right hidden sm:table-cell",children:p.bathrooms!=null?p.bathrooms:"—"}),a.jsx("td",{className:"px-2 py-1.5 text-right hidden sm:table-cell",children:p.squareFootage!=null?p.squareFootage.toLocaleString():"—"}),a.jsx("td",{className:"whitespace-nowrap px-4 py-1.5 text-right font-medium",children:ou(p.price)})]},p.formattedAddress||g))})]})})]})]})}function ade({message:e,isPremium:t,onSwitchToAdvisor:n,onUpgradeClick:r}){return a.jsxs(ht,{className:"border-border/30 bg-muted/70 shadow-sm w-full text-foreground",children:[a.jsx(yt,{className:"pt-3 sm:pt-4 pb-2 px-3 sm:px-4",children:a.jsx("div",{className:"text-xs sm:text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:e})}),a.jsx(PO,{className:"px-3 sm:px-4 pb-3 sm:pb-4 pt-1 flex-col sm:flex-row gap-2 sm:gap-0",children:t?a.jsxs(ie,{size:"sm",variant:"default",className:"gap-1.5 w-full sm:w-auto",onClick:n,children:[a.jsx(ts,{className:"h-3.5 w-3.5 sm:hidden"}),"Switch to Advisor",a.jsx(ts,{className:"h-3.5 w-3.5 hidden sm:inline-block"})]}):a.jsxs(ie,{size:"sm",variant:"default",className:"gap-1.5 w-full sm:w-auto text-xs sm:text-sm whitespace-normal h-auto min-h-[2rem] sm:min-h-0 py-1.5 sm:py-1",onClick:r,children:[a.jsx(Cr,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate sm:whitespace-normal",children:"Upgrade to Shield Advisor & Switch"}),a.jsx(ts,{className:"h-3.5 w-3.5 shrink-0"})]})})]})}function lde(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cde=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ude=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dde={};function rj(e,t){return(dde.jsx?ude:cde).test(e)}const hde=/[ \t\n\f\r]/g;function fde(e){return typeof e=="object"?e.type==="text"?sj(e.value):!1:sj(e)}function sj(e){return e.replace(hde,"")===""}class fh{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}fh.prototype.normal={};fh.prototype.property={};fh.prototype.space=void 0;function m4(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new fh(n,r,t)}function k0(e){return e.toLowerCase()}
vendor: 5,119 bytes, line 628
628class fr{constructor(t,n){this.attribute=n,this.property=t}}fr.prototype.attribute="";fr.prototype.booleanish=!1;fr.prototype.boolean=!1;fr.prototype.commaOrSpaceSeparated=!1;fr.prototype.commaSeparated=!1;fr.prototype.defined=!1;fr.prototype.mustUseProperty=!1;fr.prototype.number=!1;fr.prototype.overloadedBoolean=!1;fr.prototype.property="";fr.prototype.spaceSeparated=!1;fr.prototype.space=void 0;let pde=0;const Ze=Wa(),cn=Wa(),S0=Wa(),me=Wa(),At=Wa(),ya=Wa(),gr=Wa();function Wa(){return 2**++pde}const E0=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:cn,commaOrSpaceSeparated:gr,commaSeparated:ya,number:me,overloadedBoolean:S0,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),Gv=Object.keys(E0);class o1 extends fr{constructor(t,n,r,s){let i=-1;if(super(t,n),ij(this,"space",s),typeof r=="number")for(;++i<Gv.length;){const o=Gv[i];ij(this,Gv[i],(r&E0[o])===E0[o])}}}o1.prototype.defined=!0;function ij(e,t,n){n&&(e[t]=n)}function Pc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new o1(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[k0(r)]=r,n[k0(i.attribute)]=r}return new fh(t,n,e.space)}const g4=Pc({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:At,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:me,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:At,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:cn,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function v4(e,t){return t in e?e[t]:t}function y4(e,t){return v4(e,t.toLowerCase())}const mde=Pc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ya,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alpha:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:At,autoFocus:Ze,autoPlay:Ze,blocking:At,capture:null,charSet:null,checked:Ze,cite:null,className:At,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:cn,controls:Ze,controlsList:At,coords:me|ya,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:S0,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:At,height:me,hidden:S0,high:me,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:At,itemRef:At,itemScope:Ze,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ze,optimum:me,pattern:null,ping:At,placeholder:null,playsInl
628ine:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:At,required:Ze,reversed:Ze,rows:me,rowSpan:me,sandbox:At,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootCustomElementRegistry:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shadowRootSerializable:Ze,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:cn,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ze,disablePictureInPicture:Ze,disableRemotePlayback:Ze,exportParts:ya,part:At,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:y4}),gde=Pc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
628-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:At,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ya,g2:ya,glyphName:ya,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 4,609 bytes, lines 628-629
628Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:v4}),x4=Pc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),b4=Pc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:y4}),w4=Pc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vde={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},yde=/[A-Z]/g,oj=/-[a-z]/g,xde=/^data[-\w.:]+$/i;function bde(e,t){const n=k0(t);let r=t,s=fr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xde.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(oj,_de);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!oj.test(i)){let o=i.replace(yde,wde);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=o1}return new s(r,t)}function wde(e){return"-"+e.toLowerCase()}function _de(e){return e.charAt(1).toUpperCase()}const kde=m4([g4,mde,x4,b4,w4],"html"),a1=m4([g4,gde,x4,b4,w4],"svg");function Sde(e){return e.join(" ").trim()}var l1={},aj=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ede=/\n/g,Nde=/^\s*/,Cde=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,jde=/^:\s*/,Tde=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Pde=/^[;\s]*/,Ade=/^\s+|\s+$/g,Ide=`
629`,lj="/",cj="*",ea="",Rde="comment",Mde="declaration";function Ode(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var v=g.match(Ede);v&&(n+=v.length);var y=g.lastIndexOf(Ide);r=~y?g.length-y:r+g.length}function i(){var g={line:n,column:r};return function(v){return v.position=new o(g),u(),v}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var v=new Error(t.source+":"+n+":"+r+": "+g);if(v.reason=g,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function c(g){var v=g.exec(e);if(v){var y=v[0];return s(y),e=e.slice(y.length),v}}function u(){c(Nde)}function d(g){var v;
vendor: 4,410 bytes, line 629
629for(g=g||[];v=h();)v!==!1&&g.push(v);return g}function h(){var g=i();if(!(lj!=e.charAt(0)||cj!=e.charAt(1))){for(var v=2;ea!=e.charAt(v)&&(cj!=e.charAt(v)||lj!=e.charAt(v+1));)++v;if(v+=2,ea===e.charAt(v-1))return l("End of comment missing");var y=e.slice(2,v-2);return r+=2,s(y),e=e.slice(v),r+=2,g({type:Rde,comment:y})}}function f(){var g=i(),v=c(Cde);if(v){if(h(),!c(jde))return l("property missing ':'");var y=c(Tde),x=g({type:Mde,property:uj(v[0].replace(aj,ea)),value:y?uj(y[0].replace(aj,ea)):ea});return c(Pde),x}}function p(){var g=[];d(g);for(var v;v=f();)v!==!1&&(g.push(v),d(g));return g}return u(),p()}function uj(e){return e?e.replace(Ade,ea):ea}var Dde=Ode,Lde=Yu&&Yu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l1,"__esModule",{value:!0});l1.default=$de;const Fde=Lde(Dde);function $de(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Fde.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var ng={};Object.defineProperty(ng,"__esModule",{value:!0});ng.camelCase=void 0;var Vde=/^--[a-zA-Z0-9_-]+$/,Bde=/-([a-z])/g,Ude=/^[^-]+$/,zde=/^-(webkit|moz|ms|o|khtml)-/,Hde=/^-(ms)-/,Wde=function(e){return!e||Ude.test(e)||Vde.test(e)},qde=function(e,t){return t.toUpperCase()},dj=function(e,t){return"".concat(t,"-")},Gde=function(e,t){return t===void 0&&(t={}),Wde(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Hde,dj):e=e.replace(zde,dj),e.replace(Bde,qde))};ng.camelCase=Gde;var Kde=Yu&&Yu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Yde=Kde(l1),Qde=ng;function N0(e,t){var n={};return!e||typeof e!="string"||(0,Yde.default)(e,function(r,s){r&&s&&(n[(0,Qde.camelCase)(r,t)]=s)}),n}N0.default=N0;var Zde=N0;const Xde=H0(Zde),_4=k4("end"),c1=k4("start");function k4(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Jde(e){const t=c1(e),n=_4(e);if(t&&n)return{start:t,end:n}}function qu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hj(e.position):"start"in e||"end"in e?hj(e):"line"in e||"column"in e?C0(e):""}function C0(e){return fj(e&&e.line)+":"+fj(e&&e.column)}function hj(e){return C0(e&&e.start)+"-"+C0(e&&e.end)}function fj(e){return e&&typeof e=="number"?e:1}class Fn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=qu(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Fn.prototype.file="";Fn.prototype.name="";Fn.prototype.reason="";Fn.prototype.message="";Fn.prototype.stack="";Fn.prototype.column=void 0;Fn.prototype.line=void 0;Fn.prototype.ancestors=void 0;Fn.prototype.cause=void 0;Fn.prototype.fatal=void 0;Fn.prototype.place=void 0;Fn.prototype.ruleId=void 0;Fn.prototype.source=void 0;const u1={}.hasOwnProperty,ehe=new Map,the=/[A-Z]/g,nhe=new Set(["table","tbody","thead","tfoot","tr"]),rhe=new Set(["td","th"]),S4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function she(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=hhe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 6,346 bytes, line 629
629if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=dhe(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?a1:kde,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=E4(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function E4(e,t,n){if(t.type==="element")return ihe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ohe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return lhe(e,t,n);if(t.type==="mdxjsEsm")return ahe(e,t);if(t.type==="root")return che(e,t,n);if(t.type==="text")return uhe(e,t)}function ihe(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=a1,e.schema=s),e.ancestors.push(t);const i=C4(e,t.tagName,!1),o=fhe(e,t);let l=h1(e,t);return nhe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!fde(c):!0})),N4(e,o,i,t),d1(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function ohe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ad(e,t.position)}function ahe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ad(e,t.position)}function lhe(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=a1,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:C4(e,t.name,!0),o=phe(e,t),l=h1(e,t);return N4(e,o,i,t),d1(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function che(e,t,n){const r={};return d1(r,h1(e,t)),e.create(t,e.Fragment,r,n)}function uhe(e,t){return t.value}function N4(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function d1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function dhe(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function hhe(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=c1(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function fhe(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&u1.call(t.properties,s)){const i=mhe(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&rhe.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function phe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Ad(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Ad(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function h1(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:ehe;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=E4(e,i,o);l!==void 0&&n.push(l)}return n}function mhe(e,t,n){const r=bde(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?lde(n):Sde(n)),r.property==="style"){let s=typeof n=="object"?n:ghe(e,String(n));return e.stylePropertyNameCase==="css"&&(s=vhe(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?vde[r.property]||r.property:r.attribute,n]}}function ghe(e,t){try{return Xde(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Fn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=S4+"#cannot-parse-style-attribute",s}}function C4(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=rj(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=rj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return u1.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ad(e)}function Ad(e,t){const n=new Fn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=S4+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vhe(e){const t={};let n;for(n in e)u1.call(e,n)&&(t[yhe(n)]=e[n]);return t}function yhe(e){let t=e.replace(the,xhe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xhe(e){return"-"+e.toLowerCase()}const Kv={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},bhe={};function f1(e,t){const n=bhe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return j4(e,r,s)}function j4(e,t,n){if(whe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return pj(e.children,t,n)}return Array.isArray(e)?pj(e,t,n):""}function pj(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=j4(e[s],t,n);return r.join("")}function whe(e){return!!(e&&typeof e=="object")}const mj=document.createElement("i");function p1(e){const t="&"+e+";";mj.innerHTML=t;const n=mj.textContent;
vendor: 10,920 bytes, line 629
629return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pr(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Fr(e,t){return e.length>0?(Pr(e,e.length,0,t),e):t}const gj={}.hasOwnProperty;function T4(e){const t={};let n=-1;for(;++n<e.length;)_he(t,e[n]);return t}function _he(e,t){let n;for(n in t){const s=(gj.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){gj.call(s,o)||(s[o]=[]);const l=i[o];khe(s[o],Array.isArray(l)?l:l?[l]:[])}}}function khe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Pr(e,0,0,r)}function P4(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ns(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Yn=Lo(/[A-Za-z]/),Ln=Lo(/[\dA-Za-z]/),She=Lo(/[#-'*+\--9=?A-Z^-~]/);function Up(e){return e!==null&&(e<32||e===127)}const j0=Lo(/\d/),Ehe=Lo(/[\dA-Fa-f]/),Nhe=Lo(/[!-/:-@[-`{-~]/);function Ve(e){return e!==null&&e<-2}function Mt(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const rg=Lo(new RegExp("\\p{P}|\\p{S}","u")),Aa=Lo(/\s/);function Lo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ac(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Ln(e.charCodeAt(n+1))&&Ln(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function vt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return lt(c)?(e.enter(n),l(c)):t(c)}function l(c){return lt(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const Che={tokenize:jhe};function jhe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),vt(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ve(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const The={tokenize:Phe},vj={tokenize:Ahe};function Phe(e){const t=this,n=[];let r=0,s,i,o;return l;function l(w){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&b();const S=t.events.length;let _=S,E;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){E=t.events[_][1].end;break}x(r);let R=S;for(;R<t.events.length;)t.events[R][1].end={...E},R++;return Pr(t.events,_+1,0,t.events.slice(S)),t.events.length=R,u(w)}return l(w)}function u(w){if(r===n.length){if(!s)return f(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vj,d,h)(w)}function d(w){return s&&b(),x(r),f(w)}function h(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function f(w){return t.containerState={},e.attempt(vj,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function g(w){if(w===null){s&&b(),x(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),v(w)}function v(w){if(w===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(w);return}return Ve(w)?(e.consume(w),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),v)}function y(w,S){const _=t.sliceStream(w);if(S&&_.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(_),t.parser.lazy[w.start.line]){let E=s.events.length;for(;E--;)if(s.events[E][1].start.offset<o&&(!s.events[E][1].end||s.events[E][1].end.offset>o))return;const R=t.events.length;let A=R,N,k;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(N){k=t.events[A][1].end;break}N=!0}for(x(r),E=R;E<t.events.length;)t.events[E][1].end={...k},E++;Pr(t.events,A+1,0,t.events.slice(R)),t.events.length=E}}function x(w){let S=n.length;for(;S-- >w;){const _=n[S];t.containerState=_[1],_[0].exit.call(t,e)}n.length=w}function b(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Ahe(e,t,n){return vt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vc(e){if(e===null||Mt(e)||Aa(e))return 1;if(rg(e))return 2}function sg(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const T0={name:"attention",resolveAll:Ihe,tokenize:Rhe};function Ihe(e,t){let n=-1,r,s,i,o,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};yj(h,-c),yj(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Fr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Fr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Fr(u,sg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Fr(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Fr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Pr(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Rhe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=vc(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=vc(c),h=!d||d===2&&s||n.includes(c),f=!s||s===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(s||!f)),u._close=!!(i===42?f:f&&(d||!h)),t(c)}}function yj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Mhe={name:"autolink",tokenize:Ohe};function Ohe(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Yn(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Ln(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||Ln(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Up(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):She(p)?(e.consume(p),u):n(p)}function d(p){return Ln(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Ln(p))&&r++<63){const g=p===45?f:h;return e.consume(p),g}return n(p)}}const ph={partial:!0,tokenize:Dhe};function Dhe(e,t,n){return r;function r(i){return lt(i)?vt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ve(i)?t(i):n(i)}}const A4={continuation:{tokenize:Fhe},exit:$he,name:"blockQuote",tokenize:Lhe};function Lhe(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return lt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Fhe(e,t,n){const r=this;return s;function s(o){return lt(o)?vt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(A4,t,n)(o)}}function $he(e){e.exit("blockQuote")}const I4={name:"characterEscape",tokenize:Vhe};function Vhe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return Nhe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const R4={name:"characterReference",tokenize:Bhe};function Bhe(e,t,n){const r=this;let s=0,i,o;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Ln,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Ehe,d):(e.enter("characterReferenceValue"),i=7,o=j0,d(h))}function d(h){if(h===59&&s){const f=e.exit("characterReferenceValue");return o===Ln&&!p1(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&s++<i?(e.consume(h),d):n(h)}}const xj={partial:!0,tokenize:zhe},bj={concrete:!0,name:"codeFenced",tokenize:Uhe};function Uhe(e,t,n){const r=this,s={partial:!0,tokenize:_};let i=0,o=0,l;return c;function c(E){return u(E)}function u(E){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=E,e.enter("co
629deFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(E)}function d(E){return E===l?(o++,e.consume(E),d):o<3?n(E):(e.exit("codeFencedFenceSequence"),lt(E)?vt(e,h,"whitespace")(E):h(E))}function h(E){return E===null||Ve(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(xj,v,S)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(E))}function f(E){return E===null||Ve(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(E)):lt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vt(e,p,"whitespace")(E)):E===96&&E===l?n(E):(e.consume(E),f)}function p(E){return E===null||Ve(E)?h(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||Ve(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(E)):E===96&&E===l?n(E):(e.consume(E),g)}function v(E){return e.attempt(s,S,y)(E)}function y(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),x}function x(E){return i>0&&lt(E)?vt(e,b,"linePrefix",i+1)(E):b(E)}function b(E){return E===null||Ve(E)?e.check(xj,v,S)(E):(e.enter("codeFlowValue"),w(E))}function w(E){return E===null||Ve(E)?(e.exit("codeFlowValue"),b(E)):(e.consume(E),w)}function S(E){return e.exit("codeFenced"),t(E)}function _(E,R,A){let N=0;return k;function k(M){return E.enter("lineEnding"),E.consume(M),E.exit("lineEnding"),T}function T(M){return E.enter("codeFencedFence"),lt(M)?vt(E,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):I(M)}function I(M){return M===l?(E.enter("codeFencedFenceSequence"),F(M)):A(M)}function F(M){return M===l?(N++,E.consume(M),F):N>=o?(E.exit("codeFencedFenceSequence"),lt(M)?vt(E,L,"whitespace")(M):L(M)):A(M)}function L(M){return M===null||Ve(M)?(E.exit("codeFencedFence"),R(M)):A(M)}}}function zhe(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Yv={name:"codeIndented",tokenize:Whe},Hhe={partial:!0,tokenize:qhe};function Whe(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),vt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Ve(u)?e.attempt(Hhe,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ve(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function qhe(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ve(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):vt(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ve(o)?s(o):n(o)}}const Ghe={name:"codeText",previous:Yhe,resolve:Khe,tokenize:Qhe};function Khe(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Yhe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Qhe(e,t,n){let r=0,s,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),s=0,d(h)):Ve(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||Ve(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class Zhe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&au(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),au(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),au(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);au(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);au(this.left,n.reverse())}}}function au(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function M4(e){const t={};let n=-1,r,s,i,o,l,c,u;const d=new Zhe(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Xhe(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...d.get(s)[1].start},l=d.slice(s,n),l.unshift(r),d.splice(s,n-s+1,l))}}return Pr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Xhe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,h,f=-1,p=n,g=0,v=0;const y=[v];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&o.defineSki
vendor: 18,629 bytes, line 629
629p(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(v=f+1,y.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),f=y.length;f--;){const x=l.slice(y[f],y[f+1]),b=i.pop();c.push([b,b+x.length-1]),e.splice(b,2,x)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const Jhe={resolve:tfe,tokenize:nfe},efe={partial:!0,tokenize:rfe};function tfe(e){return M4(e),e}function nfe(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):Ve(l)?e.check(efe,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function rfe(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),vt(e,i,"linePrefix")}function i(o){if(o===null||Ve(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function O4(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(x),e.exit(i),f):x===null||x===32||x===41||Up(x)?n(x):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(x))}function f(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(l),f(x)):x===null||x===60||Ve(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function v(x){return!d&&(x===null||x===41||Mt(x))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(x)):d<u&&x===40?(e.consume(x),d++,v):x===41?(e.consume(x),d--,v):x===null||x===32||x===40||Up(x)?n(x):(e.consume(x),x===92?y:v)}function y(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function D4(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Ve(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ve(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!lt(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function L4(e,t,n,r,s,i){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,c):n(f)}function c(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),u(f))}function u(f){return f===o?(e.exit(i),c(o)):f===null?n(f):Ve(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),vt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Ve(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Gu(e,t){let n;return r;function r(s){return Ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):lt(s)?vt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const sfe={name:"definition",tokenize:ofe},ife={partial:!0,tokenize:afe};function ofe(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return D4.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=ns(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Mt(p)?Gu(e,u)(p):u(p)}function u(p){return O4(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(ife,h,h)(p)}function h(p){return lt(p)?vt(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ve(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function afe(e,t,n){return r;function r(l){return Mt(l)?Gu(e,s)(l):n(l)}function s(l){return L4(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return lt(l)?vt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ve(l)?t(l):n(l)}}const lfe={name:"hardBreakEscape",tokenize:cfe};function cfe(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Ve(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const ufe={name:"headingAtx",resolve:dfe,tokenize:hfe};function dfe(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Pr(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function hfe(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Mt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ve(d)?(e.exit("atxHeading"),t(d)):lt(d)?vt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Mt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const ffe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wj=["pre","script","style","textarea"],pfe={concrete:!0,name:"htmlFlow",resolveTo:vfe,tokenize:yfe},mfe={partial:!0,tokenize:bfe},gfe={partial:!0,tokenize:xfe};function vfe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function yfe(e,t,n){const r=this;let s,i,o,l,c;return u;function u(O){return d(O)}function d(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),h}function h(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),i=!0,v):O===63?(e.consume(O),s=3,r.interrupt?t:C):Yn(O)?(e.consume(O),o=String.fromCharCode(O),y):n(O)}function f(O){return O===45?(e.consume(O),s=2,p):O===91?(e.consume(O),s=5,l=0,g):Yn(O)?(e.consume(O),s=4,r.interrupt?t:C):n(O)}function p(O){return O===45?(e.consume(O),r.interrupt?t:C):n(O)}function g(O){const G="CDATA[";return O===G.charCodeAt(l++)?(e.consume(O),l===G.length?r.interrupt?t:I:g):n(O)}function v(O){return Yn(O)?(e.consume(O),o=String.fromCharCode(O),y):n(O)}function y(O){if(O===null||O===47||O===62||Mt(O)){const G=O===47,Z=o.toLowerCase();return!G&&!i&&wj.includes(Z)?(s=1,r.interrupt?t(O):I(O)):ffe.includes(o.toLowerCase())?(s=6,G?(e.consume(O),x):r.interrupt?t(O):I(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):i?b(O):w(O))}return O===45||Ln(O)?(e.consume(O),o+=String.fromCharCode(O),y):n(O)}function x(O){return O===62?(e.consume(O),r.interrupt?t:I):n(O)}function b(O){return lt(O)?(e.consume(O),b):k(O)}function w(O){return O===47?(e.consume(O),k):O===58||O===95||Yn(O)?(e.consume(O),S):lt(O)?(e.consume(O),w):k(O)}function S(O){return O===45||O===46||O===58||O===95||Ln(O)?(e.consume(O),S):_(O)}function _(O){return O===61?(e.consume(O),E):lt(O)?(e.consume(O),_):w(O)}function E(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),c=O,R):lt(O)?(e.consume(O),E):A(O)}function R(O){return O===c?(e.consume(O),c=null,N):O===null||Ve(O)?n(O):(e.consume(O),R)}function A(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Mt(O)?_(O):(e.consume(O),A)}function N(O){return O===47||O===62||lt(O)?w(O):n(O)}function k(O){return O===62?(e.consume(O),T):n(O)}function T(O){return O===null||Ve(O)?I(O):lt(O)?(e.consume(O),T):n(O)}function I(O){return O===45&&s===2?(e.consume(O),$):O===60&&s===1?(e.consume(O),j):O===62&&s===4?(e.consume(O),H):O===63&&s===3?(e.consume(O),C):O===93&&s===5?(e.consume(O),D):Ve(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(mfe,V,F)(O)):O===null||Ve(O)?(e.exit("htmlFlowData"),F(O)):(e.consume(O),I)}function F(O){return e.check(gfe,L,V)(O)}function L(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),M}function M(O){return O===null||Ve(O)?F(O):(e.enter("htmlFlowData"),I(O))}function $(O){return O===45?(e.consume(O),C):I(O)}function j(O){return O===47?(e.consume(O),o="",P):I(O)}function P(O){if(O===62){const G=o.toLowerCase();return wj.includes(G)?(e.consume(O),H):I(O)}return Yn(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),P):I(O)}function D(O){return O===93?(e.consume(O),C):I(O)}function C(O){return O===62?(e.consume(O),H):O===45&&s===2?(e.consume(O),C):I(O)}function H(O){return O===null||Ve(O)?(e.exit("htmlFlowData"),V(O)):(e.consume(O),H)}function V(O){return e.exit("htmlFlow"),t(O)}}function xfe(e,t,n){const r=this;return s;function s(o){return Ve(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function bfe(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ph,t,n)}}const wfe={name:"htmlText",tokenize:_fe};function _fe(e,t,n){const r=this;let s,i,o;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),_):C===63?(e.consume(C),w):Yn(C)?(e.consume(C),A):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):Yn(C)?(e.consume(C),b):n(C)}function d(C){return C===45?(e.consume(C),p):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),f):Ve(C)?(o=h,j(C)):(e.consume(C),h)}function f(C){return C===45?(e.consume(C),p):h(C)}function p(C){return C===62?$(C):C===45?f(C):h(C)}function g(C){const H="CDATA[";return C===H.charCodeAt(i++)?(e.consume(C),i===H.length?v:g):n(C)}function v(C){return C===null?n(C):C===93?(e.consume(C),y):Ve(C)?(o=v,j(C)):(e.consume(C),v)}function y(C){return C===93?(e.consume(C),x):v(C)}function x(C){return C===62?$(C):C===93?(e.consume(C),x):v(C)}function b(C){return C===null||C===62?$(C):Ve(C)?(o=b,j(C)):(e.consume(C),b)}function w(C){return C===null?n(C):C===63?(e.consume(C),S):Ve(C)?(o=w,j(C)):(e.consume(C),w)}function S(C){return C===62?$(C):w(C)}function _(C){return Yn(C)?(e.consume(C),E):n(C)}function E(C){return C===45||Ln(C)?(e.consume(C),E):R(C)}function R(C){return Ve(C)?(o=R,j(C)):lt(C)?(e.consume(C),R):$(C)}function A(C){return C===45||Ln(C)?(e.consume(C),A):C===47||C===62||Mt(C)?N(C):n(C)}function N(C){return C===47?(e.consume(C),$):C===58||C===95||Yn(C)?(e.consume(C),k):Ve(C)?(o=N,j(C)):lt(C)?(e.consume(C),N):$(C)}function k(C){return C===45||C===46||C===58||C===95||Ln(C)?(e.consume(C),k):T(C)}function T(C){return C===61?(e.consume(C),I):Ve(C)?(o=T,j(C)):lt(C)?(e.consume(C),T):N(C)}function I(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),s=C,F):Ve(C)?(o=I,j(C)):lt(C)?(e.consume(C),I):(e.consume(C),L)}function F(C){return C===s?(e.consume(C),s=void 0,M):C===null?n(C):Ve(C)?(o=F,j(C)):(e.consume(C),F)}function L(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Mt(C)?N(C):(e.consume(C),L)}function M(C){return C===47||C===62||Mt(C)?N(C):n(C)}function $(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function j(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),P}function P(C){return lt(C)?vt(e,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):D(C)}function D(C){return e.enter("htmlTextData"),o(C)}}const m1={name:"labelEnd",resolveAll:Nfe,resolveTo:Cfe,tokenize:jfe},kfe={tokenize:Tfe},Sfe={tokenize:Pfe},Efe={tokenize:Afe};function Nfe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Pr(e,0,e.length,n),e}function Cfe(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Fr(l,e.slice(i+1,i+r+3)),l=Fr(l,[["enter",d,t]]),l=Fr(l,sg(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Fr(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Fr(l,e.slice(o+1)),l=Fr(l,[["exit",c,t]]),Pr(e,i,e.length,l),e}function jfe(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(f){return i?i._inactive?h(f):(o=r.parser.defined.includes(ns(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(kfe,d,o?d:h)(f):f===91?e.attempt(Sfe,d,o?u:h)(f):o?d(f):h(f)}function u(f){return e.attempt(Efe,d,h)(f)}function d(f){return t(f)}function h(f){return i._balanced=!0,n(f)}}function Tfe(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return Mt(h)?Gu(e,i)(h):i(h)}function i(h){return h===41?d(h):O4(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Mt(h)?Gu(e,c)(h):d(h)}function l(h){return n(h)}function c(h){return h===34||h===39||h===40?L4(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Mt(h)?Gu(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Pfe(e,t,n){const r=this;return s;function s(l){return D4.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(ns(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function Afe(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Ife={name:"labelStartImage",resolveAll:m1.resolveAll,tokenize:Rfe};function Rfe(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Mfe={name:"labelStartLink",resolveAll:m1.resolveAll,tokenize:Ofe};function Ofe(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Qv={name:"lineEnding",tokenize:Dfe};function Dfe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),vt(e,t,"linePrefix")}}const kf={name:"thematicBreak",tokenize:Lfe};function Lfe(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ve(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),lt(u)?vt(e,l,"whitespace")(u):l(u))}}const tr={continuation:{tokenize:Bfe},exit:zfe,name:"list",tokenize:Vfe},Ffe={partial:!0,tokenize:Hfe},$fe={partial:!0,tokenize:Ufe};function Vfe(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:j0(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(kf,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return j0(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(ph,r.interrupt?n:d,e.attempt(Ffe,f,h))}
vendor: 5,407 bytes, line 629
629function d(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function h(p){return lt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Bfe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ph,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!lt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($fe,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,vt(e,e.attempt(tr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Ufe(e,t,n){const r=this;return vt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function zfe(e){e.exit(this.containerState.type)}function Hfe(e,t,n){const r=this;return vt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!lt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const _j={name:"setextUnderline",resolveTo:Wfe,tokenize:qfe};function Wfe(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function qfe(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),lt(u)?vt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Gfe={tokenize:Kfe};function Kfe(e){const t=this,n=e.attempt(ph,r,e.attempt(this.parser.constructs.flowInitial,s,vt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Jhe,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Yfe={resolveAll:$4()},Qfe=F4("string"),Zfe=F4("text");function F4(e){return{resolveAll:$4(e==="text"?Xfe:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=s[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function $4(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function Xfe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Jfe={42:tr,43:tr,45:tr,48:tr,49:tr,50:tr,51:tr,52:tr,53:tr,54:tr,55:tr,56:tr,57:tr,62:A4},epe={91:sfe},tpe={[-2]:Yv,[-1]:Yv,32:Yv},npe={35:ufe,42:kf,45:[_j,kf],60:pfe,61:_j,95:kf,96:bj,126:bj},rpe={38:R4,92:I4},spe={[-5]:Qv,[-4]:Qv,[-3]:Qv,33:Ife,38:R4,42:T0,60:[Mhe,wfe],91:Mfe,92:[lfe,I4],93:m1,95:T0,96:Ghe},ipe={null:[T0,Yfe]},ope={null:[42,95]},ape={null:[]},lpe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ope,contentInitial:epe,disable:ape,document:Jfe,flow:npe,flowInitial:tpe,insideSpan:ipe,string:rpe,text:spe},Symbol.toStringTag,{value:"Module"}));function cpe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,c
vendor: 14,661 bytes, lines 629-631
629olumn:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:R(_),check:R(E),consume:b,enter:w,exit:S,interrupt:R(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:v,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(T){return o=Fr(o,T),y(),o[o.length-1]!==null?[]:(A(t,0),u.events=sg(i,u.events,u),u.events)}function f(T,I){return dpe(p(T),I)}function p(T){return upe(o,T)}function g(){const{_bufferIndex:T,_index:I,line:F,column:L,offset:M}=r;return{_bufferIndex:T,_index:I,line:F,column:L,offset:M}}function v(T){s[T.line]=T.column,k()}function y(){let T;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<I.length;)x(I.charCodeAt(r._bufferIndex));else x(I)}}function x(T){d=d(T)}function b(T){Ve(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,k()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=T}function w(T,I){const F=I||{};return F.type=T,F.start=g(),u.events.push(["enter",F,u]),l.push(F),F}function S(T){const I=l.pop();return I.end=g(),u.events.push(["exit",I,u]),I}function _(T,I){A(T,I.from)}function E(T,I){I.restore()}function R(T,I){return F;function F(L,M,$){let j,P,D,C;return Array.isArray(L)?V(L):"tokenize"in L?V([L]):H(L);function H(ae){return te;function te(ne){const re=ne!==null&&ae[ne],J=ne!==null&&ae.null,ge=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(J)?J:J?[J]:[]];return V(ge)(ne)}}function V(ae){return j=ae,P=0,ae.length===0?$:O(ae[P])}function O(ae){return te;function te(ne){return C=N(),D=ae,ae.partial||(u.currentConstruct=ae),ae.name&&u.parser.constructs.disable.null.includes(ae.name)?Z():ae.tokenize.call(I?Object.assign(Object.create(u),I):u,c,G,Z)(ne)}}function G(ae){return T(D,C),M}function Z(ae){return C.restore(),++P<j.length?O(j[P]):$}}}function A(T,I){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&Pr(u.events,I,u.events.length-I,T.resolve(u.events.slice(I),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function N(){const T=g(),I=u.previous,F=u.currentConstruct,L=u.events.length,M=Array.from(l);return{from:L,restore:$};function $(){r=T,u.previous=I,u.currentConstruct=F,u.events.length=L,l=M,k()}}function k(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function upe(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function dpe(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
630`;break}case-3:{o=`\r
631`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function hpe(e){const r={constructs:T4([lpe,...(e||{}).extensions||[]]),content:s(Che),defined:[],document:s(The),flow:s(Gfe),lazy:{},string:s(Qfe),text:s(Zfe)};return r;function s(i){return o;function o(l){return cpe(r,i,l)}}}function fpe(e){for(;!M4(e););return e}const kj=/[\0\t\n\r]/g;function ppe(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,d,h,f,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(kj.lastIndex=h,u=kj.exec(i),f=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(f),!u){t=i.slice(h);break}if(p===10&&h===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<f&&(c.push(i.slice(h,f)),e+=f-h),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const mpe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function gpe(e){return e.replace(mpe,vpe)}function vpe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return P4(n.slice(i?2:1),i?16:10)}return p1(n)||e}const V4={}.hasOwnProperty;function ype(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),xpe(n)(fpe(hpe(n).document().write(ppe()(e,t,!0))))}function xpe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Le),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(Be),blockQuote:i(J),characterEscape:N,characterReference:N,codeFenced:i(ge),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ge,o),codeText:i(se,o),codeTextData:N,data:N,codeFlowValue:N,definition:i(ke),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Me),hardBreakEscape:i($e),hardBreakTrailing:i($e),htmlFlow:i(We,o),htmlFlowData:N,htmlText:i(We,o),htmlTextData:N,image:i(Qt),label:o,link:i(Le),listItem:i(jn),listItemValue:f,listOrdered:i(dt,h),listUnordered:i(dt),paragraph:i(pr),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Be),strong:i(fn),thematicBreak:i(on)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:re,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ae,characterReference:te,codeFenced:c(y),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:k,codeIndented:c(x),codeText:c(M),codeTextData:k,data:k,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(F),htmlFlowData:k,htmlText:c(L),htmlTextData:k,image:c(j),label:D,labelText:P,lineEnding:T,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:G,resourceDestinationString:C,resourceTitleString:H,resource:V,setextHeading:c(A),setextHeadingLineSequence:R,setextHeadingText:E,strong:c(),thematicBreak:c()}};B4(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(X){let ce={type:"root",children:[]};const Te={stack:[ce],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},Ge=[];let B=-1;for(;++B<X.length;)if(X[B][1].type==="listOrdered"||X[B][1].type==="listUnordered")if(X[B][0]==="enter")Ge.push(B);else{const W=Ge.pop();B=s(X,W,B)}for(B=-1;++B<X.length;){const W=t[X[B][0]];V4.call(W,X[B][1].type)&&W[X[B][1].type].call(Object.assign({sliceSerialize:X[B][2].sliceSerialize},Te),X[B][1])}if(Te.tokenStack.length>0){const W=Te.tokenStack[Te.tokenStack.length-1];(W[1]||Sj).call(Te,void 0,W[0])}for(ce.position={start:Li(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:Li(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},B=-1;++B<t.transforms.length;)ce=t.transforms[B](ce)||ce;return ce}function s(X,ce,Te){let Ge=ce-1,B=-1,W=!1,Y,oe,de,be;for(;++Ge<=Te;){const fe=X[Ge];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?B++:B--,be=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(Y&&!be&&!B&&!de&&(de=Ge),be=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:be=void 0}if(!B&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||B===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(Y){let _e=Ge;for(oe=void 0;_e--;){const Oe=X[_e];if(Oe[1].type==="lineEnding"||Oe[1].type==="lineEndingBlank"){if(Oe[0]==="exit")continue;oe&&(X[oe][1].type="lineEndingBlank",W=!0),Oe[1].type="lineEnding",oe=_e}else if(!(Oe[1].type==="linePrefix"||Oe[1].type==="blockQuotePrefix"||Oe[1].type==="blockQuotePrefixWhitespace"||Oe[1].type==="blockQuoteMarker"||Oe[1].type==="listItemIndent"))break}de&&(!oe||de<oe)&&(Y._spread=!0),Y.end=Object.assign({},oe?X[oe][1].start:fe[1].end),X.splice(oe||Ge,0,["exit",Y,fe[2]]),Ge++,Te++}if(fe[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};Y=_e,X.splice(Ge,0,["enter",_e,fe[2]]),Ge++,Te++,de=void 0,be=!0}}}return X[ce][1]._spread=W,Te}function i(X,ce){return Te;function Te(Ge){l.call(this,X(Ge),Ge),ce&&ce.call(this,Ge)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(X,ce,Te){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([ce,Te||void 0]),X.position={start:Li(ce.start),end:void 0}}function c(X){return ce;function ce(Te){X&&X.call(this,Te),u.call(this,Te)}}function u(X,ce){const Te=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==X.type&&(ce?ce.call(this,X,Ge[0]):(Ge[1]||Sj).call(this,X,Ge[0]));else throw new Error("Cannot close `"+X.type+"` ("+qu({start:X.start,end:X.end})+"): it’s not open");Te.position.end=Li(X.end)}function d(){return f1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(X){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function p(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=X}function g(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=X}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.value=X.replace(/(\r?\n|\r)$/g,"")}function b(X){const ce=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ce,Te.identifier=ns(this.sliceSerialize(X)).toLowerCase()}function w(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.title=X}function S(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.url=X}function _(X){const ce=this.stack[this.stack.length-1];if(!ce.depth){const Te=this.sliceSerialize(X).length;ce.depth=Te}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function R(X){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function N(X){const Te=this.stack[this.stack.length-1].children;let Ge=Te[Te.length-1];(!Ge||Ge.type!=="text")&&(Ge=fs(),Ge.position={start:Li(X.start),end:void 0},Te.push(Ge)),this.stack.push(Ge)}function k(X){const ce=this.stack.pop();ce.value+=this.sliceSerialize(X),ce.position.end=Li(X.end)}function T(X){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=ce.children[ce.children.length-1];Te.position.end=Li(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(N.call(this,X),k.call(this,X))}function I(){this.data.atHardBreak=!0}function F(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.value=X}function L(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.value=X}function M(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.value=X}function $(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ce,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function j(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ce,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function P(X){const ce=this.sliceSerialize(X),Te=this.stack[this.stack.length-2];Te.label=gpe(ce),Te.identifier=ns(ce).toLowerCase()}function D(){const X=this.stack[this.stack.length-1],ce=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Ge=X.children;Te.children=Ge}else Te.alt=ce}function C(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.url=X}function H(){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.title=X}function V(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function G(X){const ce=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ce,Te.identifier=ns(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function Z(X){this.data.characterReferenceType=X.type}function ae(X){const ce=this.sliceSerialize(X),Te=this.data.characterReferenceType;let Ge;Te?(Ge=P4(ce,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=p1(ce);const B=this.stack[this.stack.length-1];B.value+=Ge}function te(X){const ce=this.stack.pop();ce.position.end=Li(X.end)}function ne(X){k.call(this,X);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(X)}function re(X){k.call(this,X);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(X)}function J(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function se(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function $e(){return{type:"break"}}function We(){return{type:"html",value:""}}function Qt(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function dt(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function jn(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function pr(){return{type:"paragraph",children:[]}}function fn(){return{type:"strong",children:[]}}function fs(){return{type:"text",value:""}}function on(){return{type:"thematicBreak"}}}function Li(e){return{line:e.line,column:e.column,offset:e.offset}}function B4(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?B4(e,r):bpe(e,r)}}function bpe(e,t){let n;for(n in t)if(V4.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Sj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qu({start:t.start,end:t.end}
vendor: 4,533 bytes, lines 631-635
631)+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qu({start:t.start,end:t.end})+") is still open")}function wpe(e){const t=this;t.parser=n;function n(r){return ype(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _pe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function kpe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
632`}]}function Spe(e,t){const n=t.value?t.value+`
633`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Epe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Npe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cpe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ac(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function jpe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tpe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function U4(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function Ppe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return U4(e,t);const s={src:Ac(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function Ape(e,t){const n={src:Ac(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Ipe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Rpe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return U4(e,t);const s={href:Ac(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Mpe(e,t){const n={href:Ac(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ope(e,t,n){const r=e.all(t),s=n?Dpe(n):z4(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
634`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
635`});const u={type:"element",tagName:"li",properties:i,children:o};
vendor: 3,267 bytes, line 635
635return e.patch(t,u),e.applyData(t,u)}function Dpe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=z4(n[r])}return t}function z4(e){const t=e.spread;return t??e.children.length>1}function Lpe(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Fpe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $pe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Vpe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bpe(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=c1(t.children[1]),c=_4(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Upe(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const h=t.children[c],f={},p=o?o[c]:void 0;p&&(f.align=p);let g={type:"element",tagName:i,properties:f,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function zpe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ej=9,Nj=32;function Hpe(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Cj(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Cj(t.slice(s),s>0,!1)),i.join("")}function Cj(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Ej||i===Nj;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Ej||i===Nj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Wpe(e,t){const n={type:"text",value:Hpe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function qpe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Gpe={blockquote:_pe,break:kpe,code:Spe,delete:Epe,emphasis:Npe,footnoteReference:Cpe,heading:jpe,html:Tpe,imageReference:Ppe,image:Ape,inlineCode:Ipe,linkReference:Rpe,link:Mpe,listItem:Ope,list:Lpe,paragraph:Fpe,root:$pe,strong:Vpe,table:Bpe,tableCell:zpe,tableRow:Upe,text:Wpe,thematicBreak:qpe,toml:qh,yaml:qh,definition:qh,footnoteDefinition:qh};function qh(){}const H4=-1,ig=0,Ku=1,zp=2,g1=3,v1=4,y1=5,x1=6,W4=7,q4=8,Kpe=typeof self=="object"?self:globalThis,jj=(e,t)=>
vendor: 5,760 bytes, lines 635-637
635{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Kpe[e](t)},Ype=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case ig:case H4:return n(o,s);case Ku:{const l=n([],s);for(const c of o)l.push(r(c));return l}case zp:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case g1:return n(new Date(o),s);case v1:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case y1:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case x1:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case W4:{const{name:l,message:c}=o;return n(jj(l,c),s)}case q4:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(jj(i,o),s)};return r},Tj=e=>Ype(new Map,e)(0),Xo="",{toString:Qpe}={},{keys:Zpe}=Object,lu=e=>{const t=typeof e;if(t!=="object"||!e)return[ig,t];const n=Qpe.call(e).slice(8,-1);switch(n){case"Array":return[Ku,Xo];case"Object":return[zp,Xo];case"Date":return[g1,Xo];case"RegExp":return[v1,Xo];case"Map":return[y1,Xo];case"Set":return[x1,Xo];case"DataView":return[Ku,n]}return n.includes("Array")?[Ku,n]:n.includes("Error")?[W4,n]:[zp,n]},Gh=([e,t])=>e===ig&&(t==="function"||t==="symbol"),Xpe=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=lu(o);switch(l){case ig:{let d=o;switch(c){case"bigint":l=q4,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([H4],o)}return s([l,d],o)}case Ku:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),s([c,[...f]],o)}const d=[],h=s([l,d],o);for(const f of o)d.push(i(f));return h}case zp:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=s([l,d],o);for(const f of Zpe(o))(e||!Gh(lu(o[f])))&&d.push([i(f),i(o[f])]);return h}case g1:return s([l,isNaN(o.getTime())?Xo:o.toISOString()],o);case v1:{const{source:d,flags:h}=o;return s([l,{source:d,flags:h}],o)}case y1:{const d=[],h=s([l,d],o);for(const[f,p]of o)(e||!(Gh(lu(f))||Gh(lu(p))))&&d.push([i(f),i(p)]);return h}case x1:{const d=[],h=s([l,d],o);for(const f of o)(e||!Gh(lu(f)))&&d.push(i(f));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},Pj=(e,{json:t,lossy:n}={})=>{const r=[];return Xpe(!(t||n),!!t,new Map,r)(e),r},Hp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Tj(Pj(e,t)):structuredClone(e):(e,t)=>Tj(Pj(e,t));function Jpe(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function eme(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function tme(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Jpe,r=e.options.footnoteBackLabel||eme,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),f=Ac(h.toLowerCase());let p=0;const g=[],v=e.footnoteCounts.get(h);for(;v!==void 0&&++p<=v;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,p);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const b=y.children[y.children.length-1];b&&b.type==="text"?b.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Hp(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
636`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
637`}]}}const og=function(e){if(e==null)return ime;if(typeof e=="function")return ag(e);if(typeof e=="object")return Array.isArray(e)?nme(e):rme(e);if(typeof e=="string")return sme(e);throw new Error("Expected function, string, or object as test")};function nme(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=og(e[n]);return ag(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function rme(e){const t=e;return ag(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function sme(e){return ag(t);function t(n){return n&&n.type===e}}function ag(e){return t;function t(n,r,s){return!!(ome(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function ime(){return!0}function ome(e){return e!==null&&typeof e=="object"&&"type"in e}const G4=[],ame=!0,P0=!1,lme="skip";function K4(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=og(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;
vendor: 16,999 bytes, lines 637-641
637Object.defineProperty(f,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=G4,g,v,y;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=cme(n(c,d)),p[0]===P0))return p;if("children"in c&&c.children){const x=c;if(x.children&&p[0]!==lme)for(v=(r?x.children.length:-1)+o,y=d.concat(x);v>-1&&v<x.children.length;){const b=x.children[v];if(g=l(b,v,y)(),g[0]===P0)return g;v=typeof g[1]=="number"?g[1]:v+o}}return p}}}function cme(e){return Array.isArray(e)?e:typeof e=="number"?[ame,e]:e==null?G4:[e]}function b1(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),K4(e,i,l,s);function l(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const A0={}.hasOwnProperty,ume={};function dme(e,t){const n=t||ume,r=new Map,s=new Map,i=new Map,o={...Gpe,...n.handlers},l={all:u,applyData:fme,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:hme,wrap:mme};return b1(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:s,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),l;function c(d,h){const f=d.type,p=l.handlers[f];if(A0.call(l.handlers,f)&&p)return p(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:v,...y}=d,x=Hp(y);return x.children=l.all(d),x}return Hp(d)}return(l.options.unknownHandler||pme)(l,d,h)}function u(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const g=l.one(f[p],d);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Aj(g.value)),!Array.isArray(g)&&g.type==="element")){const v=g.children[0];v&&v.type==="text"&&(v.value=Aj(v.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function hme(e,t){e.position&&(t.position=Jde(e))}function fme(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Hp(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function pme(e,t){const n=t.data||{},r="value"in t&&!(A0.call(n,"hProperties")||A0.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function mme(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
638`});++r<e.length;)r&&n.push({type:"text",value:`
639`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
640`}),n}function Aj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ij(e,t){const n=dme(e,t),r=n.one(e,void 0),s=tme(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
641`},s),i}function gme(e,t){return e&&"run"in e?async function(n,r){const s=Ij(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Ij(n,{file:r,...e||t})}}function Rj(e){if(e)throw e}var Sf=Object.prototype.hasOwnProperty,Y4=Object.prototype.toString,Mj=Object.defineProperty,Oj=Object.getOwnPropertyDescriptor,Dj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Y4.call(t)==="[object Array]"},Lj=function(t){if(!t||Y4.call(t)!=="[object Object]")return!1;var n=Sf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Sf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Sf.call(t,s)},Fj=function(t,n){Mj&&n.name==="__proto__"?Mj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},$j=function(t,n){if(n==="__proto__")if(Sf.call(t,n)){if(Oj)return Oj(t,n).value}else return;return t[n]},vme=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=$j(l,n),s=$j(t,n),l!==s&&(d&&s&&(Lj(s)||(i=Dj(s)))?(i?(i=!1,o=r&&Dj(r)?r:[]):o=r&&Lj(r)?r:{},Fj(l,{name:n,newValue:e(d,o,s)})):typeof s<"u"&&Fj(l,{name:n,newValue:s}));return l};const Zv=H0(vme);function I0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function yme(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<s.length;)(u[h]===null||u[h]===void 0)&&(u[h]=s[h]);s=u,d?xme(d,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function xme(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const ys={basename:bme,dirname:wme,extname:_me,join:kme,sep:"/"};function bme(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');mh(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function wme(e){if(mh(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function _me(e){mh(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function kme(...e){let t=-1,n;for(;++t<e.length;)mh(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Sme(n)}function Sme(e){mh(e);const t=e.codePointAt(0)===47;let n=Eme(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Eme(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function mh(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Nme={cwd:Cme};function Cme(){return"/"}function R0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jme(e){if(typeof e=="string")e=new URL(e);else if(!R0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Tme(e)}function Tme(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Xv=["history","path","basename","stem","extname","dirname"];class Q4{constructor(t){let n;t?R0(t)?n={path:t}:typeof t=="string"||Pme(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Nme.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Xv.length;){const i=Xv[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Xv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ys.basename(this.path):void 0}set basename(t){ey(t,"basename"),Jv(t,"basename"),this.path=ys.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ys.dirname(this.path):void 0}set dirname(t){Vj(this.basename,"dirname"),this.path=ys.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ys.extname(this.path):void 0}set extname(t){if(Jv(t,"extname"),Vj(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ys.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){R0(t)&&(t=jme(t)),ey(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ys.basename(this.path,this.extname):void 0}set stem(t){ey(t,"stem"),Jv(t,"stem"),this.path=ys.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Fn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Jv(e,t){if(e&&e.includes(ys.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ys.sep+"`")}function ey(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Vj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Pme(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ame=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},Ime={}.hasOwnProperty;class w1 extends Ame{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=yme()}copy(){const t=new w1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Zv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ry("data",this.frozen),this.namespace[t]=n,this):Ime.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ry("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Kh(t),r=this.parser||this.Parser;return ty("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ty("process",this.parser||this.Parser),ny("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=Kh(t),c=r.parse(l);r.run(c,l,function(d,h,f){if(d||!h||!f)return u(d);const p=h,g=r.stringify(p,f);Ome(g)?f.value=g:f.result=g,u(d,f)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),ty("processSync",this.parser||this.Parser),ny("processSync",this.compiler||this.Compiler),this.process(t,s),Uj("processSync","process",n),r;function s(i,o){n=!0,Rj(i),r=o}}run(t,n,r){Bj(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=Kh(n);s.run(t,c,u);function u(d,h,f){const p=h||t;d?l(d):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),Uj("runSync","run",r),s;function i(o,l){Rj(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=Kh(n),s=this.compiler||this.Compiler;return ny("stringify",s),Bj(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(ry("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=Zv(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===u){f=h;break}if(f===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const v=r[f][1];I0(v)&&I0(p)&&(p=Zv(!0,v,p)),r[f]=[u,p,...g]}}}}const Rme=new w1().freeze();function ty(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ny(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ry(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Bj(e){if(!I0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Uj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Kh(e){return Mme(e)?e:new Q4(e)}function Mme(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Ome(e){return typeof e=="string"||Dme(e)}function Dme(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Lme="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zj=[],Hj={allowDangerousHtml:!0},Fme=/^(https?|ircs?|mailto|xmpp)$/i,$me=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Z4(e){const t=Vme(e),n=Bme(e);return Ume(t.runSync(t.parse(n),n),e)}function Vme(e){const t=e.rehypePlugins||zj,n=e.remarkPlugins||zj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hj}:Hj;return Rme().use(wpe).use(n).use(gme,r).use(t)}function Bme(e){const t=e.children||"",n=new Q4;return typeof t=="string"&&(n.value=t),n}function Ume(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||zme;for(const d of $me)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Lme+d.id,void 0);return b1(e,u),she(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Kv)if(Object.hasOwn(Kv,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],v=Kv[p];
vendor: 6,857 bytes, lines 641-642
641(v===null||v.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function zme(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Fme.test(e.slice(0,t))?e:""}function Wj(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function Hme(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Wme(e,t,n){const s=og((n||{}).ignore||[]),i=qme(t);let o=-1;for(;++o<i.length;)K4(e,"text",l);function l(u,d){let h=-1,f;for(;++h<d.length;){const p=d[h],g=f?f.children:void 0;if(s(p,g?g.indexOf(p):void 0,f))return;f=p}if(f)return c(u,d)}function c(u,d){const h=d[d.length-1],f=i[o][0],p=i[o][1];let g=0;const y=h.children.indexOf(u);let x=!1,b=[];f.lastIndex=0;let w=f.exec(u.value);for(;w;){const S=w.index,_={index:w.index,input:w.input,stack:[...d,u]};let E=p(...w,_);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?f.lastIndex=S+1:(g!==S&&b.push({type:"text",value:u.value.slice(g,S)}),Array.isArray(E)?b.push(...E):E&&b.push(E),g=S+w[0].length,x=!0),!f.global)break;w=f.exec(u.value)}return x?(g<u.value.length&&b.push({type:"text",value:u.value.slice(g)}),h.children.splice(y,1,...b)):b=[u],y+b.length}}function qme(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([Gme(s[0]),Kme(s[1])])}return t}function Gme(e){return typeof e=="string"?new RegExp(Hme(e),"g"):e}function Kme(e){return typeof e=="function"?e:function(){return e}}const sy="phrasing",iy=["autolink","link","image","label"];function Yme(){return{transforms:[nge],enter:{literalAutolink:Zme,literalAutolinkEmail:oy,literalAutolinkHttp:oy,literalAutolinkWww:oy},exit:{literalAutolink:tge,literalAutolinkEmail:ege,literalAutolinkHttp:Xme,literalAutolinkWww:Jme}}}function Qme(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sy,notInConstruct:iy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sy,notInConstruct:iy},{character:":",before:"[ps]",after:"\\/",inConstruct:sy,notInConstruct:iy}]}}function Zme(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function oy(e){this.config.enter.autolinkProtocol.call(this,e)}function Xme(e){this.config.exit.autolinkProtocol.call(this,e)}function Jme(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function ege(e){this.config.exit.autolinkEmail.call(this,e)}function tge(e){this.exit(e)}function nge(e){Wme(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,rge],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),sge]],{ignore:["link","linkReference"]})}function rge(e,t,n,r,s){let i="";if(!X4(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!ige(n)))return!1;const o=oge(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function sge(e,t,n,r){return!X4(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ige(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function oge(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=Wj(e,"(");let i=Wj(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function X4(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Aa(n)||rg(n))&&(!t||n!==47)}J4.peek=mge;function age(){this.buffer()}function lge(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function cge(){this.buffer()}function uge(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function dge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ns(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hge(e){this.exit(e)}function fge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ns(this.sliceSerialize(e)).toLowerCase(),n.label=t}function pge(e){this.exit(e)}function mge(){return"["}function J4(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function gge(){return{enter:{gfmFootnoteCallString:age,gfmFootnoteCall:lge,gfmFootnoteDefinitionLabelString:cge,gfmFootnoteDefinition:uge},exit:{gfmFootnoteCallString:dge,gfmFootnoteCall:hge,gfmFootnoteDefinitionLabelString:fge,gfmFootnoteDefinition:pge}}}function vge(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:J4},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
642`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?e3:yge))),u(),c}}function yge(e,t,n){return t===0?e:e3(e,t,n)}function e3(e,t,n){return(n?"":"    ")+e}const xge=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];t3.peek=Sge;function bge(){return{canContainEols:["delete"],enter:{strikethrough:_ge},exit:{strikethrough:kge}}}function wge(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xge}],handlers:{delete:t3}}}function _ge(e){this.enter({type:"delete",children:[]},e)}function kge(e){this.exit(e)}function t3(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function Sge(){return"~"}function Ege(e){return e.length}function Nge(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Ege,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const v=[],y=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const b=Cge(e[d][x]);if(n.alignDelimiters!==!1){const w=s(b);y[x]=w,(c[x]===void 0||w>c[x])&&(c[x]=w)}
vendor: 10,968 bytes, lines 642-654
642v.push(b)}o[d]=v,l[d]=y}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)i[h]=qj(r[h]);else{const v=qj(r);for(;++h<u;)i[h]=v}h=-1;const f=[],p=[];for(;++h<u;){const v=i[h];let y="",x="";v===99?(y=":",x=":"):v===108?y=":":v===114&&(x=":");let b=n.alignDelimiters===!1?1:Math.max(1,c[h]-y.length-x.length);const w=y+"-".repeat(b)+x;n.alignDelimiters!==!1&&(b=y.length+b+x.length,b>c[h]&&(c[h]=b),p[h]=b),f[h]=w}o.splice(1,0,f),l.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const v=o[d],y=l[d];h=-1;const x=[];for(;++h<u;){const b=v[h]||"";let w="",S="";if(n.alignDelimiters!==!1){const _=c[h]-(y[h]||0),E=i[h];E===114?w=" ".repeat(_):E===99?_%2?(w=" ".repeat(_/2+.5),S=" ".repeat(_/2-.5)):(w=" ".repeat(_/2),S=w):S=" ".repeat(_)}n.delimiterStart!==!1&&!h&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(w),x.push(b),n.alignDelimiters!==!1&&x.push(S),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
643`)}function Cge(e){return e==null?"":String(e)}function qj(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function jge(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),Tge);return s(),o}function Tge(e,t,n){return">"+(n?"":" ")+e}function Pge(e,t){return Gj(e,t.inConstruct,!0)&&!Gj(e,t.notInConstruct,!1)}function Gj(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Kj(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
644`&&Pge(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
645`}function Age(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function Ige(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Rge(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Mge(e,t,n,r){const s=Rge(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(Ige(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(i,Oge);return h(),f}const l=n.createTracker(r),c=s.repeat(Math.max(Age(i,s)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
646`,encode:["`"],...l.current()})),h()}return d+=l.move(`
647`),i&&(d+=l.move(i+`
648`)),d+=l.move(c),u(),d}function Oge(e,t,n){return(n?"":"    ")+e}function _1(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Dge(e,t,n,r){const s=_1(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
649`,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function Lge(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Id(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Wp(e,t,n){const r=vc(e),s=vc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}n3.peek=Fge;function n3(e,t,n,r){const s=Lge(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=Wp(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Id(u)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Wp(r.after.charCodeAt(0),h,s);f.inside&&(c=c.slice(0,-1)+Id(h));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+c+p}function Fge(e,t,n){return n.options.emphasis||"*"}function $ge(e,t){let n=!1;return b1(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,P0}),!!((!e.depth||e.depth<3)&&f1(e)&&(t.options.setext||n))}function Vge(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if($ge(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
650`,after:`
651`});return h(),d(),f+`
652`+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
653`))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
654`,...i.current()});return/^[\t ]/.test(u)&&(u=Id(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}r3.peek=Bge;function r3(e){return e.value||""}function Bge(){return"<"}s3.peek=Uge;function s3(e,t,n,r){const s=_1(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function Uge(){return"!"}i3.peek=zge;function i3(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function zge(){return"!"}o3.peek=Hge;function o3(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function Hge(){return"`"}function a3(e,t){const n=f1(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}l3.peek=Wge;function l3(e,t,n,r){const s=_1(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(a3(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),n.stack=d,h}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function Wge(e,t,n){return a3(e,n)?"<":"["}c3.peek=qge;function c3(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function qge(){return"["}function k1(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Gge(e){const t=k1(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Kge(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function u3(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Yge(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?Kge(n):k1(n);const l=e.ordered?o==="."?")":".":Gge(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),u3(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function Qge(e){const t=e.options.listItemIndent||"one";
vendor: 6,319 bytes, lines 654-656
654if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Zge(e,t,n,r){const s=Qge(n);let i=n.bulletCurrent||k1(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(h,f,p){return f?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function Xge(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const Jge=og(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function eve(e,t,n,r){return(e.children.some(function(o){return Jge(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tve(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}d3.peek=nve;function d3(e,t,n,r){const s=tve(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=Wp(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Id(u)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Wp(r.after.charCodeAt(0),h,s);f.inside&&(c=c.slice(0,-1)+Id(h));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+c+p}function nve(e,t,n){return n.options.strong||"*"}function rve(e,t,n,r){return n.safe(e.value,r)}function sve(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ive(e,t,n){const r=(u3(n)+(n.options.ruleSpaces?" ":"")).repeat(sve(n));return n.options.ruleSpaces?r.slice(0,-1):r}const h3={blockquote:jge,break:Kj,code:Mge,definition:Dge,emphasis:n3,hardBreak:Kj,heading:Vge,html:r3,image:s3,imageReference:i3,inlineCode:o3,link:l3,linkReference:c3,list:Yge,listItem:Zge,paragraph:Xge,root:eve,strong:d3,text:rve,thematicBreak:ive};function ove(){return{enter:{table:ave,tableData:Yj,tableHeader:Yj,tableRow:cve},exit:{codeText:uve,table:lve,tableData:ay,tableHeader:ay,tableRow:ay}}}function ave(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function lve(e){this.exit(e),this.data.inTable=void 0}function cve(e){this.enter({type:"tableRow",children:[]},e)}function ay(e){this.exit(e)}function Yj(e){this.enter({type:"tableCell",children:[]},e)}function uve(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dve));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function dve(e,t){return t==="|"?t:e}function hve(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
655`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:l}};function o(p,g,v,y){return u(d(p,v,y),p.align)}function l(p,g,v,y){const x=h(p,v,y),b=u([x]);return b.slice(0,b.indexOf(`
656`))}function c(p,g,v,y){const x=v.enter("tableCell"),b=v.enter("phrasing"),w=v.containerPhrasing(p,{...y,before:i,after:i});return b(),x(),w}function u(p,g){return Nge(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function d(p,g,v){const y=p.children;let x=-1;const b=[],w=g.enter("table");for(;++x<y.length;)b[x]=h(y[x],g,v);return w(),b}function h(p,g,v){const y=p.children;let x=-1;const b=[],w=g.enter("tableRow");for(;++x<y.length;)b[x]=c(y[x],p,g,v);return w(),b}function f(p,g,v){let y=h3.inlineCode(p,g,v);return v.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function fve(){return{exit:{taskListCheckValueChecked:Qj,taskListCheckValueUnchecked:Qj,paragraph:mve}}}function pve(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gve}}}function Qj(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function mve(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function gve(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=h3.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function vve(){return[Yme(),gge(),bge(),ove(),fve()]}function yve(e){return{extensions:[Qme(),vge(e),wge(),hve(e),pve()]}}const xve={tokenize:Eve,partial:!0},f3={tokenize:Nve,partial:!0},p3={tokenize:Cve,partial:!0},m3={tokenize:jve,partial:!0},bve={tokenize:Tve,partial:!0},g3={name:"wwwAutolink",tokenize:kve,previous:y3},v3={name:"protocolAutolink",tokenize:Sve,previous:x3},Ti={name:"emailAutolink",tokenize:_ve,previous:b3},Hs={};function wve(){return{text:Hs}}let Ho=48;for(;Ho<123;)Hs[Ho]=Ti,Ho++,Ho===58?Ho=65:Ho===91&&(Ho=97);Hs[43]=Ti;Hs[45]=Ti;Hs[46]=Ti;Hs[95]=Ti;Hs[72]=[Ti,v3];Hs[104]=[Ti,v3];Hs[87]=[Ti,g3];Hs[119]=[Ti,g3];function _ve(e,t,n){const r=this;let s,i;return o;function o(h){return!M0(h)||!b3.call(r,r.previous)||S1(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(h))}
vendor: 9,044 bytes, line 656
656function l(h){return M0(h)?(e.consume(h),l):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(bve,d,u)(h):h===45||h===95||Ln(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),s=!0,c}function d(h){return i&&s&&Yn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function kve(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!y3.call(r,r.previous)||S1(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(xve,e.attempt(f3,e.attempt(p3,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Sve(e,t,n){const r=this;let s="",i=!1;return o;function o(h){return(h===72||h===104)&&x3.call(r,r.previous)&&!S1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),e.consume(h),l):n(h)}function l(h){if(Yn(h)&&s.length<5)return s+=String.fromCodePoint(h),e.consume(h),l;if(h===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||Up(h)||Mt(h)||Aa(h)||rg(h)?n(h):e.attempt(f3,e.attempt(p3,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Eve(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function Nve(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(m3,c,l)(u):u===null||Mt(u)||Aa(u)||u!==45&&rg(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function Cve(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(m3,t,i)(o):o===null||Mt(o)||Aa(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function jve(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Mt(l)||Aa(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||Mt(l)||Aa(l)?t(l):r(l)}function i(l){return Yn(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):Yn(l)?(e.consume(l),o):n(l)}}function Tve(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Ln(i)?n(i):t(i)}}function y3(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Mt(e)}function x3(e){return!Yn(e)}function b3(e){return!(e===47||M0(e))}function M0(e){return e===43||e===45||e===46||e===95||Ln(e)}function S1(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Pve={tokenize:Fve,partial:!0};function Ave(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ove,continuation:{tokenize:Dve},exit:Lve}},text:{91:{name:"gfmFootnoteCall",tokenize:Mve},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ive,resolveTo:Rve}}}}function Ive(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=ns(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Rve(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function Mve(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||Mt(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(ns(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Mt(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function Ove(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Mt(g))return n(g);if(g===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return i=ns(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Mt(g)||(l=!0),o++,e.consume(g),g===92?h:d}function h(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),vt(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function Dve(e,t,n){return e.check(ph,t,e.attempt(Pve,t,n))}function Lve(e){e.exit("gfmFootnoteDefinition")}function Fve(e,t,n){const r=this;return vt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function $ve(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},f=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",h,l]],p=l.parser.constructs.insideSpan.null;p&&Pr(f,f.length,0,sg(p,o.slice(u+1,c),l)),Pr(f,f.length,0,[["exit",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),Pr(o,u-1,c-u+3,f),c=u+f.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,d=this.events;let h=0;return f;function f(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const v=vc(u);if(g===126)return h>1?c(g):(o.consume(g),h++,p);if(h<2&&!n)return c(g);const y=o.exit("strikethroughSequenceTemporary"),x=vc(g);return y._open=!x||x===2&&!!v,y._close=!v||v===2&&!!x,l(g)}}}class Vve{constructor(){this.map=[]}add(t,n,r){Bve(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];
vendor: 5,162 bytes, line 656
656r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function Bve(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function Uve(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function zve(){return{flow:{null:{name:"table",tokenize:Hve,resolveAll:Wve}}}}function Hve(e,t,n){const r=this;let s=0,i=0,o;return l;function l(k){let T=r.events.length-1;for(;T>-1;){const L=r.events[T][1].type;if(L==="lineEnding"||L==="linePrefix")T--;else break}const I=T>-1?r.events[T][1].type:null,F=I==="tableHead"||I==="tableRow"?E:c;return F===E&&r.parser.lazy[r.now().line]?n(k):F(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(o=!0,i+=1),d(k)}function d(k){return k===null?n(k):Ve(k)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),p):n(k):lt(k)?vt(e,d,"whitespace")(k):(i+=1,o&&(o=!1,s+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(k)))}function h(k){return k===null||k===124||Mt(k)?(e.exit("data"),d(k)):(e.consume(k),k===92?f:h)}function f(k){return k===92||k===124?(e.consume(k),h):h(k)}function p(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(k):(e.enter("tableDelimiterRow"),o=!1,lt(k)?vt(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?y(k):k===124?(o=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),v):_(k)}function v(k){return lt(k)?vt(e,y,"whitespace")(k):y(k)}function y(k){return k===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),x):k===45?(i+=1,x(k)):k===null||Ve(k)?S(k):_(k)}function x(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):_(k)}function b(k){return k===45?(e.consume(k),b):k===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(k))}function w(k){return lt(k)?vt(e,S,"whitespace")(k):S(k)}function S(k){return k===124?g(k):k===null||Ve(k)?!o||s!==i?_(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):_(k)}function _(k){return n(k)}function E(k){return e.enter("tableRow"),R(k)}function R(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),R):k===null||Ve(k)?(e.exit("tableRow"),t(k)):lt(k)?vt(e,R,"whitespace")(k):(e.enter("data"),A(k))}function A(k){return k===null||k===124||Mt(k)?(e.exit("data"),R(k)):(e.consume(k),k===92?N:A)}function N(k){return k===92||k===124?(e.consume(k),A):A(k)}}function Wve(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,h;const f=new Vve;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(Zj(f,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])),s=g.type==="tableDelimiterRow"?2:d?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=Yh(f,t,i,s,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],h=Yh(f,t,i,s,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=Yh(f,t,i,s,n,h)):o[1]!==0&&(h=Yh(f,t,o,s,n,h)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Zj(f,t,c,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Uve(t.events,n))}return e}function Yh(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},hl(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=hl(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=hl(t.events,n[2]),d=hl(t.events,n[3]),h={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,v=n[3]-n[2]-1;e.add(g,v,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return s!==void 0&&(i.end=Object.assign({},hl(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}
656function Zj(e,t,n,r,s){const i=[],o=hl(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function hl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const qve={name:"tasklistCheck",tokenize:Kve};function Gve(){return{text:{91:qve}}}function Kve(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Mt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ve(c)?t(c):lt(c)?e.check({tokenize:Yve},t,n)(c):n(c)}}function Yve(e,t,n){return vt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function Qve(e){return T4([wve(),Ave(),$ve(e),zve(),Gve()])}const Zve={};function w3(e){const t=this,n=e||Zve,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(Qve(n)),i.push(vve()),o.push(yve(n))}function Xve({number:e,citation:t,onSelect:n}){return a.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(e),"aria-label":`Source ${e}: ${t.title}`,className:q("relative mx-px inline-flex cursor-pointer items-center rounded-sm px-0.5 align-super","text-[10px] font-semibold leading-none","text-primary/70 transition-colors hover:bg-primary/10 hover:text-primary","before:absolute before:-inset-2.5 before:content-['']"),children:["[",e,"]"]})}function Jve(e,t){const n=e.matchAll(/\[(\d+(?:\s*,\s*\d+)*)\]/g),r=new Set;for(const s of n){const i=s[1].split(/\s*,\s*/);for(const o of i){const l=parseInt(o,10);t[l]&&r.add(l)}}return Array.from(r).sort((s,i)=>s-i)}const eye={kb:gH,"web-trusted":nR,"web-other":gx},tye={kb:"Knowledge Base","web-trusted":"Trusted Source","web-other":"Web Source"};function nye({citations:e,messageText:t,expanded:n,onExpandedChange:r,highlightNum:s}){const i=Jve(t,e),o=m.useRef(new Map);return m.useEffect(()=>{var l;n&&s!=null&&((l=o.current.get(s))==null||l.scrollIntoView({behavior:"smooth",block:"nearest"}))},[n,s]),i.length===0?null:a.jsxs("div",{className:"mt-2",children:[a.jsxs("button",{type:"button",onClick:()=>r(!n),"aria-expanded":n,className:q("inline-flex items-center gap-1.5 text-xs font-medium transition-colors rounded-md px-2.5 py-1.5","text-muted-foreground hover:text-foreground hover:bg-muted/60"),children:[a.jsx(gx,{className:"h-3 w-3"}),i.length," ",i.length===1?"source":"sources"]}),n&&a.jsx("div",{className:"mt-1.5 rounded-lg border bg-muted/30 p-2 space-y-1.5 md:max-h-48 md:overflow-y-auto",children:i.map(l=>{const c=e[l];if(!c)return null;const u=eye[c.chipColor]??gx,d=tye[c.chipColor]??"Source",h=s===l;return a.jsxs("div",{ref:f=>{f?o.current.set(l,f):o.current.delete(l)},className:q("flex items-start gap-2 text-xs rounded-md px-1.5 py-1 transition-colors",h&&"bg-primary/10 ring-1 ring-primary/40"),children:[a.jsxs("span",{className:"shrink-0 mt-0.5 text-muted-foreground font-mono text-[10px] w-4 text-right",children:["[",l,"]"]}),a.jsx(u,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground leading-tight truncate",children:c.title}),a.jsxs("p",{className:"text-muted-foreground truncate",children:[c.source," · ",d]}),c.citation&&a.jsx("p",{className:"italic text-muted-foreground line-clamp-2 mt-0.5",children:c.citation})]}),c.url&&a.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer","aria-label":`Open source ${l}: ${c.title}`,className:"shrink-0 mt-0.5 p-1 -m-1 text-muted-foreground hover:text-primary transition-colors",children:a.jsx(Cl,{className:"h-3.5 w-3.5"})})]},l)})})]})}function rye({suggestions:e,onSelect:t,onUpgradeClick:n,disabled:r=!1}){if(r||e.length===0)return null;const s=Io();return a.jsx("div",{className:`mt-3 flex flex-row flex-wrap gap-2 ${s?"flex-col w-full":""}`,"aria-label":"Follow-up suggestions",children:e.map(i=>a.jsxs(ie,{variant:"outline",size:"sm",className:q("h-auto justify-start gap-1.5 whitespace-normal py-1.5 px-2 text-left text-[0.70rem] transition-colors max-w-full",i.requiresUpgrade?"font-normal text-amber-700 dark:text-amber-400 border-amber-300/60 dark:border-amber-800/60 bg-amber-50/50 dark:bg-amber-950/20 hover:bg-amber-50 dark:hover:bg-amber-950/40":i.kind==="action"?"font-semibold text-teal-700 dark:text-teal-400 border-teal-300/60 dark:border-teal-800/60 bg-teal-50/50 dark:bg-teal-950/20 hover:bg-teal-50 dark:hover:bg-teal-950/40":"font-normal text-foreground hover:text-foreground hover:bg-muted/60"),onClick:()=>i.requiresUpgrade?n==null?void 0:n():t(i.text),children:[i.requiresUpgrade?a.jsx(Cr,{className:"h-3 w-3 shrink-0 text-amber-500"}):i.kind==="action"?a.jsx(ts,{className:"h-3 w-3 shrink-0 text-teal-600 dar
656k:text-teal-400"}):null,a.jsx("span",{children:i.text})]},i.text))})}function sye(e){let t=-1;for(let s=0;s<e.length;s++){const i=e[s];typeof i.type=="string"&&i.type.startsWith("tool-")&&(t=s)}if(t===-1)return e.filter(s=>s.type==="text").map(s=>s.text).join("");let n=-1;for(let s=t+1;s<e.length;s++)if(e[s].type==="step-start"){n=s;break}const r=n!==-1?n:t;return e.slice(r+1).filter(s=>s.type==="text").map(s=>s.text).join("")}function iye(){return a.jsx("span",{className:"inline-block w-[3px] h-[14px] bg-current opacity-80 rounded-sm align-text-bottom ml-0.5",style:{animation:"cursor-blink 1s steps(2) infinite"}})}function oye(){return a.jsx("span",{className:"inline-flex items-center gap-0.5 h-4","aria-label":"Loading",children:[0,1,2].map(e=>a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current opacity-60",style:{animation:`pulse 1.2s ease-in-out ${e*.2}s infinite`}},e))})}function Xj(e,t,n){return e.split(/(\[\d+(?:\s*,\s*\d+)*\])/g).flatMap((s,i)=>{const o=s.match(/^\[(\d+(?:\s*,\s*\d+)*)\]$/);return o?o[1].split(/\s*,\s*/).map(Number).map((c,u)=>{const d=t[c];return d?a.jsx(Xve,{number:c,citation:d,onSelect:n},`${i}-${u}`):null}):[s]})}const _3=({href:e,children:t})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80 break-all [overflow-wrap:anywhere]",children:t}),aye={h1:({children:e})=>a.jsx("p",{className:"font-bold text-sm mt-3 mb-1 text-inherit",children:e}),h2:({children:e})=>a.jsx("p",{className:"font-bold text-sm mt-3 mb-1 text-inherit",children:e}),h3:({children:e})=>a.jsx("p",{className:"font-semibold text-sm mt-2 mb-1 text-inherit",children:e}),h4:({children:e})=>a.jsx("p",{className:"font-semibold text-sm mt-2 mb-1 text-inherit",children:e}),h5:({children:e})=>a.jsx("p",{className:"font-medium text-sm mt-1.5 mb-0.5 text-inherit",children:e}),h6:({children:e})=>a.jsx("p",{className:"font-medium text-sm mt-1.5 mb-0.5 text-inherit",children:e})};function Fi(e,t,n){return e&&(typeof e=="string"?Xj(e,t,n):Array.isArray(e)?e.map((r,s)=>typeof r=="string"?a.jsx("span",{children:Xj(r,t,n)},s):r):e)}const lye=m.memo(function({text:t,citations:n,onCitationSelect:r}){const s=m.useMemo(()=>({h1:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-bold text-sm mt-3 mb-1 text-inherit",children:o})},h2:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-bold text-sm mt-3 mb-1 text-inherit",children:o})},h3:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-semibold text-sm mt-2 mb-1 text-inherit",children:o})},h4:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-semibold text-sm mt-2 mb-1 text-inherit",children:o})},h5:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-medium text-sm mt-1.5 mb-0.5 text-inherit",children:o})},h6:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"font-medium text-sm mt-1.5 mb-0.5 text-inherit",children:o})},p:({children:i})=>{const o=Fi(i,n,r);return a.jsx("p",{className:"my-3 text-inherit leading-relaxed",children:o})},li:({children:i})=>{const o=Fi(i,n,r);return a.jsx("li",{className:"text-sm text-inherit",children:o})},ul:({children:i})=>a.jsx("ul",{className:"list-disc list-inside pl-2 my-3 space-y-1",children:i}),ol:({children:i})=>a.jsx("ol",{className:"list-decimal list-inside pl-2 my-3 space-y-1",children:i}),strong:({children:i})=>a.jsx("strong",{className:"font-semibold text-inherit",children:i}),a:_3,table:({children:i})=>a.jsx("table",{className:"text-xs border-collapse w-full my-2",children:i}),th:({children:i})=>a.jsx("th",{className:"border border-border/50 px-2 py-1 text-left font-semibold bg-muted/30",children:i}),td:({children:i})=>a.jsx("td",{className:"border border-border/50 px-2 py-1",children:i}),hr:()=>a.jsx("hr",{className:"my-2 border-border/30"}),blockquote:({children:i})=>a.jsx("blockquote",{className:"border-l-2 border-border/50 pl-3 my-1.5 text-muted-foreground italic",children:i})}),[n,r]);return a.jsx(Z4,{remarkPlugins:[w3],components:s,children:t})});function cye(e){return e.replace(/<tools_ready>[\s\S]*?<\/tools_ready>/g,"").replace(/<think>[\s\S]*?<\/think>/g,"").replace(/<\/?function\b[^>]*>/g,"").replace(/<\/?[a-zA-Z][a-zA-Z0-9_-]*(?:\s[^>]*)?\s*\/?>/g,"").replace(/\n{3,}/g,`
657
658`).trim()}const uye={...aye,p:({children:e})=>a.jsx("p",{className:"my-1 text-inherit",children:e}),ul:({children:e})=>a.jsx("ul",{className:"list-disc list-inside pl-2 my-1.5 space-y-0.5",children:e}),ol:({children:e})=>a.jsx("ol",{className:"list-decimal list-inside pl-2 my-1.5 space-y-0.5",children:e}),li:({children:e})=>a.jsx("li",{className:"text-sm text-inherit",children:e}),strong:({children:e})=>a.jsx("strong",{className:"font-semibold text-inherit",children:e}),a:_3,table:({children:e})=>a.jsx("table",{className:"text-xs border-collapse w-full my-2",children:e}),th:({children:e})=>a.jsx("th",{className:"border border-border/50 px-2 py-1 text-left font-semibold bg-muted/30",children:e}),td:({children:e})=>a.jsx("td",{className:"border border-border/50 px-2 py-1",children:e}),hr:()=>a.jsx("hr",{className:"my-2 border-border/30"}),blockquote:({children:e})=>a.jsx("blockquote",{className:"border-l-2 border-border/50 pl-3 my-1.5 text-muted-foreground italic",children:e})};function dye({message:e,citations:t,isStreaming:n=!1,onSuggestionSelect:r,onUpgradeClick:s,onRegenerate:i}){var $,j,P;const o=cye(sye(e.parts)),l=r4(o,n),c=n||l.length<o.length,u=c?l:o,d=Object.keys(t).length>0,[h,f]=m.useState(!1),[p,g]=m.useState(null),v=m.useCallback(D=>{g(D),f(!0)},[]),y=m.useCallback(D=>{f(D),D||g(null)},[]),x=GI(($=e.metadata)==null?void 0:$.completedAt),b=!c&&r?(j=e.metadata)==null?void 0:j.suggestions:void 0,w=o,S=u,{toast:_}=sn(),E=m.useRef(null),R=m.useRef(!1),A=500,[N,k]=m.useState(!1);function T(){E.current!==null&&(window.clearTimeout(E.current),E.current=null)}async function I(){var D;if(o){try{await navigator.clipboard.writeText(o)}catch{const C=document.createElement("textarea");C.value=o,C.style.position="fixed",C.style.opacity="0",document.body.appendChild(C),C.select(),document.execCommand("copy"),document.body.removeChild(C)}_({title:"Copied to clipboard"}),(D=navigator.vibrate)==null||D.call(navigator,10),k(!0),window.setTimeout(()=>k(!1),1500)}}function F(D){c||D.target.closest("a,button")||(R.current=!1,T(),E.current=window.setTimeout(()=>{R.current=!0,I()},A))}function L(D){R.current&&(D.preventDefault(),R.current=!1)}const M=o.length>0;return a.jsx("div",{className:"flex flex-col gap-1.5",children:a.jsxs("div",{className:"contents",children:[(M||c)&&a.jsx("div",{className:"flex min-w-0 max-w-full justify-start",children:a.jsx("div",{className:q("min-w-0 break-words [overflow-wrap:anywhere] leading-relaxed text-foreground","w-full max-w-full overflow-hidden px-0 py-0 text-[15px]"),onTouchStart:F,onTouchEnd:T,onTouchMove:T,onTouchCancel:T,onContextMenu:L,children:a.jsxs("div",{className:q("min-w-0 break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0","text-[15px]"),children:[c?a.jsx("span",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:S}):d?a.jsx(lye,{text:w,citations:t,onCitationSelect:v}):a.jsx(Z4,{remarkPlugins:[w3],components:uye,children:w}),c&&!o&&a.jsx(oye,{}),c&&o&&a.jsx(iye,{}),!c&&d&&a.jsx(nye,{citations:t,messageText:w,expanded:h,onExpandedChange:y,highlightNum:p})]})})}),!c&&M&&a.jsxs("div",{className:"flex items-center gap-1 mt-0.5 self-start ml-0",children:[a.jsx("button",{type:"button",onClick:I,"aria-label":"Copy message",title:"Copy",className:"inline-flex items-center justify-center h-6 w-6 rounded-md text-muted-foreground
658/70 hover:text-foreground hover:bg-muted/60 transition-colors",children:N?a.jsx(bt,{className:"h-3.5 w-3.5"}):a.jsx(eH,{className:"h-3.5 w-3.5"})}),i&&a.jsx("button",{type:"button",onClick:i,"aria-label":"Regenerate response",title:"Regenerate",className:"inline-flex items-center justify-center h-6 w-6 rounded-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors",children:a.jsx(Pb,{className:"h-3.5 w-3.5"})}),x&&a.jsx("span",{className:"text-[10px] text-muted-foreground/70 select-none",children:x})]}),!b&&((P=e.metadata)==null?void 0:P.suggestionsLoading)&&r&&!c&&a.jsx("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:a.jsx("span",{children:"Generating suggestions…"})}),b&&b.length>0&&r&&!c&&a.jsx(rye,{suggestions:b,onSelect:r,onUpgradeClick:s})]})})}const hye={"evidence-substantiation":"Add Evidence","contemporaneous-documentation":"Enhance Description","reasonableness-patterns":"Adjust Duration","activity-classification":"Reclassify Activity","material-participation":"Reclassify Activity","hour-threshold":"Review Hours",corroboration:"Add Evidence"};function fye(e){return hye[e]??"Fix Issue"}function pye(e){return e==="CRITICAL"?"border-red-400/60 hover:border-red-500 hover:bg-red-50 dark:hover:bg-red-950/30":e==="WARNING"?"border-amber-400/60 hover:border-amber-500 hover:bg-amber-50 dark:hover:bg-amber-950/30":"border-blue-400/60 hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-950/30"}function mye(e){return e==="CRITICAL"?"bg-red-500":e==="WARNING"?"bg-amber-400":"bg-blue-400"}const Jj=5;function gye({findings:e,downloadUrl:t,onSend:n}){const r=e.filter(l=>l.severity==="CRITICAL"||l.severity==="WARNING"),s=r.slice(0,Jj),i=r.length-Jj,o=r.length>1;return r.length===0&&!t?null:a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Quick actions"}),a.jsxs("div",{className:"flex flex-wrap gap-2 overflow-x-auto pb-0.5 -mx-0.5 px-0.5",children:[s.map(l=>a.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>n(`fix finding #${l.findingNumber}`),className:q("h-7 text-xs gap-1.5 whitespace-nowrap shrink-0 transition-colors",pye(l.severity)),children:[a.jsx("span",{className:q("h-1.5 w-1.5 rounded-full shrink-0",mye(l.severity)),"aria-hidden":"true"}),"Fix #",l.findingNumber,": ",fye(l.domain)]},l.findingNumber)),i>0&&a.jsxs("span",{className:"inline-flex items-center h-7 px-2.5 text-xs text-muted-foreground border border-dashed border-border rounded-md shrink-0",children:["+",i," more"]}),o&&a.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>n("fix all"),className:"h-7 text-xs gap-1.5 whitespace-nowrap shrink-0 border-primary/40 hover:border-primary hover:bg-primary/5",children:[a.jsx(EH,{className:"h-3 w-3"}),"Fix All"]}),t&&a.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:l=>{l.preventDefault(),window.open(t,"_blank","noopener,noreferrer")},className:"h-7 text-xs gap-1.5 whitespace-nowrap shrink-0 border-border text-muted-foreground hover:text-foreground",children:[a.jsx(sH,{className:"h-3 w-3"}),"PDF Report"]})]})]})}const vye="[EVIDENCE_SCAN_CONTEXT]";function yye(e){const t=[];for(const n of e)if(n.role==="user")for(const r of n.parts)r.type==="file"&&t.push(r);return t}function xye(e){return e.some(t=>t.role!=="user"?!1:t.parts.some(n=>n.type==="text"&&n.text.includes(vye)))}function bye(e){const t=e.selectedId;if(!t)return[];if(t.trim().startsWith("["))try{const r=JSON.parse(t);if(Array.isArray(r))return r.map(s=>Number(s)).filter(s=>Number.isFinite(s))}catch{return[]}const n=Number(t);return Number.isFinite(n)?[n]:[]}function wye(e,t){return e.slice(t+1).some(n=>n.parts.some(r=>typeof r.type=="string"&&(r.type==="tool-presentCostSegEstimate"||r.type==="tool-presentMultiCostSegEstimate"||r.type==="tool-presentRentEstimate")))}function _ye(e,t){const n=e[t];if(n.role!=="assistant"||n.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-")))return!1;const s=e[t+1];return!s||s.role!=="assistant"?!1:s.parts.some(i=>typeof i.type=="string"&&i.type.startsWith("tool-"))}function kye({messages:e,mode:t,citations:n,isLoading:r,isStreaming:s,error:i,send:o,pipelineStatusLabel:l,isMobile:c=!1,isPremium:u,onRedirectSwitchToAdvisor:d,onRedirectUpgradeClick:h,onRegenerate:f,variant:p="default"}){const g=m.useRef(null),v=yye(e),y=xye(e),{getCardState:x}=Do(),b=k=>{const T=x(`${k}:logTimeMode`);return(T==null?void 0:T.mode)==="manual"||(T==null?void 0:T.mode)==="smart"},w=m.useRef(!0),[S,_]=m.useState(!1),E=80,R=m.useCallback(()=>{var T;
658const k=(T=g.current)==null?void 0:T.querySelector("[data-radix-scroll-area-viewport]");k&&(w.current=!0,_(!1),k.scrollTop=k.scrollHeight)},[]);m.useEffect(()=>{var I;const k=(I=g.current)==null?void 0:I.querySelector("[data-radix-scroll-area-viewport]");if(!k)return;const T=()=>{const F=k.scrollHeight-k.scrollTop-k.clientHeight<E;w.current=F,_(!F)};return T(),k.addEventListener("scroll",T,{passive:!0}),()=>k.removeEventListener("scroll",T)},[]),m.useEffect(()=>{var j,P;const k=(j=g.current)==null?void 0:j.querySelector("[data-radix-scroll-area-viewport]");if(!k)return;((P=e[e.length-1])==null?void 0:P.role)==="user"&&(w.current=!0,_(!1));const T=()=>{k&&w.current&&(k.scrollTop=k.scrollHeight)};T();let I=null;const F=()=>{I&&clearTimeout(I),I=setTimeout(()=>{M.disconnect(),$&&clearInterval($)},500)};let L=null;const M=new MutationObserver(()=>{L!==null&&cancelAnimationFrame(L),L=requestAnimationFrame(T),F()});M.observe(k,{childList:!0,subtree:!0,characterData:!0});const $=setInterval(T,16);return F(),()=>{M.disconnect(),L!==null&&cancelAnimationFrame(L),I&&clearTimeout(I),clearInterval($)}},[e]);const A=(()=>{for(let k=e.length-1;k>=0;k--)if(e[k].role==="assistant")return k;return-1})(),N=typeof(i==null?void 0:i.message)=="string"?i.message:typeof i=="string"?i:"";return a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx(t4,{ref:g,className:q("h-full"),children:a.jsxs("div",{className:"space-y-4 py-4 px-1 md:px-4 w-full",children:[e.map((k,T)=>{const I=T===A,F=s&&I,L=_ye(e,T);return a.jsxs("div",{children:[k.role==="user"?a.jsx(wle,{message:k,variant:p}):L?null:a.jsx("div",{className:"flex justify-start min-w-0 w-full",children:a.jsx("div",{className:q("min-w-0 w-full max-w-full break-words text-foreground leading-relaxed [&>*:first-child]:mt-0 [&>*:last-child]:mb-0","text-[15px]"),children:a.jsx(dye,{message:k,citations:n,isStreaming:F,variant:p,onSuggestionSelect:I?o:void 0,onUpgradeClick:I?h:void 0,onRegenerate:I&&!r?f:void 0})})}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-prepareTimeEntry"&&M.state!=="input-streaming"&&M.input!=null).map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(Ace,{toolCallId:M.toolCallId,entry:M.input,attachedFiles:v,skipAttachedFileExtraction:y,onCancel:()=>o("Cancel that entry.")})},`tool-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentSelectForm"&&M.state!=="input-streaming"&&M.input!=null).map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(Rce,{toolCallId:M.toolCallId,schema:M.input,onSubmit:o})},`form-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentQuestionnaire"&&M.state!=="input-streaming"&&M.input!=null).map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(Oce,{toolCallId:M.toolCallId,schema:M.input,onSubmit:o})},`questionnaire-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentRemediation"&&M.state!=="input-streaming"&&M.input!=null).map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(Qce,{toolCallId:M.toolCallId,schema:M.input,onSubmit:o})},`remediation-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>M.type==="tool-formSubmit").map(M=>{const $=String(M.questionnaireId??""),j=$.toLowerCase(),P=bye(M),D=P.length>0&&(j.includes("rent")||j.includes("cost")),C=wye(e,T),H=D&&!C;return D&&C?null:H&&j.includes("rent")?a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden space-y-2",children:P.map(V=>a.jsx(nj,{propertyId:V},V))},`formsubmit-rent-${k.id}`):H&&j.includes("cost")?a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(tj,{propertyIds:P})},`formsubmit-costseg-${k.id}`):a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(nue,{questionnaireId:$})},`formsubmit-${k.id}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentLogTimeForm"&&M.state!=="input-streaming").map(M=>{const $=M.toolCallId,j=M.input,P=b($)||vue(j)&&!y;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:P?a.jsx(gue,{toolCallId:$,defaults:j,onSubmit:o}):a.jsx(a4,{toolCallId:$,onSubmit:o,defaults:j})},`logtime-${k.id}-${$}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentAddPropertyForm"&&M.state!=="input-streaming").map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(jue,{onSubmit:o})},`addprop-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentTaxProfileForm"&&M.state!=="input-streaming").map(M=>a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx($ue,{onSubmit:o})},`taxprofile-${k.id}-${M.toolCallId}`)),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentDisplayProperties"&&M.state!=="input-streaming").map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(Vue,{formId:$==null?void 0:$.formId,onSubmit:$!=null&&$.formId?o:void 0,mode:$==null?void 0:$.mode})},`displayprops-${k.id}-${M.toolCallId}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentUnloggedSignals"&&M.state!=="input-streaming"&&M.input!=null).map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(tde,{toolCallId:M.toolCallId,framingSummary:$.framingSummary,signals:$.signals,onSubmit:o})},`unloggedsignals-${k.id}-${M.toolCallId}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentCostSegEstimate"&&M.state!=="input-streaming"&&M.input!=null).map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(tg,{propertyId:$.propertyId,propertyNickname:$.propertyNickname,status:$.status})},`costseg-${k.id}-${M.toolCallId}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentMultiCostSegEstimate"&&M.state!=="input-streaming"&&M.input!=null).map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(tj,{propertyIds:$.propertyIds})},`multicostseg-${k.id}-${M.toolCallId}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-redirectToAdvisor"&&M.state!=="input-streaming"&&M.input!=null).map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(ade,{message:$.message,isPremium:$.isPremium,onSwitchToAdvisor:d,onUpgradeClick:h})},`redirect-${k.id}-${M.toolCallId}`)}),k.parts.filter(M=>typeof M.type=="string"&&M.type==="tool-presentRentEstimate"&&M.state!=="input-streaming"&&M.input!=null).map(M=>{const $=M.input;return a.jsx("div",{className:"mt-2 max-w-[90%] overflow-hidden",children:a.jsx(nj,{propertyId:$.propertyId,propertyNickname:$.propertyNickname})},`rent-${k.id}-${M.toolCallId}`)}),I&&(()=>{const M=k.parts.find(P=>typeof P.type=="string"&&P.type==="tool-runComplianceAudit"&&P.state==="output-available");if(!M)return null;const $=M.output;if(!($!=null&&$.success))return null;const j=($.findings??[]).map(P=>{var D,C;return{findingNumber:P.findingNumber,severity:P.severity,domain:P.domain??((C=(D=P.violations)==null?void 0:D[0])==null?void 0:C.domain)??"unknown"}});return a.jsx(gye,{findings:j,downloadUrl:$.downloadUrl??null,onSend:o},`audit-actions-${k.id}`)})()]},k.id)}),i&&a.jsx("p",{className:"text-xs text-destructive",children:t==="advisor"||t==="compliance"?N.includes("403")?"Shield Advisor subscription required for this mode.":N.includes("429")?"Rate limit reached. Please wait a moment.":N.includes("503")?"AI Advisor is temporarily unavailable. Please try again later.":N.includes("EMPTY_COMPLETION")||N.includes("empty response")?"The assistant returned an empty response. Please try again — if this keeps happening, rephrase your question.":"Something went wrong. Please try again.":"Something went wrong. Please try again."})]})}),S&&a.jsx("button",{type:"button",onClick:R,"aria-label":"Scroll to latest message",className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 inline-flex items-center justify-center h-8 w-8 rounded-full border border-border bg-background text-foreground shadow-md hover:bg-muted transition-colors",children:a.jsx($9,{className:"h-4 w-4"})})]})}function Sye(){const e=new Date().getHours();return e<12?"Good morning":e<17?"Good afternoon":"Good evening"}function Eye(e,t){if(e==="advisor"&&t)return"I can give you much better guidance once I know y
658our tax situation. Set up your profile to get personalized advice, or ask any question right away.";const n=e in CC?e:"logger";return CC[n]}function Nye({userName:e,mode:t,profileIncomplete:n}){const r=Sye(),s=e||"there",i=Eye(t,n);return a.jsxs("div",{className:"flex flex-col items-center justify-center gap-3.5 py-6 text-center",children:[a.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-[18px] border border-[#F3E9CF] bg-[#FDF8EC]",children:a.jsx("img",{src:"https://repsshield.com/api/assets/logo.png",alt:"REPSShield",className:"h-9 w-9 shrink-0"})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("h2",{className:"text-[22px] font-semibold leading-tight text-foreground",children:[r,", ",s]}),a.jsx("p",{className:"mx-auto max-w-[320px] text-sm leading-relaxed text-muted-foreground",children:i})]})]})}function Cye(e){const t=Dp.advisor.map(s=>s.text);if(!e||e.length===0)return[...t,"How do I get started with REPS tracking?"];const n=e.some(s=>s.propertyType==="Short-term Rental"),r=e.some(s=>s.propertyType==="Long-term Rental");return n&&r?t.push("Compare LTR and STR tax rules for my properties"):n?t.push("Explain STR tax rules for my properties"):t.push("Explain LTR material participation rules for my properties"),t}function jye(e){const t=Dp.compliance.map(s=>s.text);if(!e||e.length===0)return t;const n=e[0],r=n.address||n.nickname||n.propertyType||"my property";return[t[0],`Audit my ${r} entries for compliance issues`,...t.slice(1)]}function Tye(e){return e==="advisor"?"Ask a tax compliance question...":e==="compliance"?"Ask about your IRS compliance posture...":"How can I help you today?"}function eT({session:e,isExpanded:t,hideHeader:n=!1,variant:r="default"}){const{user:s}=Wt(),i=B5(),o=e??i,{agent:l,mode:c,isPremium:u,setMode:d,isSwitching:h}=o,{agentWithSession:f,advisorChat:p,complianceChat:g}=o,v=c==="compliance"?g:p,[y,x]=m.useState(!1),[b,w]=m.useState(null),[S,_]=m.useState(!1),[E,R]=m.useState("idle");m.useEffect(()=>{!u&&(c==="advisor"||c==="compliance")&&d("logger")},[u,c,d]);const{data:A}=tt({queryKey:["/api/properties"],enabled:!!s,staleTime:1e3*60*5}),N=m.useMemo(()=>Cye(A??[]),[A]),k=m.useMemo(()=>jye(A??[]),[A]),T=m.useRef(0),I=c==="advisor"||c==="compliance",F=u?f:l,L=I?v:F,M=I?v.metadata.citations??{}:{},$=I?v.pipelineStatusLabel??void 0:F.pipelineStatusLabel??void 0,j=F.isLoading||p.isLoading||g.isLoading,P=L.isStreaming,D=L.messages.length===0&&!v.isLoadingSession&&!(u&&!I&&f.isLoadingSession),{data:C}=tt({queryKey:["/api/advisor/tax-profile"],enabled:!!s&&c==="advisor"&&D,staleTime:1e3*60*5}),H=C!==void 0&&C.completeness.score<50;m.useEffect(()=>{T.current=F.messages.length},[F.messages.length]),m.useEffect(()=>{!D&&b!==null&&w(null)},[D,b]);function V(se){if(!D){x(!0);return}w(ke=>ke===se?null:se)}function O(){x(!0)}function G(){const ke=[...F.messages].reverse().find(Be=>Be.role==="user"),Me=ke?ke.parts.filter(Be=>Be.type==="text").map(Be=>Be.text).join(""):"";d("advisor"),Me&&setTimeout(()=>v.send(Me),100)}function Z(se,ke){I?v.send(se,ke):u?f.send(se,ke):l.send(se,ke)}function ae(){L.stop()}function te(){L.regenerate()}function ne(){if(c==="advisor")return[...H?[{text:"Help me set up my tax profile",primary:!0}]:[],...N.map((Me,Be)=>({text:Me,primary:!H&&Be===0}))];if(c==="compliance")return k.map((ke,Me)=>({text:ke,primary:Me===0}));const se=[];return(s==null?void 0:s.hasCompletedOnboardingForm)===!0&&((A??[]).length===0&&se.push({text:"Add my first property",primary:!0}),s!=null&&s.filingStatus||se.push({text:"Set up my tax profile"})),[...se,...Dp.logger]}const re=ne(),J=b?Dp[b]:[];function ge(se,ke){const Me=(ke==null?void 0:ke.disabled)??!1,Be=c==="advisor"?Ab:c==="compliance"?im:om;return a.jsx("div",{className:q("mx-auto flex w-full max-w-[430px] flex-col gap-1.5 px-1 pt-4",Me&&"pointer-events-none select-none opacity-50"),children:se.map($e=>a.jsxs("button",{type:"button",onClick:()=>Z($e.text),tabIndex:Me?-1:void 0,className:"flex items-center gap-2.5 rounded-2xl border border-[#D8DFDA] bg-white px-3 py-2 text-left shadow-[0_1px_2px_rgba(16,24,40,0.06),0_10px_24px_-14px_rgba(16,24,40,0.25)] transition-colors active:bg-muted/50 dark:border-border/70 dark:bg-background dark:shadow-sm",children:[a.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-[#F3E9CF] bg-[#FDF8EC] text-[#44958C]",children:a.jsx(Be,{className:"h-3.5 w-3.5"})}),a.jsx("span",{className:"flex-1 text-[13px] font-medium text-foreground",children:$e.text}),a.jsx(B9,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground
658/60"})]},$e.text))})}return a.jsxs("div",{className:"relative flex flex-col flex-1 min-h-0",children:[!u&&a.jsx("div",{className:"flex justify-center py-2.5 border-b border-border/50",children:a.jsxs("button",{type:"button",onClick:()=>x(!0),className:"group inline-flex items-center gap-2 rounded-full border border-border bg-background px-3 py-1.5 shadow-sm hover:bg-muted/50 transition-colors duration-150",children:[a.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-green-500 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white leading-none",children:[a.jsx(Cr,{className:"h-2.5 w-2.5"}),"Premium"]}),a.jsx("span",{className:"text-sm text-foreground/80 group-hover:text-foreground transition-colors",children:"Upgrade to access Advisor & Compliance modes"}),a.jsx(Ar,{className:"h-3.5 w-3.5 text-muted-foreground group-hover:text-foreground transition-colors"})]})}),!n&&a.jsx("div",{className:"flex items-center justify-between pb-2 mb-0.5  border-border/50",children:a.jsx("div",{className:"flex items-center gap-1.5 flex-1",children:!D&&I&&v.metadata.webFallbackTriggered&&a.jsxs(Is,{variant:"outline",className:"text-[10px] gap-1 px-1.5 py-0",children:[a.jsx(nR,{className:"h-3 w-3"}),"Web sources used"]})})}),v.isLoadingSession||u&&!I&&f.isLoadingSession?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(ct,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):D?a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col justify-center",children:[!S&&a.jsx(Nye,{userName:[s==null?void 0:s.firstName,s==null?void 0:s.lastName].filter(Boolean).join(" ")||void 0,mode:c,profileIncomplete:H,variant:r}),!S&&!b&&re.length>0&&ge(re),!S&&b&&J.length>0&&ge(J,{disabled:!0})]}):a.jsx(kye,{messages:L.messages,mode:c,citations:M,isLoading:L.isLoading,isStreaming:P,error:L.error??null,send:Z,pipelineStatusLabel:$,isMobile:!0,isPremium:u,onRedirectSwitchToAdvisor:G,onRedirectUpgradeClick:O,onRegenerate:te,variant:r}),E==="scanning"&&a.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-10 bottom-24 z-10 flex items-center justify-center px-4",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsx(Vp,{title:"Preparing evidence scan",label:"Rep Assistant evidence",description:"Reading the upload so Rep Assistant can suggest a date, activity type, and description."})})}),D&&b&&a.jsx("div",{className:"flex flex-col gap-2 pb-2",children:a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/40 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[a.jsx(Cr,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),a.jsxs("span",{className:"text-xs font-medium text-foreground truncate",children:["Unlock ",Eae[b]," with Pro"]})]}),a.jsx(ie,{size:"sm",className:"text-xs h-6 px-2.5 shrink-0",onClick:()=>{w(null),x(!0)},children:"Upgrade"})]})}),a.jsx(pue,{onSubmit:Z,isLoading:j,onStop:ae,placeholder:Tye(c),showFileUpload:!0,mode:c,isPremium:u,isSwitching:h,onModeToggle:d,onUpgradeClick:()=>x(!0),onPreviewMode:u?void 0:V,onFilesChange:_,onEvidenceScanChange:R,autoSubmitEvidenceUploads:c==="logger",variant:r}),I?a.jsx("p",{className:"text-[10px] text-muted-foreground text-center px-2 pt-1 leading-relaxed",children:"Educational guidance only — not tax, legal, or financial advice. Consult a qualified CPA or tax attorney."}):a.jsx("p",{className:"px-2 pt-2 text-center text-[11px] leading-relaxed text-muted-foreground",children:"REPSShield AI can make mistakes. Verify important tax details."}),a.jsx(X_,{isOpen:y,onClose:()=>x(!1),feature:"Advisor & Compliance Mode",targetTier:"premium"})]})}const tT={async getPreferences(){const e=await fetch("/api/user/preferences");if(!e.ok)throw new Error("Failed to fetch user preferences");return(await e.json()).preferences},async updatePreferences(e){const t=await fetch("/api/user/preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user preferences");return(await t.json()).preferences},async getChatViewMode(){const e=await fetch("/api/user/chat-view-mode");if(!e.ok)throw new Error("Failed to fetch chat view mode");return e.json()},async updateChatViewMode(e){if(!(await fetch("/api/user/chat-view-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})})).ok)throw new Error("Failed to update chat view mode")}},nT=["/api/user/chat-view-mode"];function Pye(){const e=Lt(),{data:t,isLoading:n}=tt({queryKey:nT,queryFn:()=>tT.getChatViewMode(),staleTime:5*60*1e3}),r=gt({mutationFn:s=>tT.updateChatViewMode(s),onSuccess:(s,i)=>{e.setQueryData(nT,{mode:i})}});return{viewMode:(t==null?void 0:t.mode)??"hybrid",isLoading:n,setViewMode:r.mutate,isSaving:r.isPending}}function k3(e){const t=jm(e);return Kw(t)?"Today":Yw(t)?"Yesterday":Tr(t,"MMM d")}function Aye({item:e,isActive:t,onSelect:n,onDelete:r}){const s=e.title??`Chat — ${k3(e.lastMessageAt)}`;return a.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:i=>i.key==="Enter"&&n(),className:q("group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm cursor-pointer transition-colors select-none",t?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[a.jsx("span",{className:"flex-1 truncate",children:s}),a.jsx("button",{type:"button","aria-label":"Delete conversation",onClick:i=>{i.stopPropagation(),r()},className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Ib,{className:"h-3 w-3"})})]})}const Iye=["Today","Yesterday","Previous 7 days","Previous 30 days","Older"];function Rye(e){const t=jm(e);if(Kw(t))return"Today";if(Yw(t))return"Yesterday";const n=$r(new Date,t);return n<=7?"Previous 7 days":n<=30?"Previous 30 days":"Older"}function Mye(e){const t=jm(e);return Kw(t)?Tr(t,"h:mm a"):Yw(t)?"Yesterday":$r(new Date,t)<=7?Tr(t,"EEE"):Tr(t,"MMM d")}const Oye={logger:{label:"Quick",icon:om,chipClass:"bg-[#E9F3F1] text-[#2F7D6B]",filled:!0},advisor:{label:"Advisor",icon:Ab,chipClass:"bg-[#FDF3D8] text-[#9A6B14]"},compliance:{label:"Compliance",icon:im,chipClass:"bg-[#FDF3D8] text-[#9A6B14]"}};function ly(e){return e.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#>*`_~]/g,"").replace(/\s+/g," ").trim()}function Dye({item:e,isActive:t,onSelect:n,onDelete:r}){var l;const s=e.title??(e.firstUserMessage?ly(e.firstUserMessage).slice(0,60):`Chat — ${k3(e.lastMessageAt)}`),i=((l=e.summary)!=null&&l.trim()?ly(e.summary):null)??(e.lastMessagePreview?ly(e.lastMessagePreview):null),o=e.mode?Oye[e.mode]:void 0;return a.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:c=>c.key==="Enter"&&n(),className:q("flex items-start gap-1 rounded-xl px-3 py-2.5 cursor-pointer transition-colors select-none",t?"bg-[#E9F3F1]":"hover:bg-muted/60 active:bg-muted"),children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:q("flex-1 truncate text-sm text-foreground",t&&"font-medium"),children:s}
658),o&&a.jsxs("span",{className:q("inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold",o.chipClass),children:[a.jsx(o.icon,{className:"h-3 w-3",...o.filled?{fill:"currentColor"}:{}}),o.label]}),a.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:Mye(e.lastMessageAt)})]}),i&&a.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:i})]}),a.jsxs(Xb,{children:[a.jsx(Jb,{asChild:!0,children:a.jsx("button",{type:"button","aria-label":"Conversation options",onClick:c=>c.stopPropagation(),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(nH,{className:"h-4 w-4"})})}),a.jsx(wm,{align:"end",className:"w-44",children:a.jsxs(Pl,{onSelect:()=>r(),className:"text-destructive focus:text-destructive",children:[a.jsx(Ib,{className:"mr-2 h-4 w-4"}),"Delete"]})})]})]})}function Lye({isPremium:e,activeConversationId:t,onSelectConversation:n,onNewChat:r,variant:s="default"}){var A,N,k;const{data:i,isLoading:o}=Cae(1),l=jae(),[c,u]=m.useState(null),[d,h]=m.useState(!1),[f,p]=m.useState(""),[g,v]=m.useState(""),y=m.useRef(null),{data:x,isFetching:b}=Tae(g,g.length>=3);function w(){c&&(l.mutate(c),c===t&&r(),u(null))}function S(T){T.preventDefault(),f.trim().length>=3&&v(f.trim())}function _(){p(""),v(""),h(!1)}if(m.useEffect(()=>{if(s!=="sheet")return;const T=setTimeout(()=>{const I=f.trim();v(I.length>=3?I:"")},300);return()=>clearTimeout(T)},[f,s]),!e)return a.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[a.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Upgrade to Shield Advisor to save and resume advisor conversations."}),a.jsxs(ie,{variant:"outline",size:"sm",className:"w-full gap-1.5 text-xs",disabled:!0,children:[a.jsx(Cr,{className:"h-3.5 w-3.5 text-amber-500"}),"Shield Advisor only"]})]});const E=g.length>=3,R=s==="sheet"&&(i!=null&&i.data)?Iye.map(T=>({group:T,items:i.data.filter(I=>Rye(I.lastMessageAt)===T)})).filter(T=>T.items.length>0):[];return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s!=="sheet"&&a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 shrink-0",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"History"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button","aria-label":"New chat",onClick:r,className:"inline-flex items-center justify-center h-6 w-6 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",children:a.jsx(Q9,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button","aria-label":"Search conversations",onClick:()=>{h(T=>!T),d||setTimeout(()=>{var T;return(T=y.current)==null?void 0:T.focus()},50)},className:"inline-flex items-center justify-center h-6 w-6 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",children:a.jsx(hd,{className:"h-3.5 w-3.5"})})]})]}),(d||s==="sheet")&&a.jsx("form",{onSubmit:S,className:s==="sheet"?"px-2 pt-3 pb-2 shrink-0":"px-2 pb-2 shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(hd,{className:q("absolute top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",s==="sheet"?"left-3 h-4 w-4":"left-2 h-3 w-3")}),a.jsx("input",{ref:y,type:"text",value:f,onChange:T=>p(T.target.value),placeholder:s==="sheet"?"Search conversations":"Search… (min 3 chars)",className:s==="sheet"?"w-full rounded-full border border-transparent bg-muted/60 py-2 pl-9 pr-8 text-sm focus:outline-none focus:ring-1 focus:ring-ring":"w-full pl-6 pr-6 py-1 text-xs rounded-md border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring"}),f&&a.jsx("button",{type:"button",onClick:_,className:q("absolute top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",s==="sheet"?"right-2.5":"right-1.5"),"aria-label":"Clear search",children:a.jsx(vn,{className:s==="sheet"?"h-3.5 w-3.5":"h-3 w-3"})})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-2 pb-2 space-y-0.5",children:[E&&a.jsxs(a.Fragment,{children:[b&&a.jsx("div",{className:"flex justify-center py-4",children:a.jsx(ct,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),!b&&((A=x==null?void 0:x.data)==null?void 0:A.length)===0&&a.jsx("p",{className:"text-[11px] text-muted-foreground px-2 py-2",children:"No results."}),!b&&((N=x==null?void 0:x.data)==null?void 0:N.map(T=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>n(T.conversationId),onKeyDown:I=>I.key==="Enter"&&n(T.conversationId),className:q("group flex flex-col gap-0.5 rounded-md px-2 py-1.5 text-xs cursor-pointer transition-colors select-none",T.conversationId===t?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[a.jsx("span",{className:"font-medium truncate",children:T.title??`Chat — ${Tr(jm(T.lastMessageAt),"MMM d")}`}),a.jsx("span",{className:"text-[10px] line-clamp-2 opacity-75",children:T.snippet})]},T.messageId)))]}),!E&&a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:"flex justify-center py-4",children:a.jsx(ct,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),!o&&(!(i!=null&&i.data)||i.data.length===0)&&a.jsx("p",{className:"text-[11px] text-muted-foreground px-2 py-2",children:"No conversations yet."}),s==="sheet"?R.map(({group:T,items:I})=>
658a.jsxs("div",{children:[a.jsx("p",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:T}),a.jsx("div",{className:"space-y-0.5",children:I.map(F=>a.jsx(Dye,{item:F,isActive:F.id===t,onSelect:()=>n(F.id),onDelete:()=>u(F.id)},F.id))})]},T)):(k=i==null?void 0:i.data)==null?void 0:k.map(T=>a.jsx(Aye,{item:T,isActive:T.id===t,onSelect:()=>n(T.id),onDelete:()=>u(T.id)},T.id))]})]}),a.jsx(Lre,{open:c!==null,onOpenChange:T=>!T&&u(null),children:a.jsxs(iF,{children:[a.jsxs(oF,{children:[a.jsx(lF,{children:"Delete conversation?"}),a.jsx(cF,{children:"This conversation will be permanently deleted. This action cannot be undone."})]}),a.jsxs(aF,{children:[a.jsx(dF,{children:"Cancel"}),a.jsx(uF,{className:"bg-destructive hover:bg-destructive/90",onClick:w,children:"Delete"})]})]})})]})}const Fye=z_({date:Gn().min(1,"Date is required"),hours:Gn().min(1,"Hours is required"),activityType:Gn().min(1,"Activity type is required"),description:Gn().optional(),propertyId:Gn().optional(),isMaterialParticipation:Pd(),isQualifiedNonMaterial:Pd(),category:Gn().optional()}).refine(e=>!(e.isMaterialParticipation&&e.isQualifiedNonMaterial),{path:["isQualifiedNonMaterial"],message:"Choose only one classification type"});function $ye({open:e,onClose:t,onSubmit:n,properties:r,isSubmitting:s=!1,initialValues:i,isDuplicate:o=!1}){var D;const{toast:l}=sn(),{user:c}=Wt(),[u,d]=m.useState(!1),[h,f]=m.useState(!1),p=(c==null?void 0:c.repType)==="longTerm",g=new Date().getFullYear(),v=Io(),[y,x]=m.useState([]),[b,w]=m.useState(o?"form":"agent"),S=B5(),{viewMode:_}=Pye(),E=_==="ai-only",R=_==="classic-only",[A,N]=m.useState("chat"),[k,T]=m.useState(!1);m.useEffect(()=>{e&&(w(o||R?"form":"agent"),N("chat"))},[e,o,R]);const I=F_({resolver:$_(Fye),defaultValues:{date:((D=i==null?void 0:i.date)==null?void 0:D.substring(0,10))||Vv(),hours:(i==null?void 0:i.hours)||"",activityType:(i==null?void 0:i.activityType)||"",description:(i==null?void 0:i.description)||"",propertyId:(i==null?void 0:i.propertyId)||"none",isMaterialParticipation:(i==null?void 0:i.isMaterialParticipation)??!1,isQualifiedNonMaterial:(i==null?void 0:i.isQualifiedNonMaterial)??!1,category:(i==null?void 0:i.category)||"passive"}}),F=YF({control:I.control,name:"date"});m.useEffect(()=>{var C;if(e&&i){const H=((C=i.date)==null?void 0:C.substring(0,10))||Vv(),V=i.hours||"";I.setValue("date",H),I.setValue("hours",V),I.setValue("activityType",i.activityType||""),I.setValue("description",i.description||""),I.setValue("propertyId",i.propertyId||"none"),I.setValue("isMaterialParticipation",i.isMaterialParticipation??!1),I.setValue("isQualifiedNonMaterial",i.isQualifiedNonMaterial??!1),I.setValue("category",i.category||"passive")}},[e,i,I]),m.useEffect(()=>{if(F){const H=new Date(F).getFullYear();H<g?(f(!0),l({title:"Previous Tax Year Selected",description:`You are logging hours for ${H}. These will not count toward your current ${g} goals.`})):f(!1)}},[F,g,l]);const L=async()=>{const C=I.getValues("description");if(!(C!=null&&C.trim())){l({title:"No Description",description:"Please enter a description first",variant:"destructive"});return}d(!0);const H=I.getValues("propertyId"),V=r.find(O=>O.id===H);M.mutate({originalDescription:C,activityType:I.getValues("activityType"),propertyNickname:V==null?void 0:V.nickname})},M=gt({mutationFn:async C=>(await Xe("POST","/api/ai/enhance-description",C)).json(),onSuccess:C=>{C.success&&(I.setValue("description",C.result.enhancedDescription),l({title:"Description Enhanced",description:`AI improvements applied with ${Math.round(C.result.confidence*100)}% confidence`}))},onError:C=>{l({title:"Enhancement Failed",description:C.message||"Failed to enhance description",variant:"destructive"})},onSettled:()=>{d(!1)}}),$=async C=>{try{const H=parseFloat(C.hours);if(H<.0167||H>24){l({title:"Validation Error",description:"Hours must be between 1 minute and 24 hours",variant:"destructive"});return}await n(C,y),x([]),I.reset({date:Vv(),hours:"",activityType:"",description:"",propertyId:"none",isMaterialParticipation:!1,isQualifiedNonMaterial:!1,category:"passive"})}catch(H){console.error("Error creating entry:",H)}};m.useEffect(()=>{Object.keys(I.formState.errors).length>0},[I.formState.errors]);const j=a.jsx(V_,{...I,children:a.jsxs("form",{onSubmit:I.handleSubmit($),className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx(Sr,{control:I.control,name:"date",render:({field:C}
658)=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Date"}),a.jsx(ir,{children:a.jsx(Ct,{type:"date",...C})}),a.jsx(or,{})]})}),h&&a.jsxs("div",{className:"md:col-span-2 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 flex items-start gap-3",children:[a.jsx(bi,{className:"h-5 w-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-semibold text-amber-800 dark:text-amber-200 text-sm mb-1",children:"Previous Tax Year Selected"}),a.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["You are logging hours for a previous tax year. These hours will not count toward your current ",g," goals. You can view previous year data using the Tax Year selector on the dashboard."]})]})]}),a.jsx(Sr,{control:I.control,name:"hours",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Hours"}),a.jsx(ir,{children:a.jsx(p_,{value:C.value,onChange:C.onChange,placeholder:"0.0167",showQuickButtons:!0})}),a.jsx(or,{})]})})]}),a.jsx(Sr,{control:I.control,name:"activityType",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Activity Type"}),a.jsx(ir,{children:a.jsx("div",{className:"min-h-[44px]",children:a.jsx(y_,{value:C.value,onValueChange:C.onChange,placeholder:"Select or type activity type..."})})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:I.control,name:"propertyId",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Property (Optional)"}),a.jsxs(ko,{value:C.value,onValueChange:C.onChange,children:[a.jsx(ir,{children:a.jsx(ki,{children:a.jsx(So,{placeholder:"Select a property..."})})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"none",children:"No property"}),r.map(H=>{var O;const V=((O=H.id)==null?void 0:O.toString())||`property-fallback-${Date.now()}`;return!V||V===""||V==="undefined"||V==="null"?(console.error("Invalid property ID detected:",H),null):a.jsx(Cn,{value:V,children:H.nickname||H.address||"Unnamed Property"},V)}).filter(Boolean)]})]}),a.jsx(or,{})]})}),a.jsx(Sr,{control:I.control,name:"description",render:({field:C})=>a.jsxs(Wn,{children:[a.jsxs(qn,{className:"flex items-center justify-between text-sm font-normal",children:["Description",C.value&&a.jsx(M5,{feature:"AI Description Enhancement",tooltipText:"Enhance your time entry descriptions with AI to make them IRS audit-ready and professional. Premium feature for compliance.",showUpgradeButton:!1,children:a.jsx(ie,{type:"button",variant:"outline",size:"sm",onClick:L,disabled:u,className:"h-7 px-2 text-xs",children:u?a.jsxs(a.Fragment,{children:[a.jsx(dd,{className:"w-3 h-3 mr-1 animate-spin"}),"Enhancing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(cR,{className:"w-3 h-3 mr-1"}),"Enhance with AI"]})})})]}),a.jsx(ir,{children:a.jsx(Us,{placeholder:"Briefly describe the activity: type, property address, date & duration, tasks performed, purpose, outcome, and reference any attached documents.",rows:3,...C})}),a.jsx(or,{})]})}),a.jsx(Sr,{control:I.control,name:"category",render:({field:C})=>a.jsxs(Wn,{children:[a.jsx(qn,{children:"Category"}),a.jsxs(ko,{onValueChange:H=>{C.onChange(H),H==="material"?(I.setValue("isMaterialParticipation",!0),I.setValue("isQualifiedNonMaterial",!1)):H==="qualified"?(I.setValue("isMaterialParticipation",!1),I.setValue("isQualifiedNonMaterial",!0)):(I.setValue("isMaterialParticipation",!1),I.setValue("isQualifiedNonMaterial",!1))},value:C.value,children:[a.jsx(ir,{children:a.jsx(ki,{children:a.jsx(So,{placeholder:"Select classification"})})}),a.jsxs(Si,{children:[a.jsx(Cn,{value:"material",children:"Material Participation"}),p&&a.jsx(Cn,{value:"qualified",children:"Qualified Non-Material"})]})]}),a.jsx(B_,{children:"Select how this activity relates to your REP status."}),a.jsx(or,{})]})}),a.jsxs("div",{className:"space-y-3 pt-2",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Evidence Files"}),a.jsx(O5,{onFilesSelected:x,maxFiles:5,acceptedFileTypes:{"image/*":[".png",".jpg",".jpeg"],"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/msword":[".doc"]}})]}),v?a.jsx("div",{className:"pt-6 pb-safe-bottom",children:a.jsx(ie,{type:"submit",className:"w-full",disabled:s,children:s?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Duplicating...":"Creating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nc,{className:"mr-2 h-4 w-4"}),o?"Create Duplicate Entry":"Create Entry"]})})}):a.jsxs(Ed,{children:[a.jsx(ie,{type:"button",variant:"outline",onClick:t,disabled:s,children:"Cancel"}),a.jsx(ie,{type:"submit",disabled:s,children:s?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Duplicating...":"Creating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nc,{className:"mr-2 h-4 w-4"}),o?"Create Duplicate Entry":"Create Entry"]})})]})]})}),P=!o&&!E&&!R&&a.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-gray-200 dark:border-gray-700 p-0.5 bg-gray-50 dark:bg-gray-900",children:[a.jsxs("button",{type:"button",onClick:()=>w("agent"),className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all ${b==="agent"?"bg-white dark:bg-gray-800 shadow-sm text-gray-900 dark:text-gray-100":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:[a.jsx(z9,{className:"h-3.5 w-3.5"}),"AI Agent"]}),a.jsxs("button",{type:"button",onClick:()=>w("form"),className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all ${b==="form"?"bg-white dark:bg-gray-800 shadow-sm text-gray-900 dark:text-gray-100":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:[a.jsx(dH,{className:"h-3.5 w-3.5"}),"Classic Form"]})]});if(v){const C=b==="agent",H=S.agentWithSession.isLoading||S.advisorChat.isLoading||S.complianceChat.isLoading,V=C?A==="chat"?a.jsx("button",{type:"button","aria-label":"View chat history",onClick:()=>N("history"),className:"flex h-10 w-10 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100/70 dark:text-gray-400 dark:hover:bg-gray-800/70",children:a.jsx(aH,{className:"h-5 w-5"})}):a.jsxs("button",{type:"button","aria-label":"Back to chat",onClick:()=>N("chat"),className:"inline-flex h-10 items-center gap-0.5 rounded-full pl-1 pr-2.5 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100/70 dark:text-gray-300 dark:hover:bg-gray-800/70",children:[a.jsx(To,{className:"h-5 w-5"}),"Chat"]}):void 0,O=C?A==="chat"?a.jsx(l4,{mode:S.mode,isPremium:S.isPremium,
658isSwitching:S.isSwitching,isStreaming:H,onModeChange:S.setMode,onUpgradeClick:()=>T(!0),variant:"sheet"}):"History":o?"Duplicate Entry":"Add New Entry",G=C?a.jsx("button",{type:"button","aria-label":"New chat",onClick:()=>{S.startNewConversation(),N("chat")},className:"flex h-10 w-10 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100/70 dark:text-gray-400 dark:hover:bg-gray-800/70",children:a.jsx(bH,{className:"h-5 w-5"})}):void 0;return a.jsxs(a.Fragment,{children:[a.jsx(qee,{open:e,onOpenChange:Z=>!Z&&t(),title:O,headerLeading:V,headerActions:G,showHandle:!0,swipeToDismiss:b!=="agent",handleDragToDismiss:b==="agent",className:b==="agent"?["h-[100dvh] max-h-[100dvh] rounded-t-[28px] shadow-2xl"].join(" "):void 0,headerClassName:b==="agent"?"overflow-hidden border-b border-border/50":void 0,handleClassName:b==="agent"?"rounded-t-[28px]":void 0,centerTitle:b==="agent",children:a.jsxs("div",{className:q("flex flex-col min-h-0",b==="agent"?"flex-1":"h-[calc(90vh-80px)]"),children:[!o&&b!=="agent"&&a.jsx("div",{className:q("sticky top-0 z-10 flex justify-center px-4 pt-3 pb-1 shrink-0",b==="agent"?"bg-white/82 backdrop-blur dark:bg-gray-900/84":"bg-white dark:bg-gray-900"),children:P}),b==="agent"?a.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden",children:A==="chat"?a.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-4 pt-3",children:a.jsx(MC,{children:a.jsx(eT,{session:S,hideHeader:!0,variant:"sheet"})})}):a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(Lye,{isPremium:S.isPremium,activeConversationId:S.activeConversationId,variant:"sheet",onSelectConversation:Z=>{S.setActiveConversationId(Z),N("chat")},onNewChat:()=>{S.startNewConversation(),N("chat")}})})}):a.jsx("div",{className:"px-4 pb-4",children:j})]})}),a.jsx(X_,{isOpen:k,onClose:()=>T(!1),feature:"Advisor & Compliance Mode",targetTier:"premium"})]})}return a.jsx($s,{open:e,onOpenChange:t,children:a.jsxs(os,{className:`max-w-2xl w-[95vw] sm:w-full flex flex-col ${b==="agent"?"h-[80vh]":""}`,children:[a.jsx(as,{className:"shrink-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx(ls,{children:o?"Duplicate Time Entry":"Add New Time Entry"}),a.jsx(Eo,{className:"mt-1",children:o?"Modify the duplicated entry details and save as a new entry.":b==="agent"?"Describe what you did and the agent will log it for you.":"Create a new time entry for your real estate activities."})]}),P]})}),b==="agent"?a.jsx(MC,{children:a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(eT,{session:S})})}):j]})})}function S3(){const{isOpen:e,closeDialog:t,onEntryCreated:n}=rP(),{toast:r}=sn();Wt();const{data:s=[]}=tt({queryKey:["/api/properties"],retry:!1}),[i,o]=Re.useState(!1),l=async(c,u)=>{o(!0);try{const d=await Xe("POST","/api/time-entries",c);if(d.ok){const h=await d.json();if(wa("time_entry_logged",{source:"global_dialog"}),u&&u.length>0&&h.id)try{const f=new FormData;u.forEach(p=>{f.append("files",p)}),await Xe("POST",`/api/evidence-files/${h.id}`,f),wa("evidence_uploaded",{source:"time_entry_dialog",file_count:u.length}),r({title:"Evidence Attached",description:`${u.length} file(s) uploaded successfully`})}catch(f){console.error("File upload failed",f),r({title:"Evidence Upload Failed",description:"Entry created but files failed to upload",variant:"destructive"})}r({title:"Entry Created",description:"Time entry has been successfully created"}),n(),t()}else throw new Error("Failed to create entry")}catch(d){throw r({title:"Error",description:"Failed to create time entry",variant:"destructive"}),d}finally{o(!1)}};return a.jsx($ye,{open:e,onClose:t,onSubmit:l,properties:s,isSubmitting:i})}var E3=["PageUp","PageDown"],N3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],C3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ic="Slider",[O0,Vye,Bye]=_c(Ic),[E1]=yn(Ic,[Bye]),[Uye,gh]=E1(Ic),N1=m.forwardRef((e,t)=>
658{const{name:n,min:r=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:h=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:g,...v}=e,y=m.useRef(new Set),x=m.useRef(0),b=m.useRef(!1),S=o==="horizontal"?zye:Hye,[_=[],E]=cr({prop:d,defaultProp:u,onChange:I=>{var L;(L=[...y.current][x.current])==null||L.focus({preventScroll:!0,focusVisible:b.current}),b.current=!1,h(I)}}),R=m.useRef(_);function A(I){const F=Kye(_,I);T(I,F)}function N(I){T(I,x.current)}function k(){const I=R.current[x.current];_[x.current]!==I&&f(_)}function T(I,F,{commit:L}={commit:!1}){const M=Xye(i),$=Jye(Math.round((I-r)/i)*i+r,M),j=kd($,[r,s]);E((P=[])=>{const D=qye(P,j,F);if(Zye(D,c*i)){x.current=D.indexOf(j);const C=String(D)!==String(P);return C&&L&&f(D),C?D:P}else return P})}return a.jsx(Uye,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:x,thumbs:y.current,values:_,orientation:o,form:g,children:a.jsx(O0.Provider,{scope:e.__scopeSlider,children:a.jsx(O0.Slot,{scope:e.__scopeSlider,children:a.jsx(S,{"aria-disabled":l,"data-disabled":l?"":void 0,...v,ref:t,onPointerDown:he(v.onPointerDown,()=>{l||(R.current=_,b.current=!1)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:A,onSlideMove:l?void 0:N,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>{l||(b.current=!0,T(r,0,{commit:!0}))},onEndKeyDown:()=>{l||(b.current=!0,T(s,_.length-1,{commit:!0}))},onStepKeyDown:({event:I,direction:F})=>{if(!l){b.current=!0;const $=E3.includes(I.key)||I.shiftKey&&N3.includes(I.key)?10:1,j=x.current,P=_[j],D=i*$*F;T(P+D,j,{commit:!0})}}})})})})});N1.displayName=Ic;var[j3,T3]=E1(Ic,{startEdge:"left",endEdge:"right",size:"width",direction:1}),zye=m.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,[h,f]=m.useState(null),p=He(t,w=>f(w)),g=m.useRef(void 0),v=Oa(s),y=v==="ltr",x=y&&!i||!y&&i;function b(w){const S=g.current||h.getBoundingClientRect(),_=[0,S.width],R=C1(_,x?[n,r]:[r,n]);return g.current=S,R(w-S.left)}return a.jsx(j3,{scope:e.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:a.jsx(P3,{dir:v,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=b(w.clientX);o==null||o(S)},onSlideMove:w=>{const S=b(w.clientX);l==null||l(S)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const _=C3[x?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:_?-1:1})}})})}),Hye=m.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,d=m.useRef(null),h=He(t,d),f=m.useRef(void 0),p=!s;function g(v){const y=f.current||d.current.getBoundingClientRect(),x=[0,y.height],w=C1(x,p?[r,n]:[n,r]);return f.current=y,w(v-y.top)}return a.jsx(j3,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(P3,{"data-orientation":"vertical",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:v=>{const y=g(v.clientY);i==null||i(y)},onSlideMove:v=>{const y=g(v.clientY);o==null||o(y)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:v=>{const x=C3[p?"from-bottom":"from-top"].includes(v.key);c==null||c({event:v,direction:x?-1:1})}})})}),P3=m.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,d=gh(Ic,n);return a.jsx(we.span,{...u,ref:t,onKeyDown:he(e.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):E3.concat(N3).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:he(e.onPointerDown,h=>{const f=h.target;f.setPointerCapture(h.pointerId),h.preventDefault(),d.thumbs.has(f)?f.focus({preventScroll:!0,focusVisible:!1}):r(h)}),onPointerMove:he(e.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&s(h)}),onPointerUp:he(e.onPointerUp,h=>{const f=h.target;f.hasPointerCapture(h.pointerId)&&(f.releasePointerCapture(h.pointerId),i(h))})})}),A3="SliderTrack",I3=m.forwardRef((e,t)=>
658{const{__scopeSlider:n,...r}=e,s=gh(A3,n);return a.jsx(we.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});I3.displayName=A3;var D0="SliderRange",R3=m.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=gh(D0,n),i=T3(D0,n),o=m.useRef(null),l=He(t,o),c=s.values.length,u=s.values.map(f=>U3(f,s.min,s.max)),d=c>1?Math.min(...u):0,h=100-Math.max(...u);return a.jsx(we.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:d+"%",[i.endEdge]:h+"%"}})});R3.displayName=D0;var M3="SliderThumb",[Wye,O3]=E1(M3),D3="SliderThumbProvider";function L3(e){const{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:s}=e,i=gh(D3,t),o=Vye(t),[l,c]=m.useState(null),u=m.useMemo(()=>l?o().findIndex(y=>y.ref.current===l):-1,[o,l]),d=Bb(l),h=l?!!i.form||!!l.closest("form"):!0,f=i.values[u],p=n??(i.name?i.name+(i.values.length>1?"[]":""):void 0),g=f===void 0?0:U3(f,i.min,i.max);m.useEffect(()=>{if(l)return i.thumbs.add(l),()=>{i.thumbs.delete(l)}},[l,i.thumbs]);const v={value:f,name:p,form:i.form,isFormControl:h,index:u,thumb:l,onThumbChange:c,percent:g,size:d};return a.jsx(Wye,{scope:t,...v,children:exe(s)?s(v):r})}L3.displayName=D3;var Ef="SliderThumbTrigger",F3=m.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=gh(Ef,n),i=T3(Ef,n),{index:o,value:l,percent:c,size:u,onThumbChange:d}=O3(Ef,n),h=He(t,v=>d(v)),f=Gye(o,s.values.length),p=u==null?void 0:u[i.size],g=p?Yye(p,c,i.direction):0;return a.jsx("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${c}% + ${g}px)`},children:a.jsx(O0.ItemSlot,{scope:n,children:a.jsx(we.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":s.min,"aria-valuenow":l,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...r,ref:h,style:l===void 0?{display:"none"}:e.style,onFocus:he(e.onFocus,()=>{s.valueIndexToChangeRef.current=o})})})})});F3.displayName=Ef;var $3=m.forwardRef((e,t)=>{const{__scopeSlider:n,name:r,...s}=e;return a.jsx(L3,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:i,isFormControl:o})=>a.jsxs(a.Fragment,{children:[a.jsx(F3,{...s,ref:t,__scopeSlider:n}),o?a.jsx(B3,{__scopeSlider:n},i):null]})})});$3.displayName=M3;var V3="SliderBubbleInput",B3=m.forwardRef(({__scopeSlider:e,...t},n)=>{const{value:r,name:s,form:i}=O3(V3,e),o=m.useRef(null),l=He(o,n),c=Xw(r);return m.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"value").set;if(c!==r&&f){const p=new Event("input",{bubbles:!0});f.call(u,r),u.dispatchEvent(p)}},[c,r]),a.jsx(we.input,{style:{display:"none"},name:s,form:i,...t,ref:l,defaultValue:r})});B3.displayName=V3;function qye(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,i)=>s-i)}function U3(e,t,n){const i=100/(n-t)*(e-t);return kd(i,[0,100])}function Gye(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Kye(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function Yye(e,t,n){const r=e/2,i=C1([0,50],[0,r]);return(r-i(t)*n)*n}function Qye(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Zye(e,t){if(t>0){const n=Qye(e);return Math.min(...n)>=t}return!0}function C1(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Xye(e){if(!Number.isFinite(e))return 0;const t=e.toString();if(t.includes("e")){const[r,s]=t.split("e"),i=r.split(".")[1]||"",o=Number(s);return Math.max(0,i.length-o)}const n=t.split(".")[1];return n?n.length:0}function Jye(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}function exe(e){return typeof e=="function"}const z3=m.forwardRef(({className:e,...t},n)=>a.jsxs(N1,{ref:n,className:q("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(I3,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(R3,{className:"absolute h-full bg-primary"})}),a.jsx($3,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));z3.displayName=N1.displayName;function H3({isVisible:e,subscriptionStatus:t,trialEndDate:n,onUpgrade:r}){const[,s]=Pt(),{toast:i}=sn(),o=Lt(),{data:l,isLoading:c,error:u}=P_(),[d,h]=m.useState(!1),[f,p]=m.useState(null),[g,v]=m.useState(!1),[y,x]=m.useState([100]);m.useEffect(()=>{l!=null&&l.annualPriceMin&&x([l.annualPriceMin])},[l]);const b=async L=>{p(L);try{const M=window.location.origin,$=await dc({priceType:L,successUrl:`${M}
658/?payment=success&upgraded=true`,cancelUrl:`${M}/?payment=cancelled`});$.upgraded?(i({title:"Plan Updated",description:$.message}),window.location.reload()):$.checkoutUrl&&(window.location.href=$.checkoutUrl)}catch(M){if((M==null?void 0:M.status)===409){i({title:"Already Subscribed",description:"Opening your billing portal…"});try{const j=await(await Xe("POST","/api/create-portal-session",{})).json();if(j.url){window.location.href=j.url;return}}catch{}p(null);return}console.error("Upgrade error:",M),i({title:"Upgrade Error",description:M.message||"Failed to start upgrade process. Please try again.",variant:"destructive"}),p(null)}},w=async()=>{v(!0);try{await Xe("POST","/api/logout",{})}catch(L){console.error("Logout error:",L)}finally{await Ms(o,{force:!0}),v(!1),Kl("/logout-success")}};if(!e)return null;const S=["⏱ Advanced time tracking with real-time stopwatch","📊 Comprehensive audit-ready reports and analytics","📅 Google Calendar sync with automated time logging","🔔 Smart lease expiry and milestone reminders","📄 Professional CSV exports for tax preparation","🤖 AI-powered voice-to-text activity logging","📧 Gmail integration for email time tracking","📁 Smart evidence management with AI analysis","🎯 Material participation tracking for Short-term REP","📈 Progress forecasting and completion analytics","🔌 REST API — connect your tools and automate workflows","🛡️ Enterprise-grade security and data protection","📞 Priority customer support and onboarding"],E=l?((L,M,$)=>{if(!l)return S.slice(0,6);const j=(L-M)/($-M),P=3,D=S.length,C=Math.round(P+j*(D-P));return S.slice(0,C)})(y[0],l.annualPriceMin,l.annualPriceMax):[],R=l==null?void 0:l.monthlyPrice,A=l==null?void 0:l.annualPriceMin,N=l==null?void 0:l.annualPriceMax,k=()=>t==="trial_expired"||t==="trialing"&&n&&new Date(n)<new Date?{title:"Free Trial Expired",description:"Your 14-day free trial has ended. Upgrade to continue accessing all features.",buttonText:"UPGRADE NOW"}:["past_due","canceled","unpaid","incomplete_expired","expired"].includes(t)?{title:"Subscription Expired",description:"Your subscription has expired. Reactivate to restore full access to your account.",buttonText:"REACTIVATE SUBSCRIPTION"}:{title:"Access Restricted",description:"Your account access is currently limited. Please check your subscription status.",buttonText:"REACTIVATE SUBSCRIPTION"},{title:T,description:I,buttonText:F}=k();return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),a.jsx(ht,{className:"relative w-full max-w-md bg-white dark:bg-gray-900 shadow-2xl rounded-xl",children:a.jsxs("div",{className:"p-6 sm:p-8",children:[a.jsx("div",{className:"flex justify-center mb-6",children:a.jsx("div",{className:"relative inline-block",children:a.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-yellow-400 to-orange-500 rounded-full flex items-center justify-center shadow-lg",children:a.jsx(jb,{className:"w-8 h-8 text-white"})})})}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white text-center mb-3",children:T}),a.jsx("p",{className:"text-gray-600 dark:text-gray-300 text-center mb-6 leading-relaxed",children:I}),a.jsxs(ie,{onClick:()=>h(!0),className:`w-full bg-blue-600 hover:bg-blue-7
65900 text-white font-semibold py-3 px-4 rounded-lg text-sm flex items-center justify-center gap-2 mb-6`,children:[a.jsx(Cr,{className:"w-4 h-4"}),F,a.jsx(ts,{className:"w-4 h-4"})]}),a.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 mb-6",children:[a.jsx("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 text-sm",children:"Unlock Shield Advisor Features:"}),a.jsxs("ul",{className:"text-sm text-blue-600 dark:text-blue-400 space-y-2",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}),"Unlimited time tracking"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}),"Advanced analytics & reports"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}),"Calendar integration"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}),"AI-powered insights"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}),"REST API — connect your tools"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(bt,{className:"w-4 h-4 flex-shrink-0"}
659),"Priority support"]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex gap-2 w-full",children:[a.jsxs(ie,{variant:"outline",className:"flex-1 text-blue-600 border-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:border-blue-400 dark:hover:bg-blue-900/20 font-medium text-sm flex items-center justify-center gap-1 px-2",onClick:()=>s("/manage-subscription"),children:[a.jsx(rc,{className:"w-4 h-4 flex-shrink-0"}),"MANAGE"]}),a.jsxs(ie,{variant:"outline",className:"flex-1 text-green-600 border-green-600 hover:bg-green-50 dark:text-green-400 dark:border-green-400 dark:hover:bg-green-900/20 font-medium text-sm flex items-center justify-center gap-1 px-2",onClick:()=>s("/contact"),children:[a.jsx(nm,{className:"w-4 h-4 flex-shrink-0"}),"SUPPORT"]})]}),a.jsxs(ie,{variant:"outline",className:"w-full text-red-600 border-red-600 hover:bg-red-50 dark:text-red-400 dark:border-red-400 dark:hover:bg-red-900/20 font-medium text-sm flex items-center justify-center gap-2",onClick:w,disabled:g,children:[a.jsx(ud,{className:"w-4 h-4"}),g?"LOGGING OUT...":"LOG OUT"]})]})]})}),a.jsx($s,{open:d,onOpenChange:h,children:a.jsxs(os,{className:"max-w-4xl p-0 overflow-hidden",children:[a.jsxs(as,{className:"p-6 pb-0",children:[a.jsx(ls,{className:"text-2xl font-bold",children:"Choose Your Plan"}),a.jsx(Eo,{className:"text-base",children:a.jsx("span",{className:"text-red-600 font-medium",children:t==="trial_expired"||t==="trialing"&&n&&new Date(n)<new Date?"Your trial has ended • Choose a plan to continue":"Your subscription has expired • Reactivate to restore access"})})]}),a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 items-stretch",children:[a.jsxs(ht,{className:"border-2 hover:border-blue-500 transition-colors flex flex-col",children:[a.jsxs(hp,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(fp,{className:"text-xl",children:"Monthly Plan"}),a.jsx(om,{className:"h-5 w-5 text-blue-500"})]}),a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"text-3xl font-bold",children:c?"$--":`$${R}`}),a.jsx("span",{className:"text-gray-600",children:"/month"})]}),a.jsx(Hx,{children:"Flexible monthly billing • Cancel anytime"})]}),a.jsxs(yt,{className:"space-y-4 flex flex-col h-full",children:[a.jsx("ul",{className:"space-y-2 flex-grow",children:S.slice(0,3).map((L,M)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(bt,{className:"h-4 w-4 text-green-500 mt-0.5 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:L})]},M))}),a.jsx("div",{className:"mt-auto pt-4",children:a.jsx(ie,{className:"w-full",onClick:()=>b("monthly"),disabled:f!==null,children:f==="monthly"?"Processing...":"Choose Monthly"})})]})]}),a.jsxs(ht,{className:"border-2 border-green-500 relative flex flex-col",children:[a.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:a.jsx(Is,{className:"bg-green-500 text-white",children:"SAVE 17%"})}),a.jsxs(hp,{className:"pt-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(fp,{className:"text-xl",children:"Annual Plan"}),a.jsx(Cr,{className:"h-5 w-5 text-green-500"})]}),a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsxs("span",{className:"text-3xl font-bold",children:["$",y[0]]}),a.jsx("span",{className:"text-gray-600",children:"/year"}),a.jsxs(Is,{variant:"outline",className:"ml-2",children:["$",(y[0]/12).toFixed(2),"/mo"]})]}),a.jsx(Hx,{children:"Flexible annual pricing — choose what feels right for your business."}),c?a.jsx("div",{className:"mt-4",children:a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"h-4 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"h-6 bg-gray-300 rounded"})]})}):l&&A&&N?a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex justify-between text-sm text-gray-500 dark:text-gray-400 mb-2",children:[a.jsxs("span",{children:["$",A,"/year"]}),a.jsxs("span",{children:["$",N,"/year"]})]}),a.jsx(z3,{value:y,onValueChange:x,max:N,min:A,step:10,className:"w-full"}),a.jsx("div",{className:"flex justify-center mt-3",children:a.jsxs(Is,{variant:"outline",className:"border-green-300 text-green-700 dark:border-green-600 dark:text-green-400",children:["$",y[0],"/year selected"]})}),a.jsx("div",{className:"text-center mt-2",children:a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[E.length," of ",S.length," ","features unlocked at this price"]})})]}):null]}),a.jsxs(yt,{className:"space-y-4 flex flex-col flex-grow",children:[a.jsx("ul",{className:"space-y-2 flex-grow",children:E.map((L,M)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(bt,{className:"h-4 w-4 text-green-500 mt-0.5 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:L})]},M))}),a.jsx("div",{className:"mt-auto pt-4",children:a.jsx(ie,{className:"w-full bg-green-600 hover:bg-green-700",onClick:()=>b("annual"),disabled:f!==null,children:f==="annual"?"Processing...":"Choose Annual"})})]})]})]}),a.jsx("div",{className:"mt-6 text-center text-sm text-gray-600",children:a.jsx("p",{children:"✓ Secure payment via Stripe • ✓ Cancel anytime • ✓ No hidden fees"})})]})]})})]})}function W3(){const{user:e}=Wt(),{subscription:t}=Hm(),[n]=Pt(),r=["/","/login","/register","/forgot-password","/reset-password","/logout-success","/pricing","/features","/about","/why-reps-shield","/affiliate-program","/affiliate-signup","/tools","/privacy-policy","/terms-of-service"],s=["/manage-subscription","/logout-success"],i=r.some(g=>n===g||(n==null?void 0:n.startsWith(g+"/"))||(n==null?void 0:n.startsWith(g+"?"))),o=s.some(g=>n===g||(n==null?void 0:n.startsWith(g+"/"))||(n==null?void 0:n.startsWith(g+"?")));if(i)return{shouldShowOverlay:!1,subscriptionStatus:"public",isTrialExpired:!1,isSubscriptionExpired:!1};if(!e)return{shouldShowOverlay:!1,subscriptionStatus:"unknown",isTrialExpired:!1,isSubscriptionExpired:!1};if(o)return{shouldShowOverlay:!1,subscriptionStatus:(t==null?void 0:t.subscriptionStatus)||e.subscriptionStatus||"unknown",trialEndDate:e.trialEndDate,isTrialExpired:!1,isSubscriptionExpired:!1};if(e.isAdmin)return{shouldShowOverlay:!1,subscriptionStatus:e.subscriptionStatus||"admin",isTrialExpired:!1,isSubscriptionExpired:!1};const l=(t==null?void 0:t.subscriptionStatus)||e.subscriptionStatus||"unknown",c=e.trialEndDate,u=e.subscriptionEndDate,d=new Date,h=l==="trialing"&&c&&new Date(c)<d,f=l==="expired"&&u&&new Date(u)<d;return{shouldShowOverlay:h||f,subscriptionStatus:l,trialEndDate:c,isTrialExpired:h,isSubscriptionExpired:f}}var j1="ToastProvider",[T1,txe,nxe]=_c("Toast"),[q3]=yn("Toast",[nxe]),[rxe,lg]=q3(j1),G3=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:l}=e,[c,u]=m.useState(null),[d,h]=m.useState(0),f=m.useRef(!1),p=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${j1}\`. Expected non-empty \`string\`.`),a.jsx(T1.Provider,{scope:t,children:a.jsx(rxe,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:c,onViewportChange:u,onToastAdd:m.useCallback(()=>h(g=>g+1),[]),onToastRemove:m.useCallback(()=>h(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,announcerContainer:o,children:l})})};G3.displayName=j1;var K3="ToastViewport",sxe=["F8"],L0="toast.viewportPause",F0="toast.viewportResume",Y3=m.forwardRef((e,t)=>
659{const{__scopeToast:n,hotkey:r=sxe,label:s="Notifications ({hotkey})",...i}=e,o=lg(K3,n),l=txe(n),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),h=m.useRef(null),f=He(t,h,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;m.useEffect(()=>{const y=x=>{var w;r.length!==0&&r.every(S=>x[S]||x.code===S)&&((w=h.current)==null||w.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),m.useEffect(()=>{const y=c.current,x=h.current;if(g&&y&&x){const b=()=>{if(!o.isClosePausedRef.current){const E=new CustomEvent(L0);x.dispatchEvent(E),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const E=new CustomEvent(F0);x.dispatchEvent(E),o.isClosePausedRef.current=!1}},S=E=>{!y.contains(E.relatedTarget)&&w()},_=()=>{y.contains(document.activeElement)||w()};return y.addEventListener("focusin",b),y.addEventListener("focusout",S),y.addEventListener("pointermove",b),y.addEventListener("pointerleave",_),window.addEventListener("blur",b),window.addEventListener("focus",w),()=>{y.removeEventListener("focusin",b),y.removeEventListener("focusout",S),y.removeEventListener("pointermove",b),y.removeEventListener("pointerleave",_),window.removeEventListener("blur",b),window.removeEventListener("focus",w)}}},[g,o.isClosePausedRef]);const v=m.useCallback(({tabbingDirection:y})=>{const b=l().map(w=>{const S=w.ref.current,_=[S,...vxe(S)];return y==="forwards"?_:_.reverse()});return(y==="forwards"?b.reverse():b).flat()},[l]);return m.useEffect(()=>{const y=h.current;if(y){const x=b=>{var _,E,R;const w=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!w){const A=document.activeElement,N=b.shiftKey;if(b.target===y&&N){(_=u.current)==null||_.focus();return}const I=v({tabbingDirection:N?"backwards":"forwards"}),F=I.findIndex(L=>L===A);cy(I.slice(F+1))?b.preventDefault():N?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return y.addEventListener("keydown",x),()=>y.removeEventListener("keydown",x)}},[l,v]),a.jsxs(WH,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&a.jsx($0,{ref:u,onFocusFromOutsideViewport:()=>{const y=v({tabbingDirection:"forwards"});cy(y)}}),a.jsx(T1.Slot,{scope:n,children:a.jsx(we.ol,{tabIndex:-1,...i,ref:f})}),g&&a.jsx($0,{ref:d,onFocusFromOutsideViewport:()=>{const y=v({tabbingDirection:"backwards"});cy(y)}})]})});Y3.displayName=K3;var Q3="ToastFocusProxy",$0=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=lg(Q3,n);return a.jsx(Pm,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&r()}})});$0.displayName=Q3;var vh="Toast",ixe="toast.swipeStart",oxe="toast.swipeMove",axe="toast.swipeCancel",lxe="toast.swipeEnd",Z3=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[l,c]=cr({prop:r,defaultProp:s??!0,onChange:i,caller:vh});return a.jsx(hn,{present:n||l,children:a.jsx(dxe,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:tn(e.onPause),onResume:tn(e.onResume),onSwipeStart:he(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:he(e.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:he(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:he(e.onSwipeEnd,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});Z3.displayName=vh;var[cxe,uxe]=q3(vh,{onClose(){}}),dxe=m.forwardRef((e,t)=>
659{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...g}=e,v=lg(vh,n),[y,x]=m.useState(null),b=He(t,L=>x(L)),w=m.useRef(null),S=m.useRef(null),_=s||v.duration,E=m.useRef(0),R=m.useRef(_),A=m.useRef(0),{onToastAdd:N,onToastRemove:k}=v,T=tn(()=>{var M;(y==null?void 0:y.contains(document.activeElement))&&((M=v.viewport)==null||M.focus()),o()}),I=m.useCallback(L=>{!L||L===1/0||(window.clearTimeout(A.current),E.current=new Date().getTime(),A.current=window.setTimeout(T,L))},[T]);m.useEffect(()=>{const L=v.viewport;if(L){const M=()=>{I(R.current),u==null||u()},$=()=>{const j=new Date().getTime()-E.current;R.current=R.current-j,window.clearTimeout(A.current),c==null||c()};return L.addEventListener(L0,$),L.addEventListener(F0,M),()=>{L.removeEventListener(L0,$),L.removeEventListener(F0,M)}}},[v.viewport,_,c,u,I]),m.useEffect(()=>{i&&!v.isClosePausedRef.current&&I(_)},[i,_,v.isClosePausedRef,I]),m.useEffect(()=>(N(),()=>k()),[N,k]);const F=m.useMemo(()=>y?s$(y):null,[y]);return v.viewport?a.jsxs(a.Fragment,{children:[F&&a.jsx(hxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:F}),a.jsx(cxe,{scope:n,onClose:T,children:Ia.createPortal(a.jsx(T1.ItemSlot,{scope:n,children:a.jsx(HH,{asChild:!0,onEscapeKeyDown:he(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||T(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(we.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":v.swipeDirection,...g,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:he(e.onKeyDown,L=>{L.key==="Escape"&&(l==null||l(L.nativeEvent),L.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:he(e.onPointerDown,L=>{L.button===0&&(w.current={x:L.clientX,y:L.clientY})}),onPointerMove:he(e.onPointerMove,L=>{if(!w.current)return;const M=L.clientX-w.current.x,$=L.clientY-w.current.y,j=!!S.current,P=["left","right"].includes(v.swipeDirection),D=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,C=P?D(0,M):0,H=P?0:D(0,$),V=L.pointerType==="touch"?10:2,O={x:C,y:H},G={originalEvent:L,delta:O};j?(S.current=O,Qh(oxe,h,G,{discrete:!1})):rT(O,v.swipeDirection,V)?(S.current=O,Qh(ixe,d,G,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(M)>V||Math.abs($)>V)&&(w.current=null)}),onPointerUp:he(e.onPointerUp,L=>{const M=S.current,$=L.target;if($.hasPointerCapture(L.pointerId)&&$.releasePointerCapture(L.pointerId),S.current=null,w.current=null,M){const j=L.currentTarget,P={originalEvent:L,delta:M};rT(M,v.swipeDirection,v.swipeThreshold)?Qh(lxe,p,P,{discrete:!0}):Qh(axe,f,P,{discrete:!0}),j.addEventListener("click",D=>D.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),hxe=e=>{const{__scopeToast:t,children:n,...r}=e,s=lg(vh,t),[i,o]=m.useState(!1),[l,c]=m.useState(!1);return mxe(()=>o(!0)),m.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(La,{asChild:!0,container:s.announcerContainer||void 0,children:a.jsx(Pm,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},fxe="ToastTitle",X3=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(we.div,{...r,ref:t})});X3.displayName=fxe;var pxe="ToastDescription",J3=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(we.div,{...r,ref:t})});J3.displayName=pxe;var e$="ToastAction",t$=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(r$,{altText:n,asChild:!0,children:a.jsx(P1,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${e$}\`. Expected non-empty \`string\`.`),null)});t$.displayName=e$;var n$="ToastClose",P1=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=uxe(n$,n);return a.jsx(r$,{asChild:!0,children:a.jsx(we.button,{type:"button",...r,ref:t,onClick:he(e.onClick,s.onClose)})})});P1.displayName=n$;var r$=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function s$(e){const t=[];
659return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),gxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...s$(r))}}),t}function Qh(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Rb(s,i):s.dispatchEvent(i)}var rT=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function mxe(e=()=>{}){const t=tn(e);nn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function gxe(e){return e.nodeType===e.ELEMENT_NODE}function vxe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function cy(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var yxe=G3,i$=Y3,o$=Z3,a$=X3,l$=J3,c$=t$,u$=P1;const xxe=yxe,d$=m.forwardRef(({className:e,...t},n)=>a.jsx(i$,{ref:n,className:q("fixed top-0 z-[11000] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));d$.displayName=i$.displayName;const bxe=bc("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),h$=m.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(o$,{ref:r,className:q(bxe({variant:t}),e),...n}));h$.displayName=o$.displayName;const wxe=m.forwardRef(({className:e,...t},n)=>a.jsx(c$,{ref:n,className:q("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));wxe.displayName=c$.displayName;const f$=m.forwardRef(({className:e,...t},n)=>a.jsx(u$,{ref:n,className:q("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(vn,{className:"h-4 w-4"})}));f$.displayName=u$.displayName;const p$=m.forwardRef(({className:e,...t},n)=>a.jsx(a$,{ref:n,className:q("text-sm font-semibold",e),...t}));p$.displayName=a$.displayName;const m$=m.forwardRef(({className:e,...t},n)=>a.jsx(l$,{ref:n,className:q("text-sm opacity-90",e),...t}));m$.displayName=l$.displayName;function g$(){const{toasts:e}=sn();return a.jsxs(xxe,{children:[e.map(function({id:t,title:n,description:r,action:s,...i}){return a.jsxs(h$,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(p$,{children:n}),r&&a.jsx(m$,{children:r})]}),s,a.jsx(f$,{})]},t)}),a.jsx(d$,{})]})}const _xe="mobile_reward_granted_banner";function kxe(){return Gp()?"android":Ra()?"ios":null}function uy(e,t){var n,r;NL(e,t),(r=(n=window.amplitude)==null?void 0:n.track)==null||r.call(n,e,t)}function Sxe(e){m.useEffect(()=>{if(!e||!Ye())return;const t=kxe();if(!t)return;const n=e,r=`mobile_session_tracked:${n.id}:${t}`,s=`mobile_reward_checked:${n.id}:${t}`;let i=!1;async function o(){if(sessionStorage.getItem(r)!=="1"&&(await Xe("POST","/api/mobile/session",{platform:t,appVersion:void 0}),sessionStorage.setItem(r,"1")),sessionStorage.getItem(s)==="1")return;uy("mobile_login",{user_id:n.id,platform:t,subscription_tier:n.subscriptionStatus});const c=await(await Xe("POST","/api/mobile/rewards/check",{platform:t,appVersion:void 0})).json();if(i)return;sessionStorage.setItem(s,"1");const u=!!n.stripeSubscriptionId&&(n.subscriptionStatus==="active"||n.subscriptionStatus==="trialing"),d={user_id:n.id,platform:t,subscription_tier:n.subscriptionStatus,campaign_ke
659y:c.campaignKey,eligibility_reason:c.reason,credit_amount:c.creditAmountCents,currency:c.currency};if(c.granted){if(uy("mobile_reward_granted",d),u)try{localStorage.setItem(`${_xe}:${n.id}`,"1")}catch{}return}uy(c.eligible?"mobile_reward_already_granted":"mobile_reward_ineligible",d)}return o().catch(l=>{console.warn("Mobile reward check failed:",l)}),()=>{i=!0}},[e])}const fi=us("PushNotifications",{});let dy=null,cu=null,sT=!1;function v$(){const e=Gl.getPlatform();return e==="ios"||e==="android"||e==="web"?e:"unknown"}async function Exe(){try{return(await Yp.getInfo()).version??null}catch{return null}}async function Nxe(e,t){await Xe("POST","/api/push-notifications/tokens",{token:e,platform:v$(),appVersion:await Exe(),permissionStatus:t})}async function Cxe(){if(v$()==="android")try{await fi.createChannel({id:"geofence_visits",name:"Property visit updates",description:"Notifications when geofence visits are logged.",importance:4,visibility:1,sound:"default",vibration:!0})}catch(e){console.warn("[PushNotifications] Failed to create Android channel:",e)}}async function jxe(e){try{await Nxe(e.value,"granted"),console.log("[PushNotifications] Device token registered.")}catch(t){console.error("[PushNotifications] Failed to persist token:",t)}}function Txe(e){return new Promise(t=>setTimeout(t,e))}async function Pxe(){let e=await fi.checkPermissions();if(console.log("[PushNotifications] Permission check:",e.receive),e.receive==="prompt"&&(e=await fi.requestPermissions(),console.log("[PushNotifications] Permission request:",e.receive)),e.receive==="granted")return"granted";for(const t of[500,1500])if(await Txe(t),e=await fi.checkPermissions(),console.log("[PushNotifications] Permission re-check:",e.receive),e.receive==="granted")return"granted";return e.receive}function Axe(){sT||(sT=!0,fi.addListener("registration",jxe),fi.addListener("registrationError",e=>{console.error("[PushNotifications] Registration error:",e.error)}),fi.addListener("pushNotificationReceived",e=>{console.log("[PushNotifications] Received:",e)}),fi.addListener("pushNotificationActionPerformed",e=>{const t=e.notification.data??{};if(t.type==="geofence_visit_logged"){const n=typeof t.route=="string"?t.route:t.recipientRole==="team_member"?"/member/time-entries":"/dashboard";window.location.assign(n)}}))}const iT={async start(e){if(!(!Ye()||!e)&&dy!==e&&cu!==e){cu=e;try{Axe(),await Cxe();const t=await Pxe();if(t!=="granted"){console.warn("[PushNotifications] Permission not granted:",t);return}await fi.register(),dy=e}finally{cu===e&&(cu=null)}}},reset(){dy=null,cu=null}};function Ixe({isOpen:e,onComplete:t}){const[,n]=Pt(),[r,s]=m.useState(!1);m.useEffect(()=>{if(e){s(!0);const o=setTimeout(()=>s(!1),3e3);return()=>clearTimeout(o)}},[e]);const i=()=>{localStorage.setItem("repshield_onboarding_completed","true"),n("/dashboard"),t()};return a.jsx($s,{open:e,onOpenChange:o=>!o&&t(),children:a.jsxs(os,{className:"sm:max-w-md",children:[a.jsxs(as,{className:"text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:a.jsx(Jo,{className:"h-10 w-10 text-green-600 dark:text-green-400"})}),a.jsxs(ls,{className:"text-2xl font-bold text-green-600 dark:text-green-400 flex items-center justify-center gap-2",children:[a.jsx(vo,{className:"h-6 w-6"}),"Congratulations! 🎉",a.jsx(vo,{className:"h-6 w-6"})]}),a.jsxs(Eo,{className:"text-base text-gray-600 dark:text-gray-400 space-y-3 mt-4",children:[a.jsx("p",{className:"font-semibold",children:"You've successfully completed the REPSShield tour!"}),a.jsx("p",{children:"You now know how to use all the key features to track your real estate activities across:"}),a.jsxs("ul",{className:"text-left space-y-1 max-w-xs mx-auto",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:"Dashboard & Progress Tracking"})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:"Activity Ledger Management"})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:"Analytics & Insights"})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Jo,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),a.jsx("span",{className:"text-sm",children:"File Vault & Organization"})]})]}),a.jsx("p",{className:"text-sm font-medium",children:"Remember, you can restart this tour anytime from the help menu."})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsxs(ie,{onClick:i,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg font-semibold flex items-center gap-2 transition-colors",children:["Start Tracking Your REP Hours",a.jsx(ts,{className:"h-4 w-4"})]})}),r&&a.jsx("div",{className:"fixed inset-0 pointer-events-none z-50",children:a.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[a.jsx("div",{className:"animate-bounce",children:"🎊"}),a.jsx("div",{className:"animate-pulse delay-100",children:"✨"}),a.jsx("div",{className:"animate-bounce delay-200",children:"🎉"}),a.jsx("div",{className:"animate-pulse delay-300",children:"⭐"}),a.jsx("div",{className:"animate-bounce delay-500",children:"🌟"})]})})]})})}const Rxe=()=>
659{const{isActive:e,currentStep:t,steps:n,nextStep:r,prevStep:s,skipTour:i,endTour:o}=WV(),[l,c]=m.useState(null),[u,d]=m.useState({top:0,left:0}),[h,f]=m.useState(!1),p=n[t];return m.useEffect(()=>{if(!e||!p)return;if(p.showCompletionDialog){f(!0);return}p.action&&setTimeout(()=>{var _;(_=p.action)==null||_.call(p)},300),p.openChatbot&&setTimeout(()=>{const _=document.querySelector('button[data-tour="ai-chatbot"]');_&&_.offsetParent!==null&&_.click()},500),p.openStopwatch&&setTimeout(()=>{const _=document.querySelector('button[data-tour="stopwatch"]');_&&_.offsetParent!==null&&_.click()},500);const g=()=>{if(!p.targetSelector)return;let _=null;if(_=document.querySelector(p.targetSelector),_){c(_),_.scrollIntoView({behavior:"smooth",block:"center"});const E=_.getBoundingClientRect(),R=window.scrollY,A=window.scrollX;let N=E.top+R,k=E.left+A;switch(p.position){case"bottom":N=E.bottom+R+10,k=E.left+A+E.width/2-200;break;case"top":N=E.top+R-220,k=E.left+A+E.width/2-200;break;case"right":N=E.top+R,k=E.right+A+10;break;case"left":N=E.top+R,k=E.left+A-410;break;case"center":N=window.innerHeight/2+R-100,k=window.innerWidth/2-200;break;default:N=E.bottom+R+10,k=E.left+A}const T=window.innerWidth,I=window.innerHeight,F=Math.min(384,T-40),L=200,M=T-F-20,$=R+I-L-20,j=R+20;d({top:Math.max(j,Math.min(N,$)),left:Math.max(20,Math.min(k,M))}),_.style.backgroundColor="white",_.style.border="3px solid #3b82f6",_.style.borderRadius="12px",_.style.boxShadow="0 0 0 4px rgba(59, 130, 246, 0.3)",_.style.zIndex="1050",_.style.padding="16px",_.setAttribute("data-tour-highlighted","true")}else{const E=window.scrollY;d({top:window.innerHeight/2+E-100,left:window.innerWidth/2-192})}};g();const v=setTimeout(g,100),y=setTimeout(g,500),x=setTimeout(g,1e3),b=setTimeout(g,2e3);let w,S;return(p.openChatbot||p.openStopwatch)&&(w=setTimeout(g,800),S=setTimeout(g,1200)),()=>{clearTimeout(v),clearTimeout(y),clearTimeout(x),clearTimeout(b),w&&clearTimeout(w),S&&clearTimeout(S),l&&(l.style.zIndex="",l.style.outline="",l.style.outlineOffset="",l.style.borderRadius="",l.style.border="",l.style.backgroundColor="",l.style.boxShadow="",l.style.padding="",l.removeAttribute("data-tour-highlighted"))}},[e,t,p,l]),m.useEffect(()=>()=>{l&&(l.style.zIndex="",l.style.outline="",l.style.outlineOffset="",l.style.borderRadius="",l.style.border="",l.style.backgroundColor="",l.style.boxShadow="",l.style.padding="",l.removeAttribute("data-tour-highlighted"))},[l]),!e||!p?null:h?a.jsx(Ixe,{isOpen:h,onComplete:()=>{f(!1),o()}}):a.jsx(a.Fragment,{children:a.jsx(ht,{className:"fixed z-[9999] w-96 max-w-[calc(100vw-40px)] shadow-xl border-2 border-primary",style:{top:`${u.top}px`,left:`${u.left}px`},children:a.jsxs(yt,{className:"p-4",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:"bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-sm font-bold",children:t+1}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[t+1," of ",n.length]})]}),a.jsx(ie,{variant:"ghost",size:"sm",onClick:o,children:a.jsx(vn,{className:"h-4 w-4"})})]}),a.jsx("h3",{className:"font-semibold text-lg mb-2",children:p.title}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:p.description}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex space-x-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:s,disabled:t===0,children:[a.jsx(Eb,{className:"h-4 w-4 mr-1"}),"Back"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:i,children:[a.jsx(xH,{className:"h-4 w-4 mr-1"}),"Skip Tour"]})]}),a.jsxs(ie,{size:"sm",onClick:r,children:[t===n.length-1?"Finish":"Next",t<n.length-1&&a.jsx(ts,{className:"h-4 w-4 ml-1"})]})]})]})})})};var V0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(V0||(V0={}));var oT;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(oT||(oT={}));const hy=us("StatusBar"),Mxe={idle:"",checking:"Checking for updates",downloading:"Updating app",ready:"Restart app for updates",failed:"Update paused"};function Oxe({status:e}){return e==="ready"?a.jsx(Nb,{className:"h-5 w-5 text-emerald-600"}):e==="failed"?a.jsx(xi,{className:"h-5 w-5 text-amber-600"}):e==="downloading"?a.jsx(tH,{className:"h-5 w-5 text-primary"}):a.jsx(ct,{className:"h-5 w-5 animate-spin text-primary"})}function Dxe({state:e}){if(e.status==="idle")return null;const t=e.status==="checking"||e.status==="downloading",n=Mxe[e.status],r=Math.max(0,Math.min(100,e.percent||0)),s=e.status==="downloading"&&r>0,i=s?{background:`conic-gradient(hsl(var(--primary)) ${r*3.6}deg, hsl(var(--muted)) 0deg)`}:void 0;return a.jsxs("div",{role:"status","aria-live":"polite","aria-label":e.message||n,className:"pointer-events-none fixed bottom-[calc(env(safe-area-inset-bottom)+5rem)] right-4 z-[70]",children:[a.jsxs("div",{className:q("absolute right-[calc(100%+0.5rem)] top-1/2 max-w-[11rem] -translate-y-1/2 roun
659ded-full border bg-background/95 px-3 py-2 text-xs font-medium leading-tight text-foreground shadow-lg backdrop-blur",e.status==="failed"?"border-amber-200 text-amber-900 shadow-amber-950/10 dark:text-amber-200":"border-border shadow-black/10"),children:[a.jsx("span",{className:"block whitespace-nowrap",children:n}),s&&a.jsxs("span",{className:"mt-0.5 block text-[10px] font-semibold text-muted-foreground",children:[r,"% downloaded"]})]}),a.jsx("div",{className:q("relative flex h-14 w-14 items-center justify-center rounded-full p-0.5 shadow-lg backdrop-blur",e.status==="failed"?"bg-amber-100 shadow-amber-950/10":"bg-muted shadow-black/10"),style:i,children:a.jsxs("div",{className:"relative flex h-full w-full items-center justify-center rounded-full border border-border bg-background/95 text-foreground",children:[a.jsx(Oxe,{status:e.status}),t&&a.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-background bg-primary"}),s&&a.jsxs("span",{className:"absolute -bottom-1 rounded-full bg-primary px-1.5 py-0.5 text-[9px] font-semibold leading-none text-primary-foreground shadow-sm",children:[r,"%"]})]})})]})}const Lxe="__capgo_keep_url_path_after_reload",fy="__capgo_history_stack__",aT=100,Fxe=typeof window<"u"&&typeof document<"u"&&typeof history<"u";if(Fxe){const e=window;if(!e.__capgoHistoryPatched){e.__capgoHistoryPatched=!0;const t=()=>{try{if(e.__capgoKeepUrlPathAfterReload)return!0}catch{}try{return window.localStorage.getItem(Lxe)==="1"}catch{return!1}},n=()=>{try{const _=window.sessionStorage.getItem(fy);if(!_)return{stack:[],index:-1};const E=JSON.parse(_);return!E||!Array.isArray(E.stack)||typeof E.index!="number"?{stack:[],index:-1}:E}catch{return{stack:[],index:-1}}},r=(_,E)=>{try{window.sessionStorage.setItem(fy,JSON.stringify({stack:_,index:E}))}catch{}},s=()=>{try{window.sessionStorage.removeItem(fy)}catch{}},i=_=>{try{const E=_??window.location.href,R=new URL(E instanceof URL?E.toString():E,window.location.href);return`${R.pathname}${R.search}${R.hash}`}catch{return null}},o=(_,E)=>{if(_.length<=aT)return{stack:_,index:E};const R=_.length-aT,A=_.slice(R),N=Math.max(0,E-R);return{stack:A,index:N}},l=_=>{document.readyState==="complete"||document.readyState==="interactive"?_():window.addEventListener("DOMContentLoaded",_,{once:!0})};let c=!1,u=!1,d=!1;const h=()=>{if(!c)return;const _=n(),E=i();if(E){if(_.stack.length===0){_.stack.push(E),_.index=0,r(_.stack,_.index);return}(_.index<0||_.index>=_.stack.length)&&(_.index=_.stack.length-1),_.stack[_.index]!==E&&(_.stack[_.index]=E,r(_.stack,_.index))}},f=(_,E)=>{if(!c||u)return;const R=i(_);if(!R)return;let{stack:A,index:N}=n();A.length===0?(A.push(R),N=A.length-1):E?((N<0||N>=A.length)&&(N=A.length-1),A[N]=R):N>=A.length-1?(A.push(R),N=A.length-1):(A=A.slice(0,N+1),A.push(R),N=A.length-1),{stack:A,index:N}=o(A,N),r(A,N)},p=()=>{if(!c||u)return;const _=n();if(_.stack.length===0){h();return}const E=_.index>=0&&_.index<_.stack.length?_.index:_.stack.length-1,R=i();if(_.stack.length===1&&R===_.stack[0])return;const A=_.stack[0];if(!A)return;u=!0;try{history.replaceState(history.state,document.title,A);for(let T=1;T<_.stack.length;T+=1)history.pushState(history.state,document.title,_.stack[T])}catch{u=!1;return}u=!1;const N=_.stack.length-1,k=E-N;k!==0?history.go(k):(history.replaceState(history.state,document.title,_.stack[E]),window.dispatchEvent(new PopStateEvent("popstate")))},g=()=>{!c||d||(d=!0,l(()=>{d=!1,p()}))};let v=null,y=null;const x=()=>{if(!c||u)return;const _=i();if(!_)return;const E=n(),R=E.stack.lastIndexOf(_);R>=0?E.index=R:(E.stack.push(_),E.index=E.stack.length-1);const A=o(E.stack,E.index);r(A.stack,A.index)},b=()=>{v&&y||(v=history.pushState,y=history.replaceState,history.pushState=function(E,R,A){const N=v==null?void 0:v.call(history,E,R,A);return f(A,!1),N},history.replaceState=function(E,R,A){const N=y==null?void 0:y.call(history,E,R,A);return f(A,!0),N},window.addEventListener("popstate",x))},w=()=>{v&&(history.pushState=v,v=null),y&&(history.replaceState=y,y=null),window.removeEventListener("popstate",x)},S=_=>{if(c===_){c&&(h(),g());return}c=_,c?(b(),h(),g()):(w(),s())};
659window.addEventListener("CapacitorUpdaterKeepUrlPathAfterReload",_=>{var E;const R=_,A=(E=R==null?void 0:R.detail)===null||E===void 0?void 0:E.enabled;typeof A=="boolean"?(e.__capgoKeepUrlPathAfterReload=A,S(A)):(e.__capgoKeepUrlPathAfterReload=!0,S(!0))}),S(t())}}var lT;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.UPDATE_NOT_AVAILABLE=1]="UPDATE_NOT_AVAILABLE",e[e.UPDATE_AVAILABLE=2]="UPDATE_AVAILABLE",e[e.UPDATE_IN_PROGRESS=3]="UPDATE_IN_PROGRESS"})(lT||(lT={}));var cT;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.PENDING=1]="PENDING",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.INSTALLING=3]="INSTALLING",e[e.INSTALLED=4]="INSTALLED",e[e.FAILED=5]="FAILED",e[e.CANCELED=6]="CANCELED",e[e.DOWNLOADED=11]="DOWNLOADED"})(cT||(cT={}));var uT;(function(e){e[e.OK=0]="OK",e[e.CANCELED=1]="CANCELED",e[e.FAILED=2]="FAILED",e[e.NOT_AVAILABLE=3]="NOT_AVAILABLE",e[e.NOT_ALLOWED=4]="NOT_ALLOWED",e[e.INFO_MISSING=5]="INFO_MISSING"})(uT||(uT={}));const ta=us("CapacitorUpdater",{web:()=>ve(()=>import("./web-CM4J8oWL.js"),__vite__mapDeps([150,1])).then(e=>new e.CapacitorUpdaterWeb)});let dT=!1,py=!1,qi=null,uu=null;const $xe="https://repslive.chanlabs.dev/api/latest",Vxe=6e3;function _s(e,t){uu&&(clearTimeout(uu),uu=null),e(t),(t.status==="ready"||t.status==="failed")&&(uu=setTimeout(()=>{e({status:"idle",percent:0}),uu=null},Vxe))}function Bxe(e){if(!dT){if(dT=!0,!Gl.isNativePlatform()){console.log("[LiveUpdate] Skipped: not native platform");return}ta.notifyAppReady(),ta.addListener("download",t=>{const n=Math.round(t.percent??0);_s(e,{status:"downloading",percent:n,message:`Downloading update ${n}%`}),console.log("[LiveUpdate] Download progress:",t)}),ta.addListener("downloadComplete",t=>{_s(e,{status:"ready",percent:100,message:"Update downloaded. It will apply when you reopen the app."}),console.log("[LiveUpdate] Download complete:",t)}),ta.addListener("downloadFailed",t=>{_s(e,{status:"failed",percent:0,message:"Update download failed. We will try again later."}),console.error("[LiveUpdate] Download failed:",t)}),hT(e),Yp.addListener("appStateChange",async t=>{if(t.isActive){await hT(e);return}if(!t.isActive&&(qi!=null&&qi.id))try{console.log("[LiveUpdate] Applying update:",qi),await ta.set({id:qi.id}),qi=null}catch(n){console.error("[LiveUpdate] Failed to apply update:",n),_s(e,{status:"failed",percent:0,message:"Update failed to apply."})}})}}async function hT(e){var t;if(!py){py=!0;try{_s(e,{status:"checking",percent:0,message:"Checking for updates..."}),console.log("[LiveUpdate] Checking latest update...");const n=await ta.current();console.log("[LiveUpdate] Current:",n);const s=await(await fetch($xe,{cache:"no-store"})).json();if(console.log("[LiveUpdate] Latest:",s),!(s!=null&&s.version)||!(s!=null&&s.url)){console.log("[LiveUpdate] No update available"),_s(e,{status:"idle",percent:0});return}const i=((t=n.bundle)==null?void 0:t.version)??"builtin";if(i===s.version){console.log("[LiveUpdate] Already latest version:",i),_s(e,{status:"idle",percent:0});return}_s(e,{status:"downloading",percent:0,message:`Downloading update ${s.version}...`}),console.log("[LiveUpdate] Downloading update:",s.version),qi=await ta.download({version:s.version,url:s.url,checksum:s.checksum}),console.log("[LiveUpdate] Download complete:",qi),_s(e,{status:"ready",percent:100,message:"Update downloaded. Close and reopen the app to apply it."})}catch(n){console.error("[LiveUpdate] Check/download failed:",n),_s(e,{status:"failed",percent:0,message:"Update check failed. We will try again later."})}finally{py=!1}}}function Uxe(){const{user:e}=Wt(),t=W3(),[,n]=Pt();return m.useEffect(()=>{MI(e==null?void 0:e.id,{subscriptionStatus:e==null?void 0:e.subscriptionStatus})},[e==null?void 0:e.id,e==null?void 0:e.subscriptionStatus]),a.jsxs(d_,{children:[a.jsx(UF,{}),a.jsx(I5,{user:e}),a.jsx(S3,{}),e&&t.shouldShowOverlay&&a.jsx(H3,{isVisible:t.shouldShowOverlay,subscriptionStatus:t.subscriptionStatus,trialEndDate:t.trialEndDate,onUpgrade:()=>n("/manage-subscription")}),a.jsx(g$,{}),a.jsx(Rxe,{})]})}function zxe(){const{user:e}=Wt(),t=W3(),[,n]=Pt();return Sxe(e),m.useEffect(()=>{MI(e==null?void 0:e.id,{subscriptionStatus:e==null?void 0:e.subscriptionStatus})},[e==null?void 0:e.id,e==null?void 0:e.subscriptionStatus]),m.useEffect(()=>{const r=e!=null&&e.id?String(e.id):null;if(!r){iT.reset();return}iT.start(r).catch(s=>{console.error("[PushNotifications] Failed to start:",s)})},[e==null?void 0:e.id]),a.jsxs(a.Fragment,{children:[a.jsx(I5,{user:e}),a.jsx(S3,{}),e&&t.shouldShowOverlay&&a.jsx(H3,{isVisible:t.shouldShowOverlay,subscriptionStatus:t.subscriptionStatus,trialEndDate:t.trialEndDate,onUpgrade:()=>n("/manage-subscription")})]})}function Hxe(){const[e,t]=m.useState("offline");return m.useEffect(()=>{Ye()&&(hy.setOverlaysWebView({overlay:!1}).catch(()=>{}
659),hy.setBackgroundColor({color:"#ffffff"}).catch(()=>{}),hy.setStyle({style:V0.Light}).catch(()=>{}))},[]),a.jsxs(d_,{children:[a.jsx(Zoe,{onPhaseChange:t}),e==="live"&&a.jsx(zxe,{}),a.jsx(g$,{})]})}function Wxe(){return Ye()?a.jsx(Hxe,{}):a.jsx(Uxe,{})}function my(){const[e,t]=m.useState({status:"idle",percent:0});return m.useEffect(()=>{Bxe(t)},[]),m.useEffect(()=>{},[]),a.jsxs(o6,{children:[a.jsx(Wxe,{}),a.jsx(Dxe,{state:e})]})}const qxe=new Set(["/api/auth/refresh","/api/logout","/api/force-logout"]);function Gxe(e){try{return new URL(e,window.location.origin).pathname}catch{return e}}const Zh=window.fetch.bind(window);window.fetch=function(...e){const[t,n]=e;let r;if(typeof t=="string"?r=t:t instanceof URL?r=t.toString():r=t.url,!(r.startsWith("/api/")||r.includes("/api/")))return Zh(...e);const i=Su(r),o=Gxe(i),l=qxe.has(o),c=Fd("accessToken"),u=n?{...n}:{},d=new Headers(u.headers||{});if(c&&!l&&!d.has("Authorization")&&d.set("Authorization",`Bearer ${c}`),c&&!l&&Ye())try{new URL(i,window.location.origin).origin!==window.location.origin&&(u.credentials="omit")}catch{}u.headers=d;const h=(u.method||(t instanceof Request?t.method:void 0)||"GET").toUpperCase(),f=p=>(p.then(g=>{g.ok||tk({method:h,url:i,status:g.status})},()=>{tk({method:h,url:i,status:0})}),p);return typeof t=="string"?f(Zh(i,u)):t instanceof URL?f(Zh(new URL(i),u)):f(Zh(new Request(i,t),u))};t6();Oz();"caches"in window&&caches.keys().then(e=>{e.forEach(t=>caches.delete(t))});"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(t=>t.unregister())});typeof window<"u"&&!window.__vite_plugin_react_preamble_installed__&&(window.__vite_plugin_react_preamble_installed__=!0);function Kxe(){if(!Ye())return;const e=window.location.pathname||"/";(e==="/"||e==="/index.html"||e.endsWith("/index.html"))&&window.history.replaceState(null,"","/login")}function Yxe(e){Ye()&&(e.innerHTML="",e.removeAttribute("data-prerendered"),e.removeAttribute("style"),e.setAttribute("data-native-startup-cleared","true"))}function B0(){Kxe();const e=document.getElementById("root");if(!e){console.error("Main.tsx: Root element not found"),setTimeout(()=>{document.getElementById("root")?B0():(console.error("Main.tsx: Root element still not found, redirecting to login"),window.location.href="/login")},100);return}try{if((e.hasAttribute("data-prerendered")||e.hasAttribute("data-ssr"))&&e.innerHTML.trim().length>0&&!Ye())try{NT(e,a.jsx(my,{}))}catch(n){console.error("Main.tsx: React hydration failed, falling back to full render:",n),e.innerHTML="",gy(e).render(a.jsx(my,{}))}else{Yxe(e);const n=gy(e);try{n.render(a.jsx(my,{}))}catch(r){console.error("Main.tsx: React render failed:",r),e.innerHTML='<div style="padding: 20px; background: red; color: white;">ERROR: Failed to render React app!</div>';return}}setTimeout(()=>{document.dispatchEvent(new Event("app-rendered"))},500),window.__APP_INITIALIZED__=!0,setTimeout(()=>{const n=Array.from(document.querySelectorAll("*")).filter(s=>{const i=window.getComputedStyle(s);return i.display==="none"||i.visibility==="hidden"||i.opacity==="0"});e.style.cssText="visibility: visible !important; opacity: 1 !important; display: block !important; position: relative !important; z-index: 1 !important; min-height: 100vh !important;",document.body.style.cssText="visibility: visible !important; opacity: 1 !important; display: block !important; margin: 0 !important;";const r=document.getElementById("loading-indicator");r&&r.remove(),e.children.length===0?(console.error("React rendered but root has no children!"),e.innerHTML='<div style="padding: 20px; background: red; color: white;">ERROR: React rendered but no content appeared!</div>'):Array.from(e.children).forEach(s=>{s.style&&(s.style.visibility="visible",s.style.opacity="1",s.style.display="block")})},1e3)}catch(t){console.error("Main.tsx: React initialization failed:",t),window.location.href="/login"}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",B0):B0();const Qxe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));
659export{fd as $,ts as A,ie as B,ht as C,tH as D,H9 as E,Nr as F,p0e as G,Bd as H,zre as I,Hre as J,Wre as K,at as L,sR as M,Ct as N,T_ as O,woe as P,VS as Q,va as R,wH as S,aR as T,lR as U,Al as V,eH as W,vn as X,bi as Y,om as Z,vo as _,sn as a,gx as a$,ko as a0,ki as a1,So as a2,Si as a3,Cn as a4,Cl as a5,zn as a6,Tr as a7,qx as a8,UO as a9,or as aA,uH as aB,jb as aC,nR as aD,gt as aE,Us as aF,Xe as aG,Hm as aH,dd as aI,K2 as aJ,kn as aK,q as aL,Lt as aM,Io as aN,Yee as aO,EF as aP,yH as aQ,wo as aR,Hx as aS,eae as aT,tae as aU,sae as aV,iae as aW,nae as aX,oae as aY,rc as aZ,d_ as a_,_t as aa,$r as ab,z9 as ac,hd as ad,ct as ae,xe as af,Eb as ag,Ar as ah,Z4 as ai,w3 as aj,zoe as ak,dc as al,F_ as am,iP as an,xi as ao,rH as ap,tR as aq,$_ as ar,z_ as as,Gn as at,nm as au,V_ as av,Sr as aw,Wn as ax,qn as ay,ir as az,hp as b,iF as b$,Nb as b0,$s as b1,os as b2,as as b3,ls as b4,Eo as b5,t4 as b6,Ed as b7,vf as b8,rR as b9,Ms as bA,Kl as bB,hn as bC,we as bD,cr as bE,He as bF,he as bG,Xw as bH,Bb as bI,yn as bJ,$re as bK,y_ as bL,l0e as bM,$S as bN,bH as bO,BF as bP,NF as bQ,WV as bR,Ye as bS,Dee as bT,Lee as bU,zD as bV,kH as bW,qee as bX,wa as bY,n4 as bZ,Lre as b_,To as ba,SL as bb,EL as bc,v_ as bd,ve as be,aH as bf,iH as bg,Q0 as bh,lT as bi,rm as bj,im as bk,G9 as bl,J9 as bm,nc as bn,Ib as bo,_d as bp,pJ as bq,zZ as br,BI as bs,Oi as bt,VF as bu,ud as bv,q2 as bw,Ot as bx,ku as by,Cs as bz,fp as c,TO as c$,oF as c0,lF as c1,cF as c2,aF as c3,dF as c4,uF as c5,yc as c6,mn as c7,Cf as c8,jT as c9,Qd as cA,hi as cB,lw as cC,uw as cD,Ds as cE,Et as cF,eO as cG,CE as cH,pH as cI,r0e as cJ,mH as cK,vx as cL,X9 as cM,Fy as cN,Eue as cO,vbe as cP,Oce as cQ,JI as cR,tP as cS,r4 as cT,Ma as cU,Xg as cV,MC as cW,f0e as cX,ZI as cY,ybe as cZ,Q9 as c_,H$ as ca,J$ as cb,nV as cc,oV as cd,rV as ce,sV as cf,Un as cg,lV as ch,H1 as ci,iV as cj,js as ck,VR as cl,mm as cm,Oa as cn,$R as co,bc as cp,Ww as cq,wd as cr,Pb as cs,n0e as ct,X_ as cu,boe as cv,B9 as cw,jm as cx,Wee as cy,Tb as cz,yt as d,$ye as d$,tl as d0,HT as d1,Eoe as d2,g5 as d3,v5 as d4,K9 as d5,Vv as d6,p_ as d7,fo as d8,Zee as d9,foe as dA,MV as dB,ol as dC,Zc as dD,Xb as dE,Jb as dF,wm as dG,Pl as dH,m0e as dI,XI as dJ,_H as dK,yx as dL,lH as dM,ew as dN,sp as dO,Z9 as dP,sbe as dQ,abe as dR,cR as dS,vH as dT,Sq as dU,ibe as dV,obe as dW,c0e as dX,rP as dY,nH as dZ,lbe as d_,u0e as da,Sre as db,HZ as dc,lr as dd,mbe as de,d4 as df,_0 as dg,h4 as dh,Bue as di,pbe as dj,gbe as dk,fbe as dl,LO as dm,pp as dn,a0e as dp,o0e as dq,th as dr,MO as ds,Pd as dt,B_ as du,fH as dv,PO as dw,zse as dx,I0e as dy,H0e as dz,Is as e,kC as e$,x0e as e0,_u as e1,y0e as e2,qe as e3,nbe as e4,dr as e5,Zn as e6,ut as e7,jd as e8,Rs as e9,Km as eA,Td as eB,Mp as eC,jp as eD,pc as eE,Ns as eF,d0 as eG,Ei as eH,Sp as eI,Np as eJ,Il as eK,h0 as eL,Ee as eM,j0e as eN,k0e as eO,tbe as eP,hoe as eQ,S0e as eR,aoe as eS,Cd as eT,O0e as eU,G0e as eV,B0e as eW,c0 as eX,Wi as eY,w0e as eZ,D0e as e_,ja as ea,kp as eb,h5 as ec,Rp as ed,fc as ee,Ip as ef,U_ as eg,Ni as eh,Ta as ei,Ur as ej,Qe as ek,Wu as el,Cp as em,pe as en,Tp as eo,Pp as ep,p0 as eq,m0 as er,Ap as es,Co as et,Ep as eu,Pa as ev,Ca as ew,en as ex,gi as ey,Ne as ez,bt as f,ube as f$,_p as f0,SC as f1,hc as f2,b0e as f3,U0e as f4,z0e as f5,u0 as f6,$0e as f7,_0e as f8,W0e as f9,$te as fA,Fs as fB,qw as fC,Dn as fD,Kw as fE,Gw as fF,d0e as fG,dbe as fH,hbe as fI,Vte as fJ,Ute as fK,Fte as fL,M5 as fM,zte as fN,s1 as fO,Vp as fP,cue as fQ,uue as fR,sh as fS,Ua as fT,za as fU,ih as fV,eT as fW,Lye as fX,Pue as fY,cbe as fZ,qv as f_,P0e as fa,C0e as fb,Y0e as fc,_C as fd,ebe as fe,J0e as ff,K0e as fg,X0e as fh,Z0e as fi,Q0e as fj,q0e as fk,g0e as fl,F0e as fm,V0e as fn,v0e as fo,R0e as fp,E0e as fq,L0e as fr,N0e as fs,M0e as ft,T0e as fu,wt as fv,A0e as fw,is as fx,Lte as fy,xx as fz,Ud as g,u4 as g0,Pye as g1,B5 as g2,Bte as g3,Hte as g4,Wse as g5,qse as g6,h0e as g7,Jo as h,Cb as i,a as j,Cr as k,rbe as l,Voe as m,Boe as n,Uoe as o,Wt as p,YI as q,tt as r,QI as s,Wte as t,P_ as u,W9 as v,SH as w,jo as x,eR as y,le as z};

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.