@tight-embedded/react 6.7.0 → 6.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +2 -2
- package/dist/index.css.gz +0 -0
- package/dist/index.js +2 -2
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.js.map.gz +0 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import*as r from"react";import{useRef as a,useMemo as o,createContext as i,useContext as l,Component as s,useState as c,useCallback as d,useEffect as u,createElement as h,forwardRef as p,useLayoutEffect as g,useImperativeHandle as m,useReducer as v,Fragment as b}from"react";import"zustand/react/shallow";import{cloneDeep as f,entries as y,mapValues as x,isEqual as C,differenceBy as T,debounce as w,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as I}from"zod";import{jsx as S,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as D,useIsRestoring as P,useQuery as M,keepPreviousData as L,useMutation as F,useQueries as O,useInfiniteQuery as V}from"@tanstack/react-query";import B from"yocto-queue";import U from"big.js";import{ResponsiveContainer as W,BarChart as H,Legend as z,CartesianGrid as q,XAxis as j,YAxis as K,Tooltip as _,Bar as Y,ReferenceLine as Z,Line as G}from"recharts";import{flexRender as Q,createColumnHelper as X,useReactTable as J,getCoreRowModel as $,getExpandedRowModel as ee}from"@tanstack/react-table";import{useFloatingNodeId as te,useFloating as ne,offset as re,flip as ae,shift as oe,size as ie,autoUpdate as le,useClick as se,useDismiss as ce,useRole as de,useInteractions as ue,useFloatingParentNodeId as he,FloatingTree as pe,FloatingNode as ge,useMergeRefs as me,FloatingPortal as ve,FloatingOverlay as be,FloatingFocusManager as fe}from"@floating-ui/react";import{ContextAwareConfirmation as ye,confirmable as xe}from"react-confirm";import{createFormHookContexts as Ce,useStore as Te,createFormHook as we}from"@tanstack/react-form";import{NumericFormat as ke}from"react-number-format";import Ee from"fuse.js";import Ae from"react-inlinesvg";import{AnimatePresence as Ie,motion as Se}from"motion/react";import{useDropzone as Ne}from"react-dropzone";import{useNavigate as Re,useMatches as De,Outlet as Pe,createMemoryRouter as Me,RouterProvider as Le,useLocation as Fe,MemoryRouter as Oe,Routes as Ve,Route as Be}from"react-router";import{openDB as Ue}from"idb";import{PersistQueryClientProvider as We}from"@tanstack/react-query-persist-client";import{fetchEventSource as He}from"@microsoft/fetch-event-source";function ze(e,t){return`${e.trim()}:${t.trim()}`}const qe=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_REPORT_FILTERS:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,ze("featureFlags","updateFlags"))});function je(){return ln(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function Ke(){return ln(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let _e=null,Ye=!1;function Ze(){const e=document.querySelector("meta[name='viewport']");if(!e)return null;const t=Object.fromEntries((e.getAttribute("content")??"").split(",").map(e=>{const[t,n=""]=e.trim().split("=");return[t.trim(),n.trim()]}));return{meta:e,params:t}}function Ge(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Qe(){const e=Ze();if(!e)return;const{meta:t,params:n}=e;if(Ye)return t.remove(),Ye=!1,void(_e=null);_e?n["interactive-widget"]=_e:delete n["interactive-widget"],_e=null,Ge(t,n)}const Xe="drawerNavigation",Je=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:r,routeProps:a}=n,o={[t]:{routeProps:a}};if(r||0===e.drawerHistory.length)return 0===e.drawerHistory.length&&function(){let e=Ze();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),Ye=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;_e=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ge(t,n)}(),{drawerHistory:[o]};{const t=f(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,ze(Xe,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,ze(Xe,"closeDrawer")),0===t().drawerHistory.length&&Qe()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,ze(Xe,"closeAllDrawers")),Qe()},requestCloseDrawer:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t.length-1,r=t[n];return{drawerHistory:t.slice(0,n),closingQueue:[...e.closingQueue,r]}},void 0,ze(Xe,"requestCloseDrawer")),requestCloseAllDrawers:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t[t.length-1];return{drawerHistory:[],closingQueue:[...e.closingQueue,n]}},void 0,ze(Xe,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,ze(Xe,"confirmCloseDrawer")),0===t().drawerHistory.length&&Qe()}}),$e=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,ze("externalOptions","setOptions"))});function et(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function tt(e){return Array.isArray(e)&&e.length>0}function nt(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:E()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const rt="search",at=nt({key:rt,name:"Search"});function ot(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function it(e,t,n){return new Date(e,t,n)}function lt(e){const[t,n,r]=e.split("-");return it(Number(t),Number(n),Number(r))}function st(){return ot(it(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function ct(e,t){return ot(it(t,e,1))}function dt(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()+1,0))}function ut(e){const t=/* @__PURE__ */new Date;return ot(it(t.getFullYear(),t.getMonth()-e,1))}function ht(e){const t=e.getMonth(),n=t-t%3;return ot(it(e.getFullYear(),n,1))}function pt(e){const t=e.getMonth(),n=t-t%3+3;return ot(it(e.getFullYear(),n,0))}const gt={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_6_MONTHS:"LAST_6_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},mt={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_6_MONTHS:"Last 6 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},vt=e=>Object.values(gt).includes(e),bt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ct(e.getMonth(),e.getFullYear())}(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[gt.LAST_MONTH]:()=>ut(1),[gt.LAST_6_MONTHS]:()=>ut(5),[gt.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()-11,1))}(),[gt.THIS_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,1)),[gt.LAST_3_MONTHS]:()=>ut(2),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ht(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>ht(/* @__PURE__ */new Date)};function ft(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&void 0===t.endDate||void 0===t.beginDate&&"string"==typeof t.endDate||"string"==typeof t.beginDate&&"string"==typeof t.endDate}const yt=e=>bt[e](),xt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>dt(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,0)),[gt.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth(),0))}(),[gt.LAST_6_MONTHS]:()=>dt(),[gt.LAST_12_MONTHS]:()=>dt(),[gt.THIS_YEAR]:()=>st(),[gt.LAST_3_MONTHS]:()=>dt(),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return pt(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>pt(/* @__PURE__ */new Date)},Ct=e=>xt[e](),Tt=e=>{return vt(e)?{beginDate:yt(e),endDate:Ct(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:ot((t=e).beginDate),endDate:ot(t.endDate)};var t},wt=["SUN","MON","TUE","WED","THU","FRI","SAT"],kt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Et({yearsBack:e=10,startYear:t}){const n=t??/* @__PURE__ */(new Date).getFullYear(),r=[n];for(let a=n-1;a>=n-e;a--)r.push(a);return r}function At(e,t){return e.toDateString()===t.toDateString()}function It(e){return At(e,/* @__PURE__ */new Date)}function St(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function Nt(e){return e&&e instanceof Date&&!isNaN(e.getTime())?`${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")}/${e.getFullYear()}`:""}function Rt(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=it(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Dt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return Rt(o,i,l)?it(l,o-1,i):null}function Pt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,4})-(\d{1,2})-(\d{1,2})/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return Rt(i,l,o)?it(o,i-1,l):null}function Mt(e){if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getDate()).padStart(2,"0");return`${t}-${String(e.getMonth()+1).padStart(2,"0")}-${n}`}function Lt(e,t){return St(e,t)?t:e}function Ft(e,t){return St(t,e)?t:e}const Ot=(e,t)=>{const n={month:t.abbreviateMonth?"short":"long",year:t.abbreviateYear?"2-digit":"numeric"},r=e.toLocaleString("default",n);let a=r;if(t.abbreviateYear){const e=r.length-2;a=r.slice(0,e)+"'"+r.slice(e)}return a},Vt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return It(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Ot(t,{abbreviateMonth:!0,abbreviateYear:!1})},Bt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Ut(e,t){return it(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Wt(e){const{month:t,year:n}=e;return{beginDate:it(n,t-1,1),endDate:it(n,t+1,0)}}const Ht="date",zt=Object.values(gt).map(e=>{return{name:mt[t=e],value:{date:{name:mt[t],value:t}}};var t}),qt=nt({key:Ht,name:"Date",possibleValues:()=>({values:zt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function jt(e){return"OWNER"===e||"READ_ONLY"===e}function Kt(e){if(0===e.length)return e;const t=function(e,t){if(0===e.length)return-1;let n=e.length-1;for(;n>-1;){if(t(e[n]))return n;n--}return-1}(e,e=>e.modelKey===rt);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==rt)}const _t=qt.createFilter({name:mt[gt.LAST_12_MONTHS],value:{date:{name:mt[gt.LAST_12_MONTHS],value:gt.LAST_12_MONTHS}}});function Yt(e,t){return Kt([...t.some(e=>e.modelKey===Ht)?function(e){const t=e.findIndex(e=>e.modelKey===Ht);return-1!==t?et(e,t):e}(e.filters):e.filters,...t])}function Zt(e,t){const n=e.filters[t];return n&&n.modelKey===Ht?function(e,t){const n=[...e];return n[t]=_t,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Gt(e){return Kt(e.some(e=>e.modelKey===Ht)?e:[...e,_t])}function Qt(e,t){if(e.hasInitialized)return e;const n=[];return jt(t.userRole)&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:E(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(_t),{filters:n,hasInitialized:!0}}const Xt="transactionsDashboardFilters",Jt=e=>({transactionsDashboardFilters:[_t],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Yt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Zt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Gt(t)}),void 0,ze(Xt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,ze(Xt,"initialize"))}),$t="expenseDashboardFilters",en=e=>({expenseDashboardFilters:[_t],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Yt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Zt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Gt(t)}),void 0,ze($t,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,ze($t,"initialize"))}),tn="incomeDashboardFilters",nn=e=>({incomeDashboardFilters:[_t],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Yt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Zt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Gt(t)}),void 0,ze(tn,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,ze(tn,"initialize"))}),rn={label:"Connected Accounts",value:"connected"},an="banksAndIntegrationsState",on=e=>({banksAndIntegrationsSelectedTab:rn,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,ze(an,"setBanksAndIntegrationsSelectedTab")),toggleExpandedIntegration:(t,n)=>e(e=>({expandedPlaidItems:e.expandedPlaidItems.includes(t)||n&&!e.hasExpandedUpdated?e.expandedPlaidItems.filter(e=>e!==t):[...e.expandedPlaidItems,t],hasExpandedUpdated:!0}),void 0,ze(an,"toggleExpandedIntegration"))}),ln=e()(t(n((...e)=>({...qe(...e),...Je(...e),...$e(...e),...Jt(...e),...en(...e),...nn(...e),...on(...e)}),{name:"tight-featureflag-storage",partialize:e=>{const t=Object.entries(e).filter(([e])=>e.startsWith("FEATUREFLAG"));return Object.fromEntries(t)}}),{name:"globalStore",store:"globalStore",enabled:!1})),sn={SELECT:"select",EXPAND:"expand"},cn={...sn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},dn=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.DIMENSION_VALUE,cn.REVIEW_STATUS],un=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(dn)))}),hn=e=>{const t=un.safeParse(e);return t.success?t.data:void 0},pn=A.optional(A.string().trim()),gn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,mn=A.optional(A.array(A.string().trim())),vn=A.object({integrations:A.optional(A.array(A.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:A.optional(A.boolean()),hideManualBanks:A.optional(A.boolean())}),bn={transactionsDashboard:hn,incomeDashboard:hn,expenseDashboard:hn,accessToken:e=>{const t=pn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=mn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>gn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=vn.safeParse(e);return t.success?t.data:void 0}},fn=(e,t)=>{if(void 0!==bn[e])return(0,bn[e])(t)};function yn(e){const t=a(!1),n=ln(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=fn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=ln(e=>e.externalOptions);return{options:o(()=>f(r),[r]),setOptions:n}}function xn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Cn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Tn(e){return String.fromCharCode(e+(e>25?39:97))}function wn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Tn(t%52)+n;return Tn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var kn=/\s*!(important)?/i;function En(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var An=e=>{const t=/* @__PURE__ */new Map;return(...n)=>{const r=JSON.stringify(n);if(t.has(r))return t.get(r);const a=e(...n);return t.set(r,a),a}},In=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Sn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(In.has(n))return;const r=e[n],a=t[n];xn(r)&&xn(a)?e[n]=Sn(r,a):e[n]=a}),e):e,{})}var Nn=e=>null!=e;function Rn(e,t,n={}){const{stop:r,getKey:a}=n;return function e(n,o=[]){if("object"==typeof(i=n)&&null!==i){const i={};for(const[l,s]of Object.entries(n)){const c=a?.(l,s)??l,d=[...o,c];if(r?.(n,d))return t(n,o);const u=e(s,d);Nn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Dn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return Rn(e,e=>{return Array.isArray(e)?(t=e,n=a.breakpoints.keys,t.reduce((e,t,r)=>{const a=n[r];return null!=t&&(e[a]=t),e},{})):e;var t,n},{stop:e=>Array.isArray(e),getKey:n?e=>o?i(e):e:void 0})}var Pn={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Mn=/([A-Z])/g,Ln=/^ms-/,Fn=An(e=>e.startsWith("--")?e:e.replace(Mn,"-$1").replace(Ln,"-ms-").toLowerCase()),On=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Vn=`(?:${"cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%".split(",").join("|")})`,Bn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Vn}$`),Un={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):xn(e)?Rn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&On.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Bn.test(e)},Wn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Cn(t))};const Hn=new Set("_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_supportHover,_notDisabled,_scrolledX,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,1.5xl,1.5xlOnly,1.5xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo1.5xl,smTo2xl,mdToLg,mdToXl,mdTo1.5xl,mdTo2xl,lgToXl,lgTo1.5xl,lgTo2xl,xlTo1.5xl,xlTo2xl,1.5xlTo2xl,@/md,@/lg,@/xl,@tight-component/md,@tight-component/lg,@tight-component/xl,@page/md,@page/lg,@page/xl,@report-table-container/md,@report-table-container/lg,@report-table-container/xl,base".split(",")),zn=/^@|&|&$/;function qn(e){return Hn.has(e)||zn.test(e)}const jn=/^_/,Kn=/&|@/,_n=/* @__PURE__ */new Map;"aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos,top:top,left:left,inset:inset,insetInline:inset-x,insetBlock:inset-y,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e,insetInlineStart:inset-s,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p,paddingLeft:pl,paddingRight:pr,paddingTop:pt,paddingBottom:pb,paddingBlock:py,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px,paddingInlineEnd:pe,paddingInlineStart:ps,marginLeft:ml,marginRight:mr,marginTop:mt,marginBottom:mb,margin:m,marginBlock:my,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx,marginInlineEnd:me,marginInlineStart:ms,spaceX:sx,spaceY:sy,outlineWidth:ring-w,outlineColor:ring-c,outline:ring,outlineOffset:ring-o,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w,inlineSize:w-is,minWidth:min-w,minInlineSize:min-w-is,maxWidth:max-w,maxInlineSize:max-w-is,height:h,blockSize:h-bs,minHeight:min-h,minBlockSize:min-h-bs,maxHeight:max-h,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p,backgroundPositionX:bg-p-x,backgroundPositionY:bg-p-y,backgroundAttachment:bg-a,backgroundClip:bg-cp,background:bg,backgroundColor:bg-c,backgroundOrigin:bg-o,backgroundImage:bg-i,backgroundRepeat:bg-r,backgroundBlendMode:bg-bm,backgroundSize:bg-s,backgroundGradient:bg-grad,backgroundLinear:bg-linear,backgroundRadial:bg-radial,backgroundConic:bg-conic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr,borderTopLeftRadius:bdr-tl,borderTopRightRadius:bdr-tr,borderBottomRightRadius:bdr-br,borderBottomLeftRadius:bdr-bl,borderTopRadius:bdr-t,borderRightRadius:bdr-r,borderBottomRadius:bdr-b,borderLeftRadius:bdr-l,borderStartStartRadius:bdr-ss,borderStartEndRadius:bdr-se,borderStartRadius:bdr-s,borderEndStartRadius:bdr-es,borderEndEndRadius:bdr-ee,borderEndRadius:bdr-e,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x,borderInlineWidth:bd-x-w,borderInlineColor:bd-x-c,borderBlock:bd-y,borderBlockWidth:bd-y-w,borderBlockColor:bd-y-c,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s,borderInlineStartWidth:bd-s-w,borderInlineStartColor:bd-s-c,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e,borderInlineEndWidth:bd-e-w,borderInlineEndColor:bd-e-c,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh,boxShadowColor:bx-sh-c,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x,translateY:translate-y,translateZ:translate-z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor".split(",").forEach(e=>{const[t,n]=e.split(":");_n.set(t,n)});const Yn={conditions:{shift:function(e){return e.sort((e,t)=>{const n=qn(e),r=qn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Hn.has(e)?e.replace(jn,""):Kn.test(e)?`[${En(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1.5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${_n.get(e)||Fn(e)}_${En(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},Zn=function(e){const{utility:t,hash:n,conditions:r=Pn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return An(({base:o,...i}={})=>{const l=Dn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return Rn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&kn.test(u),[l,...c]=r.shift(o),d=c.slice().filter(e=>!/* @__PURE__ */(e=>"base"===e)(e));var u;const h=t.transform(l,function(e){return"string"==typeof e?e.replace(kn,"").trim():e}((e=>"string"==typeof e?e.replaceAll(/[\n\s]+/g," "):e)(e)));let p=((e,o)=>{let i;if(n){const n=[...r.finalize(e),o];i=a(t.toHash(n,wn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(Yn),Gn=(...e)=>Zn(Qn(...e));Gn.raw=(...e)=>Qn(...e);const{mergeCss:Qn}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>xn(e)&&Object.keys(Cn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Dn(t,e))}return{mergeCss:An(function(...e){return Sn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(Yn);function Xn(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const Jn=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function $n(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=Jn(e),o=e=>({...r,...Cn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=Qn(i,n[t][a]));const l=function(e,t){let n={};return e.forEach(e=>{Object.entries(e).every(([e,n])=>"css"===e||(Array.isArray(n)?n:[n]).some(n=>t[e]===n))&&(n=Qn(n,e.css))}),n}(a,r);return Qn(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(An(function(e){return Gn(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=Jn(e.config),i=((...e)=>{const t=e.reduce((e,t)=>(t&&t.forEach(t=>e.add(t)),e),/* @__PURE__ */new Set([]));return Array.from(t)})(e.variantKeys,Object.keys(n));return $n({base:Qn(t,o.base),variants:Object.fromEntries(i.map(e=>[e,Qn(n[e],o.variants[e])])),defaultVariants:Sn(r,o.defaultVariants),compoundVariants:[...a,...o.compoundVariants]})},splitVariantProps:function(e){return function(e,...t){const n=Object.getOwnPropertyDescriptors(e),r=Object.keys(n),a=e=>{const t={};for(let r=0;r<e.length;r++){const a=e[r];n[a]&&(Object.defineProperty(t,a,n[a]),delete n[a])}return t};return t.map(e=>a(Array.isArray(e)?e:r.filter(e))).concat(a(r))}(e,l)},getVariantProps:o})}var er,tr=((er=tr||{}).component="component",er["dashboard-placeholder-table"]="dashboard-placeholder-table",er["dashboard-header"]="dashboard-header",er["dashboard-table"]="dashboard-table",er["dashboard-table-body"]="dashboard-table-body",er["dashboard-table-cell"]="dashboard-table-cell",er["dashboard-table-column-header"]="dashboard-table-column-header",er["dashboard-table-header"]="dashboard-table-header",er.label="label",er.popup="popup",er["popup-sort-row"]="popup-sort-row",er["progress-bar"]="progress-bar",er["progress-bar-fill"]="progress-bar-fill",er.drawer="drawer",er.summation="summation",er["table-parent-row"]="table-parent-row",er["table-row"]="table-row",er["table-sub-row"]="table-sub-row",er.tile="tile",er["tile-bar-label"]="tile-bar-label",er["tile-bar-label-outer"]="tile-bar-label-outer",er["tile-body"]="tile-body",er["tile-filter-button"]="tile-filter-button",er["tile-filter-list"]="tile-filter-list",er["tile-filter-row"]="tile-filter-row",er["tile-header"]="tile-header",er["business-owner-dashboard"]="business-owner-dashboard",er["business-owner-dashboard-header"]="business-owner-dashboard-header",er["transaction-type-label"]="transaction-type-label",er["transaction-date-cell-container"]="transaction-date-cell-container",er["selector-row"]="selector-row",er["popup-list"]="popup-list",er.badge="badge",er["badge-chip"]="badge-chip",er["date-cell"]="date-cell",er["vertical-divider"]="vertical-divider",er["horizontal-divider"]="horizontal-divider",er["checkbox-input"]="checkbox-input",er["bulk-select"]="bulk-select",er["button-base"]="button-base",er["button-discreet-small"]="button-discreet-small",er["button-primary"]="button-primary",er["button-secondary"]="button-secondary",er["button-success"]="button-success",er["button-danger"]="button-danger",er["button-warning"]="button-warning",er["button-action"]="button-action",er["button-table-header"]="button-table-header",er["button-inline"]="button-inline",er["small-square-button"]="small-square-button",er.card="card",er["card-button"]="card-button",er["card-button-icon-container"]="card-button-icon-container",er["pagination-button"]="pagination-button",er.text="text",er["cell-button"]="cell-button",er["selector-button"]="selector-button",er["review-status-selector-button"]="review-status-selector-button",er["review-status-dropdown-arrow"]="review-status-dropdown-arrow",er["financial-summary-layout"]="financial-summary-layout",er["financial-summary-chatbox"]="financial-summary-chatbox",er["financial-summary-chatbox-header"]="financial-summary-chatbox-header",er["month-picker"]="month-picker",er["month-picker-left-button"]="month-picker-left-button",er["month-picker-right-button"]="month-picker-right-button",er["month-picker-label"]="month-picker-label",er["filter-bar"]="filter-bar",er["filter-search-bar"]="filter-search-bar",er.pill="pill",er["filter-pill"]="filter-pill",er["email-pill"]="email-pill",er["discreet-form-input"]="discreet-form-input",er["editable-form-input"]="editable-form-input",er["category-text"]="category-text",er["amount-input-container"]="amount-input-container",er["amount-input"]="amount-input",er["modal-popup"]="modal-popup",er["drawer-header"]="drawer-header",er["form-body"]="form-body",er.body="body",er.heading="heading",er["sub-label"]="sub-label",er["strong-label"]="strong-label",er["strong-sub-label"]="strong-sub-label",er["weak-label"]="weak-label",er["metric-xl"]="metric-xl",er["metric-md"]="metric-md",er["large-icon"]="large-icon",er["medium-icon"]="medium-icon",er["small-icon"]="small-icon",er["tiny-icon"]="tiny-icon",er["x-large-icon"]="x-large-icon",er["xx-large-icon"]="xx-large-icon",er["category-icon"]="category-icon",er["card-header"]="card-header",er.icon="icon",er["neutral-badge"]="neutral-badge",er["highlight-badge"]="highlight-badge",er["success-badge"]="success-badge",er["warning-badge"]="warning-badge",er["danger-badge"]="danger-badge",er["critical-badge"]="critical-badge",er["button-group"]="button-group",er["alert-dialog"]="alert-dialog",er["alert-header"]="alert-header",er["emphasis-label"]="emphasis-label",er["profit-loss-graph"]="profit-loss-graph",er.banner="banner",er["banner-high"]="banner-high",er["banner-medium"]="banner-medium",er["banner-low"]="banner-low",er["banner-urgent"]="banner-urgent",er["banner-default"]="banner-default",er["banner-button"]="banner-button",er["banner-button-text"]="banner-button-text",er["banner-button-icon"]="banner-button-icon",er["banner-icon"]="banner-icon",er["banner-title"]="banner-title",er["empty-dashboard-layout"]="empty-dashboard-layout",er["emphasis-sub-label"]="emphasis-sub-label",er["bar-transactions-positive"]="bar-transactions-positive",er["bar-transactions-negative"]="bar-transactions-negative",er["message-sent"]="message-sent",er["message-received"]="message-received",er["date-amount-header"]="date-amount-header",er["close-button"]="close-button",er["start-date-form-section"]="start-date-form-section",er["beginning-balance-form-section"]="beginning-balance-form-section",er["date-picker-nav-button"]="date-picker-nav-button",er["date-picker-day-button"]="date-picker-day-button",er["dropdown-selector-button"]="dropdown-selector-button",er.chip="chip",er["attachment-dropzone"]="attachment-dropzone",er["list-body"]="list-body",er["loading-skeleton"]="loading-skeleton",er["line-item-card"]="line-item-card",er["linked-entity-row"]="linked-entity-row",er["drawer-search-bar"]="drawer-search-bar",er["value-comparison-summary"]="value-comparison-summary",er["category-selector-table-cell"]="category-selector-table-cell",er["zero-state-button"]="zero-state-button",er);const nr=e=>null==e,rr=e=>!nr(e),ar="Tight-",or=e=>`${ar}${e}`;function ir(e){return e in tr}function lr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===ar&&r in tr}function sr(e){return!ir(e)&&!lr(e)}const cr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(or(e)),t.forEach(e=>{nr(e)||(sr(e)?r.push(e):ir(e)?n.push(or(e)):lr(e)&&n.push(e))}),{className:Xn(...n,...r)}},dr=cr(tr["business-owner-dashboard-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function ur({children:e}){return S("div",{...dr,children:e})}function hr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(lr(t)&&e.push(t),e),[])],[])}function pr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(sr(t)&&e.push(t),e),[])],[])}function gr(e){const t=Array.isArray(e)?e:[e];return{className:Xn(...hr(t),...pr(t))}}const mr=$n({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:{xl:"16px",base:"18px"}}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:{xl:"16px",base:"18px"}},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:{xl:"14px",base:"16px"}},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"20px",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"16px"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:{sm:"16px",base:"20px"}},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:{xl:"14px",base:"16px"}},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:{xl:"14px",base:"16px"}}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"25px"}},metric:{sm:{fontWeight:"metric.sm",fontSize:"metric.sm",fontFamily:"metric",color:"typography.metric.sm"},md:{fontWeight:"metric.md",fontSize:"metric.md",fontFamily:"metric",color:"typography.metric.md"},lg:{fontWeight:"metric.lg",fontSize:"metric.lg",fontFamily:"metric",color:"typography.metric.lg"},xl:{fontWeight:"metric.xl",fontSize:"metric.xl",fontFamily:"metric",color:"typography.metric.xl"}}}}),vr=cr(tr.heading,mr({heading:"default"}));function br({children:e,stylists:t=[]}){const n=gr([vr,...t]);return S("div",{...n,children:e})}function fr(e,t,n){return[...e,{accessToken:t,environment:n}]}function yr(e,t){return[...e,t]}function xr(e){return""===e.trim()}function Cr(e){return nr(e)||xr(e)}function Tr(e){return!Cr(e)}const wr=i({activeToken:void 0,accountantToken:void 0});function kr(){const{activeToken:e}=l(wr);return e}const Er=()=>{throw new Error("No access token provided")},Ar=72e5,Ir=new D({defaultOptions:{queries:{gcTime:Ar,staleTime:3e4,refetchInterval:6e4}}}),Sr=i("SANDBOX");function Nr(){return l(Sr)}function Rr({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=M({...n,queryKey:i,queryFn:o?t:Er,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Dr{constructor(e){this.client=e}async sendEvent({apiKey:e,events:t,notifier:n,payloadVersion:r}){const a=/* @__PURE__ */(new Date).toISOString(),o=JSON.stringify({apiKey:e,payloadVersion:r,notifier:n,events:t});await fetch(this.client.endpoints.notify,{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":r,"Bugsnag-Sent-At":a},referrerPolicy:"no-referrer",body:o})}}const Pr=Symbol("Circular"),Mr=Symbol("AccessError");function Lr(e,t,n){return Fr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Fr({key:e,value:t,replacer:n,seen:r,depthLimit:a=1/0,depth:o,edgeIndex:i,edgesLimit:l=1/0}){let s=t;if(r.includes(s)&&(s=Pr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Or(()=>s.toJSON(String(e)))),null===s||"object"!=typeof s)return s;var c;if(o>a||i+1>l)return"[...]";if(r.push(t),Array.isArray(s)){const e=[],t=Math.min(s.length,l);for(let i=0;i<t;i++){const t=Or(()=>s[i]);e.push(Fr({key:i,value:t,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l}))}t<s.length&&e.push("[...]"),s=e}else{const e={},t=Object.keys(s);for(let i=0;i<t.length;i++){const c=t[i],d=Or(()=>s[c]);e[c]=Fr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Or(e){try{return e()}catch{return Mr}}const Vr=Object.prototype.toString,Br=Object.getPrototypeOf;function Ur(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Wr=/^\s*at .*(\S+:\d+|\(native\))/m,Hr=/^(eval@)?(\[native code])?$/;function zr(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)return[e];const n=t[2]?parseInt(t[2],10):void 0,r=t[3]?parseInt(t[3],10):void 0;return[t[1],n,r]}function qr(e,t){const n=jr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Ur(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[Kr(n)];return a.push(...Zr(n).map(e=>Kr(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function jr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Vr.call(t))return!0;t=Br(t)}return!1}(e))return e;let n=function(e){if(!Ur(e))return null;const t=t=>{const n=e[t];if("string"==typeof n&&e[t.length])return n},n=t("name")||t("errorClass"),r=t("message")||t("errorMessage");if(!n||!r)return null;const a=new Error(r);return a.name=n,a}(e);if(n)return n;switch(typeof n){case"string":case"number":case"boolean":return new Error(String(e));default:return n=new Error(`${t} received a non-error. See "${t}" tab for more detail.`),n.name="InvalidError",n}}function Kr(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:_r(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function _r(e,{backtrace:t}){const n=function(e){let t=e.stack;return void 0===t&&(t=e.stacktrace),"string"==typeof t&&t.length&&t!==`${e.name}: ${e.message}`?t:void 0}(e);return n?function(e){return(e.match(Wr)?e.split("\n").filter(e=>!!e.match(Wr)).map(e=>{e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),a=zr(n?n[1]:r.pop()||"(no location)"),o=r.join(" ")||void 0;return{file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2],method:o}}):(t=e,t.split("\n").filter(e=>!e.match(Hr)).map(e=>{if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{method:e};{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=zr(e.replace(t,""));return{file:a[0],lineNumber:a[1],columnNumber:a[2],method:r}}}))).reduce((e,t)=>{if("{}"===JSON.stringify(t))return e;let n=t.file||t.method||"number"!=typeof t.lineNumber?t.file||"(unknown file)":"global code";n=n.replace(/\?.*$/,"").replace(/#.*$/,"");let r=t.method||"(unknown function)";return r=/^global code$/i.test(r)?"global code":r,e.concat([{file:n,lineNumber:t.lineNumber,columnNumber:t.columnNumber,method:r}])},[]);var t}(n):t?function(){const e=[];let t;try{t=arguments.callee}catch{return[]}for(;t&&e.length<Yr;){t.name?e.push({method:t.name,file:"(unknown file)"}):/function(?:\s+([\w$]+))+\s*\(/.test(t.toString())&&e.push({method:RegExp.$1,file:"(unknown file)"});try{t=t.caller}catch{break}}return e}():[]}const Yr=20;function Zr(e){const t=e;if(t.cause){const e=jr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(Zr(e))}return[]}function Gr(...e){console.error}const Qr={name:"errorBreadcrumbs",load(e){e.addOnPostError(t=>{e.leaveBreadcrumb(t.exceptions[0].errorClass,{errorClass:t.exceptions[0].errorClass,errorMessage:t.exceptions[0].message,severity:t.severity},"error")})}};let Xr=Date.now();const Jr=()=>{Xr=Date.now()},$r={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-Xr,!0}),{reset:Jr})},ea=[["Edge (EdgeHTML)",/Edge\/([0-9._]+)/],["Edge (iOS)",/EdgiOS\/([0-9._]+)/],["Yandex",/YaBrowser\/([0-9._]+)/],["KakaoTalk",/KAKAOTALK\s([0-9.]+)/],["Samsung",/SamsungBrowser\/([0-9.]+)/],["Silk",/\bSilk\/([0-9._-]+)\b/],["MIUI",/MiuiBrowser\/([0-9.]+)$/],["Beaker",/BeakerBrowser\/([0-9.]+)/],["Edge (Chromium)",/EdgA?\/([0-9.]+)/],["Chromium WebView",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome (iOS)",/CriOS\/([0-9.]+)(:?\s|$)/],["Firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["Firefox (iOS)",/FxiOS\/([0-9.]+)/],["Opera Mini",/Opera Mini.*Version\/([0-9.]+)/],["Opera",/Opera\/([0-9.]+)(?:\s|$)/],["Opera",/OPR\/([0-9.]+)(:?\s|$)/],["Internet Explorer",/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/],["Internet Explorer",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["Internet Explorer",/MSIE\s(7\.0)/],["Blackberry",/BB10;\sTouch.*Version\/([0-9.]+)/],["Android",/Android\s([0-9.]+)/],["Safari (iOS)",/Version\/([0-9._]+).*Mobile.*Safari.*/],["Safari",/Version\/([0-9._]+).*Safari/],["Facebook",/FB[AS]V\/([0-9.]+)/],["Instagram",/Instagram\s([0-9.]+)/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Mobile/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Gecko\)$/]],ta=[["iOS",void 0,/iP(hone|od|ad)/],["Android",void 0,/Android/],["BlackBerry",void 0,/BlackBerry|BB10/],["Windows Mobile",void 0,/IEMobile/],["Kindle",void 0,/Kindle/],["Windows","3.11",/Win16/],["Windows","95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows","98",/(Windows 98)|(Win98)/],["Windows","2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows","XP",/(Windows NT 5.1)|(Windows XP)/],["Windows","Server 2003",/(Windows NT 5.2)/],["Windows","Vista",/(Windows NT 6.0)/],["Windows","7",/(Windows NT 6.1)/],["Windows","8",/(Windows NT 6.2)/],["Windows","8.1",/(Windows NT 6.3)/],["Windows","10+",/(Windows NT 10.0)/],["Windows","ME",/Windows ME/],["Open BSD",void 0,/OpenBSD/],["Sun OS",void 0,/SunOS/],["Chrome OS",void 0,/CrOS/],["Linux",void 0,/(Linux)|(X11)/],["Mac OS",void 0,/(Mac_PowerPC)|(Macintosh)/],["QNX",void 0,/QNX/],["BeOS",void 0,/BeOS/],["OS/2",void 0,/OS\/2/]],na=(ra=function(e){const t=""!==(n=e)&&ea.reduce((e,[t,r])=>{if(e)return e;const a=r.exec(n);return!!a&&[t,a]},!1);var n;if(!t)return{};const[r,a]=t,o=function(e){for(const[t,n,r]of ta)if(r.exec(e))return{osName:t,osVersion:n};return null}(e),i="iOS"===o?.osName?function(e){const t=/iPad|iPhone|iPod/.exec(e);return t?{manufacturer:"Apple",model:t[0]}:/MacIntel/.test(e)&&self.navigator&&self.navigator.maxTouchPoints&&self.navigator.maxTouchPoints>2?{manufacturer:"Apple",model:"iPad"}:null}(e):{};return{browserName:r,browserVersion:a[1],osName:o?.osName,osVersion:o?.osVersion,manufacturer:i?.manufacturer,model:i?.model}},{name:"browserContext",load(e){e.addOnError(e=>{e.request={...e.request,url:self.location.href},e.context=e.context||self.location.pathname,e.device={...e.device,...ra(self.navigator.userAgent),locale:self.navigator.language,userAgent:self.navigator.userAgent};let t=["n/a"];try{t=self.navigator.languages}catch{}return e.metaData={...e.metaData,language:{language:self.navigator.language,languages:t}},!0})}});var ra;class aa{limit;period;events;constructor(e,t){this.limit=e,this.period=t,this.events=new B}reset(){this.events.clear()}increment(){const e=/* @__PURE__ */(new Date).getTime();if(void 0!==this.period){let t=this.events.peek();for(;void 0!==t&&e-this.period>t;)this.events.dequeue(),t=this.events.peek()}const t=this.events.size+1<=this.limit;return t&&this.events.enqueue(e),t}get size(){return this.events.size}}class oa extends s{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}handleClearError(){this.setState({error:void 0,errorInfo:void 0})}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){const{exceptions:n,metadata:r}=qr(e,"notify");t&&t.componentStack&&(t.componentStack=function(e){const t=e.split(/\s*\n\s*/g);let n="";for(let r=0,a=t.length;r<a;r++)t[r].length&&(n+=`${n.length?"\n":""}${t[r]}`);return n}(t.componentStack));const{onError:a,client:o}=this.props;o.notifyEvent({exceptions:n,unhandled:!0,severity:"error",severityReason:{type:"unhandledException"},metadata:{...r,react:t},onError:a},e),this.setState({errorInfo:t})}render(){const{error:e}=this.state;if(e){const{FallbackComponent:e}=this.props;if(e)return S(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return S(N,{children:this.props.children})}}const ia={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>S(oa,{client:e,onError:t,FallbackComponent:n,children:r})})},la=new class{breadcrumbs=[];config;delivery=new Dr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return Gr(),this;let t;this.config=e,this.config.onError&&(t=Array.isArray(this.config.onError)?this.config.onError:[this.config.onError]),this.errorCallbacks=new Set(t);for(const n of this.config.plugins||[])this.plugins.push({name:n.name||"unknown",plugin:n.load(this)});return this}get endpoints(){return{notify:this.config?.endpoints?.notify||"https://notify.bugsnag.com/"}}notify(e,t={}){const{exceptions:n,metadata:r}=qr(e,"notify");let a,o,i=r;return"function"==typeof t?a=t:(o=t.severity,t.metadata&&(i={...r,...t.metadata})),this.notifyEvent({exceptions:n,metadata:i,severity:o,onError:a},e)}leaveBreadcrumb(e,t,n){if(!this.config)return;if("string"!=typeof e)try{e=String(e)}catch{e="Unable to stringify breadcrumb message"}if(!e.length)return;this.breadcrumbs.push({name:e,metaData:t,type:n||"manual",timestamp:/* @__PURE__ */(new Date).toISOString()});const{maxBreadcrumbs:r=25}=this.config;this.breadcrumbs.length>r&&this.breadcrumbs.splice(0,this.breadcrumbs.length-r)}async notifyEvent({exceptions:e,unhandled:t,severity:n,severityReason:r,metadata:a,onError:o},i){if(!this.config)return;const l=this.config.releaseStage||"production";if(this.config.enabledReleaseStages&&!this.config.enabledReleaseStages.includes(l))return;const s={exceptions:e,breadcrumbs:this.breadcrumbs.length?this.breadcrumbs:void 0,originalError:i,unhandled:"boolean"==typeof t&&t,severity:n||"warning",severityReason:r,user:this.config.user||void 0,app:{releaseStage:l,version:this.config.appVersion,type:this.config.appType||("object"==typeof window?"browser":"node")},device:{time:/* @__PURE__ */(new Date).toISOString()},metaData:a||{}},c=[...this.errorCallbacks];o&&c.push(o);const d=["stringifyValues","redact"];c.sort((e,t)=>d.includes(e.name)&&d.includes(t.name)?0:d.includes(e.name)?1:d.includes(t.name)?-1:0);for(const m of c){const e=await m(s);if("boolean"==typeof e&&!e)return}const u=Lr(s,(e,t)=>{if("originalError"!==e)return t},{depthLimit:20,edgesLimit:500});let h;const p={apiKey:this.config.apiKey,payloadVersion:"5",notifier:{name:"Tight Components",version:"1",url:"https://github.com/tight-embedded/TraxComponents/tree/dev/packages/react/src/bugsnag/README.md"},events:[u]};try{h=JSON.stringify(p)}catch{u.metaData={notifier:"Unable to serialize metadata"},h=JSON.stringify(p)}if(h.length>1e6&&(u.metaData={notifier:`Payload was ${h.length/1e6}Mb. Metadata removed.`},h=JSON.stringify(p),h.length>1e6))throw new Error("Payload exceeded 1Mb limit");for(const m of this.postErrorCallbacks)m(s);try{await this.delivery.sendEvent(p)}catch(g){Gr()}}getUser(){return this.config?.user||{}}setUser(e,t,n){this.config&&(this.config.user={id:e,email:t,name:n})}setProperties(e){this.config&&(this.config.releaseStage=e)}addOnError(e){this.errorCallbacks.add(e)}removeOnError(e){this.errorCallbacks.delete(e)}addOnPostError(e){this.postErrorCallbacks.add(e)}removeOnPostError(e){this.postErrorCallbacks.delete(e)}getPlugin(e){return this.plugins.find(t=>t.name===e)?.plugin}setDelivery(e){this.delivery=e}};let sa="",ca="";const da="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",ua=la.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.7.0",appType:"browser",releaseStage:da,enabledReleaseStages:["prod","DEV"],plugins:[$r,na,Qr,(()=>{const e=new aa(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),ia]}),ha=(e,t)=>{try{la.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?pa({error:n,severity:"error"}):pa({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},pa=async e=>{try{await la.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:sa,environment:ca}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await pa({error:t,severity:"error"}):await pa({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},ga=ua.getPlugin("react"),ma=ga?.BugsnagErrorBoundary,va=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,ba=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},fa=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},ya={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function xa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...x(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?ya:{}}});return{url:(n=e.endpointManager.getUrl(e.path),r=e.pathParams,void 0!==r&&Object.entries(r).forEach(([e,t])=>{n=n.replace(`{${e}}`,t)}),n),headers:t};var n,r}async function Ca({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=ba({extraHeaders:t,authorization:e});ha("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ha("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),fa(e)}catch(l){return Promise.reject(l)}}async function Ta(e){const{url:t,headers:n}=xa(e);return Ca({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function wa(e){return Ta(e)}async function ka(e){return Ta(e)}const Ea=(e,t)=>({getUrl:t=>((e,t)=>{let n=t;for(;n.length>0&&"/"===n.charAt(0);)n=n.slice(1);return`${e}/${n}`})(e,t),baseUrl:e,apiVersion:t}),Aa={DEVELOPMENT:"https://dev.hurdlr.com/rest",PRODUCTION:"https://prod.hurdlr.com/rest",SANDBOX:"https://sandbox.hurdlr.com/rest",LOCAL:"http://localhost:8081/TraxAngular/rest",DEVELOPMENT_RC:"https://dev.hurdlr.com/rest",SANDBOX_RC:"https://sandbox.hurdlr.com/rest",PRODUCTION_RC:"https://prod.hurdlr.com/rest"},Ia={DEVELOPMENT:"https://dev.tight.com",PRODUCTION:"https://prod.tight.com",SANDBOX:"https://sandbox.tight.com",LOCAL:"http://localhost:8080",DEVELOPMENT_RC:"https://qa.dev.tight.com",SANDBOX_RC:"https://qa.sandbox.tight.com",PRODUCTION_RC:"https://qa.prod.tight.com"},Sa={...Ia,LOCAL:"http://localhost:8082"};function Na(e){return Ea(`${t=e,Aa[t]}/v5`,"v5");var t}const Ra=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Da=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Na(a)};return await ka(o)};function Pa({filter:e,grouping:t,select:n,accountingMethod:r}){return Rr({queryKey:Ra({filter:e,grouping:t,accountingMethod:r}),queryFn:Da,select:n})}const Ma="noDataHeight";function La(e){const t=Pt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function Fa(e){const t=La(e.period?.beginDate),n=e.netIncome??0,{profit:r,remainingIncome:a,loss:o,remainingExpenses:i}=function(e,t,n){const r=e>0?e:0,a=e<0?e:0;return{profit:r,remainingIncome:void 0!==t?U(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?U(n).plus(a).toNumber():0}}(n,e.income?.total,e.expenses?.total);return{month:{month:t,income:a,expenses:-i,profit:r,loss:o,netIncome:n,hasNoData:/* @__PURE__ */function(e,t,n){return 0===e&&0===t&&0===n}(n,a,i)},netIncome:n}}function Oa(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(nr(n))return t;for(const i of n){const{month:e,netIncome:n}=Fa(i);t.total=U(n).plus(t.total).toNumber(),t.months.push(e)}const{domainMin:r,domainMax:a}=n.reduce((e,t)=>({domainMin:Math.min(e.domainMin,-(t.expenses?.total??0)),domainMax:Math.max(e.domainMax,t.income?.total??0)}),{domainMin:0,domainMax:0});t.domain=[r,a],t.hasAnyData=t.months.some(e=>!e.hasNoData);const o=function(e,t){const n=t-e;return n>0?.03*n:3}(r,a);return t.months=t.months.map(e=>e.hasNoData?{...e,noDataHeight:o}:e),t}const Va="MONTHLY",Ba=cr(tr["tile-header"],Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ua({title:e}){return S("div",{...Ba,children:S(br,{children:e})})}const Wa=cr(tr["tile-body"],Gn({display:"flex",justifyContent:"start",alignItems:"start",flexDirection:"column",gap:"20px",height:"100%",padding:"20px 15px",backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderBottomRadius:"lg",borderTop:"hidden"}));function Ha({children:e}){return S("div",{...Wa,children:e})}const za=$n({base:{display:"flex",flexDirection:"column",boxShadow:"box-shadow",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg",overflow:"hidden"},variants:{type:{default:{minWidth:"295px",maxWidth:"426px",width:"100%",height:"295px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function qa({children:e,type:t,isSample:n=!1}){const r=cr(tr.tile,za({type:t,isSample:n}));return S("div",{...r,children:e})}const ja=Gn({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Ka=Gn.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),_a=Gn.raw({whiteSpace:"normal",overflowWrap:"break-word"}),Ya=Gn.raw({overflow:"visible",whiteSpace:"nowrap"}),Za=Gn({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"12px"}),Ga=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px"}),Qa=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"16px"}),Xa=Gn.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"14px"}),Ja=cr(tr.text,Gn({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function $a({children:e}){return S("div",{...Ja,children:e})}const eo=cr(tr["metric-xl"],mr({metric:"xl"}));function to(e){return S("div",{...eo,children:e.children})}const no=cr(tr.summation,Gn({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function ro({title:e,label:t}){return R("div",{...no,children:[S(to,{children:e}),S($a,{children:t})]})}const ao=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function oo({children:e}){return S("div",{...ao,children:e})}const io=(e,t=0)=>{const n=Math.abs(e);let r;if(t<=0)r=Math.round(n);else{const e=n.toFixed(t);r=parseFloat(e)}return Math.sign(e)*r},lo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),so=1e9;function co(e,t={}){const{cents:n="default",condense:r=!1,dollarSign:a=!1,decorator:o,signage:i="default"}=t,l="string"==typeof e?parseFloat(e):e;if(Number.isNaN(l))return"";let s;const c=Math.abs(l);let d;if(r&&c>99999)d=Math.sign(l)<0,s=function(e){const t=Math.floor((n=e,Math.log(n)/Math.log(1e3)))-1;var n;const r=Math.pow(1e3,t),a=Math.round(e/r),o=a*r;let i,l=a/1e3;return e<so&&l>=1e3&&(l/=1e3),o>=so?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${lo(l,0,1)}${i}`}(c);else{const{minPrecision:e,precision:t,roundedValue:r}=function(e,t){if("floor"===t)return{precision:0,minPrecision:0,roundedValue:(n=e,Math.sign(n)*Math.floor(Math.abs(n)))};if("round"===t){const t=0;return{precision:t,minPrecision:0,roundedValue:io(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:io(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:io(e,t)}}{const t=2,n=io(e,t);return{precision:t,roundedValue:n,minPrecision:n%1==0?0:2}}var n}(l,n);d=Math.sign(r)<0;const a=Math.abs(r);s=lo(a,e,t)}if(a)return function(e,t,n,r){let a=e;const o=n?"$":"";return void 0===r||"off"===r?a=`${o}${e}`:"parens"===r?a=`${o}${t?`(${e})`:e}`:"always"===r?a=`${t?"-":"+"}${o}${e}`:"default"===r&&(a=`${t?"-":""}${o}${e}`),a}(s,d,a,i);const u=(h=s,"$"===(p=o)?`${p}${h}`:"%"===p?`${h}${p}`:h);var h,p;return"off"===i?u:"parens"===i?d?`(${u})`:u:"always"===i?`${d?"-":"+"}${u}`:"default"===i?`${d?"-":""}${u}`:u}function uo(e){return co(e,{condense:!0,dollarSign:!0})}function ho(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function po(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function go(e,t){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const mo=$n({variants:{wrap:{ellipsis:Ka,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function vo({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Cr(n))return null;const a=gr([cr(tr["strong-label"],tr.text,mr({label:"strongLabel"}),mo({wrap:e,textAlign:t})),...r]);return S("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const bo=$n({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"16px",fontStyle:"normal",xl:{lineHeight:"14px",fontSize:"label.sub"}},variants:{intent:{weak:{color:"typography.base.weak"},normal:{color:"typography.label.sub"},action:{color:"typography.intent.action"},primary:{color:"typography.intent.primary"},danger:{color:"typography.accent.danger"}},accent:{action:{_supportHover:{color:"typography.accent.action",transition:"color 100ms ease-out"},transition:"color 300ms ease-out"},active:{color:"typography.accent.action"},strongest:{color:"brand.action.strongest"}},wrap:{ellipsis:Ka,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:Ka,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function fo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=cr(tr["sub-label"],tr.text,bo({intent:e,wrap:t,accent:r}),ja);return Cr(n)?null:S("div",{...a,children:n})}const yo=cr(null,Gn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"10px",width:"fit-content",height:"fit-content"}));function xo({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ma)return null;let n=t[0].value??0;return"expenses"===t[0].dataKey?n+=t[0].payload.loss:"income"===t[0].dataKey&&(n+=t[0].payload.profit),R("div",{...yo,children:[S(vo,{children:t[0].name??""}),S(fo,{children:uo(Number(n))})]})}const Co={"colors.white100":{value:"#FFFFFF",variable:"var(--Tight-colors-white100)"},"colors.white200":{value:"#F9F9F9",variable:"var(--Tight-colors-white200)"},"colors.white300":{value:"#EDEDED",variable:"var(--Tight-colors-white300)"},"colors.white600":{value:"#E7E8E9",variable:"var(--Tight-colors-white600)"},"colors.white700":{value:"#E0E2E3",variable:"var(--Tight-colors-white700)"},"colors.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"colors.black200":{value:"#A7ACAD",variable:"var(--Tight-colors-black200)"},"colors.black300":{value:"#A4A9AB",variable:"var(--Tight-colors-black300)"},"colors.black400":{value:"#6F7576",variable:"var(--Tight-colors-black400)"},"colors.black600":{value:"#50595C",variable:"var(--Tight-colors-black600)"},"colors.black700":{value:"#182428",variable:"var(--Tight-colors-black700)"},"colors.black800":{value:"#030506",variable:"var(--Tight-colors-black800)"},"colors.blue200":{value:"#EDFAFC",variable:"var(--Tight-colors-blue200)"},"colors.blue300":{value:"#DAF4FA",variable:"var(--Tight-colors-blue300)"},"colors.blue400":{value:"#CAECF3",variable:"var(--Tight-colors-blue400)"},"colors.blue500":{value:"#94D8E8",variable:"var(--Tight-colors-blue500)"},"colors.blue700":{value:"#2AB2D1",variable:"var(--Tight-colors-blue700)"},"colors.blue900":{value:"#177F96",variable:"var(--Tight-colors-blue900)"},"colors.green100":{value:"#EDFAF4",variable:"var(--Tight-colors-green100)"},"colors.green200":{value:"#DBF9EA",variable:"var(--Tight-colors-green200)"},"colors.green300":{value:"#B8F3D5",variable:"var(--Tight-colors-green300)"},"colors.green400":{value:"#94E8BD",variable:"var(--Tight-colors-green400)"},"colors.green500":{value:"#5FDD9C",variable:"var(--Tight-colors-green500)"},"colors.green700":{value:"#009C75",variable:"var(--Tight-colors-green700)"},"colors.green900":{value:"#067559",variable:"var(--Tight-colors-green900)"},"colors.yellow200":{value:"#FFF3C3",variable:"var(--Tight-colors-yellow200)"},"colors.yellow300":{value:"#FFE787",variable:"var(--Tight-colors-yellow300)"},"colors.yellow400":{value:"#FCD34D",variable:"var(--Tight-colors-yellow400)"},"colors.yellow500":{value:"#FBBF24",variable:"var(--Tight-colors-yellow500)"},"colors.yellow700":{value:"#F59E0B",variable:"var(--Tight-colors-yellow700)"},"colors.yellow800":{value:"#B35F00",variable:"var(--Tight-colors-yellow800)"},"colors.red200":{value:"#FFCBCB",variable:"var(--Tight-colors-red200)"},"colors.red300":{value:"#FF9797",variable:"var(--Tight-colors-red300)"},"colors.red400":{value:"#F45C5C",variable:"var(--Tight-colors-red400)"},"colors.red500":{value:"#E84747",variable:"var(--Tight-colors-red500)"},"colors.red700":{value:"#E42525",variable:"var(--Tight-colors-red700)"},"fonts.base":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-base)"},"fontSizes.sm":{value:"12px",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"14px",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"16px",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"20px",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"24px",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.sm":{value:"400",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"600",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"900",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.sm":{value:"1px",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"2px",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"4px",variable:"var(--Tight-radii-lg)"},"borderWidths.sm":{value:"0.5px",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"1px",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"1px",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"2px",variable:"var(--Tight-borderWidths-xl)"},"animations.appear.instant":{value:"0.25s linear fade-in",variable:"var(--Tight-animations-appear-instant)"},"animations.appear.delay":{value:"0.25s linear both 1.5s fade-in",variable:"var(--Tight-animations-appear-delay)"},"animations.shimmer":{value:"2s ease-in-out infinite shimmer",variable:"var(--Tight-animations-shimmer)"},"animations.spin":{value:"1.5s ease-in-out 0.1s spin infinite",variable:"var(--Tight-animations-spin)"},"shadows.box-shadow":{value:"0px 10px 30px 0px rgba(0, 0, 0, 0.05), 0px 4px 12px 0px rgba(0, 0, 0, 0.15) ",variable:"var(--Tight-shadows-box-shadow)"},"breakpoints.sm":{value:"640px",variable:"var(--Tight-breakpoints-sm)"},"breakpoints.md":{value:"850px",variable:"var(--Tight-breakpoints-md)"},"breakpoints.lg":{value:"1024px",variable:"var(--Tight-breakpoints-lg)"},"breakpoints.xl":{value:"1280px",variable:"var(--Tight-breakpoints-xl)"},"breakpoints.1.5xl":{value:"1400px",variable:"var(--Tight-breakpoints-1.5xl)"},"breakpoints.2xl":{value:"1536px",variable:"var(--Tight-breakpoints-2xl)"},"sizes.breakpoint-sm":{value:"640px",variable:"var(--Tight-sizes-breakpoint-sm)"},"sizes.breakpoint-md":{value:"850px",variable:"var(--Tight-sizes-breakpoint-md)"},"sizes.breakpoint-lg":{value:"1024px",variable:"var(--Tight-sizes-breakpoint-lg)"},"sizes.breakpoint-xl":{value:"1280px",variable:"var(--Tight-sizes-breakpoint-xl)"},"sizes.breakpoint-1.5xl":{value:"1400px",variable:"var(--Tight-sizes-breakpoint-1.5xl)"},"sizes.breakpoint-2xl":{value:"1536px",variable:"var(--Tight-sizes-breakpoint-2xl)"},"colors.brand.primary.weaker":{value:"var(--Tight-colors-black200)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-black800)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-blue200)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-blue300)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-blue500)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-blue700)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-blue900)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-green100)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-green300)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-green500)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-green900)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-yellow200)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-yellow300)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-yellow500)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-yellow700)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-yellow800)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-red300)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-red500)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"transparent",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.accent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-green200)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"rgba(0, 0, 0, 0.5)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"transparent",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"none",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"currentColor",variable:"var(--Tight-colors-currentColor)"},"fonts.body":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-body)"},"fonts.label":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-label)"},"fonts.heading":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-heading)"},"fonts.metric":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-metric)"},"fontWeights.global":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-global)"},"fontWeights.body":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-body)"},"fontWeights.label":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label)"},"fontWeights.label.strong":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strong)"},"fontWeights.label.sub":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label-sub)"},"fontWeights.label.strongSub":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strongSub)"},"fontWeights.label.emphasisSub":{value:"var(--Tight-fontWeights-lg)",variable:"var(--Tight-fontWeights-label-emphasisSub)"},"fontWeights.heading":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-heading)"},"fontWeights.title":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-title)"},"fontWeights.metric.sm":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-sm)"},"fontWeights.metric.md":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-md)"},"fontWeights.metric.lg":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-lg)"},"fontWeights.metric.xl":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-xl)"},"fontSizes.title":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-title)"},"fontSizes.body":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-body)"},"fontSizes.label":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label)"},"fontSizes.label.strong":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label-strong)"},"fontSizes.label.sub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-sub)"},"fontSizes.label.strongSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-strongSub)"},"fontSizes.label.emphasisSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-emphasisSub)"},"fontSizes.heading":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-heading)"},"fontSizes.metric.sm":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-metric-sm)"},"fontSizes.metric.md":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-metric-md)"},"fontSizes.metric.lg":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-metric-lg)"},"fontSizes.metric.xl":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-metric-xl)"},"colors.colorPalette":{value:"var(--Tight-colors-colorPalette)",variable:"var(--Tight-colors-colorPalette)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.primary":{value:"var(--Tight-colors-colorPalette-primary)",variable:"var(--Tight-colors-colorPalette-primary)"},"colors.colorPalette.primary.strong":{value:"var(--Tight-colors-colorPalette-primary-strong)",variable:"var(--Tight-colors-colorPalette-primary-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.secondary.weaker":{value:"var(--Tight-colors-colorPalette-secondary-weaker)",variable:"var(--Tight-colors-colorPalette-secondary-weaker)"},"colors.colorPalette.secondary.weak":{value:"var(--Tight-colors-colorPalette-secondary-weak)",variable:"var(--Tight-colors-colorPalette-secondary-weak)"},"colors.colorPalette.secondary":{value:"var(--Tight-colors-colorPalette-secondary)",variable:"var(--Tight-colors-colorPalette-secondary)"},"colors.colorPalette.secondary.strong":{value:"var(--Tight-colors-colorPalette-secondary-strong)",variable:"var(--Tight-colors-colorPalette-secondary-strong)"},"colors.colorPalette.action.opaque":{value:"var(--Tight-colors-colorPalette-action-opaque)",variable:"var(--Tight-colors-colorPalette-action-opaque)"},"colors.colorPalette.opaque":{value:"var(--Tight-colors-colorPalette-opaque)",variable:"var(--Tight-colors-colorPalette-opaque)"},"colors.colorPalette.action.weaker":{value:"var(--Tight-colors-colorPalette-action-weaker)",variable:"var(--Tight-colors-colorPalette-action-weaker)"},"colors.colorPalette.action.weak":{value:"var(--Tight-colors-colorPalette-action-weak)",variable:"var(--Tight-colors-colorPalette-action-weak)"},"colors.colorPalette.action":{value:"var(--Tight-colors-colorPalette-action)",variable:"var(--Tight-colors-colorPalette-action)"},"colors.colorPalette.action.strong":{value:"var(--Tight-colors-colorPalette-action-strong)",variable:"var(--Tight-colors-colorPalette-action-strong)"},"colors.colorPalette.action.stronger":{value:"var(--Tight-colors-colorPalette-action-stronger)",variable:"var(--Tight-colors-colorPalette-action-stronger)"},"colors.colorPalette.action.strongest":{value:"var(--Tight-colors-colorPalette-action-strongest)",variable:"var(--Tight-colors-colorPalette-action-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"colors.colorPalette.background.hover":{value:"var(--Tight-colors-colorPalette-background-hover)",variable:"var(--Tight-colors-colorPalette-background-hover)"},"colors.colorPalette.hover":{value:"var(--Tight-colors-colorPalette-hover)",variable:"var(--Tight-colors-colorPalette-hover)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.hover":{value:"var(--Tight-colors-colorPalette-foreground-hover)",variable:"var(--Tight-colors-colorPalette-foreground-hover)"},"colors.colorPalette.foreground.disabled":{value:"var(--Tight-colors-colorPalette-foreground-disabled)",variable:"var(--Tight-colors-colorPalette-foreground-disabled)"},"colors.colorPalette.disabled":{value:"var(--Tight-colors-colorPalette-disabled)",variable:"var(--Tight-colors-colorPalette-disabled)"},"colors.colorPalette.elevated":{value:"var(--Tight-colors-colorPalette-elevated)",variable:"var(--Tight-colors-colorPalette-elevated)"},"colors.colorPalette.elevated.hover":{value:"var(--Tight-colors-colorPalette-elevated-hover)",variable:"var(--Tight-colors-colorPalette-elevated-hover)"},"colors.colorPalette.intent.primary":{value:"var(--Tight-colors-colorPalette-intent-primary)",variable:"var(--Tight-colors-colorPalette-intent-primary)"},"colors.colorPalette.intent.primary.hover":{value:"var(--Tight-colors-colorPalette-intent-primary-hover)",variable:"var(--Tight-colors-colorPalette-intent-primary-hover)"},"colors.colorPalette.primary.hover":{value:"var(--Tight-colors-colorPalette-primary-hover)",variable:"var(--Tight-colors-colorPalette-primary-hover)"},"colors.colorPalette.intent.primary.active":{value:"var(--Tight-colors-colorPalette-intent-primary-active)",variable:"var(--Tight-colors-colorPalette-intent-primary-active)"},"colors.colorPalette.primary.active":{value:"var(--Tight-colors-colorPalette-primary-active)",variable:"var(--Tight-colors-colorPalette-primary-active)"},"colors.colorPalette.active":{value:"var(--Tight-colors-colorPalette-active)",variable:"var(--Tight-colors-colorPalette-active)"},"colors.colorPalette.intent.primary.disabled":{value:"var(--Tight-colors-colorPalette-intent-primary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-primary-disabled)"},"colors.colorPalette.primary.disabled":{value:"var(--Tight-colors-colorPalette-primary-disabled)",variable:"var(--Tight-colors-colorPalette-primary-disabled)"},"colors.colorPalette.intent.secondary":{value:"var(--Tight-colors-colorPalette-intent-secondary)",variable:"var(--Tight-colors-colorPalette-intent-secondary)"},"colors.colorPalette.intent.secondary.hover":{value:"var(--Tight-colors-colorPalette-intent-secondary-hover)",variable:"var(--Tight-colors-colorPalette-intent-secondary-hover)"},"colors.colorPalette.secondary.hover":{value:"var(--Tight-colors-colorPalette-secondary-hover)",variable:"var(--Tight-colors-colorPalette-secondary-hover)"},"colors.colorPalette.intent.secondary.active":{value:"var(--Tight-colors-colorPalette-intent-secondary-active)",variable:"var(--Tight-colors-colorPalette-intent-secondary-active)"},"colors.colorPalette.secondary.active":{value:"var(--Tight-colors-colorPalette-secondary-active)",variable:"var(--Tight-colors-colorPalette-secondary-active)"},"colors.colorPalette.intent.secondary.disabled":{value:"var(--Tight-colors-colorPalette-intent-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-secondary-disabled)"},"colors.colorPalette.secondary.disabled":{value:"var(--Tight-colors-colorPalette-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-secondary-disabled)"},"colors.colorPalette.intent.action":{value:"var(--Tight-colors-colorPalette-intent-action)",variable:"var(--Tight-colors-colorPalette-intent-action)"},"colors.colorPalette.intent.action.hover":{value:"var(--Tight-colors-colorPalette-intent-action-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-hover)"},"colors.colorPalette.action.hover":{value:"var(--Tight-colors-colorPalette-action-hover)",variable:"var(--Tight-colors-colorPalette-action-hover)"},"colors.colorPalette.intent.action.active":{value:"var(--Tight-colors-colorPalette-intent-action-active)",variable:"var(--Tight-colors-colorPalette-intent-action-active)"},"colors.colorPalette.action.active":{value:"var(--Tight-colors-colorPalette-action-active)",variable:"var(--Tight-colors-colorPalette-action-active)"},"colors.colorPalette.intent.action.disabled":{value:"var(--Tight-colors-colorPalette-intent-action-disabled)",variable:"var(--Tight-colors-colorPalette-intent-action-disabled)"},"colors.colorPalette.action.disabled":{value:"var(--Tight-colors-colorPalette-action-disabled)",variable:"var(--Tight-colors-colorPalette-action-disabled)"},"colors.colorPalette.intent.action.discreet":{value:"var(--Tight-colors-colorPalette-intent-action-discreet)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet)"},"colors.colorPalette.action.discreet":{value:"var(--Tight-colors-colorPalette-action-discreet)",variable:"var(--Tight-colors-colorPalette-action-discreet)"},"colors.colorPalette.discreet":{value:"var(--Tight-colors-colorPalette-discreet)",variable:"var(--Tight-colors-colorPalette-discreet)"},"colors.colorPalette.intent.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)"},"colors.colorPalette.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-action-discreet-hover)"},"colors.colorPalette.discreet.hover":{value:"var(--Tight-colors-colorPalette-discreet-hover)",variable:"var(--Tight-colors-colorPalette-discreet-hover)"},"colors.colorPalette.intent.action.discreet.active":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-active)"},"colors.colorPalette.action.discreet.active":{value:"var(--Tight-colors-colorPalette-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-action-discreet-active)"},"colors.colorPalette.discreet.active":{value:"var(--Tight-colors-colorPalette-discreet-active)",variable:"var(--Tight-colors-colorPalette-discreet-active)"},"colors.colorPalette.intent.action.highlight":{value:"var(--Tight-colors-colorPalette-intent-action-highlight)",variable:"var(--Tight-colors-colorPalette-intent-action-highlight)"},"colors.colorPalette.action.highlight":{value:"var(--Tight-colors-colorPalette-action-highlight)",variable:"var(--Tight-colors-colorPalette-action-highlight)"},"colors.colorPalette.highlight":{value:"var(--Tight-colors-colorPalette-highlight)",variable:"var(--Tight-colors-colorPalette-highlight)"},"colors.colorPalette.intent.success":{value:"var(--Tight-colors-colorPalette-intent-success)",variable:"var(--Tight-colors-colorPalette-intent-success)"},"colors.colorPalette.intent.success.hover":{value:"var(--Tight-colors-colorPalette-intent-success-hover)",variable:"var(--Tight-colors-colorPalette-intent-success-hover)"},"colors.colorPalette.success.hover":{value:"var(--Tight-colors-colorPalette-success-hover)",variable:"var(--Tight-colors-colorPalette-success-hover)"},"colors.colorPalette.intent.success.active":{value:"var(--Tight-colors-colorPalette-intent-success-active)",variable:"var(--Tight-colors-colorPalette-intent-success-active)"},"colors.colorPalette.success.active":{value:"var(--Tight-colors-colorPalette-success-active)",variable:"var(--Tight-colors-colorPalette-success-active)"},"colors.colorPalette.intent.success.disabled":{value:"var(--Tight-colors-colorPalette-intent-success-disabled)",variable:"var(--Tight-colors-colorPalette-intent-success-disabled)"},"colors.colorPalette.success.disabled":{value:"var(--Tight-colors-colorPalette-success-disabled)",variable:"var(--Tight-colors-colorPalette-success-disabled)"},"colors.colorPalette.intent.success.highlight":{value:"var(--Tight-colors-colorPalette-intent-success-highlight)",variable:"var(--Tight-colors-colorPalette-intent-success-highlight)"},"colors.colorPalette.success.highlight":{value:"var(--Tight-colors-colorPalette-success-highlight)",variable:"var(--Tight-colors-colorPalette-success-highlight)"},"colors.colorPalette.intent.warning":{value:"var(--Tight-colors-colorPalette-intent-warning)",variable:"var(--Tight-colors-colorPalette-intent-warning)"},"colors.colorPalette.intent.warning.hover":{value:"var(--Tight-colors-colorPalette-intent-warning-hover)",variable:"var(--Tight-colors-colorPalette-intent-warning-hover)"},"colors.colorPalette.warning.hover":{value:"var(--Tight-colors-colorPalette-warning-hover)",variable:"var(--Tight-colors-colorPalette-warning-hover)"},"colors.colorPalette.intent.warning.active":{value:"var(--Tight-colors-colorPalette-intent-warning-active)",variable:"var(--Tight-colors-colorPalette-intent-warning-active)"},"colors.colorPalette.warning.active":{value:"var(--Tight-colors-colorPalette-warning-active)",variable:"var(--Tight-colors-colorPalette-warning-active)"},"colors.colorPalette.intent.warning.disabled":{value:"var(--Tight-colors-colorPalette-intent-warning-disabled)",variable:"var(--Tight-colors-colorPalette-intent-warning-disabled)"},"colors.colorPalette.warning.disabled":{value:"var(--Tight-colors-colorPalette-warning-disabled)",variable:"var(--Tight-colors-colorPalette-warning-disabled)"},"colors.colorPalette.intent.warning.highlight":{value:"var(--Tight-colors-colorPalette-intent-warning-highlight)",variable:"var(--Tight-colors-colorPalette-intent-warning-highlight)"},"colors.colorPalette.warning.highlight":{value:"var(--Tight-colors-colorPalette-warning-highlight)",variable:"var(--Tight-colors-colorPalette-warning-highlight)"},"colors.colorPalette.intent.danger":{value:"var(--Tight-colors-colorPalette-intent-danger)",variable:"var(--Tight-colors-colorPalette-intent-danger)"},"colors.colorPalette.intent.danger.hover":{value:"var(--Tight-colors-colorPalette-intent-danger-hover)",variable:"var(--Tight-colors-colorPalette-intent-danger-hover)"},"colors.colorPalette.danger.hover":{value:"var(--Tight-colors-colorPalette-danger-hover)",variable:"var(--Tight-colors-colorPalette-danger-hover)"},"colors.colorPalette.intent.danger.active":{value:"var(--Tight-colors-colorPalette-intent-danger-active)",variable:"var(--Tight-colors-colorPalette-intent-danger-active)"},"colors.colorPalette.danger.active":{value:"var(--Tight-colors-colorPalette-danger-active)",variable:"var(--Tight-colors-colorPalette-danger-active)"},"colors.colorPalette.intent.danger.disabled":{value:"var(--Tight-colors-colorPalette-intent-danger-disabled)",variable:"var(--Tight-colors-colorPalette-intent-danger-disabled)"},"colors.colorPalette.danger.disabled":{value:"var(--Tight-colors-colorPalette-danger-disabled)",variable:"var(--Tight-colors-colorPalette-danger-disabled)"},"colors.colorPalette.intent.danger.weak":{value:"var(--Tight-colors-colorPalette-intent-danger-weak)",variable:"var(--Tight-colors-colorPalette-intent-danger-weak)"},"colors.colorPalette.intent.danger.highlight":{value:"var(--Tight-colors-colorPalette-intent-danger-highlight)",variable:"var(--Tight-colors-colorPalette-intent-danger-highlight)"},"colors.colorPalette.danger.highlight":{value:"var(--Tight-colors-colorPalette-danger-highlight)",variable:"var(--Tight-colors-colorPalette-danger-highlight)"},"colors.colorPalette.reports.alternateRows":{value:"var(--Tight-colors-colorPalette-reports-alternateRows)",variable:"var(--Tight-colors-colorPalette-reports-alternateRows)"},"colors.colorPalette.alternateRows":{value:"var(--Tight-colors-colorPalette-alternateRows)",variable:"var(--Tight-colors-colorPalette-alternateRows)"},"colors.colorPalette.base":{value:"var(--Tight-colors-colorPalette-base)",variable:"var(--Tight-colors-colorPalette-base)"},"colors.colorPalette.base.weak":{value:"var(--Tight-colors-colorPalette-base-weak)",variable:"var(--Tight-colors-colorPalette-base-weak)"},"colors.colorPalette.contrast":{value:"var(--Tight-colors-colorPalette-contrast)",variable:"var(--Tight-colors-colorPalette-contrast)"},"colors.colorPalette.contrast.weak":{value:"var(--Tight-colors-colorPalette-contrast-weak)",variable:"var(--Tight-colors-colorPalette-contrast-weak)"},"colors.colorPalette.accent.success":{value:"var(--Tight-colors-colorPalette-accent-success)",variable:"var(--Tight-colors-colorPalette-accent-success)"},"colors.colorPalette.accent.warning":{value:"var(--Tight-colors-colorPalette-accent-warning)",variable:"var(--Tight-colors-colorPalette-accent-warning)"},"colors.colorPalette.accent.danger":{value:"var(--Tight-colors-colorPalette-accent-danger)",variable:"var(--Tight-colors-colorPalette-accent-danger)"},"colors.colorPalette.accent.action":{value:"var(--Tight-colors-colorPalette-accent-action)",variable:"var(--Tight-colors-colorPalette-accent-action)"},"colors.colorPalette.body":{value:"var(--Tight-colors-colorPalette-body)",variable:"var(--Tight-colors-colorPalette-body)"},"colors.colorPalette.label":{value:"var(--Tight-colors-colorPalette-label)",variable:"var(--Tight-colors-colorPalette-label)"},"colors.colorPalette.label.sub":{value:"var(--Tight-colors-colorPalette-label-sub)",variable:"var(--Tight-colors-colorPalette-label-sub)"},"colors.colorPalette.sub":{value:"var(--Tight-colors-colorPalette-sub)",variable:"var(--Tight-colors-colorPalette-sub)"},"colors.colorPalette.label.strong":{value:"var(--Tight-colors-colorPalette-label-strong)",variable:"var(--Tight-colors-colorPalette-label-strong)"},"colors.colorPalette.label.strongSub":{value:"var(--Tight-colors-colorPalette-label-strongSub)",variable:"var(--Tight-colors-colorPalette-label-strongSub)"},"colors.colorPalette.strongSub":{value:"var(--Tight-colors-colorPalette-strongSub)",variable:"var(--Tight-colors-colorPalette-strongSub)"},"colors.colorPalette.label.emphasisSub":{value:"var(--Tight-colors-colorPalette-label-emphasisSub)",variable:"var(--Tight-colors-colorPalette-label-emphasisSub)"},"colors.colorPalette.emphasisSub":{value:"var(--Tight-colors-colorPalette-emphasisSub)",variable:"var(--Tight-colors-colorPalette-emphasisSub)"},"colors.colorPalette.heading":{value:"var(--Tight-colors-colorPalette-heading)",variable:"var(--Tight-colors-colorPalette-heading)"},"colors.colorPalette.metric.sm":{value:"var(--Tight-colors-colorPalette-metric-sm)",variable:"var(--Tight-colors-colorPalette-metric-sm)"},"colors.colorPalette.sm":{value:"var(--Tight-colors-colorPalette-sm)",variable:"var(--Tight-colors-colorPalette-sm)"},"colors.colorPalette.metric.md":{value:"var(--Tight-colors-colorPalette-metric-md)",variable:"var(--Tight-colors-colorPalette-metric-md)"},"colors.colorPalette.md":{value:"var(--Tight-colors-colorPalette-md)",variable:"var(--Tight-colors-colorPalette-md)"},"colors.colorPalette.metric.lg":{value:"var(--Tight-colors-colorPalette-metric-lg)",variable:"var(--Tight-colors-colorPalette-metric-lg)"},"colors.colorPalette.lg":{value:"var(--Tight-colors-colorPalette-lg)",variable:"var(--Tight-colors-colorPalette-lg)"},"colors.colorPalette.metric.xl":{value:"var(--Tight-colors-colorPalette-metric-xl)",variable:"var(--Tight-colors-colorPalette-metric-xl)"},"colors.colorPalette.xl":{value:"var(--Tight-colors-colorPalette-xl)",variable:"var(--Tight-colors-colorPalette-xl)"},"colors.colorPalette.layout.weak":{value:"var(--Tight-colors-colorPalette-layout-weak)",variable:"var(--Tight-colors-colorPalette-layout-weak)"},"colors.colorPalette.layout":{value:"var(--Tight-colors-colorPalette-layout)",variable:"var(--Tight-colors-colorPalette-layout)"},"colors.colorPalette.layout.strong":{value:"var(--Tight-colors-colorPalette-layout-strong)",variable:"var(--Tight-colors-colorPalette-layout-strong)"},"colors.colorPalette.positive":{value:"var(--Tight-colors-colorPalette-positive)",variable:"var(--Tight-colors-colorPalette-positive)"},"colors.colorPalette.positive.weak":{value:"var(--Tight-colors-colorPalette-positive-weak)",variable:"var(--Tight-colors-colorPalette-positive-weak)"},"colors.colorPalette.positive.strong":{value:"var(--Tight-colors-colorPalette-positive-strong)",variable:"var(--Tight-colors-colorPalette-positive-strong)"},"colors.colorPalette.negative":{value:"var(--Tight-colors-colorPalette-negative)",variable:"var(--Tight-colors-colorPalette-negative)"},"colors.colorPalette.negative.weak":{value:"var(--Tight-colors-colorPalette-negative-weak)",variable:"var(--Tight-colors-colorPalette-negative-weak)"},"colors.colorPalette.negative.strong":{value:"var(--Tight-colors-colorPalette-negative-strong)",variable:"var(--Tight-colors-colorPalette-negative-strong)"}};function To(e,t){return Co[e]?.value||t}To.var=function(e,t){return Co[e]?.variable||t};const wo=cr(null,Gn({borderRadius:"50%",flexShrink:0})),ko=cr(null,Gn({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Eo=To.var("colors.surface.foreground.disabled");function Ao({color:e=Eo,diameter:t=17,label:n}){return R("div",{...ko,"data-testid":"bullet-row",children:[S("div",{...wo,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&S(fo,{children:n})]})}const Io=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function So({payload:e}){return void 0===e?null:S("div",{...Io,children:e.map((e,t)=>"none"!==e.type&&S(Ao,{color:e.color,label:e.value,diameter:17},t))})}const No={right:20,left:20},Ro=["income","profit","expenses","loss"],Do=e=>Ro.findIndex(t=>t===e.dataKey),Po={paddingBottom:"20px",marginLeft:"-20px"},Mo={stackId:"stack",isAnimationActive:!1},Lo=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),Fo=To.var("colors.money"),Oo=To.var("colors.border.layout"),Vo=To.var("colors.border.layout.strong"),Bo={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")},Uo={profit:To.var("colors.money.positive.strong"),income:To.var("colors.money.positive.weak"),loss:To.var("colors.money.negative.strong"),expenses:To.var("colors.money.negative.weak")},Wo=[0,100],Ho=["auto","auto"];function zo({data:e}){const[t,n]=c(!0);if(void 0===e)return null;const r=e.hasAnyData?Ho:Wo;return S(W,{width:"100%",height:"100%",...Lo,children:R(H,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:No,children:[S(z,{verticalAlign:"top",itemSorter:Do,wrapperStyle:Po,content:({payload:e})=>S(So,{payload:e})}),S(q,{strokeDasharray:"0",vertical:!1,stroke:Oo}),S(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Oo,tick:Bo}),S(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Oo,tick:Bo,tickFormatter:e=>uo(e)}),S(_,{content:({active:e,payload:t})=>S(xo,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),S(Y,{name:"Profit",dataKey:"profit",fill:Uo.profit,...Mo}),S(Y,{name:"Income",dataKey:"income",fill:Uo.income,...Mo}),S(Y,{name:"Loss",dataKey:"loss",fill:Uo.loss,...Mo}),S(Y,{name:"Expenses",dataKey:"expenses",fill:Uo.expenses,...Mo}),S(Y,{dataKey:Ma,fill:Oo,legendType:"none",...Mo}),S(Z,{y:0,stroke:Vo}),S(G,{dataKey:"netIncome",fill:Fo,stroke:Fo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const qo=Gn({backgroundColor:"surface.elevated",borderRadius:"sm",backgroundImage:"linear-gradient(90deg, {colors.surface.elevated} 30%, {colors.surface.foreground} 50%, {colors.surface.elevated} 70%)",backgroundSize:"400%",backgroundPosition:"100% 0",animation:"shimmer"});function jo({styles:e}){const t=Xn(or(tr["loading-skeleton"]),qo,e);return S("div",{className:t,"data-testid":"shimmer-block"})}const Ko=Gn({width:"40%",minHeight:65});function _o({children:e}){return R(N,{children:[S(jo,{styles:Ko}),S(oo,{children:e})]})}const Yo=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),Zo=Gn({width:"80px",height:"17px",marginBottom:"10px"}),Go=Gn({width:"100%",height:"100%"});function Qo(){return R(N,{children:[R("div",{...Yo,children:[S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo})]}),S(jo,{styles:Go})]})}const Xo=$n({base:{color:"typography.base.weak",boxSizing:"border-box",position:"absolute",bottom:"0",left:"0",right:"0",top:"0",display:"flex",justifyContent:"center",alignItems:"center",pointerEvents:"none",margin:"0 auto",transform:"rotate(-20deg)",opacity:"80%"},variants:{size:{sm:{fontSize:"4em"},lg:{fontSize:"7em"},xl:{fontSize:"10em"}}}});function Jo({size:e}){const t=Xo({size:e});return S("div",{className:t,children:"Sample"})}const $o=20200,ei=5043,ti=Object.freeze({income:$o,expenses:ei,netIncome:15157,absoluteSum:Math.abs($o)+Math.abs(ei)}),ni=Object.freeze({total:ei,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),ri=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),ai=[{income:1247,expenses:7434},{income:2103,expenses:8672},{income:1876,expenses:7656},{income:3291,expenses:6623},{income:5647,expenses:7034},{income:8923,expenses:6456},{income:11547,expenses:5892},{income:9834,expenses:6721},{income:15283,expenses:5347},{income:18467,expenses:4923},{income:17924,expenses:4534},{income:20200,expenses:5043}];function oi({filter:e=gt.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:Oa})}({filter:e,grouping:Va}),a=t?function(){const e=[],t=/* @__PURE__ */new Date;let n=0,r=0,a=0;for(let o=11;o>=0;o--){const i=new Date(t.getFullYear(),t.getMonth()-o,1),l=Ot(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=ai[11-o],c=s.income-s.expenses,d=c>0?c:0,u=c<0?c:0,h=s.income-d,p=s.expenses+u;e.push({month:l,income:h,expenses:-p,profit:d,loss:u,netIncome:c,hasNoData:!1}),n+=c,r=Math.max(r,s.income),a=Math.max(a,s.expenses)}return{total:n,domain:[-a,r],months:e,hasAnyData:!0}}():n;return R(qa,{type:"chart",children:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:r?S(_o,{children:S(Qo,{})}):R(N,{children:[S(ro,{title:uo(a?.total??0),label:"Profit"}),S(oo,{children:S(zo,{data:a})})]})}),t&&S(Jo,{size:"xl"})]})}const ii={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},li=i({}),si=$n({base:{stroke:"currentColor"},variants:{primary:{DEFAULT:{stroke:"icon.intent.primary"},hover:{stroke:"icon.intent.primary.hover"},active:{stroke:"icon.intent.primary.active"}},secondary:{DEFAULT:{stroke:"icon.intent.secondary"},hover:{stroke:"icon.intent.secondary.hover"},active:{stroke:"icon.intent.secondary.active"}},success:{DEFAULT:{stroke:"icon.intent.success"},hover:{stroke:"icon.intent.success.hover"},active:{stroke:"icon.intent.success.active"}},warning:{DEFAULT:{stroke:"icon.intent.warning"},hover:{stroke:"icon.intent.warning.hover"},active:{stroke:"icon.intent.warning.active"}},danger:{DEFAULT:{stroke:"icon.intent.danger"},hover:{stroke:"icon.intent.danger.hover"},active:{stroke:"icon.intent.danger.active"}},action:{DEFAULT:{stroke:"icon.intent.action"},hover:{stroke:"icon.intent.action.hover"},active:{stroke:"icon.intent.action.active"}}}});function ci(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:i}=l(li),s=n?.styleIconKey?i?.[n.styleIconKey]:void 0,c=gr([cr(null,si()),...o]);return s?S("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:Gn({objectFit:"contain"})}):S(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const di=ci(e=>r.createElement("svg",{width:13,height:15,stroke:"currentColor",viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),ui=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),hi=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),pi=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),gi=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.21065 9.68766C6.15485 9.47136 6.04211 9.27397 5.88416 9.11602C5.72621 8.95807 5.52882 8.84533 5.31252 8.78953L1.47815 7.80078C1.41273 7.78221 1.35515 7.74281 1.31416 7.68856C1.27316 7.6343 1.25098 7.56816 1.25098 7.50016C1.25098 7.43215 1.27316 7.36601 1.31416 7.31175C1.35515 7.2575 1.41273 7.2181 1.47815 7.19953L5.31252 6.21016C5.52874 6.15441 5.72608 6.04176 5.88402 5.88393C6.04197 5.7261 6.15475 5.52884 6.21065 5.31266L7.1994 1.47828C7.21778 1.4126 7.25714 1.35474 7.31147 1.31353C7.36581 1.27231 7.43214 1.25 7.50034 1.25C7.56854 1.25 7.63486 1.27231 7.6892 1.31353C7.74353 1.35474 7.78289 1.4126 7.80127 1.47828L8.7894 5.31266C8.8452 5.52895 8.95794 5.72634 9.11589 5.88429C9.27384 6.04224 9.47123 6.15498 9.68752 6.21078L13.5219 7.19891C13.5878 7.21709 13.646 7.25641 13.6874 7.31083C13.7289 7.36525 13.7513 7.43176 13.7513 7.50016C13.7513 7.56855 13.7289 7.63507 13.6874 7.68948C13.646 7.7439 13.5878 7.78322 13.5219 7.80141L9.68752 8.78953C9.47123 8.84533 9.27384 8.95807 9.11589 9.11602C8.95794 9.27397 8.8452 9.47136 8.7894 9.68766L7.80065 13.522C7.78227 13.5877 7.74291 13.6456 7.68857 13.6868C7.63424 13.728 7.56791 13.7503 7.49971 13.7503C7.43151 13.7503 7.36518 13.728 7.31085 13.6868C7.25651 13.6456 7.21715 13.5877 7.19877 13.522L6.21065 9.68766Z",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M12.5 1.875V4.375",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M13.75 3.125H11.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M2.5 10.625V11.875",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M3.125 11.25H1.875",strokeLinecap:"round",strokeLinejoin:"round"})),"AiStar");function mi(e){return Ea(`${t=e,Ia[t]}`,"v6");var t}async function vi({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=ba({extraHeaders:t,authorization:e}),l=(({url:e,params:t})=>{let n=e;const r=null==(a=t)?"":Object.entries(a).map(([e,t])=>{let n;return n=Array.isArray(t)?t.map(t=>va(e,t)).join("&"):va(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ha("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ha("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(s){return Promise.reject(s)}}async function bi(e){const{url:t,headers:n}=xa(e);return vi({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function fi(e){return bi({...e,endpointManager:mi(e.environment)})}async function yi(e){return bi({...e,endpointManager:Na(e.environment)})}const xi=i(void 0);function Ci(){return l(xi)}const Ti=e=>["introspect",e];function wi(e){return async t=>{const n=t.queryKey;return async function(e,t,n){const r={path:"/sdk/introspect",accessToken:e,environment:t,params:n?{theme:n}:void 0};return await yi(r)}(n[2].accessToken,n[2].environment,e)}}function ki(){const e=Ci();return Rr({queryKey:Ti(e),queryFn:wi(e)})}const Ei={RECONCILIATION_DISCREPANCY:"RECONCILIATION_DISCREPANCY",USER_REVIEW_REQUIRED:"USER_REVIEW_REQUIRED",AWAITING_MATCH:"AWAITING_MATCH",ACCOUNTANT_REVIEW_REQUIRED:"ACCOUNTANT_REVIEW_REQUIRED",STAGED:"STAGED",RECONCILED:"RECONCILED",PARTNER_REVIEW_REQUIRED:"PARTNER_REVIEW_REQUIRED"},Ai=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Ii={DISCREPANCY:{text:"Discrepancy",Icon:ui,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:hi,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:di,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:hi,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:hi,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:di,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:gi,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:pi,variant:"success"}},Si={DISCREPANCY:["RECONCILIATION_DISCREPANCY"],CLIENT_REVIEW:["USER_REVIEW_REQUIRED"],NEEDS_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:[],ADDITIONAL_REVIEW:["PARTNER_REVIEW_REQUIRED"],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Ni={DISCREPANCY:[],CLIENT_REVIEW:[],NEEDS_REVIEW:["RECONCILIATION_DISCREPANCY","USER_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED","PARTNER_REVIEW_REQUIRED"],ADDITIONAL_REVIEW:[],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Ri=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Di=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Pi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Mi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Li=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],Fi=[{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"RECONCILIATION_DISCREPANCY",displayName:"Discrepancy"},{status:"USER_REVIEW_REQUIRED",displayName:"Flag to User"},{status:"RECONCILED",displayName:"Reconciled"}];function Oi(){return Ui()?Fi:Li}function Vi(e,t){return{...Ii[e],key:e,value:(t?Si:Ni)[e]}}function Bi(e){const t=Ui()?Si:Ni,n=Ai.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Ii[n]}function Ui(){const{query:{data:e}}=ki();return"ACCOUNTANT"===e?.userRole}function Wi(){return Vi("NEEDS_REVIEW",Ui())}function Hi(e){return e in Ei}const{CONVERSATIONS:zi,TRANSACTIONS:qi}=ii.FinancialOverview,ji={MESSAGE_REVIEW:zi,TRANSACTION_REVIEW:qi,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},Ki={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},_i={resolutionStatus:{in:["OPEN"]}},Yi=[],Zi=[],Gi=ci(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10,transform:"scale(-1, 1) translate(-13, 0)"})),"ArrowLeft"),Qi=ci(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),Xi=Gn.raw({transition:"background 300ms ease-out, background-color 300ms ease-out, border-color 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, background-color 100ms ease-out, border-color 100ms ease-out, box-shadow 0ms"}}),Ji=Gn(Xi),$i=Gn.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),el=Gn($i),tl=Gn({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}});Gn({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),Gn({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const nl=i({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function rl({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["small-icon"],tr.icon),...t??[]],size:12})}const al=cr(tr["pagination-button"],Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderRadius:"md",borderColor:"border.layout",color:"typography.base",display:"inline-flex",alignItems:"center",justifyContent:"center",height:{xl:"35px",base:"44px"},overflow:"hidden",gap:0})),ol=cr(null,Gn({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,overflow:"hidden",color:"icon.base",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:"none",boxShadow:"0 0 0 0 transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{opacity:.6,pointerEvents:"none"},_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}}),el),il=cr(null,Gn({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),ll=cr(null,Gn({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function sl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=l(nl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...al,children:[S("div",{...il,children:S("button",{...ol,onClick:r,disabled:!t,children:S(rl,{Component:Gi,stylists:[ll]})})}),S("div",{...il,children:S("button",{...ol,onClick:n,disabled:!e,children:S(rl,{Component:Qi,stylists:[ll]})})})]})}const cl=Gn({width:"100%",height:"50px"});function dl(){return S(jo,{styles:cl})}const ul=cr(tr["dashboard-placeholder-table"],Gn({display:"flex",flexDirection:"column",gap:"4px"})),hl=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),pl=Gn({width:"100px",height:"20px"});function gl({numColumns:e=6}){return R("div",{...ul,children:[S("div",{...hl,children:Array.from({length:e},(e,t)=>S(jo,{styles:pl},t))}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{})]})}function ml(e,t){const n=kr(),r=Nr();return d(a=>{const o=Tr(n),i=o?{}:{retry:!1,staleTime:1/0};return Ir.prefetchQuery({queryKey:fr(e(a),n??"",r),queryFn:o?t:Er,...i})},[e,t,n,r])}const vl=Object.freeze({}),bl=Object.freeze({cursor:"FINAL_PAGE"});function fl({queryKey:e,queryFn:t,...n}){const[r,i]=c(vl),l=a(e);C(l.current,e)||(l.current=e,i(vl));const s=n.select,h=rr(s)?e=>({...s(e),cursor:e.cursor}):void 0,p=yr(e,r),g=Rr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(vl),getLastPage:()=>t(bl),hasNextPage:rr(e?.after),hasPreviousPage:rr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=ml(d(t=>yr(e,t),[e]),t),b=ml(d(t=>yr(e,t),[e]),t);return u(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{pa({error:e,severity:"error"})}),e.before&&b({cursor:e.before}).catch(e=>{pa({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,b]),{...g,paginationControls:m}}function yl({delay:e,callback:t}){const n=o(()=>function({delay:e,callback:t}){let n;const r=()=>{n&&(clearTimeout(n),n=void 0)};return{startCallback:a=>{r(),n=setTimeout(()=>{t(a)},e)},cancelCallback:()=>r()}}({delay:e,callback:t}),[e,t]);return u(()=>()=>{n.cancelCallback()},[n]),{startCallback:d(e=>{n.startCallback(e)},[n]),cancelCallback:d(()=>{n.cancelCallback()},[n])}}function xl({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=yl({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Cl={CREATED_DATE_TIME:"CREATED_DATE_TIME",SUBJECT:"SUBJECT",EMAIL:"EMAIL",LAST_MESSAGE_CREATED_DATE_TIME:"LAST_MESSAGE_CREATED_DATE_TIME",LAST_MESSAGE_TEXT:"LAST_MESSAGE_TEXT"},Tl={ASC:"ASC",DESC:"DESC"},wl=e=>["conversations",e??{}],kl=e=>["conversations","conversation",e],El=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Al(e){return fl({queryKey:e?wl(e):["conversations",{}],queryFn:El})}const Il=async e=>{const t=e.queryKey,{id:n}=t[2],r={path:"/v6/conversations/{id}",pathParams:{id:n},accessToken:t[3].accessToken,environment:t[3].environment},a=await fi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Sl(e){const t=rr(e);return Rr({queryKey:kl({id:e??""}),queryFn:Il,enabled:t})}const Nl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function Rl(){return xl({prefetchFn:ml(kl,Il)})}function Dl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Pl({header:e}){const t=Dl(e.column);return S("div",{...cr(tr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:Q(e.column.columnDef.header,e.getContext())})}const Ml=cr(tr["dashboard-table-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center"}));function Ll({headerGroups:e}){return S("div",{children:e.map(e=>h("div",{...Ml,key:e.id},e.headers.map(e=>S(Pl,{header:e},e.id))))})}const Fl=cr(tr["dashboard-table-body"],Gn({display:"flex",flexDirection:"column"}));function Ol({children:e}){return S("div",{...Fl,children:e})}function Vl({cell:e,onCellClick:t}){const n=Dl(e.column),r=cr(tr["dashboard-table-cell"],Gn({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),a=cr(null,Gn({display:"flex",flexDirection:"row",height:"100%"}));return S("div",{...a,style:n,onClick:()=>{t&&t(e)},children:S("div",{style:n,...r,children:Q(e.column.columnDef.cell,e.getContext())})})}const Bl=cr(tr["table-sub-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function Ul({rowData:e,onCellClick:t}){const n=e.getVisibleCells();return S("div",{...Bl,children:n.map(e=>S(Vl,{cell:e,onCellClick:t,isChild:!0},e.id))})}const Wl=Gn({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden"}),Hl=Gn({background:"surface.background"}),zl=cr(tr["table-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"}}));function ql({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=e.getIsExpanded(),i=cr(tr["table-parent-row"],Wl,e.index%2==0?Hl:void 0),l=e.getVisibleCells();return R("div",{...i,onMouseEnter:t,onMouseLeave:n,children:[S("div",{...zl,children:l.map(e=>S(Vl,{cell:e,onCellClick:r},e.id))}),o&&S("div",{children:e.subRows.map(e=>S(Ul,{rowData:e,onCellClick:r,shouldDisplayDivider:a},e.id))})]})}const jl=(e,t={})=>{ln.getState().openDrawer(e,t)},Kl=()=>{ln.getState().requestCloseDrawer()},_l=()=>ln(e=>e.drawerHistory);function Yl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.fetchQuery({queryKey:a,queryFn:t})}function Zl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.prefetchQuery({queryKey:a,queryFn:t})}const Gl=[{name:"One-Time Expense",value:"ONE_TIME"},{name:"Weekly Recurring Expense",value:"WEEKLY"},{name:"Monthly Recurring Expense",value:"MONTHLY"},{name:"Yearly Recurring Expense",value:"YEARLY"}],Ql={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},Xl={ASC:"ASC",DESC:"DESC"},Jl=e=>["banks/transactions",e??{}],$l=e=>["banks/transactions",e.id],es=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ts(e,t){return fl({queryKey:Jl(e),queryFn:es,...t})}const ns=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function rs({id:e,enabled:t=!0}){return Rr({queryKey:$l({id:e??""}),queryFn:ns,enabled:t})}function as(){return xl({prefetchFn:ml($l,ns)})}function os(){const{query:{data:e}}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!nr(t)&&t.length>0}const is={COMPANY:"co",EMPLOYEE:"emp",DIMENSION_VALUE:"cls",DIMENSION:"tcll",CUSTOMER:"cus",BANK_ACCOUNT:"bka",GL_ACCOUNT:"gla",TRANSACTION_CATEGORY:"ctg",BANK_TRANSACTION:"btxn",PROCESSOR_TRANSACTION:"ptxn",TRANSACTION_LINE_ITEM:"tli",VENDOR:"vnd",TRANSACTION_RULE:"trl",INVOICE:"inv",INVOICE_LINE_ITEM:"ili",BILL:"bll",BILL_LINE_ITEM:"bli",PAYROLL:"prl",PAYROLL_LINE_ITEM:"pli",FINANCIAL_SUMMARY:"fsm",TASK:"tsk",CONVERSATION:"cnv",MESSAGE:"msg",REACTION:"rct",BUSINESS_TYPE:"bzt",TEMPLATE_CLASS_LABEL:"tcll",TEMPLATE_COA:"tcoa",TEMPLATE_GL_ACCOUNT:"tgla",TEMPLATE_TRANSACTION_RULES:"ttrl",MANUAL_JOURNAL_ENTRY:"mje",ASSET:"ast",ASSET_DEPRECIATION:"asd",EXPENSE_AMORTIZATION:"exa",REVENUE_RECOGNITION:"rvr",GL_TRANSACTION:"glt",ATTACHMENT:"att",CAR:"car",MILEAGE:"mlg",INTEGRATION:"int",TIME:"tme",TIME_TYPE:"tmt",TAX_RETURN:"txr"};function ls(e,t){return!Cr(e)&&e.startsWith(t)}function ss({id:e,prefix:t}){return void 0!==e?`${is[t]}_${e}`:""}function cs(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}const ds=e=>["conversations/messages",e];function us(e){if(nr(e)||0===e.length)return null;const t=[[e[0]]];for(let n=1;n<e.length;n++){const r=e[n],a=t[t.length-1],o=a[0].author.userId;r.author.userId===o?a.push(r):t.push([r])}return t}const hs=async e=>{const t=e.queryKey,{id:n}=t[1],r={path:"/v6/conversations/{id}/messages",pathParams:{id:n},accessToken:t[2].accessToken,environment:t[2].environment},a=await fi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},ps=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:mi(n),accessToken:t};return await wa(r)};function gs(){return xl({prefetchFn:ml(ds,hs)})}const ms=e=>["summaries",e??{}],vs=e=>["summaries",e.id],bs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const fs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function ys({rowData:e,isMobile:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),{startPrefetch:i,cancelPrefetch:l}=as(),{startPrefetch:s,cancelPrefetch:c}=xl({prefetchFn:ml(vs,fs)}),u=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?i({id:e.original.attachedEntityId}):rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&s({id:e.original.attachedEntityId}),a({id:e.original.id}),n({id:e.original.id})},[e.original.attachedEntityId,e.original.id,a,n,i,s]),h=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?l():rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&c(),o(),r()},[l,c,r,o,e.original.attachedEntityId]);return S(ql,{rowData:e,onMouseEnter:u,onMouseLeave:h,shouldDisplayDivider:e=>0!==e,onCellClick:()=>((e,t,n)=>{n?jl("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):rr(t)?ls(t,is.BANK_TRANSACTION)?jl("BankTransactionForm",{routeProps:{transactionId:t,initialTab:"conversation"}}):ls(t,is.FINANCIAL_SUMMARY)&&(r=e,a=t,jl("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){jl("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t)})}const xs=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Cs=Gn.raw({display:"flex",alignItems:"center",justifyContent:"center",outline:"none",cursor:"pointer",borderRadius:"md","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout",outlineOffset:"-1px"},"&:disabled":{cursor:"not-allowed",opacity:.6}}),Ts=Gn(Cs),ws=Gn.raw({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.primary.active",borderColor:"border.intent.primary.active","& .Tight-text":{color:"typography.intent.primary.active"}},"& .Tight-text":{color:"typography.intent.primary"}});Gn(ws);const ks=Gn.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Es=Gn(ks),As=Gn.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});Gn(As);const Is=Gn.raw({display:"flex",alignItems:"center",gap:"5px",backgroundColor:"surface.intent.action.discreet",borderRadius:"md",border:"{borderWidths.md} solid transparent",outline:"none",boxShadow:"0 0 0 0 transparent",position:"relative",cursor:"pointer",color:"icon.base","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"default"},_supportHover:{_enabled:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover",color:"icon.intent.action.hover",fill:"icon.intent.action.hover"}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"transparent",color:"icon.intent.action.active",fill:"icon.intent.action.active"}}),Ss=Gn.raw({color:"typography.intent.danger",border:"{borderWidths.md} solid",borderColor:"border.intent.danger",backgroundColor:"surface.intent.danger",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-text":{color:"typography.intent.danger.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.danger.active",borderColor:"border.intent.danger.active","& .Tight-text":{color:"typography.intent.danger.active"}},"& .Tight-text":{color:"typography.intent.danger"}}),Ns=Gn.raw({color:"typography.intent.success",border:"{borderWidths.md} solid",borderColor:"border.intent.success",backgroundColor:"surface.intent.success","& .Tight-text":{color:"typography.intent.success"},"& path":{stroke:"icon.intent.success"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-text":{color:"typography.intent.success.hover"},"& path":{stroke:"icon.intent.success.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.success.active",borderColor:"border.intent.success.active","& .Tight-text":{color:"typography.intent.success.active"},"& path":{stroke:"icon.intent.success.active"}}}),Rs=Gn.raw({color:"typography.intent.warning",border:"1px solid {colors.border.intent.warning}",backgroundColor:"surface.intent.warning",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-text":{color:"typography.intent.warning.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.warning.active",borderColor:"border.intent.warning.active","& .Tight-text":{color:"typography.intent.warning.active"}},"& .Tight-text":{color:"typography.intent.warning"}}),Ds=Gn.raw({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.secondary","& .Tight-text":{color:"typography.intent.secondary"},"& path":{stroke:"icon.intent.secondary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-text":{color:"typography.intent.secondary.hover"},"& path":{stroke:"icon.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.secondary.active","& .Tight-text":{color:"typography.intent.secondary.active"},"& path":{stroke:"icon.intent.secondary.active"}}}),Ps=Gn.raw({color:"typography.intent.action",border:"1px solid {colors.border.intent.action}",backgroundColor:"surface.intent.action",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-text":{color:"typography.intent.action.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.active",borderColor:"border.intent.action.active","& .Tight-text":{color:"typography.intent.action.active"}},"& .Tight-text":{color:"typography.intent.action"}}),Ms=$n({base:Gn.raw(Cs,ks,Xi),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:ks,small:As},intent:{default:{},danger:Ss,primary:ws,secondary:Ds,success:Ns,warning:Rs,action:Ps}}}),Ls=p(function({children:e,stylists:t=[],styles:n,className:r,type:a="button",onClick:o,disabled:i,size:l="default",width:s="default",intent:c="default",active:d=!1,onMouseEnter:u,onMouseLeave:h,popupTriggerProps:p},g){const m=function(e){switch(e){case"danger":return tr["button-danger"];case"primary":return tr["button-primary"];case"secondary":return tr["button-secondary"];case"success":return tr["button-success"];case"warning":return tr["button-warning"];case"action":return tr["button-action"];case"default":return null}}(c),v=gr([cr(tr["button-base"],m,r,Gn(Ms.raw({width:s,size:l,intent:c}),n)),...t]);return S("button",{ref:g,...v,type:a,onClick:o,disabled:i,"data-active":d,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function Fs({children:e,stylists:t=[],...n}){return S(Ls,{intent:"secondary",stylists:t,...n,children:e})}const Os=()=>{jl("Conversation",{routeProps:{conversationId:null}})},Vs=cr(tr["small-square-button"],void 0),Bs=Gn({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function Us(){return S("div",{className:Bs,children:S(Fs,{stylists:[Vs],onClick:Os,width:"fill-parent",children:S(rl,{Component:xs})})})}const Ws=$n({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},financialOverviewDashboard:{marginTop:"16px",borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout",borderRadius:"lg",background:"surface.foreground"}}}});function Hs({children:e,dashboard:t}){const n=cr(tr["dashboard-table"],Ws({dashboard:t}));return S("div",{...n,children:e})}const zs=i(null),qs="mobile",js=$n({base:{padding:"0 25px",height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",width:"100%"},variants:{alignVariant:{flexStart:{alignItems:"flex-start"},center:{alignItems:"center"},flexEnd:{alignItems:"flex-end"}}},defaultVariants:{alignVariant:"flexStart"}});function Ks({children:e,alignVariant:t="flexStart"}){const n=cr(null,js({alignVariant:t}));return S("div",{...n,children:e})}const _s=$n({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"18px",maxWidth:"100%",xl:{lineHeight:"16px",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"}},wrap:{ellipsis:Ka,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:Ya},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function Ys({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=cr(tr.label,tr.text,Gn(_s.raw({intent:t,wrap:n,alignment:r}),a));return Cr(e)?null:S("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const Zs={"sm-sm":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-med":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-lg":cr(tr.text,Gn({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-sm":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-med":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-lg":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja)};function Gs({children:e,size:t,weight:n,stylists:r=[]}){const a=gr([Zs[`${t}-${n}`],...r]);return S("div",{title:e,...a,children:e})}const Qs=cr(tr["emphasis-label"],Gn({lineHeight:"16px"}));function Xs({children:e}){return S(Gs,{size:"med",weight:"lg",stylists:[Qs],children:e})}function Js({text:e,isRead:t}){return S(t?Ys:Xs,{children:e})}function $s({date:e,isRead:t=!1}){const n=Vt(e);return S(Js,{text:n,isRead:t})}const ec=cr(tr["strong-sub-label"],mr({label:"strongSubLabel"}));function tc({children:e,stylists:t=[]}){return Cr(e)?null:S(Gs,{size:"sm",weight:"med",stylists:[ec,...t],children:e})}const nc=i(null),rc=Gn({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),ac=Gn.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",color:"icon.base",minWidth:{base:"100%"},boxShadow:{sm:"none"},minHeight:{sm:"35px"},height:{sm:"fit-content"},flexShrink:{sm:0},textAlign:{sm:"start"},"&[data-focused='true']":{boxShadow:"none",outline:"none",backgroundColor:"surface.intent.action.discreet.hover"}}),oc=cr(tr["selector-row"],Gn(ac));function ic(e,t,n){const[r,a]=c(e);return[t??r,n??a]}function lc({children:e}){return null===he()?S(pe,{children:e}):e}function sc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const u=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=c(),[u,h]=c(),[p,g]=ic(e,r,a),m=te(),v=ne({placement:t,open:p,nodeId:m,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||g(e)},whileElementsMounted:le,middleware:[re(n),ae({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),oe({padding:8}),ie({apply({availableHeight:e,elements:t}){let n=e;if(e<314){const t=37*Math.floor(e/37)-18.5;n=Math.max(t,55.5)}Object.assign(t.floating.style,{maxHeight:`${n}px`,overflowY:"auto"})},padding:8})]}),b=v.context,f=se(b,{enabled:i}),y=ce(b,{bubbles:{escapeKey:!0}}),x=de(b),C=ue([f,y,x]),T=d(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:T,...C,...v,modal:!0,labelId:l,descriptionId:u,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,T,C,v,l,u,m])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=he(),p=l&&null===h,g=u.nodeId;return S(lc,{children:S(ge,{id:g,children:S(nc.Provider,{value:{...u,popupParentNodeId:h,blockInteraction:p},children:e})})})}function cc(){const e=l(nc);if(nr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function dc({children:e}){const t=cc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return S(N,{children:e(a)})}const uc=ci(e=>r.createElement("svg",{stroke:"currentColor",width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",strokeWidth:.8,strokeMiterlimit:10}),r.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function hc({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["tiny-icon"],tr.icon),...t??[]],size:9})}const pc=ci(e=>r.createElement("svg",{stroke:"currentColor",width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.03625 2.20312H9.96378"}),r.createElement("path",{d:"M1.03625 5H9.96378"}),r.createElement("path",{d:"M1.03625 7.79688H7.24223"})),"Sort"),gc=cr(tr["button-discreet-small"],Gn(Is,{maxWidth:"fit-content",justifyContent:"center","&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),Ji),mc=cr(null,Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),vc=cr(null,Gn({display:"flex",color:"icon.base",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:"0 6px 0 0",border:"none",outline:"none",position:"relative",cursor:"pointer","&::before":{content:"''",position:"absolute",top:"-9px",right:"-7px",bottom:"-9px",left:"-5px"},_focusVisible:{borderRadius:"sm",outline:"4px solid",outlineColor:"border.layout"}})),bc=cr(null,Gn({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function fc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...gc,"data-active":a,children:[R("button",{...mc,...r,children:[S(tc,{children:t}),!a&&S("div",{...bc,children:S(hc,{Component:pc})})]}),a&&S("button",{...vc,onClick:e,children:S(hc,{Component:uc})})]})}const yc=$n({base:{borderColor:"border.layout",background:"surface.foreground",borderRadius:"zero",boxShadow:"box-shadow",animation:"appear.instant",display:"flex",flexShrink:1,width:"max-content",position:"absolute",top:0,left:0,"& *":{boxSizing:"border-box"}},variants:{type:{reaction:{borderRadius:"sm"}}}});function xc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=cc(),d=me([c.refs.setFloating,n]),u=cr(tr.popup,yc({type:r}));return a||l.open?R(ve,{children:[s&&S(be,{lockScroll:!0}),S(fe,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:S("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Cc=cr(tr["popup-sort-row"],Gn({border:"none",background:"none",paddingLeft:"10px",paddingRight:"10px",paddingTop:"4px",paddingBottom:"4px",margin:0,cursor:"pointer",display:"flex",alignItems:"center",width:"100%",outline:"none",_focusVisible:{outline:"4px solid",outlineOffset:"-2px",outlineColor:"border.layout"}}));function Tc({onClick:e,children:t,active:n}){return S("button",{onClick:e,...Cc,children:S(fo,{accent:n?"active":"action",children:t})})}const wc=cr(null,Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),kc=cr(null,Gn({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Ec({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=cc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...wc,children:[S(tc,{stylists:[kc],children:"Sort by:"}),S(Tc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),S(Tc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Ac=Gn.raw(Is,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Ic({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,d]=c(!1),u=cr(tr["button-discreet-small"],Gn(Ac,e),Ji),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return S("button",{type:"button",...u,onClick:e=>{void 0===h&&d(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const Sc={minWidth:"140px"};function Nc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=l(zs);if(!a)return null;const{sortInstance:o,setSortInstance:i}=a,s=o?.orderBy===t,c=()=>{i(void 0)};return t&&n&&r?R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(fc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),S(xc,{style:Sc,children:S(Ec,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{i(e)},sortInstance:o})})]}):S(Ic,{disabled:!0,children:S(tc,{children:e})})}const Rc=$n({base:{display:"flex",width:"100%"},variants:{align:{left:{justifyContent:"flex-start"},center:{justifyContent:"center"},right:{justifyContent:"flex-end"}},padding:{none:{},default:{},large:{}}},compoundVariants:[{align:"left",padding:"none",css:{paddingLeft:"0"}},{align:"left",padding:"default",css:{paddingLeft:"19px"}},{align:"left",padding:"large",css:{paddingLeft:"33px"}},{align:"right",padding:"none",css:{paddingRight:"0"}},{align:"right",padding:"default",css:{paddingRight:"19px"}},{align:"right",padding:"large",css:{paddingRight:"33px"}}],defaultVariants:{align:"left",padding:"default"}});function Dc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return S("div",{className:Rc({align:a,padding:o}),children:S(Nc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Pc="Oldest to Newest",Mc="Newest to Oldest";const Lc=i({userId:void 0,userRole:void 0,userEmail:void 0,companyId:void 0,customerPartnerId:void 0,apiPartnerName:void 0,clientId:void 0,unitIntegrationBankName:null,supportedIntegrations:[],isDfy:!1,hasBookkeeper:!1});function Fc({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=l(Lc);let a="";return e===r?a="Me":jt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),S(Js,{text:a,isRead:t})}const Oc=ci(e=>r.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.77996 13.5774L13.2416 7.78614C13.9666 6.84449 14.288 5.65345 14.1351 4.47491C13.9821 3.29638 13.3674 2.22682 12.4261 1.5014C11.969 1.12033 11.4381 0.83785 10.8667 0.671702C10.2952 0.505554 9.69563 0.459321 9.10548 0.535904C8.51534 0.612488 7.9474 0.810234 7.43731 1.11673C6.92722 1.42323 6.48599 1.83186 6.14132 2.31698L1.10393 8.82104C-0.191398 10.3699 0.829788 12.2478 1.98119 13.1525C2.59811 13.6529 3.38756 13.8897 4.17805 13.8114C4.96854 13.7331 5.69621 13.3461 6.20301 12.7344L11.213 6.23038C11.3671 6.03065 11.4803 5.8025 11.5461 5.55898C11.612 5.31546 11.6291 5.06134 11.5967 4.81118C11.5642 4.56101 11.4827 4.3197 11.3569 4.10105C11.2311 3.88239 11.0634 3.6907 10.8635 3.53692C10.4594 3.22747 9.94931 3.09053 9.44461 3.15603C8.93992 3.22152 8.48166 3.48412 8.16999 3.88645L3.94132 9.36933",strokeMiterlimit:10})),"Attachment"),Vc=cr(tr.text,Gn({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"16px",maxWidth:"100%",fontFamily:"label"}),ja);function Bc({children:e,stylists:t=[]}){const n=gr([Vc,...t]);return S("div",{...n,children:e})}const Uc=$n({base:{display:"flex",gap:8,border:"none",borderBottom:"1px solid",borderBottomColor:"border.layout.weak",borderRadius:0,padding:0,width:"100%",height:"100%",cursor:"pointer",alignItems:"stretch"},variants:{isRead:{true:{backgroundColor:"transparent"},false:{backgroundColor:"surface.background"}}}}),Wc=Xn(Gn({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),ja),Hc=Gn({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),zc=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),qc=Gn({display:"flex",alignItems:"center",gap:8}),jc=Gn({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),Kc=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),_c=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),Yc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Zc({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return S("button",{className:Uc({isRead:a}),onTouchEnd:o,children:R("div",{className:Wc,children:[R("div",{className:Kc,children:[!a&&S("div",{className:Yc}),S(Js,{text:t,isRead:a})]}),R("div",{className:Hc,children:[S("div",{className:_c,children:S(Fc,{authorUserId:e,isRead:a})}),R("div",{className:qc,children:[S("div",{className:zc,children:S($s,{date:n,isRead:a})}),a?S(rl,{Component:Qi}):S(Bc,{children:S(rl,{Component:Qi})})]})]}),S("div",{className:jc,children:Cr(r)?R(N,{children:[S(rl,{Component:Oc}),S(Ys,{children:"Shared a file"})]}):S(Ys,{children:r})})]})})}const Gc=Gn({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),Qc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Xc({text:e,isRead:t}){return t?S(Ys,{children:e}):R("div",{className:Gc,children:[S("div",{className:Qc}),S(Xs,{children:e})]})}const Jc=X(),$c=cr(null,Gn({paddingLeft:"25px"})),ed=[Jc.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>S(Ks,{children:S(Fc,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>S(tc,{stylists:[$c],children:"From"}),size:160,maxSize:160}),Jc.accessor("subject",{id:"subject",cell:({row:e})=>R(Ks,{children:[S(Xc,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),S(Ys,{children:e.original.latestMessage.text})]}),header:()=>S(tc,{stylists:[$c],children:"Subject"}),size:200}),Jc.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>S(Ks,{children:S($s,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>S(Dc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Mc,sortAscDisplay:Pc}),size:150,maxSize:150}),Jc.display({id:qs,cell:({row:e})=>S(Zc,{sender:e.original.latestMessage.author.userId,subject:e.original.subject,date:e.original.lastUpdatedDateTime,message:e.original.latestMessage.text,isRead:"READ"===e.original.readStatus,handleFormOpen:()=>{}})})];function td(e){return e?ed.filter(e=>e.id===qs):ed.filter(e=>e.id!==qs)}const nd=[],rd=Gn({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px",color:"icon.base"}),ad=cr(tr["empty-dashboard-layout"],rd);function od({children:e}){return S("div",{...ad,"data-testid":"empty-dashboard-layout",children:e})}const id=Gn({width:"25px",height:"25px",borderRadius:"sm"});function ld({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:id}),S("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["large-icon"],tr.icon),...n??[]],size:25})}const sd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return S(Ls,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),cd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M12 1.47998C6.2 1.47998 1.5 5.74998 1.5 11C1.52866 13.0153 2.23294 14.9626 3.5 16.53L2.5 21.53L9.16 20.2C10.1031 20.4499 11.0744 20.5776 12.05 20.58C17.85 20.58 22.55 16.3 22.55 11.03C22.55 5.75998 17.8 1.47998 12 1.47998Z",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),dd=Gn({width:"15px",height:"15px",borderRadius:"sm"});function ud({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:dd}),S("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:15})}const hd=()=>{jl("Conversation",{routeProps:{conversationId:null}})};function pd(){return R(N,{children:[S(ld,{Component:cd}),S(vo,{wrap:"wrap",children:"Need help with your financials?"}),R(sd,{...cr(tr["zero-state-button"]),onClick:hd,children:[S(vo,{children:"Message Bookkeeper"}),S(ud,{Component:Qi})]})]})}const gd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function md(){return R(N,{children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const vd=i({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,unstable_mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function bd(e){const{registerAnchor:t}=l(vd);g(()=>{t(e)},[e,t])}const fd=cr(null,Gn({display:"flex",flexDirection:"row",gap:"5px"}));function yd({children:e}){return S("div",{...fd,children:e})}const xd=$n({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Cd(e){return S(e?md:pd,{})}function Td({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){bd(zi);const i=function({conversations:e,isMobile:t}){return J({data:e??nd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??nd.length,columns:td(t),getCoreRowModel:$(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Al({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!nr(l?.data?.[0])&&!s;return R("div",{className:xd({isMobile:o}),children:[S("div",{id:zi}),R(nl.Provider,{value:r,children:[R(ur,{children:[S(br,{children:"Conversations"}),R(yd,{children:[S(sl,{}),S(Us,{})]})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:a?S(gl,{numColumns:4}):R(N,{children:[!o&&S(zs.Provider,{value:{sortInstance:e,setSortInstance:t},children:S(Ll,{headerGroups:i.getHeaderGroups()})}),n.length>0?S(Ol,{children:i.getRowModel().rows.map(e=>S(ys,{rowData:e,isMobile:o},e.id))}):S(od,{children:Cd(c)})]})})]})]})}const wd=cr(tr.body,mr({body:"default"}));function kd({children:e,stylists:t=[]}){if(Cr(e))return null;const n=gr([wd,...t]);return S("div",{...n,children:e})}const Ed=cr(null,Gn({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Ad=$n({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Id=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Sd(){return S("div",{...Ed,children:Id.map((e,t)=>S(jo,{styles:Ad({width:e?.width})},t))})}const Nd=Gn({position:"absolute",top:"-1",right:"-1",width:"10",height:"10",borderRadius:"999px",backgroundColor:"surface.intent.warning",boxShadow:"0 0 0 1px {colors.border.intent.warning}"}),Rd=Gn({position:"relative",width:"25px",height:"25px"});function Dd({hasUnread:e}){return R("div",{className:Rd,children:[S(ld,{Component:cd}),e&&S("div",{"data-testid":"unread-comment-badge",className:Nd,"aria-hidden":"true"})]})}const Pd=cr(tr["financial-summary-chatbox-header"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Md({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Pd,children:[S(vo,{children:"Message Bookkeeper"}),t&&S(Dd,{hasUnread:e})]})}const Ld=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function Fd(){return R("div",{className:Ld,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),S(fo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(sd,{...cr(tr["zero-state-button"]),onClick:()=>jl("Conversation"),children:[S(vo,{children:"Send a Message"}),S(ud,{Component:Qi})]})]})}const Od=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Vd({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=d(()=>{a({id:t}),n({id:t})},[t,a,n]),l=d(()=>{o(),r()},[o,r]);return R("div",{className:Od,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),S(fo,{wrap:"wrap",children:"Pick up where you left off."}),S(Fs,{onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:S(vo,{children:"Continue conversation"})})]})}const Bd=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Ud({summaryId:e}){return R("div",{className:Bd,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),S(fo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),S(Fs,{...cr(tr["zero-state-button"]),onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e}}),children:S(vo,{children:"Talk to a bookkeeper"})})]})}function Wd({summaryId:e,conversationId:t}){const n=rr(t);return nr(e)?S(Fd,{}):n?S(Vd,{conversationId:t,summaryId:e}):S(Ud,{summaryId:e})}const Hd=Gn({display:"flex",flexDirection:"column",flex:{base:"1 1 100%",xl:"0 0 342px"},maxHeight:"247px",minHeight:"247px",width:{base:"100%",xl:"342px"},maxWidth:{base:"100%",xl:"342px"},background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",alignItems:"center",overflow:"hidden",boxSizing:"border-box"}),zd=cr(tr["financial-summary-chatbox"],Gn({display:"flex",flexDirection:"column",flex:"1 1 0",minHeight:0,width:"100%",backgroundColor:"surface.background",padding:"10px",gap:"10px",alignItems:"flex-start",boxSizing:"border-box"}));function qd({summaryData:e}){const t=rr(e?.summary),n=rr(e?.conversation);return R("div",{className:Hd,children:[S(Md,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),S("div",{...zd,children:S(Wd,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const jd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),Kd=Gn({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function _d(){return R("div",{className:Kd,children:[S(ld,{Component:jd}),S(vo,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const Yd=Gn({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),Zd=$n({base:{display:"flex",flex:{base:"1 1 100%",xl:"1 1 0"},minWidth:{base:"100%",xl:"450px"},maxHeight:"247px",minHeight:"247px",background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",gap:"10px",alignItems:"flex-start",boxSizing:"border-box",position:"relative",marginBottom:10,overflow:"auto"},variants:{isSample:{true:{pointerEvents:"none",overflow:"hidden"},false:{}},isZeroState:{true:{alignItems:"center",justifyContent:"center",padding:"16px"},false:{}}}}),Gd=cr(null,Gn({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),Qd=Gn({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function Xd({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Rr({queryKey:(t={limit:1,filter:{date:{equal:ct(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?ms(t):["summaries",{}],queryFn:bs,...n});var t,n}(t),a=e?function(){const e=/* @__PURE__ */new Date;return`In ${e.toLocaleString("en-US",{month:"long"})} ${e.getFullYear()}, your total income increased significantly to $${$o.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${ei.toLocaleString()}, compared to $${4534..toLocaleString()} last month, which slightly narrowed your net profit margin despite a healthy $${15157..toLocaleString()} net profit. \n\nA key area for improvement is transaction categorization; with one transaction remaining uncategorized and only two user-categorized, enhancing categorization accuracy will improve financial tracking and insights. To maintain positive momentum, consider reviewing variable expenses to identify any controllable cost increases.\n\nGoing forward, continue focusing on revenue growth while keeping a close eye on expense management, and aim to fully categorize all transactions to gain more precise financial visibility.`}():n?.summary,o=!e&&!r&&!a,i=cr(tr["financial-summary-layout"],Zd({isSample:e,isZeroState:o}));return R("div",{className:Qd,children:[S("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?S(Sd,{}):o?S(_d,{}):R("div",{className:Yd,children:[S(kd,{stylists:[Gd],children:a}),e&&S(Jo,{size:"lg"})]})}),S(qd,{summaryData:n})]})}const Jd=cr(tr["month-picker"],Gn({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),$d=cr(tr["month-picker-left-button"],Gn({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),eu=cr(tr["month-picker-right-button"],Gn({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),tu=cr(tr["month-picker-label"],Gn({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function nu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=it(e.year,e.month,1),o=Ot(a,{abbreviateMonth:!0});return R("div",{...Jd,children:[S(Fs,{stylists:[$d],onClick:()=>{return t(0===(n=e).month?{month:11,year:n.year-1}:{month:n.month-1,year:n.year});var n},disabled:r,children:S(rl,{Component:Gi})}),S("div",{...tu,children:S(vo,{children:o})}),S(Fs,{stylists:[eu],onClick:()=>{return t(11===(n=e).month?{month:0,year:n.year+1}:{month:n.month+1,year:n.year});var n},disabled:n,children:S(rl,{Component:Qi})})]})}const ru=Gn({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function au({children:e}){return S("div",{className:ru,children:e})}const ou=$n({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),iu=cr(tr["progress-bar"],Gn({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),lu=cr(tr["progress-bar-fill"],Gn({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),su=cr(tr["tile-bar-label"],Gn({paddingLeft:"10px"})),cu=cr(tr["tile-bar-label-outer"],Gn({paddingLeft:"10px"}));function du({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?tr["bar-transactions-positive"]:tr["bar-transactions-negative"],l=cr(i,ou({color:n})),s=gr([lu,l]);return R("div",{...iu,style:{width:a},children:[S("div",{...s,style:{width:`${t}%`},children:o&&S("div",{...su,children:S(Ys,{children:e})})}),!o&&S("div",{...cu,children:S(Ys,{children:e})})]})}const uu=cr(tr["metric-md"],Gn(mr.raw({metric:"md"}),Ya));function hu(e){return S("div",{...uu,children:e.children})}const pu=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),gu=Gn({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function mu({label:e,amount:t,total:n,color:r}){const a=n>0?function(e,t,n,r=0,a=100){return r+(e-t)*(a-r)/(n-t)}(t,0,n):0;return R("div",{className:pu,children:[S(du,{label:e,percentage:a,color:r}),S("div",{className:gu,children:S(hu,{children:uo(t)})})]})}const vu=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),r.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),r.createElement("path",{d:"M1.34228 9.57602C1.18256 9.00181 1.10327 8.40823 1.10669 7.81223C1.1074 6.38654 1.56211 4.99811 2.4049 3.8482C3.2477 2.69828 4.4348 1.84664 5.79412 1.41671C7.15345 0.986775 8.61437 1.00089 9.96513 1.45702C11.3159 1.91314 12.4863 2.78757 13.3067 3.95356",strokeMiterlimit:10}),r.createElement("path",{d:"M14.2937 6.04849C14.4534 6.6227 14.5327 7.21628 14.5293 7.81228C14.5286 9.23797 14.0739 10.6264 13.2311 11.7763C12.3883 12.9262 11.2012 13.7779 9.84185 14.2078C8.48253 14.6377 7.02161 14.6236 5.67085 14.1675C4.32008 13.7114 3.14967 12.8369 2.32925 11.671",strokeMiterlimit:10})),"Sync"),bu={},fu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return bu[e]={loading:!1,error:null,scriptEl:t}},yu="undefined"!=typeof window&&void 0!==window.document;function xu({src:e,checkForExisting:t=!1,...n}){let r=bu[e];!r&&t&&e&&yu&&(r=fu(e));const[a,o]=c(r?r.loading:Boolean(e)),[i,l]=c(r?r.error:null),[s,d]=c(!1);return u(()=>{if(!yu||!e||s||i)return;let a;r=bu[e],!r&&t&&(r=fu(e)),r?a=r.scriptEl:(a=document.createElement("script"),a.src=e,Object.keys(n).forEach(e=>{void 0===a[e]?a.setAttribute(e,n[e]):a[e]=n[e]}),r=bu[e]={loading:!0,error:null,scriptEl:a});const c=()=>{r&&(r.loading=!1),o(!1),d(!0)},u=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",c),a.addEventListener("error",u),document.body.appendChild(a),()=>{a.removeEventListener("load",c),a.removeEventListener("error",u),r&&r.loading&&(a.remove(),delete bu[e])}},[e]),[a,i]}const Cu=e=>["integrations",e??{}],Tu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function wu(e,t){return fl({...t,queryKey:Cu(e),queryFn:Tu})}function ku(e){return wu({filter:{apiName:{equal:"PLAID"}}},e)}function Eu(e){return Ea(`${t=e,Aa[t]}/v1`,"v1");var t}async function Au({institutionId:e,accessToken:t,environment:n}){if(!t)throw new Error("Access token is required to get Plaid item institution");const r={path:"/banks2/bankUrl",accessToken:t,endpointManager:Eu(n)},{url:a,headers:o}=xa(r);return await vi({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Iu="cancel",Su="danger",Nu="success",Ru=Gn({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Du=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Pu=$n({base:{background:"surface.background",borderRadius:"md",display:"flex",flexDirection:"column",gap:"16px"},variants:{size:{sm:{maxWidth:"360px",minWidth:"0",margin:"32px"},md:{maxWidth:"600px",minWidth:"400px",margin:"32px"},lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"},margin:{sm:"32px",base:"0"},height:{sm:"auto",base:"100dvh"}}},padding:{none:{padding:"0"},sm:{padding:"8px"},md:{padding:"16px"},lg:{padding:"24px"}}},defaultVariants:{size:"sm",padding:"md"}}),Mu={transform:"none",willChange:"auto"};function Lu({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=ne({open:e,strategy:"fixed"}),s=ce(l,{outsidePress:o,escapeKey:i}),c=de(l,{role:t}),{getFloatingProps:d}=ue([s,c]),u="alertdialog"===t?tr["alert-dialog"]:null,{className:h}=cr(u,Pu({size:r,padding:a}));return e?S(ve,{children:S(be,{lockScroll:!0,className:Ru,children:S(fe,{context:l,modal:!0,returnFocus:!0,children:S("div",{...d(),className:h,style:Mu,children:n})})})}):null}const Fu=cr(tr["close-button"],Gn({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",color:"icon.base",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),el),Ou=()=>Kl();function Vu({Icon:e=uc,handleClose:t=Ou}={}){return S("button",{...Fu,onClick:t,type:"button",children:S(ud,{Component:e,...Fu})})}const Bu=cr(tr["alert-header"],Gn({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"26px"},_a));function Uu({children:e}){return S("div",{...Bu,children:e})}const Wu=Gn({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),Hu=Gn.raw({width:"100%"}),zu=e=>{switch(e){case qu.DANGER:return"danger";case qu.SUCCESS:return"success";case qu.ACTION:return"primary";default:return"secondary"}},qu={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ju=ye.createConfirmation(xe(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Lu,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Du,children:[S(Uu,{children:r}),o&&S(Vu,{handleClose:()=>n()})]}),a&&"string"==typeof a?S(Ys,{wrap:"wrap",children:a}):S(N,{children:a}),S("div",{className:Wu,children:i.map(e=>S(Ls,{intent:zu(e.type),styles:Hu,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:S(vo,{children:e.label})},e.key))})]})}));function Ku(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function _u(e){return new U(e).div(100).toNumber()}function Yu(e){return new U(e).times(100).toNumber()}function Zu(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function Gu(e,t){return t?e?`${e} ${Zu(t)}`:Zu(t):e??""}const Qu=e=>jl("Conversation",{routeProps:{conversationId:null,defaultValues:e}}),Xu=Gn({display:"flex",flexDirection:"column",gap:"12px"});async function Ju(e){await ju({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const $u=e=>["banks/accounts",e??{}],eh={integration:{expand:!0},status:{notIn:["REMOVED"]}},th=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment,i={path:"/v6/banks/accounts/query",bodyParams:{...n,filter:{...n.filter},cursor:r},accessToken:a,endpointManager:mi(o)},l=await wa(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function nh(e){return fl({queryKey:$u({...e?.params,filter:{...eh,...e?.params?.filter}}),queryFn:th,enabled:e?.enabled,select:e?.select})}function rh(e,t){return Yl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:e,environment:t})}const ah={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},oh={short:{credentialsChanged:e=>`${e} Credentials Changed`,accountLocked:e=>`${e} Account Locked`,supportChanged:e=>`${e} Support Changed`,updateNeeded:e=>`${e} Update Needed`,noAccountsAvailable:e=>`No ${e} Accounts Available`,connectionError:e=>`${e} Connection Error`,serverError:e=>`${e} Server Error`,temporarilyDown:e=>`${e} Temporarily Down`,serverDown:e=>`${e} Server Down`,requestError:e=>`${e} Request Error`,inputError:e=>`${e} Input Error`,volumeDown:e=>`${e} Down Due to Volume`,credentialsExpiring:e=>`${e} Credentials Expiring`,relinkNeeded:e=>`${e} Relink Needed`,generic:()=>"Bank Connection Error"},long:{relinkCredentials:()=>"Please relink your account using your latest credentials.",invalidUpdatedUsername:({isMobile:e})=>`Your bank account has an updated username and needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,accountLocked:({isMobile:e})=>`Your bank account has been locked. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" and ask your financial institution to unlock your account. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,supportChanged:({apiPartnerName:e})=>`Unfortunately, your bank has added restrictions that block services like ${e||"ours"} from linking with it. Please chat with support to resolve this issue.`,updateNeeded:({isMobile:e})=>`Your bank requires you to take some action. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to log in and perform the requested action. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,mfaUpdateNeeded:({isMobile:e})=>`You have an unsupported "Multi-Factor Authentication" enabled. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to disable it on your banking site. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,noAccountsUnlink:()=>"It seems that you have no active accounts with this bank. Please unlink this bank.",connectionError:()=>"Your bank connection encountered an error. Please chat with support to resolve the issue.",productNotReady:()=>"Your institution was not ready for transactions to be pulled. Please chat with support to resolve the issue.",permissionRevoked:({apiInstitutionName:e})=>`Access to your accounts with ${e} has been revoked. Please unlink and relink your account using your latest credentials.`,bankMaintenance:()=>"Your bank's server is down for maintenance, so it may take a little longer than normal to receive new transactions.",serverDown:()=>"Your bank's server is unexpectedly down. Please chat with support to resolve the issue.",bankConnectionMaintenance:()=>"Your bank connection is down for maintenance, so it may take a little longer than normal to receive new transactions.",partnerCredsChange:({isMobile:e})=>`Your bank account needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,credentialsExpiring:({apiInstitutionName:e})=>`Your authorization for ${e} will expire soon. Please relink your bank with your latest credentials.`,relinkForStatements:()=>"Please relink your account using your latest credentials to enable automatic retrieval of bank statements.",generic:()=>"There was an error with your bank connection. Please chat with our team so they can resolve it."}},ih={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_MFA:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.invalidUpdatedUsername,buttonType:ah.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:oh.short.accountLocked,longMessage:oh.long.accountLocked,buttonType:ah.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT},USER_SETUP_REQUIRED:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.updateNeeded,buttonType:ah.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.mfaUpdateNeeded,buttonType:ah.OPEN_BANK},NO_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},ITEM_NOT_FOUND:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCT_NOT_READY:{shortMessage:oh.short.serverError,longMessage:oh.long.productNotReady,buttonType:ah.CHAT},USER_PERMISSION_REVOKED:{shortMessage:oh.short.connectionError,longMessage:oh.long.permissionRevoked,buttonType:ah.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:oh.short.serverDown,longMessage:oh.long.serverDown,buttonType:ah.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PLANNED_MAINTENANCE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankConnectionMaintenance,buttonType:ah.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:oh.short.requestError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:oh.short.inputError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:oh.short.volumeDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.partnerCredsChange,buttonType:ah.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:oh.short.credentialsExpiring,longMessage:oh.long.credentialsExpiring,buttonType:ah.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:oh.short.relinkNeeded,longMessage:oh.long.relinkForStatements,buttonType:ah.RELINK}},DEFAULT:{DEFAULT:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:oh.short.generic,longMessage:oh.long.generic,buttonType:ah.CHAT}}};function lh({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=ih[e];if(!n)return pa({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(pa({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT)}const sh=e=>{const t=e?.status?"DELETED"===e.status?"REMOVED":e.status:"ACTIVE",n="MORTGAGE"!==e?.apiType&&"BROKERAGE"!==e?.apiType&&e?.apiType?e.apiType:"OTHER";return{iconUrl:"",...e,id:e.id??"",status:"DELETED"===e.status?"REMOVED":t,name:e.apiName??"",apiName:"PLAID",glAccountId:ss({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:ss({id:e.plaidItemId||e.oauthAccountId,prefix:"INTEGRATION"}),apiInstitutionId:e.apiInstitutionId??null},mask:e.apiMask??"",beginningBalanceData:{},isSupported:e.isSupported||!1,tranStartDate:e.tranStartDate||null,tranMinStartDate:e.tranMinStartDate||null,latestTransactionDate:e.latestTransactionDate||null,accountBalance:e.apiCurrentBalance||null,subType:e.apiSubType||null}};function ch({mutationFn:e,onMutateFn:t,...n}){const r=kr(),a=Nr(),o=!Cr(r);return F({...n,mutationFn:o?t=>e({data:t,accessToken:r,environment:a}):Er,onMutate:o&&rr(t)?e=>t({data:e,accessToken:r,environment:a}):void 0},Ir)}const dh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Na(n)};return await ka(r)},uh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),hh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),ph=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/accounts",bodyParams:{accounts:e.accounts},accessToken:t,endpointManager:Na(n)};return await ka(r)})({data:{accounts:e},accessToken:t,environment:n});function gh(e){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},...e})}function mh(){return gh({mutationFn:hh})}function vh(){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:ph})}const bh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,fh=e=>"PLAID"===e,yh=e=>({id:cs(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),xh=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Ch=async()=>ju({title:"Merge Accounts",body:R("div",{className:xh,children:[S(Ys,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),S(Ys,{wrap:"wrap",children:"This action can't be undone."}),S(Ys,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Continue",type:qu.DANGER}]}),Th=()=>ju({title:"Merge Failed",body:S(Ys,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Iu,label:"OK"}]}),{formContext:wh,fieldContext:kh,useFieldContext:Eh,useFormContext:Ah}=Ce(),Ih=ci(e=>r.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{id:"icon/check"},r.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function Sh({children:e,stylists:t=[],...n}){return S(Ls,{intent:"success",stylists:t,...n,children:e})}function Nh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Sh,{type:"submit",disabled:n,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Rh=cr(null,Gn({display:"flex",width:"100%"}));function Dh({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r}){return R(sd,{type:"submit",disabled:n,stylists:[Rh],onClick:r,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Ph=$n({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{weak:{backgroundColor:"border.layout.weak"},normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"border.intent.secondary"}}}});function Mh({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=cr("vertical"===e?tr["vertical-divider"]:tr["horizontal-divider"],n,Ph({alignment:e,color:t}));return S("div",{...r})}const Lh=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),Fh=[cr(null,Gn({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],Oh=cr(null,Gn({display:"flex",alignItems:"center",gap:"4px"}));function Vh({errorMessage:e}){return R("div",{...Oh,children:[S(ud,{Component:ui,stylists:Fh}),S(fo,{intent:"danger",wrap:"wrap",children:e})]})}const Bh=Gn({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function Uh({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o}){return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[e,o&&S("div",{className:Bh,children:S(Vh,{errorMessage:o})}),S(Dh,{showIcon:t,disabled:r,onClick:a,textContent:n})]})]})}const Wh=Gn.raw({"&[data-state='closed'][data-disablehover='false']":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:not([data-state])[data-disablehover='false']:not(:focus-within)":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&[data-state='open']":{backgroundColor:"surface.intent.action.discreet.active"},"&[data-active='false']:has(:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),Hh=Gn.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function zh({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i}}}const qh=Gn({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},Wh),jh=Gn(Hh),Kh=Gn({display:"flex",flexDirection:"column",gap:"8px"}),_h=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Yh({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:d,errorMessage:u,disableHover:h=!1,type:p,remainingChars:g,hasErrorStyles:m}){const v=cr(i||null,qh,l,jh,el),[b,f]=c(!0),{dataAttributes:y}=zh({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h});return R("div",{className:Kh,children:[R("div",{className:_h,children:[void 0!==r&&S(Ys,{children:r}),rr(g)&&S(Ys,{children:`${g}`})]}),S("div",{...v,onClick:s,...n,onMouseDown:e=>{f(!0),t&&t.current&&e.target!==t.current&&(e.preventDefault(),t.current.focus())},onFocus:()=>{t&&t.current&&function(e,t){if("setSelectionRange"in e&&"number"!==t){const t=e.value.length;e.setSelectionRange(t,t)}}(t.current,p)},onBlur:()=>{f(!1),d?.()},...y,children:e}),o&&"open"!==n?.["data-state"]&&u&&S(Vh,{errorMessage:u})]})}const Zh=Gn({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled","&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}});function Gh({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a}){const o=Eh(),i=Te(o.store,e=>e.meta.errors[0]?.message),l=Te(o.store,e=>e.meta.isDefaultValue),s=Te(o.store,e=>e.meta.isTouched);return S(Yh,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:l,isTouched:s,className:tr["discreet-form-input"],additionalStyles:Zh,errorMessage:i,onClick:a,onBlur:o.handleBlur,children:e})}function Qh(e){((navigator.userAgent?navigator.userAgent.toLowerCase().includes("mac"):navigator.platform.toLowerCase().includes("mac"))?e.metaKey:e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),e.currentTarget.requestSubmit())}function Xh(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Jh(e){"Enter"===e.key&&e.currentTarget.blur()}const $h=cr(tr["amount-input"],mr({metric:"md"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),ep=cr(null,Gn({display:"flex",alignItems:"center",gap:"2px"}));function tp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=c(!1);return R("div",{...ep,children:[nr(e)&&S(hu,{children:"$"}),S(ke,{...$h,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:nr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Jh,autoFocus:o})]})}const np=Gn({backgroundColor:"surface.foreground.disabled",pointerEvents:"none",border:"{borderWidths.lg} solid",borderColor:"border.layout"}),rp=$n({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function ap({kind:e,label:t,children:n,inputRef:r,disabled:a,popupTriggerProps:o,onClick:i,disableHover:l=!1,type:s,maxLength:c,hasErrorStyles:d}){const u=Eh(),h=Te(u.store,e=>e.meta.errors[0]?.message),p=Te(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=rr(c)?c-g:void 0,v=a?np:rp({kind:e});return S(Yh,{label:t,inputRef:r,popupTriggerProps:o,className:tr["editable-form-input"],additionalStyles:v,errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,children:n})}const op=cr(null,Gn({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function ip({options:e,onSelect:t,selectedLabel:n}){const r=cc();return S("div",{...op,children:e.map(e=>S(Tc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const lp=ci(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2922)"},r.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2922"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),sp=cr(tr["dropdown-selector-button"],Gn({cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderRadius:"sm",gap:"7px",backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),Ji);function cp({selectedLabel:e,options:t,onSelect:n}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...sp,...t,children:[S(vo,{children:e}),S(hc,{Component:lp})]})}),S(xc,{children:S(ip,{options:t,onSelect:n,selectedLabel:e})})]})}const dp=cr(null,Gn({display:"flex",alignItems:"center",gap:"15px"})),up=kt.map((e,t)=>({value:t,label:e})),hp=Et({}).map(e=>({value:e,label:String(e)}));function pp({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return R("div",{...dp,children:[S(cp,{selectedLabel:kt[r],options:up,onSelect:e=>a(n,e)}),S(cp,{selectedLabel:String(n),options:hp,onSelect:e=>a(e,r)})]})}const gp=cr(null,Gn({background:"surface.foreground",padding:"25px",gap:"15px"})),mp=cr(null,Gn({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),vp=cr(tr["date-picker-nav-button"],Gn({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),Ji),bp=cr(null,Gn({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),fp=cr(null,Gn({padding:"8px",textAlign:"center"})),yp=cr(tr["date-picker-day-button"],Gn({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"6px",width:"36px",height:"36px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"sm",cursor:"pointer",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}},"&[data-selected='true']":{backgroundColor:"surface.intent.action.discreet.active",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.active"},"&[data-today='true']::after":{content:"''",position:"absolute",bottom:"3px",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:"brand.primary"},"&:disabled":{cursor:"default"}}),Ji),xp=cr(null,Gn({color:"typography.base"}));function Cp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&At(e,t),l=It(e),s=e.getMonth()!==n,c=!!a&&St(e,a),d=!!o&&St(o,e);return S("button",{...yp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:S(vo,{stylists:s||c||d?[xp]:[],children:e.getDate().toString()})})}function Tp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=cc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=it(e,t,1),r=new Date(n);return r.setDate(r.getDate()-n.getDay()),Array.from({length:42},(e,t)=>{const n=new Date(r);return n.setDate(r.getDate()+t),n})}(s,c),u=(h=d)[h.length-1];var h;const p=void 0===a||u&&St(a,u),g=nr(o)||d.length>0&&St(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return R("div",{...gp,children:[R("div",{...mp,children:[S("button",{...vp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:S(rl,{Component:Gi})}),S(pp,{currentMonthYear:l,onMonthYearChange:r}),S("button",{...vp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:S(rl,{Component:Qi})})]}),R("div",{...bp,children:[wt.map(e=>S("div",{...fp,children:S(fo,{children:e})},e)),d.map(t=>S(Cp,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const wp=cr(null,mr({label:"default"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),kp=cr(null,mr({label:"default"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",cursor:"text",overflowWrap:"break-word",minWidth:"100%",maxWidth:"100%","&::placeholder":{color:"typography.base.weak"},"&:focus":{outline:"none"}}));function Ep(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant"}),e.current.setAttribute("data-hasscrolled","true"))}async function Ap(e){const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const Ip=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),Sp=[...Ip].map(e=>`.${e}`).join(","),Np=/* @__PURE__ */new Set(["xls","xlsx","csv"]),Rp={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...Ip].map(e=>e.toUpperCase()).join(", ")} file.`,fileTooLarge:"File exceeds the 50MB size limit.",fileTooLargeSpreadsheet:"File exceeds the 50MB size limit. Try splitting it into smaller parts.",duplicate:"File has already been attached. To replace it, delete the existing file first.",maxAttachmentsReached:"Maximum of 3 attachments allowed per transaction. Remove an existing attachment to add more."},Dp={"image/jpeg":[".jpg",".jpeg",".jfif"],"image/png":[".png"],"image/gif":[".gif"],"image/heic":[".heic"],"image/tiff":[".tif",".tiff"],"image/svg+xml":[".svg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"application/vnd.ms-excel":[".xls"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"text/csv":[".csv"],"text/plain":[".txt"]};function Pp(e,t,n,r,a,o,i=crypto.randomUUID(),l=null,s=null,c=null){return{localId:i,id:t,file:e,displayText:r,displayFileName:n,isPending:a,hasError:o,fileSize:l,iconUrl:s,publicFileUrl:c}}function Mp(e,t,n){return Pp(e,null,e.name,t,!1,!0,n)}async function Lp(e,t){const n=await async function(e,t){const n=e.name.split("."),r=n.length>=2?n[n.length-1].toLowerCase():void 0;if(!r||!Ip.has(r))return Rp.unsupportedFileType;if(e.size>52428800)return Np.has(r)?Rp.fileTooLargeSpreadsheet:Rp.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await Ap(e);for(const e of a)if(await Ap(e.file)===t)return Rp.duplicate}return null}(e,t);return n?Mp(e,n):Pp(e,null,e.name,Rp.pendingUpload,!0,!1)}const Fp=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Na(n).getUrl(`/files/upload/${a}`),s=Cr(o)?"att_"+i:o,c=new FormData;return c.append("file",r),c.append("caption",s),c.append("entityId",String(i)),(await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`},credentials:"include",body:c})).json()};function Op(){return ch({mutationFn:Fp,onSuccess:async()=>Ir.invalidateQueries({queryKey:["files/attachments"]})})}const Vp=async({data:e,accessToken:t,environment:n})=>{const r=Na(n).getUrl("/files/attachment");return(await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e.id})})).json()};const Bp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Up=Gn({display:"none"}),Wp=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=Op();return{mutateAsync:d(async t=>{const n=t.map(({file:t})=>e({file:t,entity:"message",caption:t.name,entityId:null})),r=await Promise.allSettled(n);return t.map((e,t)=>function(e,t){if("fulfilled"===t.status&&"SUCCESS"===t.value.result){const n=t.value?.attachment?.id??null,r=t.value?.attachment?.caption??e.file.name,a=t.value?.attachment?.fileSize??null,o=t.value?.attachment?.iconUrl??null,i=t.value?.attachment?.publicFileUrl??null;return Pp(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return Mp(e.file,Rp.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=d(()=>{r.current?.click()},[]),l=d(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>Lp(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await o(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,o]);return R("div",{children:[S("input",{className:Up,type:"file",multiple:!0,accept:Sp,ref:r,onChange:l}),S(Fs,{type:"button",onClick:i,children:S("span",{className:Bp,children:S(ud,{Component:Oc})})})]})},Hp=I.custom(),zp=I.object({message:I.object({text:I.string(),attachments:I.array(Hp)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),qp=Gn.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),jp=Gn.raw({visibility:"hidden",fontSizeAdjust:"none",fontSize:"100%",fontStyle:"normal",letterSpacing:"normal",fontStretch:"normal",fontVariant:"normal",fontWeight:"normal",textAlign:"left",textAlignLast:"initial",textDecoration:"none",textEmphasis:"none",textIndent:"0px",textJustify:"auto",textShadow:"none",textTransform:"none"}),Kp=Gn(jp,qp),_p=Gn.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),Yp=Gn(_p,qp,mr.raw({body:"default"})),Zp=Gn({display:"block",width:"100%"}),Gp=Gn({position:"relative"}),Qp=Gn({display:"flex",justifyContent:"flex-end",gap:"15px"}),Xp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Jp=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Eh(),c=a(null),{startCallback:d}=yl({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&zp.safeParse(s.form.state.values).success;return S(ap,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Ep(t),void d(!0)),children:R("div",{className:Zp,children:[R("div",{className:Gp,children:[R("pre",{className:Kp,children:[s.state.value.text,S("br",{})]}),S("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:Yp,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Qp,children:[!i&&S(Wp,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),S(Fs,{disabled:!u,type:"submit",children:S("span",{className:Xp,children:S(ud,{Component:gd})})})]})]})})}),$p=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,eg=i(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function tg(e,t){switch(t.type){case"increment":return((e,t)=>{let n;if(null===e.focusedIndex)n=0;else{const r=e.focusedIndex+1;n=!t.repeat&&r>e.maxIndex?0:Math.min(r,e.maxIndex)}return{...e,focusedIndex:n}})(e,t);case"decrement":return((e,t)=>{let n;if(null===e.focusedIndex)n=e.maxIndex;else{const r=e.focusedIndex-1;n=!t.repeat&&r<0?e.maxIndex:Math.max(r,0)}return{...e,focusedIndex:n}})(e,t);case"set":return{...e,focusedIndex:Math.min(t.focusedIndex,e.maxIndex)};case"max":return{...e,maxIndex:t.max}}}function ng(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function rg(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return r.top>=n.top&&r.bottom<=n.bottom&&r.left>=n.left&&r.right<=n.right}function ag(e,t,n){if(null===e)return{node:void 0,metadata:void 0};const r=t[e];return{node:r,metadata:n.get(r)}}function og(e){const[t,n]=c(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:i,isMousing:s,isScrolling:h}=function(e,t){const n=a(null),[r,o]=c(!0),[i,s]=c(!1),d=l(eg),[h,p]=v(tg,{focusedIndex:null,maxIndex:e});u(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&nr(h.focusedIndex)&&void 0!==d?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,d?.popupNodeId,t.forceRootCascade]);const g=a(null);return u(()=>{p({type:"max",max:e})},[e]),u(()=>{const e=n.current;if(null!==e){const n=e=>{s(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));h.focusedIndex===r&&g.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(o(!0),g.current=e.target,p({type:"set",focusedIndex:r}),t.setCascadeState(!0,r))},r=e=>{const t="ArrowDown"===e.key||"Tab"===e.key&&!e.shiftKey,n="ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey;o(!1),s(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>s(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",a),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",a)}}},[t,h.focusedIndex]),{listRef:n,focusedState:h,isMousing:r,isScrolling:i}}(t.size-1,e),p=cc(),g=d((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),m=d(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:b,sortedMap:f}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(ng)),n},[e,t]),r=o(()=>{const t=/* @__PURE__ */new Map;return n.forEach((n,r)=>{const a=e.get(n)??{};t.set(n,{...a,index:r})}),t},[n,e]);return{sortedNodes:n,sortedMap:r}}(t,r);!function(e,t,n,r,a,o){u(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=ag(r,t,n),{shouldOpenCascade:c,shouldCloseCascade:d}=function(e,t,n,r){const a=e.placement.includes("left"),o=e?.popupParentNodeId&&!r.forceRootCascade,i=o&&n?.hasCascading&&a?"ArrowLeft":"ArrowRight",l=a?"ArrowRight":"ArrowLeft";return{shouldOpenCascade:n?.hasCascading&&t.key===i,shouldCloseCascade:o&&t.key===l}}(a,e,s,o),u=!(e.target instanceof HTMLInputElement&&""!==e.target.value)&&" "===e.key;var h,p,g,m,v;c||"Enter"===e.key||u?(p=r,g=l,m=i,v=o,!(!(h=s)||!h.hasCascading||null===p||g&&m&&rg(g,m)&&(v.setCascadeState(!0,p),v.setFocus(!0),0))||function(e){const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});e?.dispatchEvent(t)}(l),e.preventDefault()):d&&(e.preventDefault(),a.close())};return i.addEventListener("keydown",l),()=>{i.removeEventListener("keydown",l)}},[e,t,r,n,a,o])}(r,b,f,i.focusedIndex,p,e);const{startCallback:y,cancelCallback:x}=yl({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&rg(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=i.focusedIndex,u(()=>{const e=E.current;if(null===C||T)return;const{node:t,metadata:n}=ag(C,w,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),I({focusedIndex:C,node:t,listElement:e})),()=>S()},[C,T=s,E=r,A=e,S=x,w=b,k=f,I=y]),function(e,t,n,r){u(()=>{const{metadata:a}=ag(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(i.focusedIndex,b,f,e),o(()=>({register:g,unregister:m,map:f,focusedIndex:i.focusedIndex,listRef:r,isMousing:s,isScrolling:h,popupNodeId:p?.nodeId}),[g,m,f,i.focusedIndex,r,s,h,p?.nodeId]);var C,T,w,k,E,A,I,S}const ig=i(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function lg({style:e,children:t,forceNewCascade:n}){const r=cr(tr["popup-list"],rc,e),a=function(e){const[t,n]=c(null),[r,a]=c(!1),[o,i]=c(null),l=d((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=d(()=>{n(null),i(null),a(!1)},[n,i,a]),u=d(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:u,forceRootCascade:e}}(n),o=og(a);return S("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:S(eg.Provider,{value:o,children:S(ig.Provider,{value:a,children:t})})})}function sg({searchTerm:e,setSearchTerm:t,onClick:n,placeholder:r,SearchInput:a,SearchList:o,DefaultList:i,extraProps:l,listLength:s,forceSearchVisible:c}){const d=c||s>=5,u=Tr(e),h=e=>{n?.(e)};return R(N,{children:[d&&S(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?S(o,{...l??{},onClick:h,searchTerm:e}):S(i,{...l??{},onClick:h})]})}const cg=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function dg({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return u(()=>{r.current?.focus({preventScroll:!0});const e=e=>{const t=document.activeElement,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement;!r.current||document.activeElement===r.current||n||(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)&&"Backspace"!==e.key||r.current.focus()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[]),S("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:cg})}function ug({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=cc(),[d,u]=c(""),h=Tr(d),p=l?.(h);return S(xc,{children:S(lg,{style:p,children:S(sg,{searchTerm:d,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:dg,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function hg({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:i,focusedIndex:s,isMousing:c,listRef:u}=l(eg);g(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==i&&null!==t.current?i.get(t.current)?.index??-1:-1,[i]),p=h===s;g(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const m=d(()=>{u?.current?.focus()},[u]),v=o(()=>({onFocus:m,"data-focused":p}),[m,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const pg=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return S("button",{...oc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),gg=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=hg(),l=me([i,r]);return S(pg,{...oc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),mg=Gn({display:"flex",gap:"8px",alignItems:"center"});function vg({promptText:e}){return R("div",{className:mg,children:[S(rl,{Component:xs}),S(Ys,{children:e})]})}function bg({text:e}){return S("div",{...oc,children:e?S(vo,{children:e}):S(jo,{styles:Gn({width:"100%",height:"16px"})})})}const fg=cr(tr["popup-list"],rc),yg=()=>R("div",{...fg,children:[S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{})]});function xg({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?S(yg,{}):R(N,{children:[r&&S(gg,{onClick:()=>jl("BankAccountForm"),children:S(vg,{promptText:"Add bank account"})}),e?.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}const Cg={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Tg={...Cg,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function wg({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ee(e??[],Tg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[a&&S(gg,{onClick:()=>jl("BanksAndIntegrations"),children:S(vg,{promptText:"Add bank account"})}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}function kg({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return S(ug,{onClick:e,placeholder:"Search bank accounts...",SearchList:wg,DefaultList:xg,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Eg=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function Ag({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=Gu(n?.name??"",n?.mask??"");return R(sc,{placement:"bottom-start",children:[S(dc,{children:r=>S(ap,{label:e,popupTriggerProps:r,disabled:t,children:S("button",{className:Eg,type:"button",disabled:t,children:rr(n)?S(Ys,{children:i}):S(Ys,{intent:"weak",children:"Select bank account"})})})}),S(kg,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const Ig=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),Sg=e=>{if(nr(e))return!1;const t=e.filter(e=>fh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||rr(e.lastSyncedDate))},Ng=()=>{const e=nh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function Rg(){return nh({select:e=>{return{...e,plaidItemAccountsReadyToSync:Sg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>fh(e.apiName)))};var t}})}function Dg(e){return e?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)}function Pg(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function Mg(e){return nh({select:t=>({...t,data:Pg(t?.data,e)})})}const Lg=e=>{const{query:t}=nh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data},Fg=()=>["expenses/categories"],Og=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:ss({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?ss({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function Vg(e){return Rr({...e,queryKey:["expenses/categories"],queryFn:Og})}function Bg(){return Vg({select:e=>({...e,data:e.data?jg(e.data):void 0})})}function Ug(e,t){return(t.get(e)??[]).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Wg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Hg(){return Vg({select:e=>({...e,data:e.data?Wg(e.data):void 0})})}function zg(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentCategoryId){const e=t.get(n.parentCategoryId)??[];e.push(n),t.set(n.parentCategoryId,e)}return t}function qg(e){if(0===e.length)return[];const t=zg(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function jg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Kg(){return xl({prefetchFn:ml(Fg,Og)})}const _g=e=>({id:e.id,name:e.name});function Yg(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:Ku("Category","Categories",n.size,!0),list:[...n].join(", ")}}const Zg=cr(tr.text,mr({label:"strongLabel"}),Gn({maxWidth:"100%"}),ja);function Gg({children:e,stylists:t=[]}){const n=gr([Zg,...t]);return S("div",{...n,children:e})}const Qg={keys:[{name:"name"}],threshold:.1};function Xg(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Jg(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.id===l.id))),o=!(a||0!==r?.children?.length&&r.children),i=!a&&r.children&&r.children.length>0;var l;a?Xg(a,r,n):o?Xg(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Xg(e,n,t)})}(r,n)}),n}const $g=cr(tr["category-icon"],Gn({objectFit:"contain"})),em=cr(tr["category-icon"],Gn({objectFit:"contain",color:"icon.base"}));function tm(e,t,n){const r=({size:n=24})=>{const{icons:r}=l(li),a=e;return Tr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?S(Ae,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...em}):S("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...$g});var o};return r.displayName=t,r}const nm=cr(null,Gn({whiteSpace:"normal"})),rm=[cr(null,Gn({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function am({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=Vg({select:e=>({...e,data:e.data?qg(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ee(i??[],Qg),[i]),c=o(()=>i?Jg(s.search(e),i):[],[i,e,s]);return a?S(yg,{}):l?S(bg,{text:"No data"}):0===c.length?S(bg,{text:"No results found"}):S(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=tm(n.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(_g(n)),children:[S(ud,{Component:a}),S(Gg,{stylists:[nm],children:r?n.name:R(N,{children:[e.name,S(rl,{Component:Qi,stylists:rm}),n.name]})})]},`${e.id}_${n.id}`)})})}const om=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=me([a,t?.ref]);return S(pg,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function im({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=l(ig),{itemRef:o,index:i,itemProps:s}=hg({hasCascading:!0}),{isScrolling:c}=l(eg);return R(sc,{open:n===i,onOpenChange:e=>{c||r(e,i)},placement:"right-start",children:[S(dc,{children:t=>S(om,{itemProps:s,index:i,ref:o,popupTriggerProps:t,children:e})}),S(xc,{initialFocus:a,children:t})]})}const lm=Gn({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),sm=Gn({display:"flex",gap:"8px",color:"icon.base"});function cm({Icon:e,iconUrl:t,displayLabel:n}){const r=t?tm(t,"Icon"):void 0;return R("div",{className:lm,children:[R("div",{className:sm,children:[!nr(e)&&e,nr(e)&&r&&S(ud,{Component:r}),S(vo,{wrap:"wrap",children:n})]}),S(rl,{Component:Qi})]})}function dm({category:e,handleCategoryChange:t}){return S(lg,{children:e.children?.map(e=>{const n=tm(e.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(_g(e)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:e.name})]},e.id)})})}function um({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=Bg(),a=t?.data,o=!r&&n&&void 0===a;return r?S(yg,{}):o?S(bg,{text:"No data"}):S(N,{children:a?.map(t=>{if(t.hasChilds)return S(im,{triggerChildren:S(cm,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:S(dm,{category:t,handleCategoryChange:e})},t.id);const n=tm(t.iconUrl,"Expense Category Icon");return R(gg,{onClick:()=>e(_g(t)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:t.name})]},t.id)})})}const hm=({onClick:e})=>{const{query:{data:t}}=Bg();return S(ug,{onClick:e,placeholder:"Search expense categories...",SearchList:am,DefaultList:um,listLength:(t?.data??[]).length})},pm=cr(tr["category-text"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",padding:0,outline:"none",border:"none",background:"none",borderRadius:"md",color:"typography.intent.action",flex:"1 1 0",minWidth:0,cursor:"pointer",_supportHover:{color:"typography.intent.action.hover"},"&:focus-visible":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"},"& .Tight-icon > path":{_supportHover:{stroke:"typography.intent.action.hover"}}}),tl),gm=cr(null,Gn({color:"inherit"})),mm=cr(tr["amount-input-container"],Gn({borderRadius:"md",border:"none",background:"transparent",color:"typography.intent.action",maxWidth:"120px","&:not(:focus-within)":{_supportHover:{color:"typography.intent.action.hover"}},"& .Tight-amount-input, & .Tight-text":{color:"inherit"},"&[data-clicked='true']:focus-within":{outline:"1px solid",outlineOffset:"2px",outlineColor:"border.layout.strong"},"&[data-clicked='false']:has(:focus-visible)":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"}}),tl);function vm({options:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map((e,r)=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(Ys,{children:e.label})},`${e.label}_${r}`))})})}const bm=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),fm=Gn.raw({color:"typography.base.weak"}),ym=(e,t)=>e===t;function xm({options:e,label:t,isEqual:n=ym,isEmpty:r,disabled:a}){const o=Eh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!nr(o.state.value)&&!r?.(o.state.value);return R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>S(ap,{label:t,popupTriggerProps:n,disabled:a,children:S("button",{...bm,type:"button",children:S(Ys,l?{children:i(e,o.state.value)}:{extraClassNames:[fm],children:`Select ${t.toLowerCase()}...`})})})}),S(vm,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const Cm=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),Tm=e=>r.createElement("svg",{width:16,height:16,stroke:"currentColor",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),wm=ci(Tm,"Bank",{styleIconKey:"bank"}),km=$n({base:{display:"flex",flexDirection:{base:"row",sm:"column"},alignItems:{base:"center",sm:"start"},justifyContent:"flex-start",textAlign:"start",gap:"4px",maxWidth:"100%",flexWrap:"wrap",minWidth:0},variants:{active:{true:{flexDirection:"column-reverse",alignItems:"start"},false:{flexDirection:{base:"column"},alignItems:{base:"start"}}}}});function Em({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?Gu(e,t):e;return R("div",{className:km({active:r}),children:[n&&S(fo,{intent:r?"normal":"weak",children:n}),S(Ys,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const Am=e=>["plaidInstitutionLogo",e??{}],Im=Gn({display:"flex",gap:"10px",maxWidth:"100%"});function Sm({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=kr(),n=Nr();return M({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Au({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?tm(i,"Logo"):void 0;return R("div",{className:Im,children:[S(ld,{Component:l&&o?l:wm}),S(Em,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Nm=Gn({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Rm({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return S(Fs,{...r,disabled:n,width:"fill-parent",children:S(Gg,{children:e?Gu(e.name,e.mask):R("div",{className:Nm,children:[S(Ys,{children:t}),S(rl,{Component:xs})]})})})}const Dm="TRIGGER_ACCOUNT",Pm="FORM_SELECTABLE_ACCOUNT",Mm=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Lm({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Mm,children:[R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(Rm,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Dm?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),S(kg,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&S(Vh,{errorMessage:o})]})}const Fm=(e,t,n)=>{if(!n)return;const r=e===Pm?t:n,a=e===Pm?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,fh(c)&&bh(d));var c,d;const u=(h=r?.status,p=a?.status,"ACTIVE"===h&&"INACTIVE"===p);var h,p;return o?"Selected account number does not match destination account number":s?"Merging a linked account into a manually tracked account may result in duplicate transactions":u?"You selected an active account to be merged into an archived account":void 0},Om=Gn({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Vm=Gn({display:{base:"block",sm:"none"}}),Bm=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Um=Gn({display:"flex",justifyContent:"center",alignItems:"center"}),Wm=Gn({display:{base:"none",sm:"block"}}),Hm=Gn({display:{base:"block",sm:"none"}});function zm({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Om,children:[R("div",{className:Bm,children:[o?S(Lm,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Dm,bankAccounts:n,isFilling:r,warningMessage:Fm(Dm,e,t??null)}):S(Rm,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Um,children:[S("div",{className:Wm,children:S(ud,{Component:Qi})}),S("div",{className:Hm,children:S(ud,{Component:lp})})]}),S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),S("div",{className:Vm,children:S(Mh,{alignment:"horizontal"})})]})}function qm({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=V({...n,queryKey:i,queryFn:o?t:Er,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const jm=e=>["vendors",e??{}],Km=e=>["vendors","infinite",e??{}],_m=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Ym=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return _m({queryParams:n,cursor:r,accessToken:a,environment:o})};function Zm(e={},t){return fl({queryKey:jm(e),queryFn:Ym,...t})}const Gm=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return _m({queryParams:n,cursor:o,accessToken:r,environment:a})};async function Qm(e){const{url:t,headers:n}=xa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=ba({extraHeaders:n,authorization:t});ha("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ha("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function Xm(e){return Qm(e)}const Jm=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:mi(n)}),$m=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),ev=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:mi(n)}),tv=async()=>await Ir.invalidateQueries({queryKey:["vendors"]});function nv(){return ch({mutationFn:Jm,onSuccess:tv})}const rv=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),av=Gn({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),ov=cr(tr["button-inline"],Gn({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function iv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:av,children:[S("input",{ref:o,type:"text",placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r()):"Escape"===e.key&&(e.preventDefault(),a())},onFocus:e=>{e.stopPropagation()},className:rv}),S("button",{type:"button",onClick:r,...ov,children:S(fo,{children:"Add"})})]})}function lv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);return u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]),S(gg,{onClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:s}):S(vg,{promptText:e})})}function sv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ee(e??[],Cg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(Ys,{children:e.name})},e.id))]})}function cv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>S(gg,{onClick:()=>t(e),children:S(Ys,{children:e.name})},e.id))]})}function dv({onClick:e}){const{query:{data:t,isLoading:n}}=Zm({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=nv(),a=t?.data??[];return S(ug,{onClick:e,placeholder:"Search vendors...",SearchList:sv,DefaultList:cv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}function uv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const hv=e=>["customers",e??{}],pv=e=>["customers","infinite",e??{}],gv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},mv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return gv({queryParams:n,cursor:r,accessToken:a,environment:o})};function vv(e={},t){return fl({queryKey:hv(e),queryFn:mv,...t})}const bv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return gv({queryParams:n,cursor:o,accessToken:r,environment:a})},fv=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:mi(n)}),yv=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),xv=async()=>await Ir.invalidateQueries({queryKey:["customers"]});function Cv(){return ch({mutationFn:fv,onSuccess:xv})}const Tv={type:"tween",duration:.3},wv={x:"100%"},kv={x:0},Ev={x:"100%"};function Av({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return S(xc,{style:r,modal:!0,forceMount:t,children:e})}const Iv=Gn({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Sv=cr(null,Iv);function Nv({children:e,clickHandler:t}){const n=cc();return t||(t=()=>{n.close()}),S(be,{lockScroll:!0,...Sv,onClick:t,children:e})}const Rv=Gn({display:"flex",flexDirection:"column",position:"fixed",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},backgroundColor:"surface.background"});function Dv({children:e,overlay:t=!1}){const n=cc(),r=d(e=>{e.stopPropagation()},[]);return S(Ie,{children:n.context.open&&R(Av,{fadeIn:!1,forceMount:!0,children:[t&&S(Nv,{}),S(Se.div,{transition:Tv,initial:wv,animate:kv,exit:Ev,className:Rv,onAnimationEnd:r,children:e})]})})}const Pv=Gn.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Mv=Gn.raw({display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",maxWidth:{base:"none",sm:"512px"},scrollbar:"hidden"}),Lv=cr(tr["drawer-header"],Gn(Pv));function Fv({hideDivider:e=!1,children:t}){return R(N,{children:[S("header",{...Lv,children:t}),!e&&S(Mh,{alignment:"horizontal",color:"normal"})]})}const Ov=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Vv({children:e}){return S("div",{className:Ov,children:e})}const Bv=Gn({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Uv=$n({base:Mv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Wv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=cc();return R(N,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>{r?.(),i.close()}}),S(vo,{children:o}),!nr(t)&&S("div",{className:Bv,children:t})]})}),S("div",{className:Uv({padChildren:a}),children:n}),e]})}function Hv({overlay:e=!1,...t}){return S(Dv,{overlay:e,children:S(Wv,{...t})})}const zv=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.19899 11.5105C8.9944 11.5105 11.2605 9.2444 11.2605 6.44899C11.2605 3.65358 8.9944 1.38745 6.19899 1.38745C3.40358 1.38745 1.13745 3.65358 1.13745 6.44899C1.13745 9.2444 3.40358 11.5105 6.19899 11.5105Z",strokeMiterlimit:10}),r.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),qv=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),jv=cr(tr["drawer-search-bar"],Gn({display:"flex",padding:"16px",flexDirection:"row",alignItems:"center",gap:"8px",flex:"1 0 0",borderRadius:"sm",border:"1px solid {colors.border.layout}",backgroundColor:"surface.foreground",maxHeight:"49px",minWidth:"fit-content"})),Kv=Xn(Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",backgroundColor:"surface.foreground",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),mr({label:"strongLabel"})),_v=cr(null,Gn({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Yv({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:qv,children:[S(vo,{children:"Search"}),R("div",{...jv,children:[S(ud,{Component:zv}),S("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Kv}),Tr(e)&&S(Fs,{stylists:[_v],onClick:()=>t(""),children:S(ud,{Component:uc})})]})]})}function Zv({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=c("");return S(sg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Yv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function Gv({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:u}){const[h,p]=ic({},a?.selected,i),[g,m]=ic({},a?.expanded,l),v=d((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),b=d((e,t)=>{const n=t??!g[e],r={[e]:n};m({...g,...r})},[g,m]),f=o(()=>e.map((e,a)=>({key:r({rows:e,groupIndex:a,originalGroup:t?.[a]}),index:a,original:t?.[a]??void 0,getRows:()=>e.map((e,t)=>{const r=n(e,t);return{key:r,value:e,expanded:g[r]??!1,getCanSelect:()=>c?.(e)??!0,getIsSelected:()=>h[r]??!1,toggleSelected:e=>v(r,e),getCanExpand:()=>u?.(e)??!0,getIsExpanded:()=>g[r]??!1,toggleExpanded:()=>b(r,!g[r])}})})),[e,r,t,n,h,v,g,b,c,u]);return o(()=>{const e={selected:h,expanded:g};return{groups:f,toggleSelected:v,toggleExpanded:b,getState:()=>e}},[f,v,b,g,h])}const Qv=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2768)"},r.createElement("path",{d:"M2.70654 9.12132C3.60197 9.12132 4.32787 8.39543 4.32787 7.49999C4.32787 6.60456 3.60197 5.87866 2.70654 5.87866C1.8111 5.87866 1.08521 6.60456 1.08521 7.49999C1.08521 8.39543 1.8111 9.12132 2.70654 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M8.32496 9.12132C9.22039 9.12132 9.94629 8.39543 9.94629 7.49999C9.94629 6.60456 9.22039 5.87866 8.32496 5.87866C7.42952 5.87866 6.70363 6.60456 6.70363 7.49999C6.70363 8.39543 7.42952 9.12132 8.32496 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M13.9434 9.12132C14.8388 9.12132 15.5647 8.39543 15.5647 7.49999C15.5647 6.60456 14.8388 5.87866 13.9434 5.87866C13.048 5.87866 12.3221 6.60456 12.3221 7.49999C12.3221 8.39543 13.048 9.12132 13.9434 9.12132Z",fill:"currentColor"}))),"Dots"),Xv=Gn({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function Jv({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:Xv,children:[S(ud,{Component:Qv}),S(vo,{wrap:"wrap",children:`No ${t} found`}),n&&S(fo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const $v=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function eb({children:e}){return S("div",{className:$v,children:e})}const tb=cr(tr["list-body"],null);function nb({title:e,children:t}){return R(eb,{children:[e,S("div",{...tb,children:t})]})}const rb=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10})),"Circle"),ab=cr(null,Gn({fill:"surface.intent.action.active"}));function ob({selected:e,showEmptyIndicator:t}){return e?S(ud,{Component:pi,stylists:[ab]}):t?S(ud,{Component:rb}):null}const ib=$n({base:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"9px",cursor:"pointer",padding:"16px",color:"typography.intent.secondary",minHeight:"52px",width:"100%",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}}}});function lb({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=cr(tr["selector-row"],ib({selected:r}),el);return S("button",{onClick:t,...a,...n,type:"button",children:e})}function sb({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(lb,{handleClick:t,selected:n,children:[e,S(ob,{selected:n,showEmptyIndicator:r})]})}const cb=Gn.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function db(){return S(jo,{styles:Gn(ac,cb)})}const ub=Gn({width:"70px",height:"24px"}),hb=Gn({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function pb(){return R("div",{className:hb,children:[S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]}),S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]})]})}function gb({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ee(e,Cg),[e]),s=Gv({data:o(()=>l.search(t).map(e=>e.item),[l,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?S(pb,{}):0===s.groups.length?S(Jv,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):S(nb,{title:S(Ys,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})}const mb=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),vb=Gn({width:"100%"});function bb({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]);const d=()=>{l(""),o(!1)};return R("div",{className:vb,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d()},children:[S(Mh,{alignment:"horizontal"}),S(lb,{handleClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:d,inputRef:s}):S(vg,{promptText:e})})]})}function fb({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=Gv({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?S(pb,{}):R(eb,{children:[S(bb,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n}),R("div",{className:mb,children:[S(Ys,{children:"Customers"}),S("div",{children:i.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})]})]})}function yb({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=vv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(uv)})}),{mutateAsync:a}=Cv(),o=cc(),i=n?.data??[],[l,s]=c(t?{[t.id]:!0}:{}),d=!l[t?.id??""];return S(Hv,{title:"Back",Footer:S(Uh,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!d}),onClose:()=>s(t?{[t.id]:!0}:{}),children:S(Zv,{placeholder:"Search customers...",onClick:e=>{nr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:gb,DefaultList:fb,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a({data:[{name:e}]}),n=t.data?.[0]?.data?.id;n&&s({[ss({id:n,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function xb({frequencies:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map(e=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(vo,{children:e.name})},e.value))})})}const Cb=$n({base:{minWidth:0,borderRadius:"zero",border:"1px solid",borderColor:"border.layout",_first:{borderRight:"none"},_last:{borderLeft:"none"},"&:not(:first-child):not(:last-child)":{borderLeft:"none",borderRight:"none"},_focus:{zIndex:2}},variants:{width:{full:{width:"100%"}},backgroundColor:{foreground:{backgroundColor:"surface.foreground"}},active:{true:{borderColor:"border.intent.secondary",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function Tb({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=cr(tr["button-group"],Xn(Cb({width:a,backgroundColor:o,active:t,corners:i}),Es,Ts,Gn(Ds),Ji));return S("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?S(vo,{wrap:"wrap",textAlign:"center",children:e.label}):S(Ys,{wrap:"wrap",alignment:"center",children:e.label})})}const wb=$n({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function kb({width:e,children:t}){return S("div",{className:wb({width:e}),children:t})}function Eb({options:e,handleClick:t,selectedIndex:n}){const[r,a]=c(null);return S(kb,{width:"full",children:e.map((e,o)=>R(b,{children:[0!==o&&S(Mh,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),S(Tb,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const Ab=ci(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),r.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),r.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),Ib=Gn({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",padding:"16px",gap:"8px",outline:"none",color:"icon.base",borderRadius:"2px",border:"{borderWidths.md} dashed {colors.border.layout}"},Wh,Hh,$i),Sb=cr(null,Gn({color:"icon.base"})),Nb=cr(tr["attachment-dropzone"],Ib);function Rb({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Nb.className,onMouseDown:r,onBlur:n}),children:[S("input",{...t()}),S(ud,{stylists:[Sb],Component:Ab}),S(Ys,{children:"Add Files"})]})}const Db=Gn({display:"flex",flexDirection:"column",gap:"8px"}),Pb=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Mb({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:Db,children:[o&&S("div",{className:Pb,children:S(Ys,{children:o})}),S(Rb,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&S(Vh,{errorMessage:i})]})}const Lb=Gn({display:"flex",justifyContent:"start",width:"100%"}),Fb=Gn({display:"flex",alignItems:"center",gap:"9px"}),Ob=Gn({width:"100%"}),Vb=$n({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Bb(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Ub({flatDimensionValues:e,dimensions:t,dimensionValueOptions:n,selectedRow:r,searchTerm:a,onClick:i}){const l=o(()=>e.filter(e=>{const n=t.find(t=>t.id===e.dimension?.id);return!n||!Bb(n)}),[e,t]),s=o(()=>new Ee(l,Cg),[l]),c=o(()=>new Set(s.search(a).map(e=>e.item.id)),[s,a]),d=o(()=>n.map(e=>e.filter(e=>c.has(e.id))).filter(e=>e.length>0),[c,n]);if(0===d.length)return S(Jv,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:"Search Results"})}),S("div",{className:Vb({nested:u}),children:d.map(e=>S("div",{className:Ob,children:e.map(e=>S(lb,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:Fb,children:[S(ob,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),S(Ys,{children:e.name})]})},e.id))},e[0].id))})]})}const Wb=ci(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2940)"},r.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2940"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),Hb=$n({base:{display:"flex",alignItems:"stretch",width:"100%",minHeight:"52px",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},variants:{active:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}},expanded:{true:{borderBottom:"none"}}}}),zb=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",padding:"16px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent",color:"typography.intent.secondary","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),qb=Gn({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"16px",minWidth:"58px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}});function jb({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=cr(tr["selector-row"],Hb({active:r,expanded:a}),el);return R("div",{...i,children:[o?R("button",{type:"button",className:zb,onClick:t,children:[S(ob,{selected:r,showEmptyIndicator:!r}),e]}):S("div",{className:zb,children:e}),!nr(n)&&S("button",{type:"button",className:qb,onClick:n,children:S(ud,{Component:a?Wb:lp})})]})}function Kb({dimensionValueRows:e,onClick:t}){return e.map(e=>S(lb,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:Fb,children:[S(ob,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),S(Ys,{children:e.value.name})]})},e.key))}function _b({fieldDimension:e,dimensionValueOptions:t,dimensions:n,selectedRow:r,setSelectedRow:a,allowMultiselect:o,onClick:i}){const l=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),s=Gv({data:t,groups:l,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),hasMultiSelect:o??!1,getCanSelect:e=>{const t=n.find(t=>t.id===e.dimension?.id);return!t||!Bb(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:e})}),S("div",{className:Vb({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:Ob,children:[(c||0===t)&&S(Mh,{alignment:"horizontal"}),S(jb,{onClick:n.getCanSelect()?()=>i(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:S(Ys,{children:n.value.name})}),n.expanded&&R(N,{children:[S(Mh,{alignment:"horizontal"}),S(Kb,{dimensionValueRows:r,onClick:i})]})]},e.key)}return S(Kb,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function Yb({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=d(t=>{if(n){const e=!a[t.id],n={...a,[t.id]:e};if(e){const e=r.find(e=>e.some(e=>e.id===t.id));e&&e.length>1&&(e[0].id===t.id?e.slice(1).forEach(e=>{n[e.id]=!1}):n[e[0].id]=!1)}o(n)}e?.(t)},[n,r,a,o,e]);return S(Zv,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Ub,DefaultList:_b,listLength:t.flatDimensionValues.length,extraProps:t})}function Zb({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){const i=o(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.dimension?.id);return!n||!Bb(n)}),[n,r]),[l,s]=c(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),d=o(()=>i.flat(),[i]),u=cc(),h=Object.values(l).some(Boolean);return S(Wv,{title:"Back",Footer:S(Uh,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=d.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:S(Yb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:d,selectedRow:l,setSelectedRow:s})})}function Gb(e){const t=cc();return S(Dv,{children:t.open&&S(Zb,{...e})})}const Qb=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),Xb=Gn.raw({color:"typography.base.weak"});function Jb(e){const t=e.slice(0,10);return 0===t.length?"":t.length<=3?`(${t}`:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`}const $b=/\D/g,ef=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),tf=Gn({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),nf=$n({base:{display:"inline-flex",height:"25px",padding:"5px 10px",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"md",border:"{borderWidths.lg} solid",borderColor:"border.intent.secondary",background:"surface.intent.secondary",fontSize:"sm",fontWeight:"sm",lineHeight:"14px",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),rf=Gn({border:"none",background:"none",padding:0,cursor:"pointer"}),af=Gn({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function of({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...cr(tr.pill,n,nf({disabled:r})),children:[S("div",{className:af,children:e}),S("button",{className:rf,onClick:t,disabled:r,children:S(hc,{Component:uc,stylists:[cr(null,tf)]})})]})}const lf=I.email(),sf=Gn({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),cf=Gn({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},mr.raw({label:"default"})),{useAppForm:df,withForm:uf,withFieldGroup:hf}=we({formContext:wh,fieldContext:kh,formComponents:{SaveButton:Nh,FormSaveButton:Dh,FormFooter:Uh},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Eh();return S(Gh,{inputRef:t,label:e,children:S(tp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Eh();return S(ap,{inputRef:r,label:e,hasErrorStyles:t,children:S(tp,{value:o.state.value,onChange:o.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:o=!1,hasErrorStyles:i}){const l=Eh(),s=Te(l.store,e=>e.meta.isDefaultValue),d=a(null),[u,h]=c(()=>l.state.value?Pt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Pt(l.state.value):null,[g,m]=c(""),v=e=>{const r=function(e){const t=e.replace(/\D/g,"");return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4,8)}`}(e.target.value);m(r);const a=Dt(r);if(a){let e=a;t&&n?e=Ft(Lt(a,t),n):t?e=Lt(a,t):n&&(e=Ft(a,n)),l.handleChange(Mt(e)),h(e)}else l.handleChange("")},b=g||(p?Nt(p):""),[f,y]=c(!1),x=e=>{f&&(()=>{if(p&&!s){const e=Dt(g);(t&&e&&St(e,t)||n&&e&&St(n,e))&&m(Nt(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),x(!f))},T=o?ap:Gh;return R(sc,{placement:"bottom-start",onOpenChange:x,open:f,children:[S(dc,{children:t=>S(T,{label:e,inputRef:d,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:S("input",{...wp,ref:d,type:"text",id:l.name,value:b,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),S(xc,{initialFocus:!1,children:S(Tp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Mt(e)),m(Nt(e)),h(e)},viewDate:u,onViewDateChange:h,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const o=Eh(),i=a(null);return S(ap,{label:e,inputRef:i,children:S("textarea",{...kp,ref:i,value:o.state.value||"",onChange:e=>o.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:Jp,SplitExpenseCategoryField:function({value:e,onChange:t}){const n=e?.iconUrl?tm(e.iconUrl,"Expense Icon"):void 0;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...pm,...t,type:"button",children:[n&&S(ud,{Component:n}),S(vo,{stylists:[gm],children:e?.name||"Uncategorized"})]})}),S(hm,{onClick:t})]})},SplitExpenseAmountField:function({value:e,onChange:t,onBlur:n}){const[r,a]=c(!1);return S("div",{...mm,"data-clicked":r,children:S(tp,{value:e,onChange:t,onClick:()=>a(!0),onBlur:()=>(a(!1),void n())})})},ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Eh(),a=Lg(t?.id??""),{query:{data:o},isFilling:i}=nh({select:e=>({...e,data:Dg(e?.data)})}),l=o?.data,s=rr(e)&&!$p(e);return S(Ag,{label:"Bank Account",disabled:s,onClick:e=>{var t;n({id:(t=e).id,name:t.name}),r()},bankAccount:a,bankAccountOptions:l,isFilling:i})},ButtonGroupField:function({label:e,options:t}){const n=Eh(),r=t.findIndex(e=>e.value===n.state.value);return S(ap,{label:e,disableHover:!0,children:S(Eb,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:xm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Eh(),l=a(null);return S(ap,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:S("input",{className:Cm,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:zm,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?ap:Gh,{handleBlur:l}=Eh();return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),S(dv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?ap:Gh;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),S(yb,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??Gl[0].name}`;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(ap,{inputRef:r,label:e,popupTriggerProps:t,children:S(vo,{children:o})})}),S(xb,{frequencies:Gl,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=Dp,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Eh(),{mutateAsync:d}=Op(),[u,h]=c(!0),{dataAttributes:p}=zh({isActive:u,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l}),{getRootProps:g,getInputProps:m}=Ne({maxFiles:e,accept:t,disabled:n,onDrop:async t=>{const n=s.state.value??[],r=n.filter(e=>!e.hasError).length,a=e-r,o=t.slice(0,a),i=t.slice(a),l=[...await Promise.all(o.map(e=>Lp(e,n))),...i.map(e=>Mp(e,Rp.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const u=c.map(async e=>{try{const t=await d({file:e.file,entity:"glSource",caption:e.file.name,entityId:null}),n=t?.attachment;return{localId:e.localId,success:!0,id:n?.id??null,iconUrl:n?.iconUrl??null,publicFileUrl:n?.publicFileUrl??null,fileSize:n?.fileSize??null}}catch{return{localId:e.localId,success:!1,id:null,iconUrl:null,publicFileUrl:null,fileSize:null}}}),h=await Promise.allSettled(u);s.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=c.findIndex(t=>t.localId===e.localId);if(-1===t)return e;const n=h[t];return"fulfilled"===n?.status&&n.value.success?{...e,isPending:!1,hasError:!1,displayText:"",id:n.value.id,iconUrl:n.value.iconUrl,publicFileUrl:n.value.publicFileUrl,fileSize:n.value.fileSize}:{...e,isPending:!1,hasError:!0,displayText:"Upload failed. Please try again."}}))}});return S(Mb,{getRootProps:g,getInputProps:m,dataAttrs:p,onMouseDown:()=>h(!0),onBlur:()=>h(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(sc,{children:[S(dc,{children:n=>S(ap,{label:e,popupTriggerProps:n,children:S("button",{className:Qb,type:"button",children:S(Ys,t?{children:t.name}:{extraClassNames:[Xb],children:`Select ${e.toLowerCase()}...`})})})}),S(Gb,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Eh(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),S(ap,{label:e,disabled:t,inputRef:o,kind:"text",children:S("input",{className:ef,value:Jb(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace($b,"").length,o=t.value.replace($b,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=Jb(o);i.current=function(e,t){let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e[r])){if(n===t)return r;n++}return e.length}(l,a)},onBlur:function(){const e=r.state.value;e.length>0&&e.length<10&&r.setErrorMap({onBlur:{message:"Phone number is incomplete"}})},type:"text",inputMode:"numeric",ref:o,placeholder:n})})},MultiEmailField:function({label:e,disabled:t,placeholder:n="Add email address"}){const r=Eh(),[o,i]=c(""),l=a(null),s=r.state.value,d=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=lf.safeParse(e);return t.success?!s.some(t=>t.toLowerCase()===e.toLowerCase())||(r.handleBlur(),r.setErrorMap({onChange:{message:"Email already added"}}),!1):(r.handleBlur(),r.setErrorMap({onChange:{message:t.error.issues[0].message}}),!1)})(e)&&(r.handleChange([...s,e]),r.setErrorMap({onChange:void 0}),i(""))};return S(ap,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:sf,children:[s.map(e=>S(of,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:tr["email-pill"],disabled:t},e)),S("input",{ref:l,className:cf,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:d,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),d()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const pf=[cr(null,Gn({"& path":{stroke:"icon.base"}}))];function gf({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Fs,{type:"button",onClick:n,children:[e&&S(rl,{Component:uc,stylists:pf}),S(vo,{children:t})]})}const mf=Gn({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),vf=Gn({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),bf=Gn({maxWidth:"600px"}),ff=Gn({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),yf=Gn({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),xf=Gn({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Cf=Gn({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Tf=Gn({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),wf=Gn({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),kf=e=>{Qh(e),Xh(e)};function Ef({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=nh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=vh(),a=kr(),o=Nr(),i=rr(n),l=i?{selectedAccounts:n}:e;return i&&a&&n.forEach(({duplicateAccount:e})=>{var t,n,r;e&&(t=e.id,n=a,r=o,Zl({queryKey:yr(Jl({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:es,accessToken:n,environment:r}))}),df({defaultValues:l,onSubmit:async e=>{if(await Ch()===Su){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await Th());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=yr(Jl({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await Yl({queryKey:r,queryFn:es,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Pt(e.tranStartDate||""),l=Pt(n||""),s=Pt(e.tranMinStartDate||""),nr(l)?i:rr(s)?Ft(l,s):(rr(i)&&Ft(l,i),i));var i,l,s;return nr(r)?null:Mt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...yh(t),duplicateBankAccountIds:[cs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await Th()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:mf,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:kf,children:[R("div",{className:vf,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:bf,children:S(Ys,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:ff,children:[R("div",{className:yf,children:[S("div",{className:xf,children:S(vo,{children:"Duplicate Account"})}),S("div",{className:Cf,children:S(vo,{children:"Into"})}),S("div",{className:Tf,children:S(vo,{children:"Destination Account"})})]}),S(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>S(i.AppField,{name:`selectedAccounts[${n}]`,children:t=>{const n=t.state.value.duplicateAccount?.id,o=function(e,t,n,r){const a=function(e,t,n){const r=new Set(e.map(e=>e.id));return t.forEach(({duplicateAccount:e})=>{e&&e.id!==n&&r.add(e.id)}),Array.from(r)}(e,t,n);return r?.filter(e=>!a.includes(e.id)&&bh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return S(zm,{destinationAccount:t.state.value.destinationAccount,selectedDuplicate:t.state.value.duplicateAccount,availableAccounts:o,isFilling:a,onSelectionChange:e=>{const n={duplicateAccount:e,destinationAccount:t.state.value.destinationAccount};t.handleChange(n)}},t.state.value.destinationAccount.id)}},n))})]}),S("div",{className:wf,children:S(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[S(gf,{showIcon:!1,onClick:()=>n()}),S(sd,{onClick:()=>i.reset(o),disabled:!t,children:S(vo,{children:"Clear Selections"})}),S(Nh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Af=Gn({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",width:"100%",maxWidth:"100%",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative",overflow:"hidden",boxSizing:"border-box"}),If=ye.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return S(Lu,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:S("div",{className:Af,children:S(Ef,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Sf({plaidItemAccounts:e,matchingAccountPairs:t}){await If({matchingAccountPairs:t,plaidItemAccounts:e})}const Nf=Gn({display:"flex",flexDirection:"column",gap:"12px"}),Rf=async(e,t,n)=>{try{const r=await async function({accessToken:e,plaidItemId:t,environment:n}){if(!e)throw new Error("Access token is required to create Plaid link token");const r={path:"/banks2/createPlaidLinkToken",accessToken:e,endpointManager:Eu(n)},{url:a,headers:o}=xa(r);return vi({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ha("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(pa({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),Ju("NO_LINK_TOKEN"))}catch(r){return pa({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),Ju("LINK_TOKEN_FAILED")}};async function Df(e,t,n){const r=await async function(e,t){const n=yr(Cu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await Yl({queryKey:n,queryFn:Tu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Pf(e,t,n,r){ha("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ha("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,Zl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:r,environment:a});const o=await Df(e,t,n);if(o){const e=await rh(t,n);return e?.data?.filter(e=>e.integration?.id===o.id)||[]}}var r,a;return[]}(t?.institution?.institution_id,n,r),{plaidItem:i}=await async function({publicToken:e,metadata:t,accessToken:n,environment:r}){if(!n)throw new Error("Access token is required to create Plaid link token");const a={path:"/banks2/webPlaidPublicToken",accessToken:n,endpointManager:Eu(r)},{url:o,headers:i}=xa(a);return await Ca({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ha("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Ir.invalidateQueries({queryKey:["integrations"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]}),Ir.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===lh({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return pa({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const l=await rh(n,r),s=l?.data?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=T(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(pa({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ju({title:"Uh Oh!",body:"It appears something went wrong fetching the accounts from your bank. Please chat with the support or try again later.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void pa({error:new Error("No new accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}});if(!i.some(e=>"ACTIVE"===e.status))return pa({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ju({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Iu,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return pa({error:new Error("Accounts saved successfully with unsupported accounts"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),function(e,t,n){const r=e.length;return ju({title:"All set! Ready to track your transactions?",body:R("div",{className:Xu,children:[S(Ys,{wrap:"wrap",children:`Your ${n} ${t} ${Ku("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),S(Ys,{wrap:"wrap",children:`The following linked ${r>1?"accounts are":"account is"} not supported at this time, so ${r>1?"they":"it"} will remain unsynced.`}),S("ul",{children:e.map(e=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Nu,label:"Get Started",type:qu.SUCCESS}]})}(l,o,e.plaidItemAccounts.length);const s=function(e,t){const n=[];for(const r of e){if(!r.apiMask)continue;const e=t.find(e=>e.mask===r.apiMask&&r.isSupported);e&&n.push({destinationAccount:sh(r),duplicateAccount:e})}return n}(i,a);return s.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await ju({title:"Your transactions are being categorized",body:R("div",{className:Nf,children:[S(Ys,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),S(Ys,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),R("ul",{children:[r.map(({duplicateAccount:e})=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e?.name??"",e?.mask??"")})},e?.id)),a&&S("li",{children:S(Ys,{wrap:"wrap",children:"and more..."})})]}),S(Ys,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Iu,label:"No thanks"},{key:Nu,label:"Review",type:qu.SUCCESS}]})===Nu&&await Sf({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(pa({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ju({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${Ku("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Nu,label:"Get started",type:qu.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return pa({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`I tried to link with ${e} and it failed (CODE: BANK_POST_FAILURE).`,attachments:[]}})}(t.institution?.name||"my bank"),{}}var a}async function Mf(e,t,n){return nr(e)?(ha("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ha("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(pa({error:new Error("Plaid Item sync failed, refreshing Plaid Items"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),!0):("INVALID_UPDATED_USERNAME"===e.error_code&&(pa({error:new Error("Plaid Item sync failed due to invalid updated username"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),await async function(e){const t=await ju({title:e,body:'Your bank account has an updated username. To fix it, tap "Banks & Integrations", and unlink your old account, so you can relink it with your new username. If you need any assistance, tap "Chat" to chat with a member of our team.',buttons:[{key:Iu,label:"Cancel"},{key:"chat",label:"Chat"},{key:Nu,label:"Banks & Integrations",type:qu.SUCCESS}]});"chat"===t?Qu({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Nu||(e=>{const t=ln.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||jl("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Lf=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Vt(t.lastSyncedDate)}`},Ff=e=>{let t;return e.isSupported?"ACTIVE"!==e.status?t="Archived":!e.lastSyncedDate&&e.syncTransactions?t="Processing":e.syncTransactions||(t="Not Synced"):t="Not Supported",t},Of="PLAID_LINK_NEW",Vf="PLAID_LINK_UPDATE",Bf="PLAID_LINK_UNLINK";function Uf({plaidEvent:e,plaidItemId:t,apiAccessToken:n,apiErrorCode:r,message:a}){return{eventType:"onPlaidLink",message:a,defaultPrevented:!0,data:{plaidEvent:e,integrationId:t,apiAccessToken:n,apiErrorCode:r}}}const Wf=i({});function Hf({onPlaidLink:e,children:t}){return S(Wf.Provider,{value:{onPlaidLink:e},children:t})}function zf(){return l(Wf)}const qf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)};function jf(){return ch({mutationFn:qf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const Kf=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Na(t)};return await ka(n)};function _f(){return ch({mutationFn:Kf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const Yf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(cs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Na(n)};return await async function(e){return Qm(e)}(r)};function Zf(){const{mutate:e}=_f();return ch({mutationFn:Yf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})},onError:async t=>{pa({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Try Again",type:qu.SUCCESS}]})===Nu&&e()}})}function Gf(e){return new Promise(t=>{window.Plaid.create({token:e,onSuccess:(e,n)=>t({status:"success",public_token:e,metadata:n}),onExit:(e,n)=>t({status:"exit",metadata:n,error:e}),onEvent:(e,t)=>{ha(`Plaid event: ${e}`,{metadata:t,eventName:e})}}).open()})}async function Qf(e,t,n,r){const a=await Rf(e,t,n);if(!a)return;const o=await Gf(a);if("success"===o?.status){const{public_token:e,metadata:a}=o;ha("Plaid link successful",{public_token:e,metadata:a});const i=await Pf(e,a,t,n);if(i.relinkPlaidItemId)return Qf(i.relinkPlaidItemId,t,n,r)}else if("exit"===o?.status){const{metadata:e,error:t}=o;ha("Plaid link exited",{metadata:e,error:t}),await Mf(t,e,a)&&r()}else pa({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:o,token:a}})}function Xf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=_f(),{onPlaidLink:o}=zf();return{linkPlaid:e=>{if(rr(o)){const t=Uf(e);o(t)}else Qf(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(o)}}function Jf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=_f(),{apiPartnerName:o}=l(Lc),{onPlaidLink:i}=zf();return{linkPlaid:e=>{if(rr(i)){const t=Uf(e);i(t)}else!async function(e,t,n,r,a){const o=await Rf(e,t,n);if(!o)return;const i=await Gf(o);if("success"===i?.status){const{public_token:e,metadata:o}=i;ha("Plaid link from search successful",{public_token:e,metadata:o});const l=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Df(t.institution.institution_id,n,r);if(i)return pa({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ju({title:"Already Linked",body:`It seems that this bank is already linked${o?` with ${o}`:""}. Please tap "Relink" to update the existing linked institution.`,buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]}))===Nu?{relinkPlaidItemId:cs(i.id)}:{}}var o;return ha("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Pf(e,t,n,r)}(e,o,t,n,r);l.relinkPlaidItemId&&Qf(l.relinkPlaidItemId,t,n,a)}else if("exit"===i?.status){const{metadata:e,error:t}=i;ha("Plaid link from search exited",{metadata:e,error:t}),await Mf(t,e,o)&&a()}}(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,o,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(i)}}const $f=cr(null,Ts,Gn({position:"absolute",left:1,right:1,bottom:1,width:"calc(100% - 2)",height:"44px",background:"surface.intent.primary",border:"none",borderRadius:0,gap:9,color:"icon.intent.primary",pointerEvents:"all",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}}}),Ji);function ey(){const{linkPlaid:e,loading:t}=Xf();return R("button",{onClick:()=>e({plaidEvent:Of,message:"Tile Plaid Link button pressed"}),...$f,disabled:t,children:[S(ud,{Component:vu}),S(Ys,{intent:"primary",children:"Link Account"})]})}const ty=Gn({width:266,minHeight:32});function ny(){return S(jo,{styles:ty})}const ry=cr(tr.text,Gn({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function ay({children:e}){return S("div",{...ry,children:e})}const oy={SUCCESS:Gn({backgroundColor:"surface.intent.success.highlight"}),DANGER:Gn({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:Gn({backgroundColor:"surface.intent.secondary"})},iy=cr(tr.chip,Gn({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function ly({variant:e,children:t}){return S("div",{className:Xn(iy.className,oy[e]),children:S(ay,{children:t})})}const sy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function cy({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${co(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return S(ly,{variant:sy(r,n,t),children:a})}const dy=Gn({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function uy({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:dy,children:[S(ro,{title:e,label:t}),rr(n)&&S(cy,{difference:n,invertDirection:r})]})}const hy={netIncome:0,income:0,expenses:0,absoluteSum:0},py=e=>{if(nr(e))return hy;const t=e.income?.total??0,n=e.expenses?.total??0,r=U(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},gy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(py):[]},my=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function vy({defaultRange:e=gt.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i},isFilling:l}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:gy})}({filter:a,grouping:t?Va:void 0}),{profitLossData:s,profitDifference:c}=o(()=>{if(n)return{profitLossData:ti,profitDifference:null};if(!i||0===i.length)return{profitLossData:my,profitDifference:null};if(2===i.length){const[e,t]=i;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:i[0],profitDifference:null}},[i,n]);return R(qa,{isSample:n,children:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:l?R(_o,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(s.netIncome),label:"Profit",comparison:c}),R(oo,{children:[S(mu,{amount:s.income,total:s.absoluteSum,color:"positive",label:"Income"}),S(mu,{amount:s.expenses,total:s.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const by=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],fy=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Na(a)};return await ka(o)},yy={moneyIn:0,moneyOut:0,netMoneyIn:0},xy=e=>{if(nr(e)||nr(e.operatingActivities)||!e.operatingActivities.children)return yy;let t=new U(0),n=new U(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(U(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Cy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(xy):[]};const Ty=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function wy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i,isFetched:l},isFilling:s}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Rr({queryKey:by({filter:e,grouping:t}),queryFn:fy,select:n})}({filter:e,grouping:t,select:Cy})}({filter:a,grouping:t?Va:void 0}),{cashFlowData:c,difference:d}=o(()=>{if(n)return{cashFlowData:ri,difference:null};if(!i||0===i.length)return{cashFlowData:Ty,difference:null};if(2===i.length){const[e,t]=i;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:i[0],difference:null}},[i,n]),u=n||l?Math.abs(c.moneyIn)+Math.abs(c.moneyOut):0;return R(qa,{isSample:n,children:[S(Ua,{title:"Cash Flow"}),S(Ha,{children:s?R(_o,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(c.netMoneyIn),label:"Change in Cash",comparison:d}),R(oo,{children:[S(mu,{amount:c.moneyIn,total:u,color:"positive",label:"Money In"}),S(mu,{amount:c.moneyOut,total:u,color:"negative",label:"Money Out"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const ky=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Ey=Gn({display:"flex",justifyContent:"end"});function Ay({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:ky,children:[S(Ao,{color:e,label:t}),S("div",{className:Ey,children:S(Ys,{children:n})})]})}const Iy=cr(null,Gn({display:"flex",gap:"10px",alignItems:"center"})),Sy=Gn({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Ny=cr(null,Sy);function Ry({bulletAmount:e=3,shimmer:t=!1}){return S(N,{children:Array.from({length:e},(e,n)=>R("div",{...Iy,children:[S(Ao,{color:To.var("colors.brand.secondary")}),t?S(jo,{styles:Sy}):S("div",{...Ny})]},n))})}const Dy={total:0,children:[]},Py=e=>{return nr(e)||nr(e.expenses)||!e.expenses.children?Dy:{total:e.expenses.total??0,children:(t=e.expenses.children,t.sort((e,t)=>(t.total??0)-(e.total??0)).slice(0,3).map(e=>({name:e.name??"",total:e.total??0})))};var t},My=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Py):[]},Ly=[To.var("colors.brand.primary"),To.var("colors.brand.success"),To.var("colors.brand.action")],Fy=Object.freeze({total:0,children:[]});function Oy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=ln(e=>e.externalOptions).dataVisualizationColors??Ly,l=t?Wt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:My})}({filter:l,grouping:t?Va:void 0}),{expenseData:d,expensesDifference:u}=o(()=>{if(r)return{expenseData:ni,expensesDifference:null};if(!s||0===s.length)return{expenseData:Fy,expensesDifference:null};if(2===s.length){const[e,t]=s;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:s[0],expensesDifference:null}},[s,r]),h=void 0===n?"Total Expenses":`${kt[n]} Total`,p=d.children.length>0;return R(qa,{isSample:r,children:[S(Ua,{title:"Expenses"}),S(Ha,{children:c?S(_o,{children:S(Ry,{shimmer:!0})}):R(N,{children:[S(uy,{title:uo(d.total),label:h,comparison:u,invertDirection:!0}),S(oo,{children:p?d.children.map((e,t)=>S(Ay,{color:i[t],bulletLabel:e.name,moneySummary:uo(e.total)},t)):S(Ry,{})})]})}),r&&S(Jo,{size:"sm"}),a&&S(ey,{})]})}const Vy=cr(null,Gn({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function By({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:it(l=e.year,i,1),endDate:it(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Vy,children:[R(ur,{children:[S(br,{children:"Monthly Review"}),S(nu,{period:e,setPeriod:t,disableNext:r||(s=e,c=n,h=s.month,p=c.month,h===p&&(d=s.year,u=c.year,d===u)),disablePrev:r})]}),R(au,{children:[S(vy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),S(wy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),S(Oy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const Uy="Oldest to Newest",Wy="Newest to Oldest",Hy="A-Z",zy="Z-A",qy="Lowest to Highest",jy="Highest to Lowest",Ky="A-Z",_y="Z-A";function Yy(){const[e,t]=c(void 0),n=o(()=>{if(e&&(e.orderBy||e.direction))return e},[e]);return{sortInstance:e,setSortInstance:e=>{(function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Ql)??!1,n=(e.direction&&e.direction in Xl)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const Zy=Gn({width:"15px",height:"15px",borderRadius:"sm",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,position:"relative","&::before":{content:"''",position:"absolute",top:"-10px",left:"-10px",right:"-10px",bottom:"-10px"},_supportHover:{"&[data-is-checked='false']":{backgroundColor:"surface.background.hover"}}}),Gy=Gn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),Qy=Gn({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function Xy({checked:e,onClick:t,Icon:n=Ih}){const[r,a]=c(e??!1),o=void 0===e?r:e;return S("button",{...cr(tr["checkbox-input"],Zy,o?Qy:Gy,el),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&S(hc,{Component:n})})}const Jy=cr(null,Gn({paddingLeft:"20px",paddingRight:"5px"}));function $y({checked:e,onClick:t,Icon:n=Ih}){return S("div",{...Jy,children:S(Xy,{checked:e,onClick:t,Icon:n})})}const ex=cr(tr["date-cell"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function tx({date:e,annotation:t}){const n=Nt(Pt(e));return R("div",{...ex,children:[t&&S(ay,{children:t}),S(Ys,{children:n})]})}const nx="Income",rx={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},ax={Expense:[{name:"Expense",value:rx.EXPENSE}],Income:[{name:nx,value:rx.REVENUE}],Transfer:[{name:"Bank Transfer In",value:rx.TRANSFER_IN},{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]},ox={EXPENSE:"Expense",REVENUE:nx,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},ix=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Add ${t}`])),lx=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Edit ${t}`])),sx=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},cx=e=>e===rx.TRANSFER_IN||e===rx.TRANSFER_OUT,dx=Gn({color:"money.negative"}),ux=Gn({color:"money.positive"}),hx=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>xr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),px=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!nr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:dx};const t=e.amount>0;let n;return n=t?"Expense Refund":e.children?.length>0?"Split Expense":"Expense",{type:"EXPENSE",displayName:n,css:t?ux:dx}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":nx,css:t?dx:ux}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?dx:ux};break;default:t=(e=>({type:e.type,displayName:hx(e.type),css:e.amount<0?dx:ux}))(e)}var n;return t},gx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 10.625H7.5C5.8424 10.625 4.25269 9.96652 3.08058 8.79442C1.90848 7.62231 1.25 6.0326 1.25 4.375V0.625",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),mx=cr(tr["transaction-date-cell-container"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function vx({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=px(e),a=cr(tr["transaction-type-label"],r.css),o=t?S("span",{...a,children:r.displayName}):void 0;return n?R("div",{...mx,children:[S(ud,{Component:gx}),S(tx,{date:e.date,annotation:o})]}):S(tx,{date:e.date,annotation:o})}const bx=Gn({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),fx=Gn({display:"flex",flexDirection:"column",width:"100%"}),yx=Gn({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function xx({label:e,subLabel:t,iconUrl:n}){return R("div",{className:bx,children:[n?S("img",{src:n,className:yx,alt:void 0,width:24,height:24}):S("span",{className:yx}),R("div",{className:fx,children:[S(Ys,{children:e}),S(fo,{children:t})]})]})}function Cx({bankTransaction:e,isChild:t=!1}){return t?S("div",{className:Gn({paddingLeft:"25px"}),children:S(xx,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):S(xx,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function Tx(e){return ho(_u(e.amount))}const wx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),kx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),Ex=Gn({display:"flex",alignItems:"center",gap:"8px"}),Ax=Gn({padding:"6px"});function Ix({row:e}){const t=e.original,n=S(hu,{children:Tx(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return S(Ic,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:R("div",{className:Ex,children:[S(ud,{Component:t?kx:wx}),n]})})}return S("div",{className:Ax,children:n})}const Sx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),Nx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),Rx=Gn({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),Dx=Gn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function Px({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Sx;case"Deposited to":return Nx;default:return null}})(e);return R("div",{className:Rx,children:[n&&S(ud,{Component:n}),R("div",{className:Dx,children:[e&&S(fo,{children:e}),t&&S(Ys,{children:t})]})]})}const Mx=Gn({maxWidth:"100%",width:"fit-content",display:"inline-flex",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.layout",background:"surface.background","& .Tight-sub-label":{color:"typography.base"},"& .Tight-icon > path":{stroke:"icon.base"}}),Lx=Xn(Mx,Gn({padding:"2.5px"})),Fx=Xn(Mx,Gn({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),Ox=Gn({background:"surface.intent.secondary",border:"{borderWidths.sm} solid",borderColor:"border.intent.secondary","& .Tight-sub-label":{color:"typography.intent.secondary"},"& .Tight-label":{color:"typography.intent.secondary"},"& .Tight-icon > path":{stroke:"icon.intent.secondary"}}),Vx=Xn(Ox,Gn({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),Bx=Gn({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.action",background:"surface.intent.action","& .Tight-sub-label":{color:"typography.intent.action"},"& .Tight-label":{color:"typography.intent.action"},"& .Tight-icon > path":{stroke:"icon.intent.action"},_supportHover:{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}}}),Ux=Xn(Bx,Gn({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),Wx=Gn({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.success",background:"surface.intent.success","& .Tight-sub-label":{color:"typography.intent.success"},"& .Tight-label":{color:"typography.intent.success"},"& .Tight-icon > path":{stroke:"icon.intent.success"}}),Hx=Xn(Wx,Gn({_supportHover:{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}}})),zx=Gn({background:"surface.intent.warning",border:"{borderWidths.sm} solid",borderColor:"border.intent.warning","& .Tight-sub-label":{color:"typography.intent.warning"},"& .Tight-label":{color:"typography.intent.warning"},"& .Tight-icon > path":{stroke:"icon.intent.warning"}}),qx=Xn(zx,Gn({_supportHover:{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}}})),jx=Gn({background:"surface.intent.danger",border:"{borderWidths.sm} solid",borderColor:"border.intent.danger","& .Tight-sub-label":{color:"typography.intent.danger"},"& .Tight-label":{color:"typography.intent.danger"},"& .Tight-icon > path":{stroke:"icon.intent.danger"}}),Kx=Xn(jx,Gn({_supportHover:{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}}})),_x=Gn({display:"flex",alignItems:"center",gap:"8px",height:"37px",margin:"0 8px",padding:"10px",borderRadius:"sm",cursor:"pointer",minWidth:0,outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}}),Yx={default:Vx,neutral:Vx,warning:qx,success:Hx,danger:Kx,highlight:Ux},Zx=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=gr([cr(tr["selector-button"],Xn(_x,Yx[e]),el),...n]);return S("button",{ref:a,...o,...r,children:t})}),Gx=()=>["accounting/glAccounts"],Qx=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(n);return $x(r)};function Xx(e){return Rr({...e,queryKey:["accounting/glAccounts"],queryFn:Qx})}function Jx(){return Xx({select:lC})}const $x=e=>e.map(e=>({...e,id:ss({id:e.id,prefix:"GL_ACCOUNT"})}));function eC(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentAccountNo){const e=t.get(n.parentAccountNo)??[];e.push(n),t.set(n.parentAccountNo,e)}return t}function tC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>tC(e,t))}const nC=e=>!e.parentAccountNo;function rC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:tC(e,t)}))}function aC(e,t){return(t.get(e)??[]).map(e=>{const n=aC(e.accountNo,t);return{...e,children:n}})}function oC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:aC(e.accountNo,t)}))}function iC(){return Xx({select:oC})}function lC(e){return rC(e).flatMap(e=>[e,...e.children])}const sC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function cC(e,t){return o(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const dC={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function uC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function hC(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.accountNo===l.accountNo))),o=!a&&r.children?.length>0,i=!(a||r.children&&0!==r.children.length);var l;o?function(e,t){e.children.forEach(n=>{uC(e,n,t)})}(r,n):a?uC(a,r,n):i&&uC(r,r,n)}),n}const pC=[cr(null,Gn({marginLeft:"6px",marginRight:"6px"}))],gC=cr(null,Gn({whiteSpace:"normal"}));function mC({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=Jx(),i=cC(r,e),l=o(()=>new Ee(i,dC),[i]),s=o(()=>hC(l.search(n),i),[i,n,l]);return a?S(yg,{}):s.map(({parent:e,child:n})=>S(gg,{onClick:()=>t(n),children:R(Gg,{stylists:[gC],children:[e.name,S(rl,{Component:Qi,stylists:pC}),n.name]})},`${n.accountNo}`))}function vC({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=Xx({select:rC}),o=cC(n,e);return a?S(yg,{}):a||r||void 0!==n?o.map(e=>S(im,{triggerChildren:S(cm,{displayLabel:e.name}),popupChildren:S(bC,{glAccount:e,onClick:t})},e.accountNo)):S(bg,{text:"No data"})}function bC({glAccount:e,onClick:t}){return S(lg,{children:e.children.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{children:e.name})},e.accountNo))})}const fC=Gn({maxWidth:"420px",width:"fit-content"});function yC({onClick:e,types:t}){const{query:{data:n}}=iC(),r=cC(n,t);return S(ug,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?fC:void 0,SearchList:mC,DefaultList:vC,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const xC={id:"mock_task_link_bank",priority:"HIGH",name:"Link your bank account",description:"Effortlessly track every dollar by linking your bank account",shortDescription:"Link your bank to track every dollar",type:"LINK_BANK",dismissable:"DISMISSABLE",status:"ACTIVE"};function CC(e,t=!0){const n=lh({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return{id:`${e.apiInstitutionName??"unknown"}_${e.id}_${e.apiErrorCode}_bank_error_task`,priority:"URGENT",name:n?.shortMessage(e.apiInstitutionName??"your bank")||"",description:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!1,apiPartnerName:""})||"",shortDescription:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!0,apiPartnerName:""})||"",type:n?.buttonType||"CHAT",dismissable:"DISMISSABLE",status:"ACTIVE",meta:{plaidItem:e}}}function TC(){return wu({filter:{status:{equal:"ACTIVE"}}},{select:e=>({multiAccountIntegrations:e.data?.filter(e=>["PLAID","UNIT"].includes(e.apiName))||[],integrations:e.data?.filter(e=>!["PLAID","UNIT"].includes(e.apiName))||[],cursor:e.cursor})})}const wC={LINK_BANK:"LINK_BANK",RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT",MESSAGE_REVIEW:"MESSAGE_REVIEW",TRANSACTION_REVIEW:"TRANSACTION_REVIEW",BANK_ERROR:"BANK_ERROR",RULE_REVIEW:"RULE_REVIEW",CSV_IMPORT_REVIEW:"CSV_IMPORT_REVIEW",ONBOARDING_FORM:"ONBOARDING_FORM"},kC=e=>["tasks",e??{}],EC={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},AC={filter:{status:{in:["ACTIVE"]}}},IC=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:mi(t[2].environment)},a=await wa(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function SC(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=nr(r=e)||nr(r.data)?[]:[...r.data].sort((e,t)=>EC[e.priority]-EC[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=AC,Rr({...r,queryKey:a?kC(a):["tasks",{}],queryFn:IC}));var r,a;const{query:{data:i},isFilling:l}=Rg(),{query:{data:s},isFilling:c}=ku({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:o(()=>{let e=[];const n=s?.data;n&&(e=n.map(e=>CC(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[xC]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const NC=e=>{const t=ji[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},RC=e=>["banks/transactions/summary",e],DC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},PC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),MC=async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}),LC=async({data:e,accessToken:t,environment:n})=>MC({data:[e],accessToken:t,environment:n}),FC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function OC(){return ha("mutation successful, invalidating BT queries"),Promise.all([Ir.invalidateQueries({queryKey:["banks/transactions"]}),Ir.invalidateQueries({queryKey:["banks/transactions/summary"]}),Ir.invalidateQueries({queryKey:["tasks"]}),Ir.invalidateQueries({queryKey:["reports"]})]).catch(e=>pa({error:e,severity:"error"}))}function VC(){return ch({onSuccess:()=>OC(),mutationFn:MC})}function BC(){return UC({mutationFn:LC})}function UC(e){return ch({onSuccess:()=>OC(),...e})}const WC=cr(tr["category-selector-table-cell"]);function HC({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=xl({prefetchFn:ml(Gx,Qx)}),{mutate:o}=BC(),i=void 0!==t,l=nr(e.glAccount?.iconUrl)?void 0:tm(e.glAccount.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[WC],onMouseEnter:r,onMouseLeave:a,children:[l&&S(ud,{Component:l}),S(Ys,{children:n})]})}),S(yC,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{o({id:e.id,glAccountId:t.id})},types:sC})]})}const zC=e=>e>0?"Deposited to":"Withdrawn from",qC=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",strokeMiterlimit:10}),r.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 7.85619 5.91297 7.11425 5.17103C6.37231 4.42909 5.36602 4.01227 4.31676 4.01227H1.67926",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 8.68983 5.91297 9.43177 5.17103C10.1737 4.42909 11.18 4.01227 12.2293 4.01227H14.8668",strokeMiterlimit:10})),"Split"),jC=cr(null,Gn({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),KC=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function _C({transaction:e}){const{label:t,list:n}=Yg(e.children);return S(Ks,{children:R("div",{...KC,children:[S(ud,{Component:qC}),R("div",{...jC,children:[S(vo,{children:t}),S(fo,{children:n})]})]})})}const YC=cr(tr["category-selector-table-cell"]);function ZC({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=Kg(),a=e.category?.name??"",{mutate:o}=BC(),i=void 0!==t,l=nr(e.category?.iconUrl)?void 0:tm(e.category.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[YC],onMouseEnter:n,onMouseLeave:r,children:[l&&S(ud,{Component:l}),S(Ys,{children:a})]})}),S(hm,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,categoryId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{t?.id&&o({id:e.id,categoryId:t.id.toString()})}})]})}function GC({transaction:e,parentTransaction:t}){if(e.children.length>0)return S(_C,{transaction:e});switch(sx(e.type)){case"EXPENSE_CATEGORY":return S(ZC,{transaction:e,parentTransaction:t});case"TRANSFER":return S(Px,{annotation:zC(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return pa({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return S(HC,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function QC({name:e}){return S(N,{children:e&&S(Ys,{children:e})})}function XC({onClick:e}){const t=cc(),n=Oi();return S(xc,{children:S(lg,{children:n.map(({status:n,displayName:r})=>S(gg,{onClick:()=>(e(n),void t.close()),children:S(vo,{children:r})},n))})})}const JC=cr(tr["review-status-selector-button"],Gn({width:"151px",justifyContent:"center"})),$C=cr(tr["review-status-dropdown-arrow"],Gn({display:"none"}));function eT({status:e,transactionId:t}){const[n,r]=c(!1),{mutate:a}=BC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:d}=Bi(e);return t&&((u=t).startsWith(is.TRANSACTION_LINE_ITEM)||u.startsWith(is.PROCESSOR_TRANSACTION))?null:R(sc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{variant:s,...e,stylists:[JC],onClick:i,children:[S(ud,{Component:d}),S(Ys,{children:l}),S("div",{...$C,children:S(rl,{Component:lp})})]})}),S(XC,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function tT({status:e,transactionId:t}){return S(eT,{status:e,transactionId:t},t)}function nT(){return S(ud,{Component:Qi})}function rT(){return S(nT,{})}const aT=e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),oT=ci(aT,"Dash"),iT=cr(null,Gn({stroke:"icon.base.weak"}));function lT({hasConversation:e,hasUnread:t=!1}){return S(N,{children:e?S(Dd,{hasUnread:t}):S("div",{"data-testid":"no-conversations-dash",children:S(hc,{Component:oT,stylists:[iT]})})})}function sT({conversationId:e}){const{query:{data:t}}=Sl(e??null),{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=rr(t),l=i&&"READ"===t?.readStatus,s=d(()=>{rr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=d(()=>{rr(e)&&(r(),o())},[e,r,o]);return S("div",{onMouseEnter:s,onMouseLeave:c,children:S(lT,{hasConversation:i,hasUnread:!l})})}const cT=cr(tr["badge-chip"],Lx),dT=cr(null,Za),uT=cr(null,el),hT=cr(tr["neutral-badge"],Ox),pT=cr(tr["highlight-badge"],Bx),gT=cr(tr["success-badge"],Wx),mT=cr(tr["warning-badge"],zx),vT=cr(tr["danger-badge"],tr["critical-badge"],jx);function bT({type:e,children:t}){let n;switch(e){case"danger":n=vT;break;case"warning":n=mT;break;case"neutral":n=hT;break;case"success":n=gT;break;case"highlight":n=pT}const r=gr([cT,dT,n,uT]);return S("div",{...r,children:t})}function fT({reviewStatus:e}){const{variant:t,Icon:n}=Bi(e);return S(bT,{type:t,children:S(ud,{Component:n})})}const yT=Gn({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),xT=Gn({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),CT=Gn({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),TT=Gn({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),wT=Gn({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),kT=Gn({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function ET({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=Yg(e.children);return`${t}: ${n}`}switch(sx(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${zC(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void pa({error:new Error("Should not get here. Payout without line items."),severity:"error"});default:return e.glAccount?.name}}(t),r=void 0!==e.getParentRow();return R("div",{className:yT,children:[r&&S(ud,{Component:gx}),R("div",{className:wT,children:[R("div",{className:CT,children:[t.iconUrl?S("img",{src:t.iconUrl,className:kT,alt:void 0,width:24,height:24}):S("span",{className:kT}),S(vo,{children:t.description})]}),R("div",{className:TT,children:[S(fT,{reviewStatus:t.reviewStatus}),S(fo,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:xT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[S(Ix,{row:e}),S(rl,{Component:Qi})]})]})}const AT=ci(aT,"Minus");function IT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return S($y,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?AT:Ih})}const ST=X(),NT=[ST.display({id:cn.SELECT,header:({table:e})=>S(IT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?S($y,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),ST.accessor("date",{id:cn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return S(Ks,{children:S(vx,{transaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:Uy,sortDescDisplay:Wy}),size:130,maxSize:144}),ST.accessor("description",{id:cn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return S(Ks,{children:S(Cx,{bankTransaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Hy,sortDescDisplay:zy}),size:180}),ST.accessor("amount",{id:cn.AMOUNT,cell:e=>S(Ks,{alignVariant:"flexEnd",children:S(Ix,{row:e.row})}),header:()=>S(Dc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:qy,sortDescDisplay:jy,align:"right"}),size:130,maxSize:130}),ST.accessor("category.id",{id:cn.CATEGORY,cell:({row:e})=>S(GC,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>S(Dc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),ST.accessor(e=>e.dimensionValues[0]?.id,{id:cn.DIMENSION_VALUE,cell:e=>S(Ks,{children:S(QC,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>S(Dc,{columnName:"Business"}),size:130}),ST.accessor("reviewStatus",{id:cn.REVIEW_STATUS,cell:e=>S(Ks,{children:S(tT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>S(Dc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:Ky,sortDescDisplay:_y,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),ST.display({id:cn.COMMENTS,cell:e=>{const t=e.row.original;return S(Ks,{alignVariant:"center",children:S(sT,{conversationId:t.conversation?.id})})},header:()=>S(Dc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),ST.display({id:cn.EXPAND,cell:()=>S("div",{className:Gn({paddingRight:"20px"}),children:S(rT,{})}),size:40,maxSize:60})],RT=ST.display({id:"MOBILE",cell:e=>S(ET,{row:e.row})}),DT=i(!0);function PT(){return l(DT)}const MT=[];function LT({transactions:e,columns:t}){const n=PT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(cn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[RT]:(i=t)?NT.filter(e=>i.includes(e.id)):NT;var i;return J({data:e??MT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??MT.length,columns:o,getCoreRowModel:$(),getRowCanExpand:e=>e.original.children.length>0,getSubRows:e=>e.children.map(e=>{return t=e,{...t,iconUrl:t.iconUrl??"",reconciliationMatch:null,tax:{paymentInfo:null},customData:null,children:[],attachments:[],suggestedCategories:[],conversation:null,status:"ACTIVE"};var t}),getExpandedRowModel:ee(),paginateExpandedRows:!1,getRowId:e=>e.id,state:{columnOrder:r,columnVisibility:a}})}const FT=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.REVIEW_STATUS];function OT({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["xx-large-icon"],tr.icon),...t??[]],size:50})}function VT(){return R(N,{children:[S(OT,{Component:pi}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function BT({children:e,stylists:t=[],...n}){return S(Ls,{intent:"warning",stylists:t,...n,children:e})}function UT(){const{linkPlaid:e,loading:t}=Xf();return S(BT,{...cr(tr["zero-state-button"]),onClick:()=>e({plaidEvent:Of,message:"Plaid Link button pressed"}),disabled:t,children:S(vo,{children:"Link your bank"})})}function WT(){return R(N,{children:[S(OT,{Component:wm}),S(br,{children:"Link Bank Account"}),S(fo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),S(UT,{})]})}const HT=Gn({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function zT(){return R(N,{children:[S("div",{className:HT,children:S(OT,{Component:hi})}),S(br,{children:"Transactions are being processed"}),S(fo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}const qT=Gn({animation:"linear 1s spin infinite"}),jT={background:"conic-gradient(from 90deg,rgba(255, 255, 255, 0) 0deg,rgba(148, 216, 232, 1) 360deg)",height:"100%",width:"100%",opacity:1};function KT({size:e}){const t=e??15;return S("div",{children:R("svg",{className:qT,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:S("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:S("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:S("div",{style:jT})})})}),S("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z","data-figma-gradient-fill":'{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"transform":{"m00":-9.1848822316819949e-16,"m01":-14.999998092651367,"m02":15.999998092651367,"m10":14.999998092651367,"m11":-9.1848822316819949e-16,"m12":1.0},"opacity":1.0,"blendMode":"NORMAL","visible":true}'}),S("defs",{children:S("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:S("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z"})})})]})})}function _T(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,u(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=w(e,t,n),o=(...e)=>a(...e);return o.cancel=()=>{a.cancel()},o.isPending=()=>!!r.current,o.flush=()=>a.flush(),o},[e,t,n]);return u(()=>{r.current=w(e,t,n)},[e,t,n]),i}function YT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=c(e),[a,o]=c(!1);u(()=>{r(e)},[e]);const i=_T(d(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const ZT=cr(tr["filter-bar"],Gn({display:"flex",padding:"16px",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",borderRadius:"2px",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:0,xl:{display:"flex",flex:"1 0 0",flexDirection:"column",height:"35px",padding:"0 10px",justifyContent:"center",alignItems:"flex-start",gap:"10px",borderRadius:"sm",background:"surface.background"}})),GT=cr(tr["filter-search-bar"],Gn({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),QT=cr(null,Gn({color:"icon.base",flexShrink:0,marginRight:"15px"})),XT=cr(null,Gn({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px",display:"flex",flex:"1 0 0",flexDirection:"column",justifyContent:"center",height:"100%",minWidth:0,padding:0,fontFamily:"label",_placeholder:{color:"typography.base.weak"},xl:{fontSize:"14px",lineHeight:"16px"}})),JT=Gn({width:25});function $T({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:t,onChangeDebouncedValue:e});return S("div",{...ZT,children:R("div",{...GT,children:[S("div",{className:JT,children:n||i?S(KT,{}):S(ud,{stylists:[QT],Component:zv})}),S("input",{...XT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh})]})})}const ew=cr(tr["date-amount-header"],Gn({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function tw({formattedDate:e,formattedSum:t}){return R("div",{...ew,children:[S(vo,{wrap:"wrap",children:e}),S(hu,{children:t})]})}function nw(e,t){return jl("BankTransactionForm",{routeProps:{transactionId:e,initialTab:t}})}function rw(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=cx(e.row.original.type),o="category"===e.column.id&&(r||a),i="comments"===e.column.id,l="amount"===e.column.id;if(i){const e=t.getParentRow();nw(e?.original.id??t.original.id,"conversation")}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();nw(e?.original.id??t.original.id)}}function aw({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=as(),a=d(()=>n({id:e.original.id}),[n,e.original]);return S(ql,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:rw,shouldDisplayDivider:n=>{return r=n,a=t,o=e.getVisibleCells().length,!(0===r||a&&1===r||r===o-1||a||1===r);var r,a,o}})}function ow({rows:e}){const t=o(()=>function(e){return Array.from(function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.original.date;if(t.has(e)){const r=t.get(e);r&&(r.netSumCents+=n.original.amount,r.formattedSumDollars=ho(_u(r.netSumCents)),r.rows.push(n))}else{const r=Pt(e);t.set(e,{date:e,formattedDate:r?Nt(r):e,netSumCents:n.original.amount,formattedSumDollars:ho(_u(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return S(N,{children:t.map(e=>R(b,{children:[S(tw,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>S(aw,{rowData:e},e.id))]},e.date))})}function iw({table:e,hasSelect:t}){const n=PT();return S(Ol,{children:n?S(ow,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>S(aw,{rowData:e,hasSelect:t},e.id))})}function lw(e){return e?"Search":"Search transactions..."}function sw(e,t){const n=/* @__PURE__ */new Map;return t.forEach(t=>{const r=t.selectedValues(e);r.length>0&&n.set(t.key,[...r])}),n}function cw(e,t){return e.get(t)??[]}function dw(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function uw(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function hw(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function pw({buttonText:e,onButtonClick:t}){return R(N,{children:[S(ld,{Component:Qv}),S(vo,{children:"No results"}),S(fo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&S(Ic,{onClick:t,children:e})]})}const gw=Gn({xl:{minWidth:"900px"}}),mw=Gn({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function vw({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){bd(qi);const c=function({transactions:e}){return function({transactions:e,columns:t}){return LT({transactions:e,columns:t?[...t,cn.EXPAND]:void 0})}({transactions:e,columns:FT})}({transactions:i}),{query:{data:d},isFilling:u}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=PT(),p=!nr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=S(pw,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=S(VT,{})):a=S(zT,{}):a=S(WT,{}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:gw,children:[S("div",{id:qi}),R(nl.Provider,{value:o,children:[R(ur,{children:[S(br,{children:"Transactions for review"}),S(yd,{children:S(sl,{})})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:r?S(gl,{}):R(N,{children:[!h&&S("div",{className:mw,children:S($T,{placeholder:lw(h),searchTerm:l,onChange:s,isFetching:a})}),S(zs.Provider,{value:{sortInstance:t,setSortInstance:n},children:S(Ll,{headerGroups:c.getHeaderGroups()})}),nr(g)?S(iw,{table:c,hasSelect:!1}):S(od,{children:g})]})})]})]})}function bw(){const[e,t]=c(""),{sortInstance:n,setSortInstance:r,apiSort:a}=Yy(),o={...(()=>{const e=Wi();return{...Ki,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:d}=ts({filter:o,sort:a,limit:10}),u=i?.data??Yi,{hasPlaidLinkedBankAccount:h,isFilling:p}=Ng();return S(vw,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:d,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const fw=cr(tr["button-table-header"]),yw=Gn({height:{xl:"auto",base:"44px"}});function xw(){const e=nh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return S("div",{className:yw,children:R(Fs,{onClick:()=>{jl(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[fw],children:[S(rl,{Component:vu}),S(tc,{children:"Banks & Integrations"})]})})}const Cw=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function Tw({children:e}){return S("div",{...Cw,children:e})}const ww=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),kw=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:cd,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:di,buttonText:"Review"};case"LINK_BANK":return{Icon:wm,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:wm,buttonText:"Fix"};case"RELINK":return{Icon:wm,buttonText:"Relink"};case"CHAT":return{Icon:ui,buttonText:"Learn more"};case"ONBOARDING_FORM":return{Icon:ww,buttonText:"Complete"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:pi,buttonText:""};default:return{Icon:ui,buttonText:""}}},Ew=cr(tr["banner-title"],Gn({display:"flex",alignItems:"center",gap:"8px"})),Aw=cr(tr["banner-icon"],Gn({width:"20px",height:"20px"}));function Iw({title:e,type:t}){const{Icon:n}=kw(t);return R("div",{...Ew,children:[S(ud,{Component:n,stylists:[Aw]}),S(vo,{wrap:"wrap",children:e})]})}const Sw=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",color:"icon.base",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function Nw({title:e,description:t,type:n}){return R("div",{...Sw,children:[S(Iw,{title:e,type:n}),S(fo,{wrap:"wrap",children:t})]})}const Rw=tr["banner-button"],Dw=Gn.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),Pw=cr(tr["banner-button-text"]),Mw=cr(tr["banner-button-icon"]);function Lw({priority:e,type:t,handleClick:n}){const{buttonText:r}=kw(t),a=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R(Ls,{onClick:n,intent:a,styles:Dw,className:Rw,children:[S(vo,{stylists:[Pw],children:r}),S(rl,{stylists:[Mw],Component:Qi})]})}const Fw=$n({base:{display:"flex",flexDirection:{base:"column",xl:"row"},padding:{base:"16px",xl:"15px"},gap:{base:"16px",xl:"0"},justifyContent:{xl:"space-between"},alignItems:{base:"flex-start",xl:"center"},alignSelf:"stretch",width:{base:"100%",xl:"auto"},minWidth:{xl:"350px"},borderRadius:{base:"sm",xl:"lg"},border:"1px solid",backgroundColor:"surface.foreground"},variants:{priority:{HIGH:{borderColor:"border.intent.warning"},MEDIUM:{borderColor:"border.intent.action"},LOW:{borderColor:"border.intent.success"},URGENT:{borderColor:"border.intent.danger"},DEFAULT:{borderColor:"border.intent.secondary"}}}}),Ow={HIGH:tr["banner-high"],MEDIUM:tr["banner-medium"],LOW:tr["banner-low"],URGENT:tr["banner-urgent"]};function Vw({task:e,handleClick:t}){const{name:n,description:r,shortDescription:a,type:o,priority:i}=e,l=PT()?a:r,s=cr(tr.banner,Ow[i],Fw({priority:i}));return R("div",{...s,children:[S(Nw,{title:n,description:l,type:o}),S(Lw,{priority:i,type:o,handleClick:t})]})}function Bw(e,t){Qu({message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}})}function Uw(e,t,n,r,a){return()=>ju({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function Ww(e){const{mutateAsync:t}=Zf(),n=kr(),r=Nr(),{apiPartnerName:a}=l(Lc),o=PT(),{linkPlaid:i,loading:s,hasOnPlaidLinkOverride:c}=Xf(),{linkPlaid:d,loading:u}=Xf(),h=lh({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(nr(h)||nr(e))return null;const p="ITEM_LOCKED"===e.apiErrorCode;switch(h.buttonType){case ah.DELETE_OR_RELINK:case ah.RELINK:return s?null:(m=i,v=a,b=o,{alert:Uw(h,(g=e).apiInstitutionName,v,b,[{key:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]),actions:{success:()=>{m({plaidEvent:Vf,plaidItemId:g.id,apiAccessToken:g.apiAccessToken,apiErrorCode:g.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case ah.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:Nu,label:"Unlink and Relink",type:qu.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:"PLAID_LINK_UNLINK_RELINK",plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,t,d,a,o,c);case ah.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l){return{alert:Uw(e,t.apiInstitutionName,i,l,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:ah.RELINK,label:"Relink"},{key:Nu,label:"Go To Bank",type:qu.SUCCESS}]),actions:{success:async()=>{const e=await Au({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;window.open(o,"_blank")},[ah.RELINK]:()=>{o({plaidEvent:Vf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,p,n,r,i,a,o);case ah.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:Nu,label:"Unlink",type:qu.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:Bf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(h,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:Uw(e,t,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat",type:qu.SUCCESS}]),actions:{[ah.CHAT]:()=>Bw(t,r)}}}(h,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var g,m,v,b}const Hw=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){pa({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function zw({task:e}){const{linkPlaid:t,loading:n}=Xf(),{linkPlaid:r,loading:a}=Jf(),o=Ww(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&nr(o);return i||l||s?null:S(Vw,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Vf,plaidItemId:e?.meta?.plaidItem?.id,apiAccessToken:e?.meta?.plaidItem?.apiAccessToken,apiErrorCode:e?.meta?.plaidItem?.apiErrorCode,message:"Fix Relink Bank Error button pressed"}):"LINK_BANK"===e.type?(ha("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Of,message:"Plaid Banner Link Bank pressed"})):rr(o)&&(ha("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Hw(o))}})}const qw=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function jw(){const e=PT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return S("div",{...qw,children:S(Nw,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const Kw=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function _w(){const e=PT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return S("div",{...Kw,children:S(Nw,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Yw=Gn({width:"100%",height:72,minWidth:"300px"});function Zw(){return R(N,{children:[S(jo,{styles:Yw}),S(jo,{styles:Yw}),S(jo,{styles:Yw})]})}function Gw({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?S(Zw,{}):a?e.map(e=>{if(void 0===wC[e.type]||"ONBOARDING_FORM"===e.type&&nr(e.actionLink))return null;if("LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(ah).includes(e.type))return S(zw,{task:e},e.id);const n=e.actionLink,r=rr(n)?()=>window.open(n,"_blank"):()=>t(e.type);return S(Vw,{task:e,handleClick:r},e.id)}):S(n?_w:jw,{})}function Qw({shouldFilterTasks:e=!1}){const{taskBanners:t,isFilling:n}=SC(e),r=os(),{query:{data:a}}=Rg();return R(N,{children:[R(ur,{children:[S(br,{children:"Action Items"}),S(xw,{})]}),S(Tw,{children:S(Gw,{taskBanners:t,handleScrollAction:NC,isWaitingForPlaidItemAccountsSync:!r&&!0===a?.plaidItemAccountsReadyToSync,isFilling:n})})]})}const Xw=cr(tr["business-owner-dashboard"],Gn({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Jw=Gn({display:"flex",width:"100%",justifyContent:"center"}),$w={status:{in:["ACTIVE","INACTIVE"]}};function ek({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=c(void 0);return{sortInstance:e,setSortInstance:d(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Cl)??!1,n=(e.direction&&e.direction in Tl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:i,paginationControls:s}=Al({limit:10,sort:a,filter:_i}),u=o?.data??Zi,h=PT(),{hasBookkeeper:p}=l(Lc),{initialPageProps:g}=l(vd),{query:{data:m}}=Rg(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ts({filter:$w,limit:1});return(e?.data?.length??0)>0}(),m),b=/* @__PURE__ */new Date,f={month:b.getMonth(),year:b.getFullYear()};const[y,x]=ic(g?.period??f,e,t),C=(T=y.month,{beginDate:it((w=y.year)-1,T+1,1),endDate:it(w,T+1,0)});var T,w;return S("div",{className:Jw,children:R("div",{...Xw,children:[S(Qw,{shouldFilterTasks:h}),!h&&R(N,{children:[S(By,{period:y,handleDateChange:e=>{var t,n;(t=f).year===(n=e).year&&n.month>t.month||n.year>t.year||x(e)},todayPeriod:f,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[S(ur,{children:S(br,{children:"Financial Summary"})}),S(Xd,{isSample:v,period:y})]})]}),!h&&S(N,{children:S(oi,{filter:C,isSample:v})}),p&&S(Td,{sortInstance:n,setSortInstance:r,conversations:u,paginationControls:s,isFilling:i,isMobile:h}),S(bw,{})]})})}function tk(e){return S(ma||N,{children:e.children})}function nk({children:e}){return S(tk,{children:S("div",{className:or(tr.component),children:e})})}function rk(e){return S(nk,{children:S(ek,{...e})})}const ak=Gn({display:"flex",flexDirection:"column"});function ok({task:e}){return S("div",{className:ak,children:S(zw,{task:e})})}const ik=Gn({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),lk=Gn({width:"80px",height:"12px"}),sk=Gn({width:"150px",height:"16px"}),ck=Gn({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),dk=Gn({userSelect:"none",cursor:"pointer"});function uk(){return R("div",{className:ck,children:[R("div",{className:dk,children:[R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]}),R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})]}),S("div",{className:dk,children:R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})})]})}const hk=Gn.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function pk({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=PT(),a=n||r?Ic:Fs;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(a,{extraClassNames:[hk],popupTriggerProps:e,children:S(rl,{Component:Qv,stylists:t})})}),S(xc,{children:e})]})}const gk=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),r.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),mk=$n({base:{display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative"},variants:{width:{lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"}},sm:{minWidth:{sm:"360px",base:"100dvw"},maxWidth:{sm:"392px",base:"100dvw"}}}}});function vk({width:e="lg",children:t}){const n=cr(tr["modal-popup"],mk({width:e}));return S("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const bk=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),fk=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yk=Gn({display:"flex",flexDirection:"column",gap:"12px"}),xk=Gn({display:"flex",flexDirection:"row",gap:"10px"}),Ck=Gn({display:"flex",flexDirection:"column",gap:"10px"}),Tk=({acknowledged:e,setAcknowledged:t})=>R("div",{className:yk,children:[S(Ys,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),R("div",{className:xk,children:[S(Xy,{checked:e,onClick:()=>t(!e)}),S(Ys,{wrap:"wrap",children:"I understand."})]})]});function wk({bankAccounts:e}){const{apiPartnerName:t}=l(Lc),n=e.reduce((e,t)=>{const n=Pt(t.tranStartDate||""),r=Pt(e.tranStartDate||"");return n&&r&&St(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutate:n}=vh();return df({defaultValues:{tranStartDate:t},onSubmit:t=>{var r,a;ju({title:"Start Date Updated",body:R("div",{className:Ck,children:[S(Ys,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),S(Ys,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Nu,type:qu.SUCCESS}]}),n((r=e,a=t.value.tranStartDate,r.map(e=>({id:cs(e.id),tranStartDate:a,duplicateBankAccountIds:[]}))))}})})(e,n),a=cc(),o=()=>{a.close()},[i,s]=c(!1),{query:{data:d}}=ku(),u=d?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Pt(e.reduce((e,t)=>{const n=Pt(t.tranMinStartDate||""),r=Pt(e.tranMinStartDate||"");return n&&r&&St(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${Gu(e[0]?.name,e[0]?.mask)} account dating back to ${Bt(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Bt(h)}.`;return R("form",{className:bk,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit(),a.close()},children:[S(vo,{children:"Set Bank Transaction Start Date"}),S(Ys,{wrap:"wrap",children:p}),S(Ys,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),S(r.AppField,{name:"tranStartDate",children:e=>S(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),S(r.Subscribe,{selector:e=>e,children:e=>{const t=Pt(e.values.tranStartDate||""),r=Pt(n),a=t&&r&&St(t,r);return R(N,{children:[e.isDirty&&a&&S(Tk,{acknowledged:i,setAcknowledged:s}),R("div",{className:fk,children:[S(gf,{showIcon:!1,onClick:o}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!i})]})]})}})]})}function kk({bankAccounts:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:gk}),S(vo,{children:"Edit Start Date"})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:e})})})})]})}const Ek=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M7.49998 14.4245C11.3242 14.4245 14.4244 11.3244 14.4244 7.50011C14.4244 3.67585 11.3242 0.575684 7.49998 0.575684C3.67573 0.575684 0.575562 3.67585 0.575562 7.50011C0.575562 11.3244 3.67573 14.4245 7.49998 14.4245Z",strokeMiterlimit:10}),r.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),Ak=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M11.7346 14.5L11.7346 12.9152C11.7333 12.2895 11.5704 11.6747 11.2616 11.1305C10.9528 10.5863 10.5087 10.1311 9.97233 9.80895L7.43662 8.29386C6.90079 7.97055 6.45795 7.51384 6.1513 6.96831C5.84465 6.42279 5.68467 5.80708 5.68698 5.18127L5.68698 3.60913",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),r.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),Ik={QBO:"QuickBooks Online",XERO:"Xero",STRIPE:"Stripe",SHOPIFY:"Shopify",SQUARE:"Square",RUTTER:"Rutter",UBER:"Uber",MOOV:"Moov",QUALPAY:"Qualpay",BENCH:"Bench",WAVE:"Wave",MANUAL_ENTRY:"Manual Entry",CSV_IMPORT:"CSV Import",PARTNER_IMPLEMENTATION:"Partner Implementation",FRESHBOOKS:"FreshBooks",FRESHBOOKS2:"FreshBooks"};function Sk(e){const{apiPartnerName:t,unitIntegrationBankName:n}=l(Lc);return"UNIT"===e?n??t??"Unit":Ik[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Nk=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Rk=cr(null,Gn({color:"brand.danger"}));function Dk({integration:e,accounts:t}){const{mutate:n}=Zf(),r=cc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=Xf(),{query:{data:l}}=(s=e.id,wu({},{select:e=>{return{...e,data:(t=e.data,n=s,t?.find(e=>e.id===n))};var t,n}}));var s;const c=l?.data,{query:{data:d}}=Mg(e.id),u=d?.data,h=Sk(e.apiName),p="PLAID"===e.apiName;return R(lg,{children:[p&&!o&&R(gg,{onClick:()=>(a({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[S(ud,{Component:xs}),S(vo,{children:"Add Account"})]}),p&&u&&S(kk,{bankAccounts:u}),tt(t)&&R(gg,{onClick:()=>Sf({plaidItemAccounts:t}),children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Accounts"})]}),p&&R(gg,{onClick:()=>(async()=>{let o;var l;o=tt(t)?await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{wrap:"wrap",children:`Would you like to unlink ${e} altogether? If you unlink now and relink ${e} again in the future, you may see duplicate transactions.`})}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(h),r.close(),o===Su&&(p&&i?a({plaidEvent:Bf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[S(ud,{stylists:[Rk],Component:Ek}),S(vo,{stylists:[Rk],children:"Delete Connection"})]})]})}const Pk=Gn({userSelect:"none"});function Mk({children:e}){return S("div",{className:Pk,children:e})}const Lk=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px 12px 16px 16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"});function Fk({children:e}){return S("div",{className:Lk,children:e})}const Ok=cr(tr.badge,Fx),Vk=cr(null,Za),Bk=cr(null,el),Uk=cr(tr["neutral-badge"],Vx),Wk=cr(tr["highlight-badge"],Ux),Hk=cr(tr["success-badge"],Hx),zk=cr(tr["warning-badge"],qx),qk=cr(tr["danger-badge"],tr["critical-badge"],Kx);function jk({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=qk;break;case"warning":o=zk;break;case"neutral":o=Uk;break;case"success":o=Hk;break;case"highlight":o=Wk}const i=gr([Ok,Vk,o,Bk]);return S("button",{...i,onClick:n,disabled:r,...a,children:t})}function Kk({plaidItem:e}){const t=Ww(e);return R(jk,{type:"danger",onClick:n=>{n.stopPropagation(),t&&(ha(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Hw(t))},disabled:nr(t),children:[S(ud,{Component:ui}),S(fo,{children:"Fix Bank Error"}),S(rl,{Component:Qi})]})}const _k=$n({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",color:"icon.base",display:"flex",borderTop:"none",borderLeft:"none",borderRight:"none",width:"100%",justifyContent:"space-between",alignItems:"center"},variants:{active:{true:{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",cursor:"pointer"}}}}}),Yk=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function Zk({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=Xn(_k({active:a}),el);return R("button",{className:l,onClick:t=>{t.stopPropagation(),jl("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:Yk,children:[S(ud,{Component:i?gx:wm}),S(Em,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&S(ud,{Component:Qi})]})}const Gk=Gn({display:"flex",flexDirection:"column",gap:"4px"}),Qk=Gn({display:"flex",alignItems:"center",gap:"8px"}),Xk=cr(null,Gn({color:"brand.primary.weak"})),Jk=Gn({overflow:"hidden"});function $k({integration:e,isCompact:t=!1}){const{query:{data:n}}=Mg(e.id),r=n?.data,a="PLAID"===e.apiName,o=Sk(e.apiName);if(!tt(r))return null;const i=e.iconUrl?tm(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(Mk,{children:[R(Fk,{children:[R(Vv,{children:[S(ld,{Component:i??wm}),R("div",{className:Gk,children:[S(Ys,{children:e.apiInstitutionName??o}),S(fo,{children:Lf(r)})]})]}),R("div",{className:Qk,children:[a&&rr(e.apiErrorCode)&&S(Kk,{plaidItem:e}),S(pk,{stylists:[Xk],shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e,accounts:r})})]})]}),S("div",{className:Jk,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return S(Zk,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Ff(t),active:n,integration:e},t.id)})})]})}const eE=tm("data:image/png;base64,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","Stripe"),tE=tm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABGNJREFUeAHtnD1sEzEUx58vd72UpmUBJhYqZtQFIYG6ICiUsXxIwARDEUJiABZWQGIBBgZAlWBjKpQBUEVbIaEWWBFiRGJgLAP0K7nch/n7koaUJvWdk1zTnF0lufN7tt/7xXc5u/ZjJEm2be91AxoyiE6SwfYR5z0owiXF2lXMiLFlCvjXgOilZdCU4zjfNzKW1ROaZnaQDH6VMTYEnb56els8f4FzPkUBe+h5hdlavtQClLNs+y4RG0WBrlqFOjCviItizHWcm/Btqdq/NYBylNvp2O5zwDlarZSeYz5tO9b5JVqaX/W5GlCvZWcnIDiyKkzp54zrFEbg+6LwP7MKwbK77+H47Op5ij/7M6aVC3xvUjAIe5Bpdh9iGf4e52m558i+/yL32WHPy3/ErzdShq7hXcMJYYRvXWUm6EHZ7B6L0xdkd+pP+T+34x0tuIwGDMPnwxpOTXJ9go2Ba+x0TbHOJMGGmXZ2HnfqHZrHegIYT/0yymOr9VKdg4dr3mOCg+rA08ct/gX59C5g7DfqqX7obAe83OB8O36NjsPDUzCo8swXwzjOzC57GQPSbTEKCVUXOC67hcLTmOU2Rd3KZi8C0hM0bsUxAAPZldJzUJxSQpfTxFaBI8yFrc+EzeI4blIF9DZuQ5utH1DwRsUGJUC456yZElBpOPkymWWVNpUAoaF2uyFH8V3JZlVAUQzqCB0NSPI1akAakISARKx7kAYkISAR6x4kASQGq0mlbrMrex1PUAfRoNIzCcpx/H3yioX7OM4nYXhigADnBmN0q2GnGA2jLgZItxuuK0IFyV1ijAYj2BNNpZl1SVpMDhBh5qh5qZl1bWhVkoA2NKRdhRqQ5JvRgDQgCQGJWPcgDUhCQCLWPUgDkhCQiHUP0oAkBCRi3YM0IAkBiVj3oDYCpLK6op75zayrXhthfnI9iNPshpbEEXKai6PeiG5iM4qYAbyHmUDehCnXz+Up10b8jlw2MUCwKA/H7kS2rE0Uk7vE2sThuGZoQBJiGpAGJCEgEesepAFJCEjEuge1CJDq4nOJOS0VK9ms1IOwgj3XUldaUrkvtrPHTkqAMFw4EbulTS5gkKFksyqgESzvv7DJPkduPrSVITCCQlLdqyGa8rBWZxwvbGYJ/uBcdc2PgtmRimAzi9EHq47hdQYlYo87xV4NAWgFm1m6IzWZMiUAyhthLIuUOR7ZXcT5MBDo41vkAmlTBBsDUVDG0+Z3VH8FG70tvD6t0rZwKhR+YB50pr5eOiUhE7ApPQf59AAYECJGpzKBIlZUCialja5B4P1EQI9dOD9QVkj5B3vkufkxAaHy/yVEO5nLmOZ+5PWnnI4Ij3MJDMIrqnqosWg75jksZp9OLyARYEkwKMUOEhwqPUicFKm4Evj+q4yZQaATNvC/XOh0aEJv4Y8RomsUDEQMgEpaA6icWwSkSYOZH4jxXgxDdiPfrpTorAMR5O01grxd8VxH7KsPL6tqF6UDzLSHCfwLHN4iAPR6ZXwAAAAASUVORK5CYII=","Square"),nE=tm("data:image/png;base64,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","Shopify"),rE=tm("data:image/png;base64,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","Gusto"),aE=tm("data:image/png;base64,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","Freshbooks"),oE=tm("data:image/png;base64,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","Uber"),iE=tm("data:image/png;base64,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","Bank"),lE={GUSTO:rE,FRESHBOOKS:aE,FRESHBOOKS2:aE,SHOPIFY:nE,STRIPE:eE,SQUARE:tE,UBER:oE};function sE(e){return lE[e]??iE}const cE=Gn({display:"flex",flexDirection:"column",gap:"4px"});function dE({integration:e,isCompact:t}){const n=Sk(e.apiName),r=function(e){if(e)return`Last synced ${Vt(e)}`}(e.lastSyncedDate),a=sE(e.apiName);return S(Mk,{children:R(Fk,{children:[R(Vv,{children:[S(ld,{Component:a}),R("div",{className:cE,children:[S(Ys,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&S(fo,{intent:"normal",children:r})]})]}),S(pk,{shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e})})]})})}const uE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),hE=Gn.raw({color:"typography.base.weak"}),pE=Gn({overflow:"hidden"});function gE({manualBankAccounts:e,isCompact:t=!1}){const n=PT(),r=t||n?Ic:Fs;return R(Mk,{children:[R("div",{className:uE,children:[S(Ys,{extraClassNames:[hE],children:"Manually Tracked Accounts"}),S(r,{onClick:()=>jl("BankAccountForm"),active:!1,children:S(rl,{Component:xs})})]}),S("div",{className:pE,children:e.map(e=>S(Zk,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const mE=cr(tr["selector-row"],Xn(Gn(Is,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),Ji)),vE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),bE=Gn({display:"flex",alignItems:"center",gap:"8px"}),fE=Gn({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),yE=cr(null,Gn({width:"20px",height:"20px"}));function xE(){const{linkPlaid:e,loading:t}=Jf();return S("button",{...mE,disabled:t,onClick:()=>{ha("Add New Connection button pressed"),e({plaidEvent:Of,message:"Add New Connection button pressed"})},children:R("div",{className:vE,children:[R("div",{className:bE,children:[S(ld,{stylists:[yE],Component:wm}),R("div",{className:fE,children:[S(Ys,{children:"Connect your bank"}),S(fo,{children:"Find your banking institution with Plaid"})]})]}),S(ud,{Component:Qi})]})})}const CE=Gn({paddingInline:"16px",paddingBottom:"8px"}),TE=Gn.raw({color:"typography.base.weak",fontWeight:"label"});function wE({title:e,children:t}){return R("div",{children:[S("div",{className:CE,children:S(Ys,{extraClassNames:[TE],children:e})}),t]})}const kE=Gn({minWidth:"100%",height:"45px"});function EE(){return R(N,{children:[S(jo,{styles:kE}),S(jo,{styles:kE}),S(jo,{styles:kE})]})}const AE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),Ji)),IE=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),SE=Gn({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),NE=Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function RE({integration:e}){const{linkPlaid:t,loading:n}=Xf(),r="PLAID"===e.apiName,a=Sk(e.apiName),o=e.iconUrl?tm(e.iconUrl,"Institution Icon"):wm;return S("button",{...AE,disabled:n||!r,onClick:()=>{ha(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:IE,children:[R("div",{className:SE,children:[S(ld,{Component:o}),S(Ys,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:NE,children:[S(rl,{Component:vu}),S(Ys,{children:"Relink"})]})]})})}const DE=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},r.createElement("g",{fill:"none",fillRule:"nonzero"},r.createElement("path",{fill:"#95BF47",d:"M48.024 12.24a.567.567 0 0 0-.536-.495c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69c-.357-.36-1.073-.27-1.341-.18-.045 0-.716.225-1.878.585-1.118-3.285-3.086-6.255-6.529-6.255h-.313C27.768.585 26.517 0 25.487 0c-8.048 0-11.894 10.125-13.1 15.255-3.13.99-5.367 1.665-5.635 1.755-1.744.54-1.789.585-2.012 2.25C4.56 20.52 0 56.07 0 56.07l35.549 6.705L54.82 58.59c0-.045-6.752-46.035-6.797-46.35zm-14.443-3.6c-.894.27-1.922.585-2.996.945V8.91c0-1.98-.268-3.6-.715-4.905 1.789.27 2.951 2.295 3.711 4.635zm-5.947-4.185c.492 1.26.805 3.015.805 5.445v.36c-1.967.63-4.07 1.26-6.215 1.935 1.207-4.635 3.487-6.885 5.41-7.74zm-2.37-2.295c.358 0 .716.135 1.029.36-2.594 1.215-5.321 4.275-6.484 10.44-1.7.54-3.354 1.035-4.919 1.53 1.342-4.68 4.606-12.33 10.374-12.33z"}),r.createElement("path",{fill:"#5E8E3E",d:"M47.488 11.7c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69a.716.716 0 0 0-.492-.225l-2.683 55.35 19.273-4.185s-6.752-46.035-6.797-46.35a.776.776 0 0 0-.581-.54z"}),r.createElement("path",{fill:"#FFF",d:"M29.02 22.41l-2.37 7.11S24.55 28.395 22 28.395c-3.756 0-3.935 2.385-3.935 2.97 0 3.24 8.407 4.5 8.407 12.105 0 5.985-3.757 9.855-8.854 9.855-6.126 0-9.211-3.825-9.211-3.825l1.654-5.445s3.22 2.79 5.902 2.79c1.789 0 2.504-1.395 2.504-2.43 0-4.23-6.886-4.41-6.886-11.385 0-5.85 4.159-11.52 12.61-11.52 3.22-.045 4.83.9 4.83.9z"}),r.createElement("path",{fill:"#000",d:"M77.835 35.263c-1.938-1.032-2.93-1.93-2.93-3.141 0-1.526 1.398-2.513 3.56-2.513 2.524 0 4.777 1.032 4.777 1.032L85 25.256S83.378 24 78.6 24c-6.669 0-11.31 3.814-11.31 9.154 0 3.051 2.163 5.34 5.047 7 2.343 1.301 3.154 2.243 3.154 3.634 0 1.436-1.171 2.603-3.334 2.603-3.2 0-6.264-1.66-6.264-1.66L64 50.115S66.794 52 71.526 52c6.85 0 11.807-3.365 11.807-9.423-.045-3.32-2.524-5.61-5.498-7.314zM103.897 24.304c-3.316 0-5.925 1.62-7.914 4.053l-.089-.045L98.768 13h-7.472L84 52h7.473l2.476-13.33c.972-5.044 3.537-8.152 5.925-8.152 1.68 0 2.343 1.171 2.343 2.838 0 1.035-.088 2.341-.31 3.377L99.078 52h7.473l2.919-15.762c.31-1.666.53-3.648.53-4.999.045-4.368-2.166-6.935-6.102-6.935zM127.92 24C118.943 24 113 32.23 113 41.4c0 5.859 3.565 10.6 10.255 10.6C132.058 52 138 43.994 138 34.6c.044-5.456-3.081-10.6-10.08-10.6zm-3.653 22.185c-2.552 0-3.609-2.191-3.609-4.965 0-4.338 2.201-11.405 6.25-11.405 2.641 0 3.521 2.326 3.521 4.562 0 4.652-2.244 11.808-6.162 11.808zM157.168 24c-5.102 0-8.01 4.489-8.01 4.489h-.09l.447-4.045h-6.713c-.313 2.712-.94 6.89-1.521 10L136 62h7.563l2.104-11.156h.179s1.566.978 4.43.978c8.906 0 14.724-9.066 14.724-18.222 0-5.067-2.282-9.6-7.832-9.6zm-7.25 22.133c-1.969 0-3.133-1.11-3.133-1.11L148.04 38c.895-4.711 3.356-7.822 5.996-7.822 2.328 0 3.044 2.133 3.044 4.133 0 4.889-2.91 11.822-7.16 11.822zM176.287 14A4.25 4.25 0 0 0 172 18.284c0 2.186 1.414 3.716 3.536 3.716h.088c2.343 0 4.332-1.574 4.376-4.284 0-2.186-1.459-3.716-3.713-3.716zM166 52h7.736L179 25h-7.782zM198.487 25.574h-5.453l.277-1.276c.462-2.642 2.034-4.965 4.668-4.965 1.387 0 2.496.41 2.496.41l1.525-6.06S200.66 13 197.748 13c-2.773 0-5.546.774-7.672 2.551-2.681 2.233-3.929 5.467-4.53 8.747l-.23 1.276h-3.652l-1.156 5.831h3.652L180 53h7.81l4.16-21.595h5.408l1.11-5.831z"}),r.createElement("path",{fill:"#000",d:"M216.005 25s-4.788 11.928-6.912 18.45h-.09c-.135-2.1-1.897-18.45-1.897-18.45h-8.04l4.607 24.615c.09.536.045.894-.18 1.251-.904 1.698-2.395 3.35-4.157 4.557-1.445 1.027-3.071 1.697-4.336 2.144L197.123 64c1.536-.313 4.788-1.608 7.498-4.11 3.479-3.216 6.731-8.22 10.029-15.01L224 25h-7.995z"}))),PE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),Ji)),ME=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),LE=Gn({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),FE=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),OE=Gn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",outline:"none",backgroundColor:"surface.foreground",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:{sm:"16px",base:"18px"},padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),VE=Gn({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function BE(){const e=cc(),{mutateAsync:t}=jf(),[n,r]=c("");return R("div",{className:LE,children:[S(vo,{children:"Enter your shop name"}),S("div",{className:VE,children:S(DE,{})}),S(Ys,{children:"Please enter the name of your shop below."}),S("input",{className:OE,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:FE,children:[S(gf,{showIcon:!1,onClick:()=>{e.close()}}),S(Sh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:S(vo,{children:"Connect"})})]})]})}function UE(){const e=sE("SHOPIFY")??vu;return R(sc,{placement:"bottom",children:[S(dc,{children:t=>R("button",{...PE,...t,children:[R("div",{className:ME,children:[S(ld,{Component:e}),S(Ys,{children:"Shopify"})]}),S(ud,{Component:Qi})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(BE,{})})})})]})}const WE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),Ji)),HE=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function zE({apiName:e}){const{mutateAsync:t}=jf(),n=Sk(e);if("SHOPIFY"===e)return S(UE,{});const r=sE(e)??vu;return R("button",{...WE,onClick:async()=>{const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:HE,children:[S(ld,{Component:r}),S(Ys,{children:n})]}),S(ud,{Component:Qi})]})}const qE=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function jE(e){return qE.includes(e)}const KE=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],_E=Gn({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),YE=Gn({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function ZE(){const{query:{data:e},isFilling:t}=TC(),n=e?.multiAccountIntegrations,r=e?.integrations,a=rr(n)&&n.length>0||rr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=l(Lc),n=ln(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(jE),a=e?.map(e=>e.apiName)||[];let o=r??KE;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:_E,children:[(t||a)&&S(wE,{title:"Already Connected",children:t?S(EE,{}):R(N,{children:[n?.map(e=>S(RE,{integration:e},e.id)),r?.map(e=>S(RE,{integration:e},e.id))]})}),S(wE,{title:"Available Banks",children:S(xE,{})}),o&&o.length>0&&S(wE,{title:"Integrations",children:S("div",{className:YE,children:o.map(e=>S(zE,{apiName:e},e))})})]})}const GE=Gn({marginTop:"16px"}),QE=Gn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),XE=Gn.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function JE({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?S(ZE,{}):t?R(N,{children:[R("div",{className:GE,children:[S(Ys,{extraClassNames:[XE],children:"Connected Accounts"}),r?.map(t=>S($k,{integration:t,isCompact:e},t.id)),a?.map(t=>S(dE,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&S(gE,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?S(gE,{manualBankAccounts:o}):R("div",{className:QE,children:[S(ld,{Component:wm}),S(vo,{wrap:"wrap",textAlign:"center",children:"If you prefer to manually input your transactions as opposed to having them automatically tracked, you can add your Manually Tracked Bank Account(s) here."})]})}const $E=cr(null,Gn({color:"typography.base.weak"})),eA=cr(tr["drawer-header"],Gn({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Pv)),tA=Gn({display:"flex",gap:"8px"}),nA=Gn({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),rA=$n({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),aA=Gn({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),oA=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),iA=cr(null,Gn({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),lA=$n({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function sA({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=PT()||e,{query:{data:a},isFilling:o}=TC(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=nh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>fh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:Dg(e?.data)};var t}}),{mutate:c,isPending:d}=_f(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&CC(p,!1),m="connected"===ln(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,b=m?"Add New Connection":"Add New Account",f=()=>{jl(m?"NewConnection":"BankAccountForm")},y=r?Ic:Fs;return R(Hf,{onPlaidLink:n,children:[R("div",{...eA,children:[R(Vv,{children:[t&&S(Vu,{}),r?S(vo,{children:"Banks & Integrations"}):S(br,{stylists:[$E],children:"Banks & Integrations"})]}),R("div",{className:tA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[S(ud,{Component:vu,stylists:[cr(null,lA({refreshLoading:d}))]}),!r&&S(Ys,{children:"Sync Accounts"})]}),R(y,{onClick:()=>f(),active:!1,children:[S(ud,{Component:xs}),!r&&S(Ys,{children:"Add New Connection"})]})]})]}),g&&S("div",{className:oA,children:S(ok,{task:g})}),o?S(uk,{}):R(N,{children:[S("div",{className:rA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:S("div",{className:nA,children:S(JE,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&S("div",{className:aA,children:R(Fs,{stylists:[iA],onClick:()=>f(),children:[S(ud,{Component:xs}),S(vo,{children:b})]})})]})]})}const cA=Gn({display:"flex",justifyContent:"center"}),dA=Gn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1150px",border:"{borderWidths.md} solid {colors.border.layout.weak}",borderRadius:"lg",backgroundColor:"surface.foreground",marginBottom:"42px",overflow:"hidden"});function uA({onPlaidLink:e}){return S(nk,{children:S("div",{className:cA,children:S("div",{className:dA,children:S(sA,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})}function hA(e){return nt({key:"customer",name:"Customer",possibleValues:e})}function pA(e,t){if(e?.id&&t.id){const n=t.id?.in?.filter(t=>!e.id?.in?.includes(t));return{...t,id:{in:[...e.id.in??[],...n??[]]}}}return e?.id&&!t.id?{...t,id:e.id}:t}const gA=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function mA({children:e}){return S("div",{className:gA,children:e})}function vA({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(sc,{children:[S(dc,{children:e=>R(lb,{popupTriggerChildrenProps:e,children:[R(mA,{children:[t&&S(ud,{Component:tm(t,"")}),S(Ys,{wrap:"wrap",children:i})]}),S(ud,{Component:Qi})]})}),S(Hv,{title:r,Footer:o??null,children:a})]})}function bA(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ee(i??[],r),[i,r]);return o(()=>{if(!i)return{};const t=l.search(e);return function(e){const t={};for(const{parent:n,child:r}of e){const e=n.id;n.id===r.id?t[e]={parent:n,children:[]}:t[e]?t[e].children.push(r):t[e]={parent:n,children:[r]}}return t}(a(t,i))},[i,l,e,a])}function fA({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return S(N,{children:e.map((e,o)=>S(r,{groupIndex:o,children:e.map((e,n)=>S(a,{item:e},t(e,n)))},n(e,o)))})}const yA=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),xA=cr(tr["list-body"],Gn({display:"block"}));function CA({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:yA,children:[e&&S(Ys,{intent:"weak",children:e}),n?S(Jv,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):S("div",{...xA,children:t})]})}const TA=Gn({display:"flex",flexDirection:"column",gap:"16px"});function wA({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return S(sb,{handleClick:t,selected:n,isMultiSelect:r,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)}function kA({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=o(()=>Object.entries(e),[e]),i=o(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return S(eb,{children:S("div",{className:TA,children:S(fA,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>S(wA,{item:e,onItemClick:()=>t(e),selected:n.has(e.id),isMultiSelect:r}),GroupComponent:({children:e,groupIndex:t})=>{const n=a[t][1],r=n.children.length>0?n.parent.name:void 0;return S(CA,{label:r,children:e})}})})})}function EA({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:Qg,processResults:Jg});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function AA(e,t){return hC(e,t).map(e=>({parent:e.parent,child:e.child}))}function IA({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:dC,processResults:AA});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function SA(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...SA(n));return t}function NA(e,t){return e.value?.[t]?.value?.id?.in??[]}function RA(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&NA(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{NA(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function DA(e,t){const n=[];return e.forEach(e=>NA(e,t).forEach(e=>n.push(e))),new Set(n)}function PA(e,t,n,r){return d(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!NA(t,e).some(e=>n.includes(e)));return dw(t,e,r)})},[t,r,e])}const MA=Gn.raw({width:"100%",justifyContent:"center"}),LA=Gn({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function FA({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:LA,children:[R(sd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[S(Ys,{children:"Apply"}),S(rl,{Component:Ih})]}),S(Fs,{onClick:e,styles:MA,children:S(Ys,{children:"Clear All"})})]})}function OA({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function VA({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"category"),t=RA(l,e,p,"category");u(t)}},[p,l,s,u]),v=S(OA,{onApply:m,onClearAll:g});return S(vA,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:S(Zv,{placeholder:"Search expense categories...",onClick:a,SearchList:EA,DefaultList:BA,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}})})}function BA({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(VA,{categories:e.children??[],label:e.name??"",category:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,e.name??"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const UA=[];function WA({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Hg(),s=i?.data??UA,c=DA(cw(t,"category"),"category"),u=d(e=>{const t=HA(e);n(t)},[n]),h=PA("category",r,0,a);return a&&o?S(Zv,{placeholder:"Search expense categories...",onClick:u,SearchList:EA,DefaultList:BA,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function HA(e){const t=e.name??"",n=(e=>e.id?e.id.toString():"")(e);return{name:t,value:{category:{name:t,value:{id:{in:[n]}}}}}}function zA(){const{query:{data:e},isFilling:t}=Vg(),n=e?.data,r=o(()=>n?.map(HA),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}function qA(e){return nt({key:"category",name:"Category",NestedListComponent:WA,possibleValues:e})}const jA=[{value:"in",label:"In"}];function KA(e){return nt({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:jA})}function _A(){const e=function(){const e=Ui();return(e?Ri:Di).map(t=>Vi(t,e))}(),t=o(()=>function(e){const t="in";return[...e].map(e=>({name:e.text,value:{reviewStatus:{name:e.text,value:{[t]:e.value}}}}))}(e),[e]);return d(()=>({values:t,isFilling:!1}),[t])}function YA(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const ZA=I.object({minAmount:I.number().nullable(),maxAmount:I.number().nullable()}).refine(e=>null===e.minAmount||null===e.maxAmount||e.minAmount<=e.maxAmount,{message:"Minimum amount must be less than or equal to maximum amount",path:["amounts"]});function GA(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:rr((a=t).greaterThanEqual)?_u(a.greaterThanEqual):null,maxAmount:rr(a.lessThanEqual)?_u(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const QA=Gn({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function XA({children:e,title:t}){return S(Hv,{title:t,padChildren:!1,children:S("form",{onSubmit:e=>{e.preventDefault()},className:QA,children:e})})}const JA=Gn({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),$A=Gn({display:"flex",flexDirection:"column",flex:1}),eI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function tI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return S(XA,{title:"Amount",children:S(nI,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function nI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:GA(0,r),validators:{onChange:ZA},onSubmit:()=>{if(!r||!n)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:a,pendingFilters:n}),i=Te(o.store,e=>e.errorMap),l=i&&Object.values(i).some(e=>void 0!==e),s=()=>{if(!r)return;if(l)return void r([]);const t=function(e,t,n){const r=n.operators?.find(e=>"greaterThanEqual"===e.value),a=n.operators?.find(e=>"lessThanEqual"===e.value),o=[];if(null!==e&&r){const t=co(e,{dollarSign:!0,signage:"default"}),a=Yu(e),i=n.createFilter({name:`${t}${r.label}`,value:{[n.key]:{name:"",value:{[r.value]:a}}}});o.push(i)}if(null!==t&&a){const e=co(t,{dollarSign:!0,signage:"default"}),r=Yu(t),i=n.createFilter({name:`${a.label} ${e}`,value:{[n.key]:{name:"",value:{[a.value]:r}}}});o.push(i)}return o}(o.getFieldValue("minAmount"),o.getFieldValue("maxAmount"),e);r(t)};return R(N,{children:[S("div",{className:eI,children:R(eb,{children:[R("div",{className:JA,children:[S("div",{className:$A,children:S(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),S(vo,{children:"To"}),S("div",{className:$A,children:S(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&S(Vh,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const rI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"greaterThan",label:"Greater than"},{value:"greaterThanEqual",label:"+"},{value:"lessThan",label:"Less than"},{value:"lessThanEqual",label:"Up to"}];function aI(){return nt({key:"amount",name:"Amount",operators:rI,ModalComponent:tI})}function oI(){const{query:{data:e},isFilling:t}=nh(),n=e?.data,r=function({institutionIds:e}){const t=kr(),n=Nr(),r=[...new Set(e)],a=O({queries:r.map(e=>({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Au({institutionId:e,accessToken:t,environment:n})}),staleTime:864e5}))}),o={};return a.forEach(e=>{e.data&&(o[e.data.institutionId]=e.data?.data?.map?.logo)}),o}({institutionIds:o(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>rr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=Gu(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return d(()=>({values:a??[],isFilling:t}),[a,t])}function iI(e){return nt({key:"bankAccount",name:"Bank Account",possibleValues:e})}const lI=e=>e.value.bankAccount?.value.id?.in?e.value.bankAccount?.value.id?.in:e.value.bankAccount?.value.id?.notIn?e.value.bankAccount?.value.id?.notIn:[],sI=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function cI(e){return Rr({queryKey:["dimensionValues"],queryFn:sI,...e})}function dI(){const{query:{data:e},isFilling:t}=vv({filter:{status:{in:["ACTIVE"]}}}),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}function uI(e){return nt({key:"vendor",name:"Vendor",possibleValues:e})}function hI(e){const t=e.map(({name:e,types:t})=>function(e,t){const n="in";return{name:t,value:{type:{name:t,value:{[n]:e.map(e=>e.value)}}}}}(t,e));return nt({key:"type",name:"Type",possibleValues:()=>({values:t})})}const pI=ci(e=>r.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},r.createElement("path",{d:"M8 15.3859C12.0792 15.3859 15.3861 12.079 15.3861 7.99982C15.3861 3.92062 12.0792 0.61377 8 0.61377C3.9208 0.61377 0.613953 3.92062 0.613953 7.99982C0.613953 12.079 3.9208 15.3859 8 15.3859Z",strokeMiterlimit:10}),r.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),gI=cr(null,Gn({fill:"surface.intent.action.active"}));function mI({isSelected:e}){return S(ud,e?{Component:pI,stylists:[gI]}:{Component:rb})}function vI({filters:e,model:t,setFilters:n}){if(!t||!n)return null;const r=t.possibleValues?.();if(!r)return null;const a=t.selectedValues(e);return S(nb,{title:S(fo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?xI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(lb,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:r.name})}),S(mI,{isSelected:i})]},`${r.name}_${o}`)})})}const bI="status",fI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function yI(){const e="in";return{values:fI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function xI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function CI(e){return xI(e.value.status?.value)}function TI(){return nt({key:bI,name:"Status",possibleValues:yI,singleSelect:!0,SimpleListComponent:vI})}const wI=(kI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(kI));var kI;function EI({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function AI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"glAccount"),t=RA(l,e,p,"glAccount");u(t)}},[p,l,s,u]),v=S(EI,{onApply:m,onClearAll:g});return S(vA,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:S(Zv,{placeholder:"Search GL accounts...",onClick:a,SearchList:IA,DefaultList:II,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}})})}function II({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(AI,{glAccounts:e.children??[],label:e.name,glAccount:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:S(mA,{children:S(Ys,{wrap:"wrap",children:e.name})})},e.id)})})}const SI=[];function NI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=iC(),s=i??SI,c=DA(cw(t,"glAccount"),"glAccount"),u=d(e=>{const t=RI(e);n(t)},[n]),h=PA("glAccount",r,0,a);return a&&o?S(Zv,{placeholder:"Search GL accounts...",onClick:u,SearchList:IA,DefaultList:II,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function RI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function DI(e){return nt({key:"glAccount",name:"GL Account",NestedListComponent:NI,possibleValues:e})}function PI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(vt(e)){const t=Tt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(ft(e)){const t={};return t.greaterThanEqual=e.beginDate,t.lessThanEqual=e.endDate,t}}(r.date.value)),r.amount&&(n.amount=(a=e.amount,o=r.amount.value,a?{...a,...o}:o)),r.description&&(n.description=r.description.value),r.category&&(n.category=(i=e.category,l=r.category.value,pA(i,l))),r.reviewStatus&&(n.reviewStatus=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.reviewStatus,r.reviewStatus.value)),r.bankAccount&&(n.bankAccount=function(e,t){return pA(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return pA(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return pA(e,t)}(e.glAccount,r.glAccount.value)),r.type&&(n.type=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.type,r.type.value)),r.search&&(n.search=r.search.value),r.status&&(n.status=function(e,t){return e?{...e,...t}:t}(e.status,r.status.value)),r.vendor&&(n.vendor=function(e,t){return pA(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return pA(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function MI(e,t){const n=e.reduce(PI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return wI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const LI=e=>{const t=ln(e=>e.transactionsDashboardFilters),n=ln(e=>e.expenseDashboardFilters),r=ln(e=>e.incomeDashboardFilters),a=ln(e=>e.setTransactionsDashboardFilters),o=ln(e=>e.addTransactionsDashboardFilters),i=ln(e=>e.removeTransactionsDashboardFilter),l=ln(e=>e.hasInitializedTransactionsDashboardFilters),s=ln(e=>e.setExpenseDashboardFilters),c=ln(e=>e.addExpenseDashboardFilters),d=ln(e=>e.removeExpenseDashboardFilter),u=ln(e=>e.hasInitializedExpenseDashboardFilters),h=ln(e=>e.setIncomeDashboardFilters),p=ln(e=>e.addIncomeDashboardFilters),g=ln(e=>e.removeIncomeDashboardFilter),m=ln(e=>e.hasInitializedIncomeDashboardFilters);switch(e){case"transactionsDashboard":return{filters:t,setFilters:a,addFilters:o,removeFilter:i,hasUserConfiguredFilters:l};case"expenseDashboard":return{filters:n,setFilters:s,addFilters:c,removeFilter:d,hasUserConfiguredFilters:u};case"incomeDashboard":return{filters:r,setFilters:h,addFilters:p,removeFilter:g,hasUserConfiguredFilters:m}}};function FI(){return{getCategories:zA(),getBankAccounts:oI(),getCustomers:dI(),getVendors:function(){const{query:{data:e},isFilling:t}=Zm(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=cI(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Dimension Value";return{name:t,value:{dimensionValues:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=Jx(),n=o(()=>e?.map(e=>RI(e)),[e]);return d(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:_A()}}function OI(e,t,n){return n?function(e,t){let n;return e.forEach(e=>{const r=e.value[t]?.value?.contain;r&&(n=r)}),n||""}(n,e):""}const VI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function BI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return S(XA,{title:"Back",children:S(UI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function UI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:{[e.key]:OI(e.key,0,r)},onSubmit:()=>{if(!n||!r)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:n,pendingFilters:a});return R(N,{children:[S("div",{className:VI,children:S(eb,{children:S(o.AppField,{name:e.key,listeners:{onBlur:()=>{const t=function(e,t){const n=e.trim();if(!n)return null;const r=t.operators?.find(e=>"contain"===e.value);return r?t.createFilter({name:`${r.label} "${n}"`,value:{[t.key]:{name:"",value:{[r.value]:n}}}}):null}(o.getFieldValue(e.key),e);r(t?[t]:[])}},children:t=>S(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const WI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function HI(){return nt({key:"description",name:"Description",operators:WI,ModalComponent:BI})}const zI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function qI(){return nt({key:"notes",name:"Notes",operators:zI,ModalComponent:BI})}const jI=[{name:"Expense",types:ax.Expense},{name:"Income",types:ax.Income},{name:"Transfer",types:ax.Transfer}];function KI(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:KA(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(jI),search:at}),[l,i,s,c,u,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>MI(e,void 0),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}function _I(e,t,n,r,a){const o=ln(e=>e.initializeTransactionsDashboardFilters),i=ln(e=>e.initializeExpenseDashboardFilters),l=ln(e=>e.initializeIncomeDashboardFilters),s=ln(e=>e.hasInitializedTransactionsDashboardFilters),c=ln(e=>e.hasInitializedExpenseDashboardFilters),d=ln(e=>e.hasInitializedIncomeDashboardFilters),h=Wi(),p="transactionsDashboard"===e?s:"expenseDashboard"===e?c:d;u(()=>{const s=h?.value??[];!p&&!r&&t&&a&&("transactionsDashboard"===e?o({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):"expenseDashboard"===e?i({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):l({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}))},[p,r,t,a,e,n,h,o,i,l])}const YI=i(void 0);function ZI(){const e=l(YI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function GI({filters:e,removeFilter:t}){return function(e){const t=[];let n=null,r=null,a=null,o=null,i=null;for(let s=0;s<e.length;s++){const l=e[s];if(l.modelKey!==rt&&l.modelKey!==Ht&&(l.modelKey!==bI||!CI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(nr(n)&&rr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(nr(r)&&rr(e?.lessThanEqual)){r=s,o=e.lessThanEqual;continue}}t.push({key:l.id,text:l.name,indicesToRemove:[s]})}}const l=function(e,t,n,r,a){if(null!==e&&null!==t&&null!==n&&null!==r){const o=co(_u(n),{dollarSign:!0,signage:"default"}),i=co(_u(r),{dollarSign:!0,signage:"default"});return{key:`${a[e].id}-${a[t].id}`,text:`${o} - ${i}`,indicesToRemove:[e,t].sort((e,t)=>t-e)}}return null!==e?{key:a[e].id,text:a[e].name,indicesToRemove:[e]}:null!==t?{key:a[t].id,text:a[t].name,indicesToRemove:[t]}:null}(n,r,a,o,e);return l&&t.splice(i??t.length,0,l),t}(e).map(e=>S(of,{text:e.text,additionalValidClassName:tr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const QI=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_24404_41655)"},r.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter"),XI=Gn({width:"17px",height:"17px",borderRadius:"sm"});function JI({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:XI}),S("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:17})}const $I=Gn({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),eS={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function tS(){const e=PT(),{dashboardKey:t}=ZI();return S(Fs,{onClick:()=>{jl(eS[t],{routeProps:{}})},stylists:[cr(null,$I)],children:e?S(JI,{Component:QI}):R(N,{children:[S(rl,{Component:QI}),S(Ys,{children:"Filters"})]})})}const nS=I.object({beginDate:I.string().nullable(),endDate:I.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Pt(e.beginDate),n=Pt(e.endDate);if(t&&n)return!St(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),rS=Gn({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),aS=Gn({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),oS=cr(null,Gn({marginTop:"22px"}));function iS({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,df({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:nS},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=Te(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return R("div",{className:rS,children:[R("div",{className:aS,children:[S(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),S(ld,{Component:AT,stylists:[oS]}),S(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&S(Vh,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const lS={width:"fit-content"};function sS({onDateRangeChange:e}){const{filters:t}=ZI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ht);if(void 0!==t){const e=t.value.date?.value;if(ft(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:lS,children:S(iS,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const cS=Gn({width:200,minWidth:200});function dS({dateFilter:e,addFilter:t}){return S(gg,{onClick:()=>t(e),children:S(vo,{children:mt[e]})})}function uS({getModel:e,addFilters:t}){const{setOpen:n}=cc(),r=r=>{const a=e(Ht);if(void 0===a)return;const o=a.createFilter({name:mt[r],value:{[a.key]:{name:mt[r],value:r}}});t([o]),n(!1)};return S(xc,{children:R(lg,{style:cS,children:[S(dS,{dateFilter:gt.ALL_TIME,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_3_MONTHS,addFilter:r}),S(dS,{dateFilter:gt.LAST_12_MONTHS,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_QUARTER,addFilter:r}),S(dS,{dateFilter:gt.LAST_QUARTER,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_YEAR,addFilter:r}),S(dS,{dateFilter:gt.LAST_YEAR,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(sS,{onDateRangeChange:n=>{const r=e(Ht);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const hS=[cr(null,$I)];function pS({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ht);let n=mt[gt.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=vt(e)?mt[e]:ft(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Pt(e.beginDate):null,n=e.endDate?Pt(e.endDate):null;return t&&!n?`After ${Bt(t)}`:!t&&n?`Before ${Bt(n)}`:t&&n?`${Nt(t)} - ${Nt(n)}`:"Custom"}(e):t.name}return n})(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:hS,popupTriggerProps:e,children:S(Ys,{children:r})})}),S(uS,{getModel:t,addFilters:n})]})}const gS=Gn({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),mS=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function vS({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=cc();return S(gg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:gS,children:[R("span",{className:mS,children:[n&&S(ud,{Component:n}),S(vo,{children:e})]}),o&&S(ud,{Component:Qi})]})})}const bS=[{label:ox[rx.EXPENSE],type:rx.EXPENSE},{label:ox[rx.REVENUE],type:rx.REVENUE},{label:ox.BANK_TRANSFER,type:"TRANSFER_IN"},{label:ox.BANK_TRANSFER,type:"TRANSFER_OUT"}],fS=cr(null,$I);function yS({manualTransactionOptions:e}){const t=bS.filter(t=>e.includes(t.type)),n=PT();return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:[fS],popupTriggerProps:e,children:n?S(JI,{Component:xs}):R(N,{children:[S(rl,{Component:xs}),S(Ys,{children:"Add Transaction"})]})})}),S(xc,{children:S(lg,{children:t.map(({label:e,type:t})=>S(vS,{closeOnClick:!0,onClick:()=>jl("BankTransactionForm",{routeProps:{initialType:t}}),children:e},t))})})]})}const xS=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.2016 7.5C13.2023 7.15497 13.1694 6.81068 13.1034 6.47202L14.4718 5.68631L12.5926 2.4125L11.2307 3.19821C10.7043 2.75208 10.1007 2.40592 9.44979 2.17679V0.625H5.70455V2.20298C5.05363 2.43211 4.45006 2.77827 3.9236 3.2244L2.56169 2.43869L0.682526 5.7125L2.05098 6.49821C1.92 7.17727 1.92 7.87511 2.05098 8.55417L0.682526 9.33988L2.56169 12.6137L3.9236 11.828C4.45006 12.2741 5.05363 12.6203 5.70455 12.8494V14.375H9.44979V12.797C10.1007 12.5679 10.7043 12.2217 11.2307 11.7756L12.5926 12.5613L14.4718 9.2875L13.1034 8.50179C13.1677 8.17171 13.2006 7.83628 13.2016 7.5Z"}),r.createElement("path",{d:"M7.57716 10.0012C8.95853 10.0012 10.0784 8.88134 10.0784 7.49997C10.0784 6.1186 8.95853 4.99878 7.57716 4.99878C6.19579 4.99878 5.07597 6.1186 5.07597 7.49997C5.07597 8.88134 6.19579 10.0012 7.57716 10.0012Z"})),"Gear"),CS=Gn.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function TS(){return S(Fs,{styles:CS,onClick:()=>jl("TransactionSettingsDrawer"),children:S(ud,{Component:xS})})}const wS=Gn.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function kS({children:e,styles:t}){return S("div",{className:Gn(wS,t),children:e})}const ES=cr(tr["dashboard-header"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),AS=cr(null,Gn({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),IS=Gn.raw({paddingLeft:"15px",paddingRight:"15px"}),SS=Gn({display:"none",xl:{display:"flex"}});function NS({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=ZI(),l=PT(),s=o(()=>nr(n)?"":n.find(e=>e.modelKey===rt)?.value.search?.value??"",[n]);return R("div",{...ES,children:[R("div",{...AS,children:[S($T,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(rt);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:lw(l)}),S(tS,{}),S(yS,{manualTransactionOptions:t}),!l&&S(pS,{filters:n,getModel:a,addFilters:i}),S(TS,{}),S("div",{className:SS,children:S(sl,{})})]}),n.length>0&&S(kS,{styles:IS,children:S(GI,{filters:n,removeFilter:r})})]})}const RS=dn.filter(e=>e!==cn.COMMENTS&&e!==cn.DIMENSION_VALUE),DS=cr(null,Gn({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function PS(){return S("div",{...DS,children:S(sl,{})})}const MS=Gn.raw({gap:"6px"});function LS({Icon:e,label:t,children:n,onClick:r}){return n?R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>R(Ic,{popupTriggerProps:n,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}),n]}):R(Ic,{onClick:r,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}const FS=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M10.6196 14.2124H4.3803C4.06894 14.2128 3.7693 14.0937 3.54327 13.8795C3.31724 13.6654 3.18207 13.3726 3.16568 13.0617L2.61591 3.22968H12.384L11.8342 13.0617C11.8179 13.3726 11.6827 13.6654 11.4567 13.8795C11.2306 14.0937 10.931 14.2128 10.6196 14.2124Z",strokeMiterlimit:10}),r.createElement("path",{d:"M1.3949 3.22968H13.605",strokeMiterlimit:10}),r.createElement("path",{d:"M6.27894 0.787598H8.72097C9.0448 0.787598 9.35537 0.91624 9.58435 1.14522C9.81334 1.37421 9.94198 1.68478 9.94198 2.00861V3.22963H5.05792V2.00861C5.05792 1.68478 5.18656 1.37421 5.41555 1.14522C5.64453 0.91624 5.9551 0.787598 6.27894 0.787598Z",strokeMiterlimit:10}),r.createElement("path",{d:"M9.09821 5.05792V12.384",strokeMiterlimit:10}),r.createElement("path",{d:"M5.90167 5.05792V12.384",strokeMiterlimit:10})),"Delete"),OS=cr(null,Gn({whiteSpace:"normal"}));function VS({transactions:e,id:t,label:n,resetSelected:r}){const{mutate:a}=VC(),o=cc();return Hi(t)?S(gg,{onClick:()=>(t=>{if(e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));a(r)}var n;o.close(),r&&r()})(t),children:S(Gg,{stylists:[OS],children:n})}):null}const BS={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},US=e=>e.map(e=>({id:e.id,status:BS.INACTIVE})),WS=ci(e=>r.createElement("svg",{stroke:"currentColor",width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.84644 15.0764C11.6751 15.0764 14.7788 11.9727 14.7788 8.14405C14.7788 4.3154 11.6751 1.21167 7.84644 1.21167C4.0178 1.21167 0.914062 4.3154 0.914062 8.14405C0.914062 11.9727 4.0178 15.0764 7.84644 15.0764Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.79217 9.6784V8.95116C7.79192 8.79114 7.82335 8.63265 7.88467 8.48484C7.94598 8.33703 8.03596 8.20282 8.14941 8.08996L8.65337 7.586C8.88132 7.35726 9.00972 7.04774 9.01061 6.7248V6.61636C9.00892 6.29431 8.8798 5.98603 8.65149 5.75891C8.42317 5.53179 8.11422 5.40429 7.79217 5.4043C7.47012 5.40429 7.16117 5.53179 6.93285 5.75891C6.70453 5.98603 6.57542 6.29431 6.57373 6.61636",strokeMiterlimit:10}),r.createElement("path",{d:"M7.18604 10.8838H8.39809",strokeMiterlimit:10})),"Uncategorized"),HS=[{id:"delete",label:"Delete",Icon:FS,component:function({transactions:e,resetSelected:t,...n}){const{mutate:r}=VC(),a=()=>{const n=US(e);r(n),t&&t()};return S(LS,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ju({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(e=>{e===Su&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:WS,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return o>0&&S(LS,{label:`${t} ${Ku("Expense","Expenses",o,!0)}`,...r,children:S(hm,{onClick:function(t){var r,o;t?.id&&(a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:WS,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return S(LS,{label:`${t} ${Ku("Revenue","Revenues",o,!0)}`,...r,children:S(yC,{onClick:function(t){var r,o;a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:sC})})}}];function zS({subActionList:e}){return S(lg,{children:e})}function qS({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const i=o(()=>e.map(e=>{const{component:n,id:r,filter:o,label:i}=e,l=t.filter(e=>!o||o(e));return l.length>0?S(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return S(LS,{label:n,Icon:r,children:S(xc,{children:i.length>0?S(zS,{subActionList:i}):S(gg,{children:S(Ys,{children:"No Actions Available for Selection"})},"no-actions")})})}const jS=cr(tr["bulk-select"],Gn({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function KS({table:e}){const t=e.getSelectedRowModel(),n=t.rows.some(e=>"EXPENSE"===e.original.type),r=t.rows.some(e=>"REVENUE"===e.original.type),a=o(()=>t.rows.map(e=>e.original),[t]),i=t.rows.length,l=(()=>{const e=Oi();return o(()=>[...HS,{id:"review",label:"Change Review Status",Icon:pi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:VS}))}],[e])})(),s=()=>e.resetRowSelection(!0);return R("div",{...jS,children:[S(IT,{table:e}),S(vo,{children:`${i} selected`}),l.map(e=>{if("recategorize-expenses"===e.id&&!n)return null;if("recategorize-revenues"===e.id&&!r)return null;const{component:t,subActions:o,id:i,filter:l,...c}=e,d=a.filter(e=>!l||l(e));return o?S(qS,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&S(t,{transactions:d,resetSelected:s,...c},i)})]})}function _S({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r}){const o=PT(),i=function({transactions:e,columns:t}){const n=PT(),r=LT({transactions:e,columns:t?[cn.SELECT,...t,cn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!nr(t.getColumn(sn.SELECT)),o=a(r?e:null);if(r){if(o.current!==e&&void 0!==o.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}o.current=e}}(e,r,!n),r}({transactions:e,columns:t}),{setFilters:l}=ZI(),s=i.getIsAllRowsSelected(),c=i.getIsSomeRowsSelected(),d=s||c;let u;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?u=S(pw,{buttonText:"Clear Filters",onButtonClick:()=>l([])}):r&&0===e?.length&&(u=S(zT,{})):u=S(WT,{});const h=d&&nr(u)&&!o;return R(Hs,{dashboard:"transactionDashboard",children:[h?S(KS,{table:i}):S(Ll,{headerGroups:i.getHeaderGroups()}),nr(u)?S(iw,{table:i}):S(od,{children:u})]})}const YS={transform(e){const{align:t,justify:n,direction:r,gap:a,...o}=e;return{display:"flex",flexDirection:r,alignItems:t,justifyContent:n,gap:a,...o}},defaultValues:{direction:"column",gap:"8px"}},ZS=(e={})=>{const t=Wn(YS,e);return YS.transform(t,Un)},GS=e=>Gn(ZS(e));GS.raw=ZS;const QS={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},XS=(e={})=>{const t=Wn(QS,e);return QS.transform(t,Un)},JS=e=>Gn(XS(e));JS.raw=XS;const $S={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},eN=(e={})=>{const t=Wn($S,e);return $S.transform(t,Un)},tN=e=>Gn(eN(e));tN.raw=eN;const nN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},rN=(e={})=>{const t=Wn(nN,e);return nN.transform(t,Un)},aN=e=>Gn(rN(e));aN.raw=rN;const oN=Gn({display:"flex",padding:"16px 12px",border:"0.75px",borderStyle:"solid",borderRadius:"lg",borderColor:["border.layout"]}),iN=cr(tr.card,oN,Gn({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function lN({children:e}){return S("div",{...iN,children:e})}const sN=cr(tr["card-header"],Gn({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function cN({children:e}){return S("div",{...sN,children:e})}const dN=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function uN({children:e}){return S("div",{className:dN,children:e})}const hN=$n({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"sm",cursor:"pointer",background:"surface.background",gap:"8px",alignSelf:"stretch",userSelect:"none"},variants:{filterStatus:{inactive:{padding:"8px"},active:{paddingTop:"8px",paddingBottom:"8px",paddingRight:"8px",paddingLeft:"4px",borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:"brand.action.strong",background:"surface.background.hover"},zeroState:{color:"typography.base.weak",cursor:"default",padding:"8px"}}},defaultVariants:{filterStatus:"inactive"}});function pN({filterApiNames:e,filterModelKey:t,extractFilterValue:n,filterStatus:r,buttonClassName:a,isZeroState:o,filterEffectiveValueExtractor:i,children:l}){const{addFilters:s,filters:c,getModel:d,removeFilter:u}=ZI();if(!d(t))return null;const h="active"===r,p=cr(tr["card-button"],hN({filterStatus:r}),a);return S("div",o?{...p,children:l}:{...p,onClick:h?()=>{return t=u,void function(e,t,n){const r=[];return e.forEach((e,a)=>{n(e).some(e=>t.includes(e))&&r.push(a)}),r.reverse()}(c,e,i).forEach(e=>{t(e)});var t}:()=>((e,t,n,r,a)=>{const o=e(t);if(!o||!o.possibleValues)return;const i=[];o.possibleValues().values.forEach(e=>{const t=n(e.value);if(t&&t.some(e=>r.includes(e))){const t=o.createFilter(e);i.push(t)}}),a(i)})(d,t,n,e,s),children:l})}const gN=$n({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"sm",borderWidth:"1px",borderStyle:"solid"},variants:{intent:{danger:{borderColor:"border.intent.danger",background:"surface.intent.danger"},warning:{borderColor:"border.intent.warning",background:"surface.intent.warning"},success:{borderColor:"border.intent.success",background:"surface.intent.success"},neutral:{borderColor:"border.intent.secondary",background:"surface.intent.secondary"}}},defaultVariants:{intent:"neutral"}}),mN=Gn({minWidth:"200px"}),vN=Gn({marginLeft:"auto"});function bN({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=ZI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Rr({queryKey:RC({groupBy:e,filter:t}),queryFn:DC})}({groupBy:"REVIEW_STATUS",filter:e});return{data:t?.data??void 0,isFilling:n,isRehydrating:r}}(r);let o=e.value.some(e=>{return t=n,!(!(r=e)||!Hi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,cr(tr["card-button-icon-container"],gN({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Hi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(pN,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:mN,isZeroState:t,filterEffectiveValueExtractor:YA,children:[S("div",{...l,children:S(ud,{Component:e.Icon})}),!t&&i&&R(N,{children:[S(vo,{children:e.text}),S("div",{className:vN,children:S(hu,{children:s})})]}),!t&&!i&&R(N,{children:[S(Ys,{children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]})]},e.text)}function fN({isZeroState:e}){const t=function(){const e=Ui();return(e?Pi:Mi).map(t=>Vi(t,e))}();return R(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Review Status"})}),S(uN,{children:t.map(t=>S(bN,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const yN=Gn({width:"20px",height:"20px",borderRadius:"sm"});function xN({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:yN}),S("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:20})}const CN=Gn({minWidth:"269px"}),TN=Gn({marginLeft:"auto"});function wN({account:e,isZeroState:t}){const{apiFilters:n}=ZI(),r=(i=n,l=e.id,i.bankAccount?.id?.in?.includes(l)?"active":"inactive"),a="active"===r,o=e.name??"";var i,l;const s=Cr(e.mask)?void 0:Zu(e.mask),c=co(null!=(d=e.accountBalance)?_u(d):0,{dollarSign:!0});var d;return R(pN,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:CN,isZeroState:t,filterEffectiveValueExtractor:lI,children:[e.iconUrl&&S(xN,{imageUrl:e.iconUrl,Component:wm}),!t&&a&&R(N,{children:[S(vo,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),!t&&!a&&R(N,{children:[S(Ys,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:o}),s&&S(Ys,{intent:"weak",wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]})]},e.id)}const kN=[{name:"Expenses Card",mask:"0000",accountBalance:1e6},{name:"Travel Card",mask:"0001",accountBalance:5e5},{name:"Primary Checking",mask:"0002",accountBalance:15e5},{name:"Emergency Savings",mask:"0003",accountBalance:15e5}];function EN({isZeroState:e}){const{query:{data:t}}=nh({params:{filter:{apiName:{in:[...Ig]}}}}),n=(r=t?.data??[],e?kN:r.filter(e=>"ACTIVE"===e.status).sort((e,t)=>{const n=e.latestTransactionDate??"",r=t.latestTransactionDate??"";if(n!==r)return r.localeCompare(n);const a=e.accountBalance??0;return(t.accountBalance??0)-a}).slice(0,4));var r;return R(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Account Balances"})}),S(uN,{children:n.map((t,n)=>S(wN,{account:t,isZeroState:e},n))})]})}const AN=Gn({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),IN=Gn({display:{"@page/xl":"flex",base:"none"}}),SN=Gn({display:{"@page/xl":"none",base:"flex"}}),NN=Gn({maxWidth:"100%",display:{"@page/md":"grid",base:"none"},gridTemplateColumns:{"@page/xl":"1fr 2fr 4fr","@page/md":"1fr 1fr"},gridTemplateRows:{"@page/xl":"1fr"},height:"auto",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"});function RN({showZeroStates:e,Chart:t}){return R("div",{className:NN,children:[S("div",{className:IN,children:S(fN,{isZeroState:e})}),S("div",{className:IN,children:S(EN,{isZeroState:e})}),S("div",{className:AN,children:S(t,{})}),S("div",{className:SN,children:S(fN,{isZeroState:e})}),S("div",{className:SN,children:S(EN,{isZeroState:e})})]})}const DN=Gn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),PN=aN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),MN=Gn({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),LN=Gn({paddingTop:"8px"}),FN=Gn({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),ON=Gn({display:"flex",flexDirection:"column",gap:"10px"});function VN({columns:e=RS,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1}){const{filters:d}=ZI(),{hasPlaidLinkedBankAccount:u}=Ng(),h=u??!1,p=PT();if(a)return S("div",{children:`Error: ${o?.message}`});if(r)return S(gl,{});if(void 0!==t){const r=function(e,t){let n;return n=0===e?"FILTERS_NOT_APPLIED":e>0&&0===t?"FILTERS_MATCHED_NONE":"FILTERS_MATCHED_ANY",n}(1===d.length&&rr(d[0].value?.date)?0:d.length,t.length);return S("div",{className:PN,children:R("div",{className:DN,children:[p&&c&&S("div",{className:ON,children:S(Qw,{})}),S(RN,{Chart:l,showZeroStates:!i}),R("div",{className:MN,children:[S("div",{className:LN,children:S(NS,{isFetching:n,manualTransactionOptions:s})}),S("div",{className:FN,children:S(_S,{hasLinkedBankAccount:h,filterState:r,transactions:t,columns:e})})]}),S(PS,{})]})})}return"zero state"}const BN=Gn({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),UN=cr(tr.card,oN,BN);function WN({children:e}){return S("div",{...UN,children:e})}const HN=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function zN({children:e}){return S("div",{className:HN,children:e})}const qN=cr(tr["card-header"],Gn({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function jN({children:e}){return S("div",{...qN,children:e})}const KN=Gn({minWidth:"300px"});function _N({options:e,handleClick:t,selectedIndex:n}){return S("div",{className:KN,children:S(Eb,{options:e,handleClick:t,selectedIndex:n})})}function YN(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=pt(e);return{beginDate:ht(it(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:ot(it(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:st()}:"LAST_12_MONTHS"}const ZN=To.var("colors.border.layout"),GN=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),QN=To.var("colors.money.positive.weak"),XN=To.var("colors.money.positive"),JN=To.var("colors.money.negative.weak"),$N=To.var("colors.money.negative"),eR=To.var("colors.surface.intent.action"),tR=To.var("colors.surface.intent.action.active"),nR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],rR=()=>{const[e,t]=c(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Pa({accountingMethod:"CASH",filter:YN(e),grouping:e,select:t=>{if("SUCCESS"!==t.result)return[];const n=t.json?.data;if(void 0===n)return[];let r=n;return"YEARLY"===e&&(r=function(e){let t=!1;const n=[],r=e.length-1,a=e.length-2;return e.forEach((e,o)=>{((e?.income?.total??0)>0||(e?.expenses?.total??0)>0)&&(t=!0),(t||o===r||o===a)&&n.push(e)}),n}(n)),r.map(t=>{const n=t.period?.beginDate,{label:r,longLabel:a}=function(e,t){return void 0===e?{label:"",longLabel:""}:"MONTHLY"===t?function(e){const t=Pt(e??"");return{longLabel:t?Ot(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:La(e)}}(e):"QUARTERLY"===t?function(e){const t=lt(e),n=t.getMonth(),r=Math.trunc(n/3)+1,a=t.getFullYear();return{label:`Q${r} ${"'"+a%100}`,longLabel:`Quarter ${r} ${a}`}}(e):"YEARLY"===t?function(e){const t=lt(e).getFullYear();return{label:t.toString(),longLabel:t.toString()}}(e):{label:"",longLabel:""}}(n,e);return{longLabel:a,income:(t.income?.total??0)+(t.otherIncome?.total??0),expense:(t.cogs?.total??0)+(t.expenses?.total??0)+(t.otherExpenses?.total??0),label:r}})}});return t??[]}(nR[e].value)}};function aR({selectedIndex:e,onSelect:t}){return S(_N,{options:nR,handleClick:t,selectedIndex:e})}const oR={top:20,right:20,left:20,bottom:5},iR={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")};function lR({data:e,children:t,tooltip:n}){return S(W,{width:"100%",height:"100%",...GN,style:{flexGrow:1},children:R(H,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:oR,children:[S(j,{dataKey:"label",interval:0,tickLine:!1,stroke:ZN,tick:iR}),S(_,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const sR=Gn({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function cR(){return R("div",{className:sR,children:[S(Ao,{color:QN,label:"Income",diameter:10}),S(Ao,{color:JN,label:"Expense",diameter:10})]})}const dR=cr(null,Gn({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),uR=cr(null,Gn({width:"100%",height:"1px",backgroundColor:"border.layout"})),hR=cr(null,Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),pR=To.var("colors.money.positive"),gR=To.var("colors.money.negative");function mR({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t.find(e=>"income"===e.dataKey),r=t.find(e=>"expense"===e.dataKey),a=t[0]?.payload?.longLabel||"",o=n?.value??0,i=r?.value??0;return R("div",{...dR,children:[S(vo,{children:a}),S("div",{...uR}),R("div",{...hR,children:[S(Ao,{color:pR,label:"Income",diameter:12}),S(hu,{children:uo(Number(o))})]}),R("div",{...hR,children:[S(Ao,{color:gR,label:"Expense",diameter:12}),S(hu,{children:uo(Number(i))})]})]})}function vR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"All Transactions"}),S(ro,{title:uo(r),label:void 0})]}),R(jN,{children:[S(aR,{selectedIndex:e,onSelect:t}),S(cR,{})]})]}),R(lR,{data:n,tooltip:({active:e,payload:t})=>S(mR,{active:e,payload:t}),children:[S(Y,{name:"Income",dataKey:"income",minPointSize:2,fill:QN,isAnimationActive:!1,activeBar:{fill:XN}}),S(Y,{name:"Expense",dataKey:"expense",minPointSize:2,fill:JN,isAnimationActive:!1,activeBar:{fill:$N}})]})]})}function bR({columns:e,limit:t=100}){const n=KI(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return _I("transactionsDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:vR,manualTransactionOptions:[rx.EXPENSE,rx.REVENUE,"TRANSFER_IN"]})})})})}const fR=e=>S(nk,{children:S(bR,{...e})}),yR={in:["EXPENSE","TRANSFER_OUT"]},xR=[{name:"Expense",types:ax.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]}];function CR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:KA(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(xR),search:at}),[l,i,s,c,u,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>MI(e,yR),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}const TR=cr(tr.text,Gn({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function wR({children:e}){return S("div",{...TR,children:e})}const kR=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function ER({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t[0]?.payload?.longLabel||"",r=Number(t[0]?.value??0);return R("div",{className:kR,children:[S(ay,{children:n}),S(wR,{children:po(r)})]})}const AR=Gn({width:"160px",height:"32px"}),IR=Gn({width:"54px",height:"32px"}),SR=({y:e,payload:t})=>S("foreignObject",{x:0,y:e-10,className:AR,children:S(Ys,{children:String(t.value)})}),NR=({x:e,y:t,payload:n})=>{return S("foreignObject",{x:e,y:t-10,className:IR,children:S(Ys,{alignment:"right",children:(r=n.value,co(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},RR=({active:e,payload:t})=>S(ER,{active:e,payload:t});function DR({data:e}){return S(W,{width:"100%",height:44*(e?.length??0)+12,...GN,children:R(H,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[S(j,{type:"number",hide:!0,domain:[0,"dataMax"]}),S(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:SR,width:172}),S(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:NR,width:66}),S(_,{content:RR,isAnimationActive:!1,cursor:{fill:"transparent"}}),S(Y,{dataKey:"total",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR},barSize:32})]})})}const PR=e=>{if("SUCCESS"!==e.result)return[];const t=e.json?.data?.[0];return void 0!==t&&void 0!==t.expenses&&t.expenses.children?t.expenses.children.map(e=>{const t=e.name??"Uncategorized";return{name:t,longLabel:t,total:e.total??0}}).filter(e=>0!==e.total).sort((e,t)=>t.total-e.total).slice(0,5):[]},MR=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function LR(){const[e,t]=c(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Mt(n),endDate:Mt(t)}})(MR[e].value),{query:{data:r}}=Pa({filter:n,select:PR}),a=n?`${Nt(Pt(n.beginDate))} - ${Nt(Pt(n.endDate))}`:"";return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&S(Ys,{intent:"weak",wrap:"ellipsis",children:a})]}),S(_N,{options:MR,handleClick:e=>t(e),selectedIndex:e})]}),S(DR,{data:r})]})}function FR({columns:e,limit:t=100}){const n=CR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return _I("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:LR,manualTransactionOptions:[rx.EXPENSE,"TRANSFER_OUT"],showTasks:!0})})})})}const OR=e=>S(nk,{children:S(FR,{...e})}),VR={in:["REVENUE","TRANSFER_IN"]},BR=[{name:nx,types:ax.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:rx.TRANSFER_IN}]}];function UR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:u}=FI(),h=o(()=>({reviewStatus:KA(u),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(s),date:qt,description:HI(),glAccount:DI(c),notes:qI(),status:TI(),type:hI(BR),search:at}),[l,i,s,c,u]),p=o(()=>[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type],[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type]),g=/* @__PURE__ */(new Date).getDate(),m=o(()=>MI(e,VR),[e,g]),v=d(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:m,getModel:v,hasUserConfiguredFilters:a}}function WR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"Total Income"}),S(ro,{title:uo(r),label:void 0})]}),S(jN,{children:S(aR,{selectedIndex:e,onSelect:t})})]}),S(lR,{data:n,tooltip:({active:e,payload:t})=>S(ER,{active:e,payload:t}),children:S(Y,{name:"Revenue",dataKey:"income",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR}})})]})}function HR({columns:e,limit:t=100}){const n=UR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return _I("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:WR,manualTransactionOptions:[rx.REVENUE,"TRANSFER_IN"],showTasks:!0})})})})}const zR=e=>S(nk,{children:S(HR,{...e})});function qR(){return S(Mh,{color:"weak",alignment:"horizontal"})}const jR=$n({base:{display:"flex",padding:"12px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...$i,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),KR=$n({base:{...Ga},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}}),_R=$n({base:{textWrap:"wrap",...Xa},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function YR({description:e,name:t,disabled:n,onClick:r}){const a=n?void 0:r,o=n?void 0:(i=r,e=>{"Enter"!==e.key&&"Space"!==e.code||(e.preventDefault(),i?.(e))});var i;return R("div",{className:jR({disabled:n}),role:"button",tabIndex:n?-1:0,onKeyDown:o,onClick:a,children:[R("div",{className:JS({alignItems:"flex-start",gap:"4px"}),children:[S("div",{className:KR({disabled:n??!1}),children:t}),S("div",{className:_R({disabled:n??!1}),children:e})]}),!n&&S(ud,{Component:Qi})]})}const ZR=Gn({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),GR=Gn({display:"flex",alignItems:"center",padding:"16px 12px",width:"100%"}),QR=Gn(Ga,{color:"typography.base.weak"});function XR({label:e,children:t}){return R("div",{className:ZR,children:[S("div",{className:GR,children:S("div",{className:QR,children:e})}),t]})}const JR={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}}};function $R(){const e=function(){const e=Re();return d(t=>{e(JR[t].route)},[e])}();return R(XR,{label:"Accounting",children:[S(qR,{}),S(YR,{name:"Profit & Loss",description:"How much money you made or lost over a period",onClick:()=>e("profit-and-loss")}),S(qR,{}),S(YR,{disabled:!0,name:"Balance Sheet",description:"What your business owns and owes at a point in time"}),S(qR,{}),S(YR,{disabled:!0,name:"Cash Flow Statement",description:"Where your cash came from and where it went"}),S(qR,{}),S(YR,{disabled:!0,name:"Trial Balance",description:"All account balances to verify your books are in order"})]})}function eD(){return R(XR,{label:"Taxes",children:[S(qR,{}),S(YR,{disabled:!0,name:"Schedule C",description:"Sole proprietor profit or loss for your U.S. tax return"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1065",description:"Income and deductions for partnership tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120-S",description:"Income and deductions for S-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120",description:"Income and deductions for C-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"T2125",description:"Business income and expenses for Canadian tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Tax Details for Filing",description:"Summary of income and deductions to share with your CPA"})]})}function tD(){return R(XR,{label:"Operations",children:[S(qR,{}),S(YR,{disabled:!0,name:"Accounts Receivable Aging",description:"Who owes you money and how long it's been outstanding"}),S(qR,{}),S(YR,{disabled:!0,name:"Accounts Payable Aging",description:"What you owe others and when payments are due"}),S(qR,{}),S(YR,{disabled:!0,name:"Expense Analysis",description:"Where you're spending money and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Income Analysis",description:"Where your revenue comes from and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Mileage Analysis",description:"Business miles driven for tax deduction tracking"}),S(qR,{}),S(YR,{disabled:!0,name:"Time & Task Analysis",description:"Hours worked and billable time by project or client"})]})}const nD=GS({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),rD=JS({gap:"16px",width:"100%"}),aD=tN({gap:"8px",alignItems:"center"}),oD=Gn(Ga,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),iD=Gn(Ga,{color:"typography.base"});function lD(){const e=De(),t=Re(),n=e.flatMap(e=>function(e){try{return IP.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:S("nav",{className:aD,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(b,{children:[r>0&&S(rl,{Component:Qi}),a?S("span",{className:iD,"aria-current":"page",children:e.label}):S("button",{type:"button",className:oD,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const sD=JS({gap:"16px",alignItems:"flex-start",width:"100%"}),cD=e=>["reports","profitAndLoss",e],dD=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result?r.data:void 0};function uD(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function hD(e){if(!nr(e))return co(_u(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function pD(e){if(!nr(e))return co(e,{cents:"always",decorator:"%",signage:"parens"})}function gD(e){const t=e?.json;if(void 0===t)return[];const n=function(e){return(t,n)=>{const r=n((l=e,l[0]?.data?.[0]??{})),a=r?.name,o=uD(e,e=>{const t=n(e)?.total;return hD(t)}),i=[...(r?.children??[]).map((r,a)=>{const o=uD(e,e=>{const t=n(e)?.children?.[a].total;return function(e){if(void 0!==e)return co(_u(e),{cents:"always",signage:"parens"})}(t)});return{key:`${t}.${a}`,label:r.name,level:1,values:o}}),{key:`${t}.total`,label:`Total ${a}`,level:0,type:"expandTotal",values:o}];var l;return{key:t,label:a,level:0,values:o,subrows:i}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,level:0,type:a,values:uD(e,r)})}(t);/* @__PURE__ */
|
|
2
|
-
return function(){const e=[];return{caboose:()=>[...e],car(t){return e.push(t),this}}}().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>hD(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>pD(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>hD(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>pD(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>hD(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}const mD=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e}),"Nothing");function vD({expanded:e,canExpand:t=!0}){return S(hc,{Component:t?e?lp:Qi:mD})}const bD=$n({base:{border:"inherit",whiteSpace:"nowrap",padding:"6px 8px",color:"typography.base"},variants:{alignment:{end:{textAlign:"end"},start:{textAlign:"start"},center:{textAlign:"center"}},weight:{inherit:{},regular:Ga,bold:Qa},clickable:{true:{cursor:"pointer"},false:{cursor:"inherit"}},border:{left:{borderLeftStyle:"solid",borderLeftWidth:"md",borderLeftColor:"border.layout"},right:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout"}},stickyLeft:{true:{position:"sticky",left:0,zIndex:1,backgroundColor:"inherit",_scrolledX:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout",filter:"drop-shadow(4px 2px 4px rgba(0, 0, 0, 0.05))"}}}},defaultVariants:{alignment:"end",clickable:!1,weight:"inherit",stickyLeft:!1}});function fD({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return S("td",{rowSpan:e,onClick:n,className:bD({clickable:r??void 0!==n,...a}),children:t})}function yD({children:e,colspan:t,...n}){return S("th",{colSpan:t,className:bD({...n}),children:e})}const xD=X();function CD(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const TD=Gn({alignItems:"center",display:"flex",gap:8}),wD=xD.accessor("label",{id:"label",header:e=>{const t=e.table.getIsAllRowsExpanded();return S(fD,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R("div",{className:TD,children:[S(vD,{expanded:t}),t?"Collapse All":"Expand All"]})})},cell:e=>S(fD,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:R("div",{className:TD,children:[S(vD,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})});const kD={[gt.LAST_6_MONTHS]:"Last 6 Months",[gt.LAST_12_MONTHS]:"Last 12 Months (TTM)",[gt.LAST_QUARTER]:"Last Quarter",[gt.LAST_YEAR]:"Last Year",[gt.THIS_QUARTER]:"This Quarter",[gt.THIS_YEAR]:"This Year"},ED=[gt.LAST_6_MONTHS,gt.LAST_12_MONTHS,gt.LAST_QUARTER,gt.LAST_YEAR,gt.THIS_QUARTER,gt.THIS_YEAR];const AD=Gn({width:"200px",minWidth:"200px"}),ID={width:"fit-content"};function SD({onPresetSelect:e,onCustomSelect:t}){const{close:n}=cc();return S(xc,{children:R(lg,{style:AD,children:[ED.map((t,r)=>R(b,{children:[S(gg,{onClick:()=>(e(t),void n()),children:S(vo,{children:kD[t]})}),(1===r||3===r)&&S(Mh,{alignment:"horizontal"})]},t)),S(Mh,{alignment:"horizontal"}),S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:ID,children:S(iS,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function ND({value:e,onChange:t}){const n=function(e){const t=Pt(e.endDate),n=Pt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:Nt(n)} - ${null===t?e.endDate:Nt(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${Nt(n)} - ${Nt(t)}`;const r=n.getFullYear(),a=t.getFullYear(),o=n.getMonth(),i=t.getMonth();return 0===o&&11===i?r===a?`${r}`:`${r} - ${a}`:r===a&&o===i?Ot(n,{abbreviateMonth:!0}):`${Ot(n,{abbreviateMonth:!0})} - ${Ot(t,{abbreviateMonth:!0})}`}(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:gk}),S(Ys,{wrap:"nowrap",children:n})]})}),S(SD,{onPresetSelect:e=>{t(Tt(e))},onCustomSelect:e=>{t(e)}})]})}const RD={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},DD={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},PD=["NONE","MONTHLY","QUARTERLY","YEARLY"],MD=Gn({width:"200px",minWidth:"200px"});function LD({onSelect:e}){const{close:t}=cc();return S(xc,{children:S(lg,{style:MD,children:PD.map(n=>S(gg,{onClick:()=>(e(n),void t()),children:S(vo,{children:RD[n]})},n))})})}function FD({value:e,onChange:t}){const n=DD[e];return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:jd}),S(Ys,{wrap:"nowrap",children:n})]})}),S(LD,{onSelect:t})]})}const OD=[{label:"Accrual",value:"ACCRUAL"},{label:"Cash",value:"CASH"}],VD=Object.fromEntries(OD.map((e,t)=>[e.value,t])),BD=Gn({width:"200px"});function UD({accountingMethod:e,onChange:t}){const n=VD[e],r=d(e=>{t(OD[e].value)},[t]);return S("div",{className:BD,children:S(Eb,{options:OD,selectedIndex:n,handleClick:r})})}const WD=ci(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_43563_992)"},r.createElement("path",{d:"M5.99982 3.61C6.78959 3.61 7.42982 2.96977 7.42982 2.18C7.42982 1.39023 6.78959 0.75 5.99982 0.75C5.21006 0.75 4.56982 1.39023 4.56982 2.18C4.56982 2.96977 5.21006 3.61 5.99982 3.61Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.705 11.25C2.23243 11.25 2.66 10.8224 2.66 10.295C2.66 9.76756 2.23243 9.34 1.705 9.34C1.17757 9.34 0.75 9.76756 0.75 10.295C0.75 10.8224 1.17757 11.25 1.705 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M5.99992 11.25C6.52735 11.25 6.95492 10.8224 6.95492 10.295C6.95492 9.76756 6.52735 9.34 5.99992 9.34C5.47249 9.34 5.04492 9.76756 5.04492 10.295C5.04492 10.8224 5.47249 11.25 5.99992 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.2948 11.25C10.8223 11.25 11.2498 10.8224 11.2498 10.295C11.2498 9.76756 10.8223 9.34 10.2948 9.34C9.76741 9.34 9.33984 9.76756 9.33984 10.295C9.33984 10.8224 9.76741 11.25 10.2948 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.70508 9.33998V6.47998H10.2951V9.33998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6 9.33999V3.61499",strokeMiterlimit:10,strokeLinecap:"square"})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_43563_992"},r.createElement("rect",{width:12,height:12,fill:"white"})))),"DimensionValue"),HD=Gn({width:"200px",minWidth:"200px"});function zD({labels:e,onSelect:t}){const{close:n}=cc(),r=e=>{t(e),n()};return S(xc,{children:R(lg,{style:HD,children:[S(gg,{onClick:()=>r(void 0),children:S(vo,{children:"None"})}),e.map(e=>S(gg,{onClick:()=>r(e.id),children:S(vo,{children:e.name})},e.id))]})})}function qD(e){return function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.dimension;if(nr(e)||n.has(e))continue;const i=r.children.find(e=>!nr(e.dimension.id)),l=i?.dimension,s=l?.id,c=s?{id:s,name:l?.name??"",status:"ACTIVE",requiredness:l?.requiredness??"NOT_REQUIRED",child:null}:null;n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:c})}return t}(e?.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}function jD(){return cI({select:qD})}function KD({value:e,onChange:t}){const{query:{data:n=[]}}=jD();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:WD}),S(Ys,{wrap:"nowrap",children:a})]})}),S(zD,{labels:n,onSelect:t})]})}function _D({popupTriggerProps:e,text:t}){return R(lb,{popupTriggerChildrenProps:e,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:t})}),S(ud,{Component:Qi})]})}function YD({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=cw(n,e.key),i=hw(e.name,o,1);return R(sc,{children:[S(dc,{children:e=>S(_D,{popupTriggerProps:e,text:i})}),e.ModalComponent&&S(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>dw(n,e.key,t))},filters:a})]})}const ZD=ci(Tm,"Bank");function GD({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?S(mI,{isSelected:n}):S(ob,{selected:n,showEmptyIndicator:!0});return R(lb,{handleClick:t,selected:n,children:[R(mA,{children:[o&&S(ld,{imageUrl:e.iconUrl,Component:ZD}),S(Ys,{wrap:"wrap",children:e.name})]}),i]})}function QD({values:e,model:t,pendingFilters:n,onClick:r}){return S(nb,{title:S(fo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=cw(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return S(GD,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):S(Jv,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function XD({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ee(e,Cg),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return S(QD,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function JD({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return S(Zv,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:XD,DefaultList:QD,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function $D({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=cc();return S(Hv,{title:"Back",Footer:S(FA,{onClearAll:()=>{a(e=>dw(e,t.key,[]))},onApply:()=>{const e=cw(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?S(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):S(JD,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function eP({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=cc();return S(FA,{onApply:()=>{n(uw(e)),a()},onClearAll:()=>{t(e=>dw(e,r,[]))}})}function tP({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=cw(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>C(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>C(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,t,e.createFilter);var o,i,l;return dw(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=S(Hv,{title:"Back",Footer:S(eP,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:S(e.SimpleListComponent,{filters:t,pendingFilters:n,onToggle:o,model:e,setPendingFilters:r,setFilters:a})});else if(void 0!==e.possibleValues){const{values:l,isFilling:s}=e.possibleValues();if(nr(l)||!tt(l))return null;if(s)return S(db,{});i=S($D,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=cw(n,e.key),s=hw(e.name,l);return R(sc,{children:[S(dc,{children:e=>S(_D,{popupTriggerProps:e,text:s})}),i]})}const nP=Gn({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function rP({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=PT();return S("div",{className:nP,children:S(nb,{title:S(fo,{children:"Filter by"}),children:t.filter(e=>{return n=o,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const o=t.possibleValues?t.possibleValues():null;return nr(o)&&void 0===t.SimpleListComponent?S(YD,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):S(tP,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function aP(e){return!nr(e)&&e.startsWith("dimension_")}const oP=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function iP(){return Rr({queryKey:["dimensions"],queryFn:oP})}function lP({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=iP(),{query:{data:i}}=cI(),l=aP(t?.key)?t.key:"dimension_NO_MODEL_YOU_MESSED_UP",s=o(()=>a?.data??[],[a]),c=o(()=>(i?.data??[]).filter(t=>t.dimension.id===e.id).filter(e=>{if(e.children.length>0)return!0;const t=s.find(t=>t.id===e.dimension?.id);return!t||!Bb(t)}).map(e=>[e,...e.children]),[i,s,e.id]),d=o(()=>c.flat(),[c]),u=o(()=>{const e=n.get(l),t={};return e?.forEach(e=>{const n=e.value[l];void 0!==n&&(t[n.value.dimensionValueId]=!0)}),t},[n,l]);return S(Yb,{fieldDimension:e.name,dimensionValueOptions:c,dimensions:s,flatDimensionValues:d,selectedRow:u,setSelectedRow:e=>{if(void 0===r)return;const n=Object.entries(e).filter(([,e])=>e).flatMap(([e])=>{if(void 0===t)return[];const n=d.find(t=>t.id===e);if(void 0===n)return[];const r=n.name??"",a=n.dimension.id??"";return[t.createFilter({name:r,value:{[l]:{name:r,value:{dimensionId:a,dimensionValueId:e}}}})]});r(e=>dw(e,l,n))},allowMultiselect:!0})}function sP(e,t){return nt({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>S(lP,{...e,dimension:t})})}function cP({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=dI(),t=function(){const{query:{data:e}}=jD();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,sP(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:hA(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=cc(),[a,i]=c(()=>sw(e,n));return S(Wv,{title:"Filter By",padChildren:!1,Footer:S(FA,{onApply:()=>{t(uw(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:S(rP,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function dP({filters:e,setFilters:t}){const{open:n}=cc();return S(Dv,{overlay:!0,children:n&&S(cP,{filters:e,setFilters:t})})}function uP({filters:e,setFilters:t}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:QI}),S(Ys,{wrap:"nowrap",children:"Filters"})]})}),S(dP,{filters:e,setFilters:t})]})}function hP({filters:e,setFilters:t}){return e.map((n,r)=>S(of,{text:n.name,onClickRemove:()=>t(et(e,r)),additionalValidClassName:tr["filter-pill"]},n.id))}const pP=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),r.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),r.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download");function gP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:pP}),S(Ys,{children:"Export Report"})]})}function mP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:gd}),S(Ys,{children:"Send Report"})]})}const vP=[],bP=$n({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:Ga,bold:Qa},expandable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"auto"}},rowType:{normal:{},expandTotal:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout"},reportTotal:{borderTopWidth:"4px",borderTopStyle:"double",borderTopColor:"border.layout.strong",borderBottomWidth:"4px",borderBottomStyle:"double",borderBottomColor:"border.layout.strong"},sectionStart:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout.strong"},sectionEnd:{borderBottomWidth:"md",borderBottomStyle:"solid",borderBottomColor:"border.layout.strong"}}},defaultVariants:{weight:"regular",expandable:!1,rowType:"normal"}}),fP=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),yP=tN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),xP=tN({gap:"8px",flexWrap:"wrap"}),CP=aN({name:"report-table-container",containerType:"scroll-state",overflowX:"auto",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout",width:"fit-content",maxWidth:"100%",paddingBottom:"16px",maxHeight:"80dvh",isolation:"isolate",boxSizing:"border-box"}),TP=Gn({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),wP=Gn({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),kP=Gn({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function EP(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function AP(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!aP(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}const IP=I.object({label:I.string()}),SP=Me([{path:JR["/"].path,errorElement:S(N,{}),element:S(Pe,{}),handle:JR["/"].handle,children:[{index:!0,Component:function(){return R("div",{className:nD,children:[R("div",{className:rD,children:[S($R,{}),S(eD,{})]}),S("div",{className:rD,children:S(tD,{})})]})}},{Component:function(){return R("div",{className:sD,children:[S(lD,{}),S(Pe,{})]})},children:[{path:JR["profit-and-loss"].path,Component:function(){const[e,t]=c(()=>Tt(gt.LAST_6_MONTHS)),[n,r]=c("MONTHLY"),[i,l]=c("ACCRUAL"),[s,u]=c(void 0),h=a(null),[p,g]=c([]),m=ln(e=>e.FEATUREFLAG_REPORT_FILTERS),v=d(()=>{const e=f.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[f=h]);var f;const{query:{data:y},isFilling:x}=(C={filters:{...e,dimensionValues:AP(p),customerIds:EP(p)},grouping:{period:n,dimensionId:s},accountingMethod:i},T={placeholderData:L},Rr({queryKey:cD(C??{}),queryFn:dD,...T}));var C,T;const w=o(()=>gD(y),[y]),k=o(()=>function(e){const t=e?.json??[],n=t[0],r=n?.data,a=t.map((e,a)=>{const o=e.data?.length??0,i=a!==t.length-1&&(o>1||r?.[0]?.name!==n?.name),l=(c=a,d=i,void 0===(s=e).data?[]:s.data.map((e,t)=>xD.accessor(`values.${c}[${t}]`,{header:t=>S(yD,{border:CD(t.column)?"left":void 0,weight:d?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return S(fD,{border:CD(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?xD.group({id:`valueRecord.${a}`,header:t=>S(yD,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[wD,...a]}(y),[y]),E=J({data:w??vP,columns:k,getCoreRowModel:$(),getExpandedRowModel:ee(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:!0,columnPinning:{left:["label"]}}}),A=E.getExpandedRowModel().rows;return R("div",{className:fP,children:[R("div",{className:yP,children:[R("div",{className:xP,children:[S(ND,{value:e,onChange:t}),S(FD,{value:n,onChange:r}),m&&S(uP,{filters:p,setFilters:g}),S(KD,{value:s,onChange:u})]}),R("div",{className:xP,children:[S(UD,{accountingMethod:i,onChange:l}),S(gP,{}),S(mP,{})]})]}),S(kS,{children:S(hP,{filters:p,setFilters:g})}),!x&&S("div",{className:CP,ref:h,onScroll:v,children:R("table",{className:TP,children:[S("thead",{className:wP,children:E.getHeaderGroups().map(e=>S("tr",{className:kP,children:e.headers.map((e,t)=>e.isPlaceholder?S(yD,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):Q(e.column.columnDef.header,e.getContext()))},e.id))}),S("tbody",{children:A.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,o=n||"expandTotal"===a?"bold":"regular",i=t<A.length-1;let l=e.original.type;if(i){const e=A[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return S("tr",{className:bP({rowType:l,expandable:n,weight:o}),onClick:r,children:e.getVisibleCells().map(e=>S(b,{children:Q(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})]})},handle:JR["profit-and-loss"].handle}]}]}]);function NP(){return u(()=>()=>{SP.navigate(JR["/"].route)},[]),S(Le,{router:SP})}function RP(){return S(nk,{children:S(NP,{})})}const DP=Ue("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),PP={queryClient:Ir,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await DP).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await DP).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await DP).delete("queryClient",e)}(e)}}}(),maxAge:Ar,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function MP({children:e}){return S(We,{client:Ir,persistOptions:PP,children:e})}const LP=Gn({position:"absolute",top:0,left:{base:0,sm:"auto"},right:0,bottom:{base:0,sm:"auto"},width:"100%",height:"100%",minWidth:"100%",minHeight:"100%",maxHeight:"100%",maxWidth:"100%",overflow:"hidden",overscrollBehavior:{base:"contain",xl:"none"}}),FP=Gn({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:{base:"transparent",xl:"overlay"},overscrollBehavior:{base:"contain",xl:"none"}}),OP=cr(null,tr.component,LP);function VP({children:e}){const t=a(null),n=a(null),r=PT();return g(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),S(ve,{children:S(be,{lockScroll:!0,className:FP,children:S("div",{onMouseDown:e=>{n.current=e.target},onClick:e=>{const r=n.current===t.current,a=e.target===t.current;r&&a&&(n.current=null,ln.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...OP,children:e})})})}const BP=i({closingQueue:[],drawerHistory:[]});function UP({children:e}){const t=ln(e=>e.drawerHistory),n=ln(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return S(BP.Provider,{value:r,children:a&&S(VP,{children:e})})}const WP=i({isActive:!0,isClosing:!1});function HP({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=l(BP),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),i=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==i,d=(o&&o[t])??(i&&i[t]);return S(WP.Provider,{value:{isActive:s,isClosing:c},children:d&&S(e,{...d.routeProps})})}const zP=cr(tr.drawer,Gn({position:"absolute",display:"flex",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",backgroundColor:"surface.background",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},overscrollBehavior:{base:"contain",xl:"none"},_focus:{outline:"none"}})),qP=Gn({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function jP({children:e}){const t=a(null),{isActive:n,isClosing:r}=l(WP),{onExitAnimationEnd:o,onInitialAnimationComplete:i}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=c(!0),o=d(()=>{ln.getState().confirmCloseDrawer()},[]),i=d(()=>{a(!1)},[a]);return u(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:n,isClosing:r,focusRef:t}),{context:s,refs:h}=ne({open:n&&!r}),p=me([t,h.setFloating]);return S(Ie,{onExitComplete:o,children:!r&&S(fe,{context:s,modal:!0,initialFocus:-1,children:R(Se.div,{tabIndex:-1,ref:p,onAnimationComplete:()=>i(),transition:Tv,initial:wv,animate:kv,exit:Ev,...zP,children:[e,!n&&S("div",{className:qP})]})})})}const KP=$n({base:{display:"flex",height:"100%",maxHeight:"100%",minHeight:0,flexDirection:"column",minWidth:{base:"128px",sm:"512px"},maxWidth:{base:"100%",sm:"512px"},flexGrow:1,overflow:"hidden"},variants:{background:{foreground:{backgroundColor:"surface.foreground"}}}});function _P({background:e,children:t}){return S("div",{className:KP({background:e}),children:t})}const YP=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function ZP(e){return void 0!==YP[e]}function GP(e){return YP[e]}const QP=ci(e=>r.createElement("svg",{id:"Layer_1","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,width:24,height:24,...e},r.createElement("defs",null,r.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),r.createElement("path",{className:"cls-63ce7444ea57ea6c838005ed-1",d:"M6.27,21.55H8.5l2.33.95h7.92a2.86,2.86,0,0,0,2.85-2.59l.88-9.13c0-.14,0-.28,0-.42h0a2.18,2.18,0,0,0-2.18-2.18H15.63l.52-1.09a6.27,6.27,0,0,0,.62-2.73h0A2.86,2.86,0,0,0,13.91,1.5h0A1.9,1.9,0,0,0,12,3.41h0a6,6,0,0,1-1.25,3.66l-2.33,3H6.27"}),r.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),XP=Gn({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function JP({cldrShortName:e}){return S("div",{className:XP,children:GP(e)})}const $P=$n({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),eM=Gn({display:"flex",gap:"4px",backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",padding:"4px 8px",alignItems:"center",justifyContent:"center",scrollbar:"hidden",overflow:"hidden"});function tM({reactions:e,type:t,handleClick:n}){return S("div",{className:eM,children:e.map((e,r)=>S("button",{className:$P({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:S(JP,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const nM=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:mi(n)};return await wa(o)},rM=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:mi(n)};return await Xm(o)};function aM(e,t,n){return fr(ds({id:e}),t,n)}async function oM(e){const t=ds({id:e});return ha("mutation successful, invalidating messages queries"),Ir.invalidateQueries({queryKey:t}).catch(e=>pa({error:e,severity:"error"}))}function iM(e,t,n){const r=[...e];return r[n]=t,r}const lM=Gn({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),sM=Object.keys(YP).filter(ZP).map(e=>({emojiCode:e,authorInfo:[]}));function cM({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:i}=l(Lc),{mutate:s}=function(e){const{userId:t,userEmail:n}=l(Lc);return ch({mutationFn:nM,onMutateFn:({data:r,accessToken:a,environment:o})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a,userEmail:o}){const i=aM(n,t,r);await Ir.cancelQueries({queryKey:i});const l=Ir.getQueryData(i);return Ir.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:iM(t,(r=t[n],i=e,l=a,s=o,{...r,reactions:[...r.reactions,{emojiCode:i.emojiCode,authorInfo:[{userId:l,email:s}]}]}),n);var r,i,l,s}),{oldMessages:l}}({data:r,accessToken:a,conversationId:e,environment:o,userId:t,userEmail:n})},onSettled:()=>oM(e)})}(e);return R(sc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[S(dc,{children:e=>S("button",{className:lM,...e,children:S(ud,{Component:QP})})}),S(xc,{type:"reaction",children:S(tM,{reactions:sM,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===i);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const dM=$n({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function uM({reactions:e,type:t,handleClick:n}){const r=dM({type:t});return S("div",{className:r,children:S(tM,{reactions:e,handleClick:n,type:t})})}const hM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),pM=$n({base:{position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"column",alignItems:"flex-start",borderRadius:"md",borderWidth:1,borderStyle:"solid",flexShrink:1,overflow:"wrap",wordBreak:"break-word",whiteSpace:"pre-wrap"},variants:{type:{sent:{color:"typography.intent.primary",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary"},received:{color:"typography.base",borderColor:"border.layout",backgroundColor:"surface.foreground"}}}}),gM=Gn({position:"relative",display:"flex",flexDirection:"column"});function mM({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const i=a(null),{isHover:s,setIsHover:d,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=c(!1),[r,a]=c(!1);return u(()=>{if(null===o.current||!i||s)return;const e=o.current,t=t=>{t.target===e||e.contains(t.target)||l(!1)};return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}},[i=t,o=e,s=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,s}(i),{mutate:g}=function(e){const{userId:t}=l(Lc);return ch({mutationFn:rM,onMutateFn:({data:n,accessToken:r,environment:a})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a}){const o=aM(n,t,r);await Ir.cancelQueries({queryKey:o});const i=Ir.getQueryData(o);return Ir.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return nr(r)||0===r.reactions.length?t:iM(t,function(e,t,n){const r=e.reactions.filter(e=>e.emojiCode!==t||!e.authorInfo.some(e=>e.userId===n));return{...e,reactions:r}}(r,e.emojiCode,a),n)}),{oldMessages:i}}({data:n,accessToken:r,conversationId:e,environment:a,userId:t})},onSettled:()=>oM(e)})}(e),m=n?"sent":"received",v=o.filter(e=>ZP(e.emojiCode)),b=v.length>0,f="sent"===m?tr["message-sent"]:tr["message-received"],y=cr(tr[f],pM({type:m}));return R("div",{className:hM({type:m,hasReactionsOnMessage:b}),ref:i,onMouseEnter:()=>"received"===m&&d(!0),children:[R("div",{className:gM,children:[S("div",{...y,children:r}),b&&S(uM,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),s&&S(cM,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const vM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),bM=Gn({position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"12px",borderRadius:"md",borderWidth:1,borderStyle:"solid",borderColor:"border.layout",backgroundColor:"surface.foreground",flexShrink:1}),fM=Gn({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),yM=Gn({textDecoration:"none",color:"inherit",cursor:"pointer"});function xM({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=PT();return S("div",{className:vM({type:e?"sent":"received"}),children:S("div",{onClick:async()=>{if(o)window.open(a,"_self","noopener,noreferrer");else try{if(a){const e=await fetch(a),t=await e.blob(),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n??"attachment",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}}catch(e){await pa({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:yM,children:R("div",{className:bM,children:[R("div",{className:fM,children:[S(Ys,{children:n}),S(fo,{children:`${r}`})]}),S(ud,{Component:pP})]})})})}const CM=cr(null,Gn({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function TM({children:e}){return S("div",{...CM,children:e})}const wM=cr(null,Gn({display:"flex",flexDirection:"column-reverse",alignItems:"flex-start",gap:"26px",flex:"1 1 0%",alignSelf:"stretch",overflowY:"auto",overflowX:"hidden",flexFlow:"column",padding:15,scrollbarWidth:"thin",maxHeight:"calc(100% + 15px)",marginBottom:"-15px"})),kM=Gn({minHeight:1,width:"100%"}),EM=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=d(()=>{t&&rr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){u(()=>{const r=e.current;if(null!==r){let e=r.scrollTop,a=Date.now();const o=()=>{if(t){const{scrollVelocity:t,currentScrollTop:o,currentTime:i}=function(e,t,n){const r=e.scrollTop,a=Date.now(),o=Math.abs(r-t),i=a-n;return{scrollVelocity:i>0?o/i:0,currentScrollTop:r,currentTime:a}}(r,e,a);t>5&&n(),e=o,a=i}};return r.addEventListener("scroll",o),()=>{r.removeEventListener("scroll",o)}}},[t,n,e])}(i,t,l),R("div",{tabIndex:-1,...wM,ref:i,children:[S("div",{className:kM,ref:o}),e]})}),AM=Object.freeze({message:{text:"",attachments:[]}}),IM=Gn({width:"24px",height:"24px",objectFit:"contain"});function SM({iconUrl:e,fileName:t}){return S("img",{src:e,alt:`${t} icon`,className:IM})}const NM=Gn({display:"flex",flex:"1 1 0",flexDirection:"row",justifyContent:"space-between",backgroundColor:"surface.foreground",borderWidth:"1px",borderStyle:"solid",borderColor:"border.layout",padding:"8px 16px",marginBottom:"8px"}),RM=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),DM=Gn({display:"grid",flexDirection:"column",minWidth:0}),PM="LOADING",MM="LOADED",LM="ERROR";function FM({attachment:e,onRemove:t}){const n=e.hasError?LM:e.isPending?PM:MM;return R("div",{className:NM,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:RM,children:[e.iconUrl&&S(SM,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:DM,children:[S(Ys,{children:e.displayFileName}),n===PM&&e.displayText&&S(fo,{accent:"strongest",children:e.displayText}),n===MM&&e.fileSize&&S(fo,{children:e.fileSize}),n===LM&&S(fo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&S(Ic,{onClick:async n=>{n.stopPropagation(),await ju({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]})===Su&&t(e)},children:S(rl,{Component:uc})})]})}const OM=Gn({width:"100%"});function VM({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:o,setActiveKeyboard:i,inputRef:l,defaultValues:s}){const{form:c}=function({onSubmit:e,defaultValues:t}){return{form:df({defaultValues:t??AM,onSubmit:t=>{zp.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),u=a(null),h=d(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=d(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:g}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["conversations"]})}}),m=d(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&g({id:e.id})},[c,g]);return S("form",{className:OM,ref:u,onKeyDown:e=>function(e,t,n,r){if(!r&&!e.shiftKey&&"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),null!==t&&!n)){const e=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});t.dispatchEvent(e)}}(e,u.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:S(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>S(FM,{attachment:e,onRemove:m},e.localId)),S(c.AppField,{name:"message",children:t=>S(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function BM(e,t){return{id:`placeholder_${e.conversationId}_${Date.now()}`,conversationId:e.conversationId,author:{userId:t??"placeholderUserId",email:"placeholderEmail"},status:"ACTIVE",createdDateTime:"",lastUpdatedDateTime:"",text:e.text??"",reactions:[],attachments:[]}}async function UM(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ha("mutation successful, invalidating messages queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t}),Ir.invalidateQueries({queryKey:n})]).catch(e=>pa({error:e,severity:"error"}))}const WM=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Nl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),HM=async({data:e,accessToken:t,environment:n})=>Nl({data:{data:[e]},accessToken:t,environment:n}),zM=Gn({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),qM=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),jM=Gn({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),KM="Marked As Resolved";function _M({resolver:e}){const t=e?`${e} ${KM}`:KM;return R("div",{className:qM,children:[S("div",{className:zM}),S("div",{className:jM,children:t}),S("div",{className:zM})]})}const YM=$n({variants:{width:{xs:{width:"30px"},sm:{width:"60px"},md:{width:"120px"},lg:{width:"240px"},xl:{width:"420px"}},height:{xs:{height:"5px"},sm:{height:"10px"},md:{height:"20px"},lg:{height:"40px"},xl:{height:"80px"}}}});function ZM({width:e="md",height:t="md"}){return S(jo,{styles:YM({width:e,height:t})})}const GM=Gn({display:"flex",flexDirection:"row-reverse"});function QM(){return R(N,{children:[S(ZM,{width:"lg",height:"lg"}),S("div",{className:GM,children:S(ZM,{width:"md",height:"lg"})}),S("div",{className:GM,children:S(ZM,{width:"lg",height:"xl"})}),S(ZM,{width:"md",height:"lg"})]})}const XM=Gn({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function JM({isConversationLoading:e,isFilling:t,message:n}){return e?n?S(TM,{children:S(mM,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?S(TM,{children:S(QM,{})}):R("div",{className:XM,children:[S(vo,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),S(Ys,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const $M=cr(null,Gn({display:"flex",alignItems:"center",justifyContent:"center",maxWidth:"100%",minHeight:0,height:"auto",flexDirection:"column",position:"relative",backgroundColor:"surface.background",borderTop:"{borderWidths.lg} solid",borderTopColor:"border.layout",padding:"12px 15px"}));function eL({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:i,defaultValues:s,defaultSubject:d}){const{userId:h}=l(Lc),{mutate:p}=function(){const{userId:e}=l(Lc);return ch({mutationFn:ps,onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=fr(ds({id:e.conversationId}),t,n);await Ir.cancelQueries({queryKey:a});const o=Ir.getQueryData(a);return Ir.setQueryData(a,t=>[BM(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:UM})}(),{query:{data:g},isFilling:m}=function(e){const t=rr(e);return Rr({queryKey:ds({id:e??""}),queryFn:hs,select:us,enabled:t})}(e),{mutate:v,isPending:b,variables:f}=(k=t,E=i,ch({mutationFn:HM,onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(nr(e)||nr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(rr(E)){const e={id:E};ls(E,is.BANK_TRANSACTION)?o=async()=>{const t=$l(e);return await Ir.invalidateQueries({queryKey:t})}:ls(E,is.FINANCIAL_SUMMARY)&&(i=async()=>await Ir.invalidateQueries({queryKey:a}))}return ha("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Ir.invalidateQueries({queryKey:n}),Ir.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>pa({error:e,severity:"error"}))}})),{mutate:y}=ch({mutationFn:WM,onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ha("mutation successful, invalidating conversations queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t})]).catch(e=>pa({error:e,severity:"error"}))}}),[x,C]=c(!1),T=a(null),w=a(null);var k,E;u(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),u(()=>{Ep(w)},[g,w]);const A=nr(e)||nr(g)||m;return R(N,{children:[A?S(EM,{ref:w,inputRef:T,activeKeyboard:x,setActiveKeyboard:C,children:S(JM,{isConversationLoading:b,isFilling:m,message:f?.message?.text})}):R(EM,{ref:w,activeKeyboard:x,setActiveKeyboard:C,inputRef:T,children:[n&&S(_M,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return S(TM,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!nr(e)).map(e=>S(xM,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&S(mM,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),S("div",{...$M,children:S(VM,{scrollRef:w,inputRef:T,conversationId:e,blockSubmit:b,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),l=o.map(e=>`att_${e.id}`),s=a.length>0,c=l.length>0;if(s||c)if(nr(e)){const e=function(e,t,n){let r="";return rr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(d,a,o[0]?.displayFileName),t=(u=a,h=l,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...rr(g=i)&&{attachedEntityId:g},message:{text:u,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:l}});var u,h,g},setActiveKeyboard:C,defaultValues:s})})]})}function tL({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=c(e),{query:{data:o}}=Sl(r),i="CLOSED"===o?.resolutionStatus;return R(_P,{children:[S(Fv,{}),S(eL,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const nL=cr(tr["form-body"],Gn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"},width:"100%"}));function rL({children:e}){return S("div",{...nL,children:e})}const aL=cr(null,Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),oL=cr(null,Gn({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),iL=Gn({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),lL=e=>{Qh(e),Xh(e)},sL=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:a,conversationId:o,transactionId:i,transaction:l})=>S(jP,{children:R("div",{...aL,children:[S(_P,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:lL,...oL,children:[n,S(rL,{children:e}),r]})}),null!==a&&S("div",{className:iL}),"conversation"===a&&i&&S(tL,{conversationId:o,attachedEntityId:i,defaultSubject:l?.description})]})}),cL=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],dL=["FEDERAL","STATE","SALES"],uL=["Q1","Q2","Q3","Q4"],hL=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function pL(e){if(!nr(e))return hL.find(t=>t.value===e)?.name}const gL=I.object({id:I.string(),type:I.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:I.enum(Object.values(Ei)),amount:I.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:I.string("Required").refine(e=>(function(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||At(new Date(e),/* @__PURE__ */new Date))&&St(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),frequency:I.union([I.object({name:I.string(),value:I.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),I.undefined()]),category:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),dimensionValues:I.array(I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).optional()),bankAccount:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:I.string().nullable(),itemizedByOptions:I.object({category:I.boolean(),customer:I.boolean()}).optional(),attachments:I.array(Hp)}),mL=I.object({id:I.string(),name:I.string().optional(),requiredness:I.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),vL=I.object({id:I.string(),name:I.string().optional(),dimension:mL.optional()}),bL=vL.extend({child:vL.optional()}),fL=I.object({id:I.string().optional(),lineItemType:I.literal("itemized"),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).optional(),dimensionValues:I.array(bL),customer:I.object({id:I.string(),name:I.string().optional()}).nullable(),amount:I.number()}),yL=I.object({lineItemType:I.literal("invoice"),amount:I.number().nullable(),invoice:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),xL=I.object({lineItemType:I.literal("bill"),amount:I.number().nullable(),bill:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),CL=I.object({lineItemType:I.literal("fee"),amount:I.number()}),TL=I.object({lineItemType:I.literal("payment"),amount:I.number(),payment:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string(),bankAccount:I.object({id:I.string(),displayName:I.string()})})}),wL=I.discriminatedUnion("lineItemType",[fL,yL,CL,xL,TL]),kL=gL.extend({children:I.array(wL),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).nullable()});kL.extend({tax:I.object({paymentInfo:I.object({region:I.enum(dL).optional(),year:I.number().optional(),quarter:I.enum(uL).optional()}).nullable().optional()}).optional()});const EL=gL.extend({id:I.string(),type:I.literal(Object.values(rx)),description:I.string(),displayName:I.string(),iconUrl:I.string(),status:I.literal(Object.values(BS)),reviewStatus:I.literal(Object.values(Ei)),apiName:I.literal(Object.values({PLAID:"PLAID",UNIT:"UNIT",STRIPE:"STRIPE",SHOPIFY:"SHOPIFY",SQUARE:"SQUARE",RUTTER:"RUTTER",UBER:"UBER",MOOV:"MOOV",QUALPAY:"QUALPAY",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",QBO:"QBO",XERO:"XERO",BENCH:"BENCH",WAVE:"WAVE"})),apiSourceId:I.string().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()},{message:"Required"}),customer:I.object({id:I.string(),name:I.string().optional(),email:I.string().optional()}).nullable(),vendor:I.object({id:I.string(),name:I.string().optional()}).nullable(),invoice:I.object({id:I.string(),name:I.string(),date:I.string(),lineItems:I.array(I.object({id:I.string(),amount:I.number()}))}).nullable(),bill:I.object({id:I.string(),name:I.string().optional()}).nullable(),payroll:I.object({id:I.string(),date:I.string().optional(),checkDate:I.string().optional(),description:I.string().optional()}).nullable(),apiItemId:I.string().nullable()}),AL=I.looseObject({amount:I.number().nullable(),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),IL=I.object({children:I.array(AL),itemizeByOptions:I.record(I.string(),I.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.category?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"category"]})})}),SL=kL.extend({type:I.literal("EXPENSE"),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable()}).check(e=>{const t=e.value.children;(function(e,t){if(0===e.length)return!0;if(!e.some(e=>"itemized"===e.lineItemType))return!0;const n=e?.reduce((e,t)=>"itemized"!==t.lineItemType?e:e+(t.amount??0),0);return n===t})(t,e.value.amount)||e.issues.push({code:"custom",message:"Sum of children amounts must equal total amount",input:e.value,path:["children"]}),function(e,t=null){return 0===e.length&&Cr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),NL=kL.extend({type:I.literal("BANK_TRANSFER"),reconciliationMatch:I.object({id:I.string(),description:I.string().optional(),amount:I.number().optional(),date:I.string().optional(),apiInstitutionId:I.string().nullable().optional(),apiName:I.enum({BOX:"BOX",CLOVER:"CLOVER",STRIPE:"STRIPE",PLAID:"PLAID",KNOX:"KNOX",UBER:"UBER",FRESHBOOKS:"FRESHBOOKS",HARVEST:"HARVEST",KW:"KW",FRESHBOOKS2:"FRESHBOOKS2",CAPITAL_ONE:"CAPITAL_ONE",SQUARE:"SQUARE",DOTLOOP:"DOTLOOP",REALOGY:"REALOGY",UPWORK:"UPWORK",SHOPIFY:"SHOPIFY",DEDUCTR:"DEDUCTR",ENTERPRISE:"ENTERPRISE",MOXIWORKS:"MOXIWORKS",APPDIRECT:"APPDIRECT",LONEWOLF:"LONEWOLF",LONEWOLF_TRANSACTIONDESK:"LONEWOLF_TRANSACTIONDESK",SAMPLE_BANK:"SAMPLE_BANK",TAXBOT:"TAXBOT",GUSTO:"GUSTO",XERO:"XERO",UNIT:"UNIT",MOOV:"MOOV",QBO:"QBO",QUALPAY:"QUALPAY",BENCH:"BENCH",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",CHECK:"CHECK",RUTTER:"RUTTER",WAVE:"WAVE",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",ADYEN:"ADYEN",PAYABLI:"PAYABLI"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!nr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>NL.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),RL=EL.extend({}),DL=I.looseObject({amount:I.number().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),PL=I.object({children:I.array(DL),itemizeByOptions:I.record(I.string(),I.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.glAccount?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"glAccount"]})})}),ML=kL.extend({type:I.literal("REVENUE"),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()},{message:"Required"}).nullable()}).check(e=>{e.value.children&&e.value.children.length>0||e.value.glAccount&&""!==e.value.glAccount.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["glAccount"]})});function LL(e){return e.reduce((e,t)=>new U(e).plus(t??0).toNumber(),0)}function FL(e,t){const n=new U(e).times(100).round(0),r=new U(t).times(100).round(0);return!n.eq(r)}function OL(e,t){const{dimensionsToIndex:n,childToRootId:r,dimensionFieldCount:a}=t,o=new Array(a).fill(void 0);if(e)for(const i of e){const e=i.dimension?.id;if(Cr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function VL(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function BL(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function UL(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function WL(e){return"EXPENSE"!==e.type||nr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function HL(e,t,n){if(e(t))return n}const zL={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function qL(e){return Cr(e)?void 0:e}function jL(e,t,n){const r=(e,t)=>HL(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:qL((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:qL(e.id),amount:e.amount?Yu(e.amount):0,categoryId:e.category?.id,glAccountId:e.glAccount?.id,dimensionValueIds:e.dimensionValues?.map(e=>e.id),customerId:e.customer?.id}}(e);case"fee":return function(e){return{id:qL(e.id),amount:Yu(e.amount)}}(e);case"bill":return function(e){return{id:qL(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:qL(e.payment.id)}}(e)}var t}(e))),o="TAX_PAYMENT"===e.type,i=/* @__PURE__ */new Set;for(const l of e.children)if("itemized"===l.lineItemType)for(const e of l.dimensionValues??[])e.dimension?.id&&i.add(e.dimension.id);return{...{amount:r("amount",e.amount?Yu(e.amount):0),date:r("date",e.date),bankAccountId:r("bankAccount",e.bankAccount.id),frequency:r("frequency",e.frequency?.value),notes:r("notes",e.notes),dimensionValueIds:r("dimensionValues",e.dimensionValues?.filter(e=>!nr(e?.dimension?.id)&&!i.has(e.dimension.id)).map(e=>e?.id)),children:a,vendorId:r("vendor",e.vendor?.id||void 0),customerId:r("customer",e.customer?.id||void 0),categoryId:r("category",e.category?.id||void 0),glAccountId:r("glAccount",e.glAccount?.id||void 0),matchingBankTransactionId:r("reconciliationMatch",e.reconciliationMatch?.id||void 0),reviewStatus:r("reviewStatus",e.reviewStatus),tax:r("tax",o?e.tax:void 0),attachmentIds:r("attachments",e.attachments.filter(e=>null!==e.id&&!e.isPending&&!e.hasError).map(e=>`att_${e.id}`))},..."EXPENSE"===e.type&&(n("category")||n("children"))?function(e,t,n){const r=n.find(t=>t.id===e)?.accountId,a=t?.map(e=>{const t=n.find(t=>t.id===e.categoryId)?.accountId;return nr(t)?e:{...e,glAccountId:ss({id:t,prefix:"GL_ACCOUNT"})}});return nr(r)?nr(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:ss({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function KL(e=null){const{mutate:t}=BC(),{mutate:n}=UC({mutationFn:PC}),{query:{data:r}}=Vg();return(a,o,i)=>{const l=r?.data??[];var s;e?(t(function(e,t,n,r){return{...jL(t,n,e=>{return r[e]?.isDirty??(t=e,Object.entries(r).some(([e,n])=>n?.isDirty&&(e.startsWith(`${t}.`)||e.startsWith(`${t}[`))));var t}),id:e}}(e.id,a,l,o)),i()):(n({...jL(s=a,l,()=>!0),amount:s.amount?Yu(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||zL[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}),Kl())}}const _L=kL.extend({type:I.literal("TAX_PAYMENT"),tax:I.object({paymentInfo:I.object({region:I.enum(dL,{message:`Tax region must be one of: ${dL.join(", ")}`}),quarter:I.enum(uL,{message:"Required"}),year:I.number({message:"Tax year is required"})}).nullable()})}).superRefine((e,t)=>{e.tax?.paymentInfo||(t.addIssue({path:["tax","paymentInfo","region"],code:"custom",message:`Tax region must be one of: ${dL.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))}),YL={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Mt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:Gl[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function ZL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.bill)||!nr(n.paymentId))continue;const e=t.get(n.bill.id);e?t.set(n.bill.id,{...e,amount:e.amount+n.amount}):t.set(n.bill.id,n)}return[...t.values()]}function GL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.invoice)||!nr(n.paymentId))continue;const e=t.get(n.invoice.id);e?t.set(n.invoice.id,{...e,amount:e.amount+n.amount}):t.set(n.invoice.id,n)}return[...t.values()]}function QL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.paymentId))continue;const e=t.get(n.paymentId);e?t.set(n.paymentId,{...e,amount:e.amount+n.amount}):t.set(n.paymentId,n)}return[...t.values()]}function XL(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function JL(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(nr(e.paymentId)&&nr(e.bill)&&nr(e.invoice)||XL(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...ZL(r),...GL(r),...QL(r),...a]}(e.children,t),r=(o=n,void 0===(i=t)||0===i.size?[]:o.filter(e=>{const t=e.glAccount?.id?i.get(e.glAccount.id):void 0;return void 0===t||"DEFERRED_REVENUE"!==t.liabilityType&&"Prepaid Expenses"!==t.name})),a=r.some(e=>!(nr(e.invoice)&&nr(e.payroll)&&nr(e.bill)&&nr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return nr(e.paymentId)||XL(e,n)?t&&XL(e,n)?(r=e,{...r,lineItemType:"fee",amount:_u(r.amount)}):nr(e.invoice)?nr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:_u(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return nr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:_u(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:_u(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:_u(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:_u(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=_u(e.amount);return{lineItemType:"payment",amount:n,payment:{id:t,amount:n,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName??e.bankAccount.name??""}}}}(e,e.paymentId);var r}(e,a,t))}function $L({value:e}){return{fields:eF(function(e){switch(e){case"EXPENSE":return SL;case"TAX_PAYMENT":return _L;case"BANK_TRANSFER":return NL;case"REVENUE":return ML}}(e.type).safeParse(e))}}function eF(e){const t={};if(!e.success)for(const n of e.error.issues){const e=n.path.reduce((e,t,n)=>"number"==typeof t?`${e}[${t}]`:0===n?String(t):`${e}.${String(t)}`,"");t[e]||(t[e]={message:n.message})}return t}function tF(e,t,n){const r=KL(e),{query:{data:a}}=Xx({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=e?(l=t,s=a,{id:(i=e).id,type:WL(i),reviewStatus:i.reviewStatus,amount:_u(i.amount),category:i.category,date:i.date,vendor:i.vendor,customer:i.customer,frequency:i.frequency,bankAccount:i.bankAccount,glAccount:i.glAccount,notes:i.notes,dimensionValues:OL(i.dimensionValues,l),children:JL(i,s),reconciliationMatch:i.reconciliationMatch?{...i.reconciliationMatch,amount:_u(i.reconciliationMatch.amount??0)}:void 0,tax:i.tax,attachments:i.attachments?i.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:cs(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...YL,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var i,l,s;return df({defaultValues:o,canSubmitWhenInvalid:!0,validators:{onBlur:$L,onSubmit:$L},onSubmit:e=>r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),onSubmitInvalid:()=>{}})}function nF({transaction:e}){const{mutate:t}=VC(),n=()=>t(US([e]));return S(vS,{onClick:()=>{return e=n,void ju({title:"Delete transaction",body:"Are you sure you want to delete this transaction?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(t=>{t===Su&&e()});var e},Icon:FS,children:"Delete"})}function rF({transaction:e}){const{mutate:t}=VC();return S(vS,{onClick:()=>{t([e].map(e=>({id:e.id,status:BS.ACTIVE})))},children:"Restore"})}const aF=e=>r.createElement("svg",{stroke:"currentColor",width:16,height:15,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.36217 8.45534H7.95444C8.20781 8.45534 8.45081 8.35469 8.62998 8.17552C8.80914 7.99636 8.9098 7.75336 8.9098 7.49998C8.9098 7.24661 8.80914 7.00361 8.62998 6.82444C8.45081 6.64528 8.20781 6.54463 7.95444 6.54463H7.31753C7.06416 6.54463 6.82116 6.44397 6.64199 6.26481C6.46283 6.08564 6.36217 5.84265 6.36217 5.58927C6.36217 5.33589 6.46283 5.09289 6.64199 4.91373C6.82116 4.73456 7.06416 4.63391 7.31753 4.63391H8.9098",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 3.36011V4.63392",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 8.45532V9.72913",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.54074 14.1875L4.23491 12.9137L5.93545 14.1875L7.62962 12.9137L9.33015 14.1875L11.0307 12.9137L12.7312 14.1875L13.3681 13.5506V0.8125H1.90384V13.5506L2.54074 14.1875Z",strokeMiterlimit:10,strokeLinecap:"square"})),oF=ci(aF,"Bill");function iF({onClick:e,error:t,validate:n}){return S(Uh,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const lF=Gn({display:"flex",flexDirection:"column",width:"100%"}),sF=cr(tr["value-comparison-summary"],Gn({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),cF=Gn({display:"flex",flexDirection:"column",gap:"8px"});function dF({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return S("div",{className:lF,children:R("div",{...sF,children:[R("div",{className:cF,children:[S(Ys,{intent:"weak",children:"Selected Total"}),S(vo,{children:go(_u(e),r)})]}),R("div",{className:cF,children:[S(Ys,{intent:"weak",children:`${n} Total`}),S(vo,{children:po(t)})]})]})})}const uF=Gn.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),hF=cr(null,Gn({color:"icon.base"}));function pF({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return S("div",{className:qv,children:R("div",{...jv,children:[l?S(KT,{}):S(ud,{stylists:[hF],Component:zv}),S("input",{className:Kv,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh}),Tr(e)&&S(Fs,{styles:uF,onClick:()=>o(""),children:S(ud,{Component:uc})})]})})}const gF=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function mF({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:gF,children:[S(Ys,{intent:"weak",children:"Search"}),S(pF,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function vF(e,t,n){return`${e} | ${Nt(Pt(t))} | ${po(_u(n))}`}const bF=cr(tr["linked-entity-row"],Gn({display:"flex",alignItems:"center",padding:"16px",gap:"9px",backgroundColor:"surface.foreground",border:"0.75px solid {colors.border.layout}",width:"100%",cursor:"pointer",outline:"none",_supportHover:{backgroundColor:"surface.background"}})),fF=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),yF=cr(null,Gn({color:"icon.base"}));function xF({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...bF,onClick:o,children:[R("div",{className:fF,children:[S(ud,{stylists:[yF],Component:r}),S(Ys,{wrap:"wrap",children:vF(t,n,e)})]}),S(ob,{selected:a,showEmptyIndicator:!0})]})}const CF={root:null,threshold:1};function TF({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=d(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return u(()=>{const e=new IntersectionObserver(o,CF);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return S("div",{ref:n})}function wF({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return S(N,{children:t.groups.map(t=>R(CA,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>S(xF,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),S(TF,{onIntersect:a,enable:!r&&o})]},t.key))})}function kF(e){return co(e,{cents:"always",dollarSign:!0})}function EF(e){return kF(Math.abs(e))}function AF({title:e,body:t}){return ju({title:e,body:t,cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"FEE":"NO_FEE")}function IF(e,t,n){const r=EF(e);return`The selected bills total of ${EF(t)} is less than the expense total of ${r}. Was there a fee of ${EF(n)}?`}const SF=Gn(Mv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function NF({children:e}){return S("div",{className:SF,children:e})}function RF({transactionTotal:e,bills:t,onSubmit:n,fetchNextPage:r,hasNextPage:a,isFetching:o,isFetchingNextPage:i,searchTerm:l,onSearchChange:s}){const[d,u]=c({}),h=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:u,hasMultiSelect:!0,state:{selected:d}}),p=t.filter(e=>d[e.id]).reduce((e,t)=>e+t.amount,0),g=o&&!i;return S(Wv,{title:"Link Bill",Footer:S(iF,{onClick:()=>{const r=new U(p).div(100).times(-1).toNumber(),a=new U(e).sub(r).toNumber(),o=t.filter(e=>d[e.id]);r>e&&o.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Bill Payment",body:IF(n,e,t)})}({selectedTotal:r,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=a),n(o,t)}).catch(()=>{}):n(o,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:p,transactionTotal:e,transactionTypeLabel:"Expense"}),S(mF,{searchTerm:l,onChange:s,isFetching:g,searchPlaceholder:"Search bills..."}),S(wF,{listLabel:"Bills",glSourceList:h,icon:oF,fetchNextPage:r,hasNextPage:a,isFetching:o,pluralNoun:"bills",singularNoun:"bill"})]})})}const DF=e=>["bills/bills","infinite",e??{}],PF=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/bills/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:mi(n)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},MF=[];function LF(e){const t=e.lineItems?.reduce((e,t)=>e+t.amount,0)??0;return{id:e.id,name:e.name??"",date:e.date??"",amount:t}}function FF(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return nr(e)||(t.search=e),t}function OF(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(d=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:d}),limit:10,filter:FF(t)},qm({queryFn:PF,queryKey:DF(s)}));var s,d;const u=(r?.pages??MF).flatMap(e=>(e.data??[]).map(LF));return S(RF,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function VF(e){const t=cc();return S(Dv,{children:t.open&&S(OF,{...e})})}function BF(e){return{lineItemType:"fee",amount:e}}function UF(e){return{lineItemType:"bill",amount:_u(-e.amount),bill:{id:e.id,amount:_u(e.amount),date:e.date,name:e.name}}}function WF(e){return e.map(UF)}function HF(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function zF(e){return`Remove ${e}?`}function qF(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function jF({action:e,titleName:t,entityName:n}){return ju({title:zF(t),body:qF(e,n),cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"YES":"NO").catch(()=>"NO")}const KF={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},_F={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function YF(e,t){const n=_F[t];return jF({titleName:n,entityName:n.toLowerCase(),action:KF[e]})}const ZF="bill",GF=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(ZF,e.state.values.children);ZF!==t?"YES"===await YF(ZF,t)&&n(!0):n(!0)},Icon:oF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),S(VF,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=WF(t);0!==r&&a.push(BF(r)),e.setFieldValue("children",a),n(!1)}})]})}}),QF=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M5.71252 10.4813H7.80002C8.03706 10.4813 8.26439 10.3871 8.432 10.2195C8.59961 10.0519 8.69377 9.82454 8.69377 9.5875C8.69377 9.35046 8.59961 9.12313 8.432 8.95552C8.26439 8.78791 8.03706 8.69375 7.80002 8.69375H7.17502C6.93799 8.69375 6.71066 8.59959 6.54305 8.43198C6.37544 8.26437 6.28127 8.03704 6.28127 7.8C6.28127 7.56296 6.37544 7.33563 6.54305 7.16802C6.71066 7.00041 6.93799 6.90625 7.17502 6.90625H9.26252",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 5.11249V6.90624",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 10.4813V12.275",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V14.0625H2.13123V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V4.51875H9.28748V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10})),"Payroll");function XF(e,t,n){const r=EF(e);return`The selected invoice total of ${EF(t)} is greater than the transaction total of ${r}. Was there a fee of ${EF(n)}?`}const JF=e=>["payments/payments","infinite",e??{}],$F=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/payments/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:mi(n)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},eO=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),tO=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),nO=Gn({marginLeft:"auto"});function rO({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:eO,children:[R("div",{className:tO,children:[S(Ys,{children:e}),t&&S(Ys,{wrap:"nowrap",children:ho(t)})]}),R("div",{className:tO,children:[n&&S(fo,{children:n}),S("span",{className:nO,children:r&&S(fo,{wrap:"nowrap",children:Nt(Pt(r))})})]})]})}function aO({payment:e,selected:t,onClick:n}){return S(sb,{handleClick:n,selected:t,isMultiSelect:!0,children:S(rO,{description:e.description,amount:_u(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}const oO=[];function iO(e){return e}function lO(e){return e.pages.flatMap(e=>(e.data??[]).map(iO))}function sO(e){return Object.values(e).some(e=>e)}function cO(e,t){return e===Yu(t)}function dO(e,t){return(t??[]).filter(t=>e[t.id]).reduce((e,t)=>e+t.amount,0)}function uO(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:xr(t)?void 0:t}}function hO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const[r,a]=c(""),{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:u}}=(h={filter:uO(n,r)},p={select:lO},qm({queryFn:$F,queryKey:JF(h),...p}));var h,p;const[g,m]=c({}),v=dO(g,o),[b,f]=c(void 0),y=d(e=>{const n=dO(e,o),r=sO(e);void 0===b||!cO(n,t)&&r||f(void 0),m(e)},[o,t,b]),x=Gv({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:g},onSelectedChange:y}),C=l&&!u;return S(Wv,{title:"Link Transactions",Footer:S(iF,{validate:()=>{const e=cO(v,t),n=sO(g),r=e||!n;return r||f("The selected total must equal the income amount."),r},error:b,onClick:()=>{e(o?.filter(e=>g[e.id])??oO)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:v,transactionTotal:t,transactionTypeLabel:nx,selectedAmountSignage:"default"}),S(mF,{searchTerm:r,onChange:a,isFetching:C,searchPlaceholder:"Search transactions..."}),x.groups.map(e=>{const t=e.getRows();return S(CA,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return S(aO,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),S(TF,{onIntersect:i,enable:!l&&s})]})})}function pO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const r=cc();return S(Dv,{children:r.open&&S(hO,{transactionTotalDollars:t,parentBankAccountId:n,onSubmit:e})})}function gO({transactionTotal:e,invoices:t,onInvoiceSubmit:n,onPaymentSubmit:r,hasExistingInvoices:a,parentBankAccountId:o,fetchNextPage:i,hasNextPage:l,isFetching:s,isFetchingNextPage:d,searchTerm:u,onSearchChange:h}){const[p,g]=c({}),[m,v]=c(!1),b=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:g,hasMultiSelect:!0,state:{selected:p}}),f=t.filter(e=>p[e.id]).reduce((e,t)=>e+t.amount,0),y=s&&!d;return S(Wv,{title:"Link Invoice",HeaderRightAction:S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(lg,{forceNewCascade:!0,children:R(sc,{open:m,onOpenChange:v,children:[S(vS,{onClick:async()=>{const e=t.some(e=>p[e.id]);if(a){if("YES"!==await YF("payment","invoice"))return}else if(e&&"YES"!==await async function(){return jF({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;v(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),S(pO,{transactionTotalDollars:e,parentBankAccountId:o,onSubmit:r})]})})}),Footer:S(iF,{onClick:async()=>{const r=_u(f),a=t.filter(e=>p[e.id]);if(r>e&&a.length>0){const t=new U(r).sub(e),o=t.toNumber(),i=t.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Invoice Payment",body:XF(n,e,t)})})({selectedTotal:r,transactionTotal:e,suggestedFee:o}).then(e=>{let t=0;"FEE"===e&&(t=i),n(a,t)}).catch(()=>{})}else n(a,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:f,transactionTotal:e,transactionTypeLabel:nx}),S(mF,{searchTerm:u,onChange:h,isFetching:y,searchPlaceholder:"Search invoices..."}),S(wF,{listLabel:"Invoices",glSourceList:b,icon:QF,fetchNextPage:i,hasNextPage:l,isFetching:s,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const mO=e=>["invoicing/invoices","infinite",e??{}],vO=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return(async({params:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/invoicing/invoices/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}})({params:n,cursor:e.pageParam,accessToken:r,environment:a})},bO=[];function fO(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return xr(e)||(t.search=e),t}function yO(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return qm({queryFn:vO,queryKey:mO(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:fO(t)}});var s;const d=(r?.pages??bO).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return S(gO,{...e,invoices:d,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function xO(e){const t=cc();return S(Dv,{children:t.open&&S(yO,{...e})})}function CO(e){const t=_u(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const TO=(e,t)=>{const n=e.map(CO);return 0!==t&&n.push(BF(t)),n};function wO(e){const t=_u(e.amount);return{lineItemType:"payment",amount:t,payment:{id:e.id,amount:t,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName}}}}function kO(e){return e.map(wO)}const EO="invoice",AO=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(EO,e.state.values.children);EO!==t?"YES"===await YF(EO,t)&&n(!0):n(!0)},Icon:QF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=TO(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)},hasExistingInvoices:r,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),IO=Gl.filter(e=>"ONE_TIME"!=e.value);function SO({onClick:e}){const t=cc();return S(im,{triggerChildren:S(cm,{displayLabel:"Make recurring"}),popupChildren:S(xb,{frequencies:IO,onClick:n=>{e(n),t.close()}})})}function NO({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return S(Ic,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:S(ld,{Component:t})})}function RO({activeTab:e,onClick:t,popupTriggerProps:n}){return S(NO,{active:"conversation"===e,onClick:()=>t("conversation"),icon:cd,ariaLabel:"conversation-tab",popupTriggerProps:n})}const DO=Gn({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function PO({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=cc(),[a,o]=c(e),{query:{data:i}}=Sl(a),l="CLOSED"===i?.resolutionStatus;return S(Av,{children:R("div",{className:DO,children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>r.setOpen(!1)}),S(vo,{children:"Back"})]})}),S(eL,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const MO={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:nx},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},LO=Object.values(MO);function FO({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=Ke();return a?S(pb,{}):S(nb,{title:R(N,{children:[s&&t&&S(vo,{children:"Suggested"}),S(vo,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?S(vA,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:S(BO,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:R(mA,{children:[t.iconUrl&&S(ud,{Component:tm(t.iconUrl,t.name??"")}),S(Ys,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const OO="Search expense categories...",VO=[];function BO({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=Hg(),s=r??i?.data??VO,c=cc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return S(Zv,{placeholder:OO,onClick:d,SearchList:EA,DefaultList:FO,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function UO({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=Ke();return a?S(pb,{}):R(N,{children:[c&&t&&S(nb,{title:S(vo,{children:"Suggested"})}),S(nb,{title:S(vo,{children:r}),children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?S(vA,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:S(zO,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:S(mA,{children:S(Ys,{wrap:"wrap",children:t.name})})},t.id)})})]})}const WO="Search income categories...",HO=[];function zO({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,nestedGlAccounts:r,parentAccount:a,glAccount:o,parentOnClick:i}){const{query:{data:l,isFetched:s},isFilling:c}=iC(),d=r??l??HO,u=cC([...d],sC),h=cc(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return S(Zv,{placeholder:WO,onClick:g,SearchList:IA,DefaultList:UO,listLength:d.length,extraProps:{glAccounts:u,listLabel:e,isFetched:s,isFilling:c,showSuggestedCategories:n,parentAccount:a,glAccount:o,handleConversion:t,parentOnClick:g,selectedIds:p},forceSearchVisible:!0})}function qO({list:e,onClick:t,NestedChildList:n}){return S(eb,{children:e.groups.map(e=>S(CA,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return S(vA,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:S(n,{row:e})},e.key);const r=e.getIsSelected();return S(sb,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(mA,{children:[e.value.iconUrl&&S(ud,{Component:tm(e.value.iconUrl,e.value.name)}),S(Ys,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const jO="All Tax Categories";function KO({handleConversion:e,region:t}){const n=cc(),r=Gv({data:[hL],groups:[{label:jO,key:jO}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return S(qO,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function _O({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=Ke(),d=!l&&i&&0===r.length;return l?S(pb,{}):R(eb,{children:[a&&S("div",{children:S(lb,{handleClick:t,children:S(Ys,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&S(vo,{children:"Suggested"}),!d&&R(N,{children:[S(vo,{children:o}),S("div",{children:r?.map(t=>{const n=s?.id===t.id;return S(sb,{handleClick:()=>e(t),selected:n,children:S(rO,{description:t.description,amount:_u(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const YO={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function ZO({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ee(n??[],YO),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?S(pb,{}):0===l.length?S(Jv,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):S(eb,{children:S("div",{children:l.map(e=>{const n=a?.id===e.id;return S(sb,{handleClick:()=>t(e),selected:n,children:S(rO,{description:e.description,amount:_u(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const GO=[];function QO({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Pt(o),s=(c=r,{filter:{status:{in:["ACTIVE"]},type:{in:[(d=a)>0?"EXPENSE":"REVENUE",d>0?"TRANSFER_OUT":"TRANSFER_IN"]},amount:{equal:-d},date:{greaterThanEqual:Mt(Ut(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Mt(Ut(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=ts(s,{enabled:null!==l}),m=h?.data??GO,{query:{data:v}}=Xx({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),b=cc();return S(Zv,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),b.close()},SearchList:ZO,DefaultList:_O,listLength:m.length??0,extraProps:{listLabel:e,bankTransfers:m,isFetched:p,isFilling:g,holdingAccount:v,showSuggestedCategories:n,transactionDate:o,onNeedsMatchClick:()=>{v&&t({type:"BANK_TRANSFER",value:{glAccount:v}}),b.close()},reconciliationMatch:i}})}function XO({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=c(function(e){switch(e){case"EXPENSE":return LO.indexOf(MO.EXPENSE);case"REVENUE":return LO.indexOf(MO.REVENUE);case"TAX_PAYMENT":return LO.indexOf(MO.TAX_EXPENSE);default:return LO.indexOf(MO.TRANSFER)}}(e)),{category:d,glAccount:u,tax:h,date:p,bankAccount:g,reconciliationMatch:m,amount:v}=o,b=h?.paymentInfo?.region,f=g?.id;return R(Hv,{title:t,children:[!i&&S(Eb,{options:LO,handleClick:e=>s(e),selectedIndex:l}),S(()=>{switch(LO[l].value){case"EXPENSE":return S(BO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:d});case"REVENUE":return S(zO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return S(KO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:b});case"BANK_TRANSFER":return S(QO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:f,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}const JO=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function $O({children:e}){const{startPrefetch:t,cancelPrefetch:n}=Kg();return S("button",{className:JO,type:"button",onMouseEnter:t,onMouseLeave:n,children:e})}const eV=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function tV({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:eV,children:[l&&S(ud,{Component:l}),S(Ys,{wrap:"wrap",children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function nV(){const{query:{data:e}}=cI(),{query:{data:t=[]}}=jD(),n=o(()=>e?.data??[],[e]),r=o(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.set(e.id,r),e.child?.id&&(t.set(e.child.id,r),n.set(e.child.id,e.id))}),{dimensionsToIndex:t,childToRootId:n,dimensionFieldCount:e.length}}(t),[t]);return{nestedDimensionValues:n,nestedDimensions:t,dimensionLookup:r}}const rV=Gn({display:"flex",gap:"8px",alignItems:"center"});function aV({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:rV,children:[l&&S(ud,{Component:l}),S(Ys,{children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function oV(e){return{id:e.id??"",type:e.type??"EXPENSE",date:e.date??"",amount:e.amount??0,displayName:e.displayName??"",description:e.description??"",notes:e.notes??null,reviewStatus:e.reviewStatus??"USER_REVIEW_REQUIRED",apiName:e.apiName??"MANUAL_ENTRY",iconUrl:e.iconUrl??"",apiSourceId:e.apiSourceId??null,bankAccount:e.bankAccount??{id:""},glAccount:e.glAccount??{id:""},dimensionValues:e.dimensionValues??[],customer:e.customer??null,vendor:e.vendor??null,category:e.category??null,invoice:e.invoice??null,bill:e.bill??null,payroll:e.payroll??null,paymentId:e.paymentId??null,...void 0!==e.apiItemId?{apiItemId:e.apiItemId}:{}}}const iV=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.dimensionValues)e.dimension?.id&&t.push(e.dimension.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!nr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},lV={id:"customer",name:"Customer"};function sV(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function cV(e){return oV({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function dV(e,t,n,r,a){if(1===e.length){const o=e[0];"EXPENSE"===t?n(o.category??null):r(o.glAccount??null),a([])}else a(e)}const uV=cr(tr["line-item-card"],Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),hV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),pV=Gn({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),gV=uf({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedDimensionValues:a,nestedDimensions:o,dimensionLookup:i}=nV(),l=n=>{switch(n.type){case"EXPENSE":return void e.setFieldValue(`children[${t}].category`,n.value);case"REVENUE":return void e.setFieldValue(`children[${t}].glAccount`,n.value)}};return R("div",{...uV,children:[R("div",{className:hV,children:[S(Ys,{children:`Line Item #${t+1}`}),R(Ic,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[S(Ys,{children:"Remove"}),S(ud,{Component:FS})]})]}),R("div",{className:pV,children:[S(e.AppField,{name:`children[${t}].amount`,children:e=>S(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&S(tV,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&S(aV,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),S(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childDimensionValues:e.values.children[t].dimensionValues}),children:({itemizeByOptions:n,childDimensionValues:r})=>function(e,t,n,r,a,o){const{childToRootId:i}=o;return Object.entries(e).filter(([e,t])=>e!==a&&t).map(([e])=>{const a=(t??[]).findIndex(t=>!nr(t?.dimension?.id)&&(i.get(t.dimension.id)??t.dimension.id)===e);return-1===a?null:{fieldDimension:r.find(t=>t.id===e)?.name??"",dimensionValueOptions:VL(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,lV.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>S(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(BL(t))})},r[0][0].id))}),S(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&S(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),mV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function vV({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=cc();return S(xc,{children:R(lg,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return S(gg,{onClick:()=>{n(e.id,!r)},children:R("div",{className:mV,children:[S(Ys,{children:a(e)}),S(ud,{Component:r?pi:rb})]})},e.id)}),!nr(r)&&S(gg,{onClick:()=>{r?.(),o.setOpen(!1)},children:S(Ys,{children:"Confirm Selection"})})]})})}const bV=e=>Object.keys(e).filter(t=>e[t]);function fV({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(sc,{placement:"bottom-end",children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Itemize By"}),S(ud,{Component:lp})]})}),S(vV,{items:[...e,lV],selectedIds:bV(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const yV=Gn({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),xV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"}),CV=Gn.raw({color:"surface.intent.danger.active"}),TV=Gn({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function wV({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=LL(n),i=FL(t,o),l=a&&i,s=a&&r<2,c=o<t?"Your line item amounts are under-allocated":"Your line item amounts are over-allocated";return R("div",{className:yV,children:[R("div",{className:xV,children:[S(Ys,{children:`${ox[e]} amount`}),S(Ys,{children:kF(t)})]}),R("div",{className:xV,children:[S(Ys,{children:"Line items total"}),S(Ys,{children:kF(o)})]}),R("div",{className:xV,children:[S(Ys,{extraClassNames:l?[CV]:void 0,children:"Difference"}),S(Ys,{extraClassNames:l?[CV]:void 0,children:(d=t,u=o,go(new U(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:c})]}),s&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:"At least 2 line items are required"})]})]});var d,u}function kV({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return S(Uh,{onSave:e,children:S(wV,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const EV=Gn({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function AV(e){const{form:t,dimensions:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:i}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:i}){const{nestedDimensions:l,dimensionLookup:s}=nV(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new U(r).div(2).round(2,U.roundDown),n=new U(r).sub(t);return[oV({amount:t.toNumber(),...structuredClone(c)}),oV({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=cc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return IL;case"BANK_TRANSFER":return RL;case"REVENUE":return PL}}(r);return df({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=eF(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=LL(e.children.map(e=>e.amount));return FL(n,r)?{form:"amount-mismatch",fields:t}:Object.keys(t).length>0?{fields:t}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:d,itemizeByOptions:iV(d,l,s),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),u.close()}});return{form:h,dimensions:l,handleAddLineItem:()=>{const e=h.state.values.children,t=e[0];h.setFieldValue("children",[...e,oV({...t,id:"",amount:0,customer:null,...c})])},handleUnitemize:()=>{const e=h.state.values.children[0];t([e]),u.close()},handleItemizeCheckboxChange:(e,t)=>{if(h.setFieldValue("itemizeByOptions",{...h.state.values.itemizeByOptions,[e]:t}),e===lV.id)return void(t||h.setFieldValue("children",h.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=l.find(t=>t.id===e);if(nr(t))return;const n={id:"",dimension:t},r=h.state.values.children.map(e=>({...e,dimensionValues:[...e.dimensionValues??[],n]}));return void h.setFieldValue("children",r)}const n=h.state.values.children.map(t=>({...t,dimensionValues:t.dimensionValues.filter(t=>t.dimension?.id!==e)}));h.setFieldValue("children",n)}}}(e),l=S(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>S(fV,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=S(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>S(kV,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(Wv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[S(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>S(gV,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),S(t.Subscribe,{selector:e=>e.values.children,children:e=>S("div",{className:EV,children:e.length<10&&R(Ic,{onClick:r,active:!1,children:[S(Ys,{children:"Add Line Item"}),S(rl,{Component:xs})]})})})]})}function IV(e){const t=cc();return S(Dv,{children:t.open&&S(AV,{...e})})}function SV({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=cc();return R(sc,{children:[S(dc,{children:e=>S(vS,{Icon:qC,popupTriggerProps:e,children:"Itemize"})}),S(IV,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(sV)),r.close()}})]})}const NV=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(sc,{children:[S(dc,{children:e=>S(RO,{onClick:n,activeTab:t,popupTriggerProps:e})}),S(PO,{conversationId:r,attachedEntityId:a})]}):S(RO,{onClick:n,activeTab:t}),RV=uf({defaultValues:YL,props:{title:"Transaction",transaction:null,activeTab:null,tabOnClick:()=>{},conversationId:null,transactionId:void 0},render:function({form:e,title:t,transaction:n,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}){const l=je(),s=PT(),c=!nr(n)&&$p(n)&&"EXPENSE"===n.type,u=d(t=>{dV(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:t}),i&&S(NV,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[S(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>R(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&S(GF,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&S(AO,{form:e}),0===t.length&&S(SV,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:u}),UL(t)&&S(vS,{Icon:qC,onClick:()=>u([t[0]]),children:"Unitemize"})]})}),c&&S(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&S(SO,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===BS.ACTIVE&&S(nF,{transaction:n}),n?.status===BS.INACTIVE&&S(rF,{transaction:n})]})})]})})}});function DV(e){return 0===e.length||UL(e)&&e.every(e=>null===e.customer)}const PV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=je();return R(N,{children:[S(e.Subscribe,{selector:e=>{return 0===(t=e.values.children).length||t.every(e=>{switch(e.lineItemType){case"invoice":return!1;case"itemized":return!0}});var t},children:t=>t&&S(e.AppField,{name:"vendor",children:e=>S(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),S(e.Subscribe,{selector:e=>e.values.frequency,children:r=>{return a&&n&&(o=t?.type,void 0!==(i=r)&&"ONE_TIME"!==i.value&&"EXPENSE"===o)&&S(e.AppField,{name:"frequency",children:e=>S(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"category",children:t=>S(tV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),MV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"glAccount",children:t=>S(aV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}});function LV({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===zC(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:a,popupTriggerProps:e,children:R($O,{children:[r?S(rO,{description:r.description||"",amount:r.amount||0,date:r.date||Nt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):S(Ys,{intent:"weak",children:"Needs Match"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const FV=uf({defaultValues:YL,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"reconciliationMatch",children:()=>S(LV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function OV({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[S(Ys,{children:pL(r?.paymentInfo?.region)??"Select region..."}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const VV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.AppField,{name:"tax.paymentInfo.region",children:()=>S(OV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),S(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>S(e.ButtonGroupField,{label:"Quarter",options:cL})}),S(e.AppField,{name:"tax.paymentInfo.year",children:e=>S(e.GenericSelectorField,{label:"Year",options:Et({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),BV=uf({defaultValues:YL,props:{transaction:null,isManual:!1},render:function({form:e,transaction:t,isManual:n}){const r=t=>{switch(t.type){case"EXPENSE":return e.setFieldValue("category",t.value),void e.setFieldValue("type","EXPENSE");case"REVENUE":return e.setFieldValue("glAccount",t.value),void e.setFieldValue("type","REVENUE");case"TAX_PAYMENT":case"TAX_EXPENSE":return e.setFieldValue("tax.paymentInfo.region",t.value),void e.setFieldValue("type","TAX_PAYMENT");case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return rr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:_u(t.value.transfer.amount)}),rr(t.value.glAccount)&&(e.setFieldValue("glAccount",t.value.glAccount),e.setFieldValue("reviewStatus","AWAITING_MATCH"),e.setFieldValue("reconciliationMatch",void 0)),void e.setFieldValue("type","BANK_TRANSFER")}};return S(N,{children:S(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return S(PV,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return S(MV,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return S(FV,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return S(VV,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),UV=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function WV({transaction:e,bankAccount:t}){const n=e?e.description:"",r=nr(t)||nr(e)?"":((e,t)=>{const n=cx(t.type),r=zC(t.amount);return`${n?`${r} `:""}${Gu(e.name,e.mask)}`})(t,e);return R("div",{...UV,children:[S(vo,{wrap:"wrap",children:n}),t&&S(fo,{children:r})]})}const HV=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),zV=Gn({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function qV({attachments:e,onRemove:t}){return S("div",{className:HV,children:S("div",{className:zV,children:e.map(e=>S(FM,{attachment:e,onRemove:t},e.localId))})})}const jV=uf({defaultValues:YL,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["banks/transactions"]})}});return S(e.AppField,{name:"attachments",children:e=>R(N,{children:[S(e.AttachmentDropzoneField,{entityId:cs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&S(qV,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),KV=Gn({display:"flex",flexDirection:"column",gap:"8px"});function _V({children:e}){return S("div",{className:KV,children:e})}const YV=$n({base:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px 12px",backgroundColor:"surface.background",border:"1px solid",borderColor:"border.layout",borderRadius:"md",overflow:"hidden",width:"100%"},variants:{surface:{foreground:{backgroundColor:"surface.foreground"},background:{backgroundColor:"surface.background"}}}});function ZV({children:e,surface:t,style:n}){const r=Gn(YV.raw({surface:t}),n);return S("div",{className:r,children:e})}function GV(){return S(Mh,{alignment:"horizontal"})}const QV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function XV(e){return S("div",{className:QV,children:e.children})}function JV({property:e}){return"string"==typeof e?S(Ys,{children:e}):e}function $V({label:e,value:t}){return R(XV,{children:[S(JV,{property:e}),S(JV,{property:t})]})}function eB(e){return Nt(Pt(e))}function tB({amount:e,date:t,description:n}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:n}),S(GV,{}),S($V,{label:"Date",value:eB(t)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const nB=Gn.raw({padding:12});function rB({amount:e}){return S(ZV,{surface:"background",style:nB,children:S($V,{label:"Fee",value:kF(e)})})}const aB=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),oB=Gn({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function iB({label:e,warning:t}){return R("div",{className:aB,children:[S(Ys,{children:e}),t&&R("div",{className:oB,children:[S(ud,{Component:ui}),t]})]})}function lB(e){return kF(Math.abs(e))}function sB(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new U(0)),o=(i=a.toNumber(),l=r,"REVENUE"===(s=n)||"BANK_TRANSFER"===s&&l>0?i<l?"overpaid":i>l?"underpaid":"exact":"EXPENSE"===s||"BANK_TRANSFER"===s&&l<0?i>l?"overpaid":i<l?"underpaid":"exact":"exact");var i,l,s;if("exact"===o)return null;const c=a.minus(r).toNumber();return"overpaid"===o?`${lB(c)} Overpaid`:"underpaid"===o?function(e){return`${lB(e)} Underpaid`}(c):null}const cB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(_V,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?S(tB,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Invoices"}),S(rl,{Component:Qi})]})}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=TO(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:t=>{const n=kO(t);e.setFieldValue("children",n),r(!1)},hasExistingInvoices:!0,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function dB({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:kF(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.dimension?.id===e.id);return void 0===t?null:{label:e.name??"",value:t.name??""}}).filter(e=>null!==e),...null!==i?[{label:"Customer",value:i.name??""}]:[]];return S(ZV,{children:l.map((e,t)=>R(b,{children:[t>0&&S(GV,{}),S($V,{label:e.label,value:e.value.toString()})]},e.label))})}const uB=uf({defaultValues:YL,render:function({form:e}){const{query:{data:t}}=iP(),n=e.state.values.children;if(UL(n))return R(_V,{children:[S(Ys,{children:`Line Items (${n.length})`}),n.map((n,r)=>S(dB,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category??null,glAccount:n.glAccount??null,dimensionValues:n.dimensionValues,dimensions:t?.data??[],customer:n.customer},`${n.id}_${r}`)),R(sc,{children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Line Items"}),S(rl,{Component:Qi})]})}),S(IV,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(cV),onSubmit:t=>{dV(t.map(sV),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),hB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(_V,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?S(tB,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Bills"}),S(rl,{Component:Qi})]})}),S(VF,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=WF(t);0!==n&&a.push(BF(n)),e.setFieldValue("children",a),r(!1)}})]})]})}});function pB({amount:e,bankAccountName:t,date:n,description:r}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:r}),S(GV,{}),t&&R(N,{children:[S($V,{label:"Account",value:t}),S(GV,{})]}),S($V,{label:"Date",value:eB(n)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const gB=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1);return R(_V,{children:[S(iB,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?S(pB,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(sc,{open:t,onOpenChange:n,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Transactions"}),S(rl,{Component:Qi})]})}),S(pO,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,onSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)}})]})]})}}),mB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?S(cB,{form:e}):t.some(e=>"bill"===e.lineItemType)?S(hB,{form:e}):t.some(e=>"payment"===e.lineItemType)?S(gB,{form:e}):UL(t)?S(uB,{form:e}):null}});function vB({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:d}=nV(),u=void 0===i?ix[s]:lx[s],[h,p]=c(l??null),g=S(RV,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),m=S(n.Subscribe,{selector:e=>e.isDefaultValue,children:e=>S(Uh,{disabled:e})});return R(sL,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&S(WV,{transaction:e,bankAccount:r}),S(n.AppField,{name:"amount",children:e=>S(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),S(n.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),S(BV,{form:n,transaction:e,isManual:a}),S(n.Subscribe,{selector:e=>e.values.children,children:e=>function(e,t,n){const r=new Set(e.map(e=>e?.dimension?.id)),a=n.filter(e=>!r.has(e.dimension?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=VL(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,d).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>S(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>S(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(BL(e))})},r[0][0].id))}),S(n.Subscribe,{selector:e=>e.values.children,children:e=>tt(e)&&S(mB,{form:n})}),S(n.AppField,{name:"notes",children:e=>S(e.TextAreaInput,{label:"Note"})}),S(n.AppField,{name:"type",children:()=>null}),i&&S(jV,{form:n,transactionId:i})]})}function bB({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedDimensions:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedDimensions:n,dimensionLookup:r}=nV(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=rs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:tF(a,r,t),bankAccount:Lg(a?.bankAccount?.id??""),isManual:nr(a)||$p(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return S(o.Subscribe,{selector:e=>e.values.type,children:n=>S(vB,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function fB({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=rs({id:e});return u(()=>{!r&&nr(n)&&Kl()},[n,r]),nr(n)?null:S(bB,{transactionId:e,initialTab:t})}function yB({transactionId:e,initialTab:t,initialType:n}){return e?S(fB,{transactionId:e,initialTab:t}):!e&&n?S(bB,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function xB({subject:e,children:t}){return R(Fv,{children:[R(Vv,{children:[S(Vu,{}),S(vo,{children:e})]}),S("div",{className:tN({alignItems:"center",gap:15}),children:t})]})}function CB({conversationId:e,defaultValues:t}){const[n,r]=c(e),{query:{data:a}}=Sl(n),o="CLOSED"===a?.resolutionStatus;return S(jP,{children:R(_P,{children:[S(xB,{subject:a?.subject??"Conversation"}),S(eL,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const TB=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_18201_5557)"},r.createElement("path",{d:"M7.5 14.0625C11.1244 14.0625 14.0625 11.1244 14.0625 7.5C14.0625 3.87563 11.1244 0.9375 7.5 0.9375C3.87563 0.9375 0.9375 3.87563 0.9375 7.5C0.9375 11.1244 3.87563 14.0625 7.5 14.0625Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_18201_5557"},r.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function wB({onClick:e,active:t}){return S(Fs,{type:"button",onClick:e,active:t,children:S(ud,{Component:TB})})}const kB=Gn({display:"flex",flexDirection:"column"});function EB({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:kB,children:[S(fo,{children:e}),n?S(ZM,{width:r}):S(vo,{wrap:"wrap",children:t??""})]})}function AB({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=rs({id:e}),a=Lg(n?.bankAccount.id??"");if(nr(n))return null;const o=JS({alignItems:"stretch",gap:5,paddingLeft:16,paddingRight:16,backgroundColor:"surface.foreground",borderWidth:0,borderBottomStyle:"solid",borderColor:"border.layout.strong",maxHeight:0,overflow:"hidden",transition:"all 300ms ease-out","&[data-open='true']":{maxHeight:"1/3",paddingTop:16,paddingBottom:16,borderWidth:"lg",overflow:"scroll"}});return R("div",{"data-open":t,className:o,children:[R("div",{className:tN({justifyContent:"space-between"}),children:[S(EB,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),S(EB,{label:"Amount",data:ho(_u(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),S(EB,{label:"Bank Account",data:Gu(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),S(EB,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function IB({conversationId:e,transactionId:t}){const[n,r]=c(e),[a,o]=c(!0),{query:{data:i}}=Sl(n),l="CLOSED"===i?.resolutionStatus;return S(jP,{children:R(_P,{children:[S(xB,{subject:i?.subject??"Conversation",children:rr(t)&&S(wB,{onClick:()=>o(!a),active:a},"infoButton")}),rr(t)&&S(AB,{transactionId:t,isOpen:a}),S(eL,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function SB(){const e=_l().length>1;return S(jP,{children:R(_P,{background:"foreground",children:[S(Fv,{children:R(Vv,{children:[S(Vu,e?{Icon:Gi}:{}),S(vo,{children:"Add New Connection"})]})}),S(ZE,{})]})})}function NB(){return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:"Financial Summary"})]})})}const RB=Gn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),DB=mr.raw({body:"default"}),PB=Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},DB);function MB({summaryText:e}){return S("div",{className:RB,children:S("div",{className:PB,children:e})})}const LB=Gn({display:"flex",flexDirection:"column",overflow:"auto"});function FB({summary:e}){return R("div",{className:LB,children:[S(NB,{}),S(MB,{summaryText:e})]})}const OB=Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function VB({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Rr({queryKey:vs({id:e}),queryFn:fs})}({id:e});return S(jP,{children:R("div",{className:OB,children:[S(_P,{children:S(FB,{summary:n?.summary})}),S(Mh,{}),S(tL,{conversationId:t??null,attachedEntityId:e})]})})}function BB(){return S(jP,{children:S(_P,{children:S(sA,{showCloseButton:!0,inOverlay:!0})})})}const UB=I.object({id:I.string(),name:I.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:I.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:I.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Cr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),WB={mergeDestination:Pm,selectedAccount:null};const HB=Gn({display:"flex",flexDirection:"column",gap:"20px"}),zB=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),qB=Gn.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),jB=Gn(qB,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),KB=Gn(qB,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),_B=Gn(qB,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),YB=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),ZB=Gn({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),GB=Gn({width:"100%",display:"flex",justifyContent:"flex-start"}),QB=Gn({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),XB=Gn({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),JB=e=>{Qh(e),Xh(e)};function $B({account:e}){const t=cc(),n=function(e,t){const{mutateAsync:n}=mh();return df({defaultValues:WB,onSubmit:async r=>{if(await Ch()===Su&&rr(e)&&rr(r.value.selectedAccount)){const l=(a=e,o=r.value.mergeDestination,i=r.value.selectedAccount,o===Pm?{...yh(i),duplicateBankAccountIds:[cs(a.id)]}:{...yh(a),duplicateBankAccountIds:[cs(i.id)]});try{await n(l),t.close(),r.value.mergeDestination===Pm&&Kl()}catch{await Th()}}var a,o,i},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=nh();if(!(r&&r.data||a))return null;const o=r?.data?.filter(t=>t.glAccountId&&t.isSupported&&t.id!==e?.id&&t.integration?.id!==e?.integration?.id);return R("form",{className:HB,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:JB,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:zB,children:S(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:jB,children:[S("div",{className:GB,children:S(vo,{children:"Duplicate Account"})}),t===Pm?S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})})]}),R("div",{className:KB,children:[S("div",{className:QB,children:S(vo,{children:"Into"})}),S(n.AppField,{name:"mergeDestination",children:e=>S("div",{className:ZB,children:S(Fs,{onClick:()=>e.handleChange(e.state.value===Pm?Dm:Pm),children:S(ud,{Component:Qi})})})})]}),R("div",{className:_B,children:[S("div",{className:XB,children:S(vo,{children:"Destination Account"})}),t===Pm?S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})}):S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:YB,children:[S(gf,{showIcon:!1,onClick:()=>{t.close()}}),S(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>S(Nh,{disabled:nr(e),showIcon:!1,textContent:"Merge"})})]})]})}function eU({bankAccount:e}){return S(lg,{children:R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Account"})]})}),S(Av,{children:S(Nv,{children:S(vk,{children:S($B,{account:e})})})})]})})}const tU=Gn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"left",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}}),nU=({tranStartDate:e})=>R(N,{children:[S(fo,{children:"Start Date"}),Tr(e)?S(vo,{children:`${Bt(Pt(e))}`}):S(vo,{children:"Set Start Date"})]});function rU({bankAccount:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:t=>S("button",{className:Xn(or(tr["start-date-form-section"]),tU,el),...t,type:"button",children:S(nU,{tranStartDate:e.tranStartDate})})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:[e]})})})})]})}const aU=e=>["accounting/manualJournalEntry",e.id],oU=async e=>{const t=e.queryKey,n=t[2].accessToken,r=t[2].environment,a={path:"/accounting/manualJournalEntry?id={id}",pathParams:{id:t[1]},accessToken:n,environment:r};return await yi(a)};function iU({id:e}){return Rr({queryKey:aU({id:String(cs(e))}),queryFn:oU,enabled:rr(e)})}const lU=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/accounting/manualJournalEntry",bodyParams:{manualJournalEntry:e},accessToken:t,endpointManager:Na(n)};return await ka(r)})({data:e,accessToken:t,environment:n});const sU=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)},cU=I.object({amount:I.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:I.string("Required")}),dU=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===cs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},uU=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=iU({id:t??null}),r=function(){const{query:{data:e}}=Jx();return cC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutate:a}=ch({mutationFn:sU,onSuccess:async()=>{ha("beginning balance mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}}});const{mutate:o}=ch({onSuccess:async()=>{ha("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Ir.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:lU}),i=cc(),l=((e,t)=>{const n=dU(e,t);return{amount:rr(e.beginningBalanceData.journalEntry?.id)?n:"",date:rr(t?.date)?t.date:""}})(e,n);return df({defaultValues:l,validators:{onBlur:cU},onSubmit:l=>{if(i.close(),nr(t)||nr(n))a({bankAccountId:cs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(nr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>cs(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===cs(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),nr(l)?null:(o.transactions?.forEach(e=>{i.includes(e.glAccountId)&&(e.drAmount?e.drAmount=Number(e.drAmount)-l:e.crAmount&&(e.crAmount=Number(e.crAmount)-l))}),o.date=Mt(t)??o.date,o)})(n,Pt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);rr(t)&&o(t)}}})},hU=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),pU=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function gU({bankAccount:e}){const t=uU(e),n=cc(),r=()=>{n.close()};return R("form",{className:hU,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[S(vo,{children:"Set Beginning Balance"}),S(t.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),S(t.AppField,{name:"amount",children:e=>S(e.EditableAmountField,{label:"Beginning Balance Amount"})}),S(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:pU,children:[S(gf,{showIcon:!1,onClick:r}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const mU=$n({base:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"right",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}},variants:{layout:{left:{alignItems:"flex-start"},right:{alignItems:"flex-end"}}}}),vU=Gn({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function bU({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=cr(tr["beginning-balance-form-section"],mU({layout:a}),el),i=cr(tr["beginning-balance-form-section"],mU({layout:"right"}),el),l=r&&Bt(r);return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R("div",{className:vU,children:[R("button",{...o,...e,type:"button",children:[S(fo,{children:"Beginning Balance"}),S(vo,{children:rr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[S(fo,{children:"Migration Date"}),S(vo,{children:l})]})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(gU,{bankAccount:e})})})})]})}const fU=$n({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function yU({bankAccount:e,showStartDate:t}){const{query:{data:n}}=iU({id:e?.beginningBalanceData.journalEntry?.id??null}),r=dU(e,n),a=rr(n?.date)?Pt(n?.date):null,o=rr(e.tranStartDate)?Pt(e.tranStartDate):null,i=rr(a)&&rr(o)&&!At(a,o),l=i?"left":t?"right":"left";return R("div",{className:fU({layout:i?"stacked":"inline"}),children:[t&&S(rU,{bankAccount:e}),S(bU,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const xU=Gn({marginTop:"15px",marginBottom:"15px"}),CU={id:"",name:"",mask:"",type:void 0};const TU=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],wU=e=>{Qh(e),Xh(e)};function kU({bankAccountId:e}){const t=Lg(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:CU,[r,a]=c(n),o=function(e,t){const{mutate:n}=mh(),{mutateAsync:r}=gh({mutationFn:uh}),a=Tr(String(e.id));return df({defaultValues:e,validators:{onBlur:UB},onSubmit:async e=>{if(a)n(yh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((o=e.value,{apiAccountName:o.name,apiAccountNo:o.mask??void 0,apiAccountType:o.type||"DEPOSITORY",duplicateBankAccountIds:[]})),a={id:ss({id:n?.dataObject?.id,prefix:"BANK_ACCOUNT"}),name:n?.dataObject?.apiAccountName??"",mask:n?.dataObject?.apiAccountNo??"",type:e.value.type};t(a),e.formApi.reset(a,{keepDefaultValues:!0})}var o},onSubmitInvalid:()=>{}})}(r,a),i=!t||bh(t.apiName),l=!!t&&fh(t.apiName),s=Gu(r?.name??"",r?.mask??""),d=Tr(s)?s:"New Bank Account",u=l&&rr(t?.tranStartDate);return S(jP,{children:S(_P,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:wU,children:[R(Fv,{children:[R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:d}),rr(t)&&S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(eU,{bankAccount:t})})]}),S(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:S(o.SaveButton,{})})]}),R(rL,{children:[S(o.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),S(o.AppField,{name:"mask",children:e=>S(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),S(o.AppField,{name:"type",children:e=>S(e.GenericSelectorField,{label:"Account Type",options:TU,disabled:!i})}),rr(t)&&R(N,{children:[S("div",{className:xU,children:S(Mh,{alignment:"horizontal"})}),S(yU,{bankAccount:t,showStartDate:u})]})]})]})})})}function EU({filters:e,filterModels:t,setFilters:n}){const r=_l().length>1,[a,o]=c(()=>sw(e,t));return S(jP,{children:R(_P,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,r?{Icon:Gi}:{}),S(Ys,{children:"Back"})]})}),S(rP,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),S(FA,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=uw(a);n(e),Kl()}})]})})}function AU({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=LI(e);return S(EU,{filters:n,filterModels:t,setFilters:r})}function IU(){const e=CR();return S(AU,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function SU(){const e=UR();return S(AU,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function NU(){const e=KI();return S(AU,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function RU({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(lb,{popupTriggerChildrenProps:n,children:[R(mA,{children:[S(ud,{Component:e}),S(Ys,{children:t})]}),S(ud,{Component:Qi})]})}const DU=ci(aF,"Expenses");function PU(){return S(RU,{Icon:DU,label:"Categories"})}const MU=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.50005 8.39072C9.01022 8.39072 10.2345 7.16647 10.2345 5.6563C10.2345 4.14612 9.01022 2.92188 7.50005 2.92188C5.98987 2.92188 4.76562 4.14612 4.76562 5.6563C4.76562 7.16647 5.98987 8.39072 7.50005 8.39072Z"}),r.createElement("path",{d:"M11.5981 13.1742V12.4749C11.5944 11.3904 11.161 10.3516 10.3929 9.58611C9.62473 8.82059 8.58446 8.39074 7.49999 8.39075C6.4131 8.39075 5.37072 8.82251 4.60217 9.59106C3.83362 10.3596 3.40186 11.402 3.40186 12.4889V13.1882"}),r.createElement("path",{d:"M7.50011 14.4244C11.3244 14.4244 14.4245 11.3242 14.4245 7.49998C14.4245 3.67573 11.3244 0.575562 7.50011 0.575562C3.67585 0.575562 0.575684 3.67573 0.575684 7.49998C0.575684 11.3242 3.67585 14.4244 7.50011 14.4244Z"})),"Person"),LU=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function FU(e){return{id:e.id,name:e.name,status:e.status,additionalContactName:e.additionalContactName,businessName:e.businessName,email:e.email,ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoiceSettings:e.invoiceSettings,address:e.address}}function OU(e,t){return{search:Tr(e)?e:void 0,status:{in:t}}}function VU(e){return e.pages.flatMap(e=>(e.data??[]).map(FU))}const BU=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function UU(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function WU(e,t){const n=(e,n)=>HL(e=>!t(e),e,n);return{state:n("state",Cr(e.state)?void 0:e.state),city:n("city",Cr(e.city)?void 0:e.city),zip:n("zip",Cr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Cr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Cr(e.address1)?void 0:e.address1),address2:n("address2",Cr(e.address2)?void 0:e.address2)}}const HU=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:BU});function zU(e){return{id:e.id,status:e.status,name:e.name,billingContactName:e.additionalContactName||"",email:e.email||"",ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoicePrefix:e.invoiceSettings.invoicePrefix||"",address:UU(e.address)}}const qU=I.object({state:I.string(),city:I.string(),zip:I.string(),phoneWork:I.string(),address1:I.string(),address2:I.string()}),jU=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:I.string().optional(),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),email:I.email().or(I.literal("")),ccEmails:I.array(I.email()),bccEmails:I.array(I.email()),invoicePrefix:I.string().optional(),address:qU.optional()});function KU({customer:e}){const{mutateAsync:t}=Cv(),n=cc();return df({defaultValues:e??HU,validators:{onSubmit:jU},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>HL(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(BU).filter(e=>e in BU).some(e=>!n(e))?WU(e.address??BU,n):void 0,i=a("invoicePrefix",Tr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Tr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Tr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:nr(i)?void 0:{invoicePrefix:i},address:o}}(e,0,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}const _U=Object.entries({UNKNOWN:"UNKNOWN",ALABAMA:"AL",ALASKA:"AK",AMERICAN_SAMOA:"AS",ARIZONA:"AZ",ARKANSAS:"AR",CALIFORNIA:"CA",COLORADO:"CO",CONNECTICUT:"CT",DELAWARE:"DE",DISTRICT_of_COLUMBIA:"DC",FLORIDA:"FL",GEORGIA:"GA",GUAM:"GU",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",MARIANA_ISLANDS:"MP",OHIO:"OH",OKLAHOMA:"OK",OREGON:"OR",PENNSYLVANIA:"PA",PUERTO_RICO:"PR",RHODE_ISLAND:"RI",SOUTH_CAROLINA:"SC",SOUTH_DAKOTA:"SD",TENNESSEE:"TN",TEXAS:"TX",UTAH:"UT",VERMONT:"VT",VIRGIN_ISLANDS:"VI",VIRGINIA:"VA",WASHINGTON:"WA",WEST_VIRGINIA:"WV",WISCONSIN:"WI",WYOMING:"WY"}).filter(([e])=>"UNKNOWN"!==e).map(([e,t])=>({label:e.split("_").map(e=>/^[a-z]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),value:t})),YU=Gn({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),ZU=Gn({width:"100%"}),GU=hf({defaultValues:BU,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[S(e.AppField,{name:"address1",children:e=>S(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),S(e.AppField,{name:"address2",children:e=>S(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),S(e.AppField,{name:"city",children:e=>S(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:YU,children:[S("div",{className:ZU,children:S(e.AppField,{name:"state",children:()=>S(xm,{label:"State",options:[{label:"Select State",value:""},..._U],isEmpty:Cr,disabled:t})})}),S("div",{className:ZU,children:S(e.AppField,{name:"zip",children:e=>S(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),S(e.AppField,{name:"phoneWork",children:e=>S(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),QU=Gn.raw({width:"100%"});function XU({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o}){const i=PT();return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[!o&&S(Dh,{disabled:a,onClick:t}),o&&i&&S(Fs,{onClick:n,styles:QU,children:S(Ys,{children:r})}),e]})]})}const JU=Gn({display:"flex",gap:"8px"});function $U({title:e,customer:t}){const n=KU({customer:t}),[r,a]=c(n.state.values.ccEmails.length>0),[o,i]=c(n.state.values.bccEmails.length>0),{mutate:l}=Cv(),{mutate:s}=ch({mutationFn:yv,onSuccess:xv}),d=cc(),u=PT(),h="ACTIVE"===t?.status,p="INACTIVE"===t?.status,g=p&&!u,m=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({title:"Restore customer",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&(l({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),d.close())},v=h||g?S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[h&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({title:"Archive customer",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&(s({id:t?.id??""}),d.close())},closeOnClick:!0,children:"Archive"}),p&&S(vS,{onClick:m,closeOnClick:!0,children:"Restore"})]})}):null,b=g?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>S(XU,{onSave:n.handleSubmit,disabled:e||t,restoreLabel:"Restore Customer",onRestore:m,isArchived:p})});return S(Wv,{title:e,HeaderRightAction:v,Footer:b,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:p})}),S(n.AppField,{name:"billingContactName",children:e=>S(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:p})}),S(n.AppField,{name:"email",children:e=>S(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:p})}),S(n.AppField,{name:"ccEmails",children:e=>r&&S(e.MultiEmailField,{label:"CC Billing Emails",disabled:p})}),S(n.AppField,{name:"bccEmails",children:e=>o&&S(e.MultiEmailField,{label:"BCC Billing Emails",disabled:p})}),(!r||!o)&&R("div",{className:JU,children:[!r&&S(Ic,{onClick:()=>a(!0),children:"CC"}),!o&&S(Ic,{onClick:()=>i(!0),children:"BCC"})]}),S(n.AppField,{name:"invoicePrefix",children:e=>S(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:p})}),S(GU,{form:n,fields:"address",disabled:p})]})})}function eW({title:e,customer:t}){const n=cc();return S(Dv,{children:n.open&&S($U,{title:e,customer:t})})}const tW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function nW({customer:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{Component:MU}),R("div",{className:tW,children:[S(Ys,{children:e.name}),e.email&&S(fo,{children:e.email})]})]}),S(ud,{Component:Qi})]})}),S(eW,{title:"Edit Customer",customer:zU(e)})]})}const rW=Gn.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function aW({selectedValue:e,Icon:t=lp,options:n,onClick:r,additionalStyles:a=[]}){return R(sc,{children:[S(dc,{children:n=>R(Fs,{popupTriggerProps:n,styles:[rW,...a],children:[S(Ys,{children:e.label}),S(ud,{Component:t})]})}),S(vm,{options:n,onClick:r})]})}const oW=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),iW=Gn({display:"flex",gap:"8px"}),lW=Gn.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function sW({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:oW,children:[S(Ys,{intent:"weak",children:"Search"}),R("div",{className:iW,children:[S(pF,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),S(aW,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[lW]})]})]})}const cW=R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),S(Ys,{children:"Add Customer"})]})}),S(eW,{title:"Add Customer",customer:void 0})]});function dW(){const[e,t]=c(""),[n,r]=c(LU[0]),{list:a,fetchNextPage:o,canFetchNextPage:i,isLoading:l}=function({searchTerm:e,statuses:t,selected:n,onSelectedChange:r}){const{query:{data:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isFetchingNextPage:s,isPending:c}}=function(e={},t){return qm({queryFn:bv,queryKey:pv(e),...t})}({filter:OU(e,t)},{select:VU});return{list:Gv({data:[a??[]],getRowKey:e=>e.id,getGroupKey:()=>"customers",state:void 0!==n?{selected:n}:void 0,onSelectedChange:r}),data:a,fetchNextPage:o,canFetchNextPage:!i&&l,isLoading:i&&!s||c}}({searchTerm:e,statuses:n.value});return R(Wv,{title:"Back",HeaderRightAction:cW,padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:LU,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>S(CA,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>S(nW,{customer:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:i})]})}function uW(){const e=cc();return S(Dv,{children:e.open&&S(dW,{})})}function hW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:MU,label:"Customers",popupTriggerChildrenProps:e})}),S(uW,{})]})}const pW=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,strokeLinecap:"square",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.05348 1.63635V5.42983C4.05348 5.88785 3.87154 6.3271 3.54768 6.65096C3.22381 6.97483 2.78456 7.15677 2.32655 7.15677C1.86853 7.15677 1.42928 6.97483 1.10542 6.65096C0.781554 6.3271 0.599609 5.88785 0.599609 5.42983L1.97971 1.63635H4.05348Z"}),r.createElement("path",{d:"M7.50007 1.63635V5.42983C7.51534 5.66553 7.4821 5.90185 7.4024 6.12419C7.3227 6.34653 7.19825 6.55015 7.03673 6.72248C6.8752 6.8948 6.68005 7.03216 6.46333 7.12607C6.24661 7.21997 6.01293 7.26842 5.77674 7.26842C5.54055 7.26842 5.30687 7.21997 5.09015 7.12607C4.87343 7.03216 4.67828 6.8948 4.51676 6.72248C4.35524 6.55015 4.23078 6.34653 4.15108 6.12419C4.07139 5.90185 4.03815 5.66553 4.05342 5.42983V1.63635H7.50007Z"}),r.createElement("path",{d:"M10.9468 1.63635V5.42983C10.9621 5.66553 10.9289 5.90185 10.8492 6.12419C10.7695 6.34653 10.645 6.55015 10.4835 6.72248C10.322 6.8948 10.1268 7.03216 9.91011 7.12607C9.69339 7.21997 9.45971 7.26842 9.22352 7.26842C8.98733 7.26842 8.75365 7.21997 8.53693 7.12607C8.32021 7.03216 8.12506 6.8948 7.96354 6.72248C7.80201 6.55015 7.67756 6.34653 7.59786 6.12419C7.51817 5.90185 7.48493 5.66553 7.5002 5.42983V1.63635H10.9468Z"}),r.createElement("path",{d:"M14.4007 5.42983C14.4007 5.88785 14.2187 6.3271 13.8948 6.65096C13.571 6.97483 13.1317 7.15677 12.6737 7.15677C12.2157 7.15677 11.7764 6.97483 11.4526 6.65096C11.1287 6.3271 10.9468 5.88785 10.9468 5.42983V1.63635H13.0205L14.4007 5.42983Z"}),r.createElement("path",{d:"M13.0206 7.15678V13.3636H1.97974V7.15678H2.32657C2.55335 7.15678 2.77792 7.11211 2.98744 7.02532C3.19696 6.93854 3.38734 6.81133 3.5477 6.65097C3.70806 6.49061 3.83526 6.30023 3.92205 6.09071C4.00884 5.88119 4.05351 5.65662 4.05351 5.42984C4.03824 5.66554 4.07148 5.90186 4.15117 6.12419C4.23087 6.34653 4.35532 6.55016 4.51685 6.72248C4.67837 6.89481 4.87352 7.03217 5.09024 7.12607C5.30696 7.21998 5.54064 7.26842 5.77683 7.26842C6.01302 7.26842 6.2467 7.21998 6.46342 7.12607C6.68014 7.03217 6.87529 6.89481 7.03681 6.72248C7.19834 6.55016 7.32279 6.34653 7.40249 6.12419C7.48218 5.90186 7.51542 5.66554 7.50015 5.42984C7.48488 5.66554 7.51812 5.90186 7.59782 6.12419C7.67752 6.34653 7.80197 6.55016 7.96349 6.72248C8.12502 6.89481 8.32017 7.03217 8.53689 7.12607C8.75361 7.21998 8.98729 7.26842 9.22348 7.26842C9.45967 7.26842 9.69335 7.21998 9.91007 7.12607C10.1268 7.03217 10.3219 6.89481 10.4835 6.72248C10.645 6.55016 10.7694 6.34653 10.8491 6.12419C10.9288 5.90186 10.9621 5.66554 10.9468 5.42984C10.9468 5.65662 10.9915 5.88119 11.0783 6.09071C11.165 6.30023 11.2922 6.49061 11.4526 6.65097C11.613 6.81133 11.8033 6.93854 12.0129 7.02532C12.2224 7.11211 12.447 7.15678 12.6737 7.15678H13.0206Z"}),r.createElement("path",{d:"M10.2604 9.91696H4.73999V13.3636H10.2604V9.91696Z"})),"Vendor"),gW=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:BU,transactionCount:0,iconUrl:void 0});function mW(e){return{id:e.id,name:e.name,status:e.status,address:UU(e.address),transactionCount:e.transactionCount,iconUrl:e.iconUrl||void 0}}const vW=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),address:qU.optional(),transactionCount:I.number(),iconUrl:I.string().optional()});const bW=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function fW(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address,transactionCount:e.transactionCount}}function yW(e,t,n){return{search:Tr(e)?e:void 0,name:nr(n)?void 0:{notEqual:n},status:{in:t}}}function xW(e){return e.pages.flatMap(e=>(e.data??[]).map(fW))}function CW({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:yW(e,t,n)},u={select:xW},qm({queryFn:Gm,queryKey:Km(d),...u}));var d,u;return{list:Gv({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"vendors",state:void 0!==r?{selected:r}:void 0,onSelectedChange:a}),data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isLoading:l&&!c}}const TW=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.4375 7.5H0.3125",strokeMiterlimit:10}),r.createElement("path",{d:"M8.6626 2.72498L13.4376 7.49998L8.6626 12.275",strokeMiterlimit:10})),"LongArrowRight"),wW=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),kW=Gn({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),EW=$n({base:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"8px",padding:"8px",borderWidth:"md",borderColor:"border.layout",borderStyle:"solid",flex:"1",minWidth:"0"},variants:{archivedVendor:{true:{backgroundColor:"surface.background"},false:{backgroundColor:"surface.foreground"}}}}),AW=Gn({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),IW=Gn({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function SW({targetVendor:e,duplicateVendor:t}){return R("div",{className:wW,children:[S(Ys,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:kW,children:[R("div",{className:EW({archivedVendor:!0}),children:[S(ud,{imageUrl:t.iconUrl,Component:pW}),S(Ys,{intent:"weak",children:t.name})]}),R("div",{className:AW,children:[S(ud,{Component:TW,stylists:[cr(null,IW)]}),S(fo,{intent:"weak",children:"Merging Into"})]}),R("div",{className:EW({archivedVendor:!1}),children:[S(ud,{imageUrl:e.iconUrl,Component:pW}),S(Ys,{children:e.name})]})]}),S(Ys,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function NW({vendor:e,onClose:t}){const{mutate:n}=ch({mutationFn:ev,onSuccess:tv}),[r,a]=c({}),[o,i]=c(""),{list:l,data:s,fetchNextPage:d,isFetching:u,hasNextPage:h,isLoading:p}=CW({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=cc(),m=S(Uh,{onSave:async()=>{const a=Object.keys(r).find(e=>r[e]),o=s?.find(e=>e.id===a);if(!o)return;const i={name:o.name,iconUrl:o.iconUrl||void 0};"MERGE"===await async function({targetVendor:e,duplicateVendor:t}){return ju({title:"Confirm Merge",body:S(SW,{targetVendor:e,duplicateVendor:t}),cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"action",key:"MERGE",label:"Merge"}]}).then(e=>"MERGE"===e?"MERGE":"CANCEL").catch(()=>"CANCEL")}({targetVendor:i,duplicateVendor:e})&&(n({targetId:o.id,duplicateId:e.id??""}),t()),g.close()},disabled:p||Object.values(r).every(e=>!e)});return R(Wv,{title:"Back",Footer:m,padChildren:!0,children:[S(pF,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>S(CA,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>S(sb,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(mA,{children:[S(ld,{imageUrl:e.value.iconUrl??void 0,Component:pW}),S(Ys,{children:e.value.name})]})},e.value.id))},e.key)),S(TF,{onIntersect:d,enable:!u&&h})]})}function RW({vendor:e,onClose:t}){const n=cc();return S(Dv,{children:n.open&&S(NW,{vendor:e,onClose:()=>{t(),n.close()}})})}function DW({vendor:e,onClose:t}){return R(sc,{children:[S(dc,{children:e=>S(vS,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),S(RW,{vendor:e,onClose:t})]})}const PW=Gn.raw({width:"100%"});function MW({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o}){const i=PT();return S(XU,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,children:i&&!nr(e)&&R(sc,{children:[S(dc,{children:e=>S(Fs,{popupTriggerProps:e,styles:PW,children:S(Ys,{children:"Merge"})})}),S(RW,{vendor:e,onClose:r})]})})}function LW({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=nv(),n=cc();return df({defaultValues:e??gW,validators:{onSubmit:vW},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(BU).filter(e=>e in BU).some(e=>!t(e))?WU(e.address??BU,t):void 0;return{id:e.id,name:e.name,address:n}}(e,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}({vendor:t}),{mutate:r}=ch({mutationFn:$m,onSuccess:tv}),{mutate:a}=nv(),o=cc(),i=PT(),l="ACTIVE"===t?.status,s="INACTIVE"===t?.status,c=!nr(t?.transactionCount)&&t.transactionCount>0,d=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({title:"Restore vendor",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&(a({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),o.close())},u=l&&(!i||l&&!c),h=s&&!i,p=nr(t)||!u&&!h?null:S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[s&&S(vS,{onClick:d,closeOnClick:!0,children:"Restore"}),!i&&S(DW,{vendor:t,onClose:()=>o.close()}),l&&!c&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({title:"Archive vendor",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&(r({id:t?.id??""}),o.close())},closeOnClick:!0,children:"Archive"})]})}),g=s&&!i?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:r})=>S(MW,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>o.close(),disabled:e||r,isArchived:s})});return S(Wv,{title:e,HeaderRightAction:p,Footer:g,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:s,maxLength:255})}),S(GU,{form:n,fields:"address",disabled:s})]})})}function FW({title:e,vendor:t}){const n=cc();return S(Dv,{children:n.open&&S(LW,{title:e,vendor:t})})}const OW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function VW({vendor:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{imageUrl:e.iconUrl??void 0,Component:pW}),S("div",{className:OW,children:S(Ys,{children:e.name})})]}),S(ud,{Component:Qi})]})}),S(FW,{title:"Edit Vendor",vendor:mW(e)})]})}function BW(){const[e,t]=c(""),[n,r]=c(bW[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=CW({searchTerm:e,statuses:n.value}),d=PT();return R(Wv,{title:"Back",HeaderRightAction:R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),!d&&S(Ys,{children:"Add Vendor"})]})}),S(FW,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:bW,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>S(CA,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>S(VW,{vendor:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:!i&&l})]})}function UW(){const e=cc();return S(Dv,{children:e.open&&S(BW,{})})}function WW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:pW,label:"Vendors",popupTriggerChildrenProps:e})}),S(UW,{})]})}const HW=Gn({padding:"16px"});function zW(){const e=ln(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return S(jP,{children:R(_P,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:"Back"})]})}),S("div",{className:HW,children:R(CA,{label:"Transaction Settings",children:[e&&S(PU,{}),S(WW,{}),S(hW,{})]})})]})})}function qW(){return R(UP,{children:[S(HP,{name:"BankTransactionForm",Component:yB}),S(HP,{name:"Conversation",Component:CB}),S(HP,{name:"MobileConversation",Component:IB}),S(HP,{name:"FinancialSummary",Component:VB}),S(HP,{name:"BanksAndIntegrations",Component:BB}),S(HP,{name:"BankAccountForm",Component:kU}),S(HP,{name:"NewConnection",Component:SB}),S(HP,{name:"TransactionsFilterList",Component:NU}),S(HP,{name:"ExpensesFilterList",Component:IU}),S(HP,{name:"RevenueFilterList",Component:SU}),S(HP,{name:"TransactionSettingsDrawer",Component:zW})]})}const jW=({environment:e,children:t})=>S(Sr.Provider,{value:e,children:t});function KW({children:e}){const{query:{data:t}}=ki(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?ss({id:t.companyId,prefix:"COMPANY"}):void 0,customerPartnerId:t?.customerPartnerId,apiPartnerName:t?.apiPartnerName,clientId:t?.clientId,unitIntegrationBankName:t?.unitIntegrationBankName??null,supportedIntegrations:t?.supportedIntegrations??[],isDfy:t?.isDfy??!1,hasBookkeeper:t?.isDfy||!1};return S(Lc.Provider,{value:n,children:e})}const _W=e=>["whiteLabels",e??{}],YW=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ZW({children:e}){const t=Ci(),{query:{data:n}}=fl({queryKey:_W({filter:{name:{equal:t}}}),queryFn:YW}),r={icons:n?.data?.[0]?.icons};return S(li.Provider,{value:r,children:e})}const GW=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const QW="SSE connection failed with status";function XW({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Nr();u(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Sa[o]}/sse/v1/subscribe`);var o;return a.searchParams.append("customerPartnerId",n),t.forEach(e=>a.searchParams.append("events",e)),r&&a.searchParams.append("companyId",r),a.toString()}(r,n,t,e);let i=0;return He(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${QW} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case GW.CONNECTED:return void ha("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case GW.ERROR:throw pa({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case GW.CACHE_BUST:return ha("cache bust event received",{sseTypes:JSON.stringify(Array.from(r))}),void function(e){try{const t=JSON.parse(e);Array.isArray(t)&&t.forEach(e=>{setTimeout(()=>{Ir.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>pa({error:e,severity:"error"}))},500*Math.random()),ha(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void pa({error:t instanceof Error?t:new Error("JSON parse error"),severity:"error",extraData:{data:e}})}}(t)}}({event:a.event,data:a.data,env:r,sseTypes:n,customerPartnerId:t,companyId:e}),onclose:()=>function(){throw pa({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(QW))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>pa({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const JW=[GW.CACHE_BUST];function $W({children:e}){const{companyId:t,customerPartnerId:n}=l(Lc);return XW({companyId:t,customerPartnerId:n,sseTypes:JW}),e}const eH=i({dimensions:{width:null,height:null}}),tH="undefined"!=typeof window?g:u,nH="undefined"==typeof window;const rH=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;nH&&(t=!1);const[n,r]=c(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=_T(r,e.debounceDelay,{leading:!0});function i(){(e.debounceDelay?o:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const o=a(t);tH(()=>{o.current=t},[t]),u(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{o.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",i),tH(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return S(eH.Provider,{value:r,children:e})},aH=({children:e})=>{const{dimensions:t}=l(eH),n=rr(t.width)&&t.width<parseInt(To("sizes.breakpoint-xl"));return S(DT.Provider,{value:n,children:e})};function oH({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return u(()=>{var e,r;e=n,r=t,la.setProperties(da),ca=r,sa=e},[n,t]),S(jW,{environment:t,children:S(MP,{children:S(wr.Provider,{value:r,children:S(KW,{children:S(ZW,{children:S($W,{children:S(rH,{children:R(aH,{children:[S(ye.ConfirmationRoot,{}),e,S(qW,{})]})})})})})})})})}const iH={FinancialOverview:{path:"/",element:S(rk,{})},FinancialOverviewDashboard:{path:"/",element:S(rk,{})}};function lH({children:e,initialNav:t}){const n=Re(),r=Fe(),i=a(void 0),l=d(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),s=d(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),c=d(e=>{const t=iH[e.page].path;t!==r.pathname&&(ln.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&jl(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);u(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&jl(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:c,registerAnchor:s,location:r,initialPageProps:t.pageProps}),[r,c,s,t.pageProps]);return S(vd.Provider,{value:p,children:e})}function sH({accessToken:e,environment:t="PRODUCTION",initialNav:n={page:"FinancialOverview"}}){return S(oH,{environment:t,accessToken:e,children:S(Oe,{initialEntries:[iH[n.page].path],children:S(lH,{initialNav:n,children:S(Ve,{children:Object.entries(iH).map(([e,t])=>S(Be,{path:t.path,element:t.element},e))})})})})}const cH=["BanksAndIntegrations"],dH={FinancialOverview:!0},uH=new Set(Object.values(ii).flatMap(e=>Object.values(e)));function hH(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!dH[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&cH.includes(i)){const e=function(e){if("BanksAndIntegrations"===e)return{name:e}}(a);void 0!==e&&(o=e)}var i,l;if("FinancialOverview"===n||"FinancialOverviewDashboard"===n){const e=t.searchParams.get("bkAnchor"),r=null!==(l=e)&&uH.has(l)?e:void 0,a=function(e){const t=e.get("bkPage_period_month"),n=e.get("bkPage_period_year");if(null===t||null===n)return;const r=parseInt(t,10),a=parseInt(n,10);return!Number.isInteger(r)||r<0||r>11||!Number.isInteger(a)||a<2e3||a>2100?void 0:{month:r,year:a}}(t.searchParams),i=void 0!==a?{period:a}:void 0;return void 0!==r&&void 0!==o?{page:n,anchor:r,drawer:o,...void 0!==i?{pageProps:i}:{}}:void 0!==r?{page:n,anchor:r,...void 0!==i?{pageProps:i}:{}}:void 0!==o?{page:n,drawer:o,...void 0!==i?{pageProps:i}:{}}:{page:n,...void 0!==i?{pageProps:i}:{}}}return void 0!==o?{page:n,drawer:o}:{page:n}}export{uA as BanksAndIntegrations,OR as ExpenseDashboard,rk as FinancialOverview,zR as IncomeDashboard,RP as ReportDashboard,oH as Tight,sH as TightApp,fR as TransactionsDashboard,hH as parseNavUrl,yn as useOptions};
|
|
1
|
+
import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import*as r from"react";import{useRef as a,useMemo as o,createContext as i,useContext as l,Component as s,useState as c,useCallback as d,useEffect as u,createElement as h,forwardRef as p,useLayoutEffect as g,useImperativeHandle as m,useReducer as v,Fragment as b}from"react";import"zustand/react/shallow";import{cloneDeep as f,entries as y,mapValues as x,isEqual as C,differenceBy as T,debounce as w,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as I}from"zod";import{jsx as S,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as D,useIsRestoring as P,useQuery as M,keepPreviousData as L,useMutation as F,useQueries as O,useInfiniteQuery as V}from"@tanstack/react-query";import B from"yocto-queue";import U from"big.js";import{ResponsiveContainer as W,BarChart as H,Legend as z,CartesianGrid as q,XAxis as j,YAxis as _,Tooltip as K,Bar as Y,ReferenceLine as Z,Line as G}from"recharts";import{flexRender as Q,createColumnHelper as X,useReactTable as J,getCoreRowModel as $,getExpandedRowModel as ee}from"@tanstack/react-table";import{useFloatingNodeId as te,useFloating as ne,offset as re,flip as ae,shift as oe,size as ie,autoUpdate as le,useClick as se,useDismiss as ce,useRole as de,useInteractions as ue,useFloatingParentNodeId as he,FloatingTree as pe,FloatingNode as ge,useMergeRefs as me,FloatingPortal as ve,FloatingOverlay as be,FloatingFocusManager as fe}from"@floating-ui/react";import{ContextAwareConfirmation as ye,confirmable as xe}from"react-confirm";import{createFormHookContexts as Ce,useStore as Te,createFormHook as we}from"@tanstack/react-form";import{NumericFormat as ke}from"react-number-format";import Ee from"fuse.js";import Ae from"react-inlinesvg";import{AnimatePresence as Ie,motion as Se}from"motion/react";import{useDropzone as Ne}from"react-dropzone";import{useNavigate as Re,useMatches as De,Outlet as Pe,createMemoryRouter as Me,RouterProvider as Le,useLocation as Fe,MemoryRouter as Oe,Routes as Ve,Route as Be}from"react-router";import{openDB as Ue}from"idb";import{PersistQueryClientProvider as We}from"@tanstack/react-query-persist-client";import{fetchEventSource as He}from"@microsoft/fetch-event-source";function ze(e,t){return`${e.trim()}:${t.trim()}`}const qe=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_REPORT_FILTERS:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,ze("featureFlags","updateFlags"))});function je(){return ln(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function _e(){return ln(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let Ke=null,Ye=!1;function Ze(){const e=document.querySelector("meta[name='viewport']");if(!e)return null;const t=Object.fromEntries((e.getAttribute("content")??"").split(",").map(e=>{const[t,n=""]=e.trim().split("=");return[t.trim(),n.trim()]}));return{meta:e,params:t}}function Ge(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Qe(){const e=Ze();if(!e)return;const{meta:t,params:n}=e;if(Ye)return t.remove(),Ye=!1,void(Ke=null);Ke?n["interactive-widget"]=Ke:delete n["interactive-widget"],Ke=null,Ge(t,n)}const Xe="drawerNavigation",Je=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:r,routeProps:a}=n,o={[t]:{routeProps:a}};if(r||0===e.drawerHistory.length)return 0===e.drawerHistory.length&&function(){let e=Ze();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),Ye=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;Ke=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ge(t,n)}(),{drawerHistory:[o]};{const t=f(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,ze(Xe,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,ze(Xe,"closeDrawer")),0===t().drawerHistory.length&&Qe()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,ze(Xe,"closeAllDrawers")),Qe()},requestCloseDrawer:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t.length-1,r=t[n];return{drawerHistory:t.slice(0,n),closingQueue:[...e.closingQueue,r]}},void 0,ze(Xe,"requestCloseDrawer")),requestCloseAllDrawers:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t[t.length-1];return{drawerHistory:[],closingQueue:[...e.closingQueue,n]}},void 0,ze(Xe,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,ze(Xe,"confirmCloseDrawer")),0===t().drawerHistory.length&&Qe()}}),$e=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,ze("externalOptions","setOptions"))});function et(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function tt(e){return Array.isArray(e)&&e.length>0}function nt(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:E()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const rt="search",at=nt({key:rt,name:"Search"});function ot(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function it(e,t,n){return new Date(e,t,n)}function lt(e){const[t,n,r]=e.split("-");return it(Number(t),Number(n),Number(r))}function st(){return ot(it(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function ct(e,t){return ot(it(t,e,1))}function dt(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()+1,0))}function ut(e){const t=/* @__PURE__ */new Date;return ot(it(t.getFullYear(),t.getMonth()-e,1))}function ht(e){const t=e.getMonth(),n=t-t%3;return ot(it(e.getFullYear(),n,1))}function pt(e){const t=e.getMonth(),n=t-t%3+3;return ot(it(e.getFullYear(),n,0))}const gt={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_6_MONTHS:"LAST_6_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},mt={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_6_MONTHS:"Last 6 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},vt=e=>Object.values(gt).includes(e),bt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ct(e.getMonth(),e.getFullYear())}(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[gt.LAST_MONTH]:()=>ut(1),[gt.LAST_6_MONTHS]:()=>ut(5),[gt.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()-11,1))}(),[gt.THIS_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,1)),[gt.LAST_3_MONTHS]:()=>ut(2),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ht(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>ht(/* @__PURE__ */new Date)};function ft(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&void 0===t.endDate||void 0===t.beginDate&&"string"==typeof t.endDate||"string"==typeof t.beginDate&&"string"==typeof t.endDate}const yt=e=>bt[e](),xt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>dt(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,0)),[gt.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth(),0))}(),[gt.LAST_6_MONTHS]:()=>dt(),[gt.LAST_12_MONTHS]:()=>dt(),[gt.THIS_YEAR]:()=>st(),[gt.LAST_3_MONTHS]:()=>dt(),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return pt(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>pt(/* @__PURE__ */new Date)},Ct=e=>xt[e](),Tt=e=>{return vt(e)?{beginDate:yt(e),endDate:Ct(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:ot((t=e).beginDate),endDate:ot(t.endDate)};var t},wt=["SUN","MON","TUE","WED","THU","FRI","SAT"],kt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Et({yearsBack:e=10,startYear:t}){const n=t??/* @__PURE__ */(new Date).getFullYear(),r=[n];for(let a=n-1;a>=n-e;a--)r.push(a);return r}function At(e,t){return e.toDateString()===t.toDateString()}function It(e){return At(e,/* @__PURE__ */new Date)}function St(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function Nt(e){return e&&e instanceof Date&&!isNaN(e.getTime())?`${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")}/${e.getFullYear()}`:""}function Rt(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=it(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Dt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return Rt(o,i,l)?it(l,o-1,i):null}function Pt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,4})-(\d{1,2})-(\d{1,2})/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return Rt(i,l,o)?it(o,i-1,l):null}function Mt(e){if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getDate()).padStart(2,"0");return`${t}-${String(e.getMonth()+1).padStart(2,"0")}-${n}`}function Lt(e,t){return St(e,t)?t:e}function Ft(e,t){return St(t,e)?t:e}const Ot=(e,t)=>{const n={month:t.abbreviateMonth?"short":"long",year:t.abbreviateYear?"2-digit":"numeric"},r=e.toLocaleString("default",n);let a=r;if(t.abbreviateYear){const e=r.length-2;a=r.slice(0,e)+"'"+r.slice(e)}return a},Vt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return It(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Ot(t,{abbreviateMonth:!0,abbreviateYear:!1})},Bt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Ut(e,t){return it(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Wt(e){const{month:t,year:n}=e;return{beginDate:it(n,t-1,1),endDate:it(n,t+1,0)}}const Ht="date",zt=Object.values(gt).map(e=>{return{name:mt[t=e],value:{date:{name:mt[t],value:t}}};var t}),qt=nt({key:Ht,name:"Date",possibleValues:()=>({values:zt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function jt(e){return"OWNER"===e||"READ_ONLY"===e}function _t(e){if(0===e.length)return e;const t=function(e,t){if(0===e.length)return-1;let n=e.length-1;for(;n>-1;){if(t(e[n]))return n;n--}return-1}(e,e=>e.modelKey===rt);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==rt)}const Kt=qt.createFilter({name:mt[gt.LAST_12_MONTHS],value:{date:{name:mt[gt.LAST_12_MONTHS],value:gt.LAST_12_MONTHS}}});function Yt(e,t){return _t([...t.some(e=>e.modelKey===Ht)?function(e){const t=e.findIndex(e=>e.modelKey===Ht);return-1!==t?et(e,t):e}(e.filters):e.filters,...t])}function Zt(e,t){const n=e.filters[t];return n&&n.modelKey===Ht?function(e,t){const n=[...e];return n[t]=Kt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Gt(e){return _t(e.some(e=>e.modelKey===Ht)?e:[...e,Kt])}function Qt(e,t){if(e.hasInitialized)return e;const n=[];return jt(t.userRole)&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:E(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(Kt),{filters:n,hasInitialized:!0}}const Xt="transactionsDashboardFilters",Jt=e=>({transactionsDashboardFilters:[Kt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Yt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Zt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Gt(t)}),void 0,ze(Xt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,ze(Xt,"initialize"))}),$t="expenseDashboardFilters",en=e=>({expenseDashboardFilters:[Kt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Yt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Zt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Gt(t)}),void 0,ze($t,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,ze($t,"initialize"))}),tn="incomeDashboardFilters",nn=e=>({incomeDashboardFilters:[Kt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Yt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Zt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Gt(t)}),void 0,ze(tn,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,ze(tn,"initialize"))}),rn={label:"Connected Accounts",value:"connected"},an="banksAndIntegrationsState",on=e=>({banksAndIntegrationsSelectedTab:rn,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,ze(an,"setBanksAndIntegrationsSelectedTab")),toggleExpandedIntegration:(t,n)=>e(e=>({expandedPlaidItems:e.expandedPlaidItems.includes(t)||n&&!e.hasExpandedUpdated?e.expandedPlaidItems.filter(e=>e!==t):[...e.expandedPlaidItems,t],hasExpandedUpdated:!0}),void 0,ze(an,"toggleExpandedIntegration"))}),ln=e()(t(n((...e)=>({...qe(...e),...Je(...e),...$e(...e),...Jt(...e),...en(...e),...nn(...e),...on(...e)}),{name:"tight-featureflag-storage",partialize:e=>{const t=Object.entries(e).filter(([e])=>e.startsWith("FEATUREFLAG"));return Object.fromEntries(t)}}),{name:"globalStore",store:"globalStore",enabled:!1})),sn={SELECT:"select",EXPAND:"expand"},cn={...sn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},dn=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.DIMENSION_VALUE,cn.REVIEW_STATUS],un=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(dn)))}),hn=e=>{const t=un.safeParse(e);return t.success?t.data:void 0},pn=A.optional(A.string().trim()),gn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,mn=A.optional(A.array(A.string().trim())),vn=A.object({integrations:A.optional(A.array(A.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:A.optional(A.boolean()),hideManualBanks:A.optional(A.boolean())}),bn={transactionsDashboard:hn,incomeDashboard:hn,expenseDashboard:hn,accessToken:e=>{const t=pn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=mn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>gn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=vn.safeParse(e);return t.success?t.data:void 0}},fn=(e,t)=>{if(void 0!==bn[e])return(0,bn[e])(t)};function yn(e){const t=a(!1),n=ln(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=fn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=ln(e=>e.externalOptions);return{options:o(()=>f(r),[r]),setOptions:n}}function xn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Cn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Tn(e){return String.fromCharCode(e+(e>25?39:97))}function wn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Tn(t%52)+n;return Tn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var kn=/\s*!(important)?/i;function En(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var An=e=>{const t=/* @__PURE__ */new Map;return(...n)=>{const r=JSON.stringify(n);if(t.has(r))return t.get(r);const a=e(...n);return t.set(r,a),a}},In=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Sn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(In.has(n))return;const r=e[n],a=t[n];xn(r)&&xn(a)?e[n]=Sn(r,a):e[n]=a}),e):e,{})}var Nn=e=>null!=e;function Rn(e,t,n={}){const{stop:r,getKey:a}=n;return function e(n,o=[]){if("object"==typeof(i=n)&&null!==i){const i={};for(const[l,s]of Object.entries(n)){const c=a?.(l,s)??l,d=[...o,c];if(r?.(n,d))return t(n,o);const u=e(s,d);Nn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Dn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return Rn(e,e=>{return Array.isArray(e)?(t=e,n=a.breakpoints.keys,t.reduce((e,t,r)=>{const a=n[r];return null!=t&&(e[a]=t),e},{})):e;var t,n},{stop:e=>Array.isArray(e),getKey:n?e=>o?i(e):e:void 0})}var Pn={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Mn=/([A-Z])/g,Ln=/^ms-/,Fn=An(e=>e.startsWith("--")?e:e.replace(Mn,"-$1").replace(Ln,"-ms-").toLowerCase()),On=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Vn=`(?:${"cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%".split(",").join("|")})`,Bn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Vn}$`),Un={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):xn(e)?Rn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&On.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Bn.test(e)},Wn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Cn(t))};const Hn=new Set("_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_supportHover,_notDisabled,_scrolledX,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,1_5xl,1_5xlOnly,1_5xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo1_5xl,smTo2xl,mdToLg,mdToXl,mdTo1_5xl,mdTo2xl,lgToXl,lgTo1_5xl,lgTo2xl,xlTo1_5xl,xlTo2xl,1_5xlTo2xl,@/md,@/lg,@/xl,@tight-component/md,@tight-component/lg,@tight-component/xl,@page/md,@page/lg,@page/xl,@report-table-container/md,@report-table-container/lg,@report-table-container/xl,base".split(",")),zn=/^@|&|&$/;function qn(e){return Hn.has(e)||zn.test(e)}const jn=/^_/,_n=/&|@/,Kn=/* @__PURE__ */new Map;"aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos,top:top,left:left,inset:inset,insetInline:inset-x,insetBlock:inset-y,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e,insetInlineStart:inset-s,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p,paddingLeft:pl,paddingRight:pr,paddingTop:pt,paddingBottom:pb,paddingBlock:py,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px,paddingInlineEnd:pe,paddingInlineStart:ps,marginLeft:ml,marginRight:mr,marginTop:mt,marginBottom:mb,margin:m,marginBlock:my,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx,marginInlineEnd:me,marginInlineStart:ms,spaceX:sx,spaceY:sy,outlineWidth:ring-w,outlineColor:ring-c,outline:ring,outlineOffset:ring-o,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w,inlineSize:w-is,minWidth:min-w,minInlineSize:min-w-is,maxWidth:max-w,maxInlineSize:max-w-is,height:h,blockSize:h-bs,minHeight:min-h,minBlockSize:min-h-bs,maxHeight:max-h,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p,backgroundPositionX:bg-p-x,backgroundPositionY:bg-p-y,backgroundAttachment:bg-a,backgroundClip:bg-cp,background:bg,backgroundColor:bg-c,backgroundOrigin:bg-o,backgroundImage:bg-i,backgroundRepeat:bg-r,backgroundBlendMode:bg-bm,backgroundSize:bg-s,backgroundGradient:bg-grad,backgroundLinear:bg-linear,backgroundRadial:bg-radial,backgroundConic:bg-conic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr,borderTopLeftRadius:bdr-tl,borderTopRightRadius:bdr-tr,borderBottomRightRadius:bdr-br,borderBottomLeftRadius:bdr-bl,borderTopRadius:bdr-t,borderRightRadius:bdr-r,borderBottomRadius:bdr-b,borderLeftRadius:bdr-l,borderStartStartRadius:bdr-ss,borderStartEndRadius:bdr-se,borderStartRadius:bdr-s,borderEndStartRadius:bdr-es,borderEndEndRadius:bdr-ee,borderEndRadius:bdr-e,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x,borderInlineWidth:bd-x-w,borderInlineColor:bd-x-c,borderBlock:bd-y,borderBlockWidth:bd-y-w,borderBlockColor:bd-y-c,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s,borderInlineStartWidth:bd-s-w,borderInlineStartColor:bd-s-c,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e,borderInlineEndWidth:bd-e-w,borderInlineEndColor:bd-e-c,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh,boxShadowColor:bx-sh-c,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x,translateY:translate-y,translateZ:translate-z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor".split(",").forEach(e=>{const[t,n]=e.split(":");Kn.set(t,n)});const Yn={conditions:{shift:function(e){return e.sort((e,t)=>{const n=qn(e),r=qn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Hn.has(e)?e.replace(jn,""):_n.test(e)?`[${En(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Kn.get(e)||Fn(e)}_${En(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},Zn=function(e){const{utility:t,hash:n,conditions:r=Pn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return An(({base:o,...i}={})=>{const l=Dn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return Rn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&kn.test(u),[l,...c]=r.shift(o),d=c.slice().filter(e=>!/* @__PURE__ */(e=>"base"===e)(e));var u;const h=t.transform(l,function(e){return"string"==typeof e?e.replace(kn,"").trim():e}((e=>"string"==typeof e?e.replaceAll(/[\n\s]+/g," "):e)(e)));let p=((e,o)=>{let i;if(n){const n=[...r.finalize(e),o];i=a(t.toHash(n,wn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(Yn),Gn=(...e)=>Zn(Qn(...e));Gn.raw=(...e)=>Qn(...e);const{mergeCss:Qn}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>xn(e)&&Object.keys(Cn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Dn(t,e))}return{mergeCss:An(function(...e){return Sn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(Yn);function Xn(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const Jn=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function $n(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=Jn(e),o=e=>({...r,...Cn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=Qn(i,n[t][a]));const l=function(e,t){let n={};return e.forEach(e=>{Object.entries(e).every(([e,n])=>"css"===e||(Array.isArray(n)?n:[n]).some(n=>t[e]===n))&&(n=Qn(n,e.css))}),n}(a,r);return Qn(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(An(function(e){return Gn(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=Jn(e.config),i=((...e)=>{const t=e.reduce((e,t)=>(t&&t.forEach(t=>e.add(t)),e),/* @__PURE__ */new Set([]));return Array.from(t)})(e.variantKeys,Object.keys(n));return $n({base:Qn(t,o.base),variants:Object.fromEntries(i.map(e=>[e,Qn(n[e],o.variants[e])])),defaultVariants:Sn(r,o.defaultVariants),compoundVariants:[...a,...o.compoundVariants]})},splitVariantProps:function(e){return function(e,...t){const n=Object.getOwnPropertyDescriptors(e),r=Object.keys(n),a=e=>{const t={};for(let r=0;r<e.length;r++){const a=e[r];n[a]&&(Object.defineProperty(t,a,n[a]),delete n[a])}return t};return t.map(e=>a(Array.isArray(e)?e:r.filter(e))).concat(a(r))}(e,l)},getVariantProps:o})}var er,tr=((er=tr||{}).component="component",er["dashboard-placeholder-table"]="dashboard-placeholder-table",er["dashboard-header"]="dashboard-header",er["dashboard-table"]="dashboard-table",er["dashboard-table-body"]="dashboard-table-body",er["dashboard-table-cell"]="dashboard-table-cell",er["dashboard-table-column-header"]="dashboard-table-column-header",er["dashboard-table-header"]="dashboard-table-header",er.label="label",er.popup="popup",er["popup-sort-row"]="popup-sort-row",er["progress-bar"]="progress-bar",er["progress-bar-fill"]="progress-bar-fill",er.drawer="drawer",er.summation="summation",er["table-parent-row"]="table-parent-row",er["table-row"]="table-row",er["table-sub-row"]="table-sub-row",er.tile="tile",er["tile-bar-label"]="tile-bar-label",er["tile-bar-label-outer"]="tile-bar-label-outer",er["tile-body"]="tile-body",er["tile-filter-button"]="tile-filter-button",er["tile-filter-list"]="tile-filter-list",er["tile-filter-row"]="tile-filter-row",er["tile-header"]="tile-header",er["business-owner-dashboard"]="business-owner-dashboard",er["business-owner-dashboard-header"]="business-owner-dashboard-header",er["transaction-type-label"]="transaction-type-label",er["transaction-date-cell-container"]="transaction-date-cell-container",er["selector-row"]="selector-row",er["popup-list"]="popup-list",er.badge="badge",er["badge-chip"]="badge-chip",er["date-cell"]="date-cell",er["vertical-divider"]="vertical-divider",er["horizontal-divider"]="horizontal-divider",er["checkbox-input"]="checkbox-input",er["bulk-select"]="bulk-select",er["button-base"]="button-base",er["button-discreet-small"]="button-discreet-small",er["button-primary"]="button-primary",er["button-secondary"]="button-secondary",er["button-success"]="button-success",er["button-danger"]="button-danger",er["button-warning"]="button-warning",er["button-action"]="button-action",er["button-table-header"]="button-table-header",er["button-inline"]="button-inline",er["small-square-button"]="small-square-button",er.card="card",er["card-button"]="card-button",er["card-button-icon-container"]="card-button-icon-container",er["pagination-button"]="pagination-button",er.text="text",er["cell-button"]="cell-button",er["selector-button"]="selector-button",er["review-status-selector-button"]="review-status-selector-button",er["review-status-dropdown-arrow"]="review-status-dropdown-arrow",er["financial-summary-layout"]="financial-summary-layout",er["financial-summary-chatbox"]="financial-summary-chatbox",er["financial-summary-chatbox-header"]="financial-summary-chatbox-header",er["month-picker"]="month-picker",er["month-picker-left-button"]="month-picker-left-button",er["month-picker-right-button"]="month-picker-right-button",er["month-picker-label"]="month-picker-label",er["filter-bar"]="filter-bar",er["filter-search-bar"]="filter-search-bar",er.pill="pill",er["filter-pill"]="filter-pill",er["email-pill"]="email-pill",er["discreet-form-input"]="discreet-form-input",er["editable-form-input"]="editable-form-input",er["category-text"]="category-text",er["amount-input-container"]="amount-input-container",er["amount-input"]="amount-input",er["modal-popup"]="modal-popup",er["drawer-header"]="drawer-header",er["form-body"]="form-body",er.body="body",er.heading="heading",er["sub-label"]="sub-label",er["strong-label"]="strong-label",er["strong-sub-label"]="strong-sub-label",er["weak-label"]="weak-label",er["metric-xl"]="metric-xl",er["metric-md"]="metric-md",er["large-icon"]="large-icon",er["medium-icon"]="medium-icon",er["small-icon"]="small-icon",er["tiny-icon"]="tiny-icon",er["x-large-icon"]="x-large-icon",er["xx-large-icon"]="xx-large-icon",er["category-icon"]="category-icon",er["card-header"]="card-header",er.icon="icon",er["neutral-badge"]="neutral-badge",er["highlight-badge"]="highlight-badge",er["success-badge"]="success-badge",er["warning-badge"]="warning-badge",er["danger-badge"]="danger-badge",er["critical-badge"]="critical-badge",er["button-group"]="button-group",er["alert-dialog"]="alert-dialog",er["alert-header"]="alert-header",er["emphasis-label"]="emphasis-label",er["profit-loss-graph"]="profit-loss-graph",er.banner="banner",er["banner-high"]="banner-high",er["banner-medium"]="banner-medium",er["banner-low"]="banner-low",er["banner-urgent"]="banner-urgent",er["banner-default"]="banner-default",er["banner-button"]="banner-button",er["banner-button-text"]="banner-button-text",er["banner-button-icon"]="banner-button-icon",er["banner-icon"]="banner-icon",er["banner-title"]="banner-title",er["empty-dashboard-layout"]="empty-dashboard-layout",er["emphasis-sub-label"]="emphasis-sub-label",er["bar-transactions-positive"]="bar-transactions-positive",er["bar-transactions-negative"]="bar-transactions-negative",er["message-sent"]="message-sent",er["message-received"]="message-received",er["date-amount-header"]="date-amount-header",er["close-button"]="close-button",er["start-date-form-section"]="start-date-form-section",er["beginning-balance-form-section"]="beginning-balance-form-section",er["date-picker-nav-button"]="date-picker-nav-button",er["date-picker-day-button"]="date-picker-day-button",er["dropdown-selector-button"]="dropdown-selector-button",er.chip="chip",er["attachment-dropzone"]="attachment-dropzone",er["list-body"]="list-body",er["loading-skeleton"]="loading-skeleton",er["line-item-card"]="line-item-card",er["linked-entity-row"]="linked-entity-row",er["drawer-search-bar"]="drawer-search-bar",er["value-comparison-summary"]="value-comparison-summary",er["category-selector-table-cell"]="category-selector-table-cell",er["zero-state-button"]="zero-state-button",er);const nr=e=>null==e,rr=e=>!nr(e),ar="Tight-",or=e=>`${ar}${e}`;function ir(e){return e in tr}function lr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===ar&&r in tr}function sr(e){return!ir(e)&&!lr(e)}const cr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(or(e)),t.forEach(e=>{nr(e)||(sr(e)?r.push(e):ir(e)?n.push(or(e)):lr(e)&&n.push(e))}),{className:Xn(...n,...r)}},dr=cr(tr["business-owner-dashboard-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function ur({children:e}){return S("div",{...dr,children:e})}function hr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(lr(t)&&e.push(t),e),[])],[])}function pr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(sr(t)&&e.push(t),e),[])],[])}function gr(e){const t=Array.isArray(e)?e:[e];return{className:Xn(...hr(t),...pr(t))}}const mr=$n({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:{xl:"16px",base:"18px"}}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:{xl:"16px",base:"18px"}},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:{xl:"14px",base:"16px"}},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"20px",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"16px"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:{sm:"16px",base:"20px"}},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:{xl:"14px",base:"16px"}},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:{xl:"14px",base:"16px"}}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"25px"}},metric:{sm:{fontWeight:"metric.sm",fontSize:"metric.sm",fontFamily:"metric",color:"typography.metric.sm"},md:{fontWeight:"metric.md",fontSize:"metric.md",fontFamily:"metric",color:"typography.metric.md"},lg:{fontWeight:"metric.lg",fontSize:"metric.lg",fontFamily:"metric",color:"typography.metric.lg"},xl:{fontWeight:"metric.xl",fontSize:"metric.xl",fontFamily:"metric",color:"typography.metric.xl"}}}}),vr=cr(tr.heading,mr({heading:"default"}));function br({children:e,stylists:t=[]}){const n=gr([vr,...t]);return S("div",{...n,children:e})}function fr(e,t,n){return[...e,{accessToken:t,environment:n}]}function yr(e,t){return[...e,t]}function xr(e){return""===e.trim()}function Cr(e){return nr(e)||xr(e)}function Tr(e){return!Cr(e)}const wr=i({activeToken:void 0,accountantToken:void 0});function kr(){const{activeToken:e}=l(wr);return e}const Er=()=>{throw new Error("No access token provided")},Ar=72e5,Ir=new D({defaultOptions:{queries:{gcTime:Ar,staleTime:3e4,refetchInterval:6e4}}}),Sr=i("SANDBOX");function Nr(){return l(Sr)}function Rr({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=M({...n,queryKey:i,queryFn:o?t:Er,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Dr{constructor(e){this.client=e}async sendEvent({apiKey:e,events:t,notifier:n,payloadVersion:r}){const a=/* @__PURE__ */(new Date).toISOString(),o=JSON.stringify({apiKey:e,payloadVersion:r,notifier:n,events:t});await fetch(this.client.endpoints.notify,{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":r,"Bugsnag-Sent-At":a},referrerPolicy:"no-referrer",body:o})}}const Pr=Symbol("Circular"),Mr=Symbol("AccessError");function Lr(e,t,n){return Fr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Fr({key:e,value:t,replacer:n,seen:r,depthLimit:a=1/0,depth:o,edgeIndex:i,edgesLimit:l=1/0}){let s=t;if(r.includes(s)&&(s=Pr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Or(()=>s.toJSON(String(e)))),null===s||"object"!=typeof s)return s;var c;if(o>a||i+1>l)return"[...]";if(r.push(t),Array.isArray(s)){const e=[],t=Math.min(s.length,l);for(let i=0;i<t;i++){const t=Or(()=>s[i]);e.push(Fr({key:i,value:t,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l}))}t<s.length&&e.push("[...]"),s=e}else{const e={},t=Object.keys(s);for(let i=0;i<t.length;i++){const c=t[i],d=Or(()=>s[c]);e[c]=Fr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Or(e){try{return e()}catch{return Mr}}const Vr=Object.prototype.toString,Br=Object.getPrototypeOf;function Ur(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Wr=/^\s*at .*(\S+:\d+|\(native\))/m,Hr=/^(eval@)?(\[native code])?$/;function zr(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)return[e];const n=t[2]?parseInt(t[2],10):void 0,r=t[3]?parseInt(t[3],10):void 0;return[t[1],n,r]}function qr(e,t){const n=jr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Ur(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[_r(n)];return a.push(...Zr(n).map(e=>_r(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function jr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Vr.call(t))return!0;t=Br(t)}return!1}(e))return e;let n=function(e){if(!Ur(e))return null;const t=t=>{const n=e[t];if("string"==typeof n&&e[t.length])return n},n=t("name")||t("errorClass"),r=t("message")||t("errorMessage");if(!n||!r)return null;const a=new Error(r);return a.name=n,a}(e);if(n)return n;switch(typeof n){case"string":case"number":case"boolean":return new Error(String(e));default:return n=new Error(`${t} received a non-error. See "${t}" tab for more detail.`),n.name="InvalidError",n}}function _r(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:Kr(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function Kr(e,{backtrace:t}){const n=function(e){let t=e.stack;return void 0===t&&(t=e.stacktrace),"string"==typeof t&&t.length&&t!==`${e.name}: ${e.message}`?t:void 0}(e);return n?function(e){return(e.match(Wr)?e.split("\n").filter(e=>!!e.match(Wr)).map(e=>{e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),a=zr(n?n[1]:r.pop()||"(no location)"),o=r.join(" ")||void 0;return{file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2],method:o}}):(t=e,t.split("\n").filter(e=>!e.match(Hr)).map(e=>{if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{method:e};{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=zr(e.replace(t,""));return{file:a[0],lineNumber:a[1],columnNumber:a[2],method:r}}}))).reduce((e,t)=>{if("{}"===JSON.stringify(t))return e;let n=t.file||t.method||"number"!=typeof t.lineNumber?t.file||"(unknown file)":"global code";n=n.replace(/\?.*$/,"").replace(/#.*$/,"");let r=t.method||"(unknown function)";return r=/^global code$/i.test(r)?"global code":r,e.concat([{file:n,lineNumber:t.lineNumber,columnNumber:t.columnNumber,method:r}])},[]);var t}(n):t?function(){const e=[];let t;try{t=arguments.callee}catch{return[]}for(;t&&e.length<Yr;){t.name?e.push({method:t.name,file:"(unknown file)"}):/function(?:\s+([\w$]+))+\s*\(/.test(t.toString())&&e.push({method:RegExp.$1,file:"(unknown file)"});try{t=t.caller}catch{break}}return e}():[]}const Yr=20;function Zr(e){const t=e;if(t.cause){const e=jr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(Zr(e))}return[]}function Gr(...e){console.error}const Qr={name:"errorBreadcrumbs",load(e){e.addOnPostError(t=>{e.leaveBreadcrumb(t.exceptions[0].errorClass,{errorClass:t.exceptions[0].errorClass,errorMessage:t.exceptions[0].message,severity:t.severity},"error")})}};let Xr=Date.now();const Jr=()=>{Xr=Date.now()},$r={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-Xr,!0}),{reset:Jr})},ea=[["Edge (EdgeHTML)",/Edge\/([0-9._]+)/],["Edge (iOS)",/EdgiOS\/([0-9._]+)/],["Yandex",/YaBrowser\/([0-9._]+)/],["KakaoTalk",/KAKAOTALK\s([0-9.]+)/],["Samsung",/SamsungBrowser\/([0-9.]+)/],["Silk",/\bSilk\/([0-9._-]+)\b/],["MIUI",/MiuiBrowser\/([0-9.]+)$/],["Beaker",/BeakerBrowser\/([0-9.]+)/],["Edge (Chromium)",/EdgA?\/([0-9.]+)/],["Chromium WebView",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome (iOS)",/CriOS\/([0-9.]+)(:?\s|$)/],["Firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["Firefox (iOS)",/FxiOS\/([0-9.]+)/],["Opera Mini",/Opera Mini.*Version\/([0-9.]+)/],["Opera",/Opera\/([0-9.]+)(?:\s|$)/],["Opera",/OPR\/([0-9.]+)(:?\s|$)/],["Internet Explorer",/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/],["Internet Explorer",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["Internet Explorer",/MSIE\s(7\.0)/],["Blackberry",/BB10;\sTouch.*Version\/([0-9.]+)/],["Android",/Android\s([0-9.]+)/],["Safari (iOS)",/Version\/([0-9._]+).*Mobile.*Safari.*/],["Safari",/Version\/([0-9._]+).*Safari/],["Facebook",/FB[AS]V\/([0-9.]+)/],["Instagram",/Instagram\s([0-9.]+)/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Mobile/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Gecko\)$/]],ta=[["iOS",void 0,/iP(hone|od|ad)/],["Android",void 0,/Android/],["BlackBerry",void 0,/BlackBerry|BB10/],["Windows Mobile",void 0,/IEMobile/],["Kindle",void 0,/Kindle/],["Windows","3.11",/Win16/],["Windows","95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows","98",/(Windows 98)|(Win98)/],["Windows","2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows","XP",/(Windows NT 5.1)|(Windows XP)/],["Windows","Server 2003",/(Windows NT 5.2)/],["Windows","Vista",/(Windows NT 6.0)/],["Windows","7",/(Windows NT 6.1)/],["Windows","8",/(Windows NT 6.2)/],["Windows","8.1",/(Windows NT 6.3)/],["Windows","10+",/(Windows NT 10.0)/],["Windows","ME",/Windows ME/],["Open BSD",void 0,/OpenBSD/],["Sun OS",void 0,/SunOS/],["Chrome OS",void 0,/CrOS/],["Linux",void 0,/(Linux)|(X11)/],["Mac OS",void 0,/(Mac_PowerPC)|(Macintosh)/],["QNX",void 0,/QNX/],["BeOS",void 0,/BeOS/],["OS/2",void 0,/OS\/2/]],na=(ra=function(e){const t=""!==(n=e)&&ea.reduce((e,[t,r])=>{if(e)return e;const a=r.exec(n);return!!a&&[t,a]},!1);var n;if(!t)return{};const[r,a]=t,o=function(e){for(const[t,n,r]of ta)if(r.exec(e))return{osName:t,osVersion:n};return null}(e),i="iOS"===o?.osName?function(e){const t=/iPad|iPhone|iPod/.exec(e);return t?{manufacturer:"Apple",model:t[0]}:/MacIntel/.test(e)&&self.navigator&&self.navigator.maxTouchPoints&&self.navigator.maxTouchPoints>2?{manufacturer:"Apple",model:"iPad"}:null}(e):{};return{browserName:r,browserVersion:a[1],osName:o?.osName,osVersion:o?.osVersion,manufacturer:i?.manufacturer,model:i?.model}},{name:"browserContext",load(e){e.addOnError(e=>{e.request={...e.request,url:self.location.href},e.context=e.context||self.location.pathname,e.device={...e.device,...ra(self.navigator.userAgent),locale:self.navigator.language,userAgent:self.navigator.userAgent};let t=["n/a"];try{t=self.navigator.languages}catch{}return e.metaData={...e.metaData,language:{language:self.navigator.language,languages:t}},!0})}});var ra;class aa{limit;period;events;constructor(e,t){this.limit=e,this.period=t,this.events=new B}reset(){this.events.clear()}increment(){const e=/* @__PURE__ */(new Date).getTime();if(void 0!==this.period){let t=this.events.peek();for(;void 0!==t&&e-this.period>t;)this.events.dequeue(),t=this.events.peek()}const t=this.events.size+1<=this.limit;return t&&this.events.enqueue(e),t}get size(){return this.events.size}}class oa extends s{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}handleClearError(){this.setState({error:void 0,errorInfo:void 0})}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){const{exceptions:n,metadata:r}=qr(e,"notify");t&&t.componentStack&&(t.componentStack=function(e){const t=e.split(/\s*\n\s*/g);let n="";for(let r=0,a=t.length;r<a;r++)t[r].length&&(n+=`${n.length?"\n":""}${t[r]}`);return n}(t.componentStack));const{onError:a,client:o}=this.props;o.notifyEvent({exceptions:n,unhandled:!0,severity:"error",severityReason:{type:"unhandledException"},metadata:{...r,react:t},onError:a},e),this.setState({errorInfo:t})}render(){const{error:e}=this.state;if(e){const{FallbackComponent:e}=this.props;if(e)return S(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return S(N,{children:this.props.children})}}const ia={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>S(oa,{client:e,onError:t,FallbackComponent:n,children:r})})},la=new class{breadcrumbs=[];config;delivery=new Dr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return Gr(),this;let t;this.config=e,this.config.onError&&(t=Array.isArray(this.config.onError)?this.config.onError:[this.config.onError]),this.errorCallbacks=new Set(t);for(const n of this.config.plugins||[])this.plugins.push({name:n.name||"unknown",plugin:n.load(this)});return this}get endpoints(){return{notify:this.config?.endpoints?.notify||"https://notify.bugsnag.com/"}}notify(e,t={}){const{exceptions:n,metadata:r}=qr(e,"notify");let a,o,i=r;return"function"==typeof t?a=t:(o=t.severity,t.metadata&&(i={...r,...t.metadata})),this.notifyEvent({exceptions:n,metadata:i,severity:o,onError:a},e)}leaveBreadcrumb(e,t,n){if(!this.config)return;if("string"!=typeof e)try{e=String(e)}catch{e="Unable to stringify breadcrumb message"}if(!e.length)return;this.breadcrumbs.push({name:e,metaData:t,type:n||"manual",timestamp:/* @__PURE__ */(new Date).toISOString()});const{maxBreadcrumbs:r=25}=this.config;this.breadcrumbs.length>r&&this.breadcrumbs.splice(0,this.breadcrumbs.length-r)}async notifyEvent({exceptions:e,unhandled:t,severity:n,severityReason:r,metadata:a,onError:o},i){if(!this.config)return;const l=this.config.releaseStage||"production";if(this.config.enabledReleaseStages&&!this.config.enabledReleaseStages.includes(l))return;const s={exceptions:e,breadcrumbs:this.breadcrumbs.length?this.breadcrumbs:void 0,originalError:i,unhandled:"boolean"==typeof t&&t,severity:n||"warning",severityReason:r,user:this.config.user||void 0,app:{releaseStage:l,version:this.config.appVersion,type:this.config.appType||("object"==typeof window?"browser":"node")},device:{time:/* @__PURE__ */(new Date).toISOString()},metaData:a||{}},c=[...this.errorCallbacks];o&&c.push(o);const d=["stringifyValues","redact"];c.sort((e,t)=>d.includes(e.name)&&d.includes(t.name)?0:d.includes(e.name)?1:d.includes(t.name)?-1:0);for(const m of c){const e=await m(s);if("boolean"==typeof e&&!e)return}const u=Lr(s,(e,t)=>{if("originalError"!==e)return t},{depthLimit:20,edgesLimit:500});let h;const p={apiKey:this.config.apiKey,payloadVersion:"5",notifier:{name:"Tight Components",version:"1",url:"https://github.com/tight-embedded/TraxComponents/tree/dev/packages/react/src/bugsnag/README.md"},events:[u]};try{h=JSON.stringify(p)}catch{u.metaData={notifier:"Unable to serialize metadata"},h=JSON.stringify(p)}if(h.length>1e6&&(u.metaData={notifier:`Payload was ${h.length/1e6}Mb. Metadata removed.`},h=JSON.stringify(p),h.length>1e6))throw new Error("Payload exceeded 1Mb limit");for(const m of this.postErrorCallbacks)m(s);try{await this.delivery.sendEvent(p)}catch(g){Gr()}}getUser(){return this.config?.user||{}}setUser(e,t,n){this.config&&(this.config.user={id:e,email:t,name:n})}setProperties(e){this.config&&(this.config.releaseStage=e)}addOnError(e){this.errorCallbacks.add(e)}removeOnError(e){this.errorCallbacks.delete(e)}addOnPostError(e){this.postErrorCallbacks.add(e)}removeOnPostError(e){this.postErrorCallbacks.delete(e)}getPlugin(e){return this.plugins.find(t=>t.name===e)?.plugin}setDelivery(e){this.delivery=e}};let sa="",ca="";const da="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",ua=la.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.7.1",appType:"browser",releaseStage:da,enabledReleaseStages:["prod","DEV"],plugins:[$r,na,Qr,(()=>{const e=new aa(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),ia]}),ha=(e,t)=>{try{la.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?pa({error:n,severity:"error"}):pa({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},pa=async e=>{try{await la.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:sa,environment:ca}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await pa({error:t,severity:"error"}):await pa({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},ga=ua.getPlugin("react"),ma=ga?.BugsnagErrorBoundary,va=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,ba=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},fa=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},ya={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function xa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...x(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?ya:{}}});return{url:(n=e.endpointManager.getUrl(e.path),r=e.pathParams,void 0!==r&&Object.entries(r).forEach(([e,t])=>{n=n.replace(`{${e}}`,t)}),n),headers:t};var n,r}async function Ca({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=ba({extraHeaders:t,authorization:e});ha("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ha("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),fa(e)}catch(l){return Promise.reject(l)}}async function Ta(e){const{url:t,headers:n}=xa(e);return Ca({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function wa(e){return Ta(e)}async function ka(e){return Ta(e)}const Ea=(e,t)=>({getUrl:t=>((e,t)=>{let n=t;for(;n.length>0&&"/"===n.charAt(0);)n=n.slice(1);return`${e}/${n}`})(e,t),baseUrl:e,apiVersion:t}),Aa={DEVELOPMENT:"https://dev.hurdlr.com/rest",PRODUCTION:"https://prod.hurdlr.com/rest",SANDBOX:"https://sandbox.hurdlr.com/rest",LOCAL:"http://localhost:8081/TraxAngular/rest",DEVELOPMENT_RC:"https://dev.hurdlr.com/rest",SANDBOX_RC:"https://sandbox.hurdlr.com/rest",PRODUCTION_RC:"https://prod.hurdlr.com/rest"},Ia={DEVELOPMENT:"https://dev.tight.com",PRODUCTION:"https://prod.tight.com",SANDBOX:"https://sandbox.tight.com",LOCAL:"http://localhost:8080",DEVELOPMENT_RC:"https://qa.dev.tight.com",SANDBOX_RC:"https://qa.sandbox.tight.com",PRODUCTION_RC:"https://qa.prod.tight.com"},Sa={...Ia,LOCAL:"http://localhost:8082"};function Na(e){return Ea(`${t=e,Aa[t]}/v5`,"v5");var t}const Ra=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Da=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Na(a)};return await ka(o)};function Pa({filter:e,grouping:t,select:n,accountingMethod:r}){return Rr({queryKey:Ra({filter:e,grouping:t,accountingMethod:r}),queryFn:Da,select:n})}const Ma="noDataHeight";function La(e){const t=Pt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function Fa(e){const t=La(e.period?.beginDate),n=e.netIncome??0,{profit:r,remainingIncome:a,loss:o,remainingExpenses:i}=function(e,t,n){const r=e>0?e:0,a=e<0?e:0;return{profit:r,remainingIncome:void 0!==t?U(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?U(n).plus(a).toNumber():0}}(n,e.income?.total,e.expenses?.total);return{month:{month:t,income:a,expenses:-i,profit:r,loss:o,netIncome:n,hasNoData:/* @__PURE__ */function(e,t,n){return 0===e&&0===t&&0===n}(n,a,i)},netIncome:n}}function Oa(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(nr(n))return t;for(const i of n){const{month:e,netIncome:n}=Fa(i);t.total=U(n).plus(t.total).toNumber(),t.months.push(e)}const{domainMin:r,domainMax:a}=n.reduce((e,t)=>({domainMin:Math.min(e.domainMin,-(t.expenses?.total??0)),domainMax:Math.max(e.domainMax,t.income?.total??0)}),{domainMin:0,domainMax:0});t.domain=[r,a],t.hasAnyData=t.months.some(e=>!e.hasNoData);const o=function(e,t){const n=t-e;return n>0?.03*n:3}(r,a);return t.months=t.months.map(e=>e.hasNoData?{...e,noDataHeight:o}:e),t}const Va="MONTHLY",Ba=cr(tr["tile-header"],Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ua({title:e}){return S("div",{...Ba,children:S(br,{children:e})})}const Wa=cr(tr["tile-body"],Gn({display:"flex",justifyContent:"start",alignItems:"start",flexDirection:"column",gap:"20px",height:"100%",padding:"20px 15px",backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderBottomRadius:"lg",borderTop:"hidden"}));function Ha({children:e}){return S("div",{...Wa,children:e})}const za=$n({base:{display:"flex",flexDirection:"column",boxShadow:"box-shadow",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg",overflow:"hidden"},variants:{type:{default:{minWidth:"295px",maxWidth:"426px",width:"100%",height:"295px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function qa({children:e,type:t,isSample:n=!1}){const r=cr(tr.tile,za({type:t,isSample:n}));return S("div",{...r,children:e})}const ja=Gn({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),_a=Gn.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),Ka=Gn.raw({whiteSpace:"normal",overflowWrap:"break-word"}),Ya=Gn.raw({overflow:"visible",whiteSpace:"nowrap"}),Za=Gn({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"12px"}),Ga=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px"}),Qa=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"16px"}),Xa=Gn.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"14px"}),Ja=cr(tr.text,Gn({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function $a({children:e}){return S("div",{...Ja,children:e})}const eo=cr(tr["metric-xl"],mr({metric:"xl"}));function to(e){return S("div",{...eo,children:e.children})}const no=cr(tr.summation,Gn({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function ro({title:e,label:t}){return R("div",{...no,children:[S(to,{children:e}),S($a,{children:t})]})}const ao=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function oo({children:e}){return S("div",{...ao,children:e})}const io=(e,t=0)=>{const n=Math.abs(e);let r;if(t<=0)r=Math.round(n);else{const e=n.toFixed(t);r=parseFloat(e)}return Math.sign(e)*r},lo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),so=1e9;function co(e,t={}){const{cents:n="default",condense:r=!1,dollarSign:a=!1,decorator:o,signage:i="default"}=t,l="string"==typeof e?parseFloat(e):e;if(Number.isNaN(l))return"";let s;const c=Math.abs(l);let d;if(r&&c>99999)d=Math.sign(l)<0,s=function(e){const t=Math.floor((n=e,Math.log(n)/Math.log(1e3)))-1;var n;const r=Math.pow(1e3,t),a=Math.round(e/r),o=a*r;let i,l=a/1e3;return e<so&&l>=1e3&&(l/=1e3),o>=so?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${lo(l,0,1)}${i}`}(c);else{const{minPrecision:e,precision:t,roundedValue:r}=function(e,t){if("floor"===t)return{precision:0,minPrecision:0,roundedValue:(n=e,Math.sign(n)*Math.floor(Math.abs(n)))};if("round"===t){const t=0;return{precision:t,minPrecision:0,roundedValue:io(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:io(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:io(e,t)}}{const t=2,n=io(e,t);return{precision:t,roundedValue:n,minPrecision:n%1==0?0:2}}var n}(l,n);d=Math.sign(r)<0;const a=Math.abs(r);s=lo(a,e,t)}if(a)return function(e,t,n,r){let a=e;const o=n?"$":"";return void 0===r||"off"===r?a=`${o}${e}`:"parens"===r?a=`${o}${t?`(${e})`:e}`:"always"===r?a=`${t?"-":"+"}${o}${e}`:"default"===r&&(a=`${t?"-":""}${o}${e}`),a}(s,d,a,i);const u=(h=s,"$"===(p=o)?`${p}${h}`:"%"===p?`${h}${p}`:h);var h,p;return"off"===i?u:"parens"===i?d?`(${u})`:u:"always"===i?`${d?"-":"+"}${u}`:"default"===i?`${d?"-":""}${u}`:u}function uo(e){return co(e,{condense:!0,dollarSign:!0})}function ho(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function po(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function go(e,t){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const mo=$n({variants:{wrap:{ellipsis:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function vo({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Cr(n))return null;const a=gr([cr(tr["strong-label"],tr.text,mr({label:"strongLabel"}),mo({wrap:e,textAlign:t})),...r]);return S("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const bo=$n({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"16px",fontStyle:"normal",xl:{lineHeight:"14px",fontSize:"label.sub"}},variants:{intent:{weak:{color:"typography.base.weak"},normal:{color:"typography.label.sub"},action:{color:"typography.intent.action"},primary:{color:"typography.intent.primary"},danger:{color:"typography.accent.danger"}},accent:{action:{_supportHover:{color:"typography.accent.action",transition:"color 100ms ease-out"},transition:"color 300ms ease-out"},active:{color:"typography.accent.action"},strongest:{color:"brand.action.strongest"}},wrap:{ellipsis:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:_a,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function fo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=cr(tr["sub-label"],tr.text,bo({intent:e,wrap:t,accent:r}),ja);return Cr(n)?null:S("div",{...a,children:n})}const yo=cr(null,Gn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"10px",width:"fit-content",height:"fit-content"}));function xo({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ma)return null;let n=t[0].value??0;return"expenses"===t[0].dataKey?n+=t[0].payload.loss:"income"===t[0].dataKey&&(n+=t[0].payload.profit),R("div",{...yo,children:[S(vo,{children:t[0].name??""}),S(fo,{children:uo(Number(n))})]})}const Co={"colors.white100":{value:"#FFFFFF",variable:"var(--Tight-colors-white100)"},"colors.white200":{value:"#F9F9F9",variable:"var(--Tight-colors-white200)"},"colors.white300":{value:"#EDEDED",variable:"var(--Tight-colors-white300)"},"colors.white600":{value:"#E7E8E9",variable:"var(--Tight-colors-white600)"},"colors.white700":{value:"#E0E2E3",variable:"var(--Tight-colors-white700)"},"colors.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"colors.black200":{value:"#A7ACAD",variable:"var(--Tight-colors-black200)"},"colors.black300":{value:"#A4A9AB",variable:"var(--Tight-colors-black300)"},"colors.black400":{value:"#6F7576",variable:"var(--Tight-colors-black400)"},"colors.black600":{value:"#50595C",variable:"var(--Tight-colors-black600)"},"colors.black700":{value:"#182428",variable:"var(--Tight-colors-black700)"},"colors.black800":{value:"#030506",variable:"var(--Tight-colors-black800)"},"colors.blue200":{value:"#EDFAFC",variable:"var(--Tight-colors-blue200)"},"colors.blue300":{value:"#DAF4FA",variable:"var(--Tight-colors-blue300)"},"colors.blue400":{value:"#CAECF3",variable:"var(--Tight-colors-blue400)"},"colors.blue500":{value:"#94D8E8",variable:"var(--Tight-colors-blue500)"},"colors.blue700":{value:"#2AB2D1",variable:"var(--Tight-colors-blue700)"},"colors.blue900":{value:"#177F96",variable:"var(--Tight-colors-blue900)"},"colors.green100":{value:"#EDFAF4",variable:"var(--Tight-colors-green100)"},"colors.green200":{value:"#DBF9EA",variable:"var(--Tight-colors-green200)"},"colors.green300":{value:"#B8F3D5",variable:"var(--Tight-colors-green300)"},"colors.green400":{value:"#94E8BD",variable:"var(--Tight-colors-green400)"},"colors.green500":{value:"#5FDD9C",variable:"var(--Tight-colors-green500)"},"colors.green700":{value:"#009C75",variable:"var(--Tight-colors-green700)"},"colors.green900":{value:"#067559",variable:"var(--Tight-colors-green900)"},"colors.yellow200":{value:"#FFF3C3",variable:"var(--Tight-colors-yellow200)"},"colors.yellow300":{value:"#FFE787",variable:"var(--Tight-colors-yellow300)"},"colors.yellow400":{value:"#FCD34D",variable:"var(--Tight-colors-yellow400)"},"colors.yellow500":{value:"#FBBF24",variable:"var(--Tight-colors-yellow500)"},"colors.yellow700":{value:"#F59E0B",variable:"var(--Tight-colors-yellow700)"},"colors.yellow800":{value:"#B35F00",variable:"var(--Tight-colors-yellow800)"},"colors.red200":{value:"#FFCBCB",variable:"var(--Tight-colors-red200)"},"colors.red300":{value:"#FF9797",variable:"var(--Tight-colors-red300)"},"colors.red400":{value:"#F45C5C",variable:"var(--Tight-colors-red400)"},"colors.red500":{value:"#E84747",variable:"var(--Tight-colors-red500)"},"colors.red700":{value:"#E42525",variable:"var(--Tight-colors-red700)"},"fonts.base":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-base)"},"fontSizes.sm":{value:"12px",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"14px",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"16px",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"20px",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"24px",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.sm":{value:"400",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"600",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"900",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.sm":{value:"1px",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"2px",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"4px",variable:"var(--Tight-radii-lg)"},"borderWidths.sm":{value:"0.5px",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"1px",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"1px",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"2px",variable:"var(--Tight-borderWidths-xl)"},"animations.appear.instant":{value:"0.25s linear fade-in",variable:"var(--Tight-animations-appear-instant)"},"animations.appear.delay":{value:"0.25s linear both 1.5s fade-in",variable:"var(--Tight-animations-appear-delay)"},"animations.shimmer":{value:"2s ease-in-out infinite shimmer",variable:"var(--Tight-animations-shimmer)"},"animations.spin":{value:"1.5s ease-in-out 0.1s spin infinite",variable:"var(--Tight-animations-spin)"},"shadows.box-shadow":{value:"0px 10px 30px 0px rgba(0, 0, 0, 0.05), 0px 4px 12px 0px rgba(0, 0, 0, 0.15) ",variable:"var(--Tight-shadows-box-shadow)"},"breakpoints.sm":{value:"640px",variable:"var(--Tight-breakpoints-sm)"},"breakpoints.md":{value:"850px",variable:"var(--Tight-breakpoints-md)"},"breakpoints.lg":{value:"1024px",variable:"var(--Tight-breakpoints-lg)"},"breakpoints.xl":{value:"1280px",variable:"var(--Tight-breakpoints-xl)"},"breakpoints.1_5xl":{value:"1400px",variable:"var(--Tight-breakpoints-1_5xl)"},"breakpoints.2xl":{value:"1536px",variable:"var(--Tight-breakpoints-2xl)"},"sizes.breakpoint-sm":{value:"640px",variable:"var(--Tight-sizes-breakpoint-sm)"},"sizes.breakpoint-md":{value:"850px",variable:"var(--Tight-sizes-breakpoint-md)"},"sizes.breakpoint-lg":{value:"1024px",variable:"var(--Tight-sizes-breakpoint-lg)"},"sizes.breakpoint-xl":{value:"1280px",variable:"var(--Tight-sizes-breakpoint-xl)"},"sizes.breakpoint-1_5xl":{value:"1400px",variable:"var(--Tight-sizes-breakpoint-1_5xl)"},"sizes.breakpoint-2xl":{value:"1536px",variable:"var(--Tight-sizes-breakpoint-2xl)"},"colors.brand.primary.weaker":{value:"var(--Tight-colors-black200)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-black800)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-blue200)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-blue300)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-blue500)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-blue700)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-blue900)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-green100)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-green300)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-green500)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-green900)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-yellow200)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-yellow300)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-yellow500)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-yellow700)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-yellow800)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-red300)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-red500)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"transparent",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.accent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-green200)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"rgba(0, 0, 0, 0.5)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"transparent",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"none",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"currentColor",variable:"var(--Tight-colors-currentColor)"},"fonts.body":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-body)"},"fonts.label":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-label)"},"fonts.heading":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-heading)"},"fonts.metric":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-metric)"},"fontWeights.global":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-global)"},"fontWeights.body":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-body)"},"fontWeights.label":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label)"},"fontWeights.label.strong":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strong)"},"fontWeights.label.sub":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label-sub)"},"fontWeights.label.strongSub":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strongSub)"},"fontWeights.label.emphasisSub":{value:"var(--Tight-fontWeights-lg)",variable:"var(--Tight-fontWeights-label-emphasisSub)"},"fontWeights.heading":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-heading)"},"fontWeights.title":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-title)"},"fontWeights.metric.sm":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-sm)"},"fontWeights.metric.md":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-md)"},"fontWeights.metric.lg":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-lg)"},"fontWeights.metric.xl":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-xl)"},"fontSizes.title":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-title)"},"fontSizes.body":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-body)"},"fontSizes.label":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label)"},"fontSizes.label.strong":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label-strong)"},"fontSizes.label.sub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-sub)"},"fontSizes.label.strongSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-strongSub)"},"fontSizes.label.emphasisSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-emphasisSub)"},"fontSizes.heading":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-heading)"},"fontSizes.metric.sm":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-metric-sm)"},"fontSizes.metric.md":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-metric-md)"},"fontSizes.metric.lg":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-metric-lg)"},"fontSizes.metric.xl":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-metric-xl)"},"colors.colorPalette":{value:"var(--Tight-colors-colorPalette)",variable:"var(--Tight-colors-colorPalette)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.primary":{value:"var(--Tight-colors-colorPalette-primary)",variable:"var(--Tight-colors-colorPalette-primary)"},"colors.colorPalette.primary.strong":{value:"var(--Tight-colors-colorPalette-primary-strong)",variable:"var(--Tight-colors-colorPalette-primary-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.secondary.weaker":{value:"var(--Tight-colors-colorPalette-secondary-weaker)",variable:"var(--Tight-colors-colorPalette-secondary-weaker)"},"colors.colorPalette.secondary.weak":{value:"var(--Tight-colors-colorPalette-secondary-weak)",variable:"var(--Tight-colors-colorPalette-secondary-weak)"},"colors.colorPalette.secondary":{value:"var(--Tight-colors-colorPalette-secondary)",variable:"var(--Tight-colors-colorPalette-secondary)"},"colors.colorPalette.secondary.strong":{value:"var(--Tight-colors-colorPalette-secondary-strong)",variable:"var(--Tight-colors-colorPalette-secondary-strong)"},"colors.colorPalette.action.opaque":{value:"var(--Tight-colors-colorPalette-action-opaque)",variable:"var(--Tight-colors-colorPalette-action-opaque)"},"colors.colorPalette.opaque":{value:"var(--Tight-colors-colorPalette-opaque)",variable:"var(--Tight-colors-colorPalette-opaque)"},"colors.colorPalette.action.weaker":{value:"var(--Tight-colors-colorPalette-action-weaker)",variable:"var(--Tight-colors-colorPalette-action-weaker)"},"colors.colorPalette.action.weak":{value:"var(--Tight-colors-colorPalette-action-weak)",variable:"var(--Tight-colors-colorPalette-action-weak)"},"colors.colorPalette.action":{value:"var(--Tight-colors-colorPalette-action)",variable:"var(--Tight-colors-colorPalette-action)"},"colors.colorPalette.action.strong":{value:"var(--Tight-colors-colorPalette-action-strong)",variable:"var(--Tight-colors-colorPalette-action-strong)"},"colors.colorPalette.action.stronger":{value:"var(--Tight-colors-colorPalette-action-stronger)",variable:"var(--Tight-colors-colorPalette-action-stronger)"},"colors.colorPalette.action.strongest":{value:"var(--Tight-colors-colorPalette-action-strongest)",variable:"var(--Tight-colors-colorPalette-action-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"colors.colorPalette.background.hover":{value:"var(--Tight-colors-colorPalette-background-hover)",variable:"var(--Tight-colors-colorPalette-background-hover)"},"colors.colorPalette.hover":{value:"var(--Tight-colors-colorPalette-hover)",variable:"var(--Tight-colors-colorPalette-hover)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.hover":{value:"var(--Tight-colors-colorPalette-foreground-hover)",variable:"var(--Tight-colors-colorPalette-foreground-hover)"},"colors.colorPalette.foreground.disabled":{value:"var(--Tight-colors-colorPalette-foreground-disabled)",variable:"var(--Tight-colors-colorPalette-foreground-disabled)"},"colors.colorPalette.disabled":{value:"var(--Tight-colors-colorPalette-disabled)",variable:"var(--Tight-colors-colorPalette-disabled)"},"colors.colorPalette.elevated":{value:"var(--Tight-colors-colorPalette-elevated)",variable:"var(--Tight-colors-colorPalette-elevated)"},"colors.colorPalette.elevated.hover":{value:"var(--Tight-colors-colorPalette-elevated-hover)",variable:"var(--Tight-colors-colorPalette-elevated-hover)"},"colors.colorPalette.intent.primary":{value:"var(--Tight-colors-colorPalette-intent-primary)",variable:"var(--Tight-colors-colorPalette-intent-primary)"},"colors.colorPalette.intent.primary.hover":{value:"var(--Tight-colors-colorPalette-intent-primary-hover)",variable:"var(--Tight-colors-colorPalette-intent-primary-hover)"},"colors.colorPalette.primary.hover":{value:"var(--Tight-colors-colorPalette-primary-hover)",variable:"var(--Tight-colors-colorPalette-primary-hover)"},"colors.colorPalette.intent.primary.active":{value:"var(--Tight-colors-colorPalette-intent-primary-active)",variable:"var(--Tight-colors-colorPalette-intent-primary-active)"},"colors.colorPalette.primary.active":{value:"var(--Tight-colors-colorPalette-primary-active)",variable:"var(--Tight-colors-colorPalette-primary-active)"},"colors.colorPalette.active":{value:"var(--Tight-colors-colorPalette-active)",variable:"var(--Tight-colors-colorPalette-active)"},"colors.colorPalette.intent.primary.disabled":{value:"var(--Tight-colors-colorPalette-intent-primary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-primary-disabled)"},"colors.colorPalette.primary.disabled":{value:"var(--Tight-colors-colorPalette-primary-disabled)",variable:"var(--Tight-colors-colorPalette-primary-disabled)"},"colors.colorPalette.intent.secondary":{value:"var(--Tight-colors-colorPalette-intent-secondary)",variable:"var(--Tight-colors-colorPalette-intent-secondary)"},"colors.colorPalette.intent.secondary.hover":{value:"var(--Tight-colors-colorPalette-intent-secondary-hover)",variable:"var(--Tight-colors-colorPalette-intent-secondary-hover)"},"colors.colorPalette.secondary.hover":{value:"var(--Tight-colors-colorPalette-secondary-hover)",variable:"var(--Tight-colors-colorPalette-secondary-hover)"},"colors.colorPalette.intent.secondary.active":{value:"var(--Tight-colors-colorPalette-intent-secondary-active)",variable:"var(--Tight-colors-colorPalette-intent-secondary-active)"},"colors.colorPalette.secondary.active":{value:"var(--Tight-colors-colorPalette-secondary-active)",variable:"var(--Tight-colors-colorPalette-secondary-active)"},"colors.colorPalette.intent.secondary.disabled":{value:"var(--Tight-colors-colorPalette-intent-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-secondary-disabled)"},"colors.colorPalette.secondary.disabled":{value:"var(--Tight-colors-colorPalette-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-secondary-disabled)"},"colors.colorPalette.intent.action":{value:"var(--Tight-colors-colorPalette-intent-action)",variable:"var(--Tight-colors-colorPalette-intent-action)"},"colors.colorPalette.intent.action.hover":{value:"var(--Tight-colors-colorPalette-intent-action-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-hover)"},"colors.colorPalette.action.hover":{value:"var(--Tight-colors-colorPalette-action-hover)",variable:"var(--Tight-colors-colorPalette-action-hover)"},"colors.colorPalette.intent.action.active":{value:"var(--Tight-colors-colorPalette-intent-action-active)",variable:"var(--Tight-colors-colorPalette-intent-action-active)"},"colors.colorPalette.action.active":{value:"var(--Tight-colors-colorPalette-action-active)",variable:"var(--Tight-colors-colorPalette-action-active)"},"colors.colorPalette.intent.action.disabled":{value:"var(--Tight-colors-colorPalette-intent-action-disabled)",variable:"var(--Tight-colors-colorPalette-intent-action-disabled)"},"colors.colorPalette.action.disabled":{value:"var(--Tight-colors-colorPalette-action-disabled)",variable:"var(--Tight-colors-colorPalette-action-disabled)"},"colors.colorPalette.intent.action.discreet":{value:"var(--Tight-colors-colorPalette-intent-action-discreet)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet)"},"colors.colorPalette.action.discreet":{value:"var(--Tight-colors-colorPalette-action-discreet)",variable:"var(--Tight-colors-colorPalette-action-discreet)"},"colors.colorPalette.discreet":{value:"var(--Tight-colors-colorPalette-discreet)",variable:"var(--Tight-colors-colorPalette-discreet)"},"colors.colorPalette.intent.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)"},"colors.colorPalette.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-action-discreet-hover)"},"colors.colorPalette.discreet.hover":{value:"var(--Tight-colors-colorPalette-discreet-hover)",variable:"var(--Tight-colors-colorPalette-discreet-hover)"},"colors.colorPalette.intent.action.discreet.active":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-active)"},"colors.colorPalette.action.discreet.active":{value:"var(--Tight-colors-colorPalette-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-action-discreet-active)"},"colors.colorPalette.discreet.active":{value:"var(--Tight-colors-colorPalette-discreet-active)",variable:"var(--Tight-colors-colorPalette-discreet-active)"},"colors.colorPalette.intent.action.highlight":{value:"var(--Tight-colors-colorPalette-intent-action-highlight)",variable:"var(--Tight-colors-colorPalette-intent-action-highlight)"},"colors.colorPalette.action.highlight":{value:"var(--Tight-colors-colorPalette-action-highlight)",variable:"var(--Tight-colors-colorPalette-action-highlight)"},"colors.colorPalette.highlight":{value:"var(--Tight-colors-colorPalette-highlight)",variable:"var(--Tight-colors-colorPalette-highlight)"},"colors.colorPalette.intent.success":{value:"var(--Tight-colors-colorPalette-intent-success)",variable:"var(--Tight-colors-colorPalette-intent-success)"},"colors.colorPalette.intent.success.hover":{value:"var(--Tight-colors-colorPalette-intent-success-hover)",variable:"var(--Tight-colors-colorPalette-intent-success-hover)"},"colors.colorPalette.success.hover":{value:"var(--Tight-colors-colorPalette-success-hover)",variable:"var(--Tight-colors-colorPalette-success-hover)"},"colors.colorPalette.intent.success.active":{value:"var(--Tight-colors-colorPalette-intent-success-active)",variable:"var(--Tight-colors-colorPalette-intent-success-active)"},"colors.colorPalette.success.active":{value:"var(--Tight-colors-colorPalette-success-active)",variable:"var(--Tight-colors-colorPalette-success-active)"},"colors.colorPalette.intent.success.disabled":{value:"var(--Tight-colors-colorPalette-intent-success-disabled)",variable:"var(--Tight-colors-colorPalette-intent-success-disabled)"},"colors.colorPalette.success.disabled":{value:"var(--Tight-colors-colorPalette-success-disabled)",variable:"var(--Tight-colors-colorPalette-success-disabled)"},"colors.colorPalette.intent.success.highlight":{value:"var(--Tight-colors-colorPalette-intent-success-highlight)",variable:"var(--Tight-colors-colorPalette-intent-success-highlight)"},"colors.colorPalette.success.highlight":{value:"var(--Tight-colors-colorPalette-success-highlight)",variable:"var(--Tight-colors-colorPalette-success-highlight)"},"colors.colorPalette.intent.warning":{value:"var(--Tight-colors-colorPalette-intent-warning)",variable:"var(--Tight-colors-colorPalette-intent-warning)"},"colors.colorPalette.intent.warning.hover":{value:"var(--Tight-colors-colorPalette-intent-warning-hover)",variable:"var(--Tight-colors-colorPalette-intent-warning-hover)"},"colors.colorPalette.warning.hover":{value:"var(--Tight-colors-colorPalette-warning-hover)",variable:"var(--Tight-colors-colorPalette-warning-hover)"},"colors.colorPalette.intent.warning.active":{value:"var(--Tight-colors-colorPalette-intent-warning-active)",variable:"var(--Tight-colors-colorPalette-intent-warning-active)"},"colors.colorPalette.warning.active":{value:"var(--Tight-colors-colorPalette-warning-active)",variable:"var(--Tight-colors-colorPalette-warning-active)"},"colors.colorPalette.intent.warning.disabled":{value:"var(--Tight-colors-colorPalette-intent-warning-disabled)",variable:"var(--Tight-colors-colorPalette-intent-warning-disabled)"},"colors.colorPalette.warning.disabled":{value:"var(--Tight-colors-colorPalette-warning-disabled)",variable:"var(--Tight-colors-colorPalette-warning-disabled)"},"colors.colorPalette.intent.warning.highlight":{value:"var(--Tight-colors-colorPalette-intent-warning-highlight)",variable:"var(--Tight-colors-colorPalette-intent-warning-highlight)"},"colors.colorPalette.warning.highlight":{value:"var(--Tight-colors-colorPalette-warning-highlight)",variable:"var(--Tight-colors-colorPalette-warning-highlight)"},"colors.colorPalette.intent.danger":{value:"var(--Tight-colors-colorPalette-intent-danger)",variable:"var(--Tight-colors-colorPalette-intent-danger)"},"colors.colorPalette.intent.danger.hover":{value:"var(--Tight-colors-colorPalette-intent-danger-hover)",variable:"var(--Tight-colors-colorPalette-intent-danger-hover)"},"colors.colorPalette.danger.hover":{value:"var(--Tight-colors-colorPalette-danger-hover)",variable:"var(--Tight-colors-colorPalette-danger-hover)"},"colors.colorPalette.intent.danger.active":{value:"var(--Tight-colors-colorPalette-intent-danger-active)",variable:"var(--Tight-colors-colorPalette-intent-danger-active)"},"colors.colorPalette.danger.active":{value:"var(--Tight-colors-colorPalette-danger-active)",variable:"var(--Tight-colors-colorPalette-danger-active)"},"colors.colorPalette.intent.danger.disabled":{value:"var(--Tight-colors-colorPalette-intent-danger-disabled)",variable:"var(--Tight-colors-colorPalette-intent-danger-disabled)"},"colors.colorPalette.danger.disabled":{value:"var(--Tight-colors-colorPalette-danger-disabled)",variable:"var(--Tight-colors-colorPalette-danger-disabled)"},"colors.colorPalette.intent.danger.weak":{value:"var(--Tight-colors-colorPalette-intent-danger-weak)",variable:"var(--Tight-colors-colorPalette-intent-danger-weak)"},"colors.colorPalette.intent.danger.highlight":{value:"var(--Tight-colors-colorPalette-intent-danger-highlight)",variable:"var(--Tight-colors-colorPalette-intent-danger-highlight)"},"colors.colorPalette.danger.highlight":{value:"var(--Tight-colors-colorPalette-danger-highlight)",variable:"var(--Tight-colors-colorPalette-danger-highlight)"},"colors.colorPalette.reports.alternateRows":{value:"var(--Tight-colors-colorPalette-reports-alternateRows)",variable:"var(--Tight-colors-colorPalette-reports-alternateRows)"},"colors.colorPalette.alternateRows":{value:"var(--Tight-colors-colorPalette-alternateRows)",variable:"var(--Tight-colors-colorPalette-alternateRows)"},"colors.colorPalette.base":{value:"var(--Tight-colors-colorPalette-base)",variable:"var(--Tight-colors-colorPalette-base)"},"colors.colorPalette.base.weak":{value:"var(--Tight-colors-colorPalette-base-weak)",variable:"var(--Tight-colors-colorPalette-base-weak)"},"colors.colorPalette.contrast":{value:"var(--Tight-colors-colorPalette-contrast)",variable:"var(--Tight-colors-colorPalette-contrast)"},"colors.colorPalette.contrast.weak":{value:"var(--Tight-colors-colorPalette-contrast-weak)",variable:"var(--Tight-colors-colorPalette-contrast-weak)"},"colors.colorPalette.accent.success":{value:"var(--Tight-colors-colorPalette-accent-success)",variable:"var(--Tight-colors-colorPalette-accent-success)"},"colors.colorPalette.accent.warning":{value:"var(--Tight-colors-colorPalette-accent-warning)",variable:"var(--Tight-colors-colorPalette-accent-warning)"},"colors.colorPalette.accent.danger":{value:"var(--Tight-colors-colorPalette-accent-danger)",variable:"var(--Tight-colors-colorPalette-accent-danger)"},"colors.colorPalette.accent.action":{value:"var(--Tight-colors-colorPalette-accent-action)",variable:"var(--Tight-colors-colorPalette-accent-action)"},"colors.colorPalette.body":{value:"var(--Tight-colors-colorPalette-body)",variable:"var(--Tight-colors-colorPalette-body)"},"colors.colorPalette.label":{value:"var(--Tight-colors-colorPalette-label)",variable:"var(--Tight-colors-colorPalette-label)"},"colors.colorPalette.label.sub":{value:"var(--Tight-colors-colorPalette-label-sub)",variable:"var(--Tight-colors-colorPalette-label-sub)"},"colors.colorPalette.sub":{value:"var(--Tight-colors-colorPalette-sub)",variable:"var(--Tight-colors-colorPalette-sub)"},"colors.colorPalette.label.strong":{value:"var(--Tight-colors-colorPalette-label-strong)",variable:"var(--Tight-colors-colorPalette-label-strong)"},"colors.colorPalette.label.strongSub":{value:"var(--Tight-colors-colorPalette-label-strongSub)",variable:"var(--Tight-colors-colorPalette-label-strongSub)"},"colors.colorPalette.strongSub":{value:"var(--Tight-colors-colorPalette-strongSub)",variable:"var(--Tight-colors-colorPalette-strongSub)"},"colors.colorPalette.label.emphasisSub":{value:"var(--Tight-colors-colorPalette-label-emphasisSub)",variable:"var(--Tight-colors-colorPalette-label-emphasisSub)"},"colors.colorPalette.emphasisSub":{value:"var(--Tight-colors-colorPalette-emphasisSub)",variable:"var(--Tight-colors-colorPalette-emphasisSub)"},"colors.colorPalette.heading":{value:"var(--Tight-colors-colorPalette-heading)",variable:"var(--Tight-colors-colorPalette-heading)"},"colors.colorPalette.metric.sm":{value:"var(--Tight-colors-colorPalette-metric-sm)",variable:"var(--Tight-colors-colorPalette-metric-sm)"},"colors.colorPalette.sm":{value:"var(--Tight-colors-colorPalette-sm)",variable:"var(--Tight-colors-colorPalette-sm)"},"colors.colorPalette.metric.md":{value:"var(--Tight-colors-colorPalette-metric-md)",variable:"var(--Tight-colors-colorPalette-metric-md)"},"colors.colorPalette.md":{value:"var(--Tight-colors-colorPalette-md)",variable:"var(--Tight-colors-colorPalette-md)"},"colors.colorPalette.metric.lg":{value:"var(--Tight-colors-colorPalette-metric-lg)",variable:"var(--Tight-colors-colorPalette-metric-lg)"},"colors.colorPalette.lg":{value:"var(--Tight-colors-colorPalette-lg)",variable:"var(--Tight-colors-colorPalette-lg)"},"colors.colorPalette.metric.xl":{value:"var(--Tight-colors-colorPalette-metric-xl)",variable:"var(--Tight-colors-colorPalette-metric-xl)"},"colors.colorPalette.xl":{value:"var(--Tight-colors-colorPalette-xl)",variable:"var(--Tight-colors-colorPalette-xl)"},"colors.colorPalette.layout.weak":{value:"var(--Tight-colors-colorPalette-layout-weak)",variable:"var(--Tight-colors-colorPalette-layout-weak)"},"colors.colorPalette.layout":{value:"var(--Tight-colors-colorPalette-layout)",variable:"var(--Tight-colors-colorPalette-layout)"},"colors.colorPalette.layout.strong":{value:"var(--Tight-colors-colorPalette-layout-strong)",variable:"var(--Tight-colors-colorPalette-layout-strong)"},"colors.colorPalette.positive":{value:"var(--Tight-colors-colorPalette-positive)",variable:"var(--Tight-colors-colorPalette-positive)"},"colors.colorPalette.positive.weak":{value:"var(--Tight-colors-colorPalette-positive-weak)",variable:"var(--Tight-colors-colorPalette-positive-weak)"},"colors.colorPalette.positive.strong":{value:"var(--Tight-colors-colorPalette-positive-strong)",variable:"var(--Tight-colors-colorPalette-positive-strong)"},"colors.colorPalette.negative":{value:"var(--Tight-colors-colorPalette-negative)",variable:"var(--Tight-colors-colorPalette-negative)"},"colors.colorPalette.negative.weak":{value:"var(--Tight-colors-colorPalette-negative-weak)",variable:"var(--Tight-colors-colorPalette-negative-weak)"},"colors.colorPalette.negative.strong":{value:"var(--Tight-colors-colorPalette-negative-strong)",variable:"var(--Tight-colors-colorPalette-negative-strong)"}};function To(e,t){return Co[e]?.value||t}To.var=function(e,t){return Co[e]?.variable||t};const wo=cr(null,Gn({borderRadius:"50%",flexShrink:0})),ko=cr(null,Gn({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Eo=To.var("colors.surface.foreground.disabled");function Ao({color:e=Eo,diameter:t=17,label:n}){return R("div",{...ko,"data-testid":"bullet-row",children:[S("div",{...wo,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&S(fo,{children:n})]})}const Io=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function So({payload:e}){return void 0===e?null:S("div",{...Io,children:e.map((e,t)=>"none"!==e.type&&S(Ao,{color:e.color,label:e.value,diameter:17},t))})}const No={right:20,left:20},Ro=["income","profit","expenses","loss"],Do=e=>Ro.findIndex(t=>t===e.dataKey),Po={paddingBottom:"20px",marginLeft:"-20px"},Mo={stackId:"stack",isAnimationActive:!1},Lo=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),Fo=To.var("colors.money"),Oo=To.var("colors.border.layout"),Vo=To.var("colors.border.layout.strong"),Bo={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")},Uo={profit:To.var("colors.money.positive.strong"),income:To.var("colors.money.positive.weak"),loss:To.var("colors.money.negative.strong"),expenses:To.var("colors.money.negative.weak")},Wo=[0,100],Ho=["auto","auto"];function zo({data:e}){const[t,n]=c(!0);if(void 0===e)return null;const r=e.hasAnyData?Ho:Wo;return S(W,{width:"100%",height:"100%",...Lo,children:R(H,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:No,children:[S(z,{verticalAlign:"top",itemSorter:Do,wrapperStyle:Po,content:({payload:e})=>S(So,{payload:e})}),S(q,{strokeDasharray:"0",vertical:!1,stroke:Oo}),S(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Oo,tick:Bo}),S(_,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Oo,tick:Bo,tickFormatter:e=>uo(e)}),S(K,{content:({active:e,payload:t})=>S(xo,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),S(Y,{name:"Profit",dataKey:"profit",fill:Uo.profit,...Mo}),S(Y,{name:"Income",dataKey:"income",fill:Uo.income,...Mo}),S(Y,{name:"Loss",dataKey:"loss",fill:Uo.loss,...Mo}),S(Y,{name:"Expenses",dataKey:"expenses",fill:Uo.expenses,...Mo}),S(Y,{dataKey:Ma,fill:Oo,legendType:"none",...Mo}),S(Z,{y:0,stroke:Vo}),S(G,{dataKey:"netIncome",fill:Fo,stroke:Fo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const qo=Gn({backgroundColor:"surface.elevated",borderRadius:"sm",backgroundImage:"linear-gradient(90deg, {colors.surface.elevated} 30%, {colors.surface.foreground} 50%, {colors.surface.elevated} 70%)",backgroundSize:"400%",backgroundPosition:"100% 0",animation:"shimmer"});function jo({styles:e}){const t=Xn(or(tr["loading-skeleton"]),qo,e);return S("div",{className:t,"data-testid":"shimmer-block"})}const _o=Gn({width:"40%",minHeight:65});function Ko({children:e}){return R(N,{children:[S(jo,{styles:_o}),S(oo,{children:e})]})}const Yo=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),Zo=Gn({width:"80px",height:"17px",marginBottom:"10px"}),Go=Gn({width:"100%",height:"100%"});function Qo(){return R(N,{children:[R("div",{...Yo,children:[S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo})]}),S(jo,{styles:Go})]})}const Xo=$n({base:{color:"typography.base.weak",boxSizing:"border-box",position:"absolute",bottom:"0",left:"0",right:"0",top:"0",display:"flex",justifyContent:"center",alignItems:"center",pointerEvents:"none",margin:"0 auto",transform:"rotate(-20deg)",opacity:"80%"},variants:{size:{sm:{fontSize:"4em"},lg:{fontSize:"7em"},xl:{fontSize:"10em"}}}});function Jo({size:e}){const t=Xo({size:e});return S("div",{className:t,children:"Sample"})}const $o=20200,ei=5043,ti=Object.freeze({income:$o,expenses:ei,netIncome:15157,absoluteSum:Math.abs($o)+Math.abs(ei)}),ni=Object.freeze({total:ei,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),ri=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),ai=[{income:1247,expenses:7434},{income:2103,expenses:8672},{income:1876,expenses:7656},{income:3291,expenses:6623},{income:5647,expenses:7034},{income:8923,expenses:6456},{income:11547,expenses:5892},{income:9834,expenses:6721},{income:15283,expenses:5347},{income:18467,expenses:4923},{income:17924,expenses:4534},{income:20200,expenses:5043}];function oi({filter:e=gt.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:Oa})}({filter:e,grouping:Va}),a=t?function(){const e=[],t=/* @__PURE__ */new Date;let n=0,r=0,a=0;for(let o=11;o>=0;o--){const i=new Date(t.getFullYear(),t.getMonth()-o,1),l=Ot(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=ai[11-o],c=s.income-s.expenses,d=c>0?c:0,u=c<0?c:0,h=s.income-d,p=s.expenses+u;e.push({month:l,income:h,expenses:-p,profit:d,loss:u,netIncome:c,hasNoData:!1}),n+=c,r=Math.max(r,s.income),a=Math.max(a,s.expenses)}return{total:n,domain:[-a,r],months:e,hasAnyData:!0}}():n;return R(qa,{type:"chart",children:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:r?S(Ko,{children:S(Qo,{})}):R(N,{children:[S(ro,{title:uo(a?.total??0),label:"Profit"}),S(oo,{children:S(zo,{data:a})})]})}),t&&S(Jo,{size:"xl"})]})}const ii={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},li=i({}),si=$n({base:{stroke:"currentColor"},variants:{primary:{DEFAULT:{stroke:"icon.intent.primary"},hover:{stroke:"icon.intent.primary.hover"},active:{stroke:"icon.intent.primary.active"}},secondary:{DEFAULT:{stroke:"icon.intent.secondary"},hover:{stroke:"icon.intent.secondary.hover"},active:{stroke:"icon.intent.secondary.active"}},success:{DEFAULT:{stroke:"icon.intent.success"},hover:{stroke:"icon.intent.success.hover"},active:{stroke:"icon.intent.success.active"}},warning:{DEFAULT:{stroke:"icon.intent.warning"},hover:{stroke:"icon.intent.warning.hover"},active:{stroke:"icon.intent.warning.active"}},danger:{DEFAULT:{stroke:"icon.intent.danger"},hover:{stroke:"icon.intent.danger.hover"},active:{stroke:"icon.intent.danger.active"}},action:{DEFAULT:{stroke:"icon.intent.action"},hover:{stroke:"icon.intent.action.hover"},active:{stroke:"icon.intent.action.active"}}}});function ci(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:i}=l(li),s=n?.styleIconKey?i?.[n.styleIconKey]:void 0,c=gr([cr(null,si()),...o]);return s?S("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:Gn({objectFit:"contain"})}):S(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const di=ci(e=>r.createElement("svg",{width:13,height:15,stroke:"currentColor",viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),ui=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),hi=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),pi=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),gi=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.21065 9.68766C6.15485 9.47136 6.04211 9.27397 5.88416 9.11602C5.72621 8.95807 5.52882 8.84533 5.31252 8.78953L1.47815 7.80078C1.41273 7.78221 1.35515 7.74281 1.31416 7.68856C1.27316 7.6343 1.25098 7.56816 1.25098 7.50016C1.25098 7.43215 1.27316 7.36601 1.31416 7.31175C1.35515 7.2575 1.41273 7.2181 1.47815 7.19953L5.31252 6.21016C5.52874 6.15441 5.72608 6.04176 5.88402 5.88393C6.04197 5.7261 6.15475 5.52884 6.21065 5.31266L7.1994 1.47828C7.21778 1.4126 7.25714 1.35474 7.31147 1.31353C7.36581 1.27231 7.43214 1.25 7.50034 1.25C7.56854 1.25 7.63486 1.27231 7.6892 1.31353C7.74353 1.35474 7.78289 1.4126 7.80127 1.47828L8.7894 5.31266C8.8452 5.52895 8.95794 5.72634 9.11589 5.88429C9.27384 6.04224 9.47123 6.15498 9.68752 6.21078L13.5219 7.19891C13.5878 7.21709 13.646 7.25641 13.6874 7.31083C13.7289 7.36525 13.7513 7.43176 13.7513 7.50016C13.7513 7.56855 13.7289 7.63507 13.6874 7.68948C13.646 7.7439 13.5878 7.78322 13.5219 7.80141L9.68752 8.78953C9.47123 8.84533 9.27384 8.95807 9.11589 9.11602C8.95794 9.27397 8.8452 9.47136 8.7894 9.68766L7.80065 13.522C7.78227 13.5877 7.74291 13.6456 7.68857 13.6868C7.63424 13.728 7.56791 13.7503 7.49971 13.7503C7.43151 13.7503 7.36518 13.728 7.31085 13.6868C7.25651 13.6456 7.21715 13.5877 7.19877 13.522L6.21065 9.68766Z",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M12.5 1.875V4.375",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M13.75 3.125H11.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M2.5 10.625V11.875",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M3.125 11.25H1.875",strokeLinecap:"round",strokeLinejoin:"round"})),"AiStar");function mi(e){return Ea(`${t=e,Ia[t]}`,"v6");var t}async function vi({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=ba({extraHeaders:t,authorization:e}),l=(({url:e,params:t})=>{let n=e;const r=null==(a=t)?"":Object.entries(a).map(([e,t])=>{let n;return n=Array.isArray(t)?t.map(t=>va(e,t)).join("&"):va(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ha("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ha("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(s){return Promise.reject(s)}}async function bi(e){const{url:t,headers:n}=xa(e);return vi({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function fi(e){return bi({...e,endpointManager:mi(e.environment)})}async function yi(e){return bi({...e,endpointManager:Na(e.environment)})}const xi=i(void 0);function Ci(){return l(xi)}const Ti=e=>["introspect",e];function wi(e){return async t=>{const n=t.queryKey;return async function(e,t,n){const r={path:"/sdk/introspect",accessToken:e,environment:t,params:n?{theme:n}:void 0};return await yi(r)}(n[2].accessToken,n[2].environment,e)}}function ki(){const e=Ci();return Rr({queryKey:Ti(e),queryFn:wi(e)})}const Ei={RECONCILIATION_DISCREPANCY:"RECONCILIATION_DISCREPANCY",USER_REVIEW_REQUIRED:"USER_REVIEW_REQUIRED",AWAITING_MATCH:"AWAITING_MATCH",ACCOUNTANT_REVIEW_REQUIRED:"ACCOUNTANT_REVIEW_REQUIRED",STAGED:"STAGED",RECONCILED:"RECONCILED",PARTNER_REVIEW_REQUIRED:"PARTNER_REVIEW_REQUIRED"},Ai=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Ii={DISCREPANCY:{text:"Discrepancy",Icon:ui,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:hi,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:di,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:hi,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:hi,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:di,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:gi,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:pi,variant:"success"}},Si={DISCREPANCY:["RECONCILIATION_DISCREPANCY"],CLIENT_REVIEW:["USER_REVIEW_REQUIRED"],NEEDS_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:[],ADDITIONAL_REVIEW:["PARTNER_REVIEW_REQUIRED"],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Ni={DISCREPANCY:[],CLIENT_REVIEW:[],NEEDS_REVIEW:["RECONCILIATION_DISCREPANCY","USER_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED","PARTNER_REVIEW_REQUIRED"],ADDITIONAL_REVIEW:[],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Ri=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Di=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Pi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Mi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Li=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],Fi=[{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"RECONCILIATION_DISCREPANCY",displayName:"Discrepancy"},{status:"USER_REVIEW_REQUIRED",displayName:"Flag to User"},{status:"RECONCILED",displayName:"Reconciled"}];function Oi(){return Ui()?Fi:Li}function Vi(e,t){return{...Ii[e],key:e,value:(t?Si:Ni)[e]}}function Bi(e){const t=Ui()?Si:Ni,n=Ai.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Ii[n]}function Ui(){const{query:{data:e}}=ki();return"ACCOUNTANT"===e?.userRole}function Wi(){return Vi("NEEDS_REVIEW",Ui())}function Hi(e){return e in Ei}const{CONVERSATIONS:zi,TRANSACTIONS:qi}=ii.FinancialOverview,ji={MESSAGE_REVIEW:zi,TRANSACTION_REVIEW:qi,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},_i={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},Ki={resolutionStatus:{in:["OPEN"]}},Yi=[],Zi=[],Gi=ci(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10,transform:"scale(-1, 1) translate(-13, 0)"})),"ArrowLeft"),Qi=ci(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),Xi=Gn.raw({transition:"background 300ms ease-out, background-color 300ms ease-out, border-color 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, background-color 100ms ease-out, border-color 100ms ease-out, box-shadow 0ms"}}),Ji=Gn(Xi),$i=Gn.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),el=Gn($i),tl=Gn({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}});Gn({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),Gn({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const nl=i({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function rl({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["small-icon"],tr.icon),...t??[]],size:12})}const al=cr(tr["pagination-button"],Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderRadius:"md",borderColor:"border.layout",color:"typography.base",display:"inline-flex",alignItems:"center",justifyContent:"center",height:{xl:"35px",base:"44px"},overflow:"hidden",gap:0})),ol=cr(null,Gn({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,overflow:"hidden",color:"icon.base",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:"none",boxShadow:"0 0 0 0 transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{opacity:.6,pointerEvents:"none"},_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}}),el),il=cr(null,Gn({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),ll=cr(null,Gn({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function sl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=l(nl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...al,children:[S("div",{...il,children:S("button",{...ol,onClick:r,disabled:!t,children:S(rl,{Component:Gi,stylists:[ll]})})}),S("div",{...il,children:S("button",{...ol,onClick:n,disabled:!e,children:S(rl,{Component:Qi,stylists:[ll]})})})]})}const cl=Gn({width:"100%",height:"50px"});function dl(){return S(jo,{styles:cl})}const ul=cr(tr["dashboard-placeholder-table"],Gn({display:"flex",flexDirection:"column",gap:"4px"})),hl=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),pl=Gn({width:"100px",height:"20px"});function gl({numColumns:e=6}){return R("div",{...ul,children:[S("div",{...hl,children:Array.from({length:e},(e,t)=>S(jo,{styles:pl},t))}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{})]})}function ml(e,t){const n=kr(),r=Nr();return d(a=>{const o=Tr(n),i=o?{}:{retry:!1,staleTime:1/0};return Ir.prefetchQuery({queryKey:fr(e(a),n??"",r),queryFn:o?t:Er,...i})},[e,t,n,r])}const vl=Object.freeze({}),bl=Object.freeze({cursor:"FINAL_PAGE"});function fl({queryKey:e,queryFn:t,...n}){const[r,i]=c(vl),l=a(e);C(l.current,e)||(l.current=e,i(vl));const s=n.select,h=rr(s)?e=>({...s(e),cursor:e.cursor}):void 0,p=yr(e,r),g=Rr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(vl),getLastPage:()=>t(bl),hasNextPage:rr(e?.after),hasPreviousPage:rr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=ml(d(t=>yr(e,t),[e]),t),b=ml(d(t=>yr(e,t),[e]),t);return u(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{pa({error:e,severity:"error"})}),e.before&&b({cursor:e.before}).catch(e=>{pa({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,b]),{...g,paginationControls:m}}function yl({delay:e,callback:t}){const n=o(()=>function({delay:e,callback:t}){let n;const r=()=>{n&&(clearTimeout(n),n=void 0)};return{startCallback:a=>{r(),n=setTimeout(()=>{t(a)},e)},cancelCallback:()=>r()}}({delay:e,callback:t}),[e,t]);return u(()=>()=>{n.cancelCallback()},[n]),{startCallback:d(e=>{n.startCallback(e)},[n]),cancelCallback:d(()=>{n.cancelCallback()},[n])}}function xl({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=yl({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Cl={CREATED_DATE_TIME:"CREATED_DATE_TIME",SUBJECT:"SUBJECT",EMAIL:"EMAIL",LAST_MESSAGE_CREATED_DATE_TIME:"LAST_MESSAGE_CREATED_DATE_TIME",LAST_MESSAGE_TEXT:"LAST_MESSAGE_TEXT"},Tl={ASC:"ASC",DESC:"DESC"},wl=e=>["conversations",e??{}],kl=e=>["conversations","conversation",e],El=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Al(e){return fl({queryKey:e?wl(e):["conversations",{}],queryFn:El})}const Il=async e=>{const t=e.queryKey,{id:n}=t[2],r={path:"/v6/conversations/{id}",pathParams:{id:n},accessToken:t[3].accessToken,environment:t[3].environment},a=await fi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Sl(e){const t=rr(e);return Rr({queryKey:kl({id:e??""}),queryFn:Il,enabled:t})}const Nl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function Rl(){return xl({prefetchFn:ml(kl,Il)})}function Dl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Pl({header:e}){const t=Dl(e.column);return S("div",{...cr(tr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:Q(e.column.columnDef.header,e.getContext())})}const Ml=cr(tr["dashboard-table-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center"}));function Ll({headerGroups:e}){return S("div",{children:e.map(e=>h("div",{...Ml,key:e.id},e.headers.map(e=>S(Pl,{header:e},e.id))))})}const Fl=cr(tr["dashboard-table-body"],Gn({display:"flex",flexDirection:"column"}));function Ol({children:e}){return S("div",{...Fl,children:e})}function Vl({cell:e,onCellClick:t}){const n=Dl(e.column),r=cr(tr["dashboard-table-cell"],Gn({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),a=cr(null,Gn({display:"flex",flexDirection:"row",height:"100%"}));return S("div",{...a,style:n,onClick:()=>{t&&t(e)},children:S("div",{style:n,...r,children:Q(e.column.columnDef.cell,e.getContext())})})}const Bl=cr(tr["table-sub-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function Ul({rowData:e,onCellClick:t}){const n=e.getVisibleCells();return S("div",{...Bl,children:n.map(e=>S(Vl,{cell:e,onCellClick:t,isChild:!0},e.id))})}const Wl=Gn({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden"}),Hl=Gn({background:"surface.background"}),zl=cr(tr["table-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"}}));function ql({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=e.getIsExpanded(),i=cr(tr["table-parent-row"],Wl,e.index%2==0?Hl:void 0),l=e.getVisibleCells();return R("div",{...i,onMouseEnter:t,onMouseLeave:n,children:[S("div",{...zl,children:l.map(e=>S(Vl,{cell:e,onCellClick:r},e.id))}),o&&S("div",{children:e.subRows.map(e=>S(Ul,{rowData:e,onCellClick:r,shouldDisplayDivider:a},e.id))})]})}const jl=(e,t={})=>{ln.getState().openDrawer(e,t)},_l=()=>{ln.getState().requestCloseDrawer()},Kl=()=>ln(e=>e.drawerHistory);function Yl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.fetchQuery({queryKey:a,queryFn:t})}function Zl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.prefetchQuery({queryKey:a,queryFn:t})}const Gl=[{name:"One-Time Expense",value:"ONE_TIME"},{name:"Weekly Recurring Expense",value:"WEEKLY"},{name:"Monthly Recurring Expense",value:"MONTHLY"},{name:"Yearly Recurring Expense",value:"YEARLY"}],Ql={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},Xl={ASC:"ASC",DESC:"DESC"},Jl=e=>["banks/transactions",e??{}],$l=e=>["banks/transactions",e.id],es=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ts(e,t){return fl({queryKey:Jl(e),queryFn:es,...t})}const ns=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function rs({id:e,enabled:t=!0}){return Rr({queryKey:$l({id:e??""}),queryFn:ns,enabled:t})}function as(){return xl({prefetchFn:ml($l,ns)})}function os(){const{query:{data:e}}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!nr(t)&&t.length>0}const is={COMPANY:"co",EMPLOYEE:"emp",DIMENSION_VALUE:"cls",DIMENSION:"tcll",CUSTOMER:"cus",BANK_ACCOUNT:"bka",GL_ACCOUNT:"gla",TRANSACTION_CATEGORY:"ctg",BANK_TRANSACTION:"btxn",PROCESSOR_TRANSACTION:"ptxn",TRANSACTION_LINE_ITEM:"tli",VENDOR:"vnd",TRANSACTION_RULE:"trl",INVOICE:"inv",INVOICE_LINE_ITEM:"ili",BILL:"bll",BILL_LINE_ITEM:"bli",PAYROLL:"prl",PAYROLL_LINE_ITEM:"pli",FINANCIAL_SUMMARY:"fsm",TASK:"tsk",CONVERSATION:"cnv",MESSAGE:"msg",REACTION:"rct",BUSINESS_TYPE:"bzt",TEMPLATE_CLASS_LABEL:"tcll",TEMPLATE_COA:"tcoa",TEMPLATE_GL_ACCOUNT:"tgla",TEMPLATE_TRANSACTION_RULES:"ttrl",MANUAL_JOURNAL_ENTRY:"mje",ASSET:"ast",ASSET_DEPRECIATION:"asd",EXPENSE_AMORTIZATION:"exa",REVENUE_RECOGNITION:"rvr",GL_TRANSACTION:"glt",ATTACHMENT:"att",CAR:"car",MILEAGE:"mlg",INTEGRATION:"int",TIME:"tme",TIME_TYPE:"tmt",TAX_RETURN:"txr"};function ls(e,t){return!Cr(e)&&e.startsWith(t)}function ss({id:e,prefix:t}){return void 0!==e?`${is[t]}_${e}`:""}function cs(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}const ds=e=>["conversations/messages",e];function us(e){if(nr(e)||0===e.length)return null;const t=[[e[0]]];for(let n=1;n<e.length;n++){const r=e[n],a=t[t.length-1],o=a[0].author.userId;r.author.userId===o?a.push(r):t.push([r])}return t}const hs=async e=>{const t=e.queryKey,{id:n}=t[1],r={path:"/v6/conversations/{id}/messages",pathParams:{id:n},accessToken:t[2].accessToken,environment:t[2].environment},a=await fi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},ps=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:mi(n),accessToken:t};return await wa(r)};function gs(){return xl({prefetchFn:ml(ds,hs)})}const ms=e=>["summaries",e??{}],vs=e=>["summaries",e.id],bs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const fs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function ys({rowData:e,isMobile:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),{startPrefetch:i,cancelPrefetch:l}=as(),{startPrefetch:s,cancelPrefetch:c}=xl({prefetchFn:ml(vs,fs)}),u=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?i({id:e.original.attachedEntityId}):rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&s({id:e.original.attachedEntityId}),a({id:e.original.id}),n({id:e.original.id})},[e.original.attachedEntityId,e.original.id,a,n,i,s]),h=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?l():rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&c(),o(),r()},[l,c,r,o,e.original.attachedEntityId]);return S(ql,{rowData:e,onMouseEnter:u,onMouseLeave:h,shouldDisplayDivider:e=>0!==e,onCellClick:()=>((e,t,n)=>{n?jl("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):rr(t)?ls(t,is.BANK_TRANSACTION)?jl("BankTransactionForm",{routeProps:{transactionId:t,initialTab:"conversation"}}):ls(t,is.FINANCIAL_SUMMARY)&&(r=e,a=t,jl("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){jl("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t)})}const xs=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Cs=Gn.raw({display:"flex",alignItems:"center",justifyContent:"center",outline:"none",cursor:"pointer",borderRadius:"md","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout",outlineOffset:"-1px"},"&:disabled":{cursor:"not-allowed",opacity:.6}}),Ts=Gn(Cs),ws=Gn.raw({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.primary.active",borderColor:"border.intent.primary.active","& .Tight-text":{color:"typography.intent.primary.active"}},"& .Tight-text":{color:"typography.intent.primary"}});Gn(ws);const ks=Gn.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Es=Gn(ks),As=Gn.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});Gn(As);const Is=Gn.raw({display:"flex",alignItems:"center",gap:"5px",backgroundColor:"surface.intent.action.discreet",borderRadius:"md",border:"{borderWidths.md} solid transparent",outline:"none",boxShadow:"0 0 0 0 transparent",position:"relative",cursor:"pointer",color:"icon.base","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"default"},_supportHover:{_enabled:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover",color:"icon.intent.action.hover",fill:"icon.intent.action.hover"}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"transparent",color:"icon.intent.action.active",fill:"icon.intent.action.active"}}),Ss=Gn.raw({color:"typography.intent.danger",border:"{borderWidths.md} solid",borderColor:"border.intent.danger",backgroundColor:"surface.intent.danger",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-text":{color:"typography.intent.danger.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.danger.active",borderColor:"border.intent.danger.active","& .Tight-text":{color:"typography.intent.danger.active"}},"& .Tight-text":{color:"typography.intent.danger"}}),Ns=Gn.raw({color:"typography.intent.success",border:"{borderWidths.md} solid",borderColor:"border.intent.success",backgroundColor:"surface.intent.success","& .Tight-text":{color:"typography.intent.success"},"& path":{stroke:"icon.intent.success"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-text":{color:"typography.intent.success.hover"},"& path":{stroke:"icon.intent.success.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.success.active",borderColor:"border.intent.success.active","& .Tight-text":{color:"typography.intent.success.active"},"& path":{stroke:"icon.intent.success.active"}}}),Rs=Gn.raw({color:"typography.intent.warning",border:"1px solid {colors.border.intent.warning}",backgroundColor:"surface.intent.warning",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-text":{color:"typography.intent.warning.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.warning.active",borderColor:"border.intent.warning.active","& .Tight-text":{color:"typography.intent.warning.active"}},"& .Tight-text":{color:"typography.intent.warning"}}),Ds=Gn.raw({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.secondary","& .Tight-text":{color:"typography.intent.secondary"},"& path":{stroke:"icon.intent.secondary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-text":{color:"typography.intent.secondary.hover"},"& path":{stroke:"icon.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.secondary.active","& .Tight-text":{color:"typography.intent.secondary.active"},"& path":{stroke:"icon.intent.secondary.active"}}}),Ps=Gn.raw({color:"typography.intent.action",border:"1px solid {colors.border.intent.action}",backgroundColor:"surface.intent.action",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-text":{color:"typography.intent.action.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.active",borderColor:"border.intent.action.active","& .Tight-text":{color:"typography.intent.action.active"}},"& .Tight-text":{color:"typography.intent.action"}}),Ms=$n({base:Gn.raw(Cs,ks,Xi),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:ks,small:As},intent:{default:{},danger:Ss,primary:ws,secondary:Ds,success:Ns,warning:Rs,action:Ps}}}),Ls=p(function({children:e,stylists:t=[],styles:n,className:r,type:a="button",onClick:o,disabled:i,size:l="default",width:s="default",intent:c="default",active:d=!1,onMouseEnter:u,onMouseLeave:h,popupTriggerProps:p},g){const m=function(e){switch(e){case"danger":return tr["button-danger"];case"primary":return tr["button-primary"];case"secondary":return tr["button-secondary"];case"success":return tr["button-success"];case"warning":return tr["button-warning"];case"action":return tr["button-action"];case"default":return null}}(c),v=gr([cr(tr["button-base"],m,r,Gn(Ms.raw({width:s,size:l,intent:c}),n)),...t]);return S("button",{ref:g,...v,type:a,onClick:o,disabled:i,"data-active":d,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function Fs({children:e,stylists:t=[],...n}){return S(Ls,{intent:"secondary",stylists:t,...n,children:e})}const Os=()=>{jl("Conversation",{routeProps:{conversationId:null}})},Vs=cr(tr["small-square-button"],void 0),Bs=Gn({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function Us(){return S("div",{className:Bs,children:S(Fs,{stylists:[Vs],onClick:Os,width:"fill-parent",children:S(rl,{Component:xs})})})}const Ws=$n({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},financialOverviewDashboard:{marginTop:"16px",borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout",borderRadius:"lg",background:"surface.foreground"}}}});function Hs({children:e,dashboard:t}){const n=cr(tr["dashboard-table"],Ws({dashboard:t}));return S("div",{...n,children:e})}const zs=i(null),qs="mobile",js=$n({base:{padding:"0 25px",height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",width:"100%"},variants:{alignVariant:{flexStart:{alignItems:"flex-start"},center:{alignItems:"center"},flexEnd:{alignItems:"flex-end"}}},defaultVariants:{alignVariant:"flexStart"}});function _s({children:e,alignVariant:t="flexStart"}){const n=cr(null,js({alignVariant:t}));return S("div",{...n,children:e})}const Ks=$n({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"18px",maxWidth:"100%",xl:{lineHeight:"16px",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"}},wrap:{ellipsis:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:Ya},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function Ys({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=cr(tr.label,tr.text,Gn(Ks.raw({intent:t,wrap:n,alignment:r}),a));return Cr(e)?null:S("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const Zs={"sm-sm":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-med":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-lg":cr(tr.text,Gn({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-sm":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-med":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-lg":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja)};function Gs({children:e,size:t,weight:n,stylists:r=[]}){const a=gr([Zs[`${t}-${n}`],...r]);return S("div",{title:e,...a,children:e})}const Qs=cr(tr["emphasis-label"],Gn({lineHeight:"16px"}));function Xs({children:e}){return S(Gs,{size:"med",weight:"lg",stylists:[Qs],children:e})}function Js({text:e,isRead:t}){return S(t?Ys:Xs,{children:e})}function $s({date:e,isRead:t=!1}){const n=Vt(e);return S(Js,{text:n,isRead:t})}const ec=cr(tr["strong-sub-label"],mr({label:"strongSubLabel"}));function tc({children:e,stylists:t=[]}){return Cr(e)?null:S(Gs,{size:"sm",weight:"med",stylists:[ec,...t],children:e})}const nc=i(null),rc=Gn({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),ac=Gn.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",color:"icon.base",minWidth:{base:"100%"},boxShadow:{sm:"none"},minHeight:{sm:"35px"},height:{sm:"fit-content"},flexShrink:{sm:0},textAlign:{sm:"start"},"&[data-focused='true']":{boxShadow:"none",outline:"none",backgroundColor:"surface.intent.action.discreet.hover"}}),oc=cr(tr["selector-row"],Gn(ac));function ic(e,t,n){const[r,a]=c(e);return[t??r,n??a]}function lc({children:e}){return null===he()?S(pe,{children:e}):e}function sc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const u=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=c(),[u,h]=c(),[p,g]=ic(e,r,a),m=te(),v=ne({placement:t,open:p,nodeId:m,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||g(e)},whileElementsMounted:le,middleware:[re(n),ae({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),oe({padding:8}),ie({apply({availableHeight:e,elements:t}){let n=e;if(e<314){const t=37*Math.floor(e/37)-18.5;n=Math.max(t,55.5)}Object.assign(t.floating.style,{maxHeight:`${n}px`,overflowY:"auto"})},padding:8})]}),b=v.context,f=se(b,{enabled:i}),y=ce(b,{bubbles:{escapeKey:!0}}),x=de(b),C=ue([f,y,x]),T=d(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:T,...C,...v,modal:!0,labelId:l,descriptionId:u,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,T,C,v,l,u,m])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=he(),p=l&&null===h,g=u.nodeId;return S(lc,{children:S(ge,{id:g,children:S(nc.Provider,{value:{...u,popupParentNodeId:h,blockInteraction:p},children:e})})})}function cc(){const e=l(nc);if(nr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function dc({children:e}){const t=cc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return S(N,{children:e(a)})}const uc=ci(e=>r.createElement("svg",{stroke:"currentColor",width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",strokeWidth:.8,strokeMiterlimit:10}),r.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function hc({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["tiny-icon"],tr.icon),...t??[]],size:9})}const pc=ci(e=>r.createElement("svg",{stroke:"currentColor",width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.03625 2.20312H9.96378"}),r.createElement("path",{d:"M1.03625 5H9.96378"}),r.createElement("path",{d:"M1.03625 7.79688H7.24223"})),"Sort"),gc=cr(tr["button-discreet-small"],Gn(Is,{maxWidth:"fit-content",justifyContent:"center","&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),Ji),mc=cr(null,Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),vc=cr(null,Gn({display:"flex",color:"icon.base",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:"0 6px 0 0",border:"none",outline:"none",position:"relative",cursor:"pointer","&::before":{content:"''",position:"absolute",top:"-9px",right:"-7px",bottom:"-9px",left:"-5px"},_focusVisible:{borderRadius:"sm",outline:"4px solid",outlineColor:"border.layout"}})),bc=cr(null,Gn({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function fc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...gc,"data-active":a,children:[R("button",{...mc,...r,children:[S(tc,{children:t}),!a&&S("div",{...bc,children:S(hc,{Component:pc})})]}),a&&S("button",{...vc,onClick:e,children:S(hc,{Component:uc})})]})}const yc=$n({base:{borderColor:"border.layout",background:"surface.foreground",borderRadius:"zero",boxShadow:"box-shadow",animation:"appear.instant",display:"flex",flexShrink:1,width:"max-content",position:"absolute",top:0,left:0,"& *":{boxSizing:"border-box"}},variants:{type:{reaction:{borderRadius:"sm"}}}});function xc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=cc(),d=me([c.refs.setFloating,n]),u=cr(tr.popup,yc({type:r}));return a||l.open?R(ve,{children:[s&&S(be,{lockScroll:!0}),S(fe,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:S("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Cc=cr(tr["popup-sort-row"],Gn({border:"none",background:"none",paddingLeft:"10px",paddingRight:"10px",paddingTop:"4px",paddingBottom:"4px",margin:0,cursor:"pointer",display:"flex",alignItems:"center",width:"100%",outline:"none",_focusVisible:{outline:"4px solid",outlineOffset:"-2px",outlineColor:"border.layout"}}));function Tc({onClick:e,children:t,active:n}){return S("button",{onClick:e,...Cc,children:S(fo,{accent:n?"active":"action",children:t})})}const wc=cr(null,Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),kc=cr(null,Gn({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Ec({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=cc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...wc,children:[S(tc,{stylists:[kc],children:"Sort by:"}),S(Tc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),S(Tc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Ac=Gn.raw(Is,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Ic({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,d]=c(!1),u=cr(tr["button-discreet-small"],Gn(Ac,e),Ji),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return S("button",{type:"button",...u,onClick:e=>{void 0===h&&d(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const Sc={minWidth:"140px"};function Nc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=l(zs);if(!a)return null;const{sortInstance:o,setSortInstance:i}=a,s=o?.orderBy===t,c=()=>{i(void 0)};return t&&n&&r?R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(fc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),S(xc,{style:Sc,children:S(Ec,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{i(e)},sortInstance:o})})]}):S(Ic,{disabled:!0,children:S(tc,{children:e})})}const Rc=$n({base:{display:"flex",width:"100%"},variants:{align:{left:{justifyContent:"flex-start"},center:{justifyContent:"center"},right:{justifyContent:"flex-end"}},padding:{none:{},default:{},large:{}}},compoundVariants:[{align:"left",padding:"none",css:{paddingLeft:"0"}},{align:"left",padding:"default",css:{paddingLeft:"19px"}},{align:"left",padding:"large",css:{paddingLeft:"33px"}},{align:"right",padding:"none",css:{paddingRight:"0"}},{align:"right",padding:"default",css:{paddingRight:"19px"}},{align:"right",padding:"large",css:{paddingRight:"33px"}}],defaultVariants:{align:"left",padding:"default"}});function Dc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return S("div",{className:Rc({align:a,padding:o}),children:S(Nc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Pc="Oldest to Newest",Mc="Newest to Oldest";const Lc=i({userId:void 0,userRole:void 0,userEmail:void 0,companyId:void 0,customerPartnerId:void 0,apiPartnerName:void 0,clientId:void 0,unitIntegrationBankName:null,supportedIntegrations:[],isDfy:!1,hasBookkeeper:!1});function Fc({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=l(Lc);let a="";return e===r?a="Me":jt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),S(Js,{text:a,isRead:t})}const Oc=ci(e=>r.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.77996 13.5774L13.2416 7.78614C13.9666 6.84449 14.288 5.65345 14.1351 4.47491C13.9821 3.29638 13.3674 2.22682 12.4261 1.5014C11.969 1.12033 11.4381 0.83785 10.8667 0.671702C10.2952 0.505554 9.69563 0.459321 9.10548 0.535904C8.51534 0.612488 7.9474 0.810234 7.43731 1.11673C6.92722 1.42323 6.48599 1.83186 6.14132 2.31698L1.10393 8.82104C-0.191398 10.3699 0.829788 12.2478 1.98119 13.1525C2.59811 13.6529 3.38756 13.8897 4.17805 13.8114C4.96854 13.7331 5.69621 13.3461 6.20301 12.7344L11.213 6.23038C11.3671 6.03065 11.4803 5.8025 11.5461 5.55898C11.612 5.31546 11.6291 5.06134 11.5967 4.81118C11.5642 4.56101 11.4827 4.3197 11.3569 4.10105C11.2311 3.88239 11.0634 3.6907 10.8635 3.53692C10.4594 3.22747 9.94931 3.09053 9.44461 3.15603C8.93992 3.22152 8.48166 3.48412 8.16999 3.88645L3.94132 9.36933",strokeMiterlimit:10})),"Attachment"),Vc=cr(tr.text,Gn({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"16px",maxWidth:"100%",fontFamily:"label"}),ja);function Bc({children:e,stylists:t=[]}){const n=gr([Vc,...t]);return S("div",{...n,children:e})}const Uc=$n({base:{display:"flex",gap:8,border:"none",borderBottom:"1px solid",borderBottomColor:"border.layout.weak",borderRadius:0,padding:0,width:"100%",height:"100%",cursor:"pointer",alignItems:"stretch"},variants:{isRead:{true:{backgroundColor:"transparent"},false:{backgroundColor:"surface.background"}}}}),Wc=Xn(Gn({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),ja),Hc=Gn({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),zc=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),qc=Gn({display:"flex",alignItems:"center",gap:8}),jc=Gn({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),_c=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),Kc=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),Yc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Zc({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return S("button",{className:Uc({isRead:a}),onTouchEnd:o,children:R("div",{className:Wc,children:[R("div",{className:_c,children:[!a&&S("div",{className:Yc}),S(Js,{text:t,isRead:a})]}),R("div",{className:Hc,children:[S("div",{className:Kc,children:S(Fc,{authorUserId:e,isRead:a})}),R("div",{className:qc,children:[S("div",{className:zc,children:S($s,{date:n,isRead:a})}),a?S(rl,{Component:Qi}):S(Bc,{children:S(rl,{Component:Qi})})]})]}),S("div",{className:jc,children:Cr(r)?R(N,{children:[S(rl,{Component:Oc}),S(Ys,{children:"Shared a file"})]}):S(Ys,{children:r})})]})})}const Gc=Gn({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),Qc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Xc({text:e,isRead:t}){return t?S(Ys,{children:e}):R("div",{className:Gc,children:[S("div",{className:Qc}),S(Xs,{children:e})]})}const Jc=X(),$c=cr(null,Gn({paddingLeft:"25px"})),ed=[Jc.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>S(_s,{children:S(Fc,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>S(tc,{stylists:[$c],children:"From"}),size:160,maxSize:160}),Jc.accessor("subject",{id:"subject",cell:({row:e})=>R(_s,{children:[S(Xc,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),S(Ys,{children:e.original.latestMessage.text})]}),header:()=>S(tc,{stylists:[$c],children:"Subject"}),size:200}),Jc.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>S(_s,{children:S($s,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>S(Dc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Mc,sortAscDisplay:Pc}),size:150,maxSize:150}),Jc.display({id:qs,cell:({row:e})=>S(Zc,{sender:e.original.latestMessage.author.userId,subject:e.original.subject,date:e.original.lastUpdatedDateTime,message:e.original.latestMessage.text,isRead:"READ"===e.original.readStatus,handleFormOpen:()=>{}})})];function td(e){return e?ed.filter(e=>e.id===qs):ed.filter(e=>e.id!==qs)}const nd=[],rd=Gn({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px",color:"icon.base"}),ad=cr(tr["empty-dashboard-layout"],rd);function od({children:e}){return S("div",{...ad,"data-testid":"empty-dashboard-layout",children:e})}const id=Gn({width:"25px",height:"25px",borderRadius:"sm"});function ld({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:id}),S("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["large-icon"],tr.icon),...n??[]],size:25})}const sd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return S(Ls,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),cd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M12 1.47998C6.2 1.47998 1.5 5.74998 1.5 11C1.52866 13.0153 2.23294 14.9626 3.5 16.53L2.5 21.53L9.16 20.2C10.1031 20.4499 11.0744 20.5776 12.05 20.58C17.85 20.58 22.55 16.3 22.55 11.03C22.55 5.75998 17.8 1.47998 12 1.47998Z",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),dd=Gn({width:"15px",height:"15px",borderRadius:"sm"});function ud({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:dd}),S("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:15})}const hd=()=>{jl("Conversation",{routeProps:{conversationId:null}})};function pd(){return R(N,{children:[S(ld,{Component:cd}),S(vo,{wrap:"wrap",children:"Need help with your financials?"}),R(sd,{...cr(tr["zero-state-button"]),onClick:hd,children:[S(vo,{children:"Message Bookkeeper"}),S(ud,{Component:Qi})]})]})}const gd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function md(){return R(N,{children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const vd=i({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,unstable_mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function bd(e){const{registerAnchor:t}=l(vd);g(()=>{t(e)},[e,t])}const fd=cr(null,Gn({display:"flex",flexDirection:"row",gap:"5px"}));function yd({children:e}){return S("div",{...fd,children:e})}const xd=$n({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Cd(e){return S(e?md:pd,{})}function Td({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){bd(zi);const i=function({conversations:e,isMobile:t}){return J({data:e??nd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??nd.length,columns:td(t),getCoreRowModel:$(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Al({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!nr(l?.data?.[0])&&!s;return R("div",{className:xd({isMobile:o}),children:[S("div",{id:zi}),R(nl.Provider,{value:r,children:[R(ur,{children:[S(br,{children:"Conversations"}),R(yd,{children:[S(sl,{}),S(Us,{})]})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:a?S(gl,{numColumns:4}):R(N,{children:[!o&&S(zs.Provider,{value:{sortInstance:e,setSortInstance:t},children:S(Ll,{headerGroups:i.getHeaderGroups()})}),n.length>0?S(Ol,{children:i.getRowModel().rows.map(e=>S(ys,{rowData:e,isMobile:o},e.id))}):S(od,{children:Cd(c)})]})})]})]})}const wd=cr(tr.body,mr({body:"default"}));function kd({children:e,stylists:t=[]}){if(Cr(e))return null;const n=gr([wd,...t]);return S("div",{...n,children:e})}const Ed=cr(null,Gn({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Ad=$n({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Id=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Sd(){return S("div",{...Ed,children:Id.map((e,t)=>S(jo,{styles:Ad({width:e?.width})},t))})}const Nd=Gn({position:"absolute",top:"-1",right:"-1",width:"10",height:"10",borderRadius:"999px",backgroundColor:"surface.intent.warning",boxShadow:"0 0 0 1px {colors.border.intent.warning}"}),Rd=Gn({position:"relative",width:"25px",height:"25px"});function Dd({hasUnread:e}){return R("div",{className:Rd,children:[S(ld,{Component:cd}),e&&S("div",{"data-testid":"unread-comment-badge",className:Nd,"aria-hidden":"true"})]})}const Pd=cr(tr["financial-summary-chatbox-header"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Md({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Pd,children:[S(vo,{children:"Message Bookkeeper"}),t&&S(Dd,{hasUnread:e})]})}const Ld=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function Fd(){return R("div",{className:Ld,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),S(fo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(sd,{...cr(tr["zero-state-button"]),onClick:()=>jl("Conversation"),children:[S(vo,{children:"Send a Message"}),S(ud,{Component:Qi})]})]})}const Od=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Vd({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=d(()=>{a({id:t}),n({id:t})},[t,a,n]),l=d(()=>{o(),r()},[o,r]);return R("div",{className:Od,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),S(fo,{wrap:"wrap",children:"Pick up where you left off."}),S(Fs,{onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:S(vo,{children:"Continue conversation"})})]})}const Bd=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Ud({summaryId:e}){return R("div",{className:Bd,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),S(fo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),S(Fs,{...cr(tr["zero-state-button"]),onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e}}),children:S(vo,{children:"Talk to a bookkeeper"})})]})}function Wd({summaryId:e,conversationId:t}){const n=rr(t);return nr(e)?S(Fd,{}):n?S(Vd,{conversationId:t,summaryId:e}):S(Ud,{summaryId:e})}const Hd=Gn({display:"flex",flexDirection:"column",flex:{base:"1 1 100%",xl:"0 0 342px"},maxHeight:"247px",minHeight:"247px",width:{base:"100%",xl:"342px"},maxWidth:{base:"100%",xl:"342px"},background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",alignItems:"center",overflow:"hidden",boxSizing:"border-box"}),zd=cr(tr["financial-summary-chatbox"],Gn({display:"flex",flexDirection:"column",flex:"1 1 0",minHeight:0,width:"100%",backgroundColor:"surface.background",padding:"10px",gap:"10px",alignItems:"flex-start",boxSizing:"border-box"}));function qd({summaryData:e}){const t=rr(e?.summary),n=rr(e?.conversation);return R("div",{className:Hd,children:[S(Md,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),S("div",{...zd,children:S(Wd,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const jd=ci(e=>r.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),_d=Gn({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function Kd(){return R("div",{className:_d,children:[S(ld,{Component:jd}),S(vo,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const Yd=Gn({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),Zd=$n({base:{display:"flex",flex:{base:"1 1 100%",xl:"1 1 0"},minWidth:{base:"100%",xl:"450px"},maxHeight:"247px",minHeight:"247px",background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",gap:"10px",alignItems:"flex-start",boxSizing:"border-box",position:"relative",marginBottom:10,overflow:"auto"},variants:{isSample:{true:{pointerEvents:"none",overflow:"hidden"},false:{}},isZeroState:{true:{alignItems:"center",justifyContent:"center",padding:"16px"},false:{}}}}),Gd=cr(null,Gn({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),Qd=Gn({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function Xd({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Rr({queryKey:(t={limit:1,filter:{date:{equal:ct(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?ms(t):["summaries",{}],queryFn:bs,...n});var t,n}(t),a=e?function(){const e=/* @__PURE__ */new Date;return`In ${e.toLocaleString("en-US",{month:"long"})} ${e.getFullYear()}, your total income increased significantly to $${$o.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${ei.toLocaleString()}, compared to $${4534..toLocaleString()} last month, which slightly narrowed your net profit margin despite a healthy $${15157..toLocaleString()} net profit. \n\nA key area for improvement is transaction categorization; with one transaction remaining uncategorized and only two user-categorized, enhancing categorization accuracy will improve financial tracking and insights. To maintain positive momentum, consider reviewing variable expenses to identify any controllable cost increases.\n\nGoing forward, continue focusing on revenue growth while keeping a close eye on expense management, and aim to fully categorize all transactions to gain more precise financial visibility.`}():n?.summary,o=!e&&!r&&!a,i=cr(tr["financial-summary-layout"],Zd({isSample:e,isZeroState:o}));return R("div",{className:Qd,children:[S("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?S(Sd,{}):o?S(Kd,{}):R("div",{className:Yd,children:[S(kd,{stylists:[Gd],children:a}),e&&S(Jo,{size:"lg"})]})}),S(qd,{summaryData:n})]})}const Jd=cr(tr["month-picker"],Gn({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),$d=cr(tr["month-picker-left-button"],Gn({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),eu=cr(tr["month-picker-right-button"],Gn({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),tu=cr(tr["month-picker-label"],Gn({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function nu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=it(e.year,e.month,1),o=Ot(a,{abbreviateMonth:!0});return R("div",{...Jd,children:[S(Fs,{stylists:[$d],onClick:()=>{return t(0===(n=e).month?{month:11,year:n.year-1}:{month:n.month-1,year:n.year});var n},disabled:r,children:S(rl,{Component:Gi})}),S("div",{...tu,children:S(vo,{children:o})}),S(Fs,{stylists:[eu],onClick:()=>{return t(11===(n=e).month?{month:0,year:n.year+1}:{month:n.month+1,year:n.year});var n},disabled:n,children:S(rl,{Component:Qi})})]})}const ru=Gn({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function au({children:e}){return S("div",{className:ru,children:e})}const ou=$n({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),iu=cr(tr["progress-bar"],Gn({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),lu=cr(tr["progress-bar-fill"],Gn({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),su=cr(tr["tile-bar-label"],Gn({paddingLeft:"10px"})),cu=cr(tr["tile-bar-label-outer"],Gn({paddingLeft:"10px"}));function du({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?tr["bar-transactions-positive"]:tr["bar-transactions-negative"],l=cr(i,ou({color:n})),s=gr([lu,l]);return R("div",{...iu,style:{width:a},children:[S("div",{...s,style:{width:`${t}%`},children:o&&S("div",{...su,children:S(Ys,{children:e})})}),!o&&S("div",{...cu,children:S(Ys,{children:e})})]})}const uu=cr(tr["metric-md"],Gn(mr.raw({metric:"md"}),Ya));function hu(e){return S("div",{...uu,children:e.children})}const pu=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),gu=Gn({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function mu({label:e,amount:t,total:n,color:r}){const a=n>0?function(e,t,n,r=0,a=100){return r+(e-t)*(a-r)/(n-t)}(t,0,n):0;return R("div",{className:pu,children:[S(du,{label:e,percentage:a,color:r}),S("div",{className:gu,children:S(hu,{children:uo(t)})})]})}const vu=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),r.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),r.createElement("path",{d:"M1.34228 9.57602C1.18256 9.00181 1.10327 8.40823 1.10669 7.81223C1.1074 6.38654 1.56211 4.99811 2.4049 3.8482C3.2477 2.69828 4.4348 1.84664 5.79412 1.41671C7.15345 0.986775 8.61437 1.00089 9.96513 1.45702C11.3159 1.91314 12.4863 2.78757 13.3067 3.95356",strokeMiterlimit:10}),r.createElement("path",{d:"M14.2937 6.04849C14.4534 6.6227 14.5327 7.21628 14.5293 7.81228C14.5286 9.23797 14.0739 10.6264 13.2311 11.7763C12.3883 12.9262 11.2012 13.7779 9.84185 14.2078C8.48253 14.6377 7.02161 14.6236 5.67085 14.1675C4.32008 13.7114 3.14967 12.8369 2.32925 11.671",strokeMiterlimit:10})),"Sync"),bu={},fu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return bu[e]={loading:!1,error:null,scriptEl:t}},yu="undefined"!=typeof window&&void 0!==window.document;function xu({src:e,checkForExisting:t=!1,...n}){let r=bu[e];!r&&t&&e&&yu&&(r=fu(e));const[a,o]=c(r?r.loading:Boolean(e)),[i,l]=c(r?r.error:null),[s,d]=c(!1);return u(()=>{if(!yu||!e||s||i)return;let a;r=bu[e],!r&&t&&(r=fu(e)),r?a=r.scriptEl:(a=document.createElement("script"),a.src=e,Object.keys(n).forEach(e=>{void 0===a[e]?a.setAttribute(e,n[e]):a[e]=n[e]}),r=bu[e]={loading:!0,error:null,scriptEl:a});const c=()=>{r&&(r.loading=!1),o(!1),d(!0)},u=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",c),a.addEventListener("error",u),document.body.appendChild(a),()=>{a.removeEventListener("load",c),a.removeEventListener("error",u),r&&r.loading&&(a.remove(),delete bu[e])}},[e]),[a,i]}const Cu=e=>["integrations",e??{}],Tu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function wu(e,t){return fl({...t,queryKey:Cu(e),queryFn:Tu})}function ku(e){return wu({filter:{apiName:{equal:"PLAID"}}},e)}function Eu(e){return Ea(`${t=e,Aa[t]}/v1`,"v1");var t}async function Au({institutionId:e,accessToken:t,environment:n}){if(!t)throw new Error("Access token is required to get Plaid item institution");const r={path:"/banks2/bankUrl",accessToken:t,endpointManager:Eu(n)},{url:a,headers:o}=xa(r);return await vi({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Iu="cancel",Su="danger",Nu="success",Ru=Gn({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Du=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Pu=$n({base:{background:"surface.background",borderRadius:"md",display:"flex",flexDirection:"column",gap:"16px"},variants:{size:{sm:{maxWidth:"360px",minWidth:"0",margin:"32px"},md:{maxWidth:"600px",minWidth:"400px",margin:"32px"},lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"},margin:{sm:"32px",base:"0"},height:{sm:"auto",base:"100dvh"}}},padding:{none:{padding:"0"},sm:{padding:"8px"},md:{padding:"16px"},lg:{padding:"24px"}}},defaultVariants:{size:"sm",padding:"md"}}),Mu={transform:"none",willChange:"auto"};function Lu({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=ne({open:e,strategy:"fixed"}),s=ce(l,{outsidePress:o,escapeKey:i}),c=de(l,{role:t}),{getFloatingProps:d}=ue([s,c]),u="alertdialog"===t?tr["alert-dialog"]:null,{className:h}=cr(u,Pu({size:r,padding:a}));return e?S(ve,{children:S(be,{lockScroll:!0,className:Ru,children:S(fe,{context:l,modal:!0,returnFocus:!0,children:S("div",{...d(),className:h,style:Mu,children:n})})})}):null}const Fu=cr(tr["close-button"],Gn({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",color:"icon.base",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),el),Ou=()=>_l();function Vu({Icon:e=uc,handleClose:t=Ou}={}){return S("button",{...Fu,onClick:t,type:"button",children:S(ud,{Component:e,...Fu})})}const Bu=cr(tr["alert-header"],Gn({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"26px"},Ka));function Uu({children:e}){return S("div",{...Bu,children:e})}const Wu=Gn({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),Hu=Gn.raw({width:"100%"}),zu=e=>{switch(e){case qu.DANGER:return"danger";case qu.SUCCESS:return"success";case qu.ACTION:return"primary";default:return"secondary"}},qu={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ju=ye.createConfirmation(xe(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Lu,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Du,children:[S(Uu,{children:r}),o&&S(Vu,{handleClose:()=>n()})]}),a&&"string"==typeof a?S(Ys,{wrap:"wrap",children:a}):S(N,{children:a}),S("div",{className:Wu,children:i.map(e=>S(Ls,{intent:zu(e.type),styles:Hu,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:S(vo,{children:e.label})},e.key))})]})}));function _u(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function Ku(e){return new U(e).div(100).toNumber()}function Yu(e){return new U(e).times(100).toNumber()}function Zu(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function Gu(e,t){return t?e?`${e} ${Zu(t)}`:Zu(t):e??""}const Qu=e=>jl("Conversation",{routeProps:{conversationId:null,defaultValues:e}}),Xu=Gn({display:"flex",flexDirection:"column",gap:"12px"});async function Ju(e){await ju({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const $u=e=>["banks/accounts",e??{}],eh={integration:{expand:!0},status:{notIn:["REMOVED"]}},th=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment,i={path:"/v6/banks/accounts/query",bodyParams:{...n,filter:{...n.filter},cursor:r},accessToken:a,endpointManager:mi(o)},l=await wa(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function nh(e){return fl({queryKey:$u({...e?.params,filter:{...eh,...e?.params?.filter}}),queryFn:th,enabled:e?.enabled,select:e?.select})}function rh(e,t){return Yl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:e,environment:t})}const ah={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},oh={short:{credentialsChanged:e=>`${e} Credentials Changed`,accountLocked:e=>`${e} Account Locked`,supportChanged:e=>`${e} Support Changed`,updateNeeded:e=>`${e} Update Needed`,noAccountsAvailable:e=>`No ${e} Accounts Available`,connectionError:e=>`${e} Connection Error`,serverError:e=>`${e} Server Error`,temporarilyDown:e=>`${e} Temporarily Down`,serverDown:e=>`${e} Server Down`,requestError:e=>`${e} Request Error`,inputError:e=>`${e} Input Error`,volumeDown:e=>`${e} Down Due to Volume`,credentialsExpiring:e=>`${e} Credentials Expiring`,relinkNeeded:e=>`${e} Relink Needed`,generic:()=>"Bank Connection Error"},long:{relinkCredentials:()=>"Please relink your account using your latest credentials.",invalidUpdatedUsername:({isMobile:e})=>`Your bank account has an updated username and needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,accountLocked:({isMobile:e})=>`Your bank account has been locked. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" and ask your financial institution to unlock your account. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,supportChanged:({apiPartnerName:e})=>`Unfortunately, your bank has added restrictions that block services like ${e||"ours"} from linking with it. Please chat with support to resolve this issue.`,updateNeeded:({isMobile:e})=>`Your bank requires you to take some action. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to log in and perform the requested action. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,mfaUpdateNeeded:({isMobile:e})=>`You have an unsupported "Multi-Factor Authentication" enabled. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to disable it on your banking site. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,noAccountsUnlink:()=>"It seems that you have no active accounts with this bank. Please unlink this bank.",connectionError:()=>"Your bank connection encountered an error. Please chat with support to resolve the issue.",productNotReady:()=>"Your institution was not ready for transactions to be pulled. Please chat with support to resolve the issue.",permissionRevoked:({apiInstitutionName:e})=>`Access to your accounts with ${e} has been revoked. Please unlink and relink your account using your latest credentials.`,bankMaintenance:()=>"Your bank's server is down for maintenance, so it may take a little longer than normal to receive new transactions.",serverDown:()=>"Your bank's server is unexpectedly down. Please chat with support to resolve the issue.",bankConnectionMaintenance:()=>"Your bank connection is down for maintenance, so it may take a little longer than normal to receive new transactions.",partnerCredsChange:({isMobile:e})=>`Your bank account needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,credentialsExpiring:({apiInstitutionName:e})=>`Your authorization for ${e} will expire soon. Please relink your bank with your latest credentials.`,relinkForStatements:()=>"Please relink your account using your latest credentials to enable automatic retrieval of bank statements.",generic:()=>"There was an error with your bank connection. Please chat with our team so they can resolve it."}},ih={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_MFA:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.invalidUpdatedUsername,buttonType:ah.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:oh.short.accountLocked,longMessage:oh.long.accountLocked,buttonType:ah.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT},USER_SETUP_REQUIRED:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.updateNeeded,buttonType:ah.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.mfaUpdateNeeded,buttonType:ah.OPEN_BANK},NO_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},ITEM_NOT_FOUND:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCT_NOT_READY:{shortMessage:oh.short.serverError,longMessage:oh.long.productNotReady,buttonType:ah.CHAT},USER_PERMISSION_REVOKED:{shortMessage:oh.short.connectionError,longMessage:oh.long.permissionRevoked,buttonType:ah.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:oh.short.serverDown,longMessage:oh.long.serverDown,buttonType:ah.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PLANNED_MAINTENANCE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankConnectionMaintenance,buttonType:ah.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:oh.short.requestError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:oh.short.inputError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:oh.short.volumeDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.partnerCredsChange,buttonType:ah.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:oh.short.credentialsExpiring,longMessage:oh.long.credentialsExpiring,buttonType:ah.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:oh.short.relinkNeeded,longMessage:oh.long.relinkForStatements,buttonType:ah.RELINK}},DEFAULT:{DEFAULT:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:oh.short.generic,longMessage:oh.long.generic,buttonType:ah.CHAT}}};function lh({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=ih[e];if(!n)return pa({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(pa({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT)}const sh=e=>{const t=e?.status?"DELETED"===e.status?"REMOVED":e.status:"ACTIVE",n="MORTGAGE"!==e?.apiType&&"BROKERAGE"!==e?.apiType&&e?.apiType?e.apiType:"OTHER";return{iconUrl:"",...e,id:e.id??"",status:"DELETED"===e.status?"REMOVED":t,name:e.apiName??"",apiName:"PLAID",glAccountId:ss({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:ss({id:e.plaidItemId||e.oauthAccountId,prefix:"INTEGRATION"}),apiInstitutionId:e.apiInstitutionId??null},mask:e.apiMask??"",beginningBalanceData:{},isSupported:e.isSupported||!1,tranStartDate:e.tranStartDate||null,tranMinStartDate:e.tranMinStartDate||null,latestTransactionDate:e.latestTransactionDate||null,accountBalance:e.apiCurrentBalance||null,subType:e.apiSubType||null}};function ch({mutationFn:e,onMutateFn:t,...n}){const r=kr(),a=Nr(),o=!Cr(r);return F({...n,mutationFn:o?t=>e({data:t,accessToken:r,environment:a}):Er,onMutate:o&&rr(t)?e=>t({data:e,accessToken:r,environment:a}):void 0},Ir)}const dh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Na(n)};return await ka(r)},uh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),hh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),ph=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/accounts",bodyParams:{accounts:e.accounts},accessToken:t,endpointManager:Na(n)};return await ka(r)})({data:{accounts:e},accessToken:t,environment:n});function gh(e){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},...e})}function mh(){return gh({mutationFn:hh})}function vh(){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:ph})}const bh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,fh=e=>"PLAID"===e,yh=e=>({id:cs(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),xh=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Ch=async()=>ju({title:"Merge Accounts",body:R("div",{className:xh,children:[S(Ys,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),S(Ys,{wrap:"wrap",children:"This action can't be undone."}),S(Ys,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Continue",type:qu.DANGER}]}),Th=()=>ju({title:"Merge Failed",body:S(Ys,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Iu,label:"OK"}]}),{formContext:wh,fieldContext:kh,useFieldContext:Eh,useFormContext:Ah}=Ce(),Ih=ci(e=>r.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{id:"icon/check"},r.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function Sh({children:e,stylists:t=[],...n}){return S(Ls,{intent:"success",stylists:t,...n,children:e})}function Nh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Sh,{type:"submit",disabled:n,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Rh=cr(null,Gn({display:"flex",width:"100%"}));function Dh({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r}){return R(sd,{type:"submit",disabled:n,stylists:[Rh],onClick:r,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Ph=$n({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{weak:{backgroundColor:"border.layout.weak"},normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"border.intent.secondary"}}}});function Mh({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=cr("vertical"===e?tr["vertical-divider"]:tr["horizontal-divider"],n,Ph({alignment:e,color:t}));return S("div",{...r})}const Lh=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),Fh=[cr(null,Gn({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],Oh=cr(null,Gn({display:"flex",alignItems:"center",gap:"4px"}));function Vh({errorMessage:e}){return R("div",{...Oh,children:[S(ud,{Component:ui,stylists:Fh}),S(fo,{intent:"danger",wrap:"wrap",children:e})]})}const Bh=Gn({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function Uh({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o}){return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[e,o&&S("div",{className:Bh,children:S(Vh,{errorMessage:o})}),S(Dh,{showIcon:t,disabled:r,onClick:a,textContent:n})]})]})}const Wh=Gn.raw({"&[data-state='closed'][data-disablehover='false']":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:not([data-state])[data-disablehover='false']:not(:focus-within)":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&[data-state='open']":{backgroundColor:"surface.intent.action.discreet.active"},"&[data-active='false']:has(:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),Hh=Gn.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function zh({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i}}}const qh=Gn({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},Wh),jh=Gn(Hh),_h=Gn({display:"flex",flexDirection:"column",gap:"8px"}),Kh=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Yh({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:d,errorMessage:u,disableHover:h=!1,type:p,remainingChars:g,hasErrorStyles:m}){const v=cr(i||null,qh,l,jh,el),[b,f]=c(!0),{dataAttributes:y}=zh({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h});return R("div",{className:_h,children:[R("div",{className:Kh,children:[void 0!==r&&S(Ys,{children:r}),rr(g)&&S(Ys,{children:`${g}`})]}),S("div",{...v,onClick:s,...n,onMouseDown:e=>{f(!0),t&&t.current&&e.target!==t.current&&(e.preventDefault(),t.current.focus())},onFocus:()=>{t&&t.current&&function(e,t){if("setSelectionRange"in e&&"number"!==t){const t=e.value.length;e.setSelectionRange(t,t)}}(t.current,p)},onBlur:()=>{f(!1),d?.()},...y,children:e}),o&&"open"!==n?.["data-state"]&&u&&S(Vh,{errorMessage:u})]})}const Zh=Gn({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled","&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}});function Gh({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a}){const o=Eh(),i=Te(o.store,e=>e.meta.errors[0]?.message),l=Te(o.store,e=>e.meta.isDefaultValue),s=Te(o.store,e=>e.meta.isTouched);return S(Yh,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:l,isTouched:s,className:tr["discreet-form-input"],additionalStyles:Zh,errorMessage:i,onClick:a,onBlur:o.handleBlur,children:e})}function Qh(e){((navigator.userAgent?navigator.userAgent.toLowerCase().includes("mac"):navigator.platform.toLowerCase().includes("mac"))?e.metaKey:e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),e.currentTarget.requestSubmit())}function Xh(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Jh(e){"Enter"===e.key&&e.currentTarget.blur()}const $h=cr(tr["amount-input"],mr({metric:"md"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),ep=cr(null,Gn({display:"flex",alignItems:"center",gap:"2px"}));function tp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=c(!1);return R("div",{...ep,children:[nr(e)&&S(hu,{children:"$"}),S(ke,{...$h,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:nr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Jh,autoFocus:o})]})}const np=Gn({backgroundColor:"surface.foreground.disabled",pointerEvents:"none",border:"{borderWidths.lg} solid",borderColor:"border.layout"}),rp=$n({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function ap({kind:e,label:t,children:n,inputRef:r,disabled:a,popupTriggerProps:o,onClick:i,disableHover:l=!1,type:s,maxLength:c,hasErrorStyles:d}){const u=Eh(),h=Te(u.store,e=>e.meta.errors[0]?.message),p=Te(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=rr(c)?c-g:void 0,v=a?np:rp({kind:e});return S(Yh,{label:t,inputRef:r,popupTriggerProps:o,className:tr["editable-form-input"],additionalStyles:v,errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,children:n})}const op=cr(null,Gn({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function ip({options:e,onSelect:t,selectedLabel:n}){const r=cc();return S("div",{...op,children:e.map(e=>S(Tc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const lp=ci(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2922)"},r.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2922"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),sp=cr(tr["dropdown-selector-button"],Gn({cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderRadius:"sm",gap:"7px",backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),Ji);function cp({selectedLabel:e,options:t,onSelect:n}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...sp,...t,children:[S(vo,{children:e}),S(hc,{Component:lp})]})}),S(xc,{children:S(ip,{options:t,onSelect:n,selectedLabel:e})})]})}const dp=cr(null,Gn({display:"flex",alignItems:"center",gap:"15px"})),up=kt.map((e,t)=>({value:t,label:e})),hp=Et({}).map(e=>({value:e,label:String(e)}));function pp({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return R("div",{...dp,children:[S(cp,{selectedLabel:kt[r],options:up,onSelect:e=>a(n,e)}),S(cp,{selectedLabel:String(n),options:hp,onSelect:e=>a(e,r)})]})}const gp=cr(null,Gn({background:"surface.foreground",padding:"25px",gap:"15px"})),mp=cr(null,Gn({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),vp=cr(tr["date-picker-nav-button"],Gn({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),Ji),bp=cr(null,Gn({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),fp=cr(null,Gn({padding:"8px",textAlign:"center"})),yp=cr(tr["date-picker-day-button"],Gn({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"6px",width:"36px",height:"36px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"sm",cursor:"pointer",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}},"&[data-selected='true']":{backgroundColor:"surface.intent.action.discreet.active",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.active"},"&[data-today='true']::after":{content:"''",position:"absolute",bottom:"3px",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:"brand.primary"},"&:disabled":{cursor:"default"}}),Ji),xp=cr(null,Gn({color:"typography.base"}));function Cp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&At(e,t),l=It(e),s=e.getMonth()!==n,c=!!a&&St(e,a),d=!!o&&St(o,e);return S("button",{...yp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:S(vo,{stylists:s||c||d?[xp]:[],children:e.getDate().toString()})})}function Tp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=cc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=it(e,t,1),r=new Date(n);return r.setDate(r.getDate()-n.getDay()),Array.from({length:42},(e,t)=>{const n=new Date(r);return n.setDate(r.getDate()+t),n})}(s,c),u=(h=d)[h.length-1];var h;const p=void 0===a||u&&St(a,u),g=nr(o)||d.length>0&&St(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return R("div",{...gp,children:[R("div",{...mp,children:[S("button",{...vp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:S(rl,{Component:Gi})}),S(pp,{currentMonthYear:l,onMonthYearChange:r}),S("button",{...vp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:S(rl,{Component:Qi})})]}),R("div",{...bp,children:[wt.map(e=>S("div",{...fp,children:S(fo,{children:e})},e)),d.map(t=>S(Cp,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const wp=cr(null,mr({label:"default"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),kp=cr(null,mr({label:"default"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",cursor:"text",overflowWrap:"break-word",minWidth:"100%",maxWidth:"100%","&::placeholder":{color:"typography.base.weak"},"&:focus":{outline:"none"}}));function Ep(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant"}),e.current.setAttribute("data-hasscrolled","true"))}async function Ap(e){const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const Ip=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),Sp=[...Ip].map(e=>`.${e}`).join(","),Np=/* @__PURE__ */new Set(["xls","xlsx","csv"]),Rp={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...Ip].map(e=>e.toUpperCase()).join(", ")} file.`,fileTooLarge:"File exceeds the 50MB size limit.",fileTooLargeSpreadsheet:"File exceeds the 50MB size limit. Try splitting it into smaller parts.",duplicate:"File has already been attached. To replace it, delete the existing file first.",maxAttachmentsReached:"Maximum of 3 attachments allowed per transaction. Remove an existing attachment to add more."},Dp={"image/jpeg":[".jpg",".jpeg",".jfif"],"image/png":[".png"],"image/gif":[".gif"],"image/heic":[".heic"],"image/tiff":[".tif",".tiff"],"image/svg+xml":[".svg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"application/vnd.ms-excel":[".xls"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"text/csv":[".csv"],"text/plain":[".txt"]};function Pp(e,t,n,r,a,o,i=crypto.randomUUID(),l=null,s=null,c=null){return{localId:i,id:t,file:e,displayText:r,displayFileName:n,isPending:a,hasError:o,fileSize:l,iconUrl:s,publicFileUrl:c}}function Mp(e,t,n){return Pp(e,null,e.name,t,!1,!0,n)}async function Lp(e,t){const n=await async function(e,t){const n=e.name.split("."),r=n.length>=2?n[n.length-1].toLowerCase():void 0;if(!r||!Ip.has(r))return Rp.unsupportedFileType;if(e.size>52428800)return Np.has(r)?Rp.fileTooLargeSpreadsheet:Rp.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await Ap(e);for(const e of a)if(await Ap(e.file)===t)return Rp.duplicate}return null}(e,t);return n?Mp(e,n):Pp(e,null,e.name,Rp.pendingUpload,!0,!1)}const Fp=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Na(n).getUrl(`/files/upload/${a}`),s=Cr(o)?"att_"+i:o,c=new FormData;return c.append("file",r),c.append("caption",s),c.append("entityId",String(i)),(await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`},credentials:"include",body:c})).json()};function Op(){return ch({mutationFn:Fp,onSuccess:async()=>Ir.invalidateQueries({queryKey:["files/attachments"]})})}const Vp=async({data:e,accessToken:t,environment:n})=>{const r=Na(n).getUrl("/files/attachment");return(await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e.id})})).json()};const Bp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Up=Gn({display:"none"}),Wp=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=Op();return{mutateAsync:d(async t=>{const n=t.map(({file:t})=>e({file:t,entity:"message",caption:t.name,entityId:null})),r=await Promise.allSettled(n);return t.map((e,t)=>function(e,t){if("fulfilled"===t.status&&"SUCCESS"===t.value.result){const n=t.value?.attachment?.id??null,r=t.value?.attachment?.caption??e.file.name,a=t.value?.attachment?.fileSize??null,o=t.value?.attachment?.iconUrl??null,i=t.value?.attachment?.publicFileUrl??null;return Pp(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return Mp(e.file,Rp.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=d(()=>{r.current?.click()},[]),l=d(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>Lp(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await o(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,o]);return R("div",{children:[S("input",{className:Up,type:"file",multiple:!0,accept:Sp,ref:r,onChange:l}),S(Fs,{type:"button",onClick:i,children:S("span",{className:Bp,children:S(ud,{Component:Oc})})})]})},Hp=I.custom(),zp=I.object({message:I.object({text:I.string(),attachments:I.array(Hp)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),qp=Gn.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),jp=Gn.raw({visibility:"hidden",fontSizeAdjust:"none",fontSize:"100%",fontStyle:"normal",letterSpacing:"normal",fontStretch:"normal",fontVariant:"normal",fontWeight:"normal",textAlign:"left",textAlignLast:"initial",textDecoration:"none",textEmphasis:"none",textIndent:"0px",textJustify:"auto",textShadow:"none",textTransform:"none"}),_p=Gn(jp,qp),Kp=Gn.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),Yp=Gn(Kp,qp,mr.raw({body:"default"})),Zp=Gn({display:"block",width:"100%"}),Gp=Gn({position:"relative"}),Qp=Gn({display:"flex",justifyContent:"flex-end",gap:"15px"}),Xp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Jp=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Eh(),c=a(null),{startCallback:d}=yl({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&zp.safeParse(s.form.state.values).success;return S(ap,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Ep(t),void d(!0)),children:R("div",{className:Zp,children:[R("div",{className:Gp,children:[R("pre",{className:_p,children:[s.state.value.text,S("br",{})]}),S("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:Yp,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Qp,children:[!i&&S(Wp,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),S(Fs,{disabled:!u,type:"submit",children:S("span",{className:Xp,children:S(ud,{Component:gd})})})]})]})})}),$p=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,eg=i(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function tg(e,t){switch(t.type){case"increment":return((e,t)=>{let n;if(null===e.focusedIndex)n=0;else{const r=e.focusedIndex+1;n=!t.repeat&&r>e.maxIndex?0:Math.min(r,e.maxIndex)}return{...e,focusedIndex:n}})(e,t);case"decrement":return((e,t)=>{let n;if(null===e.focusedIndex)n=e.maxIndex;else{const r=e.focusedIndex-1;n=!t.repeat&&r<0?e.maxIndex:Math.max(r,0)}return{...e,focusedIndex:n}})(e,t);case"set":return{...e,focusedIndex:Math.min(t.focusedIndex,e.maxIndex)};case"max":return{...e,maxIndex:t.max}}}function ng(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function rg(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return r.top>=n.top&&r.bottom<=n.bottom&&r.left>=n.left&&r.right<=n.right}function ag(e,t,n){if(null===e)return{node:void 0,metadata:void 0};const r=t[e];return{node:r,metadata:n.get(r)}}function og(e){const[t,n]=c(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:i,isMousing:s,isScrolling:h}=function(e,t){const n=a(null),[r,o]=c(!0),[i,s]=c(!1),d=l(eg),[h,p]=v(tg,{focusedIndex:null,maxIndex:e});u(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&nr(h.focusedIndex)&&void 0!==d?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,d?.popupNodeId,t.forceRootCascade]);const g=a(null);return u(()=>{p({type:"max",max:e})},[e]),u(()=>{const e=n.current;if(null!==e){const n=e=>{s(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));h.focusedIndex===r&&g.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(o(!0),g.current=e.target,p({type:"set",focusedIndex:r}),t.setCascadeState(!0,r))},r=e=>{const t="ArrowDown"===e.key||"Tab"===e.key&&!e.shiftKey,n="ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey;o(!1),s(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>s(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",a),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",a)}}},[t,h.focusedIndex]),{listRef:n,focusedState:h,isMousing:r,isScrolling:i}}(t.size-1,e),p=cc(),g=d((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),m=d(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:b,sortedMap:f}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(ng)),n},[e,t]),r=o(()=>{const t=/* @__PURE__ */new Map;return n.forEach((n,r)=>{const a=e.get(n)??{};t.set(n,{...a,index:r})}),t},[n,e]);return{sortedNodes:n,sortedMap:r}}(t,r);!function(e,t,n,r,a,o){u(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=ag(r,t,n),{shouldOpenCascade:c,shouldCloseCascade:d}=function(e,t,n,r){const a=e.placement.includes("left"),o=e?.popupParentNodeId&&!r.forceRootCascade,i=o&&n?.hasCascading&&a?"ArrowLeft":"ArrowRight",l=a?"ArrowRight":"ArrowLeft";return{shouldOpenCascade:n?.hasCascading&&t.key===i,shouldCloseCascade:o&&t.key===l}}(a,e,s,o),u=!(e.target instanceof HTMLInputElement&&""!==e.target.value)&&" "===e.key;var h,p,g,m,v;c||"Enter"===e.key||u?(p=r,g=l,m=i,v=o,!(!(h=s)||!h.hasCascading||null===p||g&&m&&rg(g,m)&&(v.setCascadeState(!0,p),v.setFocus(!0),0))||function(e){const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});e?.dispatchEvent(t)}(l),e.preventDefault()):d&&(e.preventDefault(),a.close())};return i.addEventListener("keydown",l),()=>{i.removeEventListener("keydown",l)}},[e,t,r,n,a,o])}(r,b,f,i.focusedIndex,p,e);const{startCallback:y,cancelCallback:x}=yl({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&rg(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=i.focusedIndex,u(()=>{const e=E.current;if(null===C||T)return;const{node:t,metadata:n}=ag(C,w,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),I({focusedIndex:C,node:t,listElement:e})),()=>S()},[C,T=s,E=r,A=e,S=x,w=b,k=f,I=y]),function(e,t,n,r){u(()=>{const{metadata:a}=ag(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(i.focusedIndex,b,f,e),o(()=>({register:g,unregister:m,map:f,focusedIndex:i.focusedIndex,listRef:r,isMousing:s,isScrolling:h,popupNodeId:p?.nodeId}),[g,m,f,i.focusedIndex,r,s,h,p?.nodeId]);var C,T,w,k,E,A,I,S}const ig=i(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function lg({style:e,children:t,forceNewCascade:n}){const r=cr(tr["popup-list"],rc,e),a=function(e){const[t,n]=c(null),[r,a]=c(!1),[o,i]=c(null),l=d((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=d(()=>{n(null),i(null),a(!1)},[n,i,a]),u=d(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:u,forceRootCascade:e}}(n),o=og(a);return S("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:S(eg.Provider,{value:o,children:S(ig.Provider,{value:a,children:t})})})}function sg({searchTerm:e,setSearchTerm:t,onClick:n,placeholder:r,SearchInput:a,SearchList:o,DefaultList:i,extraProps:l,listLength:s,forceSearchVisible:c}){const d=c||s>=5,u=Tr(e),h=e=>{n?.(e)};return R(N,{children:[d&&S(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?S(o,{...l??{},onClick:h,searchTerm:e}):S(i,{...l??{},onClick:h})]})}const cg=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function dg({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return u(()=>{r.current?.focus({preventScroll:!0});const e=e=>{const t=document.activeElement,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement;!r.current||document.activeElement===r.current||n||(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)&&"Backspace"!==e.key||r.current.focus()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[]),S("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:cg})}function ug({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=cc(),[d,u]=c(""),h=Tr(d),p=l?.(h);return S(xc,{children:S(lg,{style:p,children:S(sg,{searchTerm:d,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:dg,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function hg({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:i,focusedIndex:s,isMousing:c,listRef:u}=l(eg);g(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==i&&null!==t.current?i.get(t.current)?.index??-1:-1,[i]),p=h===s;g(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const m=d(()=>{u?.current?.focus()},[u]),v=o(()=>({onFocus:m,"data-focused":p}),[m,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const pg=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return S("button",{...oc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),gg=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=hg(),l=me([i,r]);return S(pg,{...oc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),mg=Gn({display:"flex",gap:"8px",alignItems:"center"});function vg({promptText:e}){return R("div",{className:mg,children:[S(rl,{Component:xs}),S(Ys,{children:e})]})}function bg({text:e}){return S("div",{...oc,children:e?S(vo,{children:e}):S(jo,{styles:Gn({width:"100%",height:"16px"})})})}const fg=cr(tr["popup-list"],rc),yg=()=>R("div",{...fg,children:[S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{})]});function xg({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?S(yg,{}):R(N,{children:[r&&S(gg,{onClick:()=>jl("BankAccountForm"),children:S(vg,{promptText:"Add bank account"})}),e?.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}const Cg={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Tg={...Cg,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function wg({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ee(e??[],Tg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[a&&S(gg,{onClick:()=>jl("BanksAndIntegrations"),children:S(vg,{promptText:"Add bank account"})}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}function kg({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return S(ug,{onClick:e,placeholder:"Search bank accounts...",SearchList:wg,DefaultList:xg,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Eg=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function Ag({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=Gu(n?.name??"",n?.mask??"");return R(sc,{placement:"bottom-start",children:[S(dc,{children:r=>S(ap,{label:e,popupTriggerProps:r,disabled:t,children:S("button",{className:Eg,type:"button",disabled:t,children:rr(n)?S(Ys,{children:i}):S(Ys,{intent:"weak",children:"Select bank account"})})})}),S(kg,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const Ig=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),Sg=e=>{if(nr(e))return!1;const t=e.filter(e=>fh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||rr(e.lastSyncedDate))},Ng=()=>{const e=nh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function Rg(){return nh({select:e=>{return{...e,plaidItemAccountsReadyToSync:Sg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>fh(e.apiName)))};var t}})}function Dg(e){return e?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)}function Pg(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function Mg(e){return nh({select:t=>({...t,data:Pg(t?.data,e)})})}const Lg=e=>{const{query:t}=nh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data},Fg=()=>["expenses/categories"],Og=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:ss({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?ss({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function Vg(e){return Rr({...e,queryKey:["expenses/categories"],queryFn:Og})}function Bg(){return Vg({select:e=>({...e,data:e.data?jg(e.data):void 0})})}function Ug(e,t){return(t.get(e)??[]).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Wg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Hg(){return Vg({select:e=>({...e,data:e.data?Wg(e.data):void 0})})}function zg(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentCategoryId){const e=t.get(n.parentCategoryId)??[];e.push(n),t.set(n.parentCategoryId,e)}return t}function qg(e){if(0===e.length)return[];const t=zg(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function jg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function _g(){return xl({prefetchFn:ml(Fg,Og)})}const Kg=e=>({id:e.id,name:e.name});function Yg(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:_u("Category","Categories",n.size,!0),list:[...n].join(", ")}}const Zg=cr(tr.text,mr({label:"strongLabel"}),Gn({maxWidth:"100%"}),ja);function Gg({children:e,stylists:t=[]}){const n=gr([Zg,...t]);return S("div",{...n,children:e})}const Qg={keys:[{name:"name"}],threshold:.1};function Xg(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Jg(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.id===l.id))),o=!(a||0!==r?.children?.length&&r.children),i=!a&&r.children&&r.children.length>0;var l;a?Xg(a,r,n):o?Xg(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Xg(e,n,t)})}(r,n)}),n}const $g=cr(tr["category-icon"],Gn({objectFit:"contain"})),em=cr(tr["category-icon"],Gn({objectFit:"contain",color:"icon.base"}));function tm(e,t,n){const r=({size:n=24})=>{const{icons:r}=l(li),a=e;return Tr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?S(Ae,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...em}):S("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...$g});var o};return r.displayName=t,r}const nm=cr(null,Gn({whiteSpace:"normal"})),rm=[cr(null,Gn({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function am({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=Vg({select:e=>({...e,data:e.data?qg(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ee(i??[],Qg),[i]),c=o(()=>i?Jg(s.search(e),i):[],[i,e,s]);return a?S(yg,{}):l?S(bg,{text:"No data"}):0===c.length?S(bg,{text:"No results found"}):S(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=tm(n.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(Kg(n)),children:[S(ud,{Component:a}),S(Gg,{stylists:[nm],children:r?n.name:R(N,{children:[e.name,S(rl,{Component:Qi,stylists:rm}),n.name]})})]},`${e.id}_${n.id}`)})})}const om=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=me([a,t?.ref]);return S(pg,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function im({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=l(ig),{itemRef:o,index:i,itemProps:s}=hg({hasCascading:!0}),{isScrolling:c}=l(eg);return R(sc,{open:n===i,onOpenChange:e=>{c||r(e,i)},placement:"right-start",children:[S(dc,{children:t=>S(om,{itemProps:s,index:i,ref:o,popupTriggerProps:t,children:e})}),S(xc,{initialFocus:a,children:t})]})}const lm=Gn({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),sm=Gn({display:"flex",gap:"8px",color:"icon.base"});function cm({Icon:e,iconUrl:t,displayLabel:n}){const r=t?tm(t,"Icon"):void 0;return R("div",{className:lm,children:[R("div",{className:sm,children:[!nr(e)&&e,nr(e)&&r&&S(ud,{Component:r}),S(vo,{wrap:"wrap",children:n})]}),S(rl,{Component:Qi})]})}function dm({category:e,handleCategoryChange:t}){return S(lg,{children:e.children?.map(e=>{const n=tm(e.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(Kg(e)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:e.name})]},e.id)})})}function um({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=Bg(),a=t?.data,o=!r&&n&&void 0===a;return r?S(yg,{}):o?S(bg,{text:"No data"}):S(N,{children:a?.map(t=>{if(t.hasChilds)return S(im,{triggerChildren:S(cm,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:S(dm,{category:t,handleCategoryChange:e})},t.id);const n=tm(t.iconUrl,"Expense Category Icon");return R(gg,{onClick:()=>e(Kg(t)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:t.name})]},t.id)})})}const hm=({onClick:e})=>{const{query:{data:t}}=Bg();return S(ug,{onClick:e,placeholder:"Search expense categories...",SearchList:am,DefaultList:um,listLength:(t?.data??[]).length})},pm=cr(tr["category-text"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",padding:0,outline:"none",border:"none",background:"none",borderRadius:"md",color:"typography.intent.action",flex:"1 1 0",minWidth:0,cursor:"pointer",_supportHover:{color:"typography.intent.action.hover"},"&:focus-visible":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"},"& .Tight-icon > path":{_supportHover:{stroke:"typography.intent.action.hover"}}}),tl),gm=cr(null,Gn({color:"inherit"})),mm=cr(tr["amount-input-container"],Gn({borderRadius:"md",border:"none",background:"transparent",color:"typography.intent.action",maxWidth:"120px","&:not(:focus-within)":{_supportHover:{color:"typography.intent.action.hover"}},"& .Tight-amount-input, & .Tight-text":{color:"inherit"},"&[data-clicked='true']:focus-within":{outline:"1px solid",outlineOffset:"2px",outlineColor:"border.layout.strong"},"&[data-clicked='false']:has(:focus-visible)":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"}}),tl);function vm({options:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map((e,r)=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(Ys,{children:e.label})},`${e.label}_${r}`))})})}const bm=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),fm=Gn.raw({color:"typography.base.weak"}),ym=(e,t)=>e===t;function xm({options:e,label:t,isEqual:n=ym,isEmpty:r,disabled:a}){const o=Eh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!nr(o.state.value)&&!r?.(o.state.value);return R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>S(ap,{label:t,popupTriggerProps:n,disabled:a,children:S("button",{...bm,type:"button",children:S(Ys,l?{children:i(e,o.state.value)}:{extraClassNames:[fm],children:`Select ${t.toLowerCase()}...`})})})}),S(vm,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const Cm=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),Tm=e=>r.createElement("svg",{width:16,height:16,stroke:"currentColor",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),wm=ci(Tm,"Bank",{styleIconKey:"bank"}),km=$n({base:{display:"flex",flexDirection:{base:"row",sm:"column"},alignItems:{base:"center",sm:"start"},justifyContent:"flex-start",textAlign:"start",gap:"4px",maxWidth:"100%",flexWrap:"wrap",minWidth:0},variants:{active:{true:{flexDirection:"column-reverse",alignItems:"start"},false:{flexDirection:{base:"column"},alignItems:{base:"start"}}}}});function Em({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?Gu(e,t):e;return R("div",{className:km({active:r}),children:[n&&S(fo,{intent:r?"normal":"weak",children:n}),S(Ys,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const Am=e=>["plaidInstitutionLogo",e??{}],Im=Gn({display:"flex",gap:"10px",maxWidth:"100%"});function Sm({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=kr(),n=Nr();return M({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Au({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?tm(i,"Logo"):void 0;return R("div",{className:Im,children:[S(ld,{Component:l&&o?l:wm}),S(Em,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Nm=Gn({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Rm({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return S(Fs,{...r,disabled:n,width:"fill-parent",children:S(Gg,{children:e?Gu(e.name,e.mask):R("div",{className:Nm,children:[S(Ys,{children:t}),S(rl,{Component:xs})]})})})}const Dm="TRIGGER_ACCOUNT",Pm="FORM_SELECTABLE_ACCOUNT",Mm=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Lm({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Mm,children:[R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(Rm,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Dm?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),S(kg,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&S(Vh,{errorMessage:o})]})}const Fm=(e,t,n)=>{if(!n)return;const r=e===Pm?t:n,a=e===Pm?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,fh(c)&&bh(d));var c,d;const u=(h=r?.status,p=a?.status,"ACTIVE"===h&&"INACTIVE"===p);var h,p;return o?"Selected account number does not match destination account number":s?"Merging a linked account into a manually tracked account may result in duplicate transactions":u?"You selected an active account to be merged into an archived account":void 0},Om=Gn({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Vm=Gn({display:{base:"block",sm:"none"}}),Bm=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Um=Gn({display:"flex",justifyContent:"center",alignItems:"center"}),Wm=Gn({display:{base:"none",sm:"block"}}),Hm=Gn({display:{base:"block",sm:"none"}});function zm({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Om,children:[R("div",{className:Bm,children:[o?S(Lm,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Dm,bankAccounts:n,isFilling:r,warningMessage:Fm(Dm,e,t??null)}):S(Rm,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Um,children:[S("div",{className:Wm,children:S(ud,{Component:Qi})}),S("div",{className:Hm,children:S(ud,{Component:lp})})]}),S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),S("div",{className:Vm,children:S(Mh,{alignment:"horizontal"})})]})}function qm({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=V({...n,queryKey:i,queryFn:o?t:Er,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const jm=e=>["vendors",e??{}],_m=e=>["vendors","infinite",e??{}],Km=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Ym=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Km({queryParams:n,cursor:r,accessToken:a,environment:o})};function Zm(e={},t){return fl({queryKey:jm(e),queryFn:Ym,...t})}const Gm=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Km({queryParams:n,cursor:o,accessToken:r,environment:a})};async function Qm(e){const{url:t,headers:n}=xa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=ba({extraHeaders:n,authorization:t});ha("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ha("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function Xm(e){return Qm(e)}const Jm=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:mi(n)}),$m=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),ev=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:mi(n)}),tv=async()=>await Ir.invalidateQueries({queryKey:["vendors"]});function nv(){return ch({mutationFn:Jm,onSuccess:tv})}const rv=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),av=Gn({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),ov=cr(tr["button-inline"],Gn({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function iv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:av,children:[S("input",{ref:o,type:"text",placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r()):"Escape"===e.key&&(e.preventDefault(),a())},onFocus:e=>{e.stopPropagation()},className:rv}),S("button",{type:"button",onClick:r,...ov,children:S(fo,{children:"Add"})})]})}function lv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);return u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]),S(gg,{onClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:s}):S(vg,{promptText:e})})}function sv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ee(e??[],Cg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(Ys,{children:e.name})},e.id))]})}function cv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>S(gg,{onClick:()=>t(e),children:S(Ys,{children:e.name})},e.id))]})}function dv({onClick:e}){const{query:{data:t,isLoading:n}}=Zm({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=nv(),a=t?.data??[];return S(ug,{onClick:e,placeholder:"Search vendors...",SearchList:sv,DefaultList:cv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}function uv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const hv=e=>["customers",e??{}],pv=e=>["customers","infinite",e??{}],gv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},mv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return gv({queryParams:n,cursor:r,accessToken:a,environment:o})};function vv(e={},t){return fl({queryKey:hv(e),queryFn:mv,...t})}const bv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return gv({queryParams:n,cursor:o,accessToken:r,environment:a})},fv=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:mi(n)}),yv=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),xv=async()=>await Ir.invalidateQueries({queryKey:["customers"]});function Cv(){return ch({mutationFn:fv,onSuccess:xv})}const Tv={type:"tween",duration:.3},wv={x:"100%"},kv={x:0},Ev={x:"100%"};function Av({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return S(xc,{style:r,modal:!0,forceMount:t,children:e})}const Iv=Gn({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Sv=cr(null,Iv);function Nv({children:e,clickHandler:t}){const n=cc();return t||(t=()=>{n.close()}),S(be,{lockScroll:!0,...Sv,onClick:t,children:e})}const Rv=Gn({display:"flex",flexDirection:"column",position:"fixed",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},backgroundColor:"surface.background"});function Dv({children:e,overlay:t=!1}){const n=cc(),r=d(e=>{e.stopPropagation()},[]);return S(Ie,{children:n.context.open&&R(Av,{fadeIn:!1,forceMount:!0,children:[t&&S(Nv,{}),S(Se.div,{transition:Tv,initial:wv,animate:kv,exit:Ev,className:Rv,onAnimationEnd:r,children:e})]})})}const Pv=Gn.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Mv=Gn.raw({display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",maxWidth:{base:"none",sm:"512px"},scrollbar:"hidden"}),Lv=cr(tr["drawer-header"],Gn(Pv));function Fv({hideDivider:e=!1,children:t}){return R(N,{children:[S("header",{...Lv,children:t}),!e&&S(Mh,{alignment:"horizontal",color:"normal"})]})}const Ov=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Vv({children:e}){return S("div",{className:Ov,children:e})}const Bv=Gn({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Uv=$n({base:Mv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Wv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=cc();return R(N,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>{r?.(),i.close()}}),S(vo,{children:o}),!nr(t)&&S("div",{className:Bv,children:t})]})}),S("div",{className:Uv({padChildren:a}),children:n}),e]})}function Hv({overlay:e=!1,...t}){return S(Dv,{overlay:e,children:S(Wv,{...t})})}const zv=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.19899 11.5105C8.9944 11.5105 11.2605 9.2444 11.2605 6.44899C11.2605 3.65358 8.9944 1.38745 6.19899 1.38745C3.40358 1.38745 1.13745 3.65358 1.13745 6.44899C1.13745 9.2444 3.40358 11.5105 6.19899 11.5105Z",strokeMiterlimit:10}),r.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),qv=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),jv=cr(tr["drawer-search-bar"],Gn({display:"flex",padding:"16px",flexDirection:"row",alignItems:"center",gap:"8px",flex:"1 0 0",borderRadius:"sm",border:"1px solid {colors.border.layout}",backgroundColor:"surface.foreground",maxHeight:"49px",minWidth:"fit-content"})),_v=Xn(Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",backgroundColor:"surface.foreground",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),mr({label:"strongLabel"})),Kv=cr(null,Gn({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Yv({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:qv,children:[S(vo,{children:"Search"}),R("div",{...jv,children:[S(ud,{Component:zv}),S("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:_v}),Tr(e)&&S(Fs,{stylists:[Kv],onClick:()=>t(""),children:S(ud,{Component:uc})})]})]})}function Zv({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=c("");return S(sg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Yv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function Gv({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:u}){const[h,p]=ic({},a?.selected,i),[g,m]=ic({},a?.expanded,l),v=d((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),b=d((e,t)=>{const n=t??!g[e],r={[e]:n};m({...g,...r})},[g,m]),f=o(()=>e.map((e,a)=>({key:r({rows:e,groupIndex:a,originalGroup:t?.[a]}),index:a,original:t?.[a]??void 0,getRows:()=>e.map((e,t)=>{const r=n(e,t);return{key:r,value:e,expanded:g[r]??!1,getCanSelect:()=>c?.(e)??!0,getIsSelected:()=>h[r]??!1,toggleSelected:e=>v(r,e),getCanExpand:()=>u?.(e)??!0,getIsExpanded:()=>g[r]??!1,toggleExpanded:()=>b(r,!g[r])}})})),[e,r,t,n,h,v,g,b,c,u]);return o(()=>{const e={selected:h,expanded:g};return{groups:f,toggleSelected:v,toggleExpanded:b,getState:()=>e}},[f,v,b,g,h])}const Qv=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2768)"},r.createElement("path",{d:"M2.70654 9.12132C3.60197 9.12132 4.32787 8.39543 4.32787 7.49999C4.32787 6.60456 3.60197 5.87866 2.70654 5.87866C1.8111 5.87866 1.08521 6.60456 1.08521 7.49999C1.08521 8.39543 1.8111 9.12132 2.70654 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M8.32496 9.12132C9.22039 9.12132 9.94629 8.39543 9.94629 7.49999C9.94629 6.60456 9.22039 5.87866 8.32496 5.87866C7.42952 5.87866 6.70363 6.60456 6.70363 7.49999C6.70363 8.39543 7.42952 9.12132 8.32496 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M13.9434 9.12132C14.8388 9.12132 15.5647 8.39543 15.5647 7.49999C15.5647 6.60456 14.8388 5.87866 13.9434 5.87866C13.048 5.87866 12.3221 6.60456 12.3221 7.49999C12.3221 8.39543 13.048 9.12132 13.9434 9.12132Z",fill:"currentColor"}))),"Dots"),Xv=Gn({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function Jv({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:Xv,children:[S(ud,{Component:Qv}),S(vo,{wrap:"wrap",children:`No ${t} found`}),n&&S(fo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const $v=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function eb({children:e}){return S("div",{className:$v,children:e})}const tb=cr(tr["list-body"],null);function nb({title:e,children:t}){return R(eb,{children:[e,S("div",{...tb,children:t})]})}const rb=ci(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10})),"Circle"),ab=cr(null,Gn({fill:"surface.intent.action.active"}));function ob({selected:e,showEmptyIndicator:t}){return e?S(ud,{Component:pi,stylists:[ab]}):t?S(ud,{Component:rb}):null}const ib=$n({base:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"9px",cursor:"pointer",padding:"16px",color:"typography.intent.secondary",minHeight:"52px",width:"100%",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}}}});function lb({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=cr(tr["selector-row"],ib({selected:r}),el);return S("button",{onClick:t,...a,...n,type:"button",children:e})}function sb({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(lb,{handleClick:t,selected:n,children:[e,S(ob,{selected:n,showEmptyIndicator:r})]})}const cb=Gn.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function db(){return S(jo,{styles:Gn(ac,cb)})}const ub=Gn({width:"70px",height:"24px"}),hb=Gn({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function pb(){return R("div",{className:hb,children:[S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]}),S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]})]})}function gb({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ee(e,Cg),[e]),s=Gv({data:o(()=>l.search(t).map(e=>e.item),[l,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?S(pb,{}):0===s.groups.length?S(Jv,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):S(nb,{title:S(Ys,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})}const mb=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),vb=Gn({width:"100%"});function bb({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]);const d=()=>{l(""),o(!1)};return R("div",{className:vb,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d()},children:[S(Mh,{alignment:"horizontal"}),S(lb,{handleClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:d,inputRef:s}):S(vg,{promptText:e})})]})}function fb({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=Gv({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?S(pb,{}):R(eb,{children:[S(bb,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n}),R("div",{className:mb,children:[S(Ys,{children:"Customers"}),S("div",{children:i.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})]})]})}function yb({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=vv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(uv)})}),{mutateAsync:a}=Cv(),o=cc(),i=n?.data??[],[l,s]=c(t?{[t.id]:!0}:{}),d=!l[t?.id??""];return S(Hv,{title:"Back",Footer:S(Uh,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!d}),onClose:()=>s(t?{[t.id]:!0}:{}),children:S(Zv,{placeholder:"Search customers...",onClick:e=>{nr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:gb,DefaultList:fb,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a({data:[{name:e}]}),n=t.data?.[0]?.data?.id;n&&s({[ss({id:n,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function xb({frequencies:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map(e=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(vo,{children:e.name})},e.value))})})}const Cb=$n({base:{minWidth:0,borderRadius:"zero",border:"1px solid",borderColor:"border.layout",_first:{borderRight:"none"},_last:{borderLeft:"none"},"&:not(:first-child):not(:last-child)":{borderLeft:"none",borderRight:"none"},_focus:{zIndex:2}},variants:{width:{full:{width:"100%"}},backgroundColor:{foreground:{backgroundColor:"surface.foreground"}},active:{true:{borderColor:"border.intent.secondary",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function Tb({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=cr(tr["button-group"],Xn(Cb({width:a,backgroundColor:o,active:t,corners:i}),Es,Ts,Gn(Ds),Ji));return S("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?S(vo,{wrap:"wrap",textAlign:"center",children:e.label}):S(Ys,{wrap:"wrap",alignment:"center",children:e.label})})}const wb=$n({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function kb({width:e,children:t}){return S("div",{className:wb({width:e}),children:t})}function Eb({options:e,handleClick:t,selectedIndex:n}){const[r,a]=c(null);return S(kb,{width:"full",children:e.map((e,o)=>R(b,{children:[0!==o&&S(Mh,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),S(Tb,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const Ab=ci(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),r.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),r.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),Ib=Gn({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",padding:"16px",gap:"8px",outline:"none",color:"icon.base",borderRadius:"2px",border:"{borderWidths.md} dashed {colors.border.layout}"},Wh,Hh,$i),Sb=cr(null,Gn({color:"icon.base"})),Nb=cr(tr["attachment-dropzone"],Ib);function Rb({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Nb.className,onMouseDown:r,onBlur:n}),children:[S("input",{...t()}),S(ud,{stylists:[Sb],Component:Ab}),S(Ys,{children:"Add Files"})]})}const Db=Gn({display:"flex",flexDirection:"column",gap:"8px"}),Pb=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Mb({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:Db,children:[o&&S("div",{className:Pb,children:S(Ys,{children:o})}),S(Rb,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&S(Vh,{errorMessage:i})]})}const Lb=Gn({display:"flex",justifyContent:"start",width:"100%"}),Fb=Gn({display:"flex",alignItems:"center",gap:"9px"}),Ob=Gn({width:"100%"}),Vb=$n({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Bb(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Ub({flatDimensionValues:e,dimensions:t,dimensionValueOptions:n,selectedRow:r,searchTerm:a,onClick:i}){const l=o(()=>e.filter(e=>{const n=t.find(t=>t.id===e.dimension?.id);return!n||!Bb(n)}),[e,t]),s=o(()=>new Ee(l,Cg),[l]),c=o(()=>new Set(s.search(a).map(e=>e.item.id)),[s,a]),d=o(()=>n.map(e=>e.filter(e=>c.has(e.id))).filter(e=>e.length>0),[c,n]);if(0===d.length)return S(Jv,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:"Search Results"})}),S("div",{className:Vb({nested:u}),children:d.map(e=>S("div",{className:Ob,children:e.map(e=>S(lb,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:Fb,children:[S(ob,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),S(Ys,{children:e.name})]})},e.id))},e[0].id))})]})}const Wb=ci(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2940)"},r.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2940"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),Hb=$n({base:{display:"flex",alignItems:"stretch",width:"100%",minHeight:"52px",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},variants:{active:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}},expanded:{true:{borderBottom:"none"}}}}),zb=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",padding:"16px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent",color:"typography.intent.secondary","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),qb=Gn({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"16px",minWidth:"58px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}});function jb({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=cr(tr["selector-row"],Hb({active:r,expanded:a}),el);return R("div",{...i,children:[o?R("button",{type:"button",className:zb,onClick:t,children:[S(ob,{selected:r,showEmptyIndicator:!r}),e]}):S("div",{className:zb,children:e}),!nr(n)&&S("button",{type:"button",className:qb,onClick:n,children:S(ud,{Component:a?Wb:lp})})]})}function _b({dimensionValueRows:e,onClick:t}){return e.map(e=>S(lb,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:Fb,children:[S(ob,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),S(Ys,{children:e.value.name})]})},e.key))}function Kb({fieldDimension:e,dimensionValueOptions:t,dimensions:n,selectedRow:r,setSelectedRow:a,allowMultiselect:o,onClick:i}){const l=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),s=Gv({data:t,groups:l,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),hasMultiSelect:o??!1,getCanSelect:e=>{const t=n.find(t=>t.id===e.dimension?.id);return!t||!Bb(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:e})}),S("div",{className:Vb({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:Ob,children:[(c||0===t)&&S(Mh,{alignment:"horizontal"}),S(jb,{onClick:n.getCanSelect()?()=>i(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:S(Ys,{children:n.value.name})}),n.expanded&&R(N,{children:[S(Mh,{alignment:"horizontal"}),S(_b,{dimensionValueRows:r,onClick:i})]})]},e.key)}return S(_b,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function Yb({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=d(t=>{if(n){const e=!a[t.id],n={...a,[t.id]:e};if(e){const e=r.find(e=>e.some(e=>e.id===t.id));e&&e.length>1&&(e[0].id===t.id?e.slice(1).forEach(e=>{n[e.id]=!1}):n[e[0].id]=!1)}o(n)}e?.(t)},[n,r,a,o,e]);return S(Zv,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Ub,DefaultList:Kb,listLength:t.flatDimensionValues.length,extraProps:t})}function Zb({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){const i=o(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.dimension?.id);return!n||!Bb(n)}),[n,r]),[l,s]=c(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),d=o(()=>i.flat(),[i]),u=cc(),h=Object.values(l).some(Boolean);return S(Wv,{title:"Back",Footer:S(Uh,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=d.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:S(Yb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:d,selectedRow:l,setSelectedRow:s})})}function Gb(e){const t=cc();return S(Dv,{children:t.open&&S(Zb,{...e})})}const Qb=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),Xb=Gn.raw({color:"typography.base.weak"});function Jb(e){const t=e.slice(0,10);return 0===t.length?"":t.length<=3?`(${t}`:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`}const $b=/\D/g,ef=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),tf=Gn({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),nf=$n({base:{display:"inline-flex",height:"25px",padding:"5px 10px",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"md",border:"{borderWidths.lg} solid",borderColor:"border.intent.secondary",background:"surface.intent.secondary",fontSize:"sm",fontWeight:"sm",lineHeight:"14px",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),rf=Gn({border:"none",background:"none",padding:0,cursor:"pointer"}),af=Gn({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function of({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...cr(tr.pill,n,nf({disabled:r})),children:[S("div",{className:af,children:e}),S("button",{className:rf,onClick:t,disabled:r,children:S(hc,{Component:uc,stylists:[cr(null,tf)]})})]})}const lf=I.email(),sf=Gn({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),cf=Gn({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},mr.raw({label:"default"})),{useAppForm:df,withForm:uf,withFieldGroup:hf}=we({formContext:wh,fieldContext:kh,formComponents:{SaveButton:Nh,FormSaveButton:Dh,FormFooter:Uh},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Eh();return S(Gh,{inputRef:t,label:e,children:S(tp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Eh();return S(ap,{inputRef:r,label:e,hasErrorStyles:t,children:S(tp,{value:o.state.value,onChange:o.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:o=!1,hasErrorStyles:i}){const l=Eh(),s=Te(l.store,e=>e.meta.isDefaultValue),d=a(null),[u,h]=c(()=>l.state.value?Pt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Pt(l.state.value):null,[g,m]=c(""),v=e=>{const r=function(e){const t=e.replace(/\D/g,"");return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4,8)}`}(e.target.value);m(r);const a=Dt(r);if(a){let e=a;t&&n?e=Ft(Lt(a,t),n):t?e=Lt(a,t):n&&(e=Ft(a,n)),l.handleChange(Mt(e)),h(e)}else l.handleChange("")},b=g||(p?Nt(p):""),[f,y]=c(!1),x=e=>{f&&(()=>{if(p&&!s){const e=Dt(g);(t&&e&&St(e,t)||n&&e&&St(n,e))&&m(Nt(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),x(!f))},T=o?ap:Gh;return R(sc,{placement:"bottom-start",onOpenChange:x,open:f,children:[S(dc,{children:t=>S(T,{label:e,inputRef:d,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:S("input",{...wp,ref:d,type:"text",id:l.name,value:b,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),S(xc,{initialFocus:!1,children:S(Tp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Mt(e)),m(Nt(e)),h(e)},viewDate:u,onViewDateChange:h,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const o=Eh(),i=a(null);return S(ap,{label:e,inputRef:i,children:S("textarea",{...kp,ref:i,value:o.state.value||"",onChange:e=>o.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:Jp,SplitExpenseCategoryField:function({value:e,onChange:t}){const n=e?.iconUrl?tm(e.iconUrl,"Expense Icon"):void 0;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...pm,...t,type:"button",children:[n&&S(ud,{Component:n}),S(vo,{stylists:[gm],children:e?.name||"Uncategorized"})]})}),S(hm,{onClick:t})]})},SplitExpenseAmountField:function({value:e,onChange:t,onBlur:n}){const[r,a]=c(!1);return S("div",{...mm,"data-clicked":r,children:S(tp,{value:e,onChange:t,onClick:()=>a(!0),onBlur:()=>(a(!1),void n())})})},ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Eh(),a=Lg(t?.id??""),{query:{data:o},isFilling:i}=nh({select:e=>({...e,data:Dg(e?.data)})}),l=o?.data,s=rr(e)&&!$p(e);return S(Ag,{label:"Bank Account",disabled:s,onClick:e=>{var t;n({id:(t=e).id,name:t.name}),r()},bankAccount:a,bankAccountOptions:l,isFilling:i})},ButtonGroupField:function({label:e,options:t}){const n=Eh(),r=t.findIndex(e=>e.value===n.state.value);return S(ap,{label:e,disableHover:!0,children:S(Eb,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:xm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Eh(),l=a(null);return S(ap,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:S("input",{className:Cm,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:zm,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?ap:Gh,{handleBlur:l}=Eh();return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),S(dv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?ap:Gh;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),S(yb,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??Gl[0].name}`;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(ap,{inputRef:r,label:e,popupTriggerProps:t,children:S(vo,{children:o})})}),S(xb,{frequencies:Gl,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=Dp,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Eh(),{mutateAsync:d}=Op(),[u,h]=c(!0),{dataAttributes:p}=zh({isActive:u,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l}),{getRootProps:g,getInputProps:m}=Ne({maxFiles:e,accept:t,disabled:n,onDrop:async t=>{const n=s.state.value??[],r=n.filter(e=>!e.hasError).length,a=e-r,o=t.slice(0,a),i=t.slice(a),l=[...await Promise.all(o.map(e=>Lp(e,n))),...i.map(e=>Mp(e,Rp.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const u=c.map(async e=>{try{const t=await d({file:e.file,entity:"glSource",caption:e.file.name,entityId:null}),n=t?.attachment;return{localId:e.localId,success:!0,id:n?.id??null,iconUrl:n?.iconUrl??null,publicFileUrl:n?.publicFileUrl??null,fileSize:n?.fileSize??null}}catch{return{localId:e.localId,success:!1,id:null,iconUrl:null,publicFileUrl:null,fileSize:null}}}),h=await Promise.allSettled(u);s.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=c.findIndex(t=>t.localId===e.localId);if(-1===t)return e;const n=h[t];return"fulfilled"===n?.status&&n.value.success?{...e,isPending:!1,hasError:!1,displayText:"",id:n.value.id,iconUrl:n.value.iconUrl,publicFileUrl:n.value.publicFileUrl,fileSize:n.value.fileSize}:{...e,isPending:!1,hasError:!0,displayText:"Upload failed. Please try again."}}))}});return S(Mb,{getRootProps:g,getInputProps:m,dataAttrs:p,onMouseDown:()=>h(!0),onBlur:()=>h(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(sc,{children:[S(dc,{children:n=>S(ap,{label:e,popupTriggerProps:n,children:S("button",{className:Qb,type:"button",children:S(Ys,t?{children:t.name}:{extraClassNames:[Xb],children:`Select ${e.toLowerCase()}...`})})})}),S(Gb,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Eh(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),S(ap,{label:e,disabled:t,inputRef:o,kind:"text",children:S("input",{className:ef,value:Jb(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace($b,"").length,o=t.value.replace($b,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=Jb(o);i.current=function(e,t){let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e[r])){if(n===t)return r;n++}return e.length}(l,a)},onBlur:function(){const e=r.state.value;e.length>0&&e.length<10&&r.setErrorMap({onBlur:{message:"Phone number is incomplete"}})},type:"text",inputMode:"numeric",ref:o,placeholder:n})})},MultiEmailField:function({label:e,disabled:t,placeholder:n="Add email address"}){const r=Eh(),[o,i]=c(""),l=a(null),s=r.state.value,d=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=lf.safeParse(e);return t.success?!s.some(t=>t.toLowerCase()===e.toLowerCase())||(r.handleBlur(),r.setErrorMap({onChange:{message:"Email already added"}}),!1):(r.handleBlur(),r.setErrorMap({onChange:{message:t.error.issues[0].message}}),!1)})(e)&&(r.handleChange([...s,e]),r.setErrorMap({onChange:void 0}),i(""))};return S(ap,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:sf,children:[s.map(e=>S(of,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:tr["email-pill"],disabled:t},e)),S("input",{ref:l,className:cf,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:d,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),d()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const pf=[cr(null,Gn({"& path":{stroke:"icon.base"}}))];function gf({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Fs,{type:"button",onClick:n,children:[e&&S(rl,{Component:uc,stylists:pf}),S(vo,{children:t})]})}const mf=Gn({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),vf=Gn({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),bf=Gn({maxWidth:"600px"}),ff=Gn({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),yf=Gn({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),xf=Gn({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Cf=Gn({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Tf=Gn({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),wf=Gn({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),kf=e=>{Qh(e),Xh(e)};function Ef({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=nh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=vh(),a=kr(),o=Nr(),i=rr(n),l=i?{selectedAccounts:n}:e;return i&&a&&n.forEach(({duplicateAccount:e})=>{var t,n,r;e&&(t=e.id,n=a,r=o,Zl({queryKey:yr(Jl({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:es,accessToken:n,environment:r}))}),df({defaultValues:l,onSubmit:async e=>{if(await Ch()===Su){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await Th());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=yr(Jl({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await Yl({queryKey:r,queryFn:es,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Pt(e.tranStartDate||""),l=Pt(n||""),s=Pt(e.tranMinStartDate||""),nr(l)?i:rr(s)?Ft(l,s):(rr(i)&&Ft(l,i),i));var i,l,s;return nr(r)?null:Mt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...yh(t),duplicateBankAccountIds:[cs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await Th()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:mf,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:kf,children:[R("div",{className:vf,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:bf,children:S(Ys,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:ff,children:[R("div",{className:yf,children:[S("div",{className:xf,children:S(vo,{children:"Duplicate Account"})}),S("div",{className:Cf,children:S(vo,{children:"Into"})}),S("div",{className:Tf,children:S(vo,{children:"Destination Account"})})]}),S(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>S(i.AppField,{name:`selectedAccounts[${n}]`,children:t=>{const n=t.state.value.duplicateAccount?.id,o=function(e,t,n,r){const a=function(e,t,n){const r=new Set(e.map(e=>e.id));return t.forEach(({duplicateAccount:e})=>{e&&e.id!==n&&r.add(e.id)}),Array.from(r)}(e,t,n);return r?.filter(e=>!a.includes(e.id)&&bh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return S(zm,{destinationAccount:t.state.value.destinationAccount,selectedDuplicate:t.state.value.duplicateAccount,availableAccounts:o,isFilling:a,onSelectionChange:e=>{const n={duplicateAccount:e,destinationAccount:t.state.value.destinationAccount};t.handleChange(n)}},t.state.value.destinationAccount.id)}},n))})]}),S("div",{className:wf,children:S(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[S(gf,{showIcon:!1,onClick:()=>n()}),S(sd,{onClick:()=>i.reset(o),disabled:!t,children:S(vo,{children:"Clear Selections"})}),S(Nh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Af=Gn({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",width:"100%",maxWidth:"100%",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative",overflow:"hidden",boxSizing:"border-box"}),If=ye.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return S(Lu,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:S("div",{className:Af,children:S(Ef,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Sf({plaidItemAccounts:e,matchingAccountPairs:t}){await If({matchingAccountPairs:t,plaidItemAccounts:e})}const Nf=Gn({display:"flex",flexDirection:"column",gap:"12px"}),Rf=async(e,t,n)=>{try{const r=await async function({accessToken:e,plaidItemId:t,environment:n}){if(!e)throw new Error("Access token is required to create Plaid link token");const r={path:"/banks2/createPlaidLinkToken",accessToken:e,endpointManager:Eu(n)},{url:a,headers:o}=xa(r);return vi({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ha("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(pa({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),Ju("NO_LINK_TOKEN"))}catch(r){return pa({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),Ju("LINK_TOKEN_FAILED")}};async function Df(e,t,n){const r=await async function(e,t){const n=yr(Cu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await Yl({queryKey:n,queryFn:Tu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Pf(e,t,n,r){ha("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ha("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,Zl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:r,environment:a});const o=await Df(e,t,n);if(o){const e=await rh(t,n);return e?.data?.filter(e=>e.integration?.id===o.id)||[]}}var r,a;return[]}(t?.institution?.institution_id,n,r),{plaidItem:i}=await async function({publicToken:e,metadata:t,accessToken:n,environment:r}){if(!n)throw new Error("Access token is required to create Plaid link token");const a={path:"/banks2/webPlaidPublicToken",accessToken:n,endpointManager:Eu(r)},{url:o,headers:i}=xa(a);return await Ca({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ha("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Ir.invalidateQueries({queryKey:["integrations"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]}),Ir.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===lh({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return pa({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const l=await rh(n,r),s=l?.data?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=T(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(pa({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ju({title:"Uh Oh!",body:"It appears something went wrong fetching the accounts from your bank. Please chat with the support or try again later.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void pa({error:new Error("No new accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}});if(!i.some(e=>"ACTIVE"===e.status))return pa({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ju({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Iu,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return pa({error:new Error("Accounts saved successfully with unsupported accounts"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),function(e,t,n){const r=e.length;return ju({title:"All set! Ready to track your transactions?",body:R("div",{className:Xu,children:[S(Ys,{wrap:"wrap",children:`Your ${n} ${t} ${_u("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),S(Ys,{wrap:"wrap",children:`The following linked ${r>1?"accounts are":"account is"} not supported at this time, so ${r>1?"they":"it"} will remain unsynced.`}),S("ul",{children:e.map(e=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Nu,label:"Get Started",type:qu.SUCCESS}]})}(l,o,e.plaidItemAccounts.length);const s=function(e,t){const n=[];for(const r of e){if(!r.apiMask)continue;const e=t.find(e=>e.mask===r.apiMask&&r.isSupported);e&&n.push({destinationAccount:sh(r),duplicateAccount:e})}return n}(i,a);return s.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await ju({title:"Your transactions are being categorized",body:R("div",{className:Nf,children:[S(Ys,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),S(Ys,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),R("ul",{children:[r.map(({duplicateAccount:e})=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e?.name??"",e?.mask??"")})},e?.id)),a&&S("li",{children:S(Ys,{wrap:"wrap",children:"and more..."})})]}),S(Ys,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Iu,label:"No thanks"},{key:Nu,label:"Review",type:qu.SUCCESS}]})===Nu&&await Sf({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(pa({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ju({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${_u("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Nu,label:"Get started",type:qu.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return pa({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`I tried to link with ${e} and it failed (CODE: BANK_POST_FAILURE).`,attachments:[]}})}(t.institution?.name||"my bank"),{}}var a}async function Mf(e,t,n){return nr(e)?(ha("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ha("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(pa({error:new Error("Plaid Item sync failed, refreshing Plaid Items"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),!0):("INVALID_UPDATED_USERNAME"===e.error_code&&(pa({error:new Error("Plaid Item sync failed due to invalid updated username"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),await async function(e){const t=await ju({title:e,body:'Your bank account has an updated username. To fix it, tap "Banks & Integrations", and unlink your old account, so you can relink it with your new username. If you need any assistance, tap "Chat" to chat with a member of our team.',buttons:[{key:Iu,label:"Cancel"},{key:"chat",label:"Chat"},{key:Nu,label:"Banks & Integrations",type:qu.SUCCESS}]});"chat"===t?Qu({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Nu||(e=>{const t=ln.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||jl("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Lf=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Vt(t.lastSyncedDate)}`},Ff=e=>{let t;return e.isSupported?"ACTIVE"!==e.status?t="Archived":!e.lastSyncedDate&&e.syncTransactions?t="Processing":e.syncTransactions||(t="Not Synced"):t="Not Supported",t},Of="PLAID_LINK_NEW",Vf="PLAID_LINK_UPDATE",Bf="PLAID_LINK_UNLINK";function Uf({plaidEvent:e,plaidItemId:t,apiAccessToken:n,apiErrorCode:r,message:a}){return{eventType:"onPlaidLink",message:a,defaultPrevented:!0,data:{plaidEvent:e,integrationId:t,apiAccessToken:n,apiErrorCode:r}}}const Wf=i({});function Hf({onPlaidLink:e,children:t}){return S(Wf.Provider,{value:{onPlaidLink:e},children:t})}function zf(){return l(Wf)}const qf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)};function jf(){return ch({mutationFn:qf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const _f=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Na(t)};return await ka(n)};function Kf(){return ch({mutationFn:_f,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const Yf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(cs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Na(n)};return await async function(e){return Qm(e)}(r)};function Zf(){const{mutate:e}=Kf();return ch({mutationFn:Yf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})},onError:async t=>{pa({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Try Again",type:qu.SUCCESS}]})===Nu&&e()}})}function Gf(e){return new Promise(t=>{window.Plaid.create({token:e,onSuccess:(e,n)=>t({status:"success",public_token:e,metadata:n}),onExit:(e,n)=>t({status:"exit",metadata:n,error:e}),onEvent:(e,t)=>{ha(`Plaid event: ${e}`,{metadata:t,eventName:e})}}).open()})}async function Qf(e,t,n,r){const a=await Rf(e,t,n);if(!a)return;const o=await Gf(a);if("success"===o?.status){const{public_token:e,metadata:a}=o;ha("Plaid link successful",{public_token:e,metadata:a});const i=await Pf(e,a,t,n);if(i.relinkPlaidItemId)return Qf(i.relinkPlaidItemId,t,n,r)}else if("exit"===o?.status){const{metadata:e,error:t}=o;ha("Plaid link exited",{metadata:e,error:t}),await Mf(t,e,a)&&r()}else pa({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:o,token:a}})}function Xf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=Kf(),{onPlaidLink:o}=zf();return{linkPlaid:e=>{if(rr(o)){const t=Uf(e);o(t)}else Qf(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(o)}}function Jf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=Kf(),{apiPartnerName:o}=l(Lc),{onPlaidLink:i}=zf();return{linkPlaid:e=>{if(rr(i)){const t=Uf(e);i(t)}else!async function(e,t,n,r,a){const o=await Rf(e,t,n);if(!o)return;const i=await Gf(o);if("success"===i?.status){const{public_token:e,metadata:o}=i;ha("Plaid link from search successful",{public_token:e,metadata:o});const l=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Df(t.institution.institution_id,n,r);if(i)return pa({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ju({title:"Already Linked",body:`It seems that this bank is already linked${o?` with ${o}`:""}. Please tap "Relink" to update the existing linked institution.`,buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]}))===Nu?{relinkPlaidItemId:cs(i.id)}:{}}var o;return ha("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Pf(e,t,n,r)}(e,o,t,n,r);l.relinkPlaidItemId&&Qf(l.relinkPlaidItemId,t,n,a)}else if("exit"===i?.status){const{metadata:e,error:t}=i;ha("Plaid link from search exited",{metadata:e,error:t}),await Mf(t,e,o)&&a()}}(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,o,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(i)}}const $f=cr(null,Ts,Gn({position:"absolute",left:1,right:1,bottom:1,width:"calc(100% - 2)",height:"44px",background:"surface.intent.primary",border:"none",borderRadius:0,gap:9,color:"icon.intent.primary",pointerEvents:"all",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}}}),Ji);function ey(){const{linkPlaid:e,loading:t}=Xf();return R("button",{onClick:()=>e({plaidEvent:Of,message:"Tile Plaid Link button pressed"}),...$f,disabled:t,children:[S(ud,{Component:vu}),S(Ys,{intent:"primary",children:"Link Account"})]})}const ty=Gn({width:266,minHeight:32});function ny(){return S(jo,{styles:ty})}const ry=cr(tr.text,Gn({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function ay({children:e}){return S("div",{...ry,children:e})}const oy={SUCCESS:Gn({backgroundColor:"surface.intent.success.highlight"}),DANGER:Gn({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:Gn({backgroundColor:"surface.intent.secondary"})},iy=cr(tr.chip,Gn({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function ly({variant:e,children:t}){return S("div",{className:Xn(iy.className,oy[e]),children:S(ay,{children:t})})}const sy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function cy({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${co(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return S(ly,{variant:sy(r,n,t),children:a})}const dy=Gn({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function uy({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:dy,children:[S(ro,{title:e,label:t}),rr(n)&&S(cy,{difference:n,invertDirection:r})]})}const hy={netIncome:0,income:0,expenses:0,absoluteSum:0},py=e=>{if(nr(e))return hy;const t=e.income?.total??0,n=e.expenses?.total??0,r=U(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},gy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(py):[]},my=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function vy({defaultRange:e=gt.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i},isFilling:l}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:gy})}({filter:a,grouping:t?Va:void 0}),{profitLossData:s,profitDifference:c}=o(()=>{if(n)return{profitLossData:ti,profitDifference:null};if(!i||0===i.length)return{profitLossData:my,profitDifference:null};if(2===i.length){const[e,t]=i;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:i[0],profitDifference:null}},[i,n]);return R(qa,{isSample:n,children:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:l?R(Ko,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(s.netIncome),label:"Profit",comparison:c}),R(oo,{children:[S(mu,{amount:s.income,total:s.absoluteSum,color:"positive",label:"Income"}),S(mu,{amount:s.expenses,total:s.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const by=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],fy=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Na(a)};return await ka(o)},yy={moneyIn:0,moneyOut:0,netMoneyIn:0},xy=e=>{if(nr(e)||nr(e.operatingActivities)||!e.operatingActivities.children)return yy;let t=new U(0),n=new U(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(U(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Cy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(xy):[]};const Ty=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function wy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i,isFetched:l},isFilling:s}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Rr({queryKey:by({filter:e,grouping:t}),queryFn:fy,select:n})}({filter:e,grouping:t,select:Cy})}({filter:a,grouping:t?Va:void 0}),{cashFlowData:c,difference:d}=o(()=>{if(n)return{cashFlowData:ri,difference:null};if(!i||0===i.length)return{cashFlowData:Ty,difference:null};if(2===i.length){const[e,t]=i;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:i[0],difference:null}},[i,n]),u=n||l?Math.abs(c.moneyIn)+Math.abs(c.moneyOut):0;return R(qa,{isSample:n,children:[S(Ua,{title:"Cash Flow"}),S(Ha,{children:s?R(Ko,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(c.netMoneyIn),label:"Change in Cash",comparison:d}),R(oo,{children:[S(mu,{amount:c.moneyIn,total:u,color:"positive",label:"Money In"}),S(mu,{amount:c.moneyOut,total:u,color:"negative",label:"Money Out"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const ky=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Ey=Gn({display:"flex",justifyContent:"end"});function Ay({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:ky,children:[S(Ao,{color:e,label:t}),S("div",{className:Ey,children:S(Ys,{children:n})})]})}const Iy=cr(null,Gn({display:"flex",gap:"10px",alignItems:"center"})),Sy=Gn({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Ny=cr(null,Sy);function Ry({bulletAmount:e=3,shimmer:t=!1}){return S(N,{children:Array.from({length:e},(e,n)=>R("div",{...Iy,children:[S(Ao,{color:To.var("colors.brand.secondary")}),t?S(jo,{styles:Sy}):S("div",{...Ny})]},n))})}const Dy={total:0,children:[]},Py=e=>{return nr(e)||nr(e.expenses)||!e.expenses.children?Dy:{total:e.expenses.total??0,children:(t=e.expenses.children,t.sort((e,t)=>(t.total??0)-(e.total??0)).slice(0,3).map(e=>({name:e.name??"",total:e.total??0})))};var t},My=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Py):[]},Ly=[To.var("colors.brand.primary"),To.var("colors.brand.success"),To.var("colors.brand.action")],Fy=Object.freeze({total:0,children:[]});function Oy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=ln(e=>e.externalOptions).dataVisualizationColors??Ly,l=t?Wt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:My})}({filter:l,grouping:t?Va:void 0}),{expenseData:d,expensesDifference:u}=o(()=>{if(r)return{expenseData:ni,expensesDifference:null};if(!s||0===s.length)return{expenseData:Fy,expensesDifference:null};if(2===s.length){const[e,t]=s;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:s[0],expensesDifference:null}},[s,r]),h=void 0===n?"Total Expenses":`${kt[n]} Total`,p=d.children.length>0;return R(qa,{isSample:r,children:[S(Ua,{title:"Expenses"}),S(Ha,{children:c?S(Ko,{children:S(Ry,{shimmer:!0})}):R(N,{children:[S(uy,{title:uo(d.total),label:h,comparison:u,invertDirection:!0}),S(oo,{children:p?d.children.map((e,t)=>S(Ay,{color:i[t],bulletLabel:e.name,moneySummary:uo(e.total)},t)):S(Ry,{})})]})}),r&&S(Jo,{size:"sm"}),a&&S(ey,{})]})}const Vy=cr(null,Gn({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function By({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:it(l=e.year,i,1),endDate:it(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Vy,children:[R(ur,{children:[S(br,{children:"Monthly Review"}),S(nu,{period:e,setPeriod:t,disableNext:r||(s=e,c=n,h=s.month,p=c.month,h===p&&(d=s.year,u=c.year,d===u)),disablePrev:r})]}),R(au,{children:[S(vy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),S(wy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),S(Oy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const Uy="Oldest to Newest",Wy="Newest to Oldest",Hy="A-Z",zy="Z-A",qy="Lowest to Highest",jy="Highest to Lowest",_y="A-Z",Ky="Z-A";function Yy(){const[e,t]=c(void 0),n=o(()=>{if(e&&(e.orderBy||e.direction))return e},[e]);return{sortInstance:e,setSortInstance:e=>{(function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Ql)??!1,n=(e.direction&&e.direction in Xl)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const Zy=Gn({width:"15px",height:"15px",borderRadius:"sm",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,position:"relative","&::before":{content:"''",position:"absolute",top:"-10px",left:"-10px",right:"-10px",bottom:"-10px"},_supportHover:{"&[data-is-checked='false']":{backgroundColor:"surface.background.hover"}}}),Gy=Gn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),Qy=Gn({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function Xy({checked:e,onClick:t,Icon:n=Ih}){const[r,a]=c(e??!1),o=void 0===e?r:e;return S("button",{...cr(tr["checkbox-input"],Zy,o?Qy:Gy,el),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&S(hc,{Component:n})})}const Jy=cr(null,Gn({paddingLeft:"20px",paddingRight:"5px"}));function $y({checked:e,onClick:t,Icon:n=Ih}){return S("div",{...Jy,children:S(Xy,{checked:e,onClick:t,Icon:n})})}const ex=cr(tr["date-cell"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function tx({date:e,annotation:t}){const n=Nt(Pt(e));return R("div",{...ex,children:[t&&S(ay,{children:t}),S(Ys,{children:n})]})}const nx="Income",rx={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},ax={Expense:[{name:"Expense",value:rx.EXPENSE}],Income:[{name:nx,value:rx.REVENUE}],Transfer:[{name:"Bank Transfer In",value:rx.TRANSFER_IN},{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]},ox={EXPENSE:"Expense",REVENUE:nx,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},ix=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Add ${t}`])),lx=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Edit ${t}`])),sx=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},cx=e=>e===rx.TRANSFER_IN||e===rx.TRANSFER_OUT,dx=Gn({color:"money.negative"}),ux=Gn({color:"money.positive"}),hx=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>xr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),px=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!nr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:dx};const t=e.amount>0;let n;return n=t?"Expense Refund":e.children?.length>0?"Split Expense":"Expense",{type:"EXPENSE",displayName:n,css:t?ux:dx}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":nx,css:t?dx:ux}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?dx:ux};break;default:t=(e=>({type:e.type,displayName:hx(e.type),css:e.amount<0?dx:ux}))(e)}var n;return t},gx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 10.625H7.5C5.8424 10.625 4.25269 9.96652 3.08058 8.79442C1.90848 7.62231 1.25 6.0326 1.25 4.375V0.625",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),mx=cr(tr["transaction-date-cell-container"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function vx({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=px(e),a=cr(tr["transaction-type-label"],r.css),o=t?S("span",{...a,children:r.displayName}):void 0;return n?R("div",{...mx,children:[S(ud,{Component:gx}),S(tx,{date:e.date,annotation:o})]}):S(tx,{date:e.date,annotation:o})}const bx=Gn({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),fx=Gn({display:"flex",flexDirection:"column",width:"100%"}),yx=Gn({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function xx({label:e,subLabel:t,iconUrl:n}){return R("div",{className:bx,children:[n?S("img",{src:n,className:yx,alt:void 0,width:24,height:24}):S("span",{className:yx}),R("div",{className:fx,children:[S(Ys,{children:e}),S(fo,{children:t})]})]})}function Cx({bankTransaction:e,isChild:t=!1}){return t?S("div",{className:Gn({paddingLeft:"25px"}),children:S(xx,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):S(xx,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function Tx(e){return ho(Ku(e.amount))}const wx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),kx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),Ex=Gn({display:"flex",alignItems:"center",gap:"8px"}),Ax=Gn({padding:"6px"});function Ix({row:e}){const t=e.original,n=S(hu,{children:Tx(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return S(Ic,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:R("div",{className:Ex,children:[S(ud,{Component:t?kx:wx}),n]})})}return S("div",{className:Ax,children:n})}const Sx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),Nx=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),Rx=Gn({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),Dx=Gn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function Px({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Sx;case"Deposited to":return Nx;default:return null}})(e);return R("div",{className:Rx,children:[n&&S(ud,{Component:n}),R("div",{className:Dx,children:[e&&S(fo,{children:e}),t&&S(Ys,{children:t})]})]})}const Mx=Gn({maxWidth:"100%",width:"fit-content",display:"inline-flex",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.layout",background:"surface.background","& .Tight-sub-label":{color:"typography.base"},"& .Tight-icon > path":{stroke:"icon.base"}}),Lx=Xn(Mx,Gn({padding:"2.5px"})),Fx=Xn(Mx,Gn({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),Ox=Gn({background:"surface.intent.secondary",border:"{borderWidths.sm} solid",borderColor:"border.intent.secondary","& .Tight-sub-label":{color:"typography.intent.secondary"},"& .Tight-label":{color:"typography.intent.secondary"},"& .Tight-icon > path":{stroke:"icon.intent.secondary"}}),Vx=Xn(Ox,Gn({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),Bx=Gn({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.action",background:"surface.intent.action","& .Tight-sub-label":{color:"typography.intent.action"},"& .Tight-label":{color:"typography.intent.action"},"& .Tight-icon > path":{stroke:"icon.intent.action"},_supportHover:{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}}}),Ux=Xn(Bx,Gn({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),Wx=Gn({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.success",background:"surface.intent.success","& .Tight-sub-label":{color:"typography.intent.success"},"& .Tight-label":{color:"typography.intent.success"},"& .Tight-icon > path":{stroke:"icon.intent.success"}}),Hx=Xn(Wx,Gn({_supportHover:{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}}})),zx=Gn({background:"surface.intent.warning",border:"{borderWidths.sm} solid",borderColor:"border.intent.warning","& .Tight-sub-label":{color:"typography.intent.warning"},"& .Tight-label":{color:"typography.intent.warning"},"& .Tight-icon > path":{stroke:"icon.intent.warning"}}),qx=Xn(zx,Gn({_supportHover:{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}}})),jx=Gn({background:"surface.intent.danger",border:"{borderWidths.sm} solid",borderColor:"border.intent.danger","& .Tight-sub-label":{color:"typography.intent.danger"},"& .Tight-label":{color:"typography.intent.danger"},"& .Tight-icon > path":{stroke:"icon.intent.danger"}}),_x=Xn(jx,Gn({_supportHover:{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}}})),Kx=Gn({display:"flex",alignItems:"center",gap:"8px",height:"37px",margin:"0 8px",padding:"10px",borderRadius:"sm",cursor:"pointer",minWidth:0,outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}}),Yx={default:Vx,neutral:Vx,warning:qx,success:Hx,danger:_x,highlight:Ux},Zx=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=gr([cr(tr["selector-button"],Xn(Kx,Yx[e]),el),...n]);return S("button",{ref:a,...o,...r,children:t})}),Gx=()=>["accounting/glAccounts"],Qx=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(n);return $x(r)};function Xx(e){return Rr({...e,queryKey:["accounting/glAccounts"],queryFn:Qx})}function Jx(){return Xx({select:lC})}const $x=e=>e.map(e=>({...e,id:ss({id:e.id,prefix:"GL_ACCOUNT"})}));function eC(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentAccountNo){const e=t.get(n.parentAccountNo)??[];e.push(n),t.set(n.parentAccountNo,e)}return t}function tC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>tC(e,t))}const nC=e=>!e.parentAccountNo;function rC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:tC(e,t)}))}function aC(e,t){return(t.get(e)??[]).map(e=>{const n=aC(e.accountNo,t);return{...e,children:n}})}function oC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:aC(e.accountNo,t)}))}function iC(){return Xx({select:oC})}function lC(e){return rC(e).flatMap(e=>[e,...e.children])}const sC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function cC(e,t){return o(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const dC={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function uC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function hC(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.accountNo===l.accountNo))),o=!a&&r.children?.length>0,i=!(a||r.children&&0!==r.children.length);var l;o?function(e,t){e.children.forEach(n=>{uC(e,n,t)})}(r,n):a?uC(a,r,n):i&&uC(r,r,n)}),n}const pC=[cr(null,Gn({marginLeft:"6px",marginRight:"6px"}))],gC=cr(null,Gn({whiteSpace:"normal"}));function mC({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=Jx(),i=cC(r,e),l=o(()=>new Ee(i,dC),[i]),s=o(()=>hC(l.search(n),i),[i,n,l]);return a?S(yg,{}):s.map(({parent:e,child:n})=>S(gg,{onClick:()=>t(n),children:R(Gg,{stylists:[gC],children:[e.name,S(rl,{Component:Qi,stylists:pC}),n.name]})},`${n.accountNo}`))}function vC({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=Xx({select:rC}),o=cC(n,e);return a?S(yg,{}):a||r||void 0!==n?o.map(e=>S(im,{triggerChildren:S(cm,{displayLabel:e.name}),popupChildren:S(bC,{glAccount:e,onClick:t})},e.accountNo)):S(bg,{text:"No data"})}function bC({glAccount:e,onClick:t}){return S(lg,{children:e.children.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{children:e.name})},e.accountNo))})}const fC=Gn({maxWidth:"420px",width:"fit-content"});function yC({onClick:e,types:t}){const{query:{data:n}}=iC(),r=cC(n,t);return S(ug,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?fC:void 0,SearchList:mC,DefaultList:vC,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const xC={id:"mock_task_link_bank",priority:"HIGH",name:"Link your bank account",description:"Effortlessly track every dollar by linking your bank account",shortDescription:"Link your bank to track every dollar",type:"LINK_BANK",dismissable:"DISMISSABLE",status:"ACTIVE"};function CC(e,t=!0){const n=lh({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return{id:`${e.apiInstitutionName??"unknown"}_${e.id}_${e.apiErrorCode}_bank_error_task`,priority:"URGENT",name:n?.shortMessage(e.apiInstitutionName??"your bank")||"",description:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!1,apiPartnerName:""})||"",shortDescription:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!0,apiPartnerName:""})||"",type:n?.buttonType||"CHAT",dismissable:"DISMISSABLE",status:"ACTIVE",meta:{plaidItem:e}}}function TC(){return wu({filter:{status:{equal:"ACTIVE"}}},{select:e=>({multiAccountIntegrations:e.data?.filter(e=>["PLAID","UNIT"].includes(e.apiName))||[],integrations:e.data?.filter(e=>!["PLAID","UNIT"].includes(e.apiName))||[],cursor:e.cursor})})}const wC={LINK_BANK:"LINK_BANK",RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT",MESSAGE_REVIEW:"MESSAGE_REVIEW",TRANSACTION_REVIEW:"TRANSACTION_REVIEW",BANK_ERROR:"BANK_ERROR",RULE_REVIEW:"RULE_REVIEW",CSV_IMPORT_REVIEW:"CSV_IMPORT_REVIEW",ONBOARDING_FORM:"ONBOARDING_FORM"},kC=e=>["tasks",e??{}],EC={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},AC={filter:{status:{in:["ACTIVE"]}}},IC=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:mi(t[2].environment)},a=await wa(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function SC(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=nr(r=e)||nr(r.data)?[]:[...r.data].sort((e,t)=>EC[e.priority]-EC[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=AC,Rr({...r,queryKey:a?kC(a):["tasks",{}],queryFn:IC}));var r,a;const{query:{data:i},isFilling:l}=Rg(),{query:{data:s},isFilling:c}=ku({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:o(()=>{let e=[];const n=s?.data;n&&(e=n.map(e=>CC(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[xC]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const NC=e=>{const t=ji[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},RC=e=>["banks/transactions/summary",e],DC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},PC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),MC=async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}),LC=async({data:e,accessToken:t,environment:n})=>MC({data:[e],accessToken:t,environment:n}),FC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function OC(){return ha("mutation successful, invalidating BT queries"),Promise.all([Ir.invalidateQueries({queryKey:["banks/transactions"]}),Ir.invalidateQueries({queryKey:["banks/transactions/summary"]}),Ir.invalidateQueries({queryKey:["tasks"]}),Ir.invalidateQueries({queryKey:["reports"]})]).catch(e=>pa({error:e,severity:"error"}))}function VC(){return ch({onSuccess:()=>OC(),mutationFn:MC})}function BC(){return UC({mutationFn:LC})}function UC(e){return ch({onSuccess:()=>OC(),...e})}const WC=cr(tr["category-selector-table-cell"]);function HC({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=xl({prefetchFn:ml(Gx,Qx)}),{mutate:o}=BC(),i=void 0!==t,l=nr(e.glAccount?.iconUrl)?void 0:tm(e.glAccount.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[WC],onMouseEnter:r,onMouseLeave:a,children:[l&&S(ud,{Component:l}),S(Ys,{children:n})]})}),S(yC,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{o({id:e.id,glAccountId:t.id})},types:sC})]})}const zC=e=>e>0?"Deposited to":"Withdrawn from",qC=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",strokeMiterlimit:10}),r.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 7.85619 5.91297 7.11425 5.17103C6.37231 4.42909 5.36602 4.01227 4.31676 4.01227H1.67926",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 8.68983 5.91297 9.43177 5.17103C10.1737 4.42909 11.18 4.01227 12.2293 4.01227H14.8668",strokeMiterlimit:10})),"Split"),jC=cr(null,Gn({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),_C=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function KC({transaction:e}){const{label:t,list:n}=Yg(e.children);return S(_s,{children:R("div",{..._C,children:[S(ud,{Component:qC}),R("div",{...jC,children:[S(vo,{children:t}),S(fo,{children:n})]})]})})}const YC=cr(tr["category-selector-table-cell"]);function ZC({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=_g(),a=e.category?.name??"",{mutate:o}=BC(),i=void 0!==t,l=nr(e.category?.iconUrl)?void 0:tm(e.category.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[YC],onMouseEnter:n,onMouseLeave:r,children:[l&&S(ud,{Component:l}),S(Ys,{children:a})]})}),S(hm,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,categoryId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{t?.id&&o({id:e.id,categoryId:t.id.toString()})}})]})}function GC({transaction:e,parentTransaction:t}){if(e.children.length>0)return S(KC,{transaction:e});switch(sx(e.type)){case"EXPENSE_CATEGORY":return S(ZC,{transaction:e,parentTransaction:t});case"TRANSFER":return S(Px,{annotation:zC(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return pa({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return S(HC,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function QC({name:e}){return S(N,{children:e&&S(Ys,{children:e})})}function XC({onClick:e}){const t=cc(),n=Oi();return S(xc,{children:S(lg,{children:n.map(({status:n,displayName:r})=>S(gg,{onClick:()=>(e(n),void t.close()),children:S(vo,{children:r})},n))})})}const JC=cr(tr["review-status-selector-button"],Gn({width:"151px",justifyContent:"center"})),$C=cr(tr["review-status-dropdown-arrow"],Gn({display:"none"}));function eT({status:e,transactionId:t}){const[n,r]=c(!1),{mutate:a}=BC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:d}=Bi(e);return t&&((u=t).startsWith(is.TRANSACTION_LINE_ITEM)||u.startsWith(is.PROCESSOR_TRANSACTION))?null:R(sc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{variant:s,...e,stylists:[JC],onClick:i,children:[S(ud,{Component:d}),S(Ys,{children:l}),S("div",{...$C,children:S(rl,{Component:lp})})]})}),S(XC,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function tT({status:e,transactionId:t}){return S(eT,{status:e,transactionId:t},t)}function nT(){return S(ud,{Component:Qi})}function rT(){return S(nT,{})}const aT=e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),oT=ci(aT,"Dash"),iT=cr(null,Gn({stroke:"icon.base.weak"}));function lT({hasConversation:e,hasUnread:t=!1}){return S(N,{children:e?S(Dd,{hasUnread:t}):S("div",{"data-testid":"no-conversations-dash",children:S(hc,{Component:oT,stylists:[iT]})})})}function sT({conversationId:e}){const{query:{data:t}}=Sl(e??null),{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=rr(t),l=i&&"READ"===t?.readStatus,s=d(()=>{rr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=d(()=>{rr(e)&&(r(),o())},[e,r,o]);return S("div",{onMouseEnter:s,onMouseLeave:c,children:S(lT,{hasConversation:i,hasUnread:!l})})}const cT=cr(tr["badge-chip"],Lx),dT=cr(null,Za),uT=cr(null,el),hT=cr(tr["neutral-badge"],Ox),pT=cr(tr["highlight-badge"],Bx),gT=cr(tr["success-badge"],Wx),mT=cr(tr["warning-badge"],zx),vT=cr(tr["danger-badge"],tr["critical-badge"],jx);function bT({type:e,children:t}){let n;switch(e){case"danger":n=vT;break;case"warning":n=mT;break;case"neutral":n=hT;break;case"success":n=gT;break;case"highlight":n=pT}const r=gr([cT,dT,n,uT]);return S("div",{...r,children:t})}function fT({reviewStatus:e}){const{variant:t,Icon:n}=Bi(e);return S(bT,{type:t,children:S(ud,{Component:n})})}const yT=Gn({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),xT=Gn({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),CT=Gn({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),TT=Gn({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),wT=Gn({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),kT=Gn({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function ET({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=Yg(e.children);return`${t}: ${n}`}switch(sx(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${zC(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void pa({error:new Error("Should not get here. Payout without line items."),severity:"error"});default:return e.glAccount?.name}}(t),r=void 0!==e.getParentRow();return R("div",{className:yT,children:[r&&S(ud,{Component:gx}),R("div",{className:wT,children:[R("div",{className:CT,children:[t.iconUrl?S("img",{src:t.iconUrl,className:kT,alt:void 0,width:24,height:24}):S("span",{className:kT}),S(vo,{children:t.description})]}),R("div",{className:TT,children:[S(fT,{reviewStatus:t.reviewStatus}),S(fo,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:xT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[S(Ix,{row:e}),S(rl,{Component:Qi})]})]})}const AT=ci(aT,"Minus");function IT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return S($y,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?AT:Ih})}const ST=X(),NT=[ST.display({id:cn.SELECT,header:({table:e})=>S(IT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?S($y,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),ST.accessor("date",{id:cn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return S(_s,{children:S(vx,{transaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:Uy,sortDescDisplay:Wy}),size:130,maxSize:144}),ST.accessor("description",{id:cn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return S(_s,{children:S(Cx,{bankTransaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Hy,sortDescDisplay:zy}),size:180}),ST.accessor("amount",{id:cn.AMOUNT,cell:e=>S(_s,{alignVariant:"flexEnd",children:S(Ix,{row:e.row})}),header:()=>S(Dc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:qy,sortDescDisplay:jy,align:"right"}),size:130,maxSize:130}),ST.accessor("category.id",{id:cn.CATEGORY,cell:({row:e})=>S(GC,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>S(Dc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),ST.accessor(e=>e.dimensionValues[0]?.id,{id:cn.DIMENSION_VALUE,cell:e=>S(_s,{children:S(QC,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>S(Dc,{columnName:"Business"}),size:130}),ST.accessor("reviewStatus",{id:cn.REVIEW_STATUS,cell:e=>S(_s,{children:S(tT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>S(Dc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:_y,sortDescDisplay:Ky,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),ST.display({id:cn.COMMENTS,cell:e=>{const t=e.row.original;return S(_s,{alignVariant:"center",children:S(sT,{conversationId:t.conversation?.id})})},header:()=>S(Dc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),ST.display({id:cn.EXPAND,cell:()=>S("div",{className:Gn({paddingRight:"20px"}),children:S(rT,{})}),size:40,maxSize:60})],RT=ST.display({id:"MOBILE",cell:e=>S(ET,{row:e.row})}),DT=i(!0);function PT(){return l(DT)}const MT=[];function LT({transactions:e,columns:t}){const n=PT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(cn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[RT]:(i=t)?NT.filter(e=>i.includes(e.id)):NT;var i;return J({data:e??MT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??MT.length,columns:o,getCoreRowModel:$(),getRowCanExpand:e=>e.original.children.length>0,getSubRows:e=>e.children.map(e=>{return t=e,{...t,iconUrl:t.iconUrl??"",reconciliationMatch:null,tax:{paymentInfo:null},customData:null,children:[],attachments:[],suggestedCategories:[],conversation:null,status:"ACTIVE"};var t}),getExpandedRowModel:ee(),paginateExpandedRows:!1,getRowId:e=>e.id,state:{columnOrder:r,columnVisibility:a}})}const FT=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.REVIEW_STATUS];function OT({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["xx-large-icon"],tr.icon),...t??[]],size:50})}function VT(){return R(N,{children:[S(OT,{Component:pi}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function BT({children:e,stylists:t=[],...n}){return S(Ls,{intent:"warning",stylists:t,...n,children:e})}function UT(){const{linkPlaid:e,loading:t}=Xf();return S(BT,{...cr(tr["zero-state-button"]),onClick:()=>e({plaidEvent:Of,message:"Plaid Link button pressed"}),disabled:t,children:S(vo,{children:"Link your bank"})})}function WT(){return R(N,{children:[S(OT,{Component:wm}),S(br,{children:"Link Bank Account"}),S(fo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),S(UT,{})]})}const HT=Gn({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function zT(){return R(N,{children:[S("div",{className:HT,children:S(OT,{Component:hi})}),S(br,{children:"Transactions are being processed"}),S(fo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}const qT=Gn({animation:"linear 1s spin infinite"}),jT={background:"conic-gradient(from 90deg,rgba(255, 255, 255, 0) 0deg,rgba(148, 216, 232, 1) 360deg)",height:"100%",width:"100%",opacity:1};function _T({size:e}){const t=e??15;return S("div",{children:R("svg",{className:qT,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:S("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:S("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:S("div",{style:jT})})})}),S("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z","data-figma-gradient-fill":'{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"transform":{"m00":-9.1848822316819949e-16,"m01":-14.999998092651367,"m02":15.999998092651367,"m10":14.999998092651367,"m11":-9.1848822316819949e-16,"m12":1.0},"opacity":1.0,"blendMode":"NORMAL","visible":true}'}),S("defs",{children:S("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:S("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z"})})})]})})}function KT(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,u(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=w(e,t,n),o=(...e)=>a(...e);return o.cancel=()=>{a.cancel()},o.isPending=()=>!!r.current,o.flush=()=>a.flush(),o},[e,t,n]);return u(()=>{r.current=w(e,t,n)},[e,t,n]),i}function YT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=c(e),[a,o]=c(!1);u(()=>{r(e)},[e]);const i=KT(d(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const ZT=cr(tr["filter-bar"],Gn({display:"flex",padding:"16px",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",borderRadius:"2px",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:0,xl:{display:"flex",flex:"1 0 0",flexDirection:"column",height:"35px",padding:"0 10px",justifyContent:"center",alignItems:"flex-start",gap:"10px",borderRadius:"sm",background:"surface.background"}})),GT=cr(tr["filter-search-bar"],Gn({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),QT=cr(null,Gn({color:"icon.base",flexShrink:0,marginRight:"15px"})),XT=cr(null,Gn({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px",display:"flex",flex:"1 0 0",flexDirection:"column",justifyContent:"center",height:"100%",minWidth:0,padding:0,fontFamily:"label",_placeholder:{color:"typography.base.weak"},xl:{fontSize:"14px",lineHeight:"16px"}})),JT=Gn({width:25});function $T({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:t,onChangeDebouncedValue:e});return S("div",{...ZT,children:R("div",{...GT,children:[S("div",{className:JT,children:n||i?S(_T,{}):S(ud,{stylists:[QT],Component:zv})}),S("input",{...XT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh})]})})}const ew=cr(tr["date-amount-header"],Gn({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function tw({formattedDate:e,formattedSum:t}){return R("div",{...ew,children:[S(vo,{wrap:"wrap",children:e}),S(hu,{children:t})]})}function nw(e,t){return jl("BankTransactionForm",{routeProps:{transactionId:e,initialTab:t}})}function rw(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=cx(e.row.original.type),o="category"===e.column.id&&(r||a),i="comments"===e.column.id,l="amount"===e.column.id;if(i){const e=t.getParentRow();nw(e?.original.id??t.original.id,"conversation")}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();nw(e?.original.id??t.original.id)}}function aw({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=as(),a=d(()=>n({id:e.original.id}),[n,e.original]);return S(ql,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:rw,shouldDisplayDivider:n=>{return r=n,a=t,o=e.getVisibleCells().length,!(0===r||a&&1===r||r===o-1||a||1===r);var r,a,o}})}function ow({rows:e}){const t=o(()=>function(e){return Array.from(function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.original.date;if(t.has(e)){const r=t.get(e);r&&(r.netSumCents+=n.original.amount,r.formattedSumDollars=ho(Ku(r.netSumCents)),r.rows.push(n))}else{const r=Pt(e);t.set(e,{date:e,formattedDate:r?Nt(r):e,netSumCents:n.original.amount,formattedSumDollars:ho(Ku(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return S(N,{children:t.map(e=>R(b,{children:[S(tw,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>S(aw,{rowData:e},e.id))]},e.date))})}function iw({table:e,hasSelect:t}){const n=PT();return S(Ol,{children:n?S(ow,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>S(aw,{rowData:e,hasSelect:t},e.id))})}function lw(e){return e?"Search":"Search transactions..."}function sw(e,t){const n=/* @__PURE__ */new Map;return t.forEach(t=>{const r=t.selectedValues(e);r.length>0&&n.set(t.key,[...r])}),n}function cw(e,t){return e.get(t)??[]}function dw(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function uw(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function hw(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function pw({buttonText:e,onButtonClick:t}){return R(N,{children:[S(ld,{Component:Qv}),S(vo,{children:"No results"}),S(fo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&S(Ic,{onClick:t,children:e})]})}const gw=Gn({xl:{minWidth:"900px"}}),mw=Gn({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function vw({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){bd(qi);const c=function({transactions:e}){return function({transactions:e,columns:t}){return LT({transactions:e,columns:t?[...t,cn.EXPAND]:void 0})}({transactions:e,columns:FT})}({transactions:i}),{query:{data:d},isFilling:u}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=PT(),p=!nr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=S(pw,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=S(VT,{})):a=S(zT,{}):a=S(WT,{}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:gw,children:[S("div",{id:qi}),R(nl.Provider,{value:o,children:[R(ur,{children:[S(br,{children:"Transactions for review"}),S(yd,{children:S(sl,{})})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:r?S(gl,{}):R(N,{children:[!h&&S("div",{className:mw,children:S($T,{placeholder:lw(h),searchTerm:l,onChange:s,isFetching:a})}),S(zs.Provider,{value:{sortInstance:t,setSortInstance:n},children:S(Ll,{headerGroups:c.getHeaderGroups()})}),nr(g)?S(iw,{table:c,hasSelect:!1}):S(od,{children:g})]})})]})]})}function bw(){const[e,t]=c(""),{sortInstance:n,setSortInstance:r,apiSort:a}=Yy(),o={...(()=>{const e=Wi();return{..._i,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:d}=ts({filter:o,sort:a,limit:10}),u=i?.data??Yi,{hasPlaidLinkedBankAccount:h,isFilling:p}=Ng();return S(vw,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:d,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const fw=cr(tr["button-table-header"]),yw=Gn({height:{xl:"auto",base:"44px"}});function xw(){const e=nh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return S("div",{className:yw,children:R(Fs,{onClick:()=>{jl(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[fw],children:[S(rl,{Component:vu}),S(tc,{children:"Banks & Integrations"})]})})}const Cw=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function Tw({children:e}){return S("div",{...Cw,children:e})}const ww=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),kw=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:cd,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:di,buttonText:"Review"};case"LINK_BANK":return{Icon:wm,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:wm,buttonText:"Fix"};case"RELINK":return{Icon:wm,buttonText:"Relink"};case"CHAT":return{Icon:ui,buttonText:"Learn more"};case"ONBOARDING_FORM":return{Icon:ww,buttonText:"Complete"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:pi,buttonText:""};default:return{Icon:ui,buttonText:""}}},Ew=cr(tr["banner-title"],Gn({display:"flex",alignItems:"center",gap:"8px"})),Aw=cr(tr["banner-icon"],Gn({width:"20px",height:"20px"}));function Iw({title:e,type:t}){const{Icon:n}=kw(t);return R("div",{...Ew,children:[S(ud,{Component:n,stylists:[Aw]}),S(vo,{wrap:"wrap",children:e})]})}const Sw=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",color:"icon.base",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function Nw({title:e,description:t,type:n}){return R("div",{...Sw,children:[S(Iw,{title:e,type:n}),S(fo,{wrap:"wrap",children:t})]})}const Rw=tr["banner-button"],Dw=Gn.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),Pw=cr(tr["banner-button-text"]),Mw=cr(tr["banner-button-icon"]);function Lw({priority:e,type:t,handleClick:n}){const{buttonText:r}=kw(t),a=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R(Ls,{onClick:n,intent:a,styles:Dw,className:Rw,children:[S(vo,{stylists:[Pw],children:r}),S(rl,{stylists:[Mw],Component:Qi})]})}const Fw=$n({base:{display:"flex",flexDirection:{base:"column",xl:"row"},padding:{base:"16px",xl:"15px"},gap:{base:"16px",xl:"0"},justifyContent:{xl:"space-between"},alignItems:{base:"flex-start",xl:"center"},alignSelf:"stretch",width:{base:"100%",xl:"auto"},minWidth:{xl:"350px"},borderRadius:{base:"sm",xl:"lg"},border:"1px solid",backgroundColor:"surface.foreground"},variants:{priority:{HIGH:{borderColor:"border.intent.warning"},MEDIUM:{borderColor:"border.intent.action"},LOW:{borderColor:"border.intent.success"},URGENT:{borderColor:"border.intent.danger"},DEFAULT:{borderColor:"border.intent.secondary"}}}}),Ow={HIGH:tr["banner-high"],MEDIUM:tr["banner-medium"],LOW:tr["banner-low"],URGENT:tr["banner-urgent"]};function Vw({task:e,handleClick:t}){const{name:n,description:r,shortDescription:a,type:o,priority:i}=e,l=PT()?a:r,s=cr(tr.banner,Ow[i],Fw({priority:i}));return R("div",{...s,children:[S(Nw,{title:n,description:l,type:o}),S(Lw,{priority:i,type:o,handleClick:t})]})}function Bw(e,t){Qu({message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}})}function Uw(e,t,n,r,a){return()=>ju({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function Ww(e){const{mutateAsync:t}=Zf(),n=kr(),r=Nr(),{apiPartnerName:a}=l(Lc),o=PT(),{linkPlaid:i,loading:s,hasOnPlaidLinkOverride:c}=Xf(),{linkPlaid:d,loading:u}=Xf(),h=lh({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(nr(h)||nr(e))return null;const p="ITEM_LOCKED"===e.apiErrorCode;switch(h.buttonType){case ah.DELETE_OR_RELINK:case ah.RELINK:return s?null:(m=i,v=a,b=o,{alert:Uw(h,(g=e).apiInstitutionName,v,b,[{key:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]),actions:{success:()=>{m({plaidEvent:Vf,plaidItemId:g.id,apiAccessToken:g.apiAccessToken,apiErrorCode:g.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case ah.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:Nu,label:"Unlink and Relink",type:qu.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:"PLAID_LINK_UNLINK_RELINK",plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,t,d,a,o,c);case ah.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l){return{alert:Uw(e,t.apiInstitutionName,i,l,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:ah.RELINK,label:"Relink"},{key:Nu,label:"Go To Bank",type:qu.SUCCESS}]),actions:{success:async()=>{const e=await Au({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;window.open(o,"_blank")},[ah.RELINK]:()=>{o({plaidEvent:Vf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,p,n,r,i,a,o);case ah.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:Nu,label:"Unlink",type:qu.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:Bf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(h,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:Uw(e,t,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat",type:qu.SUCCESS}]),actions:{[ah.CHAT]:()=>Bw(t,r)}}}(h,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var g,m,v,b}const Hw=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){pa({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function zw({task:e}){const{linkPlaid:t,loading:n}=Xf(),{linkPlaid:r,loading:a}=Jf(),o=Ww(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&nr(o);return i||l||s?null:S(Vw,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Vf,plaidItemId:e?.meta?.plaidItem?.id,apiAccessToken:e?.meta?.plaidItem?.apiAccessToken,apiErrorCode:e?.meta?.plaidItem?.apiErrorCode,message:"Fix Relink Bank Error button pressed"}):"LINK_BANK"===e.type?(ha("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Of,message:"Plaid Banner Link Bank pressed"})):rr(o)&&(ha("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Hw(o))}})}const qw=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function jw(){const e=PT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return S("div",{...qw,children:S(Nw,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const _w=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function Kw(){const e=PT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return S("div",{..._w,children:S(Nw,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Yw=Gn({width:"100%",height:72,minWidth:"300px"});function Zw(){return R(N,{children:[S(jo,{styles:Yw}),S(jo,{styles:Yw}),S(jo,{styles:Yw})]})}function Gw({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?S(Zw,{}):a?e.map(e=>{if(void 0===wC[e.type]||"ONBOARDING_FORM"===e.type&&nr(e.actionLink))return null;if("LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(ah).includes(e.type))return S(zw,{task:e},e.id);const n=e.actionLink,r=rr(n)?()=>window.open(n,"_blank"):()=>t(e.type);return S(Vw,{task:e,handleClick:r},e.id)}):S(n?Kw:jw,{})}function Qw({shouldFilterTasks:e=!1}){const{taskBanners:t,isFilling:n}=SC(e),r=os(),{query:{data:a}}=Rg();return R(N,{children:[R(ur,{children:[S(br,{children:"Action Items"}),S(xw,{})]}),S(Tw,{children:S(Gw,{taskBanners:t,handleScrollAction:NC,isWaitingForPlaidItemAccountsSync:!r&&!0===a?.plaidItemAccountsReadyToSync,isFilling:n})})]})}const Xw=cr(tr["business-owner-dashboard"],Gn({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Jw=Gn({display:"flex",width:"100%",justifyContent:"center"}),$w={status:{in:["ACTIVE","INACTIVE"]}};function ek({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=c(void 0);return{sortInstance:e,setSortInstance:d(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Cl)??!1,n=(e.direction&&e.direction in Tl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:i,paginationControls:s}=Al({limit:10,sort:a,filter:Ki}),u=o?.data??Zi,h=PT(),{hasBookkeeper:p}=l(Lc),{initialPageProps:g}=l(vd),{query:{data:m}}=Rg(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ts({filter:$w,limit:1});return(e?.data?.length??0)>0}(),m),b=/* @__PURE__ */new Date,f={month:b.getMonth(),year:b.getFullYear()};const[y,x]=ic(g?.period??f,e,t),C=(T=y.month,{beginDate:it((w=y.year)-1,T+1,1),endDate:it(w,T+1,0)});var T,w;return S("div",{className:Jw,children:R("div",{...Xw,children:[S(Qw,{shouldFilterTasks:h}),!h&&R(N,{children:[S(By,{period:y,handleDateChange:e=>{var t,n;(t=f).year===(n=e).year&&n.month>t.month||n.year>t.year||x(e)},todayPeriod:f,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[S(ur,{children:S(br,{children:"Financial Summary"})}),S(Xd,{isSample:v,period:y})]})]}),!h&&S(N,{children:S(oi,{filter:C,isSample:v})}),p&&S(Td,{sortInstance:n,setSortInstance:r,conversations:u,paginationControls:s,isFilling:i,isMobile:h}),S(bw,{})]})})}function tk(e){return S(ma||N,{children:e.children})}function nk({children:e}){return S(tk,{children:S("div",{className:or(tr.component),children:e})})}function rk(e){return S(nk,{children:S(ek,{...e})})}const ak=Gn({display:"flex",flexDirection:"column"});function ok({task:e}){return S("div",{className:ak,children:S(zw,{task:e})})}const ik=Gn({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),lk=Gn({width:"80px",height:"12px"}),sk=Gn({width:"150px",height:"16px"}),ck=Gn({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),dk=Gn({userSelect:"none",cursor:"pointer"});function uk(){return R("div",{className:ck,children:[R("div",{className:dk,children:[R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]}),R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})]}),S("div",{className:dk,children:R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})})]})}const hk=Gn.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function pk({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=PT(),a=n||r?Ic:Fs;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(a,{extraClassNames:[hk],popupTriggerProps:e,children:S(rl,{Component:Qv,stylists:t})})}),S(xc,{children:e})]})}const gk=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),r.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),mk=$n({base:{display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative"},variants:{width:{lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"}},sm:{minWidth:{sm:"360px",base:"100dvw"},maxWidth:{sm:"392px",base:"100dvw"}}}}});function vk({width:e="lg",children:t}){const n=cr(tr["modal-popup"],mk({width:e}));return S("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const bk=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),fk=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yk=Gn({display:"flex",flexDirection:"column",gap:"12px"}),xk=Gn({display:"flex",flexDirection:"row",gap:"10px"}),Ck=Gn({display:"flex",flexDirection:"column",gap:"10px"}),Tk=({acknowledged:e,setAcknowledged:t})=>R("div",{className:yk,children:[S(Ys,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),R("div",{className:xk,children:[S(Xy,{checked:e,onClick:()=>t(!e)}),S(Ys,{wrap:"wrap",children:"I understand."})]})]});function wk({bankAccounts:e}){const{apiPartnerName:t}=l(Lc),n=e.reduce((e,t)=>{const n=Pt(t.tranStartDate||""),r=Pt(e.tranStartDate||"");return n&&r&&St(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutate:n}=vh();return df({defaultValues:{tranStartDate:t},onSubmit:t=>{var r,a;ju({title:"Start Date Updated",body:R("div",{className:Ck,children:[S(Ys,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),S(Ys,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Nu,type:qu.SUCCESS}]}),n((r=e,a=t.value.tranStartDate,r.map(e=>({id:cs(e.id),tranStartDate:a,duplicateBankAccountIds:[]}))))}})})(e,n),a=cc(),o=()=>{a.close()},[i,s]=c(!1),{query:{data:d}}=ku(),u=d?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Pt(e.reduce((e,t)=>{const n=Pt(t.tranMinStartDate||""),r=Pt(e.tranMinStartDate||"");return n&&r&&St(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${Gu(e[0]?.name,e[0]?.mask)} account dating back to ${Bt(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Bt(h)}.`;return R("form",{className:bk,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit(),a.close()},children:[S(vo,{children:"Set Bank Transaction Start Date"}),S(Ys,{wrap:"wrap",children:p}),S(Ys,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),S(r.AppField,{name:"tranStartDate",children:e=>S(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),S(r.Subscribe,{selector:e=>e,children:e=>{const t=Pt(e.values.tranStartDate||""),r=Pt(n),a=t&&r&&St(t,r);return R(N,{children:[e.isDirty&&a&&S(Tk,{acknowledged:i,setAcknowledged:s}),R("div",{className:fk,children:[S(gf,{showIcon:!1,onClick:o}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!i})]})]})}})]})}function kk({bankAccounts:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:gk}),S(vo,{children:"Edit Start Date"})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:e})})})})]})}const Ek=ci(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M7.49998 14.4245C11.3242 14.4245 14.4244 11.3244 14.4244 7.50011C14.4244 3.67585 11.3242 0.575684 7.49998 0.575684C3.67573 0.575684 0.575562 3.67585 0.575562 7.50011C0.575562 11.3244 3.67573 14.4245 7.49998 14.4245Z",strokeMiterlimit:10}),r.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),Ak=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M11.7346 14.5L11.7346 12.9152C11.7333 12.2895 11.5704 11.6747 11.2616 11.1305C10.9528 10.5863 10.5087 10.1311 9.97233 9.80895L7.43662 8.29386C6.90079 7.97055 6.45795 7.51384 6.1513 6.96831C5.84465 6.42279 5.68467 5.80708 5.68698 5.18127L5.68698 3.60913",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),r.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),Ik={QBO:"QuickBooks Online",XERO:"Xero",STRIPE:"Stripe",SHOPIFY:"Shopify",SQUARE:"Square",RUTTER:"Rutter",UBER:"Uber",MOOV:"Moov",QUALPAY:"Qualpay",BENCH:"Bench",WAVE:"Wave",MANUAL_ENTRY:"Manual Entry",CSV_IMPORT:"CSV Import",PARTNER_IMPLEMENTATION:"Partner Implementation",FRESHBOOKS:"FreshBooks",FRESHBOOKS2:"FreshBooks"};function Sk(e){const{apiPartnerName:t,unitIntegrationBankName:n}=l(Lc);return"UNIT"===e?n??t??"Unit":Ik[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Nk=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Rk=cr(null,Gn({color:"brand.danger"}));function Dk({integration:e,accounts:t}){const{mutate:n}=Zf(),r=cc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=Xf(),{query:{data:l}}=(s=e.id,wu({},{select:e=>{return{...e,data:(t=e.data,n=s,t?.find(e=>e.id===n))};var t,n}}));var s;const c=l?.data,{query:{data:d}}=Mg(e.id),u=d?.data,h=Sk(e.apiName),p="PLAID"===e.apiName;return R(lg,{children:[p&&!o&&R(gg,{onClick:()=>(a({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[S(ud,{Component:xs}),S(vo,{children:"Add Account"})]}),p&&u&&S(kk,{bankAccounts:u}),tt(t)&&R(gg,{onClick:()=>Sf({plaidItemAccounts:t}),children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Accounts"})]}),p&&R(gg,{onClick:()=>(async()=>{let o;var l;o=tt(t)?await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{wrap:"wrap",children:`Would you like to unlink ${e} altogether? If you unlink now and relink ${e} again in the future, you may see duplicate transactions.`})}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(h),r.close(),o===Su&&(p&&i?a({plaidEvent:Bf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[S(ud,{stylists:[Rk],Component:Ek}),S(vo,{stylists:[Rk],children:"Delete Connection"})]})]})}const Pk=Gn({userSelect:"none"});function Mk({children:e}){return S("div",{className:Pk,children:e})}const Lk=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px 12px 16px 16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"});function Fk({children:e}){return S("div",{className:Lk,children:e})}const Ok=cr(tr.badge,Fx),Vk=cr(null,Za),Bk=cr(null,el),Uk=cr(tr["neutral-badge"],Vx),Wk=cr(tr["highlight-badge"],Ux),Hk=cr(tr["success-badge"],Hx),zk=cr(tr["warning-badge"],qx),qk=cr(tr["danger-badge"],tr["critical-badge"],_x);function jk({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=qk;break;case"warning":o=zk;break;case"neutral":o=Uk;break;case"success":o=Hk;break;case"highlight":o=Wk}const i=gr([Ok,Vk,o,Bk]);return S("button",{...i,onClick:n,disabled:r,...a,children:t})}function _k({plaidItem:e}){const t=Ww(e);return R(jk,{type:"danger",onClick:n=>{n.stopPropagation(),t&&(ha(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Hw(t))},disabled:nr(t),children:[S(ud,{Component:ui}),S(fo,{children:"Fix Bank Error"}),S(rl,{Component:Qi})]})}const Kk=$n({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",color:"icon.base",display:"flex",borderTop:"none",borderLeft:"none",borderRight:"none",width:"100%",justifyContent:"space-between",alignItems:"center"},variants:{active:{true:{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",cursor:"pointer"}}}}}),Yk=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function Zk({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=Xn(Kk({active:a}),el);return R("button",{className:l,onClick:t=>{t.stopPropagation(),jl("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:Yk,children:[S(ud,{Component:i?gx:wm}),S(Em,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&S(ud,{Component:Qi})]})}const Gk=Gn({display:"flex",flexDirection:"column",gap:"4px"}),Qk=Gn({display:"flex",alignItems:"center",gap:"8px"}),Xk=cr(null,Gn({color:"brand.primary.weak"})),Jk=Gn({overflow:"hidden"});function $k({integration:e,isCompact:t=!1}){const{query:{data:n}}=Mg(e.id),r=n?.data,a="PLAID"===e.apiName,o=Sk(e.apiName);if(!tt(r))return null;const i=e.iconUrl?tm(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(Mk,{children:[R(Fk,{children:[R(Vv,{children:[S(ld,{Component:i??wm}),R("div",{className:Gk,children:[S(Ys,{children:e.apiInstitutionName??o}),S(fo,{children:Lf(r)})]})]}),R("div",{className:Qk,children:[a&&rr(e.apiErrorCode)&&S(_k,{plaidItem:e}),S(pk,{stylists:[Xk],shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e,accounts:r})})]})]}),S("div",{className:Jk,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return S(Zk,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Ff(t),active:n,integration:e},t.id)})})]})}const eE=tm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAGttJREFUeAHFnFuMXVd5x9c5c/GMZxxf4sTxNfcmJDSQFGhSkGhRCFChSqWIoqqtkJoXitQHXoqqVkKVWlFVQuIBIdo8oD4g1BYqFVTahLqg0JYSriExARInsXGwncSJPb7N7Uz/v/+3vnX2OR7HpiB1Zc5ea32X/3fZ31577X1O3Ctj7ba3/c3tvcmJ+0u/3LdWyr5SevO9Xs9SdGulV3r9mK9FV+CvVRlNpKK/Oh90xiX1hLa2JiTJpBx9VzaxJRjYFS/lm9uiS8I445gNowkPB4kj3dOl9A+pf7A3WH3gwN+++/GhlEOJ6e23f3h6sHf3R3sTvff31ZQcmR0GipR97PcZyukhL5OD0aQ351CyIgCBiX46yNh8ywWuaXloulKuzXbCO2NCbngdG135HBOTlYZwySLRAwXwie+fWPpg+Yf3LFXJUkjO2r7dX+z1+2+hOsaTYywczQrQ0A5V520UIc3tvMYtualT3WiBaE5ix6uxigWPSbVhOjZcnp6FDzH0ianDoEsvkpHUC/t2EsdYqsT9T7y4/A6S5HKIyonkINuCY1IDH08OwSHXZAk2nWJMpV0sOSRQfJ8Mxg4cY4w1gUfPh0YHlnHDTjsR8Kpsr4fNvjG6yQF/vQ8Y6310Ab3l1u3TH7XpfW/8s9vnt1z7KJfVAIqanfPAUwebQYRjeFVbTQJOIiOTNRg5VUUanuZrKZ99leleppUUgQvF+iRBLf1gHLhhl3m2rgy0rv2U6fbr8XWtDc4cfeqOycl+//5IDg5UZ9AOfyI5TJuDwWDeHMkxrBr4xZLTcLChtl5ijA0TPKpC/TheVjBi2dKftJF0+nEaeCnPeJyPYSXn/knZ5m7lNi7kywROBl2ThJzB65xxo0l83CA87lASak4By7zZBEP/gWV/uvNqB4hMqPU9jxE48LutYYsY9uEOpXLUbHaU7cNE775JyetWjq823/QzOQ5e/HQMOWjdYL3QVgdHkiM56yUvPTJGJ6DEa36gp4/m2PFHQ8+hqdmvihsUHS0q/+wEMhpXJibsdxMGD2q2qoQGNgFZK/smxZ5PVsqPJAcjKNDQY2iaKSpEESrfOCOyUSHQE9u6mnJ3CIfRBwLgaGkDSrPtcfCRhZcaKZN69KEb8hxHklH5Q27lQ19jkV+Tf77JzKuC4m4SwjKsgB2QeldLoqDMnUk9i7k6RdlZH3BaitDtMPoeI4gDatyd1DV6JqXazKnvRlUnk9uSgpCIAxlDjk1iS7SQCY7WEiLxxK2WxcWD6qdHQ05gkSRFKUUqKMTREcHZr4hhKujtlmyFalUdMu3sK19rOB32DUyyAjqITnrlXzhORXAwFNiJjy3TxSM5XldAt9PVW3z3nw6tRVwx7dBrnNBJdLd5Jr4TRGIyOSmUZQs9A0HJzuqM09qciUhOBqxg13mdWGboaGJGLzp8tW5imKOdNObNT4h2QAeEXLFDW81/K1VRJyQtgVWZ7jRpcwZxdUwaWIqplg6HDskROJUBgckrJmeIE8lqFpueEywoMKmttAu8C8FBMMOc9CuEA2ZcE5N+9byaWdxY3oCywBpniD7EaoCh1D0OxUNfGK4g6OlcZj4SBb0God4LMrL6ZKDgh/MpZ2bjJw5yo2PWj2jYpiWm5TSPh9eKXxPT8oE/1kIuRhw9ykGlOzhk06D4LeEVgy7tpyAm2QcZNZz3bBiIDDhxoc3xwuRQUekI6ozrPDCtNsS0yLByjJ/6lReJAae6SmCqONowiEhMqjpdeZewYioLo1Z9IFQXczLSZwYhgqgKwkECGq8cHLGjGHMS1k+OkxB4xmgBGHMYUEsEdMnzoSIxT8u7Tiy8lR8s20/cVi1SzKREj7CI9YxmXKamkcRrVoNg2cbTABjdxKDrNh9OOncVH9mcGws6epJ1s5z0arDhV8yDLwH+qrx9RjbnElrROrG8uOrcT0/2y8yGiTI9NaF5T7xSllcHZWllUBZX18pAc7YYExP9MjnBGD8gYk24MuAhVJKObVit1Zk64qClbx6bMnowhg6+xNJxI1uDYCqIhADtAiJ/OckBI+AiOeCcX1kt0wrill2byht+YXt5zfXbyr6r58rW+ekyM60EibeqpJxfXi2nzi6XYyfPlWeOnylPHFko3z9yqjx74lw5s7SqRPXLlD72q95EHFSY1JEALkxIdclS3ZiC0JRDkQQRbDcBnoNta124UHYyMcwHUt38mZvrhII0pvmMe64INN7+2h3l937txnLXzdvLhqnYZVj3Mg7nl5fLwaOny1efeKF88dGj5fHnTstPVRa+ZmvxRAw9n6XqjcU0lk71PrSaehs4Puf4xrf+xdrslmt9nQNjPJdpBAmCq8UJ8wSSy9zJ8qQehO8NJXwctb1eWVwelD3bpsufvveOcu9dexF24xXpT9O6Z3xJlfiVx4+VP/nHA+XU0qAmSZXtk4RhsMOHuACrrZrAS9lFevHYk6xBxrG8IZ2I8eRUGXg0dS05ngfdSYE9lpxbd28sH//De8q1O66Q4vieFYDLa92ETmkxuvmaTWVVier1WJh49AAnkxJVkknNmwASNVUM1aQU7se00rTyiV73QUi0W6uqJ5vBmWLZn+CQnCZV5TMp2YOpwim7tkyVv77/9U7OYCDCz6lRfAePL5RT51fKhlkuVXzMLrwbiMBoJCHd+MwNHR07rQGxUayXAgmoyq2SqoqDrmMnB1la7YdJgWaGL6+11dXywXe9uty8a2v5eSYHCwNliMV7RQY3dILG95GE4GO6a9fqhLFaW0s1Jo5s3BnJh1dJqqeurwGecupbteR4LCnd5GQiwV5cXiv33Ly13HvnXq0P//fLKh0e7ynGp188I8fD825i0ifXj3zRX2veZymGHpc6vThdfhOsA69BjtmGIvepAABVYuMWCq3mwDq0rLC1wWp55xv26NY9qauZ1xyRJLBZD4bzsNbzGpKWR90caCOED8FlrCf5tdXy7PPnSl9rUbtw7S+CETgK5jHvJMToTWZ9m7YmVtxnAVazEx7Kfcq20mvX5nF3sopLNBMWoNIV0Ja5iXLnTVeVCSWejV4uktigdeeYYlP49SeO6bI55URsmdtQdl25qey9aq5ctWU2lHQcqATw58z55XLk5KI3j2k/e2xkdaAYIaHnEaRhu4BUCSpMMOpdjPOZ8UsAmVRUn5Vk1EpPZ7JHgcTBXlFGdmyecWCZEOuuc8Dnc4vL5Y8++d/lX793vKx5qxzP6Gwot2oBvumajeVNt1xdfvUXd5bb9m31bvuF0+fLC9pITkyyjIZTnFTHITtBgZUjTkqlm1TpQ3Z4l/JKELqjjxqISIGXXtkyOVBcOWwMLcMaprtfdYXXF35fKCcHelbYNj/lnTHV9EqN6vnBkZfLQ98/UTZt3xwBicZFguqCkv0/RxfLV599unzsSwfLa/deUX73TdcpMf1yVuvc5GzIZcVIlciGJrvDSgebv3HXPE95TVoFwQhdqiCUAYCYZ8AOEI2a5WsAJiAHXQd4LIQTE9CEd4kMDaS068q5ct018+XQwkqZ1ZplNGHQT+hhaHZyuszOTvtS/cbxxfL1zzxWtm2aLv2ZqXRckmoRBCOUfchXNMx8gh14+AnNrepZhQDUkGVdjJcyVSCSY7EQ8lEHSJUciiQSI9HDi0R64N00d7EBj8SXaCzAO7ZsLB97353ljl1z5ezSitcjgg0bCaDLTtU7s1HJ2iK5CSVIc8eD//5IVr2TUntj4CsfsektA79+uBL4GIMi0Mn1WFeSX96jY8W8skRwxaBEq0CW0bQm2TpZYZFEgLnz9soLp5fKWW3iGt9A6x9W9HD62uuuLJ/+wN3lI+++tdyxZ66saId8Tg+lYnEt+8NlnL64mKtfoGbgzQ8JQHNSEKiymZTEpLecZEMX0VhGmHujiL4BRMngTTO9jgBQw0AAxhmoRN9OxXLjtcQx3WGOvHC2bNNifSFoyHWPJGl2eqq8957ryrtev7d865mX9EB6rHz5RyfK4ZcXVRX9Mq2nfbc0lAAKkgpwMuRDxuBkSCZPkpOouflg1Msf/nitR3In4jY/qig9KSSoE1eNQwvZmolqPDdfycPZ03rOePjAkXLbdXHXyVheqWd3rO2TtwZ337S98DlxZql85Ynj5e+/ebQ8cnjBvk3He1BXVfqZyQE/aelvN2HeUYnQkiT55Kdvba4wfVEpHa4gl9iYASvVfGQC6NOJ4ENglH0pU1pAP/e1I+VFvc/x9W3ByztwYqkoPptnp8pv/tKe8nd/cGf55O+8qty1e86Xnt8s6kTQOEH2SWP8sm/10oGfNKok1s3Q6/IkpGxwK6avY3UTW2+598OTG7eC4vhGqkeCgLeESMQLeTWKjpMGYE0OyWY/wmV2fGGpLJ47X950+464BNqpwbVLN8QJatWXQq/cfPWm8huv2VHmp/vlG8+eLPzCKe9SToIDizicJPsnfyTXNW0esuK3BZ0xpP6Ee5I0WDhRJrbd8tYPTyhBMEeSY2kwAMnEdIxjtBpx9SAHTcKRUFWRbtnfPvhSmemtlrtvvUZM/0nq0s1BAdhpJIobwC/rLeQN2zaUh596qSwqg95SyL5Pnv0OxZYU3IbeSQqJMU34PsmW0QRVX1eq4oUXI0GTs1QQzKrUGYcy2gAFH7ZlbdCTmCNkw5WveV8L78MHjpWzZ86V1998VTyb8exxGc2xAtX5oEaibrp6vuzWXujff3iCRSuExMsKRw7FqBDdlWpCYh5JcYJshLjAqJZq7wraeut9usS2tOANXMEyOchnctIwX9DZc3vBUCWJIBtEEqc5On3NJ6any3/+6MXyX489V3ZvmynX79jkS/CVNpHVVdDX/VCNNypJzy8slm8fOV14gWYfkeZP/kUy8Kf6qs5JkF+8ZIuYhrTkZaJWuMS2tksMVxAO8DYWWFwyMACO3uUKw7arTFaPiMPkItMrMzPT5bmF5fJPXz9cHn3qeS++u66c9XtpFnHuYD9t4130ns3T5V8OvFgWpc7lZ3+UEC7/8DViwnc/QkmEsQPVMWJLmejh4vPg9Iv1i0MI2awcigGqsbLWrlfJOXjktRXHEMduhYVRmbEldcIElseFtdkNZf8zZ8r+H32zvPqaufLOu3aVt75mZ7nhmisst6Q71+Xmiiv12ivny+v2zpeHDp7SY4kePeRNC1oz+8fl023VL0gR1zA+aPGmAZyJugbNbYMeATmYCC7PQPSdM8KZwgvOEgny2UIfy+iKap9qZVVMJ1bjKW34JlVRx84Pyn/oG4rPPfLj8s0nXyhT0rlWrzc26PsxfS12WW1Ctp/TVuKrzy6UKQDsC37gouZ2RJm0azrA9yXH3QpfqXZO8vATwtpmaJH2N6tRB+EPShmIexSNO6RbkhdccX1VRXWSA4ueA3rg4YebHRmON+gut0H7JRVN2X/4TPnSU98rd+58pvzxO28p9+j1BtV0qQb2Hj3LeSeNLSnE2whGynKtchhOCJc/MpbjoJF5GrcWdsEmxY08jGRIdZCSiQW1Jikit15s2DQELXAbDMiL+gJQ78J85qxgUZIWWKiwdmzU5Te/ZVN59ORKed+nvlO+cuBomeah8RKN+DaqIlN0EKUrf2RUuHbGVcWbR24k7KV1cvVTeVxGvK9LSbcSWeLbkfqpVeZXOPah60t1XtLNvSjDzEDtxe1WCDK2Kr1zSszbbruyfOjXbyz7tkyXs3opdl6ZilLmLNez2CwApmC1cz4/NVU+/chz5nBiXukT6iQb2/UhU0HjR9y6dbcSMOcoaKITvJLhpPhuxnoD338RAhM1v3J16cGsiYGVKTBPwtj3xhAk152McoZsHiaG1dtRTfVW/VU7N5X3vfkGPXzuKQ89frx84bvHyqP6Cpkv+np64cXXx6whblWXQPQ4VjbrlWvlBP8iR8zxiiSeBxEKX+njZZ4iYTlAEJ7+czLkN0mNeUZLNBaLgVScIJecRMcbQKbqEKAoAyEjHJ0MjapqysObVMB7t885fXO6fH777n3lt163uxx8/nT5mnbAX3vmZPmBvrZ5/vRyOae1Rt8QGXdK18qvXLu5vP/N1/nVLdSLNZ9QGWORDnUcDt/wAb8iMVwokZgunbHnPuMEwawGQ6ePnov1H5kEWAT3iFaaxSuvZgWNMmD3SvjwUFRCkI1E9sqcfq2xc+us7kZxifBuh3bD1VeUW3ZuLr//xrVy8px+nLBwvhw7tVReOrvitWj35g3lVr1dZOPHw+orNS49RB47dlYbUu5K+oIABVcM8eERcUmonli569b2RDEd0mrKIHDF6C426oRniYKQkyNq/GYuEsLlIOfaesjUJnAnHgW2zk2V7XoUSHpl+0cMy7oekJvRY8gNV03pIZT3OSHBgr6iy3M8OeM4SHNyjp86X779kzO6xWsRrrEEemxWI5Q4+eiQGGNVewIxjvE42DMPTI8XZhKORS4YFgvkSki0mGIA54ylknHuEDFNv+/RJmbXlg1lXgsuibygsfCKSAXwBeDyBQJjhBFfhjzuXPv1CHP4jN5l64QI0Xckx6Kxq7u6Pqyuqi9MxzCEUw46E9AkE1/7pA5EM2rs0FNJZycBg+Q0IaGWQpEjvmbed+VGb/jWy0/o/GxHtgY/OXm2fOqRo2ViJs6zlvw40S05+IXfUU0ahKc14eMJyfjsmVTRlpkILqBEiWnIAOQ5h/hw53JNcE10qwe+DUMv5Xr9KCr3JgYb90ZE45gZB+Zdmsc1mI6Y1yr2Vx/50tPl4Dn9eEF3xNjH1KrAR7tDddffUwvHCah46Q60/AxtSFltWEERU/Dl1ahPWBoSrRr6IR8ZrOPoyB1vAjlzkxPasut7Mi6ndURHEpIgTkydWK+OCYS73LJe6P/5vzxZvnDwdNmoX6ax7+BExzIR2lk16JhSg+omJu3RewuTBMkSIrq+zUMPIAWi6BiPt1FKnalLUQxzXwOZF2V/9fknyrf0fPWuu/eUV+/bXuZ0GSwrSSy+3aDH7aw3xwY/t6MiDzx3qvzlQ0+Xh4+eV3K0VxIzkiPT2h2TjExOJjrjcVXhoP5okVANPA/i8ChtTVqCrJHRegJA6OoqNgrJCwd01Mpcb2zmRYKRV7ErkrODqfKZ7z5fPqfN4W0758q9t+0od99yVblxx3y5Ym7aL+a9SAuKp/JMmi0RtD6xk1grZxZXyvcOv1w++92j5fM/OFnO9CfLnJLDbRR5V4UG+Gk/AsRjQjEfLzM+ZCkE/ed4kEFQLfsctwR1GTANJsAEh0YLugZWwJNozbgYOMqLsvlNsxZ77MRK+db+Q2Xmy8+WnVdwW5/Xr8Pmy/VXzetLw1lfjvyAk531qhb4c/pG5KUzy+XwS+fKgaML5Tv6LeKTLy+VJe2NNs7NlFmu4fhryYl59ZdE1GSk//gXiUxd9bURytD/SpQ8tJYgDNBSzRuuIKUtzyL8kApQUbxn5G4BPRHU23IpGzZMlhntpsE8qnI5/OOz5d+eWRBf361LbFoLKV8x89ihH9RpH6R1RrIrnGUlZUr601fo5RoLLvjcUX1B0wvGdscWY9N1UMMv+8haJV20siDgNQwGNDFJZizSpgQHYgQpImPLVp6cbZmWoGWDIjmyHToGBrMzt4OVRJVMKuiZ/pRuoXH7BRdnVtCTnUnRp9SD4RTUm0SOgY6kSNNy4Q9O2BYCahlLd12NlAKt/5oN7HQadIzrzxXkwDt8A8sYwXZb0EWxwhizK6gxDtB89B2sJjVxhZH4fuVq4QyQs0yLXS92+aRZsC3R6ENbiWlfhTCaHPkjHTfwGOYcoub2O56izKsbxapkzTiEg6FkzQ6vO8RIaHcwMKq/dFYbF6s054DtODZuK1iZELgkioA40gceNjBkH2wzfEjsNa2DDlhSkdzgk5TUSR+bDiIVl94VlMzsm8PYb03nTAo26B7G0AFmlP36unBHG7bSOThhG88cSnUydCyLjD/VRvoSIqlVZ0LRZdJNTmNkcsTvJs2+dDEZS3a4SDcEAg1n/P9AaAxQnDsmEZh0o3FW6yRJ6yZJzAwUxZSJtSTskYFm2+iSIiDkbSf4ZmFMPN4D2X76UHvLoFcHKWP8iml/wFHLV7YhDzEKotZqx7DF67wq44gNVB5dGq6hmeNANOr62OSqU5kAFMBME9C5lMIOE334M5iZmuIuxDhdaNDSRtyp8D10k2472K944z18Xh2nvDElixweYbK1cKhNO4OO+piOne5IMo+ANarrzyg7LObmcMjTRmD8kQSzSog/KSj7+J3Vg88WS7vKY0aVyUnZlhxg0asfoO2z5nlnZCPqS6y750EwDVqJuT6cs/FmYyZSjpVPf6HoiCr4yGTKPa9KQasAknMA0ibgCG7Ul0iMBaqN0E1siG2M2fSTNaiOnRgEsYd8NU9Pzerfz7lYi1IOBalWxWYk1QR8AS156/TcosOR6hAywrYdO40hJOir0TpGM7litpb2UR+vnoZr7LCT8hGbYMRjzAee+b2100rQ2qFmRQPcaq0Ctrm0DcJl0BzXUFMooRvHplMHGEzjySNQWutxzBRhJNHzcNpD0e2D+gyE+QivTunMg19l0gf7mxhUk5YClgMvCZQNvqz1D/UV64MAOWNDHEhuBtKoOVHpF+sSB35LFcnpKGQakhS8TpSVMY4V86F2FxMVB18zgSyflEkt00RHLMboJTc9arwH+ytryw/oFjq+DFkyXWZiiC4Bmo1Y9Gc7JK4rE6gAJjhfUizSjMWPUEKBAGktEXVuog7tpNrRzhwBQQY+E+zRq1M1EZgsDXrL/Qf6hz77oceF9Ilgh5LHDT056/UVdYyFaoQ0xrjINIKu69K6Mq55cxI3k5PzDLDNJc0YufTSvYOHEZ/E0cy0ptMrnzj0obc/juXyBP9m11rZn2A2Us8a/GiimpHzS/cjxi8iHjJdYMZZ0BlaVb7Ap4uAdsgjWwkqSS0TFWKaVTOO3zJr+3+4tPBB+E4Q/1bXgRcW36Evhj/Ov7xU5UO/HYdAjfT/Mugms8V22Z6ManfOucLTmxi+G//4DxdPv6O85/bhP/LWRb/tA/98u3ak9yt39+ndyT49GM77uaZdm5KmbMm0aFklyGCca7iNkckPdE9Dx1dw8kRHzrTcWEqeHxJ4DfJY59IbRt5kVlwcl55tggG9lkP6F5iSgS5+2/t4jHT/tOI9JOwHy2r/gSfffe3IPxP4vzL3JrQKxzmrAAAAAElFTkSuQmCC","Stripe"),tE=tm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABGNJREFUeAHtnD1sEzEUx58vd72UpmUBJhYqZtQFIYG6ICiUsXxIwARDEUJiABZWQGIBBgZAlWBjKpQBUEVbIaEWWBFiRGJgLAP0K7nch/n7koaUJvWdk1zTnF0lufN7tt/7xXc5u/ZjJEm2be91AxoyiE6SwfYR5z0owiXF2lXMiLFlCvjXgOilZdCU4zjfNzKW1ROaZnaQDH6VMTYEnb56els8f4FzPkUBe+h5hdlavtQClLNs+y4RG0WBrlqFOjCviItizHWcm/Btqdq/NYBylNvp2O5zwDlarZSeYz5tO9b5JVqaX/W5GlCvZWcnIDiyKkzp54zrFEbg+6LwP7MKwbK77+H47Op5ij/7M6aVC3xvUjAIe5Bpdh9iGf4e52m558i+/yL32WHPy3/ErzdShq7hXcMJYYRvXWUm6EHZ7B6L0xdkd+pP+T+34x0tuIwGDMPnwxpOTXJ9go2Ba+x0TbHOJMGGmXZ2HnfqHZrHegIYT/0yymOr9VKdg4dr3mOCg+rA08ct/gX59C5g7DfqqX7obAe83OB8O36NjsPDUzCo8swXwzjOzC57GQPSbTEKCVUXOC67hcLTmOU2Rd3KZi8C0hM0bsUxAAPZldJzUJxSQpfTxFaBI8yFrc+EzeI4blIF9DZuQ5utH1DwRsUGJUC456yZElBpOPkymWWVNpUAoaF2uyFH8V3JZlVAUQzqCB0NSPI1akAakISARKx7kAYkISAR6x4kASQGq0mlbrMrex1PUAfRoNIzCcpx/H3yioX7OM4nYXhigADnBmN0q2GnGA2jLgZItxuuK0IFyV1ijAYj2BNNpZl1SVpMDhBh5qh5qZl1bWhVkoA2NKRdhRqQ5JvRgDQgCQGJWPcgDUhCQCLWPUgDkhCQiHUP0oAkBCRi3YM0IAkBiVj3oDYCpLK6op75zayrXhthfnI9iNPshpbEEXKai6PeiG5iM4qYAbyHmUDehCnXz+Up10b8jlw2MUCwKA/H7kS2rE0Uk7vE2sThuGZoQBJiGpAGJCEgEesepAFJCEjEuge1CJDq4nOJOS0VK9ms1IOwgj3XUldaUrkvtrPHTkqAMFw4EbulTS5gkKFksyqgESzvv7DJPkduPrSVITCCQlLdqyGa8rBWZxwvbGYJ/uBcdc2PgtmRimAzi9EHq47hdQYlYo87xV4NAWgFm1m6IzWZMiUAyhthLIuUOR7ZXcT5MBDo41vkAmlTBBsDUVDG0+Z3VH8FG70tvD6t0rZwKhR+YB50pr5eOiUhE7ApPQf59AAYECJGpzKBIlZUCialja5B4P1EQI9dOD9QVkj5B3vkufkxAaHy/yVEO5nLmOZ+5PWnnI4Ij3MJDMIrqnqosWg75jksZp9OLyARYEkwKMUOEhwqPUicFKm4Evj+q4yZQaATNvC/XOh0aEJv4Y8RomsUDEQMgEpaA6icWwSkSYOZH4jxXgxDdiPfrpTorAMR5O01grxd8VxH7KsPL6tqF6UDzLSHCfwLHN4iAPR6ZXwAAAAASUVORK5CYII=","Square"),nE=tm("data:image/png;base64,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","Shopify"),rE=tm("data:image/png;base64,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","Gusto"),aE=tm("data:image/png;base64,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","Freshbooks"),oE=tm("data:image/png;base64,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","Uber"),iE=tm("data:image/png;base64,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","Bank"),lE={GUSTO:rE,FRESHBOOKS:aE,FRESHBOOKS2:aE,SHOPIFY:nE,STRIPE:eE,SQUARE:tE,UBER:oE};function sE(e){return lE[e]??iE}const cE=Gn({display:"flex",flexDirection:"column",gap:"4px"});function dE({integration:e,isCompact:t}){const n=Sk(e.apiName),r=function(e){if(e)return`Last synced ${Vt(e)}`}(e.lastSyncedDate),a=sE(e.apiName);return S(Mk,{children:R(Fk,{children:[R(Vv,{children:[S(ld,{Component:a}),R("div",{className:cE,children:[S(Ys,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&S(fo,{intent:"normal",children:r})]})]}),S(pk,{shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e})})]})})}const uE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),hE=Gn.raw({color:"typography.base.weak"}),pE=Gn({overflow:"hidden"});function gE({manualBankAccounts:e,isCompact:t=!1}){const n=PT(),r=t||n?Ic:Fs;return R(Mk,{children:[R("div",{className:uE,children:[S(Ys,{extraClassNames:[hE],children:"Manually Tracked Accounts"}),S(r,{onClick:()=>jl("BankAccountForm"),active:!1,children:S(rl,{Component:xs})})]}),S("div",{className:pE,children:e.map(e=>S(Zk,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const mE=cr(tr["selector-row"],Xn(Gn(Is,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),Ji)),vE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),bE=Gn({display:"flex",alignItems:"center",gap:"8px"}),fE=Gn({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),yE=cr(null,Gn({width:"20px",height:"20px"}));function xE(){const{linkPlaid:e,loading:t}=Jf();return S("button",{...mE,disabled:t,onClick:()=>{ha("Add New Connection button pressed"),e({plaidEvent:Of,message:"Add New Connection button pressed"})},children:R("div",{className:vE,children:[R("div",{className:bE,children:[S(ld,{stylists:[yE],Component:wm}),R("div",{className:fE,children:[S(Ys,{children:"Connect your bank"}),S(fo,{children:"Find your banking institution with Plaid"})]})]}),S(ud,{Component:Qi})]})})}const CE=Gn({paddingInline:"16px",paddingBottom:"8px"}),TE=Gn.raw({color:"typography.base.weak",fontWeight:"label"});function wE({title:e,children:t}){return R("div",{children:[S("div",{className:CE,children:S(Ys,{extraClassNames:[TE],children:e})}),t]})}const kE=Gn({minWidth:"100%",height:"45px"});function EE(){return R(N,{children:[S(jo,{styles:kE}),S(jo,{styles:kE}),S(jo,{styles:kE})]})}const AE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),Ji)),IE=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),SE=Gn({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),NE=Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function RE({integration:e}){const{linkPlaid:t,loading:n}=Xf(),r="PLAID"===e.apiName,a=Sk(e.apiName),o=e.iconUrl?tm(e.iconUrl,"Institution Icon"):wm;return S("button",{...AE,disabled:n||!r,onClick:()=>{ha(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:IE,children:[R("div",{className:SE,children:[S(ld,{Component:o}),S(Ys,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:NE,children:[S(rl,{Component:vu}),S(Ys,{children:"Relink"})]})]})})}const DE=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},r.createElement("g",{fill:"none",fillRule:"nonzero"},r.createElement("path",{fill:"#95BF47",d:"M48.024 12.24a.567.567 0 0 0-.536-.495c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69c-.357-.36-1.073-.27-1.341-.18-.045 0-.716.225-1.878.585-1.118-3.285-3.086-6.255-6.529-6.255h-.313C27.768.585 26.517 0 25.487 0c-8.048 0-11.894 10.125-13.1 15.255-3.13.99-5.367 1.665-5.635 1.755-1.744.54-1.789.585-2.012 2.25C4.56 20.52 0 56.07 0 56.07l35.549 6.705L54.82 58.59c0-.045-6.752-46.035-6.797-46.35zm-14.443-3.6c-.894.27-1.922.585-2.996.945V8.91c0-1.98-.268-3.6-.715-4.905 1.789.27 2.951 2.295 3.711 4.635zm-5.947-4.185c.492 1.26.805 3.015.805 5.445v.36c-1.967.63-4.07 1.26-6.215 1.935 1.207-4.635 3.487-6.885 5.41-7.74zm-2.37-2.295c.358 0 .716.135 1.029.36-2.594 1.215-5.321 4.275-6.484 10.44-1.7.54-3.354 1.035-4.919 1.53 1.342-4.68 4.606-12.33 10.374-12.33z"}),r.createElement("path",{fill:"#5E8E3E",d:"M47.488 11.7c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69a.716.716 0 0 0-.492-.225l-2.683 55.35 19.273-4.185s-6.752-46.035-6.797-46.35a.776.776 0 0 0-.581-.54z"}),r.createElement("path",{fill:"#FFF",d:"M29.02 22.41l-2.37 7.11S24.55 28.395 22 28.395c-3.756 0-3.935 2.385-3.935 2.97 0 3.24 8.407 4.5 8.407 12.105 0 5.985-3.757 9.855-8.854 9.855-6.126 0-9.211-3.825-9.211-3.825l1.654-5.445s3.22 2.79 5.902 2.79c1.789 0 2.504-1.395 2.504-2.43 0-4.23-6.886-4.41-6.886-11.385 0-5.85 4.159-11.52 12.61-11.52 3.22-.045 4.83.9 4.83.9z"}),r.createElement("path",{fill:"#000",d:"M77.835 35.263c-1.938-1.032-2.93-1.93-2.93-3.141 0-1.526 1.398-2.513 3.56-2.513 2.524 0 4.777 1.032 4.777 1.032L85 25.256S83.378 24 78.6 24c-6.669 0-11.31 3.814-11.31 9.154 0 3.051 2.163 5.34 5.047 7 2.343 1.301 3.154 2.243 3.154 3.634 0 1.436-1.171 2.603-3.334 2.603-3.2 0-6.264-1.66-6.264-1.66L64 50.115S66.794 52 71.526 52c6.85 0 11.807-3.365 11.807-9.423-.045-3.32-2.524-5.61-5.498-7.314zM103.897 24.304c-3.316 0-5.925 1.62-7.914 4.053l-.089-.045L98.768 13h-7.472L84 52h7.473l2.476-13.33c.972-5.044 3.537-8.152 5.925-8.152 1.68 0 2.343 1.171 2.343 2.838 0 1.035-.088 2.341-.31 3.377L99.078 52h7.473l2.919-15.762c.31-1.666.53-3.648.53-4.999.045-4.368-2.166-6.935-6.102-6.935zM127.92 24C118.943 24 113 32.23 113 41.4c0 5.859 3.565 10.6 10.255 10.6C132.058 52 138 43.994 138 34.6c.044-5.456-3.081-10.6-10.08-10.6zm-3.653 22.185c-2.552 0-3.609-2.191-3.609-4.965 0-4.338 2.201-11.405 6.25-11.405 2.641 0 3.521 2.326 3.521 4.562 0 4.652-2.244 11.808-6.162 11.808zM157.168 24c-5.102 0-8.01 4.489-8.01 4.489h-.09l.447-4.045h-6.713c-.313 2.712-.94 6.89-1.521 10L136 62h7.563l2.104-11.156h.179s1.566.978 4.43.978c8.906 0 14.724-9.066 14.724-18.222 0-5.067-2.282-9.6-7.832-9.6zm-7.25 22.133c-1.969 0-3.133-1.11-3.133-1.11L148.04 38c.895-4.711 3.356-7.822 5.996-7.822 2.328 0 3.044 2.133 3.044 4.133 0 4.889-2.91 11.822-7.16 11.822zM176.287 14A4.25 4.25 0 0 0 172 18.284c0 2.186 1.414 3.716 3.536 3.716h.088c2.343 0 4.332-1.574 4.376-4.284 0-2.186-1.459-3.716-3.713-3.716zM166 52h7.736L179 25h-7.782zM198.487 25.574h-5.453l.277-1.276c.462-2.642 2.034-4.965 4.668-4.965 1.387 0 2.496.41 2.496.41l1.525-6.06S200.66 13 197.748 13c-2.773 0-5.546.774-7.672 2.551-2.681 2.233-3.929 5.467-4.53 8.747l-.23 1.276h-3.652l-1.156 5.831h3.652L180 53h7.81l4.16-21.595h5.408l1.11-5.831z"}),r.createElement("path",{fill:"#000",d:"M216.005 25s-4.788 11.928-6.912 18.45h-.09c-.135-2.1-1.897-18.45-1.897-18.45h-8.04l4.607 24.615c.09.536.045.894-.18 1.251-.904 1.698-2.395 3.35-4.157 4.557-1.445 1.027-3.071 1.697-4.336 2.144L197.123 64c1.536-.313 4.788-1.608 7.498-4.11 3.479-3.216 6.731-8.22 10.029-15.01L224 25h-7.995z"}))),PE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),Ji)),ME=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),LE=Gn({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),FE=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),OE=Gn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",outline:"none",backgroundColor:"surface.foreground",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:{sm:"16px",base:"18px"},padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),VE=Gn({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function BE(){const e=cc(),{mutateAsync:t}=jf(),[n,r]=c("");return R("div",{className:LE,children:[S(vo,{children:"Enter your shop name"}),S("div",{className:VE,children:S(DE,{})}),S(Ys,{children:"Please enter the name of your shop below."}),S("input",{className:OE,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:FE,children:[S(gf,{showIcon:!1,onClick:()=>{e.close()}}),S(Sh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:S(vo,{children:"Connect"})})]})]})}function UE(){const e=sE("SHOPIFY")??vu;return R(sc,{placement:"bottom",children:[S(dc,{children:t=>R("button",{...PE,...t,children:[R("div",{className:ME,children:[S(ld,{Component:e}),S(Ys,{children:"Shopify"})]}),S(ud,{Component:Qi})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(BE,{})})})})]})}const WE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),Ji)),HE=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function zE({apiName:e}){const{mutateAsync:t}=jf(),n=Sk(e);if("SHOPIFY"===e)return S(UE,{});const r=sE(e)??vu;return R("button",{...WE,onClick:async()=>{const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:HE,children:[S(ld,{Component:r}),S(Ys,{children:n})]}),S(ud,{Component:Qi})]})}const qE=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function jE(e){return qE.includes(e)}const _E=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],KE=Gn({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),YE=Gn({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function ZE(){const{query:{data:e},isFilling:t}=TC(),n=e?.multiAccountIntegrations,r=e?.integrations,a=rr(n)&&n.length>0||rr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=l(Lc),n=ln(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(jE),a=e?.map(e=>e.apiName)||[];let o=r??_E;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:KE,children:[(t||a)&&S(wE,{title:"Already Connected",children:t?S(EE,{}):R(N,{children:[n?.map(e=>S(RE,{integration:e},e.id)),r?.map(e=>S(RE,{integration:e},e.id))]})}),S(wE,{title:"Available Banks",children:S(xE,{})}),o&&o.length>0&&S(wE,{title:"Integrations",children:S("div",{className:YE,children:o.map(e=>S(zE,{apiName:e},e))})})]})}const GE=Gn({marginTop:"16px"}),QE=Gn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),XE=Gn.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function JE({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?S(ZE,{}):t?R(N,{children:[R("div",{className:GE,children:[S(Ys,{extraClassNames:[XE],children:"Connected Accounts"}),r?.map(t=>S($k,{integration:t,isCompact:e},t.id)),a?.map(t=>S(dE,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&S(gE,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?S(gE,{manualBankAccounts:o}):R("div",{className:QE,children:[S(ld,{Component:wm}),S(vo,{wrap:"wrap",textAlign:"center",children:"If you prefer to manually input your transactions as opposed to having them automatically tracked, you can add your Manually Tracked Bank Account(s) here."})]})}const $E=cr(null,Gn({color:"typography.base.weak"})),eA=cr(tr["drawer-header"],Gn({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Pv)),tA=Gn({display:"flex",gap:"8px"}),nA=Gn({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),rA=$n({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),aA=Gn({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),oA=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),iA=cr(null,Gn({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),lA=$n({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function sA({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=PT()||e,{query:{data:a},isFilling:o}=TC(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=nh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>fh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:Dg(e?.data)};var t}}),{mutate:c,isPending:d}=Kf(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&CC(p,!1),m="connected"===ln(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,b=m?"Add New Connection":"Add New Account",f=()=>{jl(m?"NewConnection":"BankAccountForm")},y=r?Ic:Fs;return R(Hf,{onPlaidLink:n,children:[R("div",{...eA,children:[R(Vv,{children:[t&&S(Vu,{}),r?S(vo,{children:"Banks & Integrations"}):S(br,{stylists:[$E],children:"Banks & Integrations"})]}),R("div",{className:tA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[S(ud,{Component:vu,stylists:[cr(null,lA({refreshLoading:d}))]}),!r&&S(Ys,{children:"Sync Accounts"})]}),R(y,{onClick:()=>f(),active:!1,children:[S(ud,{Component:xs}),!r&&S(Ys,{children:"Add New Connection"})]})]})]}),g&&S("div",{className:oA,children:S(ok,{task:g})}),o?S(uk,{}):R(N,{children:[S("div",{className:rA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:S("div",{className:nA,children:S(JE,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&S("div",{className:aA,children:R(Fs,{stylists:[iA],onClick:()=>f(),children:[S(ud,{Component:xs}),S(vo,{children:b})]})})]})]})}const cA=Gn({display:"flex",justifyContent:"center"}),dA=Gn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1150px",border:"{borderWidths.md} solid {colors.border.layout.weak}",borderRadius:"lg",backgroundColor:"surface.foreground",marginBottom:"42px",overflow:"hidden"});function uA({onPlaidLink:e}){return S(nk,{children:S("div",{className:cA,children:S("div",{className:dA,children:S(sA,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})}function hA(e){return nt({key:"customer",name:"Customer",possibleValues:e})}function pA(e,t){if(e?.id&&t.id){const n=t.id?.in?.filter(t=>!e.id?.in?.includes(t));return{...t,id:{in:[...e.id.in??[],...n??[]]}}}return e?.id&&!t.id?{...t,id:e.id}:t}const gA=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function mA({children:e}){return S("div",{className:gA,children:e})}function vA({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(sc,{children:[S(dc,{children:e=>R(lb,{popupTriggerChildrenProps:e,children:[R(mA,{children:[t&&S(ud,{Component:tm(t,"")}),S(Ys,{wrap:"wrap",children:i})]}),S(ud,{Component:Qi})]})}),S(Hv,{title:r,Footer:o??null,children:a})]})}function bA(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ee(i??[],r),[i,r]);return o(()=>{if(!i)return{};const t=l.search(e);return function(e){const t={};for(const{parent:n,child:r}of e){const e=n.id;n.id===r.id?t[e]={parent:n,children:[]}:t[e]?t[e].children.push(r):t[e]={parent:n,children:[r]}}return t}(a(t,i))},[i,l,e,a])}function fA({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return S(N,{children:e.map((e,o)=>S(r,{groupIndex:o,children:e.map((e,n)=>S(a,{item:e},t(e,n)))},n(e,o)))})}const yA=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),xA=cr(tr["list-body"],Gn({display:"block"}));function CA({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:yA,children:[e&&S(Ys,{intent:"weak",children:e}),n?S(Jv,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):S("div",{...xA,children:t})]})}const TA=Gn({display:"flex",flexDirection:"column",gap:"16px"});function wA({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return S(sb,{handleClick:t,selected:n,isMultiSelect:r,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)}function kA({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=o(()=>Object.entries(e),[e]),i=o(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return S(eb,{children:S("div",{className:TA,children:S(fA,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>S(wA,{item:e,onItemClick:()=>t(e),selected:n.has(e.id),isMultiSelect:r}),GroupComponent:({children:e,groupIndex:t})=>{const n=a[t][1],r=n.children.length>0?n.parent.name:void 0;return S(CA,{label:r,children:e})}})})})}function EA({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:Qg,processResults:Jg});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function AA(e,t){return hC(e,t).map(e=>({parent:e.parent,child:e.child}))}function IA({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:dC,processResults:AA});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function SA(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...SA(n));return t}function NA(e,t){return e.value?.[t]?.value?.id?.in??[]}function RA(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&NA(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{NA(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function DA(e,t){const n=[];return e.forEach(e=>NA(e,t).forEach(e=>n.push(e))),new Set(n)}function PA(e,t,n,r){return d(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!NA(t,e).some(e=>n.includes(e)));return dw(t,e,r)})},[t,r,e])}const MA=Gn.raw({width:"100%",justifyContent:"center"}),LA=Gn({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function FA({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:LA,children:[R(sd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[S(Ys,{children:"Apply"}),S(rl,{Component:Ih})]}),S(Fs,{onClick:e,styles:MA,children:S(Ys,{children:"Clear All"})})]})}function OA({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function VA({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"category"),t=RA(l,e,p,"category");u(t)}},[p,l,s,u]),v=S(OA,{onApply:m,onClearAll:g});return S(vA,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:S(Zv,{placeholder:"Search expense categories...",onClick:a,SearchList:EA,DefaultList:BA,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}})})}function BA({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(VA,{categories:e.children??[],label:e.name??"",category:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,e.name??"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const UA=[];function WA({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Hg(),s=i?.data??UA,c=DA(cw(t,"category"),"category"),u=d(e=>{const t=HA(e);n(t)},[n]),h=PA("category",r,0,a);return a&&o?S(Zv,{placeholder:"Search expense categories...",onClick:u,SearchList:EA,DefaultList:BA,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function HA(e){const t=e.name??"",n=(e=>e.id?e.id.toString():"")(e);return{name:t,value:{category:{name:t,value:{id:{in:[n]}}}}}}function zA(){const{query:{data:e},isFilling:t}=Vg(),n=e?.data,r=o(()=>n?.map(HA),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}function qA(e){return nt({key:"category",name:"Category",NestedListComponent:WA,possibleValues:e})}const jA=[{value:"in",label:"In"}];function _A(e){return nt({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:jA})}function KA(){const e=function(){const e=Ui();return(e?Ri:Di).map(t=>Vi(t,e))}(),t=o(()=>function(e){const t="in";return[...e].map(e=>({name:e.text,value:{reviewStatus:{name:e.text,value:{[t]:e.value}}}}))}(e),[e]);return d(()=>({values:t,isFilling:!1}),[t])}function YA(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const ZA=I.object({minAmount:I.number().nullable(),maxAmount:I.number().nullable()}).refine(e=>null===e.minAmount||null===e.maxAmount||e.minAmount<=e.maxAmount,{message:"Minimum amount must be less than or equal to maximum amount",path:["amounts"]});function GA(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:rr((a=t).greaterThanEqual)?Ku(a.greaterThanEqual):null,maxAmount:rr(a.lessThanEqual)?Ku(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const QA=Gn({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function XA({children:e,title:t}){return S(Hv,{title:t,padChildren:!1,children:S("form",{onSubmit:e=>{e.preventDefault()},className:QA,children:e})})}const JA=Gn({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),$A=Gn({display:"flex",flexDirection:"column",flex:1}),eI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function tI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return S(XA,{title:"Amount",children:S(nI,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function nI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:GA(0,r),validators:{onChange:ZA},onSubmit:()=>{if(!r||!n)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:a,pendingFilters:n}),i=Te(o.store,e=>e.errorMap),l=i&&Object.values(i).some(e=>void 0!==e),s=()=>{if(!r)return;if(l)return void r([]);const t=function(e,t,n){const r=n.operators?.find(e=>"greaterThanEqual"===e.value),a=n.operators?.find(e=>"lessThanEqual"===e.value),o=[];if(null!==e&&r){const t=co(e,{dollarSign:!0,signage:"default"}),a=Yu(e),i=n.createFilter({name:`${t}${r.label}`,value:{[n.key]:{name:"",value:{[r.value]:a}}}});o.push(i)}if(null!==t&&a){const e=co(t,{dollarSign:!0,signage:"default"}),r=Yu(t),i=n.createFilter({name:`${a.label} ${e}`,value:{[n.key]:{name:"",value:{[a.value]:r}}}});o.push(i)}return o}(o.getFieldValue("minAmount"),o.getFieldValue("maxAmount"),e);r(t)};return R(N,{children:[S("div",{className:eI,children:R(eb,{children:[R("div",{className:JA,children:[S("div",{className:$A,children:S(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),S(vo,{children:"To"}),S("div",{className:$A,children:S(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&S(Vh,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const rI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"greaterThan",label:"Greater than"},{value:"greaterThanEqual",label:"+"},{value:"lessThan",label:"Less than"},{value:"lessThanEqual",label:"Up to"}];function aI(){return nt({key:"amount",name:"Amount",operators:rI,ModalComponent:tI})}function oI(){const{query:{data:e},isFilling:t}=nh(),n=e?.data,r=function({institutionIds:e}){const t=kr(),n=Nr(),r=[...new Set(e)],a=O({queries:r.map(e=>({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Au({institutionId:e,accessToken:t,environment:n})}),staleTime:864e5}))}),o={};return a.forEach(e=>{e.data&&(o[e.data.institutionId]=e.data?.data?.map?.logo)}),o}({institutionIds:o(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>rr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=Gu(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return d(()=>({values:a??[],isFilling:t}),[a,t])}function iI(e){return nt({key:"bankAccount",name:"Bank Account",possibleValues:e})}const lI=e=>e.value.bankAccount?.value.id?.in?e.value.bankAccount?.value.id?.in:e.value.bankAccount?.value.id?.notIn?e.value.bankAccount?.value.id?.notIn:[],sI=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function cI(e){return Rr({queryKey:["dimensionValues"],queryFn:sI,...e})}function dI(){const{query:{data:e},isFilling:t}=vv({filter:{status:{in:["ACTIVE"]}}}),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}function uI(e){return nt({key:"vendor",name:"Vendor",possibleValues:e})}function hI(e){const t=e.map(({name:e,types:t})=>function(e,t){const n="in";return{name:t,value:{type:{name:t,value:{[n]:e.map(e=>e.value)}}}}}(t,e));return nt({key:"type",name:"Type",possibleValues:()=>({values:t})})}const pI=ci(e=>r.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},r.createElement("path",{d:"M8 15.3859C12.0792 15.3859 15.3861 12.079 15.3861 7.99982C15.3861 3.92062 12.0792 0.61377 8 0.61377C3.9208 0.61377 0.613953 3.92062 0.613953 7.99982C0.613953 12.079 3.9208 15.3859 8 15.3859Z",strokeMiterlimit:10}),r.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),gI=cr(null,Gn({fill:"surface.intent.action.active"}));function mI({isSelected:e}){return S(ud,e?{Component:pI,stylists:[gI]}:{Component:rb})}function vI({filters:e,model:t,setFilters:n}){if(!t||!n)return null;const r=t.possibleValues?.();if(!r)return null;const a=t.selectedValues(e);return S(nb,{title:S(fo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?xI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(lb,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:r.name})}),S(mI,{isSelected:i})]},`${r.name}_${o}`)})})}const bI="status",fI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function yI(){const e="in";return{values:fI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function xI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function CI(e){return xI(e.value.status?.value)}function TI(){return nt({key:bI,name:"Status",possibleValues:yI,singleSelect:!0,SimpleListComponent:vI})}const wI=(kI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(kI));var kI;function EI({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function AI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"glAccount"),t=RA(l,e,p,"glAccount");u(t)}},[p,l,s,u]),v=S(EI,{onApply:m,onClearAll:g});return S(vA,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:S(Zv,{placeholder:"Search GL accounts...",onClick:a,SearchList:IA,DefaultList:II,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}})})}function II({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(AI,{glAccounts:e.children??[],label:e.name,glAccount:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:S(mA,{children:S(Ys,{wrap:"wrap",children:e.name})})},e.id)})})}const SI=[];function NI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=iC(),s=i??SI,c=DA(cw(t,"glAccount"),"glAccount"),u=d(e=>{const t=RI(e);n(t)},[n]),h=PA("glAccount",r,0,a);return a&&o?S(Zv,{placeholder:"Search GL accounts...",onClick:u,SearchList:IA,DefaultList:II,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function RI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function DI(e){return nt({key:"glAccount",name:"GL Account",NestedListComponent:NI,possibleValues:e})}function PI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(vt(e)){const t=Tt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(ft(e)){const t={};return t.greaterThanEqual=e.beginDate,t.lessThanEqual=e.endDate,t}}(r.date.value)),r.amount&&(n.amount=(a=e.amount,o=r.amount.value,a?{...a,...o}:o)),r.description&&(n.description=r.description.value),r.category&&(n.category=(i=e.category,l=r.category.value,pA(i,l))),r.reviewStatus&&(n.reviewStatus=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.reviewStatus,r.reviewStatus.value)),r.bankAccount&&(n.bankAccount=function(e,t){return pA(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return pA(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return pA(e,t)}(e.glAccount,r.glAccount.value)),r.type&&(n.type=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.type,r.type.value)),r.search&&(n.search=r.search.value),r.status&&(n.status=function(e,t){return e?{...e,...t}:t}(e.status,r.status.value)),r.vendor&&(n.vendor=function(e,t){return pA(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return pA(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function MI(e,t){const n=e.reduce(PI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return wI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const LI=e=>{const t=ln(e=>e.transactionsDashboardFilters),n=ln(e=>e.expenseDashboardFilters),r=ln(e=>e.incomeDashboardFilters),a=ln(e=>e.setTransactionsDashboardFilters),o=ln(e=>e.addTransactionsDashboardFilters),i=ln(e=>e.removeTransactionsDashboardFilter),l=ln(e=>e.hasInitializedTransactionsDashboardFilters),s=ln(e=>e.setExpenseDashboardFilters),c=ln(e=>e.addExpenseDashboardFilters),d=ln(e=>e.removeExpenseDashboardFilter),u=ln(e=>e.hasInitializedExpenseDashboardFilters),h=ln(e=>e.setIncomeDashboardFilters),p=ln(e=>e.addIncomeDashboardFilters),g=ln(e=>e.removeIncomeDashboardFilter),m=ln(e=>e.hasInitializedIncomeDashboardFilters);switch(e){case"transactionsDashboard":return{filters:t,setFilters:a,addFilters:o,removeFilter:i,hasUserConfiguredFilters:l};case"expenseDashboard":return{filters:n,setFilters:s,addFilters:c,removeFilter:d,hasUserConfiguredFilters:u};case"incomeDashboard":return{filters:r,setFilters:h,addFilters:p,removeFilter:g,hasUserConfiguredFilters:m}}};function FI(){return{getCategories:zA(),getBankAccounts:oI(),getCustomers:dI(),getVendors:function(){const{query:{data:e},isFilling:t}=Zm(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=cI(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Dimension Value";return{name:t,value:{dimensionValues:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=Jx(),n=o(()=>e?.map(e=>RI(e)),[e]);return d(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:KA()}}function OI(e,t,n){return n?function(e,t){let n;return e.forEach(e=>{const r=e.value[t]?.value?.contain;r&&(n=r)}),n||""}(n,e):""}const VI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function BI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return S(XA,{title:"Back",children:S(UI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function UI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:{[e.key]:OI(e.key,0,r)},onSubmit:()=>{if(!n||!r)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:n,pendingFilters:a});return R(N,{children:[S("div",{className:VI,children:S(eb,{children:S(o.AppField,{name:e.key,listeners:{onBlur:()=>{const t=function(e,t){const n=e.trim();if(!n)return null;const r=t.operators?.find(e=>"contain"===e.value);return r?t.createFilter({name:`${r.label} "${n}"`,value:{[t.key]:{name:"",value:{[r.value]:n}}}}):null}(o.getFieldValue(e.key),e);r(t?[t]:[])}},children:t=>S(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const WI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function HI(){return nt({key:"description",name:"Description",operators:WI,ModalComponent:BI})}const zI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function qI(){return nt({key:"notes",name:"Notes",operators:zI,ModalComponent:BI})}const jI=[{name:"Expense",types:ax.Expense},{name:"Income",types:ax.Income},{name:"Transfer",types:ax.Transfer}];function _I(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:_A(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(jI),search:at}),[l,i,s,c,u,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>MI(e,void 0),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}function KI(e,t,n,r,a){const o=ln(e=>e.initializeTransactionsDashboardFilters),i=ln(e=>e.initializeExpenseDashboardFilters),l=ln(e=>e.initializeIncomeDashboardFilters),s=ln(e=>e.hasInitializedTransactionsDashboardFilters),c=ln(e=>e.hasInitializedExpenseDashboardFilters),d=ln(e=>e.hasInitializedIncomeDashboardFilters),h=Wi(),p="transactionsDashboard"===e?s:"expenseDashboard"===e?c:d;u(()=>{const s=h?.value??[];!p&&!r&&t&&a&&("transactionsDashboard"===e?o({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):"expenseDashboard"===e?i({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):l({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}))},[p,r,t,a,e,n,h,o,i,l])}const YI=i(void 0);function ZI(){const e=l(YI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function GI({filters:e,removeFilter:t}){return function(e){const t=[];let n=null,r=null,a=null,o=null,i=null;for(let s=0;s<e.length;s++){const l=e[s];if(l.modelKey!==rt&&l.modelKey!==Ht&&(l.modelKey!==bI||!CI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(nr(n)&&rr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(nr(r)&&rr(e?.lessThanEqual)){r=s,o=e.lessThanEqual;continue}}t.push({key:l.id,text:l.name,indicesToRemove:[s]})}}const l=function(e,t,n,r,a){if(null!==e&&null!==t&&null!==n&&null!==r){const o=co(Ku(n),{dollarSign:!0,signage:"default"}),i=co(Ku(r),{dollarSign:!0,signage:"default"});return{key:`${a[e].id}-${a[t].id}`,text:`${o} - ${i}`,indicesToRemove:[e,t].sort((e,t)=>t-e)}}return null!==e?{key:a[e].id,text:a[e].name,indicesToRemove:[e]}:null!==t?{key:a[t].id,text:a[t].name,indicesToRemove:[t]}:null}(n,r,a,o,e);return l&&t.splice(i??t.length,0,l),t}(e).map(e=>S(of,{text:e.text,additionalValidClassName:tr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const QI=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_24404_41655)"},r.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter"),XI=Gn({width:"17px",height:"17px",borderRadius:"sm"});function JI({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:XI}),S("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:17})}const $I=Gn({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),eS={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function tS(){const e=PT(),{dashboardKey:t}=ZI();return S(Fs,{onClick:()=>{jl(eS[t],{routeProps:{}})},stylists:[cr(null,$I)],children:e?S(JI,{Component:QI}):R(N,{children:[S(rl,{Component:QI}),S(Ys,{children:"Filters"})]})})}const nS=I.object({beginDate:I.string().nullable(),endDate:I.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Pt(e.beginDate),n=Pt(e.endDate);if(t&&n)return!St(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),rS=Gn({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),aS=Gn({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),oS=cr(null,Gn({marginTop:"22px"}));function iS({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,df({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:nS},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=Te(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return R("div",{className:rS,children:[R("div",{className:aS,children:[S(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),S(ld,{Component:AT,stylists:[oS]}),S(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&S(Vh,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const lS={width:"fit-content"};function sS({onDateRangeChange:e}){const{filters:t}=ZI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ht);if(void 0!==t){const e=t.value.date?.value;if(ft(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:lS,children:S(iS,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const cS=Gn({width:200,minWidth:200});function dS({dateFilter:e,addFilter:t}){return S(gg,{onClick:()=>t(e),children:S(vo,{children:mt[e]})})}function uS({getModel:e,addFilters:t}){const{setOpen:n}=cc(),r=r=>{const a=e(Ht);if(void 0===a)return;const o=a.createFilter({name:mt[r],value:{[a.key]:{name:mt[r],value:r}}});t([o]),n(!1)};return S(xc,{children:R(lg,{style:cS,children:[S(dS,{dateFilter:gt.ALL_TIME,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_3_MONTHS,addFilter:r}),S(dS,{dateFilter:gt.LAST_12_MONTHS,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_QUARTER,addFilter:r}),S(dS,{dateFilter:gt.LAST_QUARTER,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_YEAR,addFilter:r}),S(dS,{dateFilter:gt.LAST_YEAR,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(sS,{onDateRangeChange:n=>{const r=e(Ht);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const hS=[cr(null,$I)];function pS({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ht);let n=mt[gt.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=vt(e)?mt[e]:ft(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Pt(e.beginDate):null,n=e.endDate?Pt(e.endDate):null;return t&&!n?`After ${Bt(t)}`:!t&&n?`Before ${Bt(n)}`:t&&n?`${Nt(t)} - ${Nt(n)}`:"Custom"}(e):t.name}return n})(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:hS,popupTriggerProps:e,children:S(Ys,{children:r})})}),S(uS,{getModel:t,addFilters:n})]})}const gS=Gn({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),mS=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function vS({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=cc();return S(gg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:gS,children:[R("span",{className:mS,children:[n&&S(ud,{Component:n}),S(vo,{children:e})]}),o&&S(ud,{Component:Qi})]})})}const bS=[{label:ox[rx.EXPENSE],type:rx.EXPENSE},{label:ox[rx.REVENUE],type:rx.REVENUE},{label:ox.BANK_TRANSFER,type:"TRANSFER_IN"},{label:ox.BANK_TRANSFER,type:"TRANSFER_OUT"}],fS=cr(null,$I);function yS({manualTransactionOptions:e}){const t=bS.filter(t=>e.includes(t.type)),n=PT();return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:[fS],popupTriggerProps:e,children:n?S(JI,{Component:xs}):R(N,{children:[S(rl,{Component:xs}),S(Ys,{children:"Add Transaction"})]})})}),S(xc,{children:S(lg,{children:t.map(({label:e,type:t})=>S(vS,{closeOnClick:!0,onClick:()=>jl("BankTransactionForm",{routeProps:{initialType:t}}),children:e},t))})})]})}const xS=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.2016 7.5C13.2023 7.15497 13.1694 6.81068 13.1034 6.47202L14.4718 5.68631L12.5926 2.4125L11.2307 3.19821C10.7043 2.75208 10.1007 2.40592 9.44979 2.17679V0.625H5.70455V2.20298C5.05363 2.43211 4.45006 2.77827 3.9236 3.2244L2.56169 2.43869L0.682526 5.7125L2.05098 6.49821C1.92 7.17727 1.92 7.87511 2.05098 8.55417L0.682526 9.33988L2.56169 12.6137L3.9236 11.828C4.45006 12.2741 5.05363 12.6203 5.70455 12.8494V14.375H9.44979V12.797C10.1007 12.5679 10.7043 12.2217 11.2307 11.7756L12.5926 12.5613L14.4718 9.2875L13.1034 8.50179C13.1677 8.17171 13.2006 7.83628 13.2016 7.5Z"}),r.createElement("path",{d:"M7.57716 10.0012C8.95853 10.0012 10.0784 8.88134 10.0784 7.49997C10.0784 6.1186 8.95853 4.99878 7.57716 4.99878C6.19579 4.99878 5.07597 6.1186 5.07597 7.49997C5.07597 8.88134 6.19579 10.0012 7.57716 10.0012Z"})),"Gear"),CS=Gn.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function TS(){return S(Fs,{styles:CS,onClick:()=>jl("TransactionSettingsDrawer"),children:S(ud,{Component:xS})})}const wS=Gn.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function kS({children:e,styles:t}){return S("div",{className:Gn(wS,t),children:e})}const ES=cr(tr["dashboard-header"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),AS=cr(null,Gn({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),IS=Gn.raw({paddingLeft:"15px",paddingRight:"15px"}),SS=Gn({display:"none",xl:{display:"flex"}});function NS({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=ZI(),l=PT(),s=o(()=>nr(n)?"":n.find(e=>e.modelKey===rt)?.value.search?.value??"",[n]);return R("div",{...ES,children:[R("div",{...AS,children:[S($T,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(rt);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:lw(l)}),S(tS,{}),S(yS,{manualTransactionOptions:t}),!l&&S(pS,{filters:n,getModel:a,addFilters:i}),S(TS,{}),S("div",{className:SS,children:S(sl,{})})]}),n.length>0&&S(kS,{styles:IS,children:S(GI,{filters:n,removeFilter:r})})]})}const RS=dn.filter(e=>e!==cn.COMMENTS&&e!==cn.DIMENSION_VALUE),DS=cr(null,Gn({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function PS(){return S("div",{...DS,children:S(sl,{})})}const MS=Gn.raw({gap:"6px"});function LS({Icon:e,label:t,children:n,onClick:r}){return n?R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>R(Ic,{popupTriggerProps:n,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}),n]}):R(Ic,{onClick:r,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}const FS=ci(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M10.6196 14.2124H4.3803C4.06894 14.2128 3.7693 14.0937 3.54327 13.8795C3.31724 13.6654 3.18207 13.3726 3.16568 13.0617L2.61591 3.22968H12.384L11.8342 13.0617C11.8179 13.3726 11.6827 13.6654 11.4567 13.8795C11.2306 14.0937 10.931 14.2128 10.6196 14.2124Z",strokeMiterlimit:10}),r.createElement("path",{d:"M1.3949 3.22968H13.605",strokeMiterlimit:10}),r.createElement("path",{d:"M6.27894 0.787598H8.72097C9.0448 0.787598 9.35537 0.91624 9.58435 1.14522C9.81334 1.37421 9.94198 1.68478 9.94198 2.00861V3.22963H5.05792V2.00861C5.05792 1.68478 5.18656 1.37421 5.41555 1.14522C5.64453 0.91624 5.9551 0.787598 6.27894 0.787598Z",strokeMiterlimit:10}),r.createElement("path",{d:"M9.09821 5.05792V12.384",strokeMiterlimit:10}),r.createElement("path",{d:"M5.90167 5.05792V12.384",strokeMiterlimit:10})),"Delete"),OS=cr(null,Gn({whiteSpace:"normal"}));function VS({transactions:e,id:t,label:n,resetSelected:r}){const{mutate:a}=VC(),o=cc();return Hi(t)?S(gg,{onClick:()=>(t=>{if(e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));a(r)}var n;o.close(),r&&r()})(t),children:S(Gg,{stylists:[OS],children:n})}):null}const BS={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},US=e=>e.map(e=>({id:e.id,status:BS.INACTIVE})),WS=ci(e=>r.createElement("svg",{stroke:"currentColor",width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.84644 15.0764C11.6751 15.0764 14.7788 11.9727 14.7788 8.14405C14.7788 4.3154 11.6751 1.21167 7.84644 1.21167C4.0178 1.21167 0.914062 4.3154 0.914062 8.14405C0.914062 11.9727 4.0178 15.0764 7.84644 15.0764Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.79217 9.6784V8.95116C7.79192 8.79114 7.82335 8.63265 7.88467 8.48484C7.94598 8.33703 8.03596 8.20282 8.14941 8.08996L8.65337 7.586C8.88132 7.35726 9.00972 7.04774 9.01061 6.7248V6.61636C9.00892 6.29431 8.8798 5.98603 8.65149 5.75891C8.42317 5.53179 8.11422 5.40429 7.79217 5.4043C7.47012 5.40429 7.16117 5.53179 6.93285 5.75891C6.70453 5.98603 6.57542 6.29431 6.57373 6.61636",strokeMiterlimit:10}),r.createElement("path",{d:"M7.18604 10.8838H8.39809",strokeMiterlimit:10})),"Uncategorized"),HS=[{id:"delete",label:"Delete",Icon:FS,component:function({transactions:e,resetSelected:t,...n}){const{mutate:r}=VC(),a=()=>{const n=US(e);r(n),t&&t()};return S(LS,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ju({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(e=>{e===Su&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:WS,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return o>0&&S(LS,{label:`${t} ${_u("Expense","Expenses",o,!0)}`,...r,children:S(hm,{onClick:function(t){var r,o;t?.id&&(a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:WS,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return S(LS,{label:`${t} ${_u("Revenue","Revenues",o,!0)}`,...r,children:S(yC,{onClick:function(t){var r,o;a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:sC})})}}];function zS({subActionList:e}){return S(lg,{children:e})}function qS({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const i=o(()=>e.map(e=>{const{component:n,id:r,filter:o,label:i}=e,l=t.filter(e=>!o||o(e));return l.length>0?S(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return S(LS,{label:n,Icon:r,children:S(xc,{children:i.length>0?S(zS,{subActionList:i}):S(gg,{children:S(Ys,{children:"No Actions Available for Selection"})},"no-actions")})})}const jS=cr(tr["bulk-select"],Gn({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function _S({table:e}){const t=e.getSelectedRowModel(),n=t.rows.some(e=>"EXPENSE"===e.original.type),r=t.rows.some(e=>"REVENUE"===e.original.type),a=o(()=>t.rows.map(e=>e.original),[t]),i=t.rows.length,l=(()=>{const e=Oi();return o(()=>[...HS,{id:"review",label:"Change Review Status",Icon:pi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:VS}))}],[e])})(),s=()=>e.resetRowSelection(!0);return R("div",{...jS,children:[S(IT,{table:e}),S(vo,{children:`${i} selected`}),l.map(e=>{if("recategorize-expenses"===e.id&&!n)return null;if("recategorize-revenues"===e.id&&!r)return null;const{component:t,subActions:o,id:i,filter:l,...c}=e,d=a.filter(e=>!l||l(e));return o?S(qS,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&S(t,{transactions:d,resetSelected:s,...c},i)})]})}function KS({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r}){const o=PT(),i=function({transactions:e,columns:t}){const n=PT(),r=LT({transactions:e,columns:t?[cn.SELECT,...t,cn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!nr(t.getColumn(sn.SELECT)),o=a(r?e:null);if(r){if(o.current!==e&&void 0!==o.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}o.current=e}}(e,r,!n),r}({transactions:e,columns:t}),{setFilters:l}=ZI(),s=i.getIsAllRowsSelected(),c=i.getIsSomeRowsSelected(),d=s||c;let u;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?u=S(pw,{buttonText:"Clear Filters",onButtonClick:()=>l([])}):r&&0===e?.length&&(u=S(zT,{})):u=S(WT,{});const h=d&&nr(u)&&!o;return R(Hs,{dashboard:"transactionDashboard",children:[h?S(_S,{table:i}):S(Ll,{headerGroups:i.getHeaderGroups()}),nr(u)?S(iw,{table:i}):S(od,{children:u})]})}const YS={transform(e){const{align:t,justify:n,direction:r,gap:a,...o}=e;return{display:"flex",flexDirection:r,alignItems:t,justifyContent:n,gap:a,...o}},defaultValues:{direction:"column",gap:"8px"}},ZS=(e={})=>{const t=Wn(YS,e);return YS.transform(t,Un)},GS=e=>Gn(ZS(e));GS.raw=ZS;const QS={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},XS=(e={})=>{const t=Wn(QS,e);return QS.transform(t,Un)},JS=e=>Gn(XS(e));JS.raw=XS;const $S={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},eN=(e={})=>{const t=Wn($S,e);return $S.transform(t,Un)},tN=e=>Gn(eN(e));tN.raw=eN;const nN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},rN=(e={})=>{const t=Wn(nN,e);return nN.transform(t,Un)},aN=e=>Gn(rN(e));aN.raw=rN;const oN=Gn({display:"flex",padding:"16px 12px",border:"0.75px",borderStyle:"solid",borderRadius:"lg",borderColor:["border.layout"]}),iN=cr(tr.card,oN,Gn({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function lN({children:e}){return S("div",{...iN,children:e})}const sN=cr(tr["card-header"],Gn({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function cN({children:e}){return S("div",{...sN,children:e})}const dN=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function uN({children:e}){return S("div",{className:dN,children:e})}const hN=$n({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"sm",cursor:"pointer",background:"surface.background",gap:"8px",alignSelf:"stretch",userSelect:"none"},variants:{filterStatus:{inactive:{padding:"8px"},active:{paddingTop:"8px",paddingBottom:"8px",paddingRight:"8px",paddingLeft:"4px",borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:"brand.action.strong",background:"surface.background.hover"},zeroState:{color:"typography.base.weak",cursor:"default",padding:"8px"}}},defaultVariants:{filterStatus:"inactive"}});function pN({filterApiNames:e,filterModelKey:t,extractFilterValue:n,filterStatus:r,buttonClassName:a,isZeroState:o,filterEffectiveValueExtractor:i,children:l}){const{addFilters:s,filters:c,getModel:d,removeFilter:u}=ZI();if(!d(t))return null;const h="active"===r,p=cr(tr["card-button"],hN({filterStatus:r}),a);return S("div",o?{...p,children:l}:{...p,onClick:h?()=>{return t=u,void function(e,t,n){const r=[];return e.forEach((e,a)=>{n(e).some(e=>t.includes(e))&&r.push(a)}),r.reverse()}(c,e,i).forEach(e=>{t(e)});var t}:()=>((e,t,n,r,a)=>{const o=e(t);if(!o||!o.possibleValues)return;const i=[];o.possibleValues().values.forEach(e=>{const t=n(e.value);if(t&&t.some(e=>r.includes(e))){const t=o.createFilter(e);i.push(t)}}),a(i)})(d,t,n,e,s),children:l})}const gN=$n({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"sm",borderWidth:"1px",borderStyle:"solid"},variants:{intent:{danger:{borderColor:"border.intent.danger",background:"surface.intent.danger"},warning:{borderColor:"border.intent.warning",background:"surface.intent.warning"},success:{borderColor:"border.intent.success",background:"surface.intent.success"},neutral:{borderColor:"border.intent.secondary",background:"surface.intent.secondary"}}},defaultVariants:{intent:"neutral"}}),mN=Gn({minWidth:"200px"}),vN=Gn({marginLeft:"auto"});function bN({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=ZI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Rr({queryKey:RC({groupBy:e,filter:t}),queryFn:DC})}({groupBy:"REVIEW_STATUS",filter:e});return{data:t?.data??void 0,isFilling:n,isRehydrating:r}}(r);let o=e.value.some(e=>{return t=n,!(!(r=e)||!Hi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,cr(tr["card-button-icon-container"],gN({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Hi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(pN,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:mN,isZeroState:t,filterEffectiveValueExtractor:YA,children:[S("div",{...l,children:S(ud,{Component:e.Icon})}),!t&&i&&R(N,{children:[S(vo,{children:e.text}),S("div",{className:vN,children:S(hu,{children:s})})]}),!t&&!i&&R(N,{children:[S(Ys,{children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]})]},e.text)}function fN({isZeroState:e}){const t=function(){const e=Ui();return(e?Pi:Mi).map(t=>Vi(t,e))}();return R(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Review Status"})}),S(uN,{children:t.map(t=>S(bN,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const yN=Gn({width:"20px",height:"20px",borderRadius:"sm"});function xN({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:yN}),S("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:20})}const CN=Gn({minWidth:"269px"}),TN=Gn({marginLeft:"auto"});function wN({account:e,isZeroState:t}){const{apiFilters:n}=ZI(),r=(i=n,l=e.id,i.bankAccount?.id?.in?.includes(l)?"active":"inactive"),a="active"===r,o=e.name??"";var i,l;const s=Cr(e.mask)?void 0:Zu(e.mask),c=co(null!=(d=e.accountBalance)?Ku(d):0,{dollarSign:!0});var d;return R(pN,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:CN,isZeroState:t,filterEffectiveValueExtractor:lI,children:[e.iconUrl&&S(xN,{imageUrl:e.iconUrl,Component:wm}),!t&&a&&R(N,{children:[S(vo,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),!t&&!a&&R(N,{children:[S(Ys,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:o}),s&&S(Ys,{intent:"weak",wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]})]},e.id)}const kN=[{name:"Expenses Card",mask:"0000",accountBalance:1e6},{name:"Travel Card",mask:"0001",accountBalance:5e5},{name:"Primary Checking",mask:"0002",accountBalance:15e5},{name:"Emergency Savings",mask:"0003",accountBalance:15e5}];function EN({isZeroState:e}){const{query:{data:t}}=nh({params:{filter:{apiName:{in:[...Ig]}}}}),n=(r=t?.data??[],e?kN:r.filter(e=>"ACTIVE"===e.status).sort((e,t)=>{const n=e.latestTransactionDate??"",r=t.latestTransactionDate??"";if(n!==r)return r.localeCompare(n);const a=e.accountBalance??0;return(t.accountBalance??0)-a}).slice(0,4));var r;return R(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Account Balances"})}),S(uN,{children:n.map((t,n)=>S(wN,{account:t,isZeroState:e},n))})]})}const AN=Gn({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),IN=Gn({display:{"@page/xl":"flex",base:"none"}}),SN=Gn({display:{"@page/xl":"none",base:"flex"}}),NN=Gn({maxWidth:"100%",display:{"@page/md":"grid",base:"none"},gridTemplateColumns:{"@page/xl":"1fr 2fr 4fr","@page/md":"1fr 1fr"},gridTemplateRows:{"@page/xl":"1fr"},height:"auto",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"});function RN({showZeroStates:e,Chart:t}){return R("div",{className:NN,children:[S("div",{className:IN,children:S(fN,{isZeroState:e})}),S("div",{className:IN,children:S(EN,{isZeroState:e})}),S("div",{className:AN,children:S(t,{})}),S("div",{className:SN,children:S(fN,{isZeroState:e})}),S("div",{className:SN,children:S(EN,{isZeroState:e})})]})}const DN=Gn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),PN=aN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),MN=Gn({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),LN=Gn({paddingTop:"8px"}),FN=Gn({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),ON=Gn({display:"flex",flexDirection:"column",gap:"10px"});function VN({columns:e=RS,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1}){const{filters:d}=ZI(),{hasPlaidLinkedBankAccount:u}=Ng(),h=u??!1,p=PT();if(a)return S("div",{children:`Error: ${o?.message}`});if(r)return S(gl,{});if(void 0!==t){const r=function(e,t){let n;return n=0===e?"FILTERS_NOT_APPLIED":e>0&&0===t?"FILTERS_MATCHED_NONE":"FILTERS_MATCHED_ANY",n}(1===d.length&&rr(d[0].value?.date)?0:d.length,t.length);return S("div",{className:PN,children:R("div",{className:DN,children:[p&&c&&S("div",{className:ON,children:S(Qw,{})}),S(RN,{Chart:l,showZeroStates:!i}),R("div",{className:MN,children:[S("div",{className:LN,children:S(NS,{isFetching:n,manualTransactionOptions:s})}),S("div",{className:FN,children:S(KS,{hasLinkedBankAccount:h,filterState:r,transactions:t,columns:e})})]}),S(PS,{})]})})}return"zero state"}const BN=Gn({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),UN=cr(tr.card,oN,BN);function WN({children:e}){return S("div",{...UN,children:e})}const HN=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function zN({children:e}){return S("div",{className:HN,children:e})}const qN=cr(tr["card-header"],Gn({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function jN({children:e}){return S("div",{...qN,children:e})}const _N=Gn({minWidth:"300px"});function KN({options:e,handleClick:t,selectedIndex:n}){return S("div",{className:_N,children:S(Eb,{options:e,handleClick:t,selectedIndex:n})})}function YN(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=pt(e);return{beginDate:ht(it(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:ot(it(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:st()}:"LAST_12_MONTHS"}const ZN=To.var("colors.border.layout"),GN=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),QN=To.var("colors.money.positive.weak"),XN=To.var("colors.money.positive"),JN=To.var("colors.money.negative.weak"),$N=To.var("colors.money.negative"),eR=To.var("colors.surface.intent.action"),tR=To.var("colors.surface.intent.action.active"),nR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],rR=()=>{const[e,t]=c(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Pa({accountingMethod:"CASH",filter:YN(e),grouping:e,select:t=>{if("SUCCESS"!==t.result)return[];const n=t.json?.data;if(void 0===n)return[];let r=n;return"YEARLY"===e&&(r=function(e){let t=!1;const n=[],r=e.length-1,a=e.length-2;return e.forEach((e,o)=>{((e?.income?.total??0)>0||(e?.expenses?.total??0)>0)&&(t=!0),(t||o===r||o===a)&&n.push(e)}),n}(n)),r.map(t=>{const n=t.period?.beginDate,{label:r,longLabel:a}=function(e,t){return void 0===e?{label:"",longLabel:""}:"MONTHLY"===t?function(e){const t=Pt(e??"");return{longLabel:t?Ot(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:La(e)}}(e):"QUARTERLY"===t?function(e){const t=lt(e),n=t.getMonth(),r=Math.trunc(n/3)+1,a=t.getFullYear();return{label:`Q${r} ${"'"+a%100}`,longLabel:`Quarter ${r} ${a}`}}(e):"YEARLY"===t?function(e){const t=lt(e).getFullYear();return{label:t.toString(),longLabel:t.toString()}}(e):{label:"",longLabel:""}}(n,e);return{longLabel:a,income:(t.income?.total??0)+(t.otherIncome?.total??0),expense:(t.cogs?.total??0)+(t.expenses?.total??0)+(t.otherExpenses?.total??0),label:r}})}});return t??[]}(nR[e].value)}};function aR({selectedIndex:e,onSelect:t}){return S(KN,{options:nR,handleClick:t,selectedIndex:e})}const oR={top:20,right:20,left:20,bottom:5},iR={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")};function lR({data:e,children:t,tooltip:n}){return S(W,{width:"100%",height:"100%",...GN,style:{flexGrow:1},children:R(H,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:oR,children:[S(j,{dataKey:"label",interval:0,tickLine:!1,stroke:ZN,tick:iR}),S(K,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const sR=Gn({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function cR(){return R("div",{className:sR,children:[S(Ao,{color:QN,label:"Income",diameter:10}),S(Ao,{color:JN,label:"Expense",diameter:10})]})}const dR=cr(null,Gn({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),uR=cr(null,Gn({width:"100%",height:"1px",backgroundColor:"border.layout"})),hR=cr(null,Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),pR=To.var("colors.money.positive"),gR=To.var("colors.money.negative");function mR({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t.find(e=>"income"===e.dataKey),r=t.find(e=>"expense"===e.dataKey),a=t[0]?.payload?.longLabel||"",o=n?.value??0,i=r?.value??0;return R("div",{...dR,children:[S(vo,{children:a}),S("div",{...uR}),R("div",{...hR,children:[S(Ao,{color:pR,label:"Income",diameter:12}),S(hu,{children:uo(Number(o))})]}),R("div",{...hR,children:[S(Ao,{color:gR,label:"Expense",diameter:12}),S(hu,{children:uo(Number(i))})]})]})}function vR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"All Transactions"}),S(ro,{title:uo(r),label:void 0})]}),R(jN,{children:[S(aR,{selectedIndex:e,onSelect:t}),S(cR,{})]})]}),R(lR,{data:n,tooltip:({active:e,payload:t})=>S(mR,{active:e,payload:t}),children:[S(Y,{name:"Income",dataKey:"income",minPointSize:2,fill:QN,isAnimationActive:!1,activeBar:{fill:XN}}),S(Y,{name:"Expense",dataKey:"expense",minPointSize:2,fill:JN,isAnimationActive:!1,activeBar:{fill:$N}})]})]})}function bR({columns:e,limit:t=100}){const n=_I(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("transactionsDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:vR,manualTransactionOptions:[rx.EXPENSE,rx.REVENUE,"TRANSFER_IN"]})})})})}const fR=e=>S(nk,{children:S(bR,{...e})}),yR={in:["EXPENSE","TRANSFER_OUT"]},xR=[{name:"Expense",types:ax.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]}];function CR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:_A(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(xR),search:at}),[l,i,s,c,u,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>MI(e,yR),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}const TR=cr(tr.text,Gn({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function wR({children:e}){return S("div",{...TR,children:e})}const kR=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function ER({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t[0]?.payload?.longLabel||"",r=Number(t[0]?.value??0);return R("div",{className:kR,children:[S(ay,{children:n}),S(wR,{children:po(r)})]})}const AR=Gn({width:"160px",height:"32px"}),IR=Gn({width:"54px",height:"32px"}),SR=({y:e,payload:t})=>S("foreignObject",{x:0,y:e-10,className:AR,children:S(Ys,{children:String(t.value)})}),NR=({x:e,y:t,payload:n})=>{return S("foreignObject",{x:e,y:t-10,className:IR,children:S(Ys,{alignment:"right",children:(r=n.value,co(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},RR=({active:e,payload:t})=>S(ER,{active:e,payload:t});function DR({data:e}){return S(W,{width:"100%",height:44*(e?.length??0)+12,...GN,children:R(H,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[S(j,{type:"number",hide:!0,domain:[0,"dataMax"]}),S(_,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:SR,width:172}),S(_,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:NR,width:66}),S(K,{content:RR,isAnimationActive:!1,cursor:{fill:"transparent"}}),S(Y,{dataKey:"total",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR},barSize:32})]})})}const PR=e=>{if("SUCCESS"!==e.result)return[];const t=e.json?.data?.[0];return void 0!==t&&void 0!==t.expenses&&t.expenses.children?t.expenses.children.map(e=>{const t=e.name??"Uncategorized";return{name:t,longLabel:t,total:e.total??0}}).filter(e=>0!==e.total).sort((e,t)=>t.total-e.total).slice(0,5):[]},MR=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function LR(){const[e,t]=c(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Mt(n),endDate:Mt(t)}})(MR[e].value),{query:{data:r}}=Pa({filter:n,select:PR}),a=n?`${Nt(Pt(n.beginDate))} - ${Nt(Pt(n.endDate))}`:"";return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&S(Ys,{intent:"weak",wrap:"ellipsis",children:a})]}),S(KN,{options:MR,handleClick:e=>t(e),selectedIndex:e})]}),S(DR,{data:r})]})}function FR({columns:e,limit:t=100}){const n=CR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:LR,manualTransactionOptions:[rx.EXPENSE,"TRANSFER_OUT"],showTasks:!0})})})})}const OR=e=>S(nk,{children:S(FR,{...e})}),VR={in:["REVENUE","TRANSFER_IN"]},BR=[{name:nx,types:ax.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:rx.TRANSFER_IN}]}];function UR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:u}=FI(),h=o(()=>({reviewStatus:_A(u),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(s),date:qt,description:HI(),glAccount:DI(c),notes:qI(),status:TI(),type:hI(BR),search:at}),[l,i,s,c,u]),p=o(()=>[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type],[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type]),g=/* @__PURE__ */(new Date).getDate(),m=o(()=>MI(e,VR),[e,g]),v=d(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:m,getModel:v,hasUserConfiguredFilters:a}}function WR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"Total Income"}),S(ro,{title:uo(r),label:void 0})]}),S(jN,{children:S(aR,{selectedIndex:e,onSelect:t})})]}),S(lR,{data:n,tooltip:({active:e,payload:t})=>S(ER,{active:e,payload:t}),children:S(Y,{name:"Revenue",dataKey:"income",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR}})})]})}function HR({columns:e,limit:t=100}){const n=UR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:WR,manualTransactionOptions:[rx.REVENUE,"TRANSFER_IN"],showTasks:!0})})})})}const zR=e=>S(nk,{children:S(HR,{...e})});function qR(){return S(Mh,{color:"weak",alignment:"horizontal"})}const jR=$n({base:{display:"flex",padding:"12px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...$i,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),_R=$n({base:{...Ga},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}}),KR=$n({base:{textWrap:"wrap",...Xa},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function YR({description:e,name:t,disabled:n,onClick:r}){const a=n?void 0:r,o=n?void 0:(i=r,e=>{"Enter"!==e.key&&"Space"!==e.code||(e.preventDefault(),i?.(e))});var i;return R("div",{className:jR({disabled:n}),role:"button",tabIndex:n?-1:0,onKeyDown:o,onClick:a,children:[R("div",{className:JS({alignItems:"flex-start",gap:"4px"}),children:[S("div",{className:_R({disabled:n??!1}),children:t}),S("div",{className:KR({disabled:n??!1}),children:e})]}),!n&&S(ud,{Component:Qi})]})}const ZR=Gn({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),GR=Gn({display:"flex",alignItems:"center",padding:"16px 12px",width:"100%"}),QR=Gn(Ga,{color:"typography.base.weak"});function XR({label:e,children:t}){return R("div",{className:ZR,children:[S("div",{className:GR,children:S("div",{className:QR,children:e})}),t]})}const JR={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}}};function $R(){const e=function(){const e=Re();return d(t=>{e(JR[t].route)},[e])}();return R(XR,{label:"Accounting",children:[S(qR,{}),S(YR,{name:"Profit & Loss",description:"How much money you made or lost over a period",onClick:()=>e("profit-and-loss")}),S(qR,{}),S(YR,{disabled:!0,name:"Balance Sheet",description:"What your business owns and owes at a point in time"}),S(qR,{}),S(YR,{disabled:!0,name:"Cash Flow Statement",description:"Where your cash came from and where it went"}),S(qR,{}),S(YR,{disabled:!0,name:"Trial Balance",description:"All account balances to verify your books are in order"})]})}function eD(){return R(XR,{label:"Taxes",children:[S(qR,{}),S(YR,{disabled:!0,name:"Schedule C",description:"Sole proprietor profit or loss for your U.S. tax return"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1065",description:"Income and deductions for partnership tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120-S",description:"Income and deductions for S-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120",description:"Income and deductions for C-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"T2125",description:"Business income and expenses for Canadian tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Tax Details for Filing",description:"Summary of income and deductions to share with your CPA"})]})}function tD(){return R(XR,{label:"Operations",children:[S(qR,{}),S(YR,{disabled:!0,name:"Accounts Receivable Aging",description:"Who owes you money and how long it's been outstanding"}),S(qR,{}),S(YR,{disabled:!0,name:"Accounts Payable Aging",description:"What you owe others and when payments are due"}),S(qR,{}),S(YR,{disabled:!0,name:"Expense Analysis",description:"Where you're spending money and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Income Analysis",description:"Where your revenue comes from and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Mileage Analysis",description:"Business miles driven for tax deduction tracking"}),S(qR,{}),S(YR,{disabled:!0,name:"Time & Task Analysis",description:"Hours worked and billable time by project or client"})]})}const nD=GS({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),rD=JS({gap:"16px",width:"100%"}),aD=tN({gap:"8px",alignItems:"center"}),oD=Gn(Ga,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),iD=Gn(Ga,{color:"typography.base"});function lD(){const e=De(),t=Re(),n=e.flatMap(e=>function(e){try{return IP.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:S("nav",{className:aD,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(b,{children:[r>0&&S(rl,{Component:Qi}),a?S("span",{className:iD,"aria-current":"page",children:e.label}):S("button",{type:"button",className:oD,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const sD=JS({gap:"16px",alignItems:"flex-start",width:"100%"}),cD=e=>["reports","profitAndLoss",e],dD=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result?r.data:void 0};function uD(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function hD(e){if(!nr(e))return co(Ku(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function pD(e){if(!nr(e))return co(e,{cents:"always",decorator:"%",signage:"parens"})}function gD(e){const t=e?.json;if(void 0===t)return[];const n=function(e){return(t,n)=>{const r=n((l=e,l[0]?.data?.[0]??{})),a=r?.name,o=uD(e,e=>{const t=n(e)?.total;return hD(t)}),i=[...(r?.children??[]).map((r,a)=>{const o=uD(e,e=>{const t=n(e)?.children?.[a].total;return function(e){if(void 0!==e)return co(Ku(e),{cents:"always",signage:"parens"})}(t)});return{key:`${t}.${a}`,label:r.name,level:1,values:o}}),{key:`${t}.total`,label:`Total ${a}`,level:0,type:"expandTotal",values:o}];var l;return{key:t,label:a,level:0,values:o,subrows:i}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,level:0,type:a,values:uD(e,r)})}(t);/* @__PURE__ */
|
|
2
|
+
return function(){const e=[];return{caboose:()=>[...e],car(t){return e.push(t),this}}}().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>hD(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>pD(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>hD(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>pD(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>hD(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}const mD=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e}),"Nothing");function vD({expanded:e,canExpand:t=!0}){return S(hc,{Component:t?e?lp:Qi:mD})}const bD=$n({base:{border:"inherit",whiteSpace:"nowrap",padding:"6px 8px",color:"typography.base"},variants:{alignment:{end:{textAlign:"end"},start:{textAlign:"start"},center:{textAlign:"center"}},weight:{inherit:{},regular:Ga,bold:Qa},clickable:{true:{cursor:"pointer"},false:{cursor:"inherit"}},border:{left:{borderLeftStyle:"solid",borderLeftWidth:"md",borderLeftColor:"border.layout"},right:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout"}},stickyLeft:{true:{position:"sticky",left:0,zIndex:1,backgroundColor:"inherit",_scrolledX:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout",filter:"drop-shadow(4px 2px 4px rgba(0, 0, 0, 0.05))"}}}},defaultVariants:{alignment:"end",clickable:!1,weight:"inherit",stickyLeft:!1}});function fD({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return S("td",{rowSpan:e,onClick:n,className:bD({clickable:r??void 0!==n,...a}),children:t})}function yD({children:e,colspan:t,...n}){return S("th",{colSpan:t,className:bD({...n}),children:e})}const xD=X();function CD(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const TD=Gn({alignItems:"center",display:"flex",gap:8}),wD=xD.accessor("label",{id:"label",header:e=>{const t=e.table.getIsAllRowsExpanded();return S(fD,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R("div",{className:TD,children:[S(vD,{expanded:t}),t?"Collapse All":"Expand All"]})})},cell:e=>S(fD,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:R("div",{className:TD,children:[S(vD,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})});const kD={[gt.LAST_6_MONTHS]:"Last 6 Months",[gt.LAST_12_MONTHS]:"Last 12 Months (TTM)",[gt.LAST_QUARTER]:"Last Quarter",[gt.LAST_YEAR]:"Last Year",[gt.THIS_QUARTER]:"This Quarter",[gt.THIS_YEAR]:"This Year"},ED=[gt.LAST_6_MONTHS,gt.LAST_12_MONTHS,gt.LAST_QUARTER,gt.LAST_YEAR,gt.THIS_QUARTER,gt.THIS_YEAR];const AD=Gn({width:"200px",minWidth:"200px"}),ID={width:"fit-content"};function SD({onPresetSelect:e,onCustomSelect:t}){const{close:n}=cc();return S(xc,{children:R(lg,{style:AD,children:[ED.map((t,r)=>R(b,{children:[S(gg,{onClick:()=>(e(t),void n()),children:S(vo,{children:kD[t]})}),(1===r||3===r)&&S(Mh,{alignment:"horizontal"})]},t)),S(Mh,{alignment:"horizontal"}),S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:ID,children:S(iS,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function ND({value:e,onChange:t}){const n=function(e){const t=Pt(e.endDate),n=Pt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:Nt(n)} - ${null===t?e.endDate:Nt(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${Nt(n)} - ${Nt(t)}`;const r=n.getFullYear(),a=t.getFullYear(),o=n.getMonth(),i=t.getMonth();return 0===o&&11===i?r===a?`${r}`:`${r} - ${a}`:r===a&&o===i?Ot(n,{abbreviateMonth:!0}):`${Ot(n,{abbreviateMonth:!0})} - ${Ot(t,{abbreviateMonth:!0})}`}(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:gk}),S(Ys,{wrap:"nowrap",children:n})]})}),S(SD,{onPresetSelect:e=>{t(Tt(e))},onCustomSelect:e=>{t(e)}})]})}const RD={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},DD={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},PD=["NONE","MONTHLY","QUARTERLY","YEARLY"],MD=Gn({width:"200px",minWidth:"200px"});function LD({onSelect:e}){const{close:t}=cc();return S(xc,{children:S(lg,{style:MD,children:PD.map(n=>S(gg,{onClick:()=>(e(n),void t()),children:S(vo,{children:RD[n]})},n))})})}function FD({value:e,onChange:t}){const n=DD[e];return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:jd}),S(Ys,{wrap:"nowrap",children:n})]})}),S(LD,{onSelect:t})]})}const OD=[{label:"Accrual",value:"ACCRUAL"},{label:"Cash",value:"CASH"}],VD=Object.fromEntries(OD.map((e,t)=>[e.value,t])),BD=Gn({width:"200px"});function UD({accountingMethod:e,onChange:t}){const n=VD[e],r=d(e=>{t(OD[e].value)},[t]);return S("div",{className:BD,children:S(Eb,{options:OD,selectedIndex:n,handleClick:r})})}const WD=ci(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_43563_992)"},r.createElement("path",{d:"M5.99982 3.61C6.78959 3.61 7.42982 2.96977 7.42982 2.18C7.42982 1.39023 6.78959 0.75 5.99982 0.75C5.21006 0.75 4.56982 1.39023 4.56982 2.18C4.56982 2.96977 5.21006 3.61 5.99982 3.61Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.705 11.25C2.23243 11.25 2.66 10.8224 2.66 10.295C2.66 9.76756 2.23243 9.34 1.705 9.34C1.17757 9.34 0.75 9.76756 0.75 10.295C0.75 10.8224 1.17757 11.25 1.705 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M5.99992 11.25C6.52735 11.25 6.95492 10.8224 6.95492 10.295C6.95492 9.76756 6.52735 9.34 5.99992 9.34C5.47249 9.34 5.04492 9.76756 5.04492 10.295C5.04492 10.8224 5.47249 11.25 5.99992 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.2948 11.25C10.8223 11.25 11.2498 10.8224 11.2498 10.295C11.2498 9.76756 10.8223 9.34 10.2948 9.34C9.76741 9.34 9.33984 9.76756 9.33984 10.295C9.33984 10.8224 9.76741 11.25 10.2948 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.70508 9.33998V6.47998H10.2951V9.33998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6 9.33999V3.61499",strokeMiterlimit:10,strokeLinecap:"square"})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_43563_992"},r.createElement("rect",{width:12,height:12,fill:"white"})))),"DimensionValue"),HD=Gn({width:"200px",minWidth:"200px"});function zD({labels:e,onSelect:t}){const{close:n}=cc(),r=e=>{t(e),n()};return S(xc,{children:R(lg,{style:HD,children:[S(gg,{onClick:()=>r(void 0),children:S(vo,{children:"None"})}),e.map(e=>S(gg,{onClick:()=>r(e.id),children:S(vo,{children:e.name})},e.id))]})})}function qD(e){return function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.dimension;if(nr(e)||n.has(e))continue;const i=r.children.find(e=>!nr(e.dimension.id)),l=i?.dimension,s=l?.id,c=s?{id:s,name:l?.name??"",status:"ACTIVE",requiredness:l?.requiredness??"NOT_REQUIRED",child:null}:null;n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:c})}return t}(e?.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}function jD(){return cI({select:qD})}function _D({value:e,onChange:t}){const{query:{data:n=[]}}=jD();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:WD}),S(Ys,{wrap:"nowrap",children:a})]})}),S(zD,{labels:n,onSelect:t})]})}function KD({popupTriggerProps:e,text:t}){return R(lb,{popupTriggerChildrenProps:e,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:t})}),S(ud,{Component:Qi})]})}function YD({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=cw(n,e.key),i=hw(e.name,o,1);return R(sc,{children:[S(dc,{children:e=>S(KD,{popupTriggerProps:e,text:i})}),e.ModalComponent&&S(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>dw(n,e.key,t))},filters:a})]})}const ZD=ci(Tm,"Bank");function GD({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?S(mI,{isSelected:n}):S(ob,{selected:n,showEmptyIndicator:!0});return R(lb,{handleClick:t,selected:n,children:[R(mA,{children:[o&&S(ld,{imageUrl:e.iconUrl,Component:ZD}),S(Ys,{wrap:"wrap",children:e.name})]}),i]})}function QD({values:e,model:t,pendingFilters:n,onClick:r}){return S(nb,{title:S(fo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=cw(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return S(GD,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):S(Jv,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function XD({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ee(e,Cg),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return S(QD,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function JD({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return S(Zv,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:XD,DefaultList:QD,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function $D({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=cc();return S(Hv,{title:"Back",Footer:S(FA,{onClearAll:()=>{a(e=>dw(e,t.key,[]))},onApply:()=>{const e=cw(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?S(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):S(JD,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function eP({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=cc();return S(FA,{onApply:()=>{n(uw(e)),a()},onClearAll:()=>{t(e=>dw(e,r,[]))}})}function tP({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=cw(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>C(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>C(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,t,e.createFilter);var o,i,l;return dw(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=S(Hv,{title:"Back",Footer:S(eP,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:S(e.SimpleListComponent,{filters:t,pendingFilters:n,onToggle:o,model:e,setPendingFilters:r,setFilters:a})});else if(void 0!==e.possibleValues){const{values:l,isFilling:s}=e.possibleValues();if(nr(l)||!tt(l))return null;if(s)return S(db,{});i=S($D,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=cw(n,e.key),s=hw(e.name,l);return R(sc,{children:[S(dc,{children:e=>S(KD,{popupTriggerProps:e,text:s})}),i]})}const nP=Gn({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function rP({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=PT();return S("div",{className:nP,children:S(nb,{title:S(fo,{children:"Filter by"}),children:t.filter(e=>{return n=o,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const o=t.possibleValues?t.possibleValues():null;return nr(o)&&void 0===t.SimpleListComponent?S(YD,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):S(tP,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function aP(e){return!nr(e)&&e.startsWith("dimension_")}const oP=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function iP(){return Rr({queryKey:["dimensions"],queryFn:oP})}function lP({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=iP(),{query:{data:i}}=cI(),l=aP(t?.key)?t.key:"dimension_NO_MODEL_YOU_MESSED_UP",s=o(()=>a?.data??[],[a]),c=o(()=>(i?.data??[]).filter(t=>t.dimension.id===e.id).filter(e=>{if(e.children.length>0)return!0;const t=s.find(t=>t.id===e.dimension?.id);return!t||!Bb(t)}).map(e=>[e,...e.children]),[i,s,e.id]),d=o(()=>c.flat(),[c]),u=o(()=>{const e=n.get(l),t={};return e?.forEach(e=>{const n=e.value[l];void 0!==n&&(t[n.value.dimensionValueId]=!0)}),t},[n,l]);return S(Yb,{fieldDimension:e.name,dimensionValueOptions:c,dimensions:s,flatDimensionValues:d,selectedRow:u,setSelectedRow:e=>{if(void 0===r)return;const n=Object.entries(e).filter(([,e])=>e).flatMap(([e])=>{if(void 0===t)return[];const n=d.find(t=>t.id===e);if(void 0===n)return[];const r=n.name??"",a=n.dimension.id??"";return[t.createFilter({name:r,value:{[l]:{name:r,value:{dimensionId:a,dimensionValueId:e}}}})]});r(e=>dw(e,l,n))},allowMultiselect:!0})}function sP(e,t){return nt({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>S(lP,{...e,dimension:t})})}function cP({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=dI(),t=function(){const{query:{data:e}}=jD();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,sP(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:hA(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=cc(),[a,i]=c(()=>sw(e,n));return S(Wv,{title:"Filter By",padChildren:!1,Footer:S(FA,{onApply:()=>{t(uw(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:S(rP,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function dP({filters:e,setFilters:t}){const{open:n}=cc();return S(Dv,{overlay:!0,children:n&&S(cP,{filters:e,setFilters:t})})}function uP({filters:e,setFilters:t}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:QI}),S(Ys,{wrap:"nowrap",children:"Filters"})]})}),S(dP,{filters:e,setFilters:t})]})}function hP({filters:e,setFilters:t}){return e.map((n,r)=>S(of,{text:n.name,onClickRemove:()=>t(et(e,r)),additionalValidClassName:tr["filter-pill"]},n.id))}const pP=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),r.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),r.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download");function gP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:pP}),S(Ys,{children:"Export Report"})]})}function mP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:gd}),S(Ys,{children:"Send Report"})]})}const vP=[],bP=$n({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:Ga,bold:Qa},expandable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"auto"}},rowType:{normal:{},expandTotal:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout"},reportTotal:{borderTopWidth:"4px",borderTopStyle:"double",borderTopColor:"border.layout.strong",borderBottomWidth:"4px",borderBottomStyle:"double",borderBottomColor:"border.layout.strong"},sectionStart:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout.strong"},sectionEnd:{borderBottomWidth:"md",borderBottomStyle:"solid",borderBottomColor:"border.layout.strong"}}},defaultVariants:{weight:"regular",expandable:!1,rowType:"normal"}}),fP=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),yP=tN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),xP=tN({gap:"8px",flexWrap:"wrap"}),CP=aN({name:"report-table-container",containerType:"scroll-state",overflowX:"auto",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout",width:"fit-content",maxWidth:"100%",paddingBottom:"16px",maxHeight:"80dvh",isolation:"isolate",boxSizing:"border-box"}),TP=Gn({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),wP=Gn({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),kP=Gn({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function EP(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function AP(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!aP(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}const IP=I.object({label:I.string()}),SP=Me([{path:JR["/"].path,errorElement:S(N,{}),element:S(Pe,{}),handle:JR["/"].handle,children:[{index:!0,Component:function(){return R("div",{className:nD,children:[R("div",{className:rD,children:[S($R,{}),S(eD,{})]}),S("div",{className:rD,children:S(tD,{})})]})}},{Component:function(){return R("div",{className:sD,children:[S(lD,{}),S(Pe,{})]})},children:[{path:JR["profit-and-loss"].path,Component:function(){const[e,t]=c(()=>Tt(gt.LAST_6_MONTHS)),[n,r]=c("MONTHLY"),[i,l]=c("ACCRUAL"),[s,u]=c(void 0),h=a(null),[p,g]=c([]),m=ln(e=>e.FEATUREFLAG_REPORT_FILTERS),v=d(()=>{const e=f.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[f=h]);var f;const{query:{data:y},isFilling:x}=(C={filters:{...e,dimensionValues:AP(p),customerIds:EP(p)},grouping:{period:n,dimensionId:s},accountingMethod:i},T={placeholderData:L},Rr({queryKey:cD(C??{}),queryFn:dD,...T}));var C,T;const w=o(()=>gD(y),[y]),k=o(()=>function(e){const t=e?.json??[],n=t[0],r=n?.data,a=t.map((e,a)=>{const o=e.data?.length??0,i=a!==t.length-1&&(o>1||r?.[0]?.name!==n?.name),l=(c=a,d=i,void 0===(s=e).data?[]:s.data.map((e,t)=>xD.accessor(`values.${c}[${t}]`,{header:t=>S(yD,{border:CD(t.column)?"left":void 0,weight:d?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return S(fD,{border:CD(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?xD.group({id:`valueRecord.${a}`,header:t=>S(yD,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[wD,...a]}(y),[y]),E=J({data:w??vP,columns:k,getCoreRowModel:$(),getExpandedRowModel:ee(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:!0,columnPinning:{left:["label"]}}}),A=E.getExpandedRowModel().rows;return R("div",{className:fP,children:[R("div",{className:yP,children:[R("div",{className:xP,children:[S(ND,{value:e,onChange:t}),S(FD,{value:n,onChange:r}),m&&S(uP,{filters:p,setFilters:g}),S(_D,{value:s,onChange:u})]}),R("div",{className:xP,children:[S(UD,{accountingMethod:i,onChange:l}),S(gP,{}),S(mP,{})]})]}),S(kS,{children:S(hP,{filters:p,setFilters:g})}),!x&&S("div",{className:CP,ref:h,onScroll:v,children:R("table",{className:TP,children:[S("thead",{className:wP,children:E.getHeaderGroups().map(e=>S("tr",{className:kP,children:e.headers.map((e,t)=>e.isPlaceholder?S(yD,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):Q(e.column.columnDef.header,e.getContext()))},e.id))}),S("tbody",{children:A.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,o=n||"expandTotal"===a?"bold":"regular",i=t<A.length-1;let l=e.original.type;if(i){const e=A[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return S("tr",{className:bP({rowType:l,expandable:n,weight:o}),onClick:r,children:e.getVisibleCells().map(e=>S(b,{children:Q(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})]})},handle:JR["profit-and-loss"].handle}]}]}]);function NP(){return u(()=>()=>{SP.navigate(JR["/"].route)},[]),S(Le,{router:SP})}function RP(){return S(nk,{children:S(NP,{})})}const DP=Ue("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),PP={queryClient:Ir,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await DP).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await DP).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await DP).delete("queryClient",e)}(e)}}}(),maxAge:Ar,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function MP({children:e}){return S(We,{client:Ir,persistOptions:PP,children:e})}const LP=Gn({position:"absolute",top:0,left:{base:0,sm:"auto"},right:0,bottom:{base:0,sm:"auto"},width:"100%",height:"100%",minWidth:"100%",minHeight:"100%",maxHeight:"100%",maxWidth:"100%",overflow:"hidden",overscrollBehavior:{base:"contain",xl:"none"}}),FP=Gn({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:{base:"transparent",xl:"overlay"},overscrollBehavior:{base:"contain",xl:"none"}}),OP=cr(null,tr.component,LP);function VP({children:e}){const t=a(null),n=a(null),r=PT();return g(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),S(ve,{children:S(be,{lockScroll:!0,className:FP,children:S("div",{onMouseDown:e=>{n.current=e.target},onClick:e=>{const r=n.current===t.current,a=e.target===t.current;r&&a&&(n.current=null,ln.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...OP,children:e})})})}const BP=i({closingQueue:[],drawerHistory:[]});function UP({children:e}){const t=ln(e=>e.drawerHistory),n=ln(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return S(BP.Provider,{value:r,children:a&&S(VP,{children:e})})}const WP=i({isActive:!0,isClosing:!1});function HP({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=l(BP),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),i=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==i,d=(o&&o[t])??(i&&i[t]);return S(WP.Provider,{value:{isActive:s,isClosing:c},children:d&&S(e,{...d.routeProps})})}const zP=cr(tr.drawer,Gn({position:"absolute",display:"flex",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",backgroundColor:"surface.background",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},overscrollBehavior:{base:"contain",xl:"none"},_focus:{outline:"none"}})),qP=Gn({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function jP({children:e}){const t=a(null),{isActive:n,isClosing:r}=l(WP),{onExitAnimationEnd:o,onInitialAnimationComplete:i}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=c(!0),o=d(()=>{ln.getState().confirmCloseDrawer()},[]),i=d(()=>{a(!1)},[a]);return u(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:n,isClosing:r,focusRef:t}),{context:s,refs:h}=ne({open:n&&!r}),p=me([t,h.setFloating]);return S(Ie,{onExitComplete:o,children:!r&&S(fe,{context:s,modal:!0,initialFocus:-1,children:R(Se.div,{tabIndex:-1,ref:p,onAnimationComplete:()=>i(),transition:Tv,initial:wv,animate:kv,exit:Ev,...zP,children:[e,!n&&S("div",{className:qP})]})})})}const _P=$n({base:{display:"flex",height:"100%",maxHeight:"100%",minHeight:0,flexDirection:"column",minWidth:{base:"128px",sm:"512px"},maxWidth:{base:"100%",sm:"512px"},flexGrow:1,overflow:"hidden"},variants:{background:{foreground:{backgroundColor:"surface.foreground"}}}});function KP({background:e,children:t}){return S("div",{className:_P({background:e}),children:t})}const YP=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function ZP(e){return void 0!==YP[e]}function GP(e){return YP[e]}const QP=ci(e=>r.createElement("svg",{id:"Layer_1","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,width:24,height:24,...e},r.createElement("defs",null,r.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),r.createElement("path",{className:"cls-63ce7444ea57ea6c838005ed-1",d:"M6.27,21.55H8.5l2.33.95h7.92a2.86,2.86,0,0,0,2.85-2.59l.88-9.13c0-.14,0-.28,0-.42h0a2.18,2.18,0,0,0-2.18-2.18H15.63l.52-1.09a6.27,6.27,0,0,0,.62-2.73h0A2.86,2.86,0,0,0,13.91,1.5h0A1.9,1.9,0,0,0,12,3.41h0a6,6,0,0,1-1.25,3.66l-2.33,3H6.27"}),r.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),XP=Gn({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function JP({cldrShortName:e}){return S("div",{className:XP,children:GP(e)})}const $P=$n({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),eM=Gn({display:"flex",gap:"4px",backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",padding:"4px 8px",alignItems:"center",justifyContent:"center",scrollbar:"hidden",overflow:"hidden"});function tM({reactions:e,type:t,handleClick:n}){return S("div",{className:eM,children:e.map((e,r)=>S("button",{className:$P({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:S(JP,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const nM=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:mi(n)};return await wa(o)},rM=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:mi(n)};return await Xm(o)};function aM(e,t,n){return fr(ds({id:e}),t,n)}async function oM(e){const t=ds({id:e});return ha("mutation successful, invalidating messages queries"),Ir.invalidateQueries({queryKey:t}).catch(e=>pa({error:e,severity:"error"}))}function iM(e,t,n){const r=[...e];return r[n]=t,r}const lM=Gn({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),sM=Object.keys(YP).filter(ZP).map(e=>({emojiCode:e,authorInfo:[]}));function cM({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:i}=l(Lc),{mutate:s}=function(e){const{userId:t,userEmail:n}=l(Lc);return ch({mutationFn:nM,onMutateFn:({data:r,accessToken:a,environment:o})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a,userEmail:o}){const i=aM(n,t,r);await Ir.cancelQueries({queryKey:i});const l=Ir.getQueryData(i);return Ir.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:iM(t,(r=t[n],i=e,l=a,s=o,{...r,reactions:[...r.reactions,{emojiCode:i.emojiCode,authorInfo:[{userId:l,email:s}]}]}),n);var r,i,l,s}),{oldMessages:l}}({data:r,accessToken:a,conversationId:e,environment:o,userId:t,userEmail:n})},onSettled:()=>oM(e)})}(e);return R(sc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[S(dc,{children:e=>S("button",{className:lM,...e,children:S(ud,{Component:QP})})}),S(xc,{type:"reaction",children:S(tM,{reactions:sM,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===i);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const dM=$n({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function uM({reactions:e,type:t,handleClick:n}){const r=dM({type:t});return S("div",{className:r,children:S(tM,{reactions:e,handleClick:n,type:t})})}const hM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),pM=$n({base:{position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"column",alignItems:"flex-start",borderRadius:"md",borderWidth:1,borderStyle:"solid",flexShrink:1,overflow:"wrap",wordBreak:"break-word",whiteSpace:"pre-wrap"},variants:{type:{sent:{color:"typography.intent.primary",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary"},received:{color:"typography.base",borderColor:"border.layout",backgroundColor:"surface.foreground"}}}}),gM=Gn({position:"relative",display:"flex",flexDirection:"column"});function mM({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const i=a(null),{isHover:s,setIsHover:d,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=c(!1),[r,a]=c(!1);return u(()=>{if(null===o.current||!i||s)return;const e=o.current,t=t=>{t.target===e||e.contains(t.target)||l(!1)};return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}},[i=t,o=e,s=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,s}(i),{mutate:g}=function(e){const{userId:t}=l(Lc);return ch({mutationFn:rM,onMutateFn:({data:n,accessToken:r,environment:a})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a}){const o=aM(n,t,r);await Ir.cancelQueries({queryKey:o});const i=Ir.getQueryData(o);return Ir.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return nr(r)||0===r.reactions.length?t:iM(t,function(e,t,n){const r=e.reactions.filter(e=>e.emojiCode!==t||!e.authorInfo.some(e=>e.userId===n));return{...e,reactions:r}}(r,e.emojiCode,a),n)}),{oldMessages:i}}({data:n,accessToken:r,conversationId:e,environment:a,userId:t})},onSettled:()=>oM(e)})}(e),m=n?"sent":"received",v=o.filter(e=>ZP(e.emojiCode)),b=v.length>0,f="sent"===m?tr["message-sent"]:tr["message-received"],y=cr(tr[f],pM({type:m}));return R("div",{className:hM({type:m,hasReactionsOnMessage:b}),ref:i,onMouseEnter:()=>"received"===m&&d(!0),children:[R("div",{className:gM,children:[S("div",{...y,children:r}),b&&S(uM,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),s&&S(cM,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const vM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),bM=Gn({position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"12px",borderRadius:"md",borderWidth:1,borderStyle:"solid",borderColor:"border.layout",backgroundColor:"surface.foreground",flexShrink:1}),fM=Gn({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),yM=Gn({textDecoration:"none",color:"inherit",cursor:"pointer"});function xM({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=PT();return S("div",{className:vM({type:e?"sent":"received"}),children:S("div",{onClick:async()=>{if(o)window.open(a,"_self","noopener,noreferrer");else try{if(a){const e=await fetch(a),t=await e.blob(),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n??"attachment",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}}catch(e){await pa({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:yM,children:R("div",{className:bM,children:[R("div",{className:fM,children:[S(Ys,{children:n}),S(fo,{children:`${r}`})]}),S(ud,{Component:pP})]})})})}const CM=cr(null,Gn({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function TM({children:e}){return S("div",{...CM,children:e})}const wM=cr(null,Gn({display:"flex",flexDirection:"column-reverse",alignItems:"flex-start",gap:"26px",flex:"1 1 0%",alignSelf:"stretch",overflowY:"auto",overflowX:"hidden",flexFlow:"column",padding:15,scrollbarWidth:"thin",maxHeight:"calc(100% + 15px)",marginBottom:"-15px"})),kM=Gn({minHeight:1,width:"100%"}),EM=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=d(()=>{t&&rr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){u(()=>{const r=e.current;if(null!==r){let e=r.scrollTop,a=Date.now();const o=()=>{if(t){const{scrollVelocity:t,currentScrollTop:o,currentTime:i}=function(e,t,n){const r=e.scrollTop,a=Date.now(),o=Math.abs(r-t),i=a-n;return{scrollVelocity:i>0?o/i:0,currentScrollTop:r,currentTime:a}}(r,e,a);t>5&&n(),e=o,a=i}};return r.addEventListener("scroll",o),()=>{r.removeEventListener("scroll",o)}}},[t,n,e])}(i,t,l),R("div",{tabIndex:-1,...wM,ref:i,children:[S("div",{className:kM,ref:o}),e]})}),AM=Object.freeze({message:{text:"",attachments:[]}}),IM=Gn({width:"24px",height:"24px",objectFit:"contain"});function SM({iconUrl:e,fileName:t}){return S("img",{src:e,alt:`${t} icon`,className:IM})}const NM=Gn({display:"flex",flex:"1 1 0",flexDirection:"row",justifyContent:"space-between",backgroundColor:"surface.foreground",borderWidth:"1px",borderStyle:"solid",borderColor:"border.layout",padding:"8px 16px",marginBottom:"8px"}),RM=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),DM=Gn({display:"grid",flexDirection:"column",minWidth:0}),PM="LOADING",MM="LOADED",LM="ERROR";function FM({attachment:e,onRemove:t}){const n=e.hasError?LM:e.isPending?PM:MM;return R("div",{className:NM,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:RM,children:[e.iconUrl&&S(SM,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:DM,children:[S(Ys,{children:e.displayFileName}),n===PM&&e.displayText&&S(fo,{accent:"strongest",children:e.displayText}),n===MM&&e.fileSize&&S(fo,{children:e.fileSize}),n===LM&&S(fo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&S(Ic,{onClick:async n=>{n.stopPropagation(),await ju({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]})===Su&&t(e)},children:S(rl,{Component:uc})})]})}const OM=Gn({width:"100%"});function VM({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:o,setActiveKeyboard:i,inputRef:l,defaultValues:s}){const{form:c}=function({onSubmit:e,defaultValues:t}){return{form:df({defaultValues:t??AM,onSubmit:t=>{zp.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),u=a(null),h=d(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=d(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:g}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["conversations"]})}}),m=d(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&g({id:e.id})},[c,g]);return S("form",{className:OM,ref:u,onKeyDown:e=>function(e,t,n,r){if(!r&&!e.shiftKey&&"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),null!==t&&!n)){const e=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});t.dispatchEvent(e)}}(e,u.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:S(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>S(FM,{attachment:e,onRemove:m},e.localId)),S(c.AppField,{name:"message",children:t=>S(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function BM(e,t){return{id:`placeholder_${e.conversationId}_${Date.now()}`,conversationId:e.conversationId,author:{userId:t??"placeholderUserId",email:"placeholderEmail"},status:"ACTIVE",createdDateTime:"",lastUpdatedDateTime:"",text:e.text??"",reactions:[],attachments:[]}}async function UM(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ha("mutation successful, invalidating messages queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t}),Ir.invalidateQueries({queryKey:n})]).catch(e=>pa({error:e,severity:"error"}))}const WM=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Nl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),HM=async({data:e,accessToken:t,environment:n})=>Nl({data:{data:[e]},accessToken:t,environment:n}),zM=Gn({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),qM=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),jM=Gn({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),_M="Marked As Resolved";function KM({resolver:e}){const t=e?`${e} ${_M}`:_M;return R("div",{className:qM,children:[S("div",{className:zM}),S("div",{className:jM,children:t}),S("div",{className:zM})]})}const YM=$n({variants:{width:{xs:{width:"30px"},sm:{width:"60px"},md:{width:"120px"},lg:{width:"240px"},xl:{width:"420px"}},height:{xs:{height:"5px"},sm:{height:"10px"},md:{height:"20px"},lg:{height:"40px"},xl:{height:"80px"}}}});function ZM({width:e="md",height:t="md"}){return S(jo,{styles:YM({width:e,height:t})})}const GM=Gn({display:"flex",flexDirection:"row-reverse"});function QM(){return R(N,{children:[S(ZM,{width:"lg",height:"lg"}),S("div",{className:GM,children:S(ZM,{width:"md",height:"lg"})}),S("div",{className:GM,children:S(ZM,{width:"lg",height:"xl"})}),S(ZM,{width:"md",height:"lg"})]})}const XM=Gn({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function JM({isConversationLoading:e,isFilling:t,message:n}){return e?n?S(TM,{children:S(mM,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?S(TM,{children:S(QM,{})}):R("div",{className:XM,children:[S(vo,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),S(Ys,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const $M=cr(null,Gn({display:"flex",alignItems:"center",justifyContent:"center",maxWidth:"100%",minHeight:0,height:"auto",flexDirection:"column",position:"relative",backgroundColor:"surface.background",borderTop:"{borderWidths.lg} solid",borderTopColor:"border.layout",padding:"12px 15px"}));function eL({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:i,defaultValues:s,defaultSubject:d}){const{userId:h}=l(Lc),{mutate:p}=function(){const{userId:e}=l(Lc);return ch({mutationFn:ps,onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=fr(ds({id:e.conversationId}),t,n);await Ir.cancelQueries({queryKey:a});const o=Ir.getQueryData(a);return Ir.setQueryData(a,t=>[BM(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:UM})}(),{query:{data:g},isFilling:m}=function(e){const t=rr(e);return Rr({queryKey:ds({id:e??""}),queryFn:hs,select:us,enabled:t})}(e),{mutate:v,isPending:b,variables:f}=(k=t,E=i,ch({mutationFn:HM,onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(nr(e)||nr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(rr(E)){const e={id:E};ls(E,is.BANK_TRANSACTION)?o=async()=>{const t=$l(e);return await Ir.invalidateQueries({queryKey:t})}:ls(E,is.FINANCIAL_SUMMARY)&&(i=async()=>await Ir.invalidateQueries({queryKey:a}))}return ha("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Ir.invalidateQueries({queryKey:n}),Ir.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>pa({error:e,severity:"error"}))}})),{mutate:y}=ch({mutationFn:WM,onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ha("mutation successful, invalidating conversations queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t})]).catch(e=>pa({error:e,severity:"error"}))}}),[x,C]=c(!1),T=a(null),w=a(null);var k,E;u(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),u(()=>{Ep(w)},[g,w]);const A=nr(e)||nr(g)||m;return R(N,{children:[A?S(EM,{ref:w,inputRef:T,activeKeyboard:x,setActiveKeyboard:C,children:S(JM,{isConversationLoading:b,isFilling:m,message:f?.message?.text})}):R(EM,{ref:w,activeKeyboard:x,setActiveKeyboard:C,inputRef:T,children:[n&&S(KM,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return S(TM,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!nr(e)).map(e=>S(xM,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&S(mM,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),S("div",{...$M,children:S(VM,{scrollRef:w,inputRef:T,conversationId:e,blockSubmit:b,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),l=o.map(e=>`att_${e.id}`),s=a.length>0,c=l.length>0;if(s||c)if(nr(e)){const e=function(e,t,n){let r="";return rr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(d,a,o[0]?.displayFileName),t=(u=a,h=l,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...rr(g=i)&&{attachedEntityId:g},message:{text:u,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:l}});var u,h,g},setActiveKeyboard:C,defaultValues:s})})]})}function tL({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=c(e),{query:{data:o}}=Sl(r),i="CLOSED"===o?.resolutionStatus;return R(KP,{children:[S(Fv,{}),S(eL,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const nL=cr(tr["form-body"],Gn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"},width:"100%"}));function rL({children:e}){return S("div",{...nL,children:e})}const aL=cr(null,Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),oL=cr(null,Gn({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),iL=Gn({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),lL=e=>{Qh(e),Xh(e)},sL=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:a,conversationId:o,transactionId:i,transaction:l})=>S(jP,{children:R("div",{...aL,children:[S(KP,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:lL,...oL,children:[n,S(rL,{children:e}),r]})}),null!==a&&S("div",{className:iL}),"conversation"===a&&i&&S(tL,{conversationId:o,attachedEntityId:i,defaultSubject:l?.description})]})}),cL=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],dL=["FEDERAL","STATE","SALES"],uL=["Q1","Q2","Q3","Q4"],hL=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function pL(e){if(!nr(e))return hL.find(t=>t.value===e)?.name}const gL=I.object({id:I.string(),type:I.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:I.enum(Object.values(Ei)),amount:I.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:I.string("Required").refine(e=>(function(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||At(new Date(e),/* @__PURE__ */new Date))&&St(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),frequency:I.union([I.object({name:I.string(),value:I.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),I.undefined()]),category:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),dimensionValues:I.array(I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).optional()),bankAccount:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:I.string().nullable(),itemizedByOptions:I.object({category:I.boolean(),customer:I.boolean()}).optional(),attachments:I.array(Hp)}),mL=I.object({id:I.string(),name:I.string().optional(),requiredness:I.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),vL=I.object({id:I.string(),name:I.string().optional(),dimension:mL.optional()}),bL=vL.extend({child:vL.optional()}),fL=I.object({id:I.string().optional(),lineItemType:I.literal("itemized"),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).optional(),dimensionValues:I.array(bL),customer:I.object({id:I.string(),name:I.string().optional()}).nullable(),amount:I.number()}),yL=I.object({lineItemType:I.literal("invoice"),amount:I.number().nullable(),invoice:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),xL=I.object({lineItemType:I.literal("bill"),amount:I.number().nullable(),bill:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),CL=I.object({lineItemType:I.literal("fee"),amount:I.number()}),TL=I.object({lineItemType:I.literal("payment"),amount:I.number(),payment:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string(),bankAccount:I.object({id:I.string(),displayName:I.string()})})}),wL=I.discriminatedUnion("lineItemType",[fL,yL,CL,xL,TL]),kL=gL.extend({children:I.array(wL),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).nullable()});kL.extend({tax:I.object({paymentInfo:I.object({region:I.enum(dL).optional(),year:I.number().optional(),quarter:I.enum(uL).optional()}).nullable().optional()}).optional()});const EL=gL.extend({id:I.string(),type:I.literal(Object.values(rx)),description:I.string(),displayName:I.string(),iconUrl:I.string(),status:I.literal(Object.values(BS)),reviewStatus:I.literal(Object.values(Ei)),apiName:I.literal(Object.values({PLAID:"PLAID",UNIT:"UNIT",STRIPE:"STRIPE",SHOPIFY:"SHOPIFY",SQUARE:"SQUARE",RUTTER:"RUTTER",UBER:"UBER",MOOV:"MOOV",QUALPAY:"QUALPAY",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",QBO:"QBO",XERO:"XERO",BENCH:"BENCH",WAVE:"WAVE"})),apiSourceId:I.string().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()},{message:"Required"}),customer:I.object({id:I.string(),name:I.string().optional(),email:I.string().optional()}).nullable(),vendor:I.object({id:I.string(),name:I.string().optional()}).nullable(),invoice:I.object({id:I.string(),name:I.string(),date:I.string(),lineItems:I.array(I.object({id:I.string(),amount:I.number()}))}).nullable(),bill:I.object({id:I.string(),name:I.string().optional()}).nullable(),payroll:I.object({id:I.string(),date:I.string().optional(),checkDate:I.string().optional(),description:I.string().optional()}).nullable(),apiItemId:I.string().nullable()}),AL=I.looseObject({amount:I.number().nullable(),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),IL=I.object({children:I.array(AL),itemizeByOptions:I.record(I.string(),I.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.category?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"category"]})})}),SL=kL.extend({type:I.literal("EXPENSE"),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable()}).check(e=>{const t=e.value.children;(function(e,t){if(0===e.length)return!0;if(!e.some(e=>"itemized"===e.lineItemType))return!0;const n=e?.reduce((e,t)=>"itemized"!==t.lineItemType?e:e+(t.amount??0),0);return n===t})(t,e.value.amount)||e.issues.push({code:"custom",message:"Sum of children amounts must equal total amount",input:e.value,path:["children"]}),function(e,t=null){return 0===e.length&&Cr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),NL=kL.extend({type:I.literal("BANK_TRANSFER"),reconciliationMatch:I.object({id:I.string(),description:I.string().optional(),amount:I.number().optional(),date:I.string().optional(),apiInstitutionId:I.string().nullable().optional(),apiName:I.enum({BOX:"BOX",CLOVER:"CLOVER",STRIPE:"STRIPE",PLAID:"PLAID",KNOX:"KNOX",UBER:"UBER",FRESHBOOKS:"FRESHBOOKS",HARVEST:"HARVEST",KW:"KW",FRESHBOOKS2:"FRESHBOOKS2",CAPITAL_ONE:"CAPITAL_ONE",SQUARE:"SQUARE",DOTLOOP:"DOTLOOP",REALOGY:"REALOGY",UPWORK:"UPWORK",SHOPIFY:"SHOPIFY",DEDUCTR:"DEDUCTR",ENTERPRISE:"ENTERPRISE",MOXIWORKS:"MOXIWORKS",APPDIRECT:"APPDIRECT",LONEWOLF:"LONEWOLF",LONEWOLF_TRANSACTIONDESK:"LONEWOLF_TRANSACTIONDESK",SAMPLE_BANK:"SAMPLE_BANK",TAXBOT:"TAXBOT",GUSTO:"GUSTO",XERO:"XERO",UNIT:"UNIT",MOOV:"MOOV",QBO:"QBO",QUALPAY:"QUALPAY",BENCH:"BENCH",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",CHECK:"CHECK",RUTTER:"RUTTER",WAVE:"WAVE",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",ADYEN:"ADYEN",PAYABLI:"PAYABLI"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!nr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>NL.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),RL=EL.extend({}),DL=I.looseObject({amount:I.number().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),PL=I.object({children:I.array(DL),itemizeByOptions:I.record(I.string(),I.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.glAccount?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"glAccount"]})})}),ML=kL.extend({type:I.literal("REVENUE"),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()},{message:"Required"}).nullable()}).check(e=>{e.value.children&&e.value.children.length>0||e.value.glAccount&&""!==e.value.glAccount.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["glAccount"]})});function LL(e){return e.reduce((e,t)=>new U(e).plus(t??0).toNumber(),0)}function FL(e,t){const n=new U(e).times(100).round(0),r=new U(t).times(100).round(0);return!n.eq(r)}function OL(e,t){const{dimensionsToIndex:n,childToRootId:r,dimensionFieldCount:a}=t,o=new Array(a).fill(void 0);if(e)for(const i of e){const e=i.dimension?.id;if(Cr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function VL(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function BL(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function UL(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function WL(e){return"EXPENSE"!==e.type||nr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function HL(e,t,n){if(e(t))return n}const zL={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function qL(e){return Cr(e)?void 0:e}function jL(e,t,n){const r=(e,t)=>HL(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:qL((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:qL(e.id),amount:e.amount?Yu(e.amount):0,categoryId:e.category?.id,glAccountId:e.glAccount?.id,dimensionValueIds:e.dimensionValues?.map(e=>e.id),customerId:e.customer?.id}}(e);case"fee":return function(e){return{id:qL(e.id),amount:Yu(e.amount)}}(e);case"bill":return function(e){return{id:qL(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:qL(e.payment.id)}}(e)}var t}(e))),o="TAX_PAYMENT"===e.type,i=/* @__PURE__ */new Set;for(const l of e.children)if("itemized"===l.lineItemType)for(const e of l.dimensionValues??[])e.dimension?.id&&i.add(e.dimension.id);return{...{amount:r("amount",e.amount?Yu(e.amount):0),date:r("date",e.date),bankAccountId:r("bankAccount",e.bankAccount.id),frequency:r("frequency",e.frequency?.value),notes:r("notes",e.notes),dimensionValueIds:r("dimensionValues",e.dimensionValues?.filter(e=>!nr(e?.dimension?.id)&&!i.has(e.dimension.id)).map(e=>e?.id)),children:a,vendorId:r("vendor",e.vendor?.id||void 0),customerId:r("customer",e.customer?.id||void 0),categoryId:r("category",e.category?.id||void 0),glAccountId:r("glAccount",e.glAccount?.id||void 0),matchingBankTransactionId:r("reconciliationMatch",e.reconciliationMatch?.id||void 0),reviewStatus:r("reviewStatus",e.reviewStatus),tax:r("tax",o?e.tax:void 0),attachmentIds:r("attachments",e.attachments.filter(e=>null!==e.id&&!e.isPending&&!e.hasError).map(e=>`att_${e.id}`))},..."EXPENSE"===e.type&&(n("category")||n("children"))?function(e,t,n){const r=n.find(t=>t.id===e)?.accountId,a=t?.map(e=>{const t=n.find(t=>t.id===e.categoryId)?.accountId;return nr(t)?e:{...e,glAccountId:ss({id:t,prefix:"GL_ACCOUNT"})}});return nr(r)?nr(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:ss({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function _L(e=null){const{mutate:t}=BC(),{mutate:n}=UC({mutationFn:PC}),{query:{data:r}}=Vg();return(a,o,i)=>{const l=r?.data??[];var s;e?(t(function(e,t,n,r){return{...jL(t,n,e=>{return r[e]?.isDirty??(t=e,Object.entries(r).some(([e,n])=>n?.isDirty&&(e.startsWith(`${t}.`)||e.startsWith(`${t}[`))));var t}),id:e}}(e.id,a,l,o)),i()):(n({...jL(s=a,l,()=>!0),amount:s.amount?Yu(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||zL[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}),_l())}}const KL=kL.extend({type:I.literal("TAX_PAYMENT"),tax:I.object({paymentInfo:I.object({region:I.enum(dL,{message:`Tax region must be one of: ${dL.join(", ")}`}),quarter:I.enum(uL,{message:"Required"}),year:I.number({message:"Tax year is required"})}).nullable()})}).superRefine((e,t)=>{e.tax?.paymentInfo||(t.addIssue({path:["tax","paymentInfo","region"],code:"custom",message:`Tax region must be one of: ${dL.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))}),YL={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Mt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:Gl[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function ZL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.bill)||!nr(n.paymentId))continue;const e=t.get(n.bill.id);e?t.set(n.bill.id,{...e,amount:e.amount+n.amount}):t.set(n.bill.id,n)}return[...t.values()]}function GL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.invoice)||!nr(n.paymentId))continue;const e=t.get(n.invoice.id);e?t.set(n.invoice.id,{...e,amount:e.amount+n.amount}):t.set(n.invoice.id,n)}return[...t.values()]}function QL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.paymentId))continue;const e=t.get(n.paymentId);e?t.set(n.paymentId,{...e,amount:e.amount+n.amount}):t.set(n.paymentId,n)}return[...t.values()]}function XL(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function JL(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(nr(e.paymentId)&&nr(e.bill)&&nr(e.invoice)||XL(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...ZL(r),...GL(r),...QL(r),...a]}(e.children,t),r=(o=n,void 0===(i=t)||0===i.size?[]:o.filter(e=>{const t=e.glAccount?.id?i.get(e.glAccount.id):void 0;return void 0===t||"DEFERRED_REVENUE"!==t.liabilityType&&"Prepaid Expenses"!==t.name})),a=r.some(e=>!(nr(e.invoice)&&nr(e.payroll)&&nr(e.bill)&&nr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return nr(e.paymentId)||XL(e,n)?t&&XL(e,n)?(r=e,{...r,lineItemType:"fee",amount:Ku(r.amount)}):nr(e.invoice)?nr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:Ku(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return nr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:Ku(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:Ku(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:Ku(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:Ku(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=Ku(e.amount);return{lineItemType:"payment",amount:n,payment:{id:t,amount:n,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName??e.bankAccount.name??""}}}}(e,e.paymentId);var r}(e,a,t))}function $L({value:e}){return{fields:eF(function(e){switch(e){case"EXPENSE":return SL;case"TAX_PAYMENT":return KL;case"BANK_TRANSFER":return NL;case"REVENUE":return ML}}(e.type).safeParse(e))}}function eF(e){const t={};if(!e.success)for(const n of e.error.issues){const e=n.path.reduce((e,t,n)=>"number"==typeof t?`${e}[${t}]`:0===n?String(t):`${e}.${String(t)}`,"");t[e]||(t[e]={message:n.message})}return t}function tF(e,t,n){const r=_L(e),{query:{data:a}}=Xx({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=e?(l=t,s=a,{id:(i=e).id,type:WL(i),reviewStatus:i.reviewStatus,amount:Ku(i.amount),category:i.category,date:i.date,vendor:i.vendor,customer:i.customer,frequency:i.frequency,bankAccount:i.bankAccount,glAccount:i.glAccount,notes:i.notes,dimensionValues:OL(i.dimensionValues,l),children:JL(i,s),reconciliationMatch:i.reconciliationMatch?{...i.reconciliationMatch,amount:Ku(i.reconciliationMatch.amount??0)}:void 0,tax:i.tax,attachments:i.attachments?i.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:cs(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...YL,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var i,l,s;return df({defaultValues:o,canSubmitWhenInvalid:!0,validators:{onBlur:$L,onSubmit:$L},onSubmit:e=>r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),onSubmitInvalid:()=>{}})}function nF({transaction:e}){const{mutate:t}=VC(),n=()=>t(US([e]));return S(vS,{onClick:()=>{return e=n,void ju({title:"Delete transaction",body:"Are you sure you want to delete this transaction?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(t=>{t===Su&&e()});var e},Icon:FS,children:"Delete"})}function rF({transaction:e}){const{mutate:t}=VC();return S(vS,{onClick:()=>{t([e].map(e=>({id:e.id,status:BS.ACTIVE})))},children:"Restore"})}const aF=e=>r.createElement("svg",{stroke:"currentColor",width:16,height:15,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.36217 8.45534H7.95444C8.20781 8.45534 8.45081 8.35469 8.62998 8.17552C8.80914 7.99636 8.9098 7.75336 8.9098 7.49998C8.9098 7.24661 8.80914 7.00361 8.62998 6.82444C8.45081 6.64528 8.20781 6.54463 7.95444 6.54463H7.31753C7.06416 6.54463 6.82116 6.44397 6.64199 6.26481C6.46283 6.08564 6.36217 5.84265 6.36217 5.58927C6.36217 5.33589 6.46283 5.09289 6.64199 4.91373C6.82116 4.73456 7.06416 4.63391 7.31753 4.63391H8.9098",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 3.36011V4.63392",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 8.45532V9.72913",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.54074 14.1875L4.23491 12.9137L5.93545 14.1875L7.62962 12.9137L9.33015 14.1875L11.0307 12.9137L12.7312 14.1875L13.3681 13.5506V0.8125H1.90384V13.5506L2.54074 14.1875Z",strokeMiterlimit:10,strokeLinecap:"square"})),oF=ci(aF,"Bill");function iF({onClick:e,error:t,validate:n}){return S(Uh,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const lF=Gn({display:"flex",flexDirection:"column",width:"100%"}),sF=cr(tr["value-comparison-summary"],Gn({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),cF=Gn({display:"flex",flexDirection:"column",gap:"8px"});function dF({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return S("div",{className:lF,children:R("div",{...sF,children:[R("div",{className:cF,children:[S(Ys,{intent:"weak",children:"Selected Total"}),S(vo,{children:go(Ku(e),r)})]}),R("div",{className:cF,children:[S(Ys,{intent:"weak",children:`${n} Total`}),S(vo,{children:po(t)})]})]})})}const uF=Gn.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),hF=cr(null,Gn({color:"icon.base"}));function pF({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return S("div",{className:qv,children:R("div",{...jv,children:[l?S(_T,{}):S(ud,{stylists:[hF],Component:zv}),S("input",{className:_v,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh}),Tr(e)&&S(Fs,{styles:uF,onClick:()=>o(""),children:S(ud,{Component:uc})})]})})}const gF=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function mF({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:gF,children:[S(Ys,{intent:"weak",children:"Search"}),S(pF,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function vF(e,t,n){return`${e} | ${Nt(Pt(t))} | ${po(Ku(n))}`}const bF=cr(tr["linked-entity-row"],Gn({display:"flex",alignItems:"center",padding:"16px",gap:"9px",backgroundColor:"surface.foreground",border:"0.75px solid {colors.border.layout}",width:"100%",cursor:"pointer",outline:"none",_supportHover:{backgroundColor:"surface.background"}})),fF=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),yF=cr(null,Gn({color:"icon.base"}));function xF({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...bF,onClick:o,children:[R("div",{className:fF,children:[S(ud,{stylists:[yF],Component:r}),S(Ys,{wrap:"wrap",children:vF(t,n,e)})]}),S(ob,{selected:a,showEmptyIndicator:!0})]})}const CF={root:null,threshold:1};function TF({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=d(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return u(()=>{const e=new IntersectionObserver(o,CF);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return S("div",{ref:n})}function wF({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return S(N,{children:t.groups.map(t=>R(CA,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>S(xF,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),S(TF,{onIntersect:a,enable:!r&&o})]},t.key))})}function kF(e){return co(e,{cents:"always",dollarSign:!0})}function EF(e){return kF(Math.abs(e))}function AF({title:e,body:t}){return ju({title:e,body:t,cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"FEE":"NO_FEE")}function IF(e,t,n){const r=EF(e);return`The selected bills total of ${EF(t)} is less than the expense total of ${r}. Was there a fee of ${EF(n)}?`}const SF=Gn(Mv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function NF({children:e}){return S("div",{className:SF,children:e})}function RF({transactionTotal:e,bills:t,onSubmit:n,fetchNextPage:r,hasNextPage:a,isFetching:o,isFetchingNextPage:i,searchTerm:l,onSearchChange:s}){const[d,u]=c({}),h=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:u,hasMultiSelect:!0,state:{selected:d}}),p=t.filter(e=>d[e.id]).reduce((e,t)=>e+t.amount,0),g=o&&!i;return S(Wv,{title:"Link Bill",Footer:S(iF,{onClick:()=>{const r=new U(p).div(100).times(-1).toNumber(),a=new U(e).sub(r).toNumber(),o=t.filter(e=>d[e.id]);r>e&&o.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Bill Payment",body:IF(n,e,t)})}({selectedTotal:r,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=a),n(o,t)}).catch(()=>{}):n(o,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:p,transactionTotal:e,transactionTypeLabel:"Expense"}),S(mF,{searchTerm:l,onChange:s,isFetching:g,searchPlaceholder:"Search bills..."}),S(wF,{listLabel:"Bills",glSourceList:h,icon:oF,fetchNextPage:r,hasNextPage:a,isFetching:o,pluralNoun:"bills",singularNoun:"bill"})]})})}const DF=e=>["bills/bills","infinite",e??{}],PF=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/bills/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:mi(n)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},MF=[];function LF(e){const t=e.lineItems?.reduce((e,t)=>e+t.amount,0)??0;return{id:e.id,name:e.name??"",date:e.date??"",amount:t}}function FF(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return nr(e)||(t.search=e),t}function OF(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(d=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:d}),limit:10,filter:FF(t)},qm({queryFn:PF,queryKey:DF(s)}));var s,d;const u=(r?.pages??MF).flatMap(e=>(e.data??[]).map(LF));return S(RF,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function VF(e){const t=cc();return S(Dv,{children:t.open&&S(OF,{...e})})}function BF(e){return{lineItemType:"fee",amount:e}}function UF(e){return{lineItemType:"bill",amount:Ku(-e.amount),bill:{id:e.id,amount:Ku(e.amount),date:e.date,name:e.name}}}function WF(e){return e.map(UF)}function HF(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function zF(e){return`Remove ${e}?`}function qF(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function jF({action:e,titleName:t,entityName:n}){return ju({title:zF(t),body:qF(e,n),cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"YES":"NO").catch(()=>"NO")}const _F={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},KF={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function YF(e,t){const n=KF[t];return jF({titleName:n,entityName:n.toLowerCase(),action:_F[e]})}const ZF="bill",GF=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(ZF,e.state.values.children);ZF!==t?"YES"===await YF(ZF,t)&&n(!0):n(!0)},Icon:oF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),S(VF,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=WF(t);0!==r&&a.push(BF(r)),e.setFieldValue("children",a),n(!1)}})]})}}),QF=ci(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M5.71252 10.4813H7.80002C8.03706 10.4813 8.26439 10.3871 8.432 10.2195C8.59961 10.0519 8.69377 9.82454 8.69377 9.5875C8.69377 9.35046 8.59961 9.12313 8.432 8.95552C8.26439 8.78791 8.03706 8.69375 7.80002 8.69375H7.17502C6.93799 8.69375 6.71066 8.59959 6.54305 8.43198C6.37544 8.26437 6.28127 8.03704 6.28127 7.8C6.28127 7.56296 6.37544 7.33563 6.54305 7.16802C6.71066 7.00041 6.93799 6.90625 7.17502 6.90625H9.26252",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 5.11249V6.90624",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 10.4813V12.275",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V14.0625H2.13123V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V4.51875H9.28748V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10})),"Payroll");function XF(e,t,n){const r=EF(e);return`The selected invoice total of ${EF(t)} is greater than the transaction total of ${r}. Was there a fee of ${EF(n)}?`}const JF=e=>["payments/payments","infinite",e??{}],$F=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/payments/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:mi(n)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},eO=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),tO=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),nO=Gn({marginLeft:"auto"});function rO({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:eO,children:[R("div",{className:tO,children:[S(Ys,{children:e}),t&&S(Ys,{wrap:"nowrap",children:ho(t)})]}),R("div",{className:tO,children:[n&&S(fo,{children:n}),S("span",{className:nO,children:r&&S(fo,{wrap:"nowrap",children:Nt(Pt(r))})})]})]})}function aO({payment:e,selected:t,onClick:n}){return S(sb,{handleClick:n,selected:t,isMultiSelect:!0,children:S(rO,{description:e.description,amount:Ku(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}const oO=[];function iO(e){return e}function lO(e){return e.pages.flatMap(e=>(e.data??[]).map(iO))}function sO(e){return Object.values(e).some(e=>e)}function cO(e,t){return e===Yu(t)}function dO(e,t){return(t??[]).filter(t=>e[t.id]).reduce((e,t)=>e+t.amount,0)}function uO(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:xr(t)?void 0:t}}function hO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const[r,a]=c(""),{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:u}}=(h={filter:uO(n,r)},p={select:lO},qm({queryFn:$F,queryKey:JF(h),...p}));var h,p;const[g,m]=c({}),v=dO(g,o),[b,f]=c(void 0),y=d(e=>{const n=dO(e,o),r=sO(e);void 0===b||!cO(n,t)&&r||f(void 0),m(e)},[o,t,b]),x=Gv({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:g},onSelectedChange:y}),C=l&&!u;return S(Wv,{title:"Link Transactions",Footer:S(iF,{validate:()=>{const e=cO(v,t),n=sO(g),r=e||!n;return r||f("The selected total must equal the income amount."),r},error:b,onClick:()=>{e(o?.filter(e=>g[e.id])??oO)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:v,transactionTotal:t,transactionTypeLabel:nx,selectedAmountSignage:"default"}),S(mF,{searchTerm:r,onChange:a,isFetching:C,searchPlaceholder:"Search transactions..."}),x.groups.map(e=>{const t=e.getRows();return S(CA,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return S(aO,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),S(TF,{onIntersect:i,enable:!l&&s})]})})}function pO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const r=cc();return S(Dv,{children:r.open&&S(hO,{transactionTotalDollars:t,parentBankAccountId:n,onSubmit:e})})}function gO({transactionTotal:e,invoices:t,onInvoiceSubmit:n,onPaymentSubmit:r,hasExistingInvoices:a,parentBankAccountId:o,fetchNextPage:i,hasNextPage:l,isFetching:s,isFetchingNextPage:d,searchTerm:u,onSearchChange:h}){const[p,g]=c({}),[m,v]=c(!1),b=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:g,hasMultiSelect:!0,state:{selected:p}}),f=t.filter(e=>p[e.id]).reduce((e,t)=>e+t.amount,0),y=s&&!d;return S(Wv,{title:"Link Invoice",HeaderRightAction:S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(lg,{forceNewCascade:!0,children:R(sc,{open:m,onOpenChange:v,children:[S(vS,{onClick:async()=>{const e=t.some(e=>p[e.id]);if(a){if("YES"!==await YF("payment","invoice"))return}else if(e&&"YES"!==await async function(){return jF({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;v(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),S(pO,{transactionTotalDollars:e,parentBankAccountId:o,onSubmit:r})]})})}),Footer:S(iF,{onClick:async()=>{const r=Ku(f),a=t.filter(e=>p[e.id]);if(r>e&&a.length>0){const t=new U(r).sub(e),o=t.toNumber(),i=t.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Invoice Payment",body:XF(n,e,t)})})({selectedTotal:r,transactionTotal:e,suggestedFee:o}).then(e=>{let t=0;"FEE"===e&&(t=i),n(a,t)}).catch(()=>{})}else n(a,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:f,transactionTotal:e,transactionTypeLabel:nx}),S(mF,{searchTerm:u,onChange:h,isFetching:y,searchPlaceholder:"Search invoices..."}),S(wF,{listLabel:"Invoices",glSourceList:b,icon:QF,fetchNextPage:i,hasNextPage:l,isFetching:s,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const mO=e=>["invoicing/invoices","infinite",e??{}],vO=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return(async({params:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/invoicing/invoices/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}})({params:n,cursor:e.pageParam,accessToken:r,environment:a})},bO=[];function fO(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return xr(e)||(t.search=e),t}function yO(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return qm({queryFn:vO,queryKey:mO(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:fO(t)}});var s;const d=(r?.pages??bO).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return S(gO,{...e,invoices:d,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function xO(e){const t=cc();return S(Dv,{children:t.open&&S(yO,{...e})})}function CO(e){const t=Ku(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const TO=(e,t)=>{const n=e.map(CO);return 0!==t&&n.push(BF(t)),n};function wO(e){const t=Ku(e.amount);return{lineItemType:"payment",amount:t,payment:{id:e.id,amount:t,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName}}}}function kO(e){return e.map(wO)}const EO="invoice",AO=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(EO,e.state.values.children);EO!==t?"YES"===await YF(EO,t)&&n(!0):n(!0)},Icon:QF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=TO(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)},hasExistingInvoices:r,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),IO=Gl.filter(e=>"ONE_TIME"!=e.value);function SO({onClick:e}){const t=cc();return S(im,{triggerChildren:S(cm,{displayLabel:"Make recurring"}),popupChildren:S(xb,{frequencies:IO,onClick:n=>{e(n),t.close()}})})}function NO({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return S(Ic,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:S(ld,{Component:t})})}function RO({activeTab:e,onClick:t,popupTriggerProps:n}){return S(NO,{active:"conversation"===e,onClick:()=>t("conversation"),icon:cd,ariaLabel:"conversation-tab",popupTriggerProps:n})}const DO=Gn({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function PO({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=cc(),[a,o]=c(e),{query:{data:i}}=Sl(a),l="CLOSED"===i?.resolutionStatus;return S(Av,{children:R("div",{className:DO,children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>r.setOpen(!1)}),S(vo,{children:"Back"})]})}),S(eL,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const MO={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:nx},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},LO=Object.values(MO);function FO({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=_e();return a?S(pb,{}):S(nb,{title:R(N,{children:[s&&t&&S(vo,{children:"Suggested"}),S(vo,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?S(vA,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:S(BO,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:R(mA,{children:[t.iconUrl&&S(ud,{Component:tm(t.iconUrl,t.name??"")}),S(Ys,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const OO="Search expense categories...",VO=[];function BO({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=Hg(),s=r??i?.data??VO,c=cc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return S(Zv,{placeholder:OO,onClick:d,SearchList:EA,DefaultList:FO,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function UO({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=_e();return a?S(pb,{}):R(N,{children:[c&&t&&S(nb,{title:S(vo,{children:"Suggested"})}),S(nb,{title:S(vo,{children:r}),children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?S(vA,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:S(zO,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:S(mA,{children:S(Ys,{wrap:"wrap",children:t.name})})},t.id)})})]})}const WO="Search income categories...",HO=[];function zO({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,nestedGlAccounts:r,parentAccount:a,glAccount:o,parentOnClick:i}){const{query:{data:l,isFetched:s},isFilling:c}=iC(),d=r??l??HO,u=cC([...d],sC),h=cc(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return S(Zv,{placeholder:WO,onClick:g,SearchList:IA,DefaultList:UO,listLength:d.length,extraProps:{glAccounts:u,listLabel:e,isFetched:s,isFilling:c,showSuggestedCategories:n,parentAccount:a,glAccount:o,handleConversion:t,parentOnClick:g,selectedIds:p},forceSearchVisible:!0})}function qO({list:e,onClick:t,NestedChildList:n}){return S(eb,{children:e.groups.map(e=>S(CA,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return S(vA,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:S(n,{row:e})},e.key);const r=e.getIsSelected();return S(sb,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(mA,{children:[e.value.iconUrl&&S(ud,{Component:tm(e.value.iconUrl,e.value.name)}),S(Ys,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const jO="All Tax Categories";function _O({handleConversion:e,region:t}){const n=cc(),r=Gv({data:[hL],groups:[{label:jO,key:jO}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return S(qO,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function KO({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=_e(),d=!l&&i&&0===r.length;return l?S(pb,{}):R(eb,{children:[a&&S("div",{children:S(lb,{handleClick:t,children:S(Ys,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&S(vo,{children:"Suggested"}),!d&&R(N,{children:[S(vo,{children:o}),S("div",{children:r?.map(t=>{const n=s?.id===t.id;return S(sb,{handleClick:()=>e(t),selected:n,children:S(rO,{description:t.description,amount:Ku(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const YO={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function ZO({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ee(n??[],YO),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?S(pb,{}):0===l.length?S(Jv,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):S(eb,{children:S("div",{children:l.map(e=>{const n=a?.id===e.id;return S(sb,{handleClick:()=>t(e),selected:n,children:S(rO,{description:e.description,amount:Ku(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const GO=[];function QO({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Pt(o),s=(c=r,{filter:{status:{in:["ACTIVE"]},type:{in:[(d=a)>0?"EXPENSE":"REVENUE",d>0?"TRANSFER_OUT":"TRANSFER_IN"]},amount:{equal:-d},date:{greaterThanEqual:Mt(Ut(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Mt(Ut(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=ts(s,{enabled:null!==l}),m=h?.data??GO,{query:{data:v}}=Xx({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),b=cc();return S(Zv,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),b.close()},SearchList:ZO,DefaultList:KO,listLength:m.length??0,extraProps:{listLabel:e,bankTransfers:m,isFetched:p,isFilling:g,holdingAccount:v,showSuggestedCategories:n,transactionDate:o,onNeedsMatchClick:()=>{v&&t({type:"BANK_TRANSFER",value:{glAccount:v}}),b.close()},reconciliationMatch:i}})}function XO({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=c(function(e){switch(e){case"EXPENSE":return LO.indexOf(MO.EXPENSE);case"REVENUE":return LO.indexOf(MO.REVENUE);case"TAX_PAYMENT":return LO.indexOf(MO.TAX_EXPENSE);default:return LO.indexOf(MO.TRANSFER)}}(e)),{category:d,glAccount:u,tax:h,date:p,bankAccount:g,reconciliationMatch:m,amount:v}=o,b=h?.paymentInfo?.region,f=g?.id;return R(Hv,{title:t,children:[!i&&S(Eb,{options:LO,handleClick:e=>s(e),selectedIndex:l}),S(()=>{switch(LO[l].value){case"EXPENSE":return S(BO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:d});case"REVENUE":return S(zO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return S(_O,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:b});case"BANK_TRANSFER":return S(QO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:f,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}const JO=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function $O({children:e}){const{startPrefetch:t,cancelPrefetch:n}=_g();return S("button",{className:JO,type:"button",onMouseEnter:t,onMouseLeave:n,children:e})}const eV=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function tV({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:eV,children:[l&&S(ud,{Component:l}),S(Ys,{wrap:"wrap",children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function nV(){const{query:{data:e}}=cI(),{query:{data:t=[]}}=jD(),n=o(()=>e?.data??[],[e]),r=o(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.set(e.id,r),e.child?.id&&(t.set(e.child.id,r),n.set(e.child.id,e.id))}),{dimensionsToIndex:t,childToRootId:n,dimensionFieldCount:e.length}}(t),[t]);return{nestedDimensionValues:n,nestedDimensions:t,dimensionLookup:r}}const rV=Gn({display:"flex",gap:"8px",alignItems:"center"});function aV({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:rV,children:[l&&S(ud,{Component:l}),S(Ys,{children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function oV(e){return{id:e.id??"",type:e.type??"EXPENSE",date:e.date??"",amount:e.amount??0,displayName:e.displayName??"",description:e.description??"",notes:e.notes??null,reviewStatus:e.reviewStatus??"USER_REVIEW_REQUIRED",apiName:e.apiName??"MANUAL_ENTRY",iconUrl:e.iconUrl??"",apiSourceId:e.apiSourceId??null,bankAccount:e.bankAccount??{id:""},glAccount:e.glAccount??{id:""},dimensionValues:e.dimensionValues??[],customer:e.customer??null,vendor:e.vendor??null,category:e.category??null,invoice:e.invoice??null,bill:e.bill??null,payroll:e.payroll??null,paymentId:e.paymentId??null,...void 0!==e.apiItemId?{apiItemId:e.apiItemId}:{}}}const iV=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.dimensionValues)e.dimension?.id&&t.push(e.dimension.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!nr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},lV={id:"customer",name:"Customer"};function sV(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function cV(e){return oV({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function dV(e,t,n,r,a){if(1===e.length){const o=e[0];"EXPENSE"===t?n(o.category??null):r(o.glAccount??null),a([])}else a(e)}const uV=cr(tr["line-item-card"],Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),hV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),pV=Gn({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),gV=uf({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedDimensionValues:a,nestedDimensions:o,dimensionLookup:i}=nV(),l=n=>{switch(n.type){case"EXPENSE":return void e.setFieldValue(`children[${t}].category`,n.value);case"REVENUE":return void e.setFieldValue(`children[${t}].glAccount`,n.value)}};return R("div",{...uV,children:[R("div",{className:hV,children:[S(Ys,{children:`Line Item #${t+1}`}),R(Ic,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[S(Ys,{children:"Remove"}),S(ud,{Component:FS})]})]}),R("div",{className:pV,children:[S(e.AppField,{name:`children[${t}].amount`,children:e=>S(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&S(tV,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&S(aV,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),S(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childDimensionValues:e.values.children[t].dimensionValues}),children:({itemizeByOptions:n,childDimensionValues:r})=>function(e,t,n,r,a,o){const{childToRootId:i}=o;return Object.entries(e).filter(([e,t])=>e!==a&&t).map(([e])=>{const a=(t??[]).findIndex(t=>!nr(t?.dimension?.id)&&(i.get(t.dimension.id)??t.dimension.id)===e);return-1===a?null:{fieldDimension:r.find(t=>t.id===e)?.name??"",dimensionValueOptions:VL(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,lV.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>S(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(BL(t))})},r[0][0].id))}),S(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&S(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),mV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function vV({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=cc();return S(xc,{children:R(lg,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return S(gg,{onClick:()=>{n(e.id,!r)},children:R("div",{className:mV,children:[S(Ys,{children:a(e)}),S(ud,{Component:r?pi:rb})]})},e.id)}),!nr(r)&&S(gg,{onClick:()=>{r?.(),o.setOpen(!1)},children:S(Ys,{children:"Confirm Selection"})})]})})}const bV=e=>Object.keys(e).filter(t=>e[t]);function fV({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(sc,{placement:"bottom-end",children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Itemize By"}),S(ud,{Component:lp})]})}),S(vV,{items:[...e,lV],selectedIds:bV(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const yV=Gn({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),xV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"}),CV=Gn.raw({color:"surface.intent.danger.active"}),TV=Gn({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function wV({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=LL(n),i=FL(t,o),l=a&&i,s=a&&r<2,c=o<t?"Your line item amounts are under-allocated":"Your line item amounts are over-allocated";return R("div",{className:yV,children:[R("div",{className:xV,children:[S(Ys,{children:`${ox[e]} amount`}),S(Ys,{children:kF(t)})]}),R("div",{className:xV,children:[S(Ys,{children:"Line items total"}),S(Ys,{children:kF(o)})]}),R("div",{className:xV,children:[S(Ys,{extraClassNames:l?[CV]:void 0,children:"Difference"}),S(Ys,{extraClassNames:l?[CV]:void 0,children:(d=t,u=o,go(new U(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:c})]}),s&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:"At least 2 line items are required"})]})]});var d,u}function kV({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return S(Uh,{onSave:e,children:S(wV,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const EV=Gn({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function AV(e){const{form:t,dimensions:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:i}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:i}){const{nestedDimensions:l,dimensionLookup:s}=nV(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new U(r).div(2).round(2,U.roundDown),n=new U(r).sub(t);return[oV({amount:t.toNumber(),...structuredClone(c)}),oV({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=cc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return IL;case"BANK_TRANSFER":return RL;case"REVENUE":return PL}}(r);return df({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=eF(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=LL(e.children.map(e=>e.amount));return FL(n,r)?{form:"amount-mismatch",fields:t}:Object.keys(t).length>0?{fields:t}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:d,itemizeByOptions:iV(d,l,s),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),u.close()}});return{form:h,dimensions:l,handleAddLineItem:()=>{const e=h.state.values.children,t=e[0];h.setFieldValue("children",[...e,oV({...t,id:"",amount:0,customer:null,...c})])},handleUnitemize:()=>{const e=h.state.values.children[0];t([e]),u.close()},handleItemizeCheckboxChange:(e,t)=>{if(h.setFieldValue("itemizeByOptions",{...h.state.values.itemizeByOptions,[e]:t}),e===lV.id)return void(t||h.setFieldValue("children",h.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=l.find(t=>t.id===e);if(nr(t))return;const n={id:"",dimension:t},r=h.state.values.children.map(e=>({...e,dimensionValues:[...e.dimensionValues??[],n]}));return void h.setFieldValue("children",r)}const n=h.state.values.children.map(t=>({...t,dimensionValues:t.dimensionValues.filter(t=>t.dimension?.id!==e)}));h.setFieldValue("children",n)}}}(e),l=S(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>S(fV,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=S(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>S(kV,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(Wv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[S(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>S(gV,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),S(t.Subscribe,{selector:e=>e.values.children,children:e=>S("div",{className:EV,children:e.length<10&&R(Ic,{onClick:r,active:!1,children:[S(Ys,{children:"Add Line Item"}),S(rl,{Component:xs})]})})})]})}function IV(e){const t=cc();return S(Dv,{children:t.open&&S(AV,{...e})})}function SV({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=cc();return R(sc,{children:[S(dc,{children:e=>S(vS,{Icon:qC,popupTriggerProps:e,children:"Itemize"})}),S(IV,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(sV)),r.close()}})]})}const NV=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(sc,{children:[S(dc,{children:e=>S(RO,{onClick:n,activeTab:t,popupTriggerProps:e})}),S(PO,{conversationId:r,attachedEntityId:a})]}):S(RO,{onClick:n,activeTab:t}),RV=uf({defaultValues:YL,props:{title:"Transaction",transaction:null,activeTab:null,tabOnClick:()=>{},conversationId:null,transactionId:void 0},render:function({form:e,title:t,transaction:n,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}){const l=je(),s=PT(),c=!nr(n)&&$p(n)&&"EXPENSE"===n.type,u=d(t=>{dV(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:t}),i&&S(NV,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[S(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>R(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&S(GF,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&S(AO,{form:e}),0===t.length&&S(SV,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:u}),UL(t)&&S(vS,{Icon:qC,onClick:()=>u([t[0]]),children:"Unitemize"})]})}),c&&S(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&S(SO,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===BS.ACTIVE&&S(nF,{transaction:n}),n?.status===BS.INACTIVE&&S(rF,{transaction:n})]})})]})})}});function DV(e){return 0===e.length||UL(e)&&e.every(e=>null===e.customer)}const PV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=je();return R(N,{children:[S(e.Subscribe,{selector:e=>{return 0===(t=e.values.children).length||t.every(e=>{switch(e.lineItemType){case"invoice":return!1;case"itemized":return!0}});var t},children:t=>t&&S(e.AppField,{name:"vendor",children:e=>S(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),S(e.Subscribe,{selector:e=>e.values.frequency,children:r=>{return a&&n&&(o=t?.type,void 0!==(i=r)&&"ONE_TIME"!==i.value&&"EXPENSE"===o)&&S(e.AppField,{name:"frequency",children:e=>S(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"category",children:t=>S(tV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),MV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"glAccount",children:t=>S(aV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}});function LV({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===zC(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:a,popupTriggerProps:e,children:R($O,{children:[r?S(rO,{description:r.description||"",amount:r.amount||0,date:r.date||Nt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):S(Ys,{intent:"weak",children:"Needs Match"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const FV=uf({defaultValues:YL,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"reconciliationMatch",children:()=>S(LV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function OV({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[S(Ys,{children:pL(r?.paymentInfo?.region)??"Select region..."}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const VV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.AppField,{name:"tax.paymentInfo.region",children:()=>S(OV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),S(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>S(e.ButtonGroupField,{label:"Quarter",options:cL})}),S(e.AppField,{name:"tax.paymentInfo.year",children:e=>S(e.GenericSelectorField,{label:"Year",options:Et({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),BV=uf({defaultValues:YL,props:{transaction:null,isManual:!1},render:function({form:e,transaction:t,isManual:n}){const r=t=>{switch(t.type){case"EXPENSE":return e.setFieldValue("category",t.value),void e.setFieldValue("type","EXPENSE");case"REVENUE":return e.setFieldValue("glAccount",t.value),void e.setFieldValue("type","REVENUE");case"TAX_PAYMENT":case"TAX_EXPENSE":return e.setFieldValue("tax.paymentInfo.region",t.value),void e.setFieldValue("type","TAX_PAYMENT");case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return rr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:Ku(t.value.transfer.amount)}),rr(t.value.glAccount)&&(e.setFieldValue("glAccount",t.value.glAccount),e.setFieldValue("reviewStatus","AWAITING_MATCH"),e.setFieldValue("reconciliationMatch",void 0)),void e.setFieldValue("type","BANK_TRANSFER")}};return S(N,{children:S(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return S(PV,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return S(MV,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return S(FV,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return S(VV,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),UV=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function WV({transaction:e,bankAccount:t}){const n=e?e.description:"",r=nr(t)||nr(e)?"":((e,t)=>{const n=cx(t.type),r=zC(t.amount);return`${n?`${r} `:""}${Gu(e.name,e.mask)}`})(t,e);return R("div",{...UV,children:[S(vo,{wrap:"wrap",children:n}),t&&S(fo,{children:r})]})}const HV=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),zV=Gn({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function qV({attachments:e,onRemove:t}){return S("div",{className:HV,children:S("div",{className:zV,children:e.map(e=>S(FM,{attachment:e,onRemove:t},e.localId))})})}const jV=uf({defaultValues:YL,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["banks/transactions"]})}});return S(e.AppField,{name:"attachments",children:e=>R(N,{children:[S(e.AttachmentDropzoneField,{entityId:cs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&S(qV,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),_V=Gn({display:"flex",flexDirection:"column",gap:"8px"});function KV({children:e}){return S("div",{className:_V,children:e})}const YV=$n({base:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px 12px",backgroundColor:"surface.background",border:"1px solid",borderColor:"border.layout",borderRadius:"md",overflow:"hidden",width:"100%"},variants:{surface:{foreground:{backgroundColor:"surface.foreground"},background:{backgroundColor:"surface.background"}}}});function ZV({children:e,surface:t,style:n}){const r=Gn(YV.raw({surface:t}),n);return S("div",{className:r,children:e})}function GV(){return S(Mh,{alignment:"horizontal"})}const QV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function XV(e){return S("div",{className:QV,children:e.children})}function JV({property:e}){return"string"==typeof e?S(Ys,{children:e}):e}function $V({label:e,value:t}){return R(XV,{children:[S(JV,{property:e}),S(JV,{property:t})]})}function eB(e){return Nt(Pt(e))}function tB({amount:e,date:t,description:n}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:n}),S(GV,{}),S($V,{label:"Date",value:eB(t)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const nB=Gn.raw({padding:12});function rB({amount:e}){return S(ZV,{surface:"background",style:nB,children:S($V,{label:"Fee",value:kF(e)})})}const aB=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),oB=Gn({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function iB({label:e,warning:t}){return R("div",{className:aB,children:[S(Ys,{children:e}),t&&R("div",{className:oB,children:[S(ud,{Component:ui}),t]})]})}function lB(e){return kF(Math.abs(e))}function sB(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new U(0)),o=(i=a.toNumber(),l=r,"REVENUE"===(s=n)||"BANK_TRANSFER"===s&&l>0?i<l?"overpaid":i>l?"underpaid":"exact":"EXPENSE"===s||"BANK_TRANSFER"===s&&l<0?i>l?"overpaid":i<l?"underpaid":"exact":"exact");var i,l,s;if("exact"===o)return null;const c=a.minus(r).toNumber();return"overpaid"===o?`${lB(c)} Overpaid`:"underpaid"===o?function(e){return`${lB(e)} Underpaid`}(c):null}const cB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(KV,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?S(tB,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Invoices"}),S(rl,{Component:Qi})]})}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=TO(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:t=>{const n=kO(t);e.setFieldValue("children",n),r(!1)},hasExistingInvoices:!0,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function dB({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:kF(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.dimension?.id===e.id);return void 0===t?null:{label:e.name??"",value:t.name??""}}).filter(e=>null!==e),...null!==i?[{label:"Customer",value:i.name??""}]:[]];return S(ZV,{children:l.map((e,t)=>R(b,{children:[t>0&&S(GV,{}),S($V,{label:e.label,value:e.value.toString()})]},e.label))})}const uB=uf({defaultValues:YL,render:function({form:e}){const{query:{data:t}}=iP(),n=e.state.values.children;if(UL(n))return R(KV,{children:[S(Ys,{children:`Line Items (${n.length})`}),n.map((n,r)=>S(dB,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category??null,glAccount:n.glAccount??null,dimensionValues:n.dimensionValues,dimensions:t?.data??[],customer:n.customer},`${n.id}_${r}`)),R(sc,{children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Line Items"}),S(rl,{Component:Qi})]})}),S(IV,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(cV),onSubmit:t=>{dV(t.map(sV),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),hB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(KV,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?S(tB,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Bills"}),S(rl,{Component:Qi})]})}),S(VF,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=WF(t);0!==n&&a.push(BF(n)),e.setFieldValue("children",a),r(!1)}})]})]})}});function pB({amount:e,bankAccountName:t,date:n,description:r}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:r}),S(GV,{}),t&&R(N,{children:[S($V,{label:"Account",value:t}),S(GV,{})]}),S($V,{label:"Date",value:eB(n)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const gB=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1);return R(KV,{children:[S(iB,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?S(pB,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(sc,{open:t,onOpenChange:n,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Transactions"}),S(rl,{Component:Qi})]})}),S(pO,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,onSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)}})]})]})}}),mB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?S(cB,{form:e}):t.some(e=>"bill"===e.lineItemType)?S(hB,{form:e}):t.some(e=>"payment"===e.lineItemType)?S(gB,{form:e}):UL(t)?S(uB,{form:e}):null}});function vB({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:d}=nV(),u=void 0===i?ix[s]:lx[s],[h,p]=c(l??null),g=S(RV,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),m=S(n.Subscribe,{selector:e=>e.isDefaultValue,children:e=>S(Uh,{disabled:e})});return R(sL,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&S(WV,{transaction:e,bankAccount:r}),S(n.AppField,{name:"amount",children:e=>S(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),S(n.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),S(BV,{form:n,transaction:e,isManual:a}),S(n.Subscribe,{selector:e=>e.values.children,children:e=>function(e,t,n){const r=new Set(e.map(e=>e?.dimension?.id)),a=n.filter(e=>!r.has(e.dimension?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=VL(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,d).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>S(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>S(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(BL(e))})},r[0][0].id))}),S(n.Subscribe,{selector:e=>e.values.children,children:e=>tt(e)&&S(mB,{form:n})}),S(n.AppField,{name:"notes",children:e=>S(e.TextAreaInput,{label:"Note"})}),S(n.AppField,{name:"type",children:()=>null}),i&&S(jV,{form:n,transactionId:i})]})}function bB({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedDimensions:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedDimensions:n,dimensionLookup:r}=nV(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=rs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:tF(a,r,t),bankAccount:Lg(a?.bankAccount?.id??""),isManual:nr(a)||$p(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return S(o.Subscribe,{selector:e=>e.values.type,children:n=>S(vB,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function fB({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=rs({id:e});return u(()=>{!r&&nr(n)&&_l()},[n,r]),nr(n)?null:S(bB,{transactionId:e,initialTab:t})}function yB({transactionId:e,initialTab:t,initialType:n}){return e?S(fB,{transactionId:e,initialTab:t}):!e&&n?S(bB,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function xB({subject:e,children:t}){return R(Fv,{children:[R(Vv,{children:[S(Vu,{}),S(vo,{children:e})]}),S("div",{className:tN({alignItems:"center",gap:15}),children:t})]})}function CB({conversationId:e,defaultValues:t}){const[n,r]=c(e),{query:{data:a}}=Sl(n),o="CLOSED"===a?.resolutionStatus;return S(jP,{children:R(KP,{children:[S(xB,{subject:a?.subject??"Conversation"}),S(eL,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const TB=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_18201_5557)"},r.createElement("path",{d:"M7.5 14.0625C11.1244 14.0625 14.0625 11.1244 14.0625 7.5C14.0625 3.87563 11.1244 0.9375 7.5 0.9375C3.87563 0.9375 0.9375 3.87563 0.9375 7.5C0.9375 11.1244 3.87563 14.0625 7.5 14.0625Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_18201_5557"},r.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function wB({onClick:e,active:t}){return S(Fs,{type:"button",onClick:e,active:t,children:S(ud,{Component:TB})})}const kB=Gn({display:"flex",flexDirection:"column"});function EB({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:kB,children:[S(fo,{children:e}),n?S(ZM,{width:r}):S(vo,{wrap:"wrap",children:t??""})]})}function AB({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=rs({id:e}),a=Lg(n?.bankAccount.id??"");if(nr(n))return null;const o=JS({alignItems:"stretch",gap:5,paddingLeft:16,paddingRight:16,backgroundColor:"surface.foreground",borderWidth:0,borderBottomStyle:"solid",borderColor:"border.layout.strong",maxHeight:0,overflow:"hidden",transition:"all 300ms ease-out","&[data-open='true']":{maxHeight:"1/3",paddingTop:16,paddingBottom:16,borderWidth:"lg",overflow:"scroll"}});return R("div",{"data-open":t,className:o,children:[R("div",{className:tN({justifyContent:"space-between"}),children:[S(EB,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),S(EB,{label:"Amount",data:ho(Ku(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),S(EB,{label:"Bank Account",data:Gu(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),S(EB,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function IB({conversationId:e,transactionId:t}){const[n,r]=c(e),[a,o]=c(!0),{query:{data:i}}=Sl(n),l="CLOSED"===i?.resolutionStatus;return S(jP,{children:R(KP,{children:[S(xB,{subject:i?.subject??"Conversation",children:rr(t)&&S(wB,{onClick:()=>o(!a),active:a},"infoButton")}),rr(t)&&S(AB,{transactionId:t,isOpen:a}),S(eL,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function SB(){const e=Kl().length>1;return S(jP,{children:R(KP,{background:"foreground",children:[S(Fv,{children:R(Vv,{children:[S(Vu,e?{Icon:Gi}:{}),S(vo,{children:"Add New Connection"})]})}),S(ZE,{})]})})}function NB(){return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:"Financial Summary"})]})})}const RB=Gn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),DB=mr.raw({body:"default"}),PB=Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},DB);function MB({summaryText:e}){return S("div",{className:RB,children:S("div",{className:PB,children:e})})}const LB=Gn({display:"flex",flexDirection:"column",overflow:"auto"});function FB({summary:e}){return R("div",{className:LB,children:[S(NB,{}),S(MB,{summaryText:e})]})}const OB=Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function VB({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Rr({queryKey:vs({id:e}),queryFn:fs})}({id:e});return S(jP,{children:R("div",{className:OB,children:[S(KP,{children:S(FB,{summary:n?.summary})}),S(Mh,{}),S(tL,{conversationId:t??null,attachedEntityId:e})]})})}function BB(){return S(jP,{children:S(KP,{children:S(sA,{showCloseButton:!0,inOverlay:!0})})})}const UB=I.object({id:I.string(),name:I.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:I.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:I.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Cr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),WB={mergeDestination:Pm,selectedAccount:null};const HB=Gn({display:"flex",flexDirection:"column",gap:"20px"}),zB=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),qB=Gn.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),jB=Gn(qB,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),_B=Gn(qB,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),KB=Gn(qB,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),YB=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),ZB=Gn({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),GB=Gn({width:"100%",display:"flex",justifyContent:"flex-start"}),QB=Gn({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),XB=Gn({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),JB=e=>{Qh(e),Xh(e)};function $B({account:e}){const t=cc(),n=function(e,t){const{mutateAsync:n}=mh();return df({defaultValues:WB,onSubmit:async r=>{if(await Ch()===Su&&rr(e)&&rr(r.value.selectedAccount)){const l=(a=e,o=r.value.mergeDestination,i=r.value.selectedAccount,o===Pm?{...yh(i),duplicateBankAccountIds:[cs(a.id)]}:{...yh(a),duplicateBankAccountIds:[cs(i.id)]});try{await n(l),t.close(),r.value.mergeDestination===Pm&&_l()}catch{await Th()}}var a,o,i},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=nh();if(!(r&&r.data||a))return null;const o=r?.data?.filter(t=>t.glAccountId&&t.isSupported&&t.id!==e?.id&&t.integration?.id!==e?.integration?.id);return R("form",{className:HB,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:JB,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:zB,children:S(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:jB,children:[S("div",{className:GB,children:S(vo,{children:"Duplicate Account"})}),t===Pm?S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})})]}),R("div",{className:_B,children:[S("div",{className:QB,children:S(vo,{children:"Into"})}),S(n.AppField,{name:"mergeDestination",children:e=>S("div",{className:ZB,children:S(Fs,{onClick:()=>e.handleChange(e.state.value===Pm?Dm:Pm),children:S(ud,{Component:Qi})})})})]}),R("div",{className:KB,children:[S("div",{className:XB,children:S(vo,{children:"Destination Account"})}),t===Pm?S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})}):S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:YB,children:[S(gf,{showIcon:!1,onClick:()=>{t.close()}}),S(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>S(Nh,{disabled:nr(e),showIcon:!1,textContent:"Merge"})})]})]})}function eU({bankAccount:e}){return S(lg,{children:R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Account"})]})}),S(Av,{children:S(Nv,{children:S(vk,{children:S($B,{account:e})})})})]})})}const tU=Gn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"left",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}}),nU=({tranStartDate:e})=>R(N,{children:[S(fo,{children:"Start Date"}),Tr(e)?S(vo,{children:`${Bt(Pt(e))}`}):S(vo,{children:"Set Start Date"})]});function rU({bankAccount:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:t=>S("button",{className:Xn(or(tr["start-date-form-section"]),tU,el),...t,type:"button",children:S(nU,{tranStartDate:e.tranStartDate})})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:[e]})})})})]})}const aU=e=>["accounting/manualJournalEntry",e.id],oU=async e=>{const t=e.queryKey,n=t[2].accessToken,r=t[2].environment,a={path:"/accounting/manualJournalEntry?id={id}",pathParams:{id:t[1]},accessToken:n,environment:r};return await yi(a)};function iU({id:e}){return Rr({queryKey:aU({id:String(cs(e))}),queryFn:oU,enabled:rr(e)})}const lU=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/accounting/manualJournalEntry",bodyParams:{manualJournalEntry:e},accessToken:t,endpointManager:Na(n)};return await ka(r)})({data:e,accessToken:t,environment:n});const sU=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)},cU=I.object({amount:I.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:I.string("Required")}),dU=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===cs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},uU=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=iU({id:t??null}),r=function(){const{query:{data:e}}=Jx();return cC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutate:a}=ch({mutationFn:sU,onSuccess:async()=>{ha("beginning balance mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}}});const{mutate:o}=ch({onSuccess:async()=>{ha("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Ir.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:lU}),i=cc(),l=((e,t)=>{const n=dU(e,t);return{amount:rr(e.beginningBalanceData.journalEntry?.id)?n:"",date:rr(t?.date)?t.date:""}})(e,n);return df({defaultValues:l,validators:{onBlur:cU},onSubmit:l=>{if(i.close(),nr(t)||nr(n))a({bankAccountId:cs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(nr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>cs(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===cs(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),nr(l)?null:(o.transactions?.forEach(e=>{i.includes(e.glAccountId)&&(e.drAmount?e.drAmount=Number(e.drAmount)-l:e.crAmount&&(e.crAmount=Number(e.crAmount)-l))}),o.date=Mt(t)??o.date,o)})(n,Pt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);rr(t)&&o(t)}}})},hU=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),pU=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function gU({bankAccount:e}){const t=uU(e),n=cc(),r=()=>{n.close()};return R("form",{className:hU,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[S(vo,{children:"Set Beginning Balance"}),S(t.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),S(t.AppField,{name:"amount",children:e=>S(e.EditableAmountField,{label:"Beginning Balance Amount"})}),S(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:pU,children:[S(gf,{showIcon:!1,onClick:r}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const mU=$n({base:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"right",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}},variants:{layout:{left:{alignItems:"flex-start"},right:{alignItems:"flex-end"}}}}),vU=Gn({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function bU({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=cr(tr["beginning-balance-form-section"],mU({layout:a}),el),i=cr(tr["beginning-balance-form-section"],mU({layout:"right"}),el),l=r&&Bt(r);return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R("div",{className:vU,children:[R("button",{...o,...e,type:"button",children:[S(fo,{children:"Beginning Balance"}),S(vo,{children:rr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[S(fo,{children:"Migration Date"}),S(vo,{children:l})]})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(gU,{bankAccount:e})})})})]})}const fU=$n({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function yU({bankAccount:e,showStartDate:t}){const{query:{data:n}}=iU({id:e?.beginningBalanceData.journalEntry?.id??null}),r=dU(e,n),a=rr(n?.date)?Pt(n?.date):null,o=rr(e.tranStartDate)?Pt(e.tranStartDate):null,i=rr(a)&&rr(o)&&!At(a,o),l=i?"left":t?"right":"left";return R("div",{className:fU({layout:i?"stacked":"inline"}),children:[t&&S(rU,{bankAccount:e}),S(bU,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const xU=Gn({marginTop:"15px",marginBottom:"15px"}),CU={id:"",name:"",mask:"",type:void 0};const TU=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],wU=e=>{Qh(e),Xh(e)};function kU({bankAccountId:e}){const t=Lg(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:CU,[r,a]=c(n),o=function(e,t){const{mutate:n}=mh(),{mutateAsync:r}=gh({mutationFn:uh}),a=Tr(String(e.id));return df({defaultValues:e,validators:{onBlur:UB},onSubmit:async e=>{if(a)n(yh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((o=e.value,{apiAccountName:o.name,apiAccountNo:o.mask??void 0,apiAccountType:o.type||"DEPOSITORY",duplicateBankAccountIds:[]})),a={id:ss({id:n?.dataObject?.id,prefix:"BANK_ACCOUNT"}),name:n?.dataObject?.apiAccountName??"",mask:n?.dataObject?.apiAccountNo??"",type:e.value.type};t(a),e.formApi.reset(a,{keepDefaultValues:!0})}var o},onSubmitInvalid:()=>{}})}(r,a),i=!t||bh(t.apiName),l=!!t&&fh(t.apiName),s=Gu(r?.name??"",r?.mask??""),d=Tr(s)?s:"New Bank Account",u=l&&rr(t?.tranStartDate);return S(jP,{children:S(KP,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:wU,children:[R(Fv,{children:[R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:d}),rr(t)&&S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(eU,{bankAccount:t})})]}),S(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:S(o.SaveButton,{})})]}),R(rL,{children:[S(o.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),S(o.AppField,{name:"mask",children:e=>S(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),S(o.AppField,{name:"type",children:e=>S(e.GenericSelectorField,{label:"Account Type",options:TU,disabled:!i})}),rr(t)&&R(N,{children:[S("div",{className:xU,children:S(Mh,{alignment:"horizontal"})}),S(yU,{bankAccount:t,showStartDate:u})]})]})]})})})}function EU({filters:e,filterModels:t,setFilters:n}){const r=Kl().length>1,[a,o]=c(()=>sw(e,t));return S(jP,{children:R(KP,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,r?{Icon:Gi}:{}),S(Ys,{children:"Back"})]})}),S(rP,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),S(FA,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=uw(a);n(e),_l()}})]})})}function AU({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=LI(e);return S(EU,{filters:n,filterModels:t,setFilters:r})}function IU(){const e=CR();return S(AU,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function SU(){const e=UR();return S(AU,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function NU(){const e=_I();return S(AU,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function RU({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(lb,{popupTriggerChildrenProps:n,children:[R(mA,{children:[S(ud,{Component:e}),S(Ys,{children:t})]}),S(ud,{Component:Qi})]})}const DU=ci(aF,"Expenses");function PU(){return S(RU,{Icon:DU,label:"Categories"})}const MU=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.50005 8.39072C9.01022 8.39072 10.2345 7.16647 10.2345 5.6563C10.2345 4.14612 9.01022 2.92188 7.50005 2.92188C5.98987 2.92188 4.76562 4.14612 4.76562 5.6563C4.76562 7.16647 5.98987 8.39072 7.50005 8.39072Z"}),r.createElement("path",{d:"M11.5981 13.1742V12.4749C11.5944 11.3904 11.161 10.3516 10.3929 9.58611C9.62473 8.82059 8.58446 8.39074 7.49999 8.39075C6.4131 8.39075 5.37072 8.82251 4.60217 9.59106C3.83362 10.3596 3.40186 11.402 3.40186 12.4889V13.1882"}),r.createElement("path",{d:"M7.50011 14.4244C11.3244 14.4244 14.4245 11.3242 14.4245 7.49998C14.4245 3.67573 11.3244 0.575562 7.50011 0.575562C3.67585 0.575562 0.575684 3.67573 0.575684 7.49998C0.575684 11.3242 3.67585 14.4244 7.50011 14.4244Z"})),"Person"),LU=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function FU(e){return{id:e.id,name:e.name,status:e.status,additionalContactName:e.additionalContactName,businessName:e.businessName,email:e.email,ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoiceSettings:e.invoiceSettings,address:e.address}}function OU(e,t){return{search:Tr(e)?e:void 0,status:{in:t}}}function VU(e){return e.pages.flatMap(e=>(e.data??[]).map(FU))}const BU=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function UU(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function WU(e,t){const n=(e,n)=>HL(e=>!t(e),e,n);return{state:n("state",Cr(e.state)?void 0:e.state),city:n("city",Cr(e.city)?void 0:e.city),zip:n("zip",Cr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Cr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Cr(e.address1)?void 0:e.address1),address2:n("address2",Cr(e.address2)?void 0:e.address2)}}const HU=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:BU});function zU(e){return{id:e.id,status:e.status,name:e.name,billingContactName:e.additionalContactName||"",email:e.email||"",ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoicePrefix:e.invoiceSettings.invoicePrefix||"",address:UU(e.address)}}const qU=I.object({state:I.string(),city:I.string(),zip:I.string(),phoneWork:I.string(),address1:I.string(),address2:I.string()}),jU=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:I.string().optional(),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),email:I.email().or(I.literal("")),ccEmails:I.array(I.email()),bccEmails:I.array(I.email()),invoicePrefix:I.string().optional(),address:qU.optional()});function _U({customer:e}){const{mutateAsync:t}=Cv(),n=cc();return df({defaultValues:e??HU,validators:{onSubmit:jU},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>HL(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(BU).filter(e=>e in BU).some(e=>!n(e))?WU(e.address??BU,n):void 0,i=a("invoicePrefix",Tr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Tr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Tr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:nr(i)?void 0:{invoicePrefix:i},address:o}}(e,0,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}const KU=Object.entries({UNKNOWN:"UNKNOWN",ALABAMA:"AL",ALASKA:"AK",AMERICAN_SAMOA:"AS",ARIZONA:"AZ",ARKANSAS:"AR",CALIFORNIA:"CA",COLORADO:"CO",CONNECTICUT:"CT",DELAWARE:"DE",DISTRICT_of_COLUMBIA:"DC",FLORIDA:"FL",GEORGIA:"GA",GUAM:"GU",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",MARIANA_ISLANDS:"MP",OHIO:"OH",OKLAHOMA:"OK",OREGON:"OR",PENNSYLVANIA:"PA",PUERTO_RICO:"PR",RHODE_ISLAND:"RI",SOUTH_CAROLINA:"SC",SOUTH_DAKOTA:"SD",TENNESSEE:"TN",TEXAS:"TX",UTAH:"UT",VERMONT:"VT",VIRGIN_ISLANDS:"VI",VIRGINIA:"VA",WASHINGTON:"WA",WEST_VIRGINIA:"WV",WISCONSIN:"WI",WYOMING:"WY"}).filter(([e])=>"UNKNOWN"!==e).map(([e,t])=>({label:e.split("_").map(e=>/^[a-z]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),value:t})),YU=Gn({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),ZU=Gn({width:"100%"}),GU=hf({defaultValues:BU,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[S(e.AppField,{name:"address1",children:e=>S(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),S(e.AppField,{name:"address2",children:e=>S(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),S(e.AppField,{name:"city",children:e=>S(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:YU,children:[S("div",{className:ZU,children:S(e.AppField,{name:"state",children:()=>S(xm,{label:"State",options:[{label:"Select State",value:""},...KU],isEmpty:Cr,disabled:t})})}),S("div",{className:ZU,children:S(e.AppField,{name:"zip",children:e=>S(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),S(e.AppField,{name:"phoneWork",children:e=>S(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),QU=Gn.raw({width:"100%"});function XU({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o}){const i=PT();return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[!o&&S(Dh,{disabled:a,onClick:t}),o&&i&&S(Fs,{onClick:n,styles:QU,children:S(Ys,{children:r})}),e]})]})}const JU=Gn({display:"flex",gap:"8px"});function $U({title:e,customer:t}){const n=_U({customer:t}),[r,a]=c(n.state.values.ccEmails.length>0),[o,i]=c(n.state.values.bccEmails.length>0),{mutate:l}=Cv(),{mutate:s}=ch({mutationFn:yv,onSuccess:xv}),d=cc(),u=PT(),h="ACTIVE"===t?.status,p="INACTIVE"===t?.status,g=p&&!u,m=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({title:"Restore customer",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&(l({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),d.close())},v=h||g?S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[h&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({title:"Archive customer",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&(s({id:t?.id??""}),d.close())},closeOnClick:!0,children:"Archive"}),p&&S(vS,{onClick:m,closeOnClick:!0,children:"Restore"})]})}):null,b=g?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>S(XU,{onSave:n.handleSubmit,disabled:e||t,restoreLabel:"Restore Customer",onRestore:m,isArchived:p})});return S(Wv,{title:e,HeaderRightAction:v,Footer:b,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:p})}),S(n.AppField,{name:"billingContactName",children:e=>S(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:p})}),S(n.AppField,{name:"email",children:e=>S(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:p})}),S(n.AppField,{name:"ccEmails",children:e=>r&&S(e.MultiEmailField,{label:"CC Billing Emails",disabled:p})}),S(n.AppField,{name:"bccEmails",children:e=>o&&S(e.MultiEmailField,{label:"BCC Billing Emails",disabled:p})}),(!r||!o)&&R("div",{className:JU,children:[!r&&S(Ic,{onClick:()=>a(!0),children:"CC"}),!o&&S(Ic,{onClick:()=>i(!0),children:"BCC"})]}),S(n.AppField,{name:"invoicePrefix",children:e=>S(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:p})}),S(GU,{form:n,fields:"address",disabled:p})]})})}function eW({title:e,customer:t}){const n=cc();return S(Dv,{children:n.open&&S($U,{title:e,customer:t})})}const tW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function nW({customer:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{Component:MU}),R("div",{className:tW,children:[S(Ys,{children:e.name}),e.email&&S(fo,{children:e.email})]})]}),S(ud,{Component:Qi})]})}),S(eW,{title:"Edit Customer",customer:zU(e)})]})}const rW=Gn.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function aW({selectedValue:e,Icon:t=lp,options:n,onClick:r,additionalStyles:a=[]}){return R(sc,{children:[S(dc,{children:n=>R(Fs,{popupTriggerProps:n,styles:[rW,...a],children:[S(Ys,{children:e.label}),S(ud,{Component:t})]})}),S(vm,{options:n,onClick:r})]})}const oW=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),iW=Gn({display:"flex",gap:"8px"}),lW=Gn.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function sW({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:oW,children:[S(Ys,{intent:"weak",children:"Search"}),R("div",{className:iW,children:[S(pF,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),S(aW,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[lW]})]})]})}const cW=R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),S(Ys,{children:"Add Customer"})]})}),S(eW,{title:"Add Customer",customer:void 0})]});function dW(){const[e,t]=c(""),[n,r]=c(LU[0]),{list:a,fetchNextPage:o,canFetchNextPage:i,isLoading:l}=function({searchTerm:e,statuses:t,selected:n,onSelectedChange:r}){const{query:{data:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isFetchingNextPage:s,isPending:c}}=function(e={},t){return qm({queryFn:bv,queryKey:pv(e),...t})}({filter:OU(e,t)},{select:VU});return{list:Gv({data:[a??[]],getRowKey:e=>e.id,getGroupKey:()=>"customers",state:void 0!==n?{selected:n}:void 0,onSelectedChange:r}),data:a,fetchNextPage:o,canFetchNextPage:!i&&l,isLoading:i&&!s||c}}({searchTerm:e,statuses:n.value});return R(Wv,{title:"Back",HeaderRightAction:cW,padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:LU,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>S(CA,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>S(nW,{customer:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:i})]})}function uW(){const e=cc();return S(Dv,{children:e.open&&S(dW,{})})}function hW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:MU,label:"Customers",popupTriggerChildrenProps:e})}),S(uW,{})]})}const pW=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,strokeLinecap:"square",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.05348 1.63635V5.42983C4.05348 5.88785 3.87154 6.3271 3.54768 6.65096C3.22381 6.97483 2.78456 7.15677 2.32655 7.15677C1.86853 7.15677 1.42928 6.97483 1.10542 6.65096C0.781554 6.3271 0.599609 5.88785 0.599609 5.42983L1.97971 1.63635H4.05348Z"}),r.createElement("path",{d:"M7.50007 1.63635V5.42983C7.51534 5.66553 7.4821 5.90185 7.4024 6.12419C7.3227 6.34653 7.19825 6.55015 7.03673 6.72248C6.8752 6.8948 6.68005 7.03216 6.46333 7.12607C6.24661 7.21997 6.01293 7.26842 5.77674 7.26842C5.54055 7.26842 5.30687 7.21997 5.09015 7.12607C4.87343 7.03216 4.67828 6.8948 4.51676 6.72248C4.35524 6.55015 4.23078 6.34653 4.15108 6.12419C4.07139 5.90185 4.03815 5.66553 4.05342 5.42983V1.63635H7.50007Z"}),r.createElement("path",{d:"M10.9468 1.63635V5.42983C10.9621 5.66553 10.9289 5.90185 10.8492 6.12419C10.7695 6.34653 10.645 6.55015 10.4835 6.72248C10.322 6.8948 10.1268 7.03216 9.91011 7.12607C9.69339 7.21997 9.45971 7.26842 9.22352 7.26842C8.98733 7.26842 8.75365 7.21997 8.53693 7.12607C8.32021 7.03216 8.12506 6.8948 7.96354 6.72248C7.80201 6.55015 7.67756 6.34653 7.59786 6.12419C7.51817 5.90185 7.48493 5.66553 7.5002 5.42983V1.63635H10.9468Z"}),r.createElement("path",{d:"M14.4007 5.42983C14.4007 5.88785 14.2187 6.3271 13.8948 6.65096C13.571 6.97483 13.1317 7.15677 12.6737 7.15677C12.2157 7.15677 11.7764 6.97483 11.4526 6.65096C11.1287 6.3271 10.9468 5.88785 10.9468 5.42983V1.63635H13.0205L14.4007 5.42983Z"}),r.createElement("path",{d:"M13.0206 7.15678V13.3636H1.97974V7.15678H2.32657C2.55335 7.15678 2.77792 7.11211 2.98744 7.02532C3.19696 6.93854 3.38734 6.81133 3.5477 6.65097C3.70806 6.49061 3.83526 6.30023 3.92205 6.09071C4.00884 5.88119 4.05351 5.65662 4.05351 5.42984C4.03824 5.66554 4.07148 5.90186 4.15117 6.12419C4.23087 6.34653 4.35532 6.55016 4.51685 6.72248C4.67837 6.89481 4.87352 7.03217 5.09024 7.12607C5.30696 7.21998 5.54064 7.26842 5.77683 7.26842C6.01302 7.26842 6.2467 7.21998 6.46342 7.12607C6.68014 7.03217 6.87529 6.89481 7.03681 6.72248C7.19834 6.55016 7.32279 6.34653 7.40249 6.12419C7.48218 5.90186 7.51542 5.66554 7.50015 5.42984C7.48488 5.66554 7.51812 5.90186 7.59782 6.12419C7.67752 6.34653 7.80197 6.55016 7.96349 6.72248C8.12502 6.89481 8.32017 7.03217 8.53689 7.12607C8.75361 7.21998 8.98729 7.26842 9.22348 7.26842C9.45967 7.26842 9.69335 7.21998 9.91007 7.12607C10.1268 7.03217 10.3219 6.89481 10.4835 6.72248C10.645 6.55016 10.7694 6.34653 10.8491 6.12419C10.9288 5.90186 10.9621 5.66554 10.9468 5.42984C10.9468 5.65662 10.9915 5.88119 11.0783 6.09071C11.165 6.30023 11.2922 6.49061 11.4526 6.65097C11.613 6.81133 11.8033 6.93854 12.0129 7.02532C12.2224 7.11211 12.447 7.15678 12.6737 7.15678H13.0206Z"}),r.createElement("path",{d:"M10.2604 9.91696H4.73999V13.3636H10.2604V9.91696Z"})),"Vendor"),gW=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:BU,transactionCount:0,iconUrl:void 0});function mW(e){return{id:e.id,name:e.name,status:e.status,address:UU(e.address),transactionCount:e.transactionCount,iconUrl:e.iconUrl||void 0}}const vW=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),address:qU.optional(),transactionCount:I.number(),iconUrl:I.string().optional()});const bW=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function fW(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address,transactionCount:e.transactionCount}}function yW(e,t,n){return{search:Tr(e)?e:void 0,name:nr(n)?void 0:{notEqual:n},status:{in:t}}}function xW(e){return e.pages.flatMap(e=>(e.data??[]).map(fW))}function CW({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:yW(e,t,n)},u={select:xW},qm({queryFn:Gm,queryKey:_m(d),...u}));var d,u;return{list:Gv({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"vendors",state:void 0!==r?{selected:r}:void 0,onSelectedChange:a}),data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isLoading:l&&!c}}const TW=ci(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.4375 7.5H0.3125",strokeMiterlimit:10}),r.createElement("path",{d:"M8.6626 2.72498L13.4376 7.49998L8.6626 12.275",strokeMiterlimit:10})),"LongArrowRight"),wW=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),kW=Gn({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),EW=$n({base:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"8px",padding:"8px",borderWidth:"md",borderColor:"border.layout",borderStyle:"solid",flex:"1",minWidth:"0"},variants:{archivedVendor:{true:{backgroundColor:"surface.background"},false:{backgroundColor:"surface.foreground"}}}}),AW=Gn({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),IW=Gn({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function SW({targetVendor:e,duplicateVendor:t}){return R("div",{className:wW,children:[S(Ys,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:kW,children:[R("div",{className:EW({archivedVendor:!0}),children:[S(ud,{imageUrl:t.iconUrl,Component:pW}),S(Ys,{intent:"weak",children:t.name})]}),R("div",{className:AW,children:[S(ud,{Component:TW,stylists:[cr(null,IW)]}),S(fo,{intent:"weak",children:"Merging Into"})]}),R("div",{className:EW({archivedVendor:!1}),children:[S(ud,{imageUrl:e.iconUrl,Component:pW}),S(Ys,{children:e.name})]})]}),S(Ys,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function NW({vendor:e,onClose:t}){const{mutate:n}=ch({mutationFn:ev,onSuccess:tv}),[r,a]=c({}),[o,i]=c(""),{list:l,data:s,fetchNextPage:d,isFetching:u,hasNextPage:h,isLoading:p}=CW({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=cc(),m=S(Uh,{onSave:async()=>{const a=Object.keys(r).find(e=>r[e]),o=s?.find(e=>e.id===a);if(!o)return;const i={name:o.name,iconUrl:o.iconUrl||void 0};"MERGE"===await async function({targetVendor:e,duplicateVendor:t}){return ju({title:"Confirm Merge",body:S(SW,{targetVendor:e,duplicateVendor:t}),cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"action",key:"MERGE",label:"Merge"}]}).then(e=>"MERGE"===e?"MERGE":"CANCEL").catch(()=>"CANCEL")}({targetVendor:i,duplicateVendor:e})&&(n({targetId:o.id,duplicateId:e.id??""}),t()),g.close()},disabled:p||Object.values(r).every(e=>!e)});return R(Wv,{title:"Back",Footer:m,padChildren:!0,children:[S(pF,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>S(CA,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>S(sb,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(mA,{children:[S(ld,{imageUrl:e.value.iconUrl??void 0,Component:pW}),S(Ys,{children:e.value.name})]})},e.value.id))},e.key)),S(TF,{onIntersect:d,enable:!u&&h})]})}function RW({vendor:e,onClose:t}){const n=cc();return S(Dv,{children:n.open&&S(NW,{vendor:e,onClose:()=>{t(),n.close()}})})}function DW({vendor:e,onClose:t}){return R(sc,{children:[S(dc,{children:e=>S(vS,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),S(RW,{vendor:e,onClose:t})]})}const PW=Gn.raw({width:"100%"});function MW({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o}){const i=PT();return S(XU,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,children:i&&!nr(e)&&R(sc,{children:[S(dc,{children:e=>S(Fs,{popupTriggerProps:e,styles:PW,children:S(Ys,{children:"Merge"})})}),S(RW,{vendor:e,onClose:r})]})})}function LW({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=nv(),n=cc();return df({defaultValues:e??gW,validators:{onSubmit:vW},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(BU).filter(e=>e in BU).some(e=>!t(e))?WU(e.address??BU,t):void 0;return{id:e.id,name:e.name,address:n}}(e,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}({vendor:t}),{mutate:r}=ch({mutationFn:$m,onSuccess:tv}),{mutate:a}=nv(),o=cc(),i=PT(),l="ACTIVE"===t?.status,s="INACTIVE"===t?.status,c=!nr(t?.transactionCount)&&t.transactionCount>0,d=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({title:"Restore vendor",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&(a({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),o.close())},u=l&&(!i||l&&!c),h=s&&!i,p=nr(t)||!u&&!h?null:S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[s&&S(vS,{onClick:d,closeOnClick:!0,children:"Restore"}),!i&&S(DW,{vendor:t,onClose:()=>o.close()}),l&&!c&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({title:"Archive vendor",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&(r({id:t?.id??""}),o.close())},closeOnClick:!0,children:"Archive"})]})}),g=s&&!i?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:r})=>S(MW,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>o.close(),disabled:e||r,isArchived:s})});return S(Wv,{title:e,HeaderRightAction:p,Footer:g,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:s,maxLength:255})}),S(GU,{form:n,fields:"address",disabled:s})]})})}function FW({title:e,vendor:t}){const n=cc();return S(Dv,{children:n.open&&S(LW,{title:e,vendor:t})})}const OW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function VW({vendor:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{imageUrl:e.iconUrl??void 0,Component:pW}),S("div",{className:OW,children:S(Ys,{children:e.name})})]}),S(ud,{Component:Qi})]})}),S(FW,{title:"Edit Vendor",vendor:mW(e)})]})}function BW(){const[e,t]=c(""),[n,r]=c(bW[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=CW({searchTerm:e,statuses:n.value}),d=PT();return R(Wv,{title:"Back",HeaderRightAction:R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),!d&&S(Ys,{children:"Add Vendor"})]})}),S(FW,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:bW,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>S(CA,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>S(VW,{vendor:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:!i&&l})]})}function UW(){const e=cc();return S(Dv,{children:e.open&&S(BW,{})})}function WW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:pW,label:"Vendors",popupTriggerChildrenProps:e})}),S(UW,{})]})}const HW=Gn({padding:"16px"});function zW(){const e=ln(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return S(jP,{children:R(KP,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:"Back"})]})}),S("div",{className:HW,children:R(CA,{label:"Transaction Settings",children:[e&&S(PU,{}),S(WW,{}),S(hW,{})]})})]})})}function qW(){return R(UP,{children:[S(HP,{name:"BankTransactionForm",Component:yB}),S(HP,{name:"Conversation",Component:CB}),S(HP,{name:"MobileConversation",Component:IB}),S(HP,{name:"FinancialSummary",Component:VB}),S(HP,{name:"BanksAndIntegrations",Component:BB}),S(HP,{name:"BankAccountForm",Component:kU}),S(HP,{name:"NewConnection",Component:SB}),S(HP,{name:"TransactionsFilterList",Component:NU}),S(HP,{name:"ExpensesFilterList",Component:IU}),S(HP,{name:"RevenueFilterList",Component:SU}),S(HP,{name:"TransactionSettingsDrawer",Component:zW})]})}const jW=({environment:e,children:t})=>S(Sr.Provider,{value:e,children:t});function _W({children:e}){const{query:{data:t}}=ki(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?ss({id:t.companyId,prefix:"COMPANY"}):void 0,customerPartnerId:t?.customerPartnerId,apiPartnerName:t?.apiPartnerName,clientId:t?.clientId,unitIntegrationBankName:t?.unitIntegrationBankName??null,supportedIntegrations:t?.supportedIntegrations??[],isDfy:t?.isDfy??!1,hasBookkeeper:t?.isDfy||!1};return S(Lc.Provider,{value:n,children:e})}const KW=e=>["whiteLabels",e??{}],YW=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ZW({children:e}){const t=Ci(),{query:{data:n}}=fl({queryKey:KW({filter:{name:{equal:t}}}),queryFn:YW}),r={icons:n?.data?.[0]?.icons};return S(li.Provider,{value:r,children:e})}const GW=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const QW="SSE connection failed with status";function XW({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Nr();u(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Sa[o]}/sse/v1/subscribe`);var o;return a.searchParams.append("customerPartnerId",n),t.forEach(e=>a.searchParams.append("events",e)),r&&a.searchParams.append("companyId",r),a.toString()}(r,n,t,e);let i=0;return He(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${QW} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case GW.CONNECTED:return void ha("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case GW.ERROR:throw pa({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case GW.CACHE_BUST:return ha("cache bust event received",{sseTypes:JSON.stringify(Array.from(r))}),void function(e){try{const t=JSON.parse(e);Array.isArray(t)&&t.forEach(e=>{setTimeout(()=>{Ir.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>pa({error:e,severity:"error"}))},500*Math.random()),ha(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void pa({error:t instanceof Error?t:new Error("JSON parse error"),severity:"error",extraData:{data:e}})}}(t)}}({event:a.event,data:a.data,env:r,sseTypes:n,customerPartnerId:t,companyId:e}),onclose:()=>function(){throw pa({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(QW))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>pa({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const JW=[GW.CACHE_BUST];function $W({children:e}){const{companyId:t,customerPartnerId:n}=l(Lc);return XW({companyId:t,customerPartnerId:n,sseTypes:JW}),e}const eH=i({dimensions:{width:null,height:null}}),tH="undefined"!=typeof window?g:u,nH="undefined"==typeof window;const rH=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;nH&&(t=!1);const[n,r]=c(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=KT(r,e.debounceDelay,{leading:!0});function i(){(e.debounceDelay?o:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const o=a(t);tH(()=>{o.current=t},[t]),u(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{o.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",i),tH(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return S(eH.Provider,{value:r,children:e})},aH=({children:e})=>{const{dimensions:t}=l(eH),n=rr(t.width)&&t.width<parseInt(To("sizes.breakpoint-xl"));return S(DT.Provider,{value:n,children:e})};function oH({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return u(()=>{var e,r;e=n,r=t,la.setProperties(da),ca=r,sa=e},[n,t]),S(jW,{environment:t,children:S(MP,{children:S(wr.Provider,{value:r,children:S(_W,{children:S(ZW,{children:S($W,{children:S(rH,{children:R(aH,{children:[S(ye.ConfirmationRoot,{}),e,S(qW,{})]})})})})})})})})}const iH={FinancialOverview:{path:"/",element:S(rk,{})},FinancialOverviewDashboard:{path:"/",element:S(rk,{})}};function lH({children:e,initialNav:t}){const n=Re(),r=Fe(),i=a(void 0),l=d(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),s=d(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),c=d(e=>{const t=iH[e.page].path;t!==r.pathname&&(ln.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&jl(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);u(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&jl(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:c,registerAnchor:s,location:r,initialPageProps:t.pageProps}),[r,c,s,t.pageProps]);return S(vd.Provider,{value:p,children:e})}function sH({accessToken:e,environment:t="PRODUCTION",initialNav:n={page:"FinancialOverview"}}){return S(oH,{environment:t,accessToken:e,children:S(Oe,{initialEntries:[iH[n.page].path],children:S(lH,{initialNav:n,children:S(Ve,{children:Object.entries(iH).map(([e,t])=>S(Be,{path:t.path,element:t.element},e))})})})})}const cH=["BanksAndIntegrations"],dH={FinancialOverview:!0},uH=new Set(Object.values(ii).flatMap(e=>Object.values(e)));function hH(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!dH[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&cH.includes(i)){const e=function(e){if("BanksAndIntegrations"===e)return{name:e}}(a);void 0!==e&&(o=e)}var i,l;if("FinancialOverview"===n||"FinancialOverviewDashboard"===n){const e=t.searchParams.get("bkAnchor"),r=null!==(l=e)&&uH.has(l)?e:void 0,a=function(e){const t=e.get("bkPage_period_month"),n=e.get("bkPage_period_year");if(null===t||null===n)return;const r=parseInt(t,10),a=parseInt(n,10);return!Number.isInteger(r)||r<0||r>11||!Number.isInteger(a)||a<2e3||a>2100?void 0:{month:r,year:a}}(t.searchParams),i=void 0!==a?{period:a}:void 0;return void 0!==r&&void 0!==o?{page:n,anchor:r,drawer:o,...void 0!==i?{pageProps:i}:{}}:void 0!==r?{page:n,anchor:r,...void 0!==i?{pageProps:i}:{}}:void 0!==o?{page:n,drawer:o,...void 0!==i?{pageProps:i}:{}}:{page:n,...void 0!==i?{pageProps:i}:{}}}return void 0!==o?{page:n,drawer:o}:{page:n}}export{uA as BanksAndIntegrations,OR as ExpenseDashboard,rk as FinancialOverview,zR as IncomeDashboard,RP as ReportDashboard,oH as Tight,sH as TightApp,fR as TransactionsDashboard,hH as parseNavUrl,yn as useOptions};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|